max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
flaskshop/api/checkout.py | maquinuz/flask-shop | 141 | 12738766 | from flask_restplus import Namespace, Resource, fields
from flask_login import current_user
api = Namespace("checkout", description="Checkout related operations")
cart = api.model(
"CartLine",
{
"id": fields.Integer(required=True, description="The checkout cartline id"),
"quantity": fields.In... |
third_party/tests/YosysTests/report.py | parzival3/Surelog | 156 | 12738767 | <reponame>parzival3/Surelog<filename>third_party/tests/YosysTests/report.py
#!/usr/bin/env python3
import os, time
from pathlib import Path
def getListOfFiles(dirName):
listOfFile = os.listdir(dirName)
allFiles = list()
for entry in listOfFile:
fullPath = os.path.join(dirName, entry)
if o... |
bibliopixel/util/threads/sub.py | rec/leds | 253 | 12738791 | <filename>bibliopixel/util/threads/sub.py
"""
More or less uniformly run something as a new daemon thread or process.
"""
import multiprocessing, threading, queue
def _run_locally(input, output, function, args, **kwds):
function(input, output, *args, **kwds)
def run(function, *args, use_subprocess=False, daemo... |
qrcode.py | sulphatet/Python | 28,321 | 12738801 | <filename>qrcode.py<gh_stars>1000+
#importing Required Modules
import qrcode
#QR Code Generator
query = input("Enter Content: ") #Enter Content
code = qrcode.make(str(query)) #Making the QR code
code.save("qrcode.png") #Saving the QR code file |
libs/python/config/python.py | Manu343726/boost-cmake | 918 | 12738802 | <gh_stars>100-1000
#
# Copyright (c) 2016 <NAME>
# All rights reserved.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
from . import ui
def add_options(vars):
ui.add_option('--python', help='the python exe... |
tests/test_spider.py | 123seven/ruia | 1,090 | 12738808 | <gh_stars>1000+
#!/usr/bin/env python
import asyncio
import os
from ruia import Item, Middleware, Request, Response, Spider, TextField
from ruia.exceptions import SpiderHookError
html_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "data", "for_spider_testing.html"
)
with open(html_path, mode="... |
packages/services/examples/browser/main.py | DianeHu/jupyterlab | 11,496 | 12738816 | """
Copyright (c) Jupyter Development Team.
Distributed under the terms of the Modified BSD License.
"""
import os
import json
import os.path as osp
from jupyter_server.base.handlers import JupyterHandler, FileFindHandler
from jupyter_server.extension.handler import ExtensionHandlerMixin, ExtensionHandlerJinjaMixin
fro... |
binding/web/tests/en-factory/selenium_test.py | Stonesjtu/porcupine | 1,034 | 12738822 | <filename>binding/web/tests/en-factory/selenium_test.py<gh_stars>1000+
#!/usr/bin/python3
import os
import sys
import threading
import time
from argparse import ArgumentParser
from http.server import HTTPServer, SimpleHTTPRequestHandler
from selenium import webdriver
from selenium.common.exceptions import WebDriverEx... |
examples/check_cpe.py | FreddieDev/python-libnmap | 414 | 12738829 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from libnmap.parser import NmapParser
rep = NmapParser.parse_fromfile("libnmap/test/files/full_sudo6.xml")
print(
"Nmap scan discovered {0}/{1} hosts up".format(
rep.hosts_up, rep.hosts_total
)
)
for _host in rep.hosts:
if _host.is_up():
print... |
armi/reactor/tests/test_parameters.py | keckler/armi | 162 | 12738832 | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
py/test/selenium/webdriver/common/cookie_tests.py | vinay-qa/vinayit-android-server-apk | 2,151 | 12738849 | <filename>py/test/selenium/webdriver/common/cookie_tests.py<gh_stars>1000+
import calendar
import time
import unittest
import random
import pytest
from selenium.test.selenium.webdriver.common import utils
class CookieTest(unittest.TestCase):
def setUp(self):
self._loadPage("simpleTest")
# Set the... |
util/lint_commits.py | asb/opentitan | 1,375 | 12738856 | <gh_stars>1000+
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import re
import sys
from git import Repo
error_msg_prefix = 'ERROR: '
warning_msg_prefix = 'WARNING: '
# Maximum ... |
pythonx/message_parser.py | matbb/jupyter-vim | 187 | 12738868 | """
Jupyter <-> Vim
See: <http://jupyter-client.readthedocs.io/en/stable/api/client.html>
"""
# Standard
import re
from textwrap import dedent
from threading import Thread, Lock
from time import sleep
# Py module
from jupyter_client import KernelManager
import vim
# Local
from jupyter_util import echom, unquote_str... |
configs/small/cifar10/moco_ccrop.py | xyupeng/ContrastiveCrop | 148 | 12738898 | # python DDP_moco_ccrop.py path/to/this/config
# model
dim = 128
model = dict(type='ResNet', depth=18, num_classes=dim, maxpool=False)
moco = dict(dim=dim, K=65536, m=0.999, T=0.20, mlp=True)
loss = dict(type='CrossEntropyLoss')
# data
root = '/path/to/your/dataset'
mean = (0.4914, 0.4822, 0.4465)
std = (0.2023, 0.19... |
datasets/reddit/reddit.py | dkajtoch/datasets | 10,608 | 12738902 | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace 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/LI... |
src/encoded/audit/formatter.py | procha2/encoded | 102 | 12738922 | import re
def audit_link(linkText, uri):
"""Generate link "markdown" from URI."""
return '{{{}|{}}}'.format(linkText, uri)
def path_to_text(path):
"""Convert object path to the text portion."""
accession = re.match(r'\/.*\/(.*)\/', path)
return accession.group(1) if accession else None
def space_... |
bin/check_ext_deterministic.py | dendisuhubdy/attention-lvcsr | 295 | 12738934 | <reponame>dendisuhubdy/attention-lvcsr<gh_stars>100-1000
#!/usr/bin/env python
import argparse
import fst
import sys
def main(args):
L = fst.read(args.fst_file)
for state in L:
ilab = []
for arc in state:
ilab.append(arc.ilabel)
ilabs = set(ilab)
if 0 in ilabs and... |
tests/test_cache.py | wieczorek1990/django-dynamic-models | 122 | 12738935 | import pytest
from django.utils import timezone
from dynamic_models import cache
TEST_MODEL_NAME = "test"
now = timezone.now()
@pytest.fixture
def mock_now(monkeypatch):
monkeypatch.setattr(timezone, "now", lambda: now)
def test_get_and_update_last_modified(mock_now):
assert cache.get_last_modified(TEST_... |
sdk/python/kfp/dsl/type_utils.py | Iuiu1234/pipelines | 2,860 | 12738941 | <reponame>Iuiu1234/pipelines
# Copyright 2021 The Kubeflow 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 a... |
research/object_detection/utils/learning_schedules.py | kopankom/models | 153 | 12738955 | # Copyright 2017 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... |
test/integration/identity_service_test.py | hyperledger-gerrit-archive/fabric-sdk-py | 389 | 12738971 | # Copyright IBM Corp. 2016 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... |
geoq/agents/urls.py | kaydoh/geoq | 471 | 12738985 | # -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.contrib.auth.decorators import login_required
from django.conf.urls import ur... |
zentral/core/stores/backends/splunk.py | sierra-hotel/zentral | 634 | 12739000 | <filename>zentral/core/stores/backends/splunk.py
from datetime import datetime
import json
import logging
import random
import time
from urllib.parse import urlencode, urljoin
from django.utils.functional import cached_property
from django.utils.text import slugify
import requests
from zentral.core.stores.backends.base... |
trimesh/voxel/__init__.py | hawkaa/trimesh | 1,882 | 12739013 | <filename>trimesh/voxel/__init__.py
from .base import VoxelGrid
__all__ = [
'VoxelGrid',
]
|
dialogue-engine/src/programy/parser/pattern/nodes/iset.py | cotobadesign/cotoba-agent-oss | 104 | 12739041 | <gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, 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 without limitation
the rights to use, copy, modify, mer... |
api/system/constants.py | zhangkuantian/cuelake | 272 | 12739078 | ACCOUNT_SETTING_SLACK_URL_KEY = "slackWebhookUrl"
NOTIFY_ON_SUCCESS_KEY = "notifyOnSuccess"
NOTIFY_ON_FAILURE_KEY = "notifyOnFailure" |
datasets/Part 4 - Clustering/Section 25 - Hierarchical Clustering/hc.py | abnercasallo/machinelearning-az | 234 | 12739090 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 27 13:15:02 2019
@author: juangabriel
"""
# Clustering Jerárquico
# Importar las librerías
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importar los datos del centro comercial con pandas
dataset = pd... |
toolchain/riscv/MSYS/python/Lib/test/test_urllib_response.py | zhiqiang-hu/bl_iot_sdk | 207 | 12739109 | """Unit tests for code in urllib.response."""
import socket
import tempfile
import urllib.response
import unittest
class TestResponse(unittest.TestCase):
def setUp(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.fp = self.sock.makefile('rb')
self.test... |
docs/python/logging/logging_test.py | enricomarchesin/notes | 790 | 12739159 | <gh_stars>100-1000
# Import standard library's logging
import logging
# Create function that converts dollars to cents
def convert_dollars_to_cents(dollars):
# Convert dollars to cents (as an integer)
cents = int(dollars * 100)
logging.debug("debug")
logging.info("info")
logging.warning("wa... |
magenta/models/svg_vae/image_vae.py | sandutsar/magenta | 16,143 | 12739163 | <reponame>sandutsar/magenta
# Copyright 2022 The Magenta 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 app... |
vyapp/plugins/fstmt.py | iogf/vy | 927 | 12739165 | <gh_stars>100-1000
"""
Overview
========
Find where patterns are found, this plugin uses silver searcher to search
for word patterns. It is useful to find where functions/methods
are used over multiple files.
Key-Commands
============
Namespace: fstmt
Mode: NORMAL
Event: <Control-z>
Description: Same as <Key-bar> ... |
tensorflow/python/eager/execution_callbacks.py | ryorda/tensorflow-viennacl | 522 | 12739187 | # Copyright 2017 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... |
code/evaluation.py | saurabhgupta17888/Unsupervised-Aspect-Extraction | 338 | 12739189 | import argparse
import logging
import numpy as np
from time import time
import utils as U
from sklearn.metrics import classification_report
import codecs
######### Get hyper-params in order to rebuild the model architecture ###########
# The hyper parameters should be exactly the same as those used for training
parser... |
tensor2tensor/layers/common_image_attention_test.py | jaseweir/tensor2tensor | 12,921 | 12739244 | # coding=utf-8
# Copyright 2021 The Tensor2Tensor 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 applicable... |
pliers/graph.py | nickduran/pliers | 229 | 12739262 | <gh_stars>100-1000
''' The `graph` module contains tools for constructing and executing graphs
of pliers Transformers. '''
from itertools import chain
from collections import OrderedDict
import json
from pliers.extractors.base import merge_results
from pliers.stimuli import __all__ as stim_list
from pliers.transformer... |
scripts/read-target.py | wushukai/NetBricks | 450 | 12739286 | #!/usr/bin/env python3
"""
Take the output of Cargo.toml and print target name.
"""
import sys
import json
def main(inp):
try:
o = json.loads(inp)
except:
print("Failed to interpret JSON", file=sys.stderr)
if 'targets' in o:
for target in o['targets']:
if 'kind' in targe... |
maths/Find_Min.py | ELR424/Python | 1,568 | 12739294 | def main():
def findMin(x):
minNum = x[0]
for i in x:
if minNum > i:
minNum = i
return minNum
print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56
if __name__ == '__main__':
main()
|
cgi-bin/paint_x2_unet/cgi_exe.py | Schenng/color-wave-ml-training | 2,990 | 12739317 | #!/usr/bin/env python
import numpy as np
import chainer
from chainer import cuda, serializers, Variable # , optimizers, training
import cv2
import os.path
#import chainer.functions as F
#import chainer.links as L
#import six
#import os
#from chainer.training import extensions
#from train import Image2ImageDataset
f... |
cell2location/models/base/regression_torch_model.py | nadavyayon/cell2location | 127 | 12739330 | <reponame>nadavyayon/cell2location
# -*- coding: utf-8 -*-
"""RegressionTorchModel Base class for model with no cell specific parameters"""
import matplotlib.pyplot as plt
# +
import numpy as np
import pandas as pd
from cell2location.models.base.torch_model import TorchModel
class RegressionTorchModel(TorchModel):... |
emotion.py | hyungkwonko/FacePose_pytorch | 499 | 12739385 | import cv2
import torch
from torchvision import transforms
import math
import numpy as np
import torchvision.models as models
import torch.utils.data as data
from torchvision import transforms
import cv2
import torch.nn.functional as F
from torch.autograd import Variable
import pandas as pd
import os ,torch
import torc... |
homemade/utils/features/normalize.py | gvvynplaine/homemade-machine-learning | 19,413 | 12739386 | <gh_stars>1000+
"""Normalize features"""
import numpy as np
def normalize(features):
"""Normalize features.
Normalizes input features X. Returns a normalized version of X where the mean value of
each feature is 0 and deviation is close to 1.
:param features: set of features.
:return: normalized... |
forte/processors/base/index_processor.py | J007X/forte | 163 | 12739394 | <filename>forte/processors/base/index_processor.py
# Copyright 2020 The Forte 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/lice... |
virtual/lib/python3.6/site-packages/werkzeug/contrib/sessions.py | kenmutuma001/Blog | 384 | 12739418 | # -*- coding: utf-8 -*-
r"""
werkzeug.contrib.sessions
~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains some helper classes that help one to add session
support to a python WSGI application. For full client-side session
storage see :mod:`~werkzeug.contrib.securecookie` which implements a
secure,... |
datasets/bc2gm_corpus/bc2gm_corpus.py | dkajtoch/datasets | 10,608 | 12739424 | <reponame>dkajtoch/datasets<filename>datasets/bc2gm_corpus/bc2gm_corpus.py<gh_stars>1000+
# coding=utf-8
# Copyright 2020 HuggingFace 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 Li... |
rdkit/Chem/UnitTestChemSmarts.py | kazuyaujihara/rdkit | 1,609 | 12739425 | <reponame>kazuyaujihara/rdkit<gh_stars>1000+
# $Id$
#
# Copyright (C) 2003-2006 Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source t... |
utils_scripts/joomla_rce_exploiter.py | fakegit/google_explorer | 155 | 12739431 | """
Usage:
joomla_rce_exploiter.py --file=<arg>
joomla_rce_exploiter.py --help
joomla_rce_exploiter.py --version
Options:
-h --help Open help menu
-v --version Show version
Required options:
--file='arq' arq... |
libraries/botbuilder-core/botbuilder/core/bot_state.py | Fl4v/botbuilder-python | 388 | 12739446 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import abstractmethod
from copy import deepcopy
from typing import Callable, Dict, Union
from jsonpickle.pickler import Pickler
from botbuilder.core.state_property_accessor import StatePropertyAccessor
from .bot_asse... |
src/hypercorn/__init__.py | ai-mocap/hypercorn | 264 | 12739451 | from __future__ import annotations
from .__about__ import __version__
from .config import Config
__all__ = ("__version__", "Config")
|
Torch-1 DDPG/Torch-1 DDPG CPU/main.py | summerRainn/DeepLearningNotes | 345 | 12739454 | """@author: Young
@license: (C) Copyright 2013-2017
@contact: <EMAIL>
@file: main.py
@time: 2018/1/17 10:02
"""
import gc
import gym
from agent.agent import Agent
MAX_EPISODES = 5000
env = gym.make('BipedalWalker-v2')
state_size = env.observation_space.shape[0]
action_size = env.action_space.shape[0]
agent = Agent... |
toolbox/data.py | henrytseng/srcnn | 125 | 12739459 | from functools import partial
import numpy as np
from keras.preprocessing.image import img_to_array
from keras.preprocessing.image import load_img
from toolbox.image import bicubic_rescale
from toolbox.image import modcrop
from toolbox.paths import data_dir
def load_set(name, lr_sub_size=11, lr_sub_stride=5, scale=... |
crabageprediction/venv/Lib/site-packages/fontTools/merge/base.py | 13rianlucero/CrabAgePrediction | 2,705 | 12739467 | # Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): <NAME>, <NAME>
from fontTools.ttLib.tables.DefaultTable import DefaultTable
import logging
log = logging.getLogger("fontTools.merge")
def add_method(*clazzes, **kwargs):
"""Returns a decorator function that adds a new method to one or
more ... |
ironic/tests/unit/api/controllers/v1/test_event.py | yanndegat/ironic | 350 | 12739470 | <gh_stars>100-1000
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
pypy/module/_lsprof/test/test_cprofile.py | nanjekyejoannah/pypy | 333 | 12739482 | <gh_stars>100-1000
class AppTestCProfile(object):
spaceconfig = {
"usemodules": ['_lsprof', 'time'],
}
def setup_class(cls):
cls.w_file = cls.space.wrap(__file__)
def test_repr(self):
import _lsprof
assert repr(_lsprof.Profiler) == "<type '_lsprof.Profiler'>"
def t... |
devices/management/commands/render_configuration.py | maznu/peering-manager | 127 | 12739485 | <reponame>maznu/peering-manager<gh_stars>100-1000
from argparse import FileType
from sys import stdin, stdout
from django.core.management.base import BaseCommand
from devices.models import Configuration
from peering.models import Router
class Command(BaseCommand):
help = "Render the configurations of routers."
... |
tests/test_handler.py | al3pht/cloud-custodian | 2,415 | 12739537 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import json
import logging
import mock
import os
from .common import BaseTest
from c7n.exceptions import PolicyExecutionError
from c7n.policy import Policy
from c7n import handler
class HandleTest(BaseTest):
def test_init_config_exec... |
algorithms/Python/searching/jump_search.py | Tanmoy07tech/DSA | 247 | 12739545 | """
Jump search algorithm iterates through a sorted list with a step of n^(1/2),
until the element compared is bigger than the one searched.If the item is not
in the particular step, it shifts the entire step.
It will then perform a linear search on the step until it matches the target.
If not found, it returns -1.
Tim... |
inference.py | OmkarThawakar/SeqFormer-1 | 223 | 12739582 | <reponame>OmkarThawakar/SeqFormer-1
'''
Inference code for SeqFormer
'''
import argparse
import datetime
import json
import random
import time
from pathlib import Path
import numpy as np
import torch
import datasets
import util.misc as utils
from models import build_model
import torchvision.transforms as T
import mat... |
gabbi/tests/test_replacers.py | scottwallacesh/gabbi | 145 | 12739615 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
examples/basic_functionality.py | AkBotZ/heroku3.py | 109 | 12739638 | # coding=utf-8
import os
from pprint import pprint # noqa
# Third party libraries
import heroku3
# import socket
# import httplib
# import logging
# httplib.HTTPConnection.debuglevel = 1
# logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
# logging.getLogger()... |
docs/tutorials_torch/action_recognition/extract_feat.py | Kh4L/gluon-cv | 5,447 | 12739641 | """3. Extracting video features from pre-trained models
=======================================================
Feature extraction is a very useful tool when you don't have large annotated dataset or don't have the
computing resources to train a model from scratch for your use case. It's also useful to visualize what ... |
dizoo/gym_hybrid/envs/gym_hybrid_env.py | puyuan1996/DI-engine | 464 | 12739650 | from typing import Any, List, Dict, Union, Optional
import time
import gym
import gym_hybrid
import copy
import numpy as np
from easydict import EasyDict
from ding.envs import BaseEnv, BaseEnvTimestep, BaseEnvInfo
from ding.envs.common import EnvElementInfo, affine_transform
from ding.torch_utils import to_ndarray, to_... |
examples/sklearn_job.py | kpavel/lithops | 158 | 12739656 | <gh_stars>100-1000
import numpy as np
import joblib
from lithops.util.joblib import register_lithops
from lithops.utils import setup_lithops_logger
from sklearn.datasets import load_digits
from sklearn.model_selection import RandomizedSearchCV
from sklearn.svm import SVC
digits = load_digits()
param_space = {
'C':... |
tests/models/test_bce_surv.py | rohanshad/pycox | 449 | 12739661 | import pytest
from pycox.models import BCESurv
import torchtuples as tt
from utils_model_testing import make_dataset, fit_model, assert_survs
@pytest.mark.parametrize('numpy', [True, False])
@pytest.mark.parametrize('num_durations', [2, 5])
def test_pmf_runs(numpy, num_durations):
data = make_dataset(True)
i... |
integration_tests/test_suites/k8s-integration-test-suite/conftest.py | makotonium/dagster | 4,606 | 12739673 | <filename>integration_tests/test_suites/k8s-integration-test-suite/conftest.py
# pylint: disable=unused-import
import os
import tempfile
import docker
import kubernetes
import pytest
from dagster.core.instance import DagsterInstance
from dagster_k8s.launcher import K8sRunLauncher
from dagster_k8s_test_infra.cluster im... |
libtbx/tst_containers.py | rimmartin/cctbx_project | 155 | 12739687 | <reponame>rimmartin/cctbx_project
from __future__ import absolute_import, division, print_function
def exercise_oset():
from libtbx.containers import OrderedSet as oset
o = oset()
assert repr(o) == "OrderedSet()"
assert len(o) == 0
o = oset([3,5,2,5,4,2,1])
assert list(o) == [3, 5, 2, 4, 1]
assert 3 in o
... |
docs/tests/test_images.py | victorhu3/webots | 1,561 | 12739691 | """Test module of the images."""
import unittest
from books import Books
import fnmatch
import os
import re
import sys
class TestImages(unittest.TestCase):
"""Unit test of the images."""
def test_images_are_valid(self):
"""Test that the MD files refer to valid URLs."""
books = Books()
... |
eulerian_magnification/base.py | MarGetman/EM | 323 | 12739700 | import cv2
import numpy as np
import scipy.fftpack
import scipy.signal
from matplotlib import pyplot
# from eulerian_magnification.io import play_vid_data
from eulerian_magnification.pyramid import create_laplacian_video_pyramid, collapse_laplacian_video_pyramid
from eulerian_magnification.transforms import temporal_b... |
tools/__init__.py | ziransun/wpt | 14,668 | 12739703 | <filename>tools/__init__.py<gh_stars>1000+
from . import localpaths as _localpaths # noqa: F401
|
networks/managers/trainer.py | yoxu515/aot-benchmark | 105 | 12739714 | <filename>networks/managers/trainer.py
import os
import time
import json
import datetime as datetime
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.distributed as dist
from torch.utils.data import DataLoader
from torchvision import transforms
from dataloaders.train_data... |
examples/table_movie.py | gefei/rich | 33,622 | 12739724 | <reponame>gefei/rich
"""Same as the table_movie.py but uses Live to update"""
import time
from contextlib import contextmanager
from rich import box
from rich.align import Align
from rich.console import Console
from rich.live import Live
from rich.table import Table
from rich.text import Text
TABLE_DATA = [
[
... |
xlsxwriter/test/styles/test_write_colors.py | DeltaEpsilon7787/XlsxWriter | 2,766 | 12739730 | <reponame>DeltaEpsilon7787/XlsxWriter<gh_stars>1000+
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, <NAME>, <EMAIL>
#
import unittest
from io import StringIO
from ...styles import Styles
class TestWriteColors(unittest.TestCase):... |
knox/migrations/0002_auto_20150916_1425.py | GTpyro/django-rest-knox | 788 | 12739735 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('knox', '0001_initial'),
]
operations = [
migrations.DeleteModel('AuthTok... |
Algo and DSA/LeetCode-Solutions-master/Python/longest-common-subpath.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12739749 | # Time: O(m * nlogn)
# Space: O(n)
class Solution(object):
def longestCommonSubpath(self, n, paths):
"""
:type n: int
:type paths: List[List[int]]
:rtype: int
"""
def RabinKarp(arr, x): # double hashing
hashes = tuple([reduce(lambda h,x: (h*p+x)%MOD, (a... |
zipline/pipeline/loaders/equity_pricing_loader.py | nathanwolfe/zipline-minute-bars | 412 | 12739759 | <reponame>nathanwolfe/zipline-minute-bars<filename>zipline/pipeline/loaders/equity_pricing_loader.py<gh_stars>100-1000
# Copyright 2015 Quantopian, 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 L... |
tests/test_datetime.py | ActivisionGameScience/assertpy | 246 | 12739777 | # Copyright (c) 2015-2019, Activision Publishing, Inc.
# 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 notice, this
# list of ... |
splinter/element_list.py | schurma/splinter | 2,049 | 12739783 | <filename>splinter/element_list.py
# -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from splinter.exceptions import ElementDoesNotExist
class ElementList(object):
"""
List of ... |
tests/ethereumetl/job/helpers.py | zalam003/ethereum-etl | 1,482 | 12739800 | import os
from web3 import HTTPProvider
from ethereumetl.providers.rpc import BatchHTTPProvider
from tests.ethereumetl.job.mock_batch_web3_provider import MockBatchWeb3Provider
from tests.ethereumetl.job.mock_web3_provider import MockWeb3Provider
def get_web3_provider(provider_type, read_resource_lambda=None, batch... |
aiogram/types/video.py | SvineruS/aiogram | 2,744 | 12739810 | <filename>aiogram/types/video.py
from . import base
from . import fields
from . import mixins
from .photo_size import PhotoSize
class Video(base.TelegramObject, mixins.Downloadable):
"""
This object represents a video file.
https://core.telegram.org/bots/api#video
"""
file_id: base.String = field... |
python/tvm/relay/backend/vm.py | shengxinhu/tvm | 4,640 | 12739836 | <filename>python/tvm/relay/backend/vm.py
# 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, Ver... |
tests/r/test_snow_dates.py | hajime9652/observations | 199 | 12739841 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.snow_dates import snow_dates
def test_snow_dates():
"""Test module snow_dates.py by downloading
snow_dates.... |
monk/tf_keras_1/finetune/level_13_updates_main.py | take2rohit/monk_v1 | 542 | 12739844 | from monk.tf_keras_1.finetune.imports import *
from monk.system.imports import *
from monk.tf_keras_1.finetune.level_12_losses_main import prototype_losses
class prototype_updates(prototype_losses):
'''
Main class for all parametric update functions
Args:
verbose (int): Set verbosity levels
... |
deploy/app/report/views.py | mulsign/WeeklyReport | 131 | 12739855 | <gh_stars>100-1000
#coding:utf-8
from flask import render_template, redirect,request, url_for, \
current_app, flash, Markup
from flask_babelex import lazy_gettext as _
from flask_login import current_user
from datetime import datetime, timedelta, date
from . import report
from .forms import WriteForm, ReadDepartmen... |
scripts/generate_charmap_table.py | hirnimeshrampuresoftware/python-tcod | 231 | 12739870 | #!/usr/bin/env python3
"""This script is used to generate the tables for `charmap-reference.rst`.
Uses the tabulate module from PyPI.
"""
import argparse
import unicodedata
from typing import Iterable, Iterator
from tabulate import tabulate
import tcod.tileset
def get_charmaps() -> Iterator[str]:
"""Return an ... |
grafana_dashboards/client/connection.py | Rvhappen/grafana-dashboard-builder | 131 | 12739876 | # -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# 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 ... |
walle/model/role.py | hujiangyihao/test | 12,282 | 12739895 | # -*- coding: utf-8 -*-
"""
walle-web
:copyright: © 2015-2019 walle-web.io
:created time: 2018-11-26 16:06:44
:author: <EMAIL>
"""
from datetime import datetime
from sqlalchemy import String, Integer, DateTime
from walle.model.database import SurrogatePK
from walle.model.database import db, Model
fro... |
Youtube Trending Feed Scrapper/scrap_reader.py | avinashkranjan/PraticalPythonProjects | 930 | 12739905 | # Youtube Trending Feed Reader
# Written by XZANATOL
from optparse import OptionParser
from pymongo import MongoClient
import pandas as pd
import sys
# Help menu
usage = """
<Script> [Options]
[Options]
-h, --help Shows this help message and exit
-c, --csv Reads data from "Youtube.csv" file
-m, --m... |
jarbas/chamber_of_deputies/migrations/0004_alter_field_names_following_toolbox_renamings.py | vbarceloscs/serenata-de-amor | 3,001 | 12739920 | <filename>jarbas/chamber_of_deputies/migrations/0004_alter_field_names_following_toolbox_renamings.py
from django.contrib.postgres.fields import ArrayField
from django.db import migrations, models
def convert_reimbursement_numbers_to_array(apps, schema_editor):
Reimbursement = apps.get_model("chamber_of_deputies"... |
llvm/utils/Target/ARM/analyze-match-table.py | medismailben/llvm-project | 4,812 | 12739933 | #!/usr/bin/env python
from __future__ import print_function
def analyze_match_table(path):
# Extract the instruction table.
data = open(path).read()
start = data.index("static const MatchEntry MatchTable")
end = data.index("\n};\n", start)
lines = data[start:end].split("\n")[1:]
# Parse the i... |
vnpy/api/tap/error_codes.py | iamyyl/vnpy | 323 | 12739948 | error_map = {
0: None,
-1: "连接服务失败",
-2: "链路认证失败",
-3: "主机地址不可用",
-4: "发送数据错误",
-5: "测试编号不合法",
-6: "没准备好测试网络",
-7: "当前网络测试还没结束",
-8: "没用可用的接入前置",
-9: "数据路径不可用",
-10: "重复登录",
-11: "内部错误",
-12: "上一次请求还没有结束",
-13: "输入参数非法",
-14: "授权码不合法",
-15: "授权码超期",
-1... |
hippy/module/hash/cwhirlpool.py | jweinraub/hippyvm | 289 | 12739962 | <reponame>jweinraub/hippyvm<gh_stars>100-1000
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.rtyper.tool import rffi_platform as platform
from rpython.rtyper.lltypesystem import rffi, lltype
from hippy.tool.platform import get_gmake
import subprocess
import py
LIBDIR = py.path.local(_... |
dask/array/percentile.py | marcelned/dask | 9,684 | 12740002 | <filename>dask/array/percentile.py
from collections.abc import Iterator
from functools import wraps
from numbers import Number
import numpy as np
from tlz import merge
from ..base import tokenize
from ..highlevelgraph import HighLevelGraph
from .core import Array
@wraps(np.percentile)
def _percentile(a, q, interpol... |
moderngl_window/context/pyqt5/window.py | DavideRuzza/moderngl-window | 142 | 12740031 | from typing import Tuple
from PyQt5 import QtCore, QtOpenGL, QtWidgets, QtGui
from moderngl_window.context.base import BaseWindow
from moderngl_window.context.pyqt5.keys import Keys
class Window(BaseWindow):
"""
A basic window implementation using PyQt5 with the goal of
creating an OpenGL conte... |
capslayer/data/datasets/cifar100/writer.py | ForkedReposBak/CapsLayer | 379 | 12740035 | # Copyright 2018 The CapsLayer 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 applicab... |
sportsipy/nba/constants.py | MArtinherz/sportsipy | 221 | 12740050 | PARSING_SCHEME = {
'name': 'a',
'games_played': 'td[data-stat="g"]:first',
'minutes_played': 'td[data-stat="mp"]:first',
'field_goals': 'td[data-stat="fg"]:first',
'field_goal_attempts': 'td[data-stat="fga"]:first',
'field_goal_percentage': 'td[data-stat="fg_pct"]:first',
'three_point_field_... |
tests/test_assistant.py | y226xie/flask-assistant | 400 | 12740062 | <gh_stars>100-1000
from flask_assistant.manager import Context
from tests.helpers import build_payload, get_query_response
def test_intents_with_different_formatting(simple_client, intent_payload):
resp = get_query_response(simple_client, intent_payload)
assert "Message" in resp["fulfillmentText"]
resp ... |
tests/account.py | chaserhkj/ofxclient | 219 | 12740099 | <gh_stars>100-1000
import unittest
from ofxclient import Account
from ofxclient import BankAccount
from ofxclient import BrokerageAccount
from ofxclient import CreditCardAccount
from ofxclient import Institution
class OfxAccountTests(unittest.TestCase):
def setUp(self):
institution = Institution(
... |
newtest/views.py | judexzhu/dzhops | 202 | 12740143 | <reponame>judexzhu/dzhops
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required
def testHtml(request):
user = request.user.username
return render(
request,
'test.html'
)
@login_required
def testIndex(request)... |
tests/test_chi_ssa_24.py | MAYANK25402/city-scrapers | 255 | 12740160 | <filename>tests/test_chi_ssa_24.py
from datetime import datetime
from os.path import dirname, join
import pytest # noqa
from city_scrapers_core.constants import COMMISSION, PASSED
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_ssa_24 import ChiSsa2... |
examples/benchmarks.py | ari-holtzman/transformers | 107 | 12740203 | <filename>examples/benchmarks.py<gh_stars>100-1000
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 o... |
src/zip_utils.py | TheBossProSniper/electric-windows | 210 | 12740204 | from subprocess import PIPE, Popen
from colorama import Fore, Style
import os
import winreg
from Classes.Metadata import Metadata
from Classes.PortablePacket import PortablePacket
from extension import write
home = os.path.expanduser('~')
def delete_start_menu_shortcut(shortcut_name):
start_menu = os.environ['AP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.