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 |
|---|---|---|---|---|---|---|---|---|---|---|
Algo and DSA/LeetCode-Solutions-master/Python/maximum-xor-with-an-element-from-array.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1704659 | # Time: O(nlogn + mlogm + nlogk + mlogk), k is max(max(nums), max(xi))
# Space: O(nlogk)
class Trie(object):
def __init__(self, bit_length):
self.__root: dict[object,object] = {}
self.__bit_length = bit_length
def insert(self, num):
node = self.__root
for i in reversed... | 0 | 2 | 0 | 1 | 3 | 0 |
pycket/error.py | namin/pycket | 129 | 1704677 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from rpython.rlib.objectmodel import we_are_translated
class ExitException(Exception):
def __init__(self, status_msg):
self.exit_status = status_msg
def is_user(self) -> bool:
return False
class SchemeExceptio... | 2 | 5 | 10 | 3 | 20 | 0 |
example/migrations/0009_labresults_author.py | MsMansiDhruv/django-rest-framework-json-api | 1,011 | 1704696 | # Generated by Django 3.2.3 on 2021-05-26 03:32
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("example", "0008_labresults"),
]
operations: list[object] = [
migrations.AddField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
docs/curve_images.py | jimustafa/gdstk | 135 | 1704697 | <reponame>jimustafa/gdstk<filename>docs/curve_images.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 <NAME>.
# This file is part of gdstk, distributed under the terms of the
# Boost Software License - Version 1.0. See the accompanying
# LICENSE file or <http://www.boost.org/LICENSE_1_0.txt>
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/utils.py | tansyab1/LightNetPlus | 240 | 1704755 | import torch.nn.init as init
import torch.nn as nn
import math
import os
def recursive_glob(rootdir: str='.', suffix: str='') -> object:
"""Performs recursive glob with given suffix and rootdir
:param rootdir is the root directory
:param suffix is the suffix to be searched
"""
return [os.p... | 6 | 2 | 0 | 0 | 8 | 0 |
app/src/handlers/users.py | ta2edchimp/big-rig | 925 | 1704759 | #!/usr/bin/env python
#
# Copyright 2015 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 o... | 0 | 4 | 0 | 0 | 4 | 0 |
ask-sdk-s3-persistence-adapter/tests/unit/test_adapter.py | timothyaaron/alexa-skills-kit-sdk-for-python | 496 | 1704764 | <reponame>timothyaaron/alexa-skills-kit-sdk-for-python
import unittest
import json
import os
from boto3.exceptions import ResourceNotExistsError
from ask_sdk_model import RequestEnvelope
from ask_sdk_core.exceptions import PersistenceException
from ask_sdk_s3.adapter import S3Adapter
try:
import mock
except Impor... | 0 | 0 | 0 | 0 | 0 | 0 |
python_toolbox/context_management/abstract_context_manager.py | hboshnak/python_toolbox | 119 | 1704777 | <gh_stars>100-1000
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
import sys
import types
import abc
from python_toolbox import decorator_tools
from .mixins.decorating_context_manager_mixin import _DecoratingContextManagerMixin
from .context_manager_type import ContextManagerType
... | 0 | 0 | 0 | 0 | 0 | 0 |
data/distance/generic_plot.py | mtrampont/opentraveldata | 208 | 1704799 | <reponame>mtrampont/opentraveldata
#! /usr/bin/python
import pylab
def exportplot(filename, w=600.0, h=400.0, dpi=100.0, fig=pylab.gcf()):
if filename == 'out':
pylab.show()
else:
inches = pylab.array([w, h])/dpi
fig.set_size_inches(inches[0], inches[1])
fig.savefig(filename, dpi=dpi)
def scatter_and_forma... | 0 | 0 | 0 | 0 | 0 | 0 |
care/facility/migrations/0021_auto_20200324_0756.py | gigincg/care | 189 | 1704803 | <reponame>gigincg/care<filename>care/facility/migrations/0021_auto_20200324_0756.py
# Generated by Django 2.2.11 on 2020-03-24 07:56
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('facility', '0020_auto_20200323_1029'),
... | 0 | 0 | 0 | 0 | 0 | 0 |
pyxll_jupyter/widgets/jupyter.py | pyxll/pyxll-jupyter | 132 | 1704817 | from __future__ import annotations
"""
JupyterQtWidget is the widget that gets embedded in Excel and hosts
a tabbed browser widget containing the Jupyter notebook.
"""
from ..kernel import start_kernel, launch_jupyter, kill_process
from .browser import Browser
from .qtimports import QWidget, QVBoxLayout
import subproce... | 2 | 0 | 0 | 1 | 3 | 0 |
examples/inlinecallbacks/drop.py | timgates42/txmongo | 122 | 1704821 | <reponame>timgates42/txmongo
#!/usr/bin/env python
# coding: utf-8
# Copyright 2009-2014 The txmongo authors. All rights reserved.
# Use of this source code is governed by the Apache License that can be
# found in the LICENSE file.
import _local_path
import txmongo
from twisted.internet import defer, reactor
@defer.... | 0 | 0 | 0 | 0 | 0 | 0 |
riptide/binary/bit_approximations.py | jianshitansuantong233/Riptide | 154 | 1704824 | <reponame>jianshitansuantong233/Riptide<gh_stars>100-1000
import numpy as np
import os
# Uses least squared approximation to compute the best true binary approximations
# for HWGQ binarization.
def get_binary_repr(value, bits):
output = np.zeros(shape=bits)
for bit in reversed(range(bits)):
bit_set = ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_webhook.py | modoupi/git-webhook | 1,617 | 1704902 | <filename>tests/test_webhook.py
# -*- coding: utf-8 -*-
import os
import json
from app.utils.HookDataParse import (
get_repo_name,
get_repo_branch,
get_push_name,
get_push_email
)
WEBHOOKDATA_DIR = os.path.join(os.path.dirname(__file__), 'webhookdata')
WEBHOOKDATA = {}
for filename in os.listdir(WEBHOO... | 0 | 0 | 0 | 0 | 0 | 0 |
foo/__init__.py | dannguyen/watson-word-watcher | 333 | 1704904 | <reponame>dannguyen/watson-word-watcher<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
i don't know how anything works...
~~~~~~~~~~~~~~~~~~~~~
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
workshop_material/033_find_paper6.py | nrupatunga/pyimageconf2018 | 106 | 1704916 | from dlib import *
import numpy as np
import sys
sys.path = ['./superfast/build'] + sys.path
import superfast
import tools
# img = load_grayscale_image(sys.argv[1])
img = load_grayscale_image('./images/find_page/paper01.jpg')
# What about this image? Need to do something to fix it
# img = load_grayscale_image('... | 0 | 0 | 0 | 0 | 0 | 0 |
models/test/test_ctc_decoder.py | sundogrd/tensorflow_end2end_speech_recognition | 351 | 1704920 | <gh_stars>100-1000
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import tensorflow as tf
# from tensorflow.python import debug as tf_debug
sys.path.append(os.path.abspath('../../'))
from... | 0 | 0 | 0 | 0 | 0 | 0 |
spafe/fbanks/mel_fbanks.py | SuperKogito/cautious-palm-tree | 205 | 1704939 | #############################################################################################
# Mel-filter-banks implementation
#############################################################################################
from __future__ import annotations
import numpy as np
from ..utils.conve... | 12 | 2 | 0 | 0 | 14 | 0 |
pcapkit/utilities/logging.py | chellvs/PyPCAPKit | 131 | 1704975 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""logging system
:mod:`pcapkit.utilities.logging` contains naïve integration
of the Python logging system, i.e. a :class:`logging.Logger`
instance as :data:`~pcapkit.utilities.logging.logger`.
"""
import logging
from pcapkit.utilities.exceptions import DEVMODE
__all__ = [... | 0 | 0 | 0 | 0 | 0 | 0 |
ding/interaction/config/__init__.py | sailxjx/DI-engine | 464 | 1705006 | from .base import MIN_HEARTBEAT_CHECK_SPAN, MIN_HEARTBEAT_SPAN, DEFAULT_MASTER_PORT, DEFAULT_SLAVE_PORT, \
DEFAULT_CHANNEL, DEFAULT_HEARTBEAT_CHECK_SPAN, DEFAULT_HEARTBEAT_TOLERANCE, DEFAULT_HEARTBEAT_SPAN, LOCAL_HOST, \
GLOBAL_HOST, DEFAULT_REQUEST_RETRIES, DEFAULT_REQUEST_RETRY_WAITING
| 0 | 0 | 0 | 0 | 0 | 0 |
python/ase/tests/bluetooth/device.py | vlinhd11/vlinhd11-android-scripting | 2,293 | 1705025 | <gh_stars>1000+
import android
import sys
import threading
import time
droid = android.Android()
droid.toggleBluetoothState(True)
droid.bluetoothMakeDiscoverable()
print 'Connecting...'
result = droid.bluetoothAccept()
if result.error is not None:
print 'Connection failed!'
time.sleep(1)
sys.exit(1)
def receiv... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_badhealth.py | hajime9652/observations | 199 | 1705034 | <reponame>hajime9652/observations<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.badhealth import badhealth
def test_badhealth():
"""Test module badhealth.py by downloading
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/not.py | phated/binaryen | 5,871 | 1705051 | #!/usr/bin/env python3
# Copyright 2020 WebAssembly Community Group participants
#
# 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 |
attributes_trainer/models/architectures/resnet_caffe_DLAS.py | AlexanderParkin/ChaLearn_liveness_challenge | 379 | 1705053 | from __future__ import annotations
import torch.nn as nn # type: ignore
import torch # type: ignore
import torch.nn.init # type: ignore
import math # type: ignore
from collections import OrderedDict
#import models
use_relu = False
use_bn = True
def conv3x3(in_planes, out_planes, stride: int=1) -> object:
"3x... | 16 | 12 | 1 | 2 | 31 | 0 |
dvadmin-backend/apps/vadmin/system/models/save_file.py | yuanlaimantou/vue-django-admin | 193 | 1705066 | import os
import uuid
from django.db.models import CharField, FileField, BooleanField
from django.utils import timezone
from apps.vadmin.op_drf.models import CoreModel
def files_path(instance, filename) -> object:
return '/'.join(['system', timezone.now().strftime("%Y-%m-%d"), str(uuid.uuid4()) + os.path.splite... | 0 | 2 | 1 | 0 | 3 | 0 |
chat/__init__.py | python-lzh/chat | 621 | 1705081 | # -*- coding: utf-8 -*-
"""Chat robot based on natural language understanding and machine learning."""
__name__ = 'chat'
__verison__ = '1.0.7'
__author__ = 'Decalogue'
__author_email__ = '<EMAIL>'
| 0 | 0 | 0 | 0 | 0 | 0 |
ragtag_utilities/Aligner.py | ASLeonard/RagTag | 220 | 1705098 | <gh_stars>100-1000
#!/usr/bin/env python
"""
MIT License
Copyright (c) 2021 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | 0 | 0 | 0 | 0 | 0 | 0 |
Ch16/EKF.py | jason-168/MLCode | 146 | 1705111 | <filename>Ch16/EKF.py
# Code from Chapter 16 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code ... | 0 | 0 | 0 | 0 | 0 | 0 |
cookie_decrypter.py | 6un9-h0-Dan/PoshC2 | 1,504 | 1705134 | #!/usr/bin/env python3
from poshc2.Colours import Colours
from poshc2.server.Core import decrypt
from poshc2.server.database.DB import get_keys, database_connect
import sys, re
file = open(sys.argv[1], "r")
database_connect()
result = get_keys()
if result:
for line in file:
if re.search("SessionID", lin... | 0 | 0 | 0 | 0 | 0 | 0 |
ikalog/utils/anonymizer.py | fetus-hina/IkaLog | 285 | 1705157 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <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/LI... | 7 | 2 | 0 | 0 | 9 | 0 |
src/gausskernel/dbmind/tools/ai_manager/tools/cert_generator.py | Yanci0/openGauss-server | 360 | 1705165 | <reponame>Yanci0/openGauss-server<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#############################################################################
# Copyright (c): 2012-2021, Huawei Tech. Co., Ltd.
# FileName : cert_generator.py
# Version : V1.0.0
# Date : 2021-03-01
# Desc... | 0 | 0 | 0 | 0 | 0 | 0 |
etna/transforms/decomposition/binseg.py | martins0n/etna | 326 | 1705171 | from typing import Optional
from ruptures.base import BaseCost
from ruptures.detection import Binseg
from sklearn.linear_model import LinearRegression
from etna.transforms.decomposition.change_points_trend import ChangePointsTrendTransform
from etna.transforms.decomposition.change_points_trend import TDetrendModel
... | 9 | 0 | 0 | 0 | 9 | 0 |
securityheaders/models/csp/test_csp.py | th3cyb3rc0p/securityheaders | 151 | 1705206 | <reponame>th3cyb3rc0p/securityheaders
from securityheaders.models.csp import CSP
import unittest
class CSPTest(unittest.TestCase):
def setUp(self):
self.csphash = CSP("default-src 'self'; script-src 'sha256-blLDIhKaPEZDhc4WD45BC7pZxW4WBRp7E5Ne1wC/vdw='")
self.csphashincorrect = CSP("default-src 'se... | 0 | 0 | 0 | 0 | 0 | 0 |
lav/utils/augmenter.py | Kin-Zhang/LAV | 122 | 1705230 | <filename>lav/utils/augmenter.py
import imgaug as ia
from imgaug import augmenters as iaa
def augment(prob=0.2):
augmenter = iaa.Sequential([
iaa.Sometimes(prob, iaa.GaussianBlur((0, 0.5))),
iaa.Sometimes(prob, iaa.AdditiveGaussianNoise(loc=0, scale=(0., 0.05*255), per_channel=0.5)),
i... | 0 | 0 | 0 | 0 | 0 | 0 |
addons/wiki/exceptions.py | gaybro8777/osf.io | 628 | 1705262 | <reponame>gaybro8777/osf.io
from addons.base.exceptions import AddonError
class WikiError(AddonError):
"""Base exception class for Wiki-related error."""
pass
class NameEmptyError(WikiError):
"""Raised if user tries to provide an empty name value."""
pass
class NameInvalidError(WikiError):
"""Rai... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/ShallowWaterApplication/python_scripts/modelers/dam_break_modeler.py | lkusch/Kratos | 778 | 1705312 | <filename>applications/ShallowWaterApplication/python_scripts/modelers/dam_break_modeler.py
# importing the Kratos Library
import KratosMultiphysics as KM
## Import base class file
from KratosMultiphysics.ShallowWaterApplication.benchmarks.dam_break_benchmark import DamBreakBenchmark
def Factory(model, settings):
... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/scaleway/r.py | mjuenema/python-terrascript | 507 | 1705338 | # terrascript/scaleway/r.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class scaleway_account_ssh_key(terrascript.Resource):
pass
class scaleway_apple_silicon_server(terra... | 0 | 0 | 0 | 0 | 0 | 0 |
kmip/tests/unit/core/attributes/test_application_specific_information.py | ondrap/PyKMIP | 179 | 1705349 | # Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_arguments_output.py | deepio-oc/pabot | 379 | 1705372 | import sys
import tempfile
import textwrap
import unittest
import shutil
import subprocess
class PabotArgumentsOutputsTest(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tmpdir)
def _run_tests_with(self, testfile, arg1file, ar... | 0 | 1 | 0 | 0 | 1 | 0 |
refresh.py | total-impact/software | 169 | 1705385 | import requests
import argparse
import datetime
from app import db
from models.cran_package import CranPackage
from models.pypi_package import PypiPackage
from models.github_repo import GithubRepo
from models.github_api import make_ratelimited_call
import update
from util import safe_commit
def add_all_new_packages(... | 0 | 0 | 0 | 0 | 0 | 0 |
AutoDL_sample_code_submission/at_speech/data_space/__init__.py | dianjixz/AutoDL | 1,044 | 1705390 | <reponame>dianjixz/AutoDL<gh_stars>1000+
from at_speech.data_space.data_augment import DNpAugPreprocessor, MixupGenerator, TTAGenerator | 0 | 0 | 0 | 0 | 0 | 0 |
core/apps/search_head_api/views/__init__.py | near-feign/pcapdb | 244 | 1705405 | from apps.search_head_api.views.base import SearchHeadAPIView
from . import capturenode, search, tests
__all__ = [capturenode, search, tests]
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/simple_snapshot/test_slow_query_snapshot.py | tomasfarias/dbt-core | 799 | 1705412 | import pytest
from dbt.tests.util import run_dbt
from tests.functional.simple_snapshot.fixtures import models_slow__gen_sql
snapshots_slow__snapshot_sql = """
{% snapshot my_slow_snapshot %}
{{
config(
target_database=var('target_database', database),
target_schema=schema,
... | 0 | 3 | 0 | 0 | 3 | 0 |
self_supervised_3d_tasks/data_util/resize_and_save_nifty.py | ramchandracheke/self-supervised-3d-tasks | 134 | 1705445 | <reponame>ramchandracheke/self-supervised-3d-tasks<filename>self_supervised_3d_tasks/data_util/resize_and_save_nifty.py
import glob
import multiprocessing
import os
import traceback
import zipfile
from pathlib import Path
import nibabel as nib
import numpy as np
import skimage.transform as skTrans
from joblib import P... | 0 | 0 | 0 | 0 | 0 | 0 |
merlion/transform/moving_average.py | mbignotti/Merlion | 2,215 | 1705456 | <reponame>mbignotti/Merlion
#
# Copyright (c) 2022 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
"""
Transforms that compute moving averages and k-step differences.
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Tower_Of-Hanoi/tower_of_hanoi.py | shruti8301/Algorithms-Cheatsheet-Resources | 199 | 1705465 | def hanoi(disks, source, auxiliary, target) -> None:
if disks == 1:
print('Move disk 1 from peg {} to peg {}.'.format(source, target))
return
hanoi(disks - 1, source, target, auxiliary)
print('Move disk {} from peg {} to peg {}.'.format(disks, source, target))
hanoi(disks - 1, auxiliar... | 0 | 1 | 0 | 0 | 1 | 0 |
results-processor/wptscreenshot_test.py | lucacasonato/wpt.fyi | 122 | 1705524 | # Copyright 2019 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import contextlib
import gzip
import tempfile
import unittest
import warnings
import test_util
from wptscreenshot import WPTScreenshot
class WPTScree... | 0 | 1 | 0 | 0 | 1 | 0 |
Python/ThreeSum.py | TonnyL/Windary | 205 | 1705528 | # -*- coding: UTF-8 -*-
#
# Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?
# Find all unique triplets in the array which gives the sum of zero.
#
# Note: The solution set must not contain duplicate triplets.
#
# For example, given array S = [-1, 0, 1, 2, -1, -4],
#
# A solution... | 0 | 3 | 0 | 0 | 3 | 0 |
app/job/public.py | sunshicheng/JobCenter | 152 | 1705552 | # -*- coding: utf-8 -*-
# @Author: guomaoqiu
# @File Name: public.py
# @Date: 2019-03-12 11:01:33
# @Last Modified by: guomaoqiu
# @Last Modified time: 2019-03-19 11:50:42
from __future__ import annotations
import subprocess
import json
import datetime
from datetime import date
def exec_shell(cmd) -> bool | tuple... | 0 | 2 | 0 | 0 | 2 | 0 |
api/tacticalrmm/accounts/migrations/0013_user_client_tree_sort.py | infinite8co/tacticalrmm | 903 | 1705582 | # Generated by Django 3.1.7 on 2021-03-09 02:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('accounts', '0012_user_agents_per_page'),
]
operations: list[object] = [
migrations.AddField(
model_name='... | 0 | 0 | 2 | 0 | 2 | 0 |
mindinsight/utils/command.py | mindspore-ai/mindinsight | 216 | 1705584 | # 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 | 0 | 4 | 0 | 4 | 0 |
tests/components/prometheus/__init__.py | domwillcode/home-assistant | 30,023 | 1705601 | """Tests for the prometheus component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
experiments/scripts/cph_run.py | kstawiski/DeepSurv | 395 | 1705605 | <filename>experiments/scripts/cph_run.py<gh_stars>100-1000
import sys, os
sys.path.append("/DeepSurv/deepsurv")
# Force matplotlib to not use any Xwindows backend.
import matplotlib
matplotlib.use('Agg')
import viz
import utils
import argparse
from collections import defaultdict
import pandas as pd
import numpy as n... | 0 | 0 | 0 | 0 | 0 | 0 |
prepare_model.py | www516717402/Minimal-IK | 213 | 1705625 | from config import *
import pickle
import numpy as np
def prepare_mano_model():
"""
Convert the official MANO model into compatible format with this project.
"""
with open(OFFICIAL_MANO_PATH, 'rb') as f:
data = pickle.load(f, encoding='latin1')
params = {
'pose_pca_basis': np.array(data['hands_compo... | 0 | 0 | 0 | 0 | 0 | 0 |
torchsketch/utils/general_utils/md5sum.py | songyzh/torchsketch | 182 | 1705626 | import hashlib
def md5sum(file_url) -> object:
md5sum = hashlib.md5()
with open(file_url,'rb') as f:
while True:
data = f.read(2048)
if not data:
break
md5sum.update(data)
return md5sum.hexdigest() | 0 | 1 | 0 | 0 | 1 | 0 |
tcapy/vis/app_board.py | Ahrvo-Trading-Systems/tcapy | 189 | 1705639 | <gh_stars>100-1000
"""This provides the entry point for the GUI web application, which uses the Dash library on top lightweight server
web application (eg. Flask). This version allows users to upload a CSV file with their trades.
It queries TCAEngine, which returns appropriate TCA output (via TCACaller). Uses LayoutDa... | 0 | 0 | 0 | 0 | 0 | 0 |
keras_ext/rproj_layers_util.py | ChunyuanLI/intrinsic-dimension | 203 | 1705642 | <reponame>ChunyuanLI/intrinsic-dimension
#! /usr/bin/env python
# Copyright (c) 2018 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/hardkernel/__init__.py | liangleslie/core | 30,023 | 1705652 | <gh_stars>1000+
"""Tests for the Hardkernel integration."""
| 0 | 0 | 0 | 0 | 0 | 0 |
Ch18/plotdist.py | jason-168/MLCode | 146 | 1705655 | <gh_stars>100-1000
# Code from Chapter 18 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code com... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/quad/quad_transform.py | xhzdeng/crpn | 166 | 1705683 | # --------------------------------------------------------
# CRPN
# Written by <NAME>
# --------------------------------------------------------
import numpy as np
from quad_convert import quad_2_aabb
from sort_points import sort_points
def quad_transform(ex_rois, gt_rois) -> object:
ex_rois = sort_points(ex_roi... | 0 | 3 | 0 | 0 | 3 | 0 |
23电商爬虫和Scrapy框架/day01/MySpider/MySpider/spiders/itcast.py | HaoZhang95/PythonAndMachineLearning | 937 | 1705696 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import scrapy
from MySpider.items import MyspiderItem
class ItcastSpider(scrapy.Spider):
name = 'itcast'
# 允许的域名必须和下面的start_url中的www后面的一样,不然可能获取不到
allowed_domains = ['itcast.cn']
start_urls = ['http://www.itcast.cn/channel/teacher.shtml']
def parse(self... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/detection/fsce/coco/fsce_r101_fpn_coco_30shot-fine-tuning.py | BIGWangYuDong/mmfewshot | 376 | 1705706 | _base_ = [
'../../_base_/datasets/fine_tune_based/few_shot_coco.py',
'../../_base_/schedules/schedule.py', '../fsce_r101_fpn.py',
'../../_base_/default_runtime.py'
]
# classes splits are predefined in FewShotCocoDataset
# FewShotCocoDefaultDataset predefine ann_cfg for model reproducibility
data = dict(
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter11/add_attachment.py | add54/ADMIN_SYS_PYTHON | 116 | 1705707 | import os
import smtplib
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
import getpass
host_name = 'smtp.gmail.com'
port = 465
sender = '<EMAIL>'
password = getpass.getpass()
receiver = '<EMAIL>'
text = MIMEMultipart()
text['Subject'] = 'Tes... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/UniquePathsTest.py | TonnyL/Windary | 205 | 1705717 | <filename>Python/UniquePathsTest.py
from unittest import TestCase
from UniquePaths import UniquePaths
class TestUniquePaths(TestCase):
def test_uniquePaths(self):
up = UniquePaths()
self.assertTrue(up.uniquePaths(1, 1) == 1)
self.assertTrue(up.uniquePaths(1, 2) == 1)
# Expected:... | 0 | 0 | 0 | 0 | 0 | 0 |
pybliometrics/scopus/utils/checks.py | herreio/pybliometrics | 186 | 1705742 | def check_parameter_value(parameter, allowed, name):
"""Raise a ValueError if a parameter value is not in the set of
allowed values.
"""
if parameter not in allowed:
raise ValueError(f"Parameter '{name}' must be one of {', '.join(allowed)}.")
| 0 | 0 | 0 | 0 | 0 | 0 |
src/meltano/cli/run.py | meltano/meltano | 122 | 1705770 | """meltano run command and supporting functions."""
from typing import List, Union
import click
import structlog
from meltano.core.block.blockset import BlockSet
from meltano.core.block.parser import BlockParser, validate_block_sets
from meltano.core.block.plugin_command import PluginCommandBlock
from meltano.core.db ... | 2 | 2 | 0 | 0 | 4 | 0 |
utils/meters.py | LegionChang/CoTNet | 360 | 1705773 | import decimal
import numpy as np
from collections import deque
import torch
from config import cfg
from utils.timer import Timer
from utils.logger import logger_info
import utils.distributed as dist
from utils.distributed import sum_tensor
def accuracy(output, target, topk: tuple[int]=(1,)) -> object:
"""Compute... | 4 | 10 | 0 | 8 | 22 | 0 |
Matrix_Portal_Eyes/eyes/werewolf/data.py | joewalk102/Adafruit_Learning_System_Guides | 665 | 1705789 | """ Configuration data for the werewolf eyes """
EYE_PATH = __file__[:__file__.rfind('/') + 1]
EYE_DATA = {
'eye_image' : EYE_PATH + 'werewolf-eyes.bmp',
'upper_lid_image' : EYE_PATH + 'werewolf-upper-lids.bmp',
'lower_lid_image' : EYE_PATH + 'werewolf-lower-lids.bmp',
'stencil_image' : EYE_... | 0 | 0 | 0 | 0 | 0 | 0 |
catboost/benchmarks/kaggle/rossmann-store-sales/xgboost_early_stopping.py | HeyLey/catboost | 6,989 | 1705815 | <reponame>HeyLey/catboost
#!/usr/bin/env python
import os.path
import config
import experiment_lib
import xgboost as xgb
class XGBoostExperimentEarlyStopping(experiment_lib.ExperimentEarlyStopping):
def __init__(self, **kwargs):
super(XGBoostExperimentEarlyStopping, self).__init__(**kwargs)
def g... | 0 | 0 | 0 | 0 | 0 | 0 |
datadog_checks_base/datadog_checks/base/checks/openmetrics/v2/transformers/rate.py | mchelen-gov/integrations-core | 663 | 1705836 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
def get_rate(check, metric_name, modifiers, global_options) -> object:
"""
Send with the `AgentCheck.rate` method.
"""
rate_method = check.rate
def rate(metric, sample_data, runtime_... | 0 | 1 | 0 | 0 | 1 | 0 |
python/recommendation_systems/cdl/mnist_sae.py | marktab/mxnet-notebooks | 731 | 1705891 | # pylint: skip-file
import mxnet as mx
import numpy as np
import logging
import mnist_data as data
from math import sqrt
from autoencoder import AutoEncoderModel
if __name__ == '__main__':
lv = 1e-2# lv/ln in CDL
# set to INFO to see less information during training
logging.basicConfig(level=log... | 0 | 0 | 0 | 0 | 0 | 0 |
train_segmentation.py | ashish-roopan/fsgan | 599 | 1705910 | from __future__ import annotations
import os
import itertools
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils as tutils
import torchvision.transforms as transforms
import numpy as np
from tqdm import tqdm
from fsgan.utils.obj_factory import obj_factory
from fsgan.utils.tensorboard_logger ... | 24 | 4 | 0 | 0 | 28 | 0 |
test/expensive_verify_pretrain_optimizable.py | ignatovmg/mhcflurry | 113 | 1705926 | # Expensive test - not run by nose.
from mhcflurry import train_pan_allele_models_command
from mhcflurry.downloads import get_path
from mhcflurry.allele_encoding import AlleleEncoding
import pandas
import numpy
PRETRAIN_DATA_PATH = get_path(
"random_peptide_predictions", "predictions.csv.bz2")
FULL_TRAIN_DF = p... | 0 | 0 | 0 | 0 | 0 | 0 |
xhr/resources/delay.py | meyerweb/wpt | 14,668 | 1705939 | <reponame>meyerweb/wpt<gh_stars>1000+
import time
def main(request, response):
delay = float(request.GET.first(b"ms", 500))
time.sleep(delay / 1E3)
return [(b"Access-Control-Allow-Origin", b"*"), (b"Access-Control-Allow-Methods", b"YO"), (b"Content-type", b"text/plain")], b"TEST_DELAY"
| 0 | 0 | 0 | 0 | 0 | 0 |
roamer/engine.py | sujaymansingh/roamer | 681 | 1705976 | <reponame>sujaymansingh/roamer
"""
Determines commands to be run in order to update the original directory and match
the state of the edit directory.
"""
from roamer.command import Command
from roamer import record
from roamer.entry import Entry
from roamer.directory import Directory
class Engine(object):
def __in... | 0 | 0 | 0 | 0 | 0 | 0 |
libsaas/services/pingdom/servertime.py | 80vs90/libsaas | 155 | 1705980 | <gh_stars>100-1000
from libsaas import port
from libsaas.services import base
from . import resource
class Servertime(resource.PingdomGETResource):
path = 'servertime'
# redefine methods to set docstring later
@base.mark_apimethod
def get(self):
return super(Servertime, self).get()
port.m... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_cobra.py | vishalbelsare/pycobra | 119 | 1705996 | # Licensed under the MIT License - https://opensource.org/licenses/MIT
import unittest
import numpy as np
from pycobra.cobra import Cobra
from pycobra.ewa import Ewa
from pycobra.kernelcobra import KernelCobra
import logging
from sklearn.utils.estimator_checks import check_estimator
class TestPrediction(unittest.... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_sendq_recvq_socket_buffer.py | lhuett/insights-core | 121 | 1706004 | import doctest
import pytest
from insights.parsers import ParseException
from insights.tests import context_wrap
from insights.parsers import sendq_recvq_socket_buffer
from insights.parsers.sendq_recvq_socket_buffer import SendQSocketBuffer, RecvQSocketBuffer
SENDQ_SOCKET_BUFFER = """
4096 16384 4194304
""".strip()
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pretix/base/migrations/0196_auto_20210523_1322.py | hansegucker/pretix | 1,248 | 1706027 | # Generated by Django 3.2.2 on 2021-05-23 13:22
import django.db.models.deletion
from django.db import migrations, models
import pretix.helpers.countries
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('pretixbase', '0195_auto_20210622_1457'),
]
operations: list... | 0 | 0 | 2 | 0 | 2 | 0 |
Dynamic Programming/1235. Maximum Profit in Job Scheduling.py | beckswu/Leetcode | 138 | 1706043 | class Solution:
def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int:
jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1])
dp = [[0, 0]]
for s, e, p in jobs:
i = bisect.bisect(dp, [s + 1]) - 1
if dp[i][1] + p > dp[-... | 9 | 3 | 0 | 0 | 12 | 0 |
setup.py | m1ndmaze/xlwings | 1,138 | 1706068 | <gh_stars>1000+
import os
import sys
import re
import glob
from setuptools import setup, find_packages
# long_description: Take from README file
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f:
readme = f.read()
# Version Number
with open(os.path.join(os.path.dirname(__file__), "xlwings", "_... | 0 | 0 | 0 | 0 | 0 | 0 |
Contents/Libraries/Shared/guessit/rules/properties/crc.py | jippo015/Sub-Zero.bundle | 1,553 | 1706078 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
crc and uuid properties
"""
from rebulk.remodule import re
from rebulk import Rebulk
from ..common.validators import seps_surround
def crc() -> object:
"""
Builder for rebulk object.
:return: Created Rebulk object
:rtype: Rebulk
"""
rebulk = R... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/compr-rotor.py | jchkoch/pycalculix | 138 | 1706081 | #!/usr/bin/env python3
import math
import sys
import pycalculix as pyc
import matplotlib.pyplot as plt
# We'll be modeling a rotating jet engine part
model_name = 'compr-rotor'
model = pyc.FeaModel(model_name)
# this sets dist units to meters, labels our consistent units
model.set_units('m')
# set whether or not to ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxr/tests/ShowProcessMemoryDetail/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 1706087 | <gh_stars>100-1000
expected_output = {
'jid': {240: {'index': {1: {'data': '195M',
'dyn_limit': 'unlimited',
'dynamic': '275K',
'jid': 240,
'phy_tot': '6M',
'process': 'bgp_policy_reg_... | 0 | 0 | 0 | 0 | 0 | 0 |
integration_tests/samples/readme/proxy.py | priya1puresoftware/python-slack-sdk | 2,486 | 1706093 | import logging
logging.basicConfig(level=logging.DEBUG)
# export SLACK_API_TOKEN=<PASSWORD>-***
# python3 integration_tests/samples/readme/proxy.py
import os
from slack_sdk.web import WebClient
from ssl import SSLContext
sslcert = SSLContext()
# pip3 install proxy.py
# proxy --port 9000 --log-level d
proxyinfo = "h... | 0 | 0 | 0 | 0 | 0 | 0 |
anchore_engine/db/db_grype_db_feed_metadata.py | rbrady/anchore-engine | 1,484 | 1706095 | from anchore_engine.db import GrypeDBFeedMetadata
from anchore_engine.subsys import logger
class NoActiveGrypeDB(Exception):
def __init__(self):
super().__init__("No active grypedb available")
def get_most_recent_active_grypedb(session) -> GrypeDBFeedMetadata:
"""
Queries active GrypeDBFeedMetad... | 0 | 1 | 0 | 0 | 1 | 0 |
app/__init__.py | chenxinjingjing/pyecharts-app | 188 | 1706105 | <gh_stars>100-1000
from flask import Flask
from flask_bootstrap import Bootstrap
app = Flask(__name__, static_folder='static')
bootstrap = Bootstrap(app)
from . import views
| 0 | 0 | 0 | 0 | 0 | 0 |
yabgp/message/attribute/linkstate/node/nodeflags.py | mengjunyi/yabgp | 203 | 1706107 | <filename>yabgp/message/attribute/linkstate/node/nodeflags.py
# Copyright 2015-2018 Cisco Systems, 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
facebook_business/adobjects/serverside/tests/user_data_test.py | GDGSNF/facebook-python-business-sdk | 576 | 1706115 | <filename>facebook_business/adobjects/serverside/tests/user_data_test.py<gh_stars>100-1000
# Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web se... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Math/ZeroDivision.py | piovezan/SOpt | 148 | 1706184 | <reponame>piovezan/SOpt
n = int(input())
i = 0
while i < n:
try:
x, y = input().split(" ")
x = float(x)
y = float(y)
if y != 0:
print(x / y)
i += 1
else:
print('divisao impossivel')
except ValueError:
print('fomrmato digitado errad... | 0 | 0 | 0 | 0 | 0 | 0 |
core/retry_failed.py | mikekaminsky/dbt-helper | 104 | 1706192 | <filename>core/retry_failed.py
from dbt.config import RuntimeConfig
import os
import json
import subprocess
RUN_RESULTS_FILE = "run_results.json"
class RetryFailedTask:
def __init__(self, args):
self.args = args
self.config = RuntimeConfig.from_args(args)
self.target_path = self.config.t... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_libbrotli.py | RobbiNespu/forget | 157 | 1706227 | <reponame>RobbiNespu/forget
import pytest
import libforget.brotli
BEE_SCRIPT = bytes("According to all known laws of aviation,", 'UTF-8')
TIMEOUT_TARGET = 0.2
@pytest.fixture
def app(redisdb):
from flask import Flask
app_ = Flask(__name__)
app_.config['REDIS_URI'] = 'redis://localhost:15487'
app_.de... | 0 | 0 | 0 | 0 | 0 | 0 |
hottbox/algorithms/classification/base.py | adamurban98/hottbox | 167 | 1706234 | from inspect import signature
# TODO: add interface and for checking labels at the training and testing stages (by analogy with sklearn)
# TODO: override __repr__ method by analogy with sklearn and how base Decomposition interface.
class Classifier(object):
""" General interface for all classes that describe clas... | 0 | 4 | 0 | 0 | 4 | 0 |
beyond/src/gcs.py | infinit/memo | 124 | 1706243 | from __future__ import annotations
import base64
import datetime
import httplib2
import requests
import time
import urllib.parse
import Crypto.Hash.SHA256 as SHA256
import Crypto.PublicKey.RSA as RSA
import Crypto.Signature.PKCS1_v1_5 as PKCS1_v1_5
class GCS:
host: str = 'storage.googleapis.com'
def __init__(se... | 20 | 13 | 1 | 1 | 35 | 0 |
generate/lib/run-firefox/cuddlefish/preflight.py | flamencist/browser-extensions | 102 | 1706248 | <filename>generate/lib/run-firefox/cuddlefish/preflight.py
import os, sys
import base64
import simplejson as json
def create_jid():
"""Return 'jid1-XYZ', where 'XYZ' is a randomly-generated string. (in the
previous jid0- series, the string securely identified a specific public
key). To get a suitable add-o... | 0 | 0 | 0 | 0 | 0 | 0 |
src/inventory/migrations/0013_add_app_to_collaborator.py | RogerTangos/datahub-stub | 192 | 1706282 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('inventory', '0012_change_collaborator_fields'),
]
operations: list[object] = [
migrations.AddField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
gym_gazebo2/utils/general_utils.py | kkonen/gym-gazebo2 | 339 | 1706311 | <gh_stars>100-1000
""" This file defines general utility functions and classes. """
import math
import numpy as np
# import sys
#
# sys.path.append('/home/rkojcev/ros_python3/devel/lib')
import PyKDL as kdl
class BundleType():
"""
This class bundles many fields, similar to a record or a mutable
namedtuple... | 0 | 0 | 0 | 0 | 0 | 0 |
python/784_Letter_Case_Permutation.py | dvlpsh/leetcode-1 | 4,416 | 1706324 | class Solution(object):
# def letterCasePermutation(self, S):
# ans = [[]]
# for char in S:
# n = len(ans)
# if char.isalpha():
# # Double the ans
# for i in xrange(n):
# ans.append(ans[i][:])
# ans[i].a... | 0 | 1 | 0 | 0 | 1 | 0 |
single_tech_samples/databricks/sample4_ci_cd/spark_python_jobs/tests/integration/main_test.py | rhjohnst/modern-data-warehouse-dataops | 307 | 1706358 |
import unittest
import sys
from spark_python_jobs.main import SampleJob
from uuid import uuid4
from pyspark.dbutils import DBUtils # noqa
from pyspark.sql import SparkSession, DataFrame
class SampleJobIntegrationTest(unittest.TestCase):
def setUp(self):
self.test_dir = "dbfs:/tmp/tests/sample/%s" % str... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/hilander/test.py | ketyi/dgl | 9,516 | 1706366 | <filename>examples/pytorch/hilander/test.py
import argparse, time, os, pickle
import numpy as np
import dgl
import torch
import torch.optim as optim
from models import LANDER
from dataset import LanderDataset
from utils import evaluation, decode, build_next_level, stop_iterating
###########
# ArgParser
parser = argp... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.