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 |
|---|---|---|---|---|---|---|---|---|---|---|
hw/vendor/lowrisc_ibex/vendor/google_riscv-dv/pygen/experimental/riscv_data_page_gen.py | GregAC/opentitan | 1,375 | 119120 | """Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | 1 | 1 | 0 | 1 | 3 | 0 |
features/feature_ebert_qa.py | Woffee/deformer | 114 | 119131 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .feature_bert_qa import BertQaDataBuilder
class EbertQaDataBuilder(BertQaDataBuilder):
TASK_FEATURES: tuple[str, str, str] = ('feature_id', 'question_ids', 'context_ids')
def __init__(self, config):
super().__init__(config)
self.max_first_l... | 2 | 6 | 1 | 0 | 9 | 0 |
language/bert_extraction/steal_bert_classifier/utils/merge_datasets_simple.py | Xtuden-com/language | 1,199 | 119146 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/oauth/__init__.py | sbybfai/izone | 1,009 | 119164 | <gh_stars>1000+
default_app_config = 'oauth.apps.OauthConfig' | 0 | 0 | 0 | 0 | 0 | 0 |
docs/feature/customop_example.py | yuhonghong66/minpy | 1,271 | 119209 | <reponame>yuhonghong66/minpy<filename>docs/feature/customop_example.py
@customop('numpy')
def my_softmax(x, y):
probs = numpy.exp(x - numpy.max(x, axis=1, keepdims=True))
probs /= numpy.sum(probs, axis=1, keepdims=True)
N = x.shape[0]
loss = -numpy.sum(numpy.log(probs[numpy.arange(N), y])) / N
retur... | 0 | 0 | 0 | 0 | 0 | 0 |
elpis/engines/common/input/clean_json.py | guillaume-wisniewski/elpis | 118 | 119213 | <gh_stars>100-1000
#!/usr/bin/python3
"""
Given a json file with transcript information these tools can perform
- manipulations including generating word lists or filtering output to
- exclude english/punctuation.
- Optionally provide the output json file name with -j
Usage: python3 clean_json.py [-h] [--i INFILE] [-... | 0 | 0 | 0 | 0 | 0 | 0 |
speculator/tests/unit/test_rsi.py | NathanBMcNamara/Speculator | 106 | 119221 | from speculator.features.RSI import RSI
import unittest
class RSITest(unittest.TestCase):
def test_eval_rs(self):
gains = [0.07, 0.73, 0.51, 0.28, 0.34, 0.43, 0.25, 0.15, 0.68, 0.24]
losses = [0.23, 0.53, 0.18, 0.40]
self.assertAlmostEqual(RSI.eval_rs(gains, losses), 2.746, places=3)
d... | 0 | 0 | 0 | 0 | 0 | 0 |
functions/image/image_processing.py | hsokooti/RegNet | 187 | 119229 | <gh_stars>100-1000
import math
import numpy as np
import os
import SimpleITK as sitk
import time
import functions.kernel.conv_kernel as conv_kernel
import functions.tf_utils as tfu
def ReadImage(im_address, waiting_time=1):
"""
simpleITK when writing, creates a blank file then fills it within few seconds. Thi... | 0 | 0 | 0 | 0 | 0 | 0 |
modelchimp/migrations/0044_auto_20190130_0754.py | akarsh3007/modelchimp | 134 | 119230 | # Generated by Django 2.1.3 on 2019-01-30 07:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('modelchimp', '0043_machinelearningmodel_grid_search'),
]
op... | 0 | 0 | 2 | 0 | 2 | 0 |
observations/r/sparrows.py | hajime9652/observations | 199 | 119246 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def sparrows(path) -> tuple[object, object]:
"""Sparrows
Weight and wi... | 0 | 1 | 0 | 0 | 1 | 0 |
torcms/handlers/collect_handler.py | bukun/TorCMS | 243 | 119247 | # -*- coding:utf-8 -*-
'''
For User collection
'''
import json
import tornado.web
from config import CMS_CFG
from torcms.core import tools
from torcms.core.base_handler import BaseHandler
from torcms.core.tools import logger
from torcms.model.collect_model import MCollect
class CollectHandler(BaseHandler):
'''... | 1 | 3 | 0 | 0 | 4 | 0 |
test/python/testpipeline/testquantization.py | malywonsz/txtai | 1,893 | 119294 | """
Quantization module tests
"""
import platform
import unittest
from transformers import AutoModel
from txtai.pipeline import HFModel, HFPipeline
class TestQuantization(unittest.TestCase):
"""
Quantization tests.
"""
@unittest.skipIf(platform.system() == "Darwin", "Quantized models not supported... | 0 | 0 | 0 | 0 | 0 | 0 |
blesuite/event_handler.py | jreynders/BLESuite-1 | 198 | 119295 | from blesuite.pybt.gap import GAP
import blesuite.pybt.att as att
import logging
log = logging.getLogger(__name__)
# log.addHandler(logging.NullHandler())
class BTEventHandler(object):
"""
BTEventHandler is a event handling class passed to the BLEConnectionManager in order to
have user-controlled callbac... | 0 | 14 | 0 | 0 | 14 | 0 |
tests/test_utils.py | drdarina/slack-machine | 111 | 119313 | from machine.utils.collections import CaseInsensitiveDict
from machine.utils import sizeof_fmt
from tests.singletons import FakeSingleton
def test_Singleton():
c = FakeSingleton()
c2 = FakeSingleton()
assert c == c2
def test_CaseInsensitiveDict():
d = CaseInsensitiveDict({'foo': 'bar'})
assert '... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue_ope/airdialogue_model_transformer/generate_ope_data.py | deepneuralmachine/google-research | 23,901 | 119342 | <filename>dialogue_ope/airdialogue_model_transformer/generate_ope_data.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/self3.py | martindemello/pyright | 4,391 | 119350 | <gh_stars>1000+
# This sample tests the special-case handling of Self when comparing
# two functions whose signatures differ only in the Self scope.
class SomeClass:
def __str__(self) -> str:
...
__repr__ = __str__
| 0 | 0 | 0 | 0 | 0 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/models/m_plex/account.py | disrupted/Trakttv.bundle | 1,346 | 119357 | <gh_stars>1000+
from plugin.core.exceptions import AccountAuthenticationError
from plugin.models.core import db
from plugin.models.account import Account
from datetime import datetime, timedelta
from exception_wrappers.libraries.playhouse.apsw_ext import *
from plex import Plex
from urllib import urlencode
from urlpar... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/safe_cars_run.py | emsal1863/PILCO | 277 | 119390 | <filename>examples/safe_cars_run.py
import numpy as np
import tensorflow as tf
import gym
from pilco.models import PILCO
from pilco.controllers import RbfController, LinearController
from pilco.rewards import ExponentialReward, LinearReward
from linear_cars_env import LinearCars
from safe_pilco_extension.rewards_safe... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_016.py | ksvr444/daily-coding-problem | 1,921 | 119452 | <reponame>ksvr444/daily-coding-problem
class OrderLog:
def __init__(self, size):
self.log = list()
self.size = size
def __repr__(self):
return str(self.log)
def record(self, order_id):
self.log.append(order_id)
if len(self.log) > self.size:
self.log = se... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/reddit_wtf/app.py | CaringCat/reddit2telegram | 187 | 119491 | <filename>reddit2telegram/channels/~inactive/reddit_wtf/app.py
#encoding:utf-8
subreddit = 'wtf'
t_channel = '@reddit_wtf'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
cacheback/tasks.py | kevin-brown/django-cacheback | 160 | 119505 | <filename>cacheback/tasks.py
from celery import shared_task
from django.conf import settings
@shared_task(ignore_result=getattr(settings, 'CACHEBACK_TASK_IGNORE_RESULT', False))
def refresh_cache(klass_str, obj_args, obj_kwargs, call_args, call_kwargs):
from .base import Job
Job.perform_async_refresh(klass_s... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit2/test_is_point_in_polygon.py | yegarti/arcade | 824 | 119508 | import arcade
def test_point_in_rectangle():
polygon = [
(0, 0),
(0, 50),
(50, 50),
(50, 0),
]
result = arcade.is_point_in_polygon(25, 25, polygon)
assert result is True
def test_point_not_in_empty_polygon():
polygon = []
result = arcade.is_point_in_polygon(25... | 0 | 0 | 0 | 0 | 0 | 0 |
src/admin/database/demo.py | aimanow/sft | 280 | 119510 | <reponame>aimanow/sft
import sqlalchemy as sa
from sqlalchemy.orm import relationship
from godmode.database import database
demo_database = database("sqlite:///database/demo.sqlite", connect_args={"check_same_thread": False})
class User(demo_database.TableBase):
__table__ = sa.Table('users', demo_database.meta... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/580616_Python_method_chaining_examples/recipe-580616.py | tdiprima/code | 2,023 | 119513 | '''
Program: string_processor.py
Demo of method chaining in Python.
By: <NAME> -
http://jugad2.blogspot.in/p/about-vasudev-ram.html
Copyright 2016 <NAME>
'''
import copy
class StringProcessor(object):
'''
A class to process strings in various ways.
'''
def __init__(self, st):
'''Pass a string... | 0 | 0 | 0 | 0 | 0 | 0 |
PaddleNLP/Research/Dialogue-PLATO/plato/modules/layer_norm.py | XiaoguangHu01/models | 1,319 | 119572 | # Copyright (c) 2019 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 required by app... | 7 | 3 | 0 | 0 | 10 | 0 |
tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/packs/plugins/TomcatServerStarterPlugin.py | TanJay/stratos | 127 | 119613 | <reponame>TanJay/stratos
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
toolchain/riscv/MSYS/python/Lib/symbol.py | zhiqiang-hu/bl_iot_sdk | 207 | 119621 | <reponame>zhiqiang-hu/bl_iot_sdk<filename>toolchain/riscv/MSYS/python/Lib/symbol.py
#! /usr/bin/env python3
"""Non-terminal symbols of Python grammar (from "graminit.h")."""
# This file is automatically generated; please don't muck it up!
#
# To update the symbols in this file, 'cd' to the top directory of
#... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/496973_Get_versiWin32_Portable_Executable/recipe-496973.py | tdiprima/code | 2,023 | 119679 | from __future__ import annotations
def get_version_from_win32_pe(file) -> object | str:
# http://windowssdk.msdn.microsoft.com/en-us/library/ms646997.aspx
sig = struct.pack("32s", u"VS_VERSION_INFO".encode("utf-16-le"))
# This pulls the whole file into memory, so not very feasible for
# large binaries.
... | 0 | 1 | 0 | 0 | 1 | 0 |
ocpmodels/modules/scheduler.py | Irlirion/ocp | 242 | 119693 | from __future__ import annotations
import inspect
import torch.optim.lr_scheduler as lr_scheduler
from ocpmodels.common.utils import warmup_lr_lambda
class LRScheduler:
"""
Learning rate scheduler class for torch.optim learning rate schedulers
Notes:
If no learning rate scheduler is specified i... | 2 | 3 | 0 | 1 | 6 | 0 |
foolbox/models/__init__.py | SamplingAndEnsemblingSolvers/foolbox | 2,292 | 119704 | <gh_stars>1000+
from .base import Model # noqa: F401
from .base import TransformBoundsWrapper # noqa: F401
from .pytorch import PyTorchModel # noqa: F401
from .tensorflow import TensorFlowModel # noqa: F401
from .jax import JAXModel # noqa: F401
from .numpy import NumPyModel # noqa: F401
from .wrappers import T... | 0 | 0 | 0 | 0 | 0 | 0 |
infra/bots/assets/skimage/create.py | pospx/external_skia | 2,151 | 119725 | <filename>infra/bots/assets/skimage/create.py
#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the asset."""
import argparse
import common
from assets import asset_utils
def create_asset(target_di... | 0 | 0 | 0 | 0 | 0 | 0 |
train_image_classifier.py | kiralpoon/TwinGAN | 736 | 119790 | <filename>train_image_classifier.py<gh_stars>100-1000
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/code_x_glue_tt_text_to_text/common.py | WojciechKusa/datasets | 10,608 | 119793 | from typing import List
import datasets
# Citation, taken from https://github.com/microsoft/CodeXGLUE
_DEFAULT_CITATION = """@article{CodeXGLUE,
title={CodeXGLUE: A Benchmark Dataset and Open Challenge for Code Intelligence},
year={2020},}"""
class Child:
_DESCRIPTION: None = None
_FEATUR... | 1 | 4 | 6 | 0 | 11 | 0 |
test_python_toolbox/test_cute_iter_tools/test_pushback_iterator.py | hboshnak/python_toolbox | 119 | 119826 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
from python_toolbox import cute_testing
from python_toolbox.cute_iter_tools import PushbackIterator
def test_pushback_iterator():
pushback_iterator = PushbackIterator(iter([1, 2, 3]))
assert next(pushback_iterator) == 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
Samples/Hosting/Scenarios/register_user_commands.py | TwoUnderscorez/dlr | 307 | 119829 | import App
def foo():
print 'hello world'
App.UserCommands['foo'] = foo | 0 | 0 | 0 | 0 | 0 | 0 |
test_protocol/lfw/face_cropper/crop_calfw_by_arcface.py | weihaoxie/FaceX-Zoo | 1,329 | 119846 | <gh_stars>1000+
"""
@author: <NAME>
@date: 20201012
@contact: <EMAIL>
"""
import os
import sys
import math
import multiprocessing
import cv2
sys.path.append('/export/home/wangjun492/wj_armory/faceX-Zoo/face_sdk')
from core.image_cropper.arcface_face_recognition.FaceRecImageCropper import FaceRecImageCropper
def crop... | 0 | 0 | 0 | 0 | 0 | 0 |
python/app/thirdparty/dirsearch/lib/connection/requester.py | taomujian/linbing | 351 | 119849 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# 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 License, or
# (at your option) any later version.
#
# This program is dist... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/gacha/gacha.py | Ryoich/python_zero | 203 | 119862 | <filename>samples/gacha/gacha.py
import random
N = 44
R = 100
prob = [0.0]*R
trial = 10000
for _ in range(trial):
a = []
n = 0
for i in range(R):
a.append(random.randint(1, N))
if len(set(a)) > n:
prob[i] = prob[i] + 1
n = len(set(a))
for i in range(R):
s = "{}... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/test_runbooks_render_runbooks.py | madflojo/automon | 414 | 119922 | '''
Test Runbooks.py render_runbooks()
'''
import mock
import unittest
from runbooks import render_runbooks
class RenderRunbooksIntegrationTest(unittest.TestCase):
''' Run unit tests against the cache_runbooks method '''
def setUp(self):
''' Setup mocked data '''
self.runbooks = """
... | 0 | 0 | 0 | 0 | 0 | 0 |
koalixcrm/accounting/migrations/0001_initial.py | Cataldir/koalixcrm | 290 | 119930 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 17:02
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
nn_modules/gzip-js/test/zipTest.py | PotWallet/PotWallet-Chain | 305 | 119965 | <reponame>PotWallet/PotWallet-Chain
import os
from helpers import run_cmd
from colorama import Fore
defaultTestDir = 'test-files'
defaultOutDir = 'test-outs'
"""
Run a single test
@param tFile- required; the full path to the file to run
@param level- optional (default: all); the compression level [1-9]
@return True ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | textanalytics2020/laserembeddings | 177 | 119998 | import os
import pytest
@pytest.fixture
def test_data() -> object:
import numpy as np
test_data_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'data', 'laserembeddings-test-data.npz')
return np.load(test_data_file) if os.path.isfile(test_data_file) els... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/model_package/models/__init__.py | webjunkie/django | 790 | 120006 | <filename>tests/model_package/models/__init__.py<gh_stars>100-1000
# Import all the models from subpackages
from __future__ import absolute_import
from .article import Article
from .publication import Publication
| 0 | 0 | 0 | 0 | 0 | 0 |
jaclearn/nlp/tree/constituency.py | dapatil211/Jacinle | 114 | 120061 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : constituency.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 07/04/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
from __future__ import annotations
"""
Constituency Tree.
"""
import jacinle.random as random
from jacin... | 2 | 6 | 2 | 0 | 10 | 0 |
qutip/settings.py | quantshah/qutip | 1,205 | 120098 | <filename>qutip/settings.py
"""
This module contains settings for the QuTiP graphics, multiprocessing, and
tidyup functionality, etc.
"""
from __future__ import absolute_import
# use auto tidyup
auto_tidyup = True
# use auto tidyup dims on multiplication
auto_tidyup_dims = True
# detect hermiticity
auto_herm = True
# g... | 0 | 0 | 0 | 0 | 0 | 0 |
game/consumers.py | Greenns/channels-obstruction | 103 | 120130 | <filename>game/consumers.py
import re
import logging
from channels import Group
from channels.sessions import channel_session
from .models import Game, GameSquare
from channels.auth import http_session_user, channel_session_user, channel_session_user_from_http
log = logging.getLogger(__name__)
from django.utils.decorat... | 0 | 0 | 0 | 0 | 0 | 0 |
cherrypy/__main__.py | abancu/core | 674 | 120133 | <reponame>abancu/core
import cherrypy.daemon
if __name__ == '__main__':
cherrypy.daemon.run()
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/document_test.py | RaduG/python-cloudant | 187 | 120150 | #!/usr/bin/env python
# Copyright (c) 2015 IBM. 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 b... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pyrobot/azure_kinect/camera.py | gujralsanyam22/pyrobot | 2,150 | 120177 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pyrobot.kinect2.camera import Kinect2Camera
class AzureKinectCamera(Kinect2Camera):
"""
This is camera class that interfaces wi... | 0 | 0 | 0 | 0 | 0 | 0 |
scylla/proxy/__init__.py | peng4217/scylla | 3,556 | 120186 | <reponame>peng4217/scylla
from .server import start_forward_proxy_server_non_blocking, start_forward_proxy_server
| 0 | 0 | 0 | 0 | 0 | 0 |
pyunity/examples/example9/__init__.py | pyunity/pyunity | 158 | 120197 | from pyunity import Behaviour, ShowInInspector, RectTransform, Screen, Vector2, Input, CheckBox, Text, SceneManager, GameObject, Canvas, Texture2D, Gui, RectOffset, Logger, Image2D, FontLoader, RGB
import os
class Mover2D(Behaviour):
rectTransform = ShowInInspector(RectTransform)
speed = ShowInInspector(float,... | 0 | 0 | 0 | 0 | 0 | 0 |
openunreid/data/utils/data_utils.py | zwzhang121/OpenUnReID | 344 | 120273 | <reponame>zwzhang121/OpenUnReID
import os.path as osp
from PIL import Image
def read_image(path):
"""Reads image from path using ``PIL.Image``.
Args:
path (str): path to an image.
Returns:
PIL image
"""
got_img = False
if not osp.exists(path):
raise IOError('"{}" does ... | 0 | 0 | 0 | 0 | 0 | 0 |
wrappers/python/tests/did/test_list_my_dids_with_meta.py | absltkaos/indy-sdk | 636 | 120304 | <gh_stars>100-1000
import json
import pytest
from indy import did, error
@pytest.mark.asyncio
async def test_list_my_dids_works(wallet_handle, seed_my1, did_my1, verkey_my1, metadata):
await did.create_and_store_my_did(wallet_handle, json.dumps({'seed': seed_my1}))
await did.set_did_metadata(wallet_handle, ... | 0 | 0 | 0 | 0 | 0 | 0 |
2021_04_14/dojo_test.py | devppjr/dojo | 114 | 120309 | import unittest
from dojo import main
class DojoTest(unittest.TestCase):
def test_zero(self):
primes_list = list(primes(0))
self.assertListEqual(primes_list, [])
def test_one(self):
primes_list = list(primes(3))
self.assertListEqual(primes_list, [2])
def test_two(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
netbox/tenancy/migrations/0002_tenant_ordering.py | cybarox/netbox | 4,994 | 120343 | <reponame>cybarox/netbox
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tenancy', '0001_squashed_0012'),
]
operations = [
migrations.AlterModelOptions(
name='tenant',
options={'ordering': ['name']},
),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
libmem-py/configure.py | CKLinuxProject/libmem | 195 | 120377 | import os
import shutil
import json
root_dir = os.pardir
libmem_dir = f"{root_dir}{os.sep}libmem"
project_dir = os.curdir
project_src_dir = f"{project_dir}{os.sep}src/libmem-py"
clean_script = "clean.py"
print(f"[+] Creating '{clean_script}'...")
keep_dirs = []
keep_files = []
for (path, dirs, files) in os.walk(os.... | 0 | 0 | 0 | 0 | 0 | 0 |
neuspell/noising/pcrn_utils.py | TheMortalCoil92/neuspell_access | 422 | 120383 | <reponame>TheMortalCoil92/neuspell_access<gh_stars>100-1000
import json
import string
import numpy as np
from tqdm.autonotebook import tqdm
append_left_start = lambda context: "<<" + context
append_right_end = lambda context: context + ">>"
isascii = lambda s: len(s) == len(s.encode())
ispunct = lambda s: s in string... | 0 | 0 | 0 | 0 | 0 | 0 |
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py | dvzrv/softlayer-python | 126 | 120392 | <reponame>dvzrv/softlayer-python
listOriginPath = [
{
"header": "test.example.com",
"httpPort": 80,
"mappingUniqueId": "993419389425697",
"origin": "10.10.10.1",
"originType": "HOST_SERVER",
"path": "/example",
"status": "RUNNING"
},
{
"header"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/ambiguous/pkg1/__init__.py | jouve/coveragepy | 2,254 | 120394 | <gh_stars>1000+
print("Ambiguous pkg1")
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/configs/test_get_default.py | tomasfarias/dbt-core | 799 | 120398 | import pytest
from dbt.tests.util import run_dbt
models_get__any_model_sql = """
-- models/any_model.sql
select {{ config.get('made_up_nonexistent_key', 'default_value') }} as col_value
"""
class TestConfigGetDefault:
@pytest.fixture(scope="class")
def models(self) -> dict[str,object]:
return {"an... | 0 | 1 | 0 | 0 | 1 | 0 |
doc/version.py | DougReeder/remotestorage.js | 1,737 | 120411 | <gh_stars>1000+
__version__ = '2.0.0-beta.1'
| 0 | 0 | 0 | 0 | 0 | 0 |
hwt/serializer/utils.py | ufo2011/hwt | 134 | 120413 | from __future__ import annotations
from hwt.doc_markers import internal
from hwt.hdl.statements.assignmentContainer import HdlAssignmentContainer
from hwt.hdl.statements.codeBlockContainer import HdlStmCodeBlockContainer
from hwt.hdl.statements.statement import HdlStatement
from hwt.synthesizer.rtlLevel.mainBases impor... | 2 | 3 | 0 | 0 | 5 | 0 |
saw-remote-api/python/saw_client/llvm_type.py | Grain/saw-script | 411 | 120415 | from abc import ABCMeta, abstractmethod
from typing import Any, Dict, List, Optional, Set, Union, overload
class LLVMType(metaclass=ABCMeta):
@abstractmethod
def to_json(self) -> Any: pass
class LLVMIntType(LLVMType):
def __init__(self, width : int) -> None:
self.width = width
def to_json(sel... | 7 | 13 | 0 | 0 | 20 | 0 |
laikaboss/modules/explode_helloworld.py | Techie4Life83/USBKIOSK | 750 | 120439 | # Copyright 2015 Lockheed Martin Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 0 | 2 | 0 | 1 | 3 | 0 |
modules/dbnd/src/dbnd/_vendor/croniter/tests/base.py | ipattarapong/dbnd | 224 | 120446 | try:
import unittest2 as unittest
except ImportError:
import unittest
class TestCase(unittest.TestCase):
'''
We use this base class for all the tests in this package.
If necessary, we can put common utility or setup code in here.
'''
# vim:set ft=python:
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/scatter1.py | yang69can/pyngl | 125 | 120450 | #
# File:
# scatter1.py
#
# Synopsis:
# Draws a scatter visualization using polymarkers.
#
# Categories:
# Polymarkers
# Tickmarks
# Text
# XY plots
#
# Author:
# <NAME>
#
# Date of initial publication:
# October, 2004
#
# Description:
# This example reads in some dummy of XY coordina... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudbaseinit/conf/base.py | andia10240/cloudbase-init | 160 | 120454 | <filename>cloudbaseinit/conf/base.py
# Copyright 2016 Cloudbase Solutions Srl
#
# 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
miscellanies/simple_prefetcher.py | zhangzhengde0225/SwinTrack | 143 | 120459 | import threading
# Notices: 1. The correctness is relied on GIL
# 2. Iterator is not thread-safe, so don't access by different threads in the same time
class _SimplePrefetcherIterator:
def __init__(self, iterable, low_limit: int, high_limit: int):
super(_SimplePrefetcherIterator, self).__init__()
... | 4 | 5 | 0 | 4 | 13 | 0 |
abusehelper/bots/reprbot/reprbot.py | AbuseSA/abusehelper | 117 | 120533 | from __future__ import annotations
"""
Read '/repr key=val, key2=val2' style messages from body and throw
back similar message which includes machine readable idiokit
namespace.
"""
import idiokit
from idiokit.xmpp import jid
from abusehelper.core import bot, events, taskfarm
def _collect_text(element):
yield el... | 1 | 1 | 0 | 0 | 2 | 0 |
data/__init__.py | phasorhand/PyTorchText | 1,136 | 120564 | <gh_stars>1000+
from .fold_dataset import FoldData | 0 | 0 | 0 | 0 | 0 | 0 |
ykdl/extractors/laifeng.py | Shawn-Ji/ykdl | 1,153 | 120569 | <reponame>Shawn-Ji/ykdl<gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ykdl.util.html import get_content
from ykdl.util.match import match1
from ykdl.extractor import VideoExtractor
from ykdl.videoinfo import VideoInfo
import json
from random import randint
import datetime
class Laifeng(VideoExtra... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/modules/test_monit.py | eiginn/salt | 9,425 | 120610 | """
:codeauthor: <NAME> <<EMAIL>>
"""
import pytest
import salt.modules.monit as monit
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules() -> dict[object,dict[object,object]]:
return {monit: {}}
def test_start():
"""
Test for start
"""
with patch.... | 0 | 1 | 0 | 0 | 1 | 0 |
homeassistant/components/worldclock/sensor.py | MrDelik/core | 30,023 | 120642 | """Support for showing the time in a different time zone."""
from __future__ import annotations
from datetime import tzinfo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_NAME, CONF_TIME_ZONE
from homeassistant.core import HomeA... | 7 | 3 | 1 | 0 | 11 | 0 |
run_tests.py | santosh653/yappi | 877 | 120656 | <reponame>santosh653/yappi
import unittest
import sys
def _testsuite_from_tests(tests):
suite = unittest.TestSuite()
loader = unittest.defaultTestLoader
for t in tests:
test = loader.loadTestsFromName('tests.%s' % (t))
suite.addTest(test)
return suite
if __name__ == '__main__':
s... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/changes/artifacts/test_collection_artifact.py | vault-the/changes | 443 | 120667 | from cStringIO import StringIO
import mock
from changes.artifacts.base import ArtifactParseError
from changes.artifacts.collection_artifact import CollectionArtifactHandler
from changes.config import db
from changes.constants import Result
from changes.models.failurereason import FailureReason
from changes.models.job... | 0 | 0 | 0 | 0 | 0 | 0 |
cbl/function_type.py | Commodoreprime/Command-Block-Assembly | 223 | 120671 | <filename>cbl/function_type.py
import abc
import cmd_ir.instructions as i
from .native_type import NativeType
from .containers import InstanceSymbol, Parameter, Temporary
class Invokable:
def match_arguments(self, compiler, container, args):
assert False
class FunctionType(NativeType, Invokable):
... | 0 | 0 | 0 | 0 | 0 | 0 |
models/csqa_dataset.py | kachiO/KagNet | 244 | 120696 | <reponame>kachiO/KagNet
import torch
import torch.utils.data as data
import numpy as np
import json
from tqdm import tqdm
import timeit
import pickle
import os
import dgl
import networkx as nx
import random
def load_embeddings(path):
print("Loading glove concept embeddings with pooling:", path)
concept_vec = n... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop_local_tests/macos/test_macos_packet_capture_disrupt_reorder_services.py | UAEKondaya1/expressvpn_leak_testing | 219 | 120701 | <filename>desktop_local_tests/macos/test_macos_packet_capture_disrupt_reorder_services.py<gh_stars>100-1000
from desktop_local_tests.local_packet_capture_test_case_with_disrupter import LocalPacketCaptureTestCaseWithDisrupter
from desktop_local_tests.macos.macos_reorder_services_disrupter import MacOSDNSReorderServices... | 0 | 0 | 0 | 0 | 0 | 0 |
mozillians/announcements/tests/test_managers.py | divyamoncy/mozillians | 202 | 120719 | import pytz
from datetime import datetime
from mock import patch
from nose.tools import eq_
from django.utils.timezone import make_aware
from mozillians.announcements.models import Announcement
from mozillians.announcements.tests import AnnouncementFactory, TestCase
class AnnouncementManagerTests(TestCase):
de... | 0 | 0 | 0 | 0 | 0 | 0 |
extra_tests/ctypes_tests/conftest.py | nanjekyejoannah/pypy | 333 | 120736 | from __future__ import annotations
import py
import pytest
import sys
import os
# XXX: copied from pypy/tool/cpyext/extbuild.py
if os.name != 'nt':
so_ext = 'so'
else:
so_ext = 'dll'
def _build(cfilenames, outputfilename, compile_extra, link_extra,
include_dirs, libraries, library_dirs):
try:
... | 5 | 4 | 0 | 0 | 9 | 0 |
src/lib/ntpath.py | DTenore/skulpt | 2,671 | 120749 | <filename>src/lib/ntpath.py
import _sk_fail; _sk_fail._("ntpath")
| 0 | 0 | 0 | 0 | 0 | 0 |
bbio/libraries/EventIO/eventio.py | timgates42/PyBBIO | 102 | 120753 | <filename>bbio/libraries/EventIO/eventio.py
"""
EventIO - v0.2
Copyright 2012 - <NAME> <<EMAIL>>
MIT license
Basic multi-process event-driven programming for PyBBIO.
"""
from bbio import *
from ..SafeProcess import *
import time
from collections import deque
from multiprocessing import Process
# Return value of ... | 0 | 0 | 0 | 0 | 0 | 0 |
pybinding/chebyshev.py | lise1020/pybinding | 159 | 120755 | <filename>pybinding/chebyshev.py<gh_stars>100-1000
"""Computations based on Chebyshev polynomial expansion
The kernel polynomial method (KPM) can be used to approximate various functions by expanding them
in a series of Chebyshev polynomials.
"""
import warnings
import numpy as np
import scipy
from . import _cpp
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
duecredit/tests/test__main__.py | sanjaymsh/duecredit | 213 | 120765 | # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the duecredit package for the
# copyright and license terms.
#
# ## ### ... | 0 | 0 | 0 | 0 | 0 | 0 |
web/search/apps.py | ChiChou/wiggle | 110 | 120772 | <reponame>ChiChou/wiggle
from django.apps import AppConfig
class WiggleConfig(AppConfig):
name = 'wiggle'
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio.py | rsdoherty/azure-sdk-for-python | 207 | 120774 | <gh_stars>100-1000
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Genera... | 0 | 0 | 0 | 0 | 0 | 0 |
test/units/test_oci_resource_utils.py | slmjy/oci-ansible-modules | 106 | 120798 | # Copyright (c) 2018, 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
from nose... | 0 | 0 | 0 | 0 | 0 | 0 |
flambe/utils/config.py | ethan-asapp/flambe | 148 | 120826 | <gh_stars>100-1000
import os
import re
from typing import Dict
import jinja2
def generate_config_from_template(template_path: str,
config_path: str,
remove_comments: bool = False,
**template_kwargs: Dict[str, str]):... | 0 | 0 | 0 | 0 | 0 | 0 |
qd/cae/D3plot.py | martinventer/musical-dollop | 104 | 120828 | <reponame>martinventer/musical-dollop<gh_stars>100-1000
from ._dyna_utils import plot_parts, _parse_element_result, _extract_elem_coords
from .dyna_cpp import QD_D3plot, QD_Part
import os
import numpy as np
class D3plot(QD_D3plot):
__doc__ = QD_D3plot.__doc__
def compare_scatter(self,
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration/expected_out_concat/multiple.py | Inveracity/flynt | 487 | 120844 | """
This module will be transformed... into something far greater.
"""
a = "Hello"
msg = f"{a} World"
msg2 = f"Finally, {a} World"
print(msg)
| 0 | 0 | 0 | 0 | 0 | 0 |
ex9_4_2_tfwithkeras.py | soyoung9306/-3-keras | 200 | 120853 | <gh_stars>100-1000
import tensorflow as tf
sess = tf.Session()
from keras import backend as K
K.set_session(sess)
# 분류 DNN 모델 구현 ########################
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout
from keras.metrics import categorical_accuracy, categorical_crossentropy
class D... | 0 | 0 | 0 | 0 | 0 | 0 |
indy_node/test/auth_rule/auth_framework/disable_taa.py | Rob-S/indy-node | 627 | 120859 | import json
import pytest
from indy.ledger import build_acceptance_mechanisms_request
from indy_common.authorize.auth_actions import ADD_PREFIX
from indy_common.authorize.auth_constraints import AuthConstraint, IDENTITY_OWNER
from indy_common.types import Request
from indy_node.test.auth_rule.auth_framework.basic imp... | 0 | 2 | 0 | 0 | 2 | 0 |
calculator/use__simpleeval__module.py | DazEB2/SimplePyScripts | 117 | 120890 | <filename>calculator/use__simpleeval__module.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install simpleeval
from simpleeval import simple_eval
print(simple_eval("21 + 21")) # 42
print(simple_eval("2 + 2 * 2")) # 6
print(simple_eval('10 ** 123')) # 1000000000000000000000000000... | 0 | 0 | 0 | 0 | 0 | 0 |
persia/logger.py | dumpmemory/PERSIA | 283 | 120923 | import logging
from typing import Optional
from colorlog import ColoredFormatter
class levelFilter(logging.Filter):
r"""Log level filter.
Arguments:
level (int): filter log level. Only logs with level higher than ``level`` will be kept.
"""
def __init__(self, level: int):
self.leve... | 12 | 5 | 0 | 0 | 17 | 0 |
tests/test.py | ebmhu2/pysqlcipher | 108 | 120927 | <filename>tests/test.py<gh_stars>100-1000
from pysqlcipher import dbapi2 as sqlite
conn = sqlite.connect('test.db')
c = conn.cursor()
c.execute("PRAGMA key='testaverylongpasswordisthisokey'")
c.execute("create table stocks (date text, trans text, symbol text, qty real, price real)")
c.execute("""insert into stocks valu... | 0 | 0 | 0 | 0 | 0 | 0 |
www/tests/compression/huffman.py | raspberrypieman/brython | 5,926 | 120955 | <gh_stars>1000+
class ResizeError(Exception):
pass
def codelengths_from_frequencies(freqs):
freqs = sorted(freqs.items(),
key=lambda item: (item[1], -item[0]), reverse=True)
nodes = [Node(char=key, weight=value) for (key, value) in freqs]
while len(nodes) > 1:
right, left = nodes.pop(),... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/parallel_blame.py | Yobmod/git-pandas | 202 | 120999 | from gitpandas import Repository
import time
__author__ = 'willmcginnis'
if __name__ == '__main__':
g = Repository(working_dir='..')
st = time.time()
blame = g.cumulative_blame(branch='master', include_globs=['*.py', '*.html', '*.sql', '*.md'], limit=None, skip=None)
print(blame.head())
print(ti... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/watch.py | Bakkom/micropython | 594 | 121056 | ######################################################
# A watch (as in a small clock for your wrist or pocket)
#
# Button A sets the mode: Clock or Setting time
# Button B
# in clock mode: shows the time as a scrolling display
# in setting mode: increments the time
#
# The LED array displays the clock time... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/node_prediction/citation_gcn_custom.py | JonaBecher/spektral | 2,145 | 121090 | """
This script is a proof of concept to train GCN as fast as possible and with as
little lines of code as possible.
It uses a custom training function instead of the standard Keras fit(), and
can train GCN for 200 epochs in a few tenths of a second (~0.20 on a GTX 1050).
"""
import tensorflow as tf
from tensorflow.ker... | 0 | 1 | 0 | 0 | 1 | 0 |
tornado/run_test.py | nikicc/anaconda-recipes | 130 | 121121 | from tornado.httpserver import HTTPServer
| 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.