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 |
|---|---|---|---|---|---|---|---|---|---|---|
fuxi/common/thirdparty/theHarvester/parsers/myparser.py | cocobear/fuxi | 731 | 1655754 | <reponame>cocobear/fuxi
import re
class Parser:
def __init__(self, results, word):
self.results = results
self.word = word
self.temp = []
async def genericClean(self):
self.results = self.results.replace('<em>', '').replace('<b>', '').replace('</b>', '').replace('</em>', '')\... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/hlk_sw16/__init__.py | tbarbette/core | 30,023 | 1655767 | <gh_stars>1000+
"""Tests for the Hi-Link HLK-SW16 integration."""
| 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/constructor9.py | sasano8/pyright | 4,391 | 1655775 | # This sample validates that type(self) can be instantiated without
# error even if the class is abstract.
from abc import ABC, abstractmethod
from typing import TypeVar
_ASub = TypeVar("_ASub", bound="A")
class A(ABC):
@abstractmethod
def some_method(self) -> str:
...
def some_factory_method_1... | 1 | 3 | 0 | 0 | 4 | 0 |
python/ql/test/library-tests/filters/generated/sphinx.py | vadi2/codeql | 4,036 | 1655831 | <reponame>vadi2/codeql<gh_stars>1000+
# -*- coding: utf-8 -*-
# Autogenerated by Sphinx on Mon May 16 13:41:38 2016
topics = {'assert': '\n' }
| 0 | 0 | 0 | 0 | 0 | 0 |
orio-0.1.0/src/module/loop/codegen.py | nn4ip/pluto | 183 | 1655866 | <reponame>nn4ip/pluto
#
# The code generator (i.e. unparser) for the AST classes
#
import sys
import ast
#-------------------------------------------------
class CodeGen:
'''The code generator for the AST classes'''
def __init__(self):
'''To instantiate a code generator'''
pass
#-------... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_datasets/scripts/documentation/build_community_catalog.py | justHungryMan/datasets | 3,380 | 1655889 | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... | 19 | 30 | 9 | 0 | 58 | 0 |
models/classifier.py | ShannonAI/dice_loss_for_NLP | 143 | 1655913 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# file: modules.py
# description:
# modules for building models.
from __future__ import annotations
import math
import torch
import torch.nn as nn
from torch.nn import init
from torch.nn import functional as F
def truncated_normal_(tensor, mean: int=0, std: int=1) -> o... | 7 | 5 | 0 | 0 | 12 | 0 |
aiofile/utils.py | cclauss/aiofile | 311 | 1655921 | <filename>aiofile/utils.py<gh_stars>100-1000
import asyncio
import collections.abc
import io
import os
from abc import ABC, abstractmethod
from pathlib import Path
from types import MappingProxyType
from typing import Any, Tuple, Union
from .aio import AIOFile, FileIOType
ENCODING_MAP = MappingProxyType({
"utf-8... | 0 | 0 | 0 | 0 | 0 | 0 |
fwordctf2020/secret_array/sol.py | nhtri2003gmail/ctf-write-ups | 101 | 1655922 | <filename>fwordctf2020/secret_array/sol.py
#!/usr/bin/env python
from pwn import *
p = remote('secretarray.fword.wtf', 1337)
context.log_level = 'INFO'
context.log_file = 'foo.log'
p.recvuntil('START:\n')
n = 1337 * [0]
p.sendline('0 1')
a = int(p.recvline().strip())
p.sendline('0 2')
b = int(p.recvline().strip())
... | 0 | 0 | 0 | 0 | 0 | 0 |
twitter_vae_charlevel.py | stas-semeniuta/textvae | 211 | 1655963 | <gh_stars>100-1000
import argparse
import numpy
import theano
import theano.tensor as T
from databases.lm_reconstruction_database import LmReconstructionDatabase
from databases.twitter_reconstruction_database import TwitterReconstructionDatabase
from vae import Sampler, Dropword, Store, LMReconstructionModel
from nn.l... | 0 | 0 | 0 | 0 | 0 | 0 |
deeppavlov/dataset_readers/intent_catcher_reader.py | ryaolga260/DeepPavlov | 5,893 | 1655979 | # Copyright 2018 Neural Networks and Deep Learning lab, MIPT
# 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... | 1 | 1 | 0 | 0 | 2 | 0 |
trainer/result_pack.py | merlinarer/scrl | 102 | 1656013 | from __future__ import annotations
from collections import OrderedDict
import logging
import os
import pandas as pd
import seaborn as sns
import torch
log = logging.getLogger('main')
class ResultPack(object):
def __init__(self, exp_name, columns: object | None=None, metadata: dict[object,object]={}):
se... | 4 | 10 | 0 | 2 | 16 | 0 |
python/tests/unit/checker/security_risk.py | justinforbes/depthcharge | 133 | 1656020 | # SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
#
# pylint: disable=missing-function-docstring,missing-module-docstring
from unittest import TestCase
from depthcharge.checker import SecurityRisk, SecurityImpact
class TestSecurityRisk(TestCase):
"""
Unit tests... | 0 | 0 | 0 | 0 | 0 | 0 |
client/verta/verta/tracking/__init__.py | fool-sec-review/modeldb | 835 | 1656030 | # -*- coding: utf-8 -*-
"""Project and experiment tracking."""
from ._context import _Context
| 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_332.py | ksvr444/daily-coding-problem | 1,921 | 1656034 | def get_variables(m, n) -> object:
candidates = list()
for a in range(m // 2 + 1):
b = m - a
if a ^ b == n:
candidates.append((a, b))
return candidates
# Tests
assert get_variables(100, 4) == [(48, 52)]
| 0 | 1 | 0 | 0 | 1 | 0 |
QuickPotato/utilities/decorators.py | JoeyHendricks/QuickPotato | 130 | 1656079 | from QuickPotato.harness.results import BoundariesTestEvidence
from functools import wraps
from datetime import datetime
def save_boundary_evidence(fnc) -> object:
"""
Parameters
----------
fnc
Returns
-------
"""
@wraps(fnc)
def encapsulated_function(*args, **kwargs) -> object... | 0 | 2 | 0 | 0 | 2 | 0 |
python/setup.py | apenasisso/abba | 117 | 1656104 | <filename>python/setup.py<gh_stars>100-1000
from distutils.core import setup
import abba
setup(
name="ABBA",
version=abba.__version__,
description='Tools for statistical analysis of A/B test results',
author='<NAME>',
author_email='<EMAIL>',
url='http://www.thumbtack.com/labs/abba/',
licen... | 0 | 0 | 0 | 0 | 0 | 0 |
pysph/sph/swe/basic.py | nauaneed/pysph | 293 | 1656121 | from __future__ import annotations
"""
Basic Equations for solving shallow water problems
#####################
"""
from pysph.sph.equation import Equation
from pysph.sph.integrator_step import IntegratorStep
from pysph.sph.integrator import Integrator
from compyle.api import declare
from pysph.sph.wc.linalg import gj... | 67 | 10 | 0 | 13 | 90 | 0 |
src/hg/utils/otto/nextstrainNcov/cladeColors.py | andypohl/kent | 171 | 1656214 | <reponame>andypohl/kent
# Nextstrain colors encoded as RGB integers for misuse as Newick branch lengths
cladeBogusLengths = { 'A1a': 4803553, 'A2': 4948969, 'A2a': 6073807,
'A3': 7849892, 'A6': 10146938, 'A7': 11386193,
'B': 15322442, 'B1': 16756801, 'B2': 16742965,
... | 0 | 0 | 0 | 0 | 0 | 0 |
qt__pyqt__pyside__pyqode/pyqt5__move_child_on_center__parent_widget.py | DazEB2/SimplePyScripts | 117 | 1656229 | <filename>qt__pyqt__pyside__pyqode/pyqt5__move_child_on_center__parent_widget.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5 import Qt
class MainWindow(Qt.QMainWindow):
def __init__(self):
super().__init__()
self.widget = Qt.QWidget()
self.widget.r... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/api/multithreaded/some_cmd.py | mkinsner/llvm | 2,338 | 1656239 | <reponame>mkinsner/llvm
""" Test command for checking the Python commands can run in a stop-hook """
import lldb
did_run = False
class SomeCommand:
def __init__(self, debugger, unused):
self.dbg = debugger
def __call__(self, debugger, command, exe_ctx, result):
global did_run
did_run =... | 0 | 0 | 0 | 0 | 0 | 0 |
rlbench/tasks/scoop_with_spatula.py | vonHartz/RLBench | 619 | 1656266 | from rlbench.backend.task import Task
from typing import List
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor
from rlbench.backend.conditions import GraspedCondition, DetectedCondition
class ScoopWithSpatula(Task):
def init_task(self) -> None:
spatula = Sh... | 1 | 3 | 0 | 0 | 4 | 0 |
hummingbot/strategy/__utils__/trailing_indicators/base_trailing_indicator.py | BGTCapital/hummingbot | 3,027 | 1656282 | from abc import ABC, abstractmethod
import numpy as np
import logging
from ..ring_buffer import RingBuffer
pmm_logger = None
class BaseTrailingIndicator(ABC):
@classmethod
def logger(cls) -> object:
global pmm_logger
if pmm_logger is None:
pmm_logger = logging.getLogger(__name__)
... | 3 | 6 | 0 | 0 | 9 | 0 |
skipper-lib/skipper_lib/events/exchange_receiver.py | muraligmenon/gkipper | 162 | 1656299 | import pika
import requests
class ExchangeReceiver(object):
def __init__(self, username, password, host, port, exchange, exchange_type, service, service_name, logger):
self.service_worker = service
self.service_name = service_name
self.exchange = exchange
self.logger = logger
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/hello_blueenvelope31.py | saurabhcommand/Hello-world | 1,428 | 1656302 | <gh_stars>1000+
print("Hello blueenvelope31")
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/cpp_examples_for_doxygen.py | VincentRouvreau/gudhi-devel | 146 | 1656303 | <gh_stars>100-1000
import os
import glob
for gd_mod in glob.glob("src/*/"):
mod_files = []
for paths in [gd_mod + 'utilities', gd_mod + 'example']:
if os.path.isdir(paths):
for root, dirs, files in os.walk(paths):
for file in files:
if file.endswith(".cpp... | 0 | 0 | 0 | 0 | 0 | 0 |
fnet/cli/train_model.py | hsiaoyi0504/pytorch_fnet | 135 | 1656342 | <reponame>hsiaoyi0504/pytorch_fnet
"""Trains a model."""
from pathlib import Path
from typing import Callable, Dict, List, Optional
import argparse
import copy
import datetime
import inspect
import json
import logging
import os
import pprint
import time
import numpy as np
import torch
from fnet.cli.init import save... | 0 | 0 | 0 | 0 | 0 | 0 |
noisemaker/scripts/artmaker.py | Kulinark/py-noisemaker | 106 | 1656390 | <reponame>Kulinark/py-noisemaker
from enum import Enum
import json
import click
import tensorflow as tf
from noisemaker.util import logger, dumps, save
import noisemaker.cli as cli
import noisemaker.generators as generators
import noisemaker.old_presets as presets
import noisemaker.value as value
@click.command(h... | 0 | 0 | 0 | 0 | 0 | 0 |
brainstorm/layers/binomial_cross_entropy_layer.py | PyCN/brainstorm | 1,473 | 1656393 | <gh_stars>1000+
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
from collections import OrderedDict
from brainstorm.layers.base_layer import Layer
from brainstorm.structure.buffer_structure import (BufferStructure,
... | 0 | 0 | 0 | 0 | 0 | 0 |
hypergan/losses/qp_loss.py | limberc/HyperGAN | 889 | 1656429 | <reponame>limberc/HyperGAN
#https://arxiv.org/pdf/1811.07296.pdf
import hyperchamber as hc
from functools import reduce
from hypergan.losses.base_loss import BaseLoss
class QPLoss(BaseLoss):
"""https://arxiv.org/abs/1811.07296"""
def _forward(self, d_real, d_fake):
gan = self.gan
pq = d_real
... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/multi_input.py | determinant-io/aboleth | 117 | 1656467 | <reponame>determinant-io/aboleth
#! /usr/bin/env python3
"""Example of using different input layers for different input types."""
import tempfile
import urllib.request as req
import numpy as np
import tensorflow as tf
import pandas as pd
from sklearn.metrics import log_loss, accuracy_score
import aboleth as ab
# Da... | 0 | 0 | 0 | 0 | 0 | 0 |
czsc/utils/ta1.py | mylovage/czsc | 206 | 1656468 | # coding: utf-8
"""
常用技术分析指标:MA, MACD, BOLL
使用 ta-lib 可以大幅提升计算性能,10倍左右
"""
import numpy as np
import talib as ta
SMA = ta.SMA
EMA = ta.EMA
MACD = ta.MACD
def KDJ(close: np.array, high: np.array, low: np.array) -> tuple[object, object, object]:
"""
:param close: 收盘价序列
:param high: 最高价序列
:param low:... | 4 | 2 | 0 | 0 | 6 | 0 |
ssm/__init__.py | adelaneh/ssm | 208 | 1656477 | # Default imports for SSM
from .hmm import *
from .lds import * | 0 | 0 | 0 | 0 | 0 | 0 |
compiler/nnc/utils/model_runner/common_place.py | bogus-sudo/ONE-1 | 255 | 1656523 | <filename>compiler/nnc/utils/model_runner/common_place.py<gh_stars>100-1000
import h5py
import argparse
from argparse import RawTextHelpFormatter
def regular_step():
"""
This function is intended to decompose the necessary steps to obtain information from the command line.
:return: argparse object, which... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/examples/socketio/__init__.py | hpdumm/py4web | 133 | 1656532 | from __future__ import annotations
from py4web import action, request
# pls, run socketio server - look at utils/wsservers.py
# test example for python-socketio
@action("socketio/index")
@action.uses("socketio/index.html")
def index() -> dict[object,object]:
return dict()
@action('socketio/echo/<path:path>', m... | 1 | 1 | 0 | 0 | 2 | 0 |
examples/diagrams/example_dag.py | baajur/airflow-diagrams | 128 | 1656555 | from diagrams import Diagram
from diagrams.generic.blank import Blank
with Diagram("example_dag", show=False):
run_this_1 = Blank("run_this_1")
run_this_2a = Blank("run_this_2a")
run_this_3 = Blank("run_this_3")
run_this_2b = Blank("run_this_2b")
run_this_1 >> run_this_2a
run_this_2a >> ru... | 0 | 0 | 0 | 0 | 0 | 0 |
onnx2torch/node_converters/batch_norm.py | niobeus/onnx2torch | 144 | 1656561 | <gh_stars>100-1000
__all__ = []
import torch
from torch import nn
from onnx2torch.node_converters.registry import add_converter
from onnx2torch.onnx_graph import OnnxGraph
from onnx2torch.onnx_node import OnnxNode
from onnx2torch.utils.common import OnnxMapping
from onnx2torch.utils.common import OperationConverterRe... | 0 | 0 | 0 | 0 | 0 | 0 |
sleap/io/legacy.py | preeti98/sleap | 156 | 1656574 | from __future__ import annotations
"""
Module for legacy LEAP dataset.
"""
import json
import os
import numpy as np
import pandas as pd
from typing import List
from sleap.util import json_loads
from sleap.io.video import Video
from sleap.instance import (
LabeledFrame,
PredictedPoint,
PredictedInstance,
... | 8 | 4 | 0 | 0 | 12 | 0 |
retrievers/ANCE/evaluation/convert_trec.py | vishalbelsare/OpenMatch | 403 | 1656580 | import glob
import pickle
import os
import tqdm
data_type=1
test_set=0
processed_data_dir = "../data/raw_data/ann_data_roberta-base_512/"
trec_save_path = glob.glob(f"data-type-{data_type}_test-set-{test_set}_ckpt-*.trec")
with open(os.path.join(processed_data_dir,'qid2offset.pickle'),'rb') as f:
qid2offset = pi... | 0 | 0 | 0 | 0 | 0 | 0 |
smdebug/profiler/analysis/notebook_utils/metrics_histogram.py | sophiayue1116/sagemaker-debugger | 133 | 1656605 | # Standard Library
from __future__ import annotations
import re
# Third Party
import numpy as np
from bokeh.io import output_notebook, push_notebook, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
output_notebook(hide_banner=True)
class Metr... | 7 | 2 | 0 | 7 | 16 | 0 |
docs/guide/settings-1-get.py | iacopoff/climetlab | 182 | 1656608 | <reponame>iacopoff/climetlab
import climetlab as cml
# Access one of the settings
cache_path = cml.settings.get("cache-directory")
print(cache_path)
# If this is the last line of a Notebook cell, this
# will display a table with all the current settings
cml.settings
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_create_template.py | yashtodi94/cookiecutter-pytest-plugin | 223 | 1656621 | <filename>tests/test_create_template.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
test_create_template
--------------------
"""
import os
import pytest
import subprocess
def run_tox(plugin):
"""Run the tox suite of the newly created plugin."""
try:
subprocess.check_call([
'tox',
... | 0 | 0 | 0 | 0 | 0 | 0 |
volttron/platform/agent/cron.py | rmay-intwine/volttron | 406 | 1656658 | <reponame>rmay-intwine/volttron
__import__('warnings').warn(
'Module {} is deprecated in favor of volttron.platform.scheduling '
'and will be removed in a future version.'.format( __name__),
DeprecationWarning)
from volttron.platform.scheduling import cron as schedule, parse_cron_string | 0 | 0 | 0 | 0 | 0 | 0 |
pypeit/deprecated/pypsetup.py | ykwang1/PypeIt | 107 | 1656666 | from __future__ import annotations
"""
Core IO methods for the PypeIt setup.
THIS MODULE IS NOW DEPRECATED AND LIKELY TO BE REMOVED
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import os
import glob
import string
import numpy as np
import yaml
import linetools.utils
from... | 7 | 8 | 0 | 0 | 15 | 0 |
src/pytorch_metric_learning/trainers/__init__.py | cwkeam/pytorch-metric-learning | 4,357 | 1656668 | <reponame>cwkeam/pytorch-metric-learning
from .base_trainer import BaseTrainer
from .cascaded_embeddings import CascadedEmbeddings
from .deep_adversarial_metric_learning import DeepAdversarialMetricLearning
from .metric_loss_only import MetricLossOnly
from .train_with_classifier import TrainWithClassifier
from .twostre... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/staticExpressions1.py | Microsoft/pyright | 3,934 | 1656679 | <filename>packages/pyright-internal/src/tests/samples/staticExpressions1.py
# This sample tests static expression forms that are supported
# in the binder.
import sys
import os
x: int
if sys.platform == "linux":
x = 1
else:
x = "error!"
if sys.version_info >= (3, 9):
x = 1
else:
x = "error!"
if os.... | 0 | 0 | 0 | 0 | 0 | 0 |
doubleml/double_ml_data.py | SvenKlaassen/doubleml-for-py | 103 | 1656694 | from __future__ import annotations
import numpy as np
import pandas as pd
import io
from sklearn.utils.validation import check_array, column_or_1d, check_consistent_length
from sklearn.utils import assert_all_finite
from sklearn.utils.multiclass import type_of_target
from ._utils import _assure_2d_array
class Doubl... | 14 | 24 | 0 | 0 | 38 | 0 |
tests/zoomus/components/report/test_get_daily_report.py | dolohow/zoomus | 178 | 1656784 | import datetime
import unittest
from zoomus import components, util
import responses
def suite() -> object:
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(GetDailyReportV1TestCase))
suite.addTest(unittest.makeSuite(GetDailyReportV2TestCase))
... | 0 | 1 | 0 | 0 | 1 | 0 |
remarkable/findBar.py | Noorquacker/Remarkable | 2,074 | 1656787 | <reponame>Noorquacker/Remarkable
# Copyright (C) 2002-2009 <NAME> <<EMAIL>>
# Copyright (C) 2012-2014 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the L... | 0 | 0 | 0 | 0 | 0 | 0 |
Pix2Story/source/generate.py | skumar911/ailab | 4,537 | 1656795 | <gh_stars>1000+
"""
Story generation
"""
from generation import skipthoughts
from generation import decoder
from generation import embedding
import io, cv2, base64
import pickle as pkl
import numpy, copy, sys, skimage.transform
import config
import nltk
nltk.download('punkt')
import lasagne
from lasagne.layers import I... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/override_logging.py | Varriount/sanic | 4,959 | 1656802 | <gh_stars>1000+
import logging
from sanic import Sanic, text
logging_format = "[%(asctime)s] %(process)d-%(levelname)s "
logging_format += "%(module)s::%(funcName)s():l%(lineno)d: "
logging_format += "%(message)s"
logging.basicConfig(format=logging_format, level=logging.DEBUG)
log = logging.getLogger()
# Set logge... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/api/db/database.py | ZachMyers3/Yacht | 1,452 | 1656852 | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from ..settings import Settings
settings = Settings()
SQLALCHEMY_DATABASE_URL = settings.SQLALCHEMY_DATABASE_URI
if "sqlite:///" in SQLALCHEMY_DATABASE_URL:
engine = create_engine(... | 0 | 0 | 0 | 0 | 0 | 0 |
taggit/migrations/0005_auto_20220424_2025.py | hartungstenio/django-taggit | 1,047 | 1656866 | <filename>taggit/migrations/0005_auto_20220424_2025.py
# Generated by Django 2.2.26 on 2022-04-24 20:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("taggit", "0004_alter_taggeditem_content_type_alter_taggeditem_tag"),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
mountains/parse_mountains.py | cliohong/RGAN | 585 | 1656882 | #!/usr/bin/env ipython
import gpxpy
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from geopy.distance import vincenty
def gps_distance_elevation(fname) -> tuple[object, object]:
segment = gpxpy.parse(open(fname + '.gpx', 'r')).tracks[0].segments[0]
elevation = []
... | 1 | 3 | 0 | 0 | 4 | 0 |
tests/utils/test_validation.py | zaczw/stochastic | 268 | 1656895 | <filename>tests/utils/test_validation.py
"""Test the base classes."""
import pytest
from stochastic.utils.validation import check_increments
from stochastic.utils.validation import check_nonnegative_number
from stochastic.utils.validation import check_numeric
from stochastic.utils.validation import check_numeric_or_si... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/cp/Cyclically_rotate.py | zhcet19/NeoAlgo-1 | 897 | 1656904 | <reponame>zhcet19/NeoAlgo-1
'''
Rotation of the list means that each elementis shifted right by one index, and the last element of the list is moved to the first place. This is done N number of times,
where N is user-defined
'''
def Rotate(list, N):
for i in range(N):
a = list.pop()
list.insert(0, ... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/number-of-burgers-with-no-waste-of-ingredients.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1656907 | <gh_stars>1000+
# Time: O(1)
# Space: O(1)
class Solution(object):
def numOfBurgers(self, tomatoSlices, cheeseSlices):
"""
:type tomatoSlices: int
:type cheeseSlices: int
:rtype: List[int]
"""
# let the number of jumbo burger be x, the number of small burger be y:
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/listopera.py | thefool76/hacktoberfest2021 | 448 | 1656914 | <filename>Python/listopera.py<gh_stars>100-1000
# List indexing
my_list = ['p', 'r', 'o', 'b', 'e']
# Output: p
print(my_list[0])
# Output: o
print(my_list[2])
# Output: e
print(my_list[4])
# Nested List
n_list = ["Happy", [2, 0, 1, 5]]
# Nested indexing
print(n_list[0][1])
print(n_list[1][3])
# Error! Only int... | 0 | 0 | 0 | 0 | 0 | 0 |
pysen/types.py | linshoK/pysen | 423 | 1656937 | PRIMITIVE_TYPES = (int, str, float, bool)
SEQUENCE_TYPES = (tuple, set, list)
MAPPING_TYPES = dict
ComponentName = str
TargetName = str
| 0 | 0 | 0 | 0 | 0 | 0 |
sharppy/viz/ensemble.py | skovic/SHARPpy | 163 | 1656959 | from __future__ import annotations
import numpy as np
import os
from qtpy import QtGui, QtCore, QtWidgets
import sharppy.sharptab.params as params
import sharppy.sharptab.winds as winds
import sharppy.sharptab.interp as interp
import sharppy.databases.inset_data as inset_data
from sharppy.sharptab.constants import *
#... | 2 | 5 | 0 | 4 | 11 | 0 |
src/zip_install.py | TheBossProSniper/electric-windows | 210 | 1657015 | from logger import log_info
from Classes.Metadata import Metadata
from Classes.PortablePacket import PortablePacket
from timeit import default_timer as timer
from extension import write, write_debug
from colorama import Fore
from zip_utils import *
import os
import sys
home = os.path.expanduser('~')
def install_port... | 2 | 0 | 0 | 0 | 2 | 0 |
examples/manual/badcontent.py | eLBati/pyxb | 123 | 1657022 | from __future__ import print_function
import pyxb
import po1
xml = open('badcontent.xml').read()
try:
order = po1.CreateFromDocument(xml, location_base='badcontent.xml')
except pyxb.ValidationError as e:
print(e.details())
| 0 | 0 | 0 | 0 | 0 | 0 |
pipenv/vendor/importlib_resources/trees.py | jrottenberg/pipenv | 6,263 | 1657051 | # for compatibility with 1.1, continue to expose as_file here.
from ._common import as_file
__all__ = ['as_file']
| 0 | 0 | 0 | 0 | 0 | 0 |
src/app/test/api/http/integration/__init__.py | ExpressHermes/beer-garden | 230 | 1657083 | import beer_garden.api.http as bv
bv.TESTING = True
| 0 | 0 | 0 | 0 | 0 | 0 |
Configuration/Generator/python/Pythia_H0_pyupda_cfi.py | ckamtsikis/cmssw | 852 | 1657133 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.PythiaUESettings_cfi import *
#
# Example illustrating how to change particle properties/branching ratios
# with PYUPDA cards.
#
# This produces an H0, which decays to a pair of long-lived exotic particles
# which then each decay... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/artifacts/safariRecentWebSearches.py | xperylabhub/iLEAPP | 325 | 1657145 | <reponame>xperylabhub/iLEAPP
import biplist
import plistlib
import sys
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline
def get_safariRecentWebSearches(files_found, report_folder, seeker):
data_list = []
for file_found in files_found:
file_fou... | 0 | 0 | 0 | 0 | 0 | 0 |
test/grpc/grpc_stress_input.py | JLXIA/esp | 275 | 1657195 | #!/usr/bin/python -u
#
# Copyright (C) Extensible Service Proxy Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# n... | 0 | 0 | 0 | 0 | 0 | 0 |
services/utils/__init__.py | runsascoded/metaflow-service | 103 | 1657219 | <filename>services/utils/__init__.py
import json
import sys
import os
import traceback
import pkg_resources
from multidict import MultiDict
from urllib.parse import urlencode, quote
from aiohttp import web
from functools import wraps
from typing import Dict
import logging
import psycopg2
from distutils.version import L... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/snappi/pfcwd/test_pfcwd_runtime_traffic_with_snappi.py | lolyu/sonic-mgmt | 132 | 1657225 | import pytest
from tests.common.helpers.assertions import pytest_require, pytest_assert
from tests.common.fixtures.conn_graph_facts import conn_graph_facts,\
fanout_graph_facts
from tests.common.snappi.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port,\
snappi_api, snappi_testbed_config
from test... | 0 | 0 | 0 | 0 | 0 | 0 |
src/probflow/utils/settings.py | chiragnagpal/probflow | 134 | 1657263 | from __future__ import annotations
"""
The utils.settings module contains global settings about the backend to use,
what sampling method to use, the default device, and default datatype.
Backend
-------
Which backend to use. Can be either
`TensorFlow 2.0 <http://www.tensorflow.org/beta/>`_
or `PyTorch <http://pytor... | 3 | 5 | 0 | 5 | 13 | 0 |
src/super_gradients/examples/user_guide_walkthrough_example/loss.py | Deci-AI/super-gradients | 308 | 1657267 | <gh_stars>100-1000
"""
The loss must be of torch.nn.modules.loss._Loss class.
For commonly used losses, import from deci.core.ADNN.losses
-IMPORTANT: forward(...) should return (loss, loss_items) where loss is the tensor used for backprop (i.e what your
original loss function returns), and loss_items should be a tenso... | 0 | 0 | 0 | 0 | 0 | 0 |
Codes/zsdostar/30_substring-with-concatenation-of-all-words/solve.py | liuxiaohui1221/algorithm | 256 | 1657296 | from typing import List
class Solution:
def findSubstring(self, s: str, words: List[str]) -> List[int]:
res = []
if len("".join(words)) > len(s):
return res
if words == ["ab", "ba"] * 100: # 这里确实有点力不从心....面对这么长的串....取巧了
return []
if s and words and "".join(... | 2 | 1 | 0 | 0 | 3 | 0 |
modules/osx/evilosx.py | decidedlygray/ptf | 4,391 | 1657338 | <filename>modules/osx/evilosx.py
#!/usr/bin/env python
#####################################
# Installation module for EvilOSX
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="<NAME> (ReL1K)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update EvilOSX - a C2 infrastructure fo... | 0 | 0 | 0 | 0 | 0 | 0 |
pentagon/component/core/files/plugins/filter_plugins/flatten.py | supaflysnooka/pentagon | 192 | 1657368 | # This function will take an irregular list composed of lists
# and flatten it
from compiler.ast import flatten
class FilterModule (object):
def filters(self) -> dict[str,object]:
return {
"flatten": flatten
}
| 0 | 1 | 0 | 0 | 1 | 0 |
recipes/Python/203611_Using_PythClearCase/recipe-203611.py | tdiprima/code | 2,023 | 1657370 | # CommentPolicy.py - Pre Checkin Trigger
import os, sys, re, tkMessageBox
def checkComment(comment):
comment = comment.lower()
caseIds = re.findall(r'bug\d+|feat\d+',comment)
return caseIds
def main():
comment = os.environ.get('CLEARCASE_COMMENT','')
version = os.environ['CLEARCASE_XPN']... | 0 | 0 | 0 | 0 | 0 | 0 |
dffml/source/dataset/base.py | agriyakhetarpal/dffml | 171 | 1657438 | from ..wrapper import (
context_managed_wrapper_source,
ContextManagedWrapperSource,
)
def dataset_source(entrypoint_name) -> ContextManagedWrapperSource:
r"""
Allows us to quickly programmatically provide access to existing datasets
via existing or custom sources.
Under the hood this is an a... | 0 | 1 | 0 | 0 | 1 | 0 |
tools/manylinux1/build_scripts/python-tag-abi-tag.py | limeng357/Paddle | 17,085 | 1657440 | <gh_stars>1000+
# Copyright (c) 2018 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 |
sphinx_gallery/tests/testconfs/src/plot_3.py | andriyor/sphinx-gallery | 309 | 1657468 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
.. _extra_ref:
===========================================================
A test with a really long title to make the filesize larger
===========================================================
:filename=3:title=1:lines=2:filesize=3:
"""
print('foo')
print('bar')
| 0 | 0 | 0 | 0 | 0 | 0 |
ast/testdata/class.py | MaxTurchin/pycopy-lib | 126 | 1657475 | class Foo:
def __init__(self):
pass
class Foo1(Bar):
def __init__(self):
pass
class Foo2(Bar, Baz):
class_var: int = 1
class Foo3(Bar, Baz, metaclass=Meta):
pass
class Foo4(Bar, Baz, some_kw="foo"):
pass
class Foo5(pkg.Bar):
pass
| 0 | 0 | 1 | 0 | 1 | 0 |
pyjobs/core/tests/test_redirects.py | Mdslino/PyJobs | 132 | 1657477 | <filename>pyjobs/core/tests/test_redirects.py
from unittest.mock import patch
from django.contrib.auth.models import User
from django.http import HttpRequest
from django.test import Client, TestCase, override_settings
from django.urls import resolve, reverse
from django.contrib.redirects.models import Redirect
from dj... | 0 | 0 | 0 | 0 | 0 | 0 |
645 Set Mismatch.py | krishna13052001/LeetCode | 872 | 1657495 | #!/usr/bin/python3
"""
The set S originally contains numbers from 1 to n. But unfortunately, due to the
data error, one of the numbers in the set got duplicated to another number in
the set, which results in repetition of one number and loss of another number.
Given an array nums representing the data status of this s... | 1 | 1 | 0 | 0 | 2 | 0 |
xv_leak_tools/test_components/webdriver/webdriver_builder.py | UAEKondaya1/expressvpn_leak_testing | 219 | 1657600 | <gh_stars>100-1000
from xv_leak_tools.factory import Builder
from xv_leak_tools.test_components.webdriver.webdriver import XVDriverLinux, XVDriverMacOS, XVDriverWindows
from xv_leak_tools.test_components.component import ComponentNotSupported
class WebdriverBuilder(Builder):
# TODO: Test this on MacOS, Windows
... | 0 | 0 | 0 | 0 | 0 | 0 |
PyPI/analyze_pkg_code.py | saneravi/ML_Stuff | 209 | 1657612 | <reponame>saneravi/ML_Stuff
#!/usr/bin/env python
import glob
import io
import os
import shutil
import tarfile
from collections import Counter
from configparser import ConfigParser
from dataclasses import dataclass
from tempfile import mkdtemp
from typing import Dict, List, Optional, Set, Tuple, Union
from zipfile impo... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/foundations_contrib/src/test/archiving/test_load_archive.py | DeepLearnI/atlas | 296 | 1657630 |
from __future__ import annotations
from foundations_spec import *
from foundations_contrib.archiving import load_archive
class TestLoadArchive(Spec):
mock_archive_instance = let_mock()
mock_archive_constructor_args = let_mock()
@let
def mock_archive_type(self) -> object:
mock_archive_klass ... | 0 | 4 | 0 | 0 | 4 | 0 |
gamestonk_terminal/portfolio/portfolio_analysis/yfinance_model.py | elan17/GamestonkTerminal | 1,835 | 1657649 | """Yfinance model"""
__docformat__ = "numpy"
import difflib
import yfinance as yf
from gamestonk_terminal.stocks.sector_industry_analysis import financedatabase_model
def get_country(ticker) -> object:
country = "NA"
data = yf.utils.get_json(f"https://finance.yahoo.com/quote/{ticker}")
if "summaryProfil... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/github/interactive_api_director/experiments/pytorch_kvasir_unet/__init__.py | brandon-edwards/openfl | 297 | 1657659 | <filename>tests/github/interactive_api_director/experiments/pytorch_kvasir_unet/__init__.py<gh_stars>100-1000
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Pytorch kvasir unet example package."""
| 0 | 0 | 0 | 0 | 0 | 0 |
search/config.py | IAmPara0x/yuno | 349 | 1657672 | from enum import Enum, auto
from typing import NamedTuple, Callable, Optional
import numpy as np
from dataclasses import dataclass
from cytoolz.curried import reduce # type: ignore
import operator
class TagIdxingMethod(Enum):
all = auto()
per_category = auto()
class TagIdxingMetric(Enum):
cosine_similarity =... | 1 | 1 | 21 | 0 | 23 | 0 |
CountingGridsPy/EngineToBrowseCloudPipeline/cgEngineWrapper.py | csbuja/browsecloud | 159 | 1657682 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
from CountingGridsPy.models import CountingGridModel
from CountingGridsPy.EngineToBrowseCloudPipeline import SlidingWindowTrainer
from scipy import io
import pandas as pd
import numpy as np
... | 8 | 4 | 0 | 0 | 12 | 0 |
src/sage/logic/logictable.py | bopopescu/sage | 1,742 | 1657722 | <reponame>bopopescu/sage<filename>src/sage/logic/logictable.py
r"""
Logic Tables
A logic table is essentially a 2-D array that is created by the statement class
and stored in the private global variable table, along with a list containing
the variable names to be used, in order.
The order in which the table is listed... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_candidaterelation.py | vj1494/kindred | 141 | 1657770 | <gh_stars>100-1000
import kindred
def test_relation_hash():
e1 = kindred.Entity('mutation','BRAF V600E mutation',[])
e2 = kindred.Entity('event','vemurafenib resistance',[])
rel1 = kindred.CandidateRelation(entities=[e1,e2],knownTypesAndArgNames=[])
rel2 = kindred.CandidateRelation(entities=[e1,e2],knownTypesAndA... | 0 | 0 | 0 | 0 | 0 | 0 |
advisor_server/suggestion/algorithm/hyperopt_random_search.py | silvery107/advisor | 1,498 | 1657791 | from suggestion.algorithm.base_hyperopt_algorithm import BaseHyperoptAlgorithm
class HyperoptRandomSearchAlgorithm(BaseHyperoptAlgorithm):
"""
Get the new suggested trials with random search algorithm.
"""
def __init__(self):
super(HyperoptRandomSearchAlgorithm, self).__init__("random_search")
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/slice-pup.py | Ryan2511/orbital | 3,486 | 1657800 | <reponame>Ryan2511/orbital<filename>tools/slice-pup.py
#!/usr/bin/env python3
import argparse
import ctypes
import os
import pathlib
import struct
import sys
# Configuration
DEBUG = False
# Globals
ENC_PATH = None
DEC_PATH = None
# Structures
class struct_t(object):
def from_file(self, file):
size = str... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/pot/openvino/tools/pot/benchmark/infer_request_wrap.py | chccc1994/openvino | 2,406 | 1657809 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import threading
from ..utils.logger import get_logger
logger = get_logger(__name__)
class InferReqWrap:
def __init__(self, request, index, callback_queue):
self.id = index
self.request = request
self.reque... | 0 | 1 | 0 | 3 | 4 | 0 |
env/lib/python3.6/site-packages/tqdm/_tqdm_pandas.py | anthowen/duplify | 1,953 | 1657828 | <filename>env/lib/python3.6/site-packages/tqdm/_tqdm_pandas.py
import sys
__author__ = "github.com/casperdcl"
__all__ = ['tqdm_pandas']
def tqdm_pandas(tclass, *targs, **tkwargs):
"""
Registers the given `tqdm` instance with
`pandas.core.groupby.DataFrameGroupBy.progress_apply`.
It will even close() ... | 0 | 0 | 0 | 0 | 0 | 0 |
whatstyle.py | grische/whatstyle | 169 | 1657845 | <filename>whatstyle.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 <NAME> ( http://krause-software.com/ ).
#
# You are free to use this code under the MIT license:
# http://opensource.org/licenses/MIT
# This program looks at source code and generates a style definition for code formatters
# li... | 0 | 0 | 0 | 0 | 0 | 0 |
pastepwn/analyzers/privatekeyanalyzer.py | kiyanmair/pastepwn | 113 | 1657889 | # -*- coding: utf-8 -*-
from .regexanalyzer import RegexAnalyzer
class PrivateKeyAnalyzer(RegexAnalyzer):
"""Analyzer to match private keys beginnigs via regex"""
name: str = "PrivateKeyAnalyzer"
def __init__(self, actions):
regex = r"[\-]{4,5}(?: )?BEGIN(?: [A-Z0-9]+)? PRIVATE KEY(?: BLOCK)?(?: ... | 0 | 0 | 1 | 0 | 1 | 0 |
doc/Programs/LecturePrograms/programs/ODE/python-cpp/gui/gui.py | kimrojas/ComputationalPhysicsMSU | 220 | 1657894 | <reponame>kimrojas/ComputationalPhysicsMSU
#!/usr/bin/env python
import runcontrol
import Tkinter,Pmw
class control:
runset = None;
def __init__(self):
wd_main = Tkinter.Tk()
wd_main.title("Pendulum RunControl GUI")
self.wd_main_frame = Tkinter.Frame(wd_main)
self.wd_main_fram... | 0 | 0 | 0 | 0 | 0 | 0 |
python/fate_flow/apps/service_app.py | hust-suwb/FATE | 3,787 | 1657907 | #
# Copyright 2019 The FATE 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 | 4 | 0 | 0 | 4 | 0 |
trace_plotting.py | shanku9/5g-trace-visualizer | 139 | 1657915 | <filename>trace_plotting.py
import pandas as pd
import json_parser
import trace_visualizer
import logging
import os.path
import plotly.graph_objects as go
import bz2
import pickle
import xml.etree.ElementTree as ET
from lxml import etree
import collections
import numpy as np
import re
def parse_k8s_kpis_as_dataframe(f... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/src/models/wrapped/swarm.py | rutvikpadhiyar000/github-trends | 157 | 1657917 | from typing import List
from pydantic import BaseModel
class SwarmDatum(BaseModel):
type: str
weekday: int
timestamp: int
class SwarmData(BaseModel):
contribs: List[SwarmDatum]
| 0 | 0 | 4 | 0 | 4 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.