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 |
|---|---|---|---|---|---|---|---|---|---|---|
test/test_assignors.py | informatique-cdc/kafka-python | 4,389 | 1753163 | # pylint: skip-file
from __future__ import annotations
from __future__ import absolute_import
from collections import defaultdict
from random import randint, sample
import pytest
from kafka.structs import TopicPartition
from kafka.coordinator.assignors.range import RangePartitionAssignor
from kafka.coordinator.assig... | 2 | 5 | 0 | 0 | 7 | 0 |
telethon/hints.py | fx2hero/Telethon | 6,709 | 1753174 | <reponame>fx2hero/Telethon
import datetime
import typing
from . import helpers
from .tl import types, custom
Phone = str
Username = str
PeerID = int
Entity = typing.Union[types.User, types.Chat, types.Channel]
FullEntity = typing.Union[types.UserFull, types.messages.ChatFull, types.ChatFull, types.ChannelFull]
Entit... | 0 | 0 | 0 | 0 | 0 | 0 |
GeneratorInterface/EvtGenInterface/test/Py8_tt_evtgen1_cfg.py | ckamtsikis/cmssw | 852 | 1753199 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("PhysicsTools.HepMCCandAlgos.genParticles_cfi")
process.source = cms.Source("EmptySource"... | 0 | 0 | 0 | 0 | 0 | 0 |
L1TriggerConfig/RPCTriggerConfig/test/hsbConfigTest.py | ckamtsikis/cmssw | 852 | 1753259 | import FWCore.ParameterSet.Config as cms
process = cms.Process("read")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.source = cms.Source("EmptySource")
process.rpcconfsrc1 = cms.ESProducer("RPCTriggerHsbConfig",
hsb0Mask = cms.vint32(1,2,3,0,1,2,3,0),
hsb1Mask = cms.vint... | 0 | 0 | 0 | 0 | 0 | 0 |
scrap_all_email/scrap_all_email.py | tre3x/awesomeScripts | 245 | 1753285 | <filename>scrap_all_email/scrap_all_email.py<gh_stars>100-1000
import re
import sys
import requests
url = sys.argv[1]
website = requests.get(url)
html = website.text
emails = re.findall(r"[\w\.-]+@[\w\.-]+", html)
print(emails)
| 0 | 0 | 0 | 0 | 0 | 0 |
jaxfg/noises/_gaussians.py | AvanDavad/jaxfg | 120 | 1753298 | <filename>jaxfg/noises/_gaussians.py
from typing import Sequence, Union
import jax_dataclasses
from jax import numpy as jnp
from overrides import overrides
from .. import hints
from ._noise_model_base import NoiseModelBase
@jax_dataclasses.pytree_dataclass
class Gaussian(NoiseModelBase):
sqrt_precision_matrix: ... | 0 | 0 | 0 | 0 | 0 | 0 |
webots_ros2_core/webots_ros2_core/webots_robotic_arm_node.py | TaoYibo1866/webots_ros2 | 176 | 1753308 | # Copyright 1996-2021 Cyberbotics 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 in... | 3 | 0 | 0 | 0 | 3 | 0 |
pyrep/robots/end_effectors/baxter_gripper.py | WeiWeic6222848/PyRep | 505 | 1753329 | from pyrep.robots.end_effectors.gripper import Gripper
class BaxterGripper(Gripper):
def __init__(self, count: int = 0):
super().__init__(count, 'BaxterGripper',
['BaxterGripper_leftJoint',
'BaxterGripper_rightJoint'])
| 1 | 0 | 0 | 0 | 1 | 0 |
db_test_data.py | taylortaurus/seldom | 374 | 1753335 | import time
from seldom.db_operation import SQLiteDB, MySQLDB
# 定义过去时间
past_start_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() - 100000))
past_end_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() - 100000 + 7200))
# 发布会开始&结束时间
start_time = time.strftime("%Y-%m-%d %H:%M:%S"... | 0 | 0 | 0 | 0 | 0 | 0 |
app/demo/documents/migrations/0005_link_is_approved.py | sesostris/django-material-admin | 270 | 1753345 | <filename>app/demo/documents/migrations/0005_link_is_approved.py
# Generated by Django 3.0 on 2019-12-22 17:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('documents', '0004_document_url'),
]
operations = [
migrations.AddField(
... | 0 | 0 | 0 | 0 | 0 | 0 |
gradslam/geometry/projutils.py | glebshevchukk/gradslam | 1,048 | 1753349 | """
Projective geometry utility functions.
"""
from typing import Optional
import torch
def homogenize_points(pts: torch.Tensor) -> object:
r"""Convert a set of points to homogeneous coordinates.
Args:
pts (torch.Tensor): Tensor containing points to be homogenized.
Returns:
torch.Tenso... | 11 | 5 | 21 | 0 | 37 | 0 |
azure-iot-device/tests/provisioning/conftest.py | danewalton/azure-iot-sdk-python | 366 | 1753393 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import sy... | 0 | 0 | 0 | 0 | 0 | 0 |
rosetta/__init__.py | mbi/django-rosetta | 526 | 1753402 | try:
import django
if django.VERSION[:3] <= (3, 2, 0):
default_app_config = "rosetta.apps.RosettaAppConfig"
except ImportError:
pass
VERSION = (0, 9, 8)
def get_version(limit: int=3) -> object:
"""Return the version as a human-format string."""
return '.'.join([str(i) for i in VERSION[:l... | 1 | 1 | 0 | 0 | 2 | 0 |
lib/python2.7/site-packages/ryu/services/protocols/bgp/core_manager.py | nishaero/wifi-userseg-ryu | 269 | 1753423 | <reponame>nishaero/wifi-userseg-ryu<gh_stars>100-1000
# Copyright (C) 2014 Nippon Telegraph and Telephone 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... | 0 | 0 | 0 | 0 | 0 | 0 |
cfgov/v1/tests/test_filterable_list_form.py | Colin-Seifer/consumerfinance.gov | 156 | 1753439 | <gh_stars>100-1000
from datetime import date, datetime
from io import StringIO
from django.test import TestCase, override_settings
from wagtail.core.models import Site
from pytz import timezone
from search.elasticsearch_helpers import ElasticsearchTestsMixin
from v1.documents import (
EnforcementActionFilterabl... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/external_libs/scapy-2.4.5/scapy/contrib/mqtt.py | dariusgrassi/trex-core | 250 | 1753445 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under GPLv2 license
# scapy.contrib.description = Message Queuing Telemetry Transport (MQTT)
# scapy.contrib.status = loads
from scapy.packet import Packet, bind_la... | 0 | 4 | 28 | 0 | 32 | 0 |
calvin/actorstore/systemactors/net/UDPSender.py | gabrielcercel/calvin-base | 334 | 1753452 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | 0 | 1 | 4 | 0 | 5 | 0 |
live_recorder/you_live/_base_recorder.py | iwestlin/LiveRecorder | 146 | 1753465 | # coding=utf-8
from __future__ import annotations
import requests
import os
import time
import re
from .flv_checker import Flv
recorders = {}
def recorder(liver) -> object:
assert liver != None
def clazz(cls) -> object:
recorders[liver] = cls
cls.liver = liver
return c... | 11 | 2 | 0 | 2 | 15 | 0 |
torchkit/utils/git.py | kevinzakka/torchkit | 144 | 1753490 | <filename>torchkit/utils/git.py
import subprocess
# Reference: https://stackoverflow.com/a/21901260
def git_revision_hash() -> str:
"""Return the git commit hash of the current directory.
Note:
Will return a `fatal: not a git repository` string if the command fails.
"""
try:
string = ... | 0 | 0 | 0 | 0 | 0 | 0 |
inselect/tests/gui/test_barcode_dialog.py | NaturalHistoryMuseum/inselect | 128 | 1753508 | <reponame>NaturalHistoryMuseum/inselect
import unittest
from mock import patch
from PyQt5.QtCore import QSettings
from inselect.gui.plugins.barcode_dialog import BarcodeDialog
from .gui_test import GUITest
class TestBarcodeDialog(GUITest):
"""Tests the config dialog box of the 'Read barcode' plugin
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/automation/trex_control_plane/interactive/trex/wireless/services/unit_tests/wireless_service_event_test.py | timgates42/trex-core | 956 | 1753515 | from wireless.services.trex_wireless_device_service import WirelessDeviceService
from wireless.trex_wireless_device import WirelessDevice
from wireless.services.trex_wireless_service_event import WirelessServiceEvent
from wireless.services.unit_tests.mocks import _pipe, _Connection
from wireless.pubsub.pubsub import Pu... | 0 | 5 | 0 | 3 | 8 | 0 |
src/tests/simian/mac/munki/handlers/manifests_medium_test.py | tristansgray/simian | 326 | 1753520 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/dialogs/hello-world.py | deekshant-w/tkinter-tutorial | 111 | 1753526 | import tkinter
from tkinter import ttk, messagebox
def do_hello_world():
messagebox.showinfo("Important Message", "Hello World!")
root = tkinter.Tk()
big_frame = ttk.Frame(root)
big_frame.pack(fill='both', expand=True)
button = ttk.Button(big_frame, text="Click me", command=do_hello_world)
button.pack()
root.m... | 0 | 0 | 0 | 0 | 0 | 0 |
riemann/examples/sapling_example.py | sturmianseq/riemann | 118 | 1753565 | import riemann
from riemann import simple, utils
from riemann.encoding import addresses as addr
from riemann.script import serialization as ser
riemann.select_network('zcash_sapling_main')
prevout_addr_1 = 't1S3kN4zusjHtDEwfdaCMgk132bqo9DaYW4'
prevout_addr_2 = 't1VQCUYzApF5eWf4UFAGdWwaFEpBfG2su1A'
# This is the scri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/__init__.py | starenka/xhtml2pdf | 1,016 | 1753566 | from __future__ import absolute_import
from .runtests import buildTestSuite
| 0 | 0 | 0 | 0 | 0 | 0 |
cdlib/algorithms/internal/modularity_r.py | xing-lab-pitt/cdlib | 248 | 1753580 | <gh_stars>100-1000
import networkx as nx
import time
from random import random
class ModularityRCommunityDiscovery(object):
minimum_improvement = 0.000001
def __init__(self, graph):
self.graph = graph
self.starting_node = None
self.community = []
self.boundary = set()
... | 0 | 0 | 0 | 0 | 0 | 0 |
python_modules/libraries/dagster-celery/dagster_celery_tests/test_utils.py | dbatten5/dagster | 4,606 | 1753590 | import os
from .utils import tempdir_wrapper
def test_tempdir_wrapper():
with tempdir_wrapper("/tmp/foobar") as tempfile:
assert tempfile == "/tmp/foobar"
with tempdir_wrapper() as tempfile:
assert os.path.isdir(tempfile)
assert not os.path.isdir(tempfile)
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/utils/disabling.py | robin-raymond/ArcticTypescript | 117 | 1753595 | # coding=utf8
from __future__ import annotations
import sublime
import os
from .debug import Debug
from ..system.globals import plugin_disabled_for_folders
# ############## Allows Disabling of ArcticTypescript ######################
# has a global variable in globals.py
def is_plugin_globally_disabled() -> obje... | 3 | 3 | 0 | 0 | 6 | 0 |
scripts/irods/test/test_rule_engine_plugin_framework.py | JustinKyleJames/irods | 333 | 1753611 | <filename>scripts/irods/test/test_rule_engine_plugin_framework.py
from __future__ import print_function
import sys
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
import copy
import inspect
import json
import os
import socket
import tempfile
import time # remove once file hash... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_datasets/test_loading.py | hologerry/mmflow | 481 | 1753647 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import numpy as np
from mmflow.datasets.pipelines import LoadAnnotations, LoadImageFromFile
img1_ = osp.join(osp.dirname(__file__), '../data/00001_img1.ppm')
img2_ = osp.join(osp.dirname(__file__), '../data/00001_img2.ppm')
flow_ = osp... | 0 | 0 | 0 | 0 | 0 | 0 |
test/samples/sample_helpers.py | kl4w3i/ppci | 161 | 1753658 | <reponame>kl4w3i/ppci
import io
import os
from helper_util import relpath, source_files
from ppci import api
from ppci.utils.reporting import html_reporter
from ppci.lang.c import COptions
def create_test_function(source, output, lang):
""" Create a test function for a source file """
with open(source) as f:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_imageset.py | globotree/imageprocessing | 191 | 1753685 | <gh_stars>100-1000
#!/usr/bin/env python
# coding: utf-8
"""
Test imageset class
Copyright 2017 MicaSense, 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 with... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/gn_test.py | onix39/engine | 5,823 | 1753698 | # Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import os
import imp
SKY_TOOLS = os.path.dirname(os.path.abspath(__file__))
gn = imp.load_source('gn', os.path.join(SKY_TOOLS, 'gn'))
class ... | 0 | 1 | 0 | 0 | 1 | 0 |
caffe2/python/operator_test/ngram_ops_test.py | Hacky-DH/pytorch | 60,067 | 1753708 |
import hypothesis.strategies as st
from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import numpy as np
class TestNGramOps(hu.HypothesisTestCase):
@given(
seed=st.integers(0, 2**32 - 1),
N=st.integers(min_value=10, max_val... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/scf/40-apply_electric_field.py | robert-anderson/pyscf | 501 | 1753713 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
This example has two parts. The first part applies oscillated electric field
by modifying the 1-electron Hamiltonian. The second part generate input
script for Jmol to plot the HOMOs. Running jmol xxxx.spt can output 50
image files of HOMOs... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/TrigXMonitor/python/L1TScalersSCAL_cfi.py | ckamtsikis/cmssw | 852 | 1753715 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
#demo = cms.EDAnalyzer('L1TScalers'
#)
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
l1tscalers = DQMEDAnalyzer('L1TScalersSCAL',
#l1GtData = cms.InputTag("l1GtUnpack","","HLT"),
#dqmFolder = cms.untracked.str... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/memory_inspector/memory_inspector/core/stacktrace.py | kjthegod/chromium | 2,151 | 1753733 | # Copyright 2014 The Chromium 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 __future__ import annotations
import posixpath
from memory_inspector.core import symbol
class Stacktrace(object):
"""Models a stack-trace, which is... | 0 | 6 | 0 | 4 | 10 | 0 |
zentral/contrib/mdm/payloads.py | janheise/zentral | 634 | 1753737 | from __future__ import annotations
import logging
import plistlib
from django.http import HttpResponse
from django.urls import reverse
from zentral.conf import settings
from zentral.utils.certificates import split_certificate_chain
from zentral.utils.payloads import generate_payload_uuid, get_payload_identifier
from ze... | 6 | 9 | 0 | 0 | 15 | 0 |
test/test_values.py | dongsc1994/sql-metadata | 313 | 1753760 | <reponame>dongsc1994/sql-metadata<gh_stars>100-1000
from sql_metadata import Parser
def test_getting_values():
parser = Parser(
"INSERT /* VoteHelper::addVote xxx */ "
"INTO `page_vote` (article_id,user_id,`time`) "
"VALUES ('442001','27574631','20180228130846')"
)
assert parser.v... | 0 | 0 | 0 | 0 | 0 | 0 |
biggan_imagenet/generate.py | SuperStar0907/lecam-gan | 135 | 1753765 | <gh_stars>100-1000
# Copyright 2021 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 or agreed ... | 0 | 0 | 0 | 0 | 0 | 0 |
after.py | kajeet1305/AfterQC | 188 | 1753786 | #!/usr/bin/env python
import os,sys
from optparse import OptionParser
import time
import fastq
import preprocesser
from multiprocessing import Process, Queue
import copy
from util import *
AFTERQC_VERSION = "0.9.6"
def parseCommand() -> object:
usage = "Automatic Filtering, Trimming, Error Removing and Quality C... | 0 | 4 | 0 | 0 | 4 | 0 |
Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Simple Enough.py | cnm06/Competitive-Programming | 994 | 1753791 | <gh_stars>100-1000
def answer(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
s = str(answer(n / 2))
return s + str(n % 2) + s
data = [int(i) for i in raw_input().split()]
text = answer(data[0])
ans = 0
for i in xrange(data[1] - 1, data[2]):
if text[i] == '1':
... | 0 | 0 | 0 | 0 | 0 | 0 |
h/migrations/versions/628c53b07_add_the_organization_table.py | tgiardina/rpp-h | 2,103 | 1753820 | """
Add the organization table.
Revision ID: 628c53b07
Revises: <KEY>
Create Date: 2018-03-15 11:00:50.420618
"""
import sqlalchemy as sa
from alembic import op
revision = "<KEY>"
down_revision = "<KEY>"
def upgrade():
op.create_table(
"organization",
sa.Column("id", sa.Integer, autoincrement=T... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/apps/forum_moderation/test_forms.py | BrendaH/django-machina | 572 | 1753822 | <filename>tests/unit/apps/forum_moderation/test_forms.py
import pytest
from faker import Faker
from machina.apps.forum_moderation.forms import TopicMoveForm
from machina.core.db.models import get_model
from machina.core.loading import get_class
from machina.test.factories import (
ForumReadTrackFactory, PostFactor... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/generate_slot_keys.py | yusukegoto/redis-py-cluster | 1,075 | 1753860 | import random
import string
import sys
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": "7000"}]
# Note: decode_responses must be set to True when used with python3
rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True)
# 10 batches
batch_set = {i: [] for i in range... | 0 | 0 | 0 | 0 | 0 | 0 |
feapder/utils/perfect_dict.py | RuixiangS/feapder | 876 | 1753865 | <reponame>RuixiangS/feapder<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on 2021/4/8 11:32 上午
---------
@summary:
---------
@author: Boris
@email: <EMAIL>
"""
def ensure_value(value):
if isinstance(value, (list, tuple)):
_value = []
for v in value:
_value.append(ensure_value(v... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/openbb_terminal/stocks/due_diligence/test_finviz_model.py | tehcoderer/GamestonkTerminal | 255 | 1753901 | <filename>tests/openbb_terminal/stocks/due_diligence/test_finviz_model.py
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import finviz.main_func
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.due_diligence import finviz_model
@pytest.mark.vcr
def test_get_news(mocker, recorder):
# REMOVE FINV... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ray/tests/test_autoscaler_fake_multinode.py | jamesliu/ray | 21,382 | 1753902 | <gh_stars>1000+
import pytest
import platform
import ray
from ray.cluster_utils import AutoscalingCluster
@pytest.mark.skipif(
platform.system() == "Windows", reason="Failing on Windows.")
def test_fake_autoscaler_basic_e2e(shutdown_only):
# __example_begin__
cluster = AutoscalingCluster(
head_re... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/incremental_learning/helmet_detection/training/validate_utils.py | Jw-Jm/sedna | 311 | 1753930 | # Copyright 2021 The KubeEdge 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 law or agreed to in... | 3 | 6 | 0 | 0 | 9 | 0 |
tensorflow/python/keras/utils/kernelized_utils_test.py | EricRemmerswaal/tensorflow | 190,993 | 1753939 | <reponame>EricRemmerswaal/tensorflow
# Copyright 2018 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/statsmodels/tools/parallel.py | EkremBayar/bayar | 6,931 | 1753943 | """Parallel utility function using joblib
copied from https://github.com/mne-tools/mne-python
Author: <NAME> <<EMAIL>>
License: Simplified BSD
changes for statsmodels (<NAME>)
- try import from joblib directly, (does not import all of sklearn)
"""
from statsmodels.tools.sm_exceptions import (ModuleUnavailableWarni... | 1 | 1 | 0 | 0 | 2 | 0 |
skyline/functions/numpy/percent_different.py | datastreaming/skyline-1 | 396 | 1753973 | from numpy import array as np_array
from numpy import diff as np_diff
from numpy import isnan as np_isnan
from numpy import isinf as np_isinf
# @added 20210424 - Feature #4014: Ionosphere - inference
def get_percent_different(base_value, compare_value, always_return_as_positive: bool=True) -> object:
"""
Give... | 1 | 1 | 0 | 0 | 2 | 0 |
ML/Pytorch/more_advanced/Seq2Seq_attention/seq2seq_attention.py | xuyannus/Machine-Learning-Collection | 3,094 | 1753982 | import random
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import spacy
from utils import translate_sentence, bleu, save_checkpoint, load_checkpoint
from torch.utils.tensorboard import SummaryWriter # to print to tensorboard
from torchtext.datasets import Multi30k
from torchtext.da... | 1 | 5 | 0 | 0 | 6 | 0 |
leo/modes/powerdynamo.py | ATikhonov2/leo-editor | 1,550 | 1753991 | # Leo colorizer control file for powerdynamo mode.
# This file is in the public domain.
# Properties for powerdynamo mode.
properties = {
"commentEnd": "-->",
"commentStart": "<!--",
"indentCloseBrackets": "}",
"indentOpenBrackets": "{",
"lineComment": "//",
"lineUpClosingBracket": "t... | 0 | 73 | 0 | 0 | 73 | 0 |
backend/lk/logic/slack.py | Purus/LaunchKitDocker | 2,341 | 1753997 | #
# Copyright 2016 Cluster Labs, 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 or agreed to in ... | 8 | 13 | 0 | 0 | 21 | 0 |
supports/integration-test/test_modification_actions.py | MajorJason/SSM | 199 | 1754013 | <reponame>MajorJason/SSM
import argparse
import unittest
from util import *
class TestMover(unittest.TestCase):
def test_append(self):
file_path = create_random_file(FILE_SIZE)
cid = submit_cmdlet("append -file " + file_path + " -length 1024")
cmd = wait_for_cmdlet(cid)
self.asser... | 0 | 0 | 0 | 0 | 0 | 0 |
grove/amplification/oracles.py | mkeshita/grove | 229 | 1754020 | <reponame>mkeshita/grove<filename>grove/amplification/oracles.py
##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_velocity.py | Mopolino8/pylbm | 106 | 1754074 |
import numpy as np
from pylbm.stencil import Velocity
import pytest
import random
def test_velocity_argument():
with pytest.raises(Exception):
Velocity()
@pytest.mark.parametrize('dim, axis',
[(1, [None, 0]),
(2, [None, 0, 1]),
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/states/test_docker_image.py | babs/salt | 9,425 | 1754113 | <reponame>babs/salt
"""
Unit tests for the docker state
"""
import pytest
import salt.modules.dockermod as docker_mod
import salt.states.docker_image as docker_state
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {
docker_mod: {"__context__": {"dock... | 0 | 0 | 0 | 0 | 0 | 0 |
control/tests/config_test.py | AI-App/Python-Control | 1,112 | 1754215 | """config_test.py - test config module
RMM, 25 may 2019
This test suite checks the functionality of the config module
"""
from math import pi, log10
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup as mplcleanup
import numpy as np
import pytest
import control as ct
@pytest.mark.u... | 0 | 0 | 0 | 0 | 0 | 0 |
atc/django-atc-api/atc_api/serializers.py | KeleiAzz/augmented-traffic-control | 4,319 | 1754241 | #
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
#
from __future__ import... | 0 | 7 | 3 | 0 | 10 | 0 |
demo/project/accounts/views.py | wildfish/django-rest-framework-docs | 487 | 1754258 | <reponame>wildfish/django-rest-framework-docs<filename>demo/project/accounts/views.py
from django.shortcuts import get_object_or_404
from django.views.generic.base import TemplateView
from rest_framework import parsers, renderers, generics, status
from rest_framework.authtoken.models import Token
from rest_framework.au... | 0 | 0 | 0 | 0 | 0 | 0 |
web/blog/views.py | un-project/un-project.org | 133 | 1754275 | from django.conf import settings
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from blog.models import Post
class BlogIndexView(ListView):
template_name: str = "blog/i... | 0 | 5 | 5 | 0 | 10 | 0 |
source/vsm-dashboard/vsm_dashboard/test/api_tests/network_tests.py | ramkrsna/virtual-storage-manager | 172 | 1754302 | <gh_stars>100-1000
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NEC 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/lic... | 0 | 0 | 0 | 0 | 0 | 0 |
async/collect_mac_address_tables/collection_async.py | caputomarcos/network-programmability-stream | 120 | 1754303 | <gh_stars>100-1000
import re
import time
import asyncio
from collections import defaultdict
import netdev
from decouple import config
import yaml
INVENTORY_FILE = 'mac_address_table_inventory.yml'
TEST_IP_LIST = ['10.48.18.24', '10.48.18.30']
GLOBAL_DEVICE_PARAMS = {
'device_type': 'cisco_ios',
'us... | 0 | 0 | 0 | 0 | 0 | 0 |
mmaction/datasets/image_dataset.py | JerryX1110/VFS | 106 | 1754306 | import os
import os.path as osp
from torchvision.datasets.folder import IMG_EXTENSIONS, make_dataset
from .builder import DATASETS
from .video_dataset import VideoDataset
@DATASETS.register_module()
class ImageDataset(VideoDataset):
def __init__(self, ann_file, pipeline, start_index: int=0, **kwargs):
... | 1 | 2 | 0 | 0 | 3 | 0 |
src/python/pants/backend/go/util_rules/assembly.py | yoav-orca/pants | 1,806 | 1754307 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os.path
from dataclasses import dataclass
from pathlib import PurePath
from pants.backend.go.subsystems.golang import GoRoot
from pants.backend.... | 3 | 3 | 15 | 0 | 21 | 0 |
venv/lib/python3.7/site-packages/allauth/socialaccount/providers/yahoo/urls.py | vikram0207/django-rest | 6,342 | 1754308 | <filename>venv/lib/python3.7/site-packages/allauth/socialaccount/providers/yahoo/urls.py
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import YahooProvider
urlpatterns = default_urlpatterns(YahooProvider)
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/confidentialledger/azure-confidentialledger/tests/_shared/client_test_common.py | rsdoherty/azure-sdk-for-python | 2,728 | 1754314 | import hashlib
import os
import tempfile
from azure.confidentialledger import (
LedgerUserRole,
TransactionState,
)
from .constants import NETWORK_CERTIFICATE, USER_CERTIFICATE
from .testcase import ConfidentialLedgerTestCase
CONFIDENTIAL_LEDGER_URL = "https://fake-confidential-ledger.azure.com"
class Conf... | 0 | 1 | 0 | 0 | 1 | 0 |
mindspore/profiler/parser/optime_parser.py | LottieWang/mindspore | 3,200 | 1754315 | # 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 | 3 | 2 | 0 | 5 | 0 |
examples/hello-cgen.py | maelso/cgen | 119 | 1754318 | <reponame>maelso/cgen
import cgen as c
func = c.FunctionBody(
c.FunctionDeclaration(c.Const(c.Pointer(c.Value("char", "greet"))), []),
c.Block([
c.Statement('return "hello world"')
])
)
print(func)
| 0 | 0 | 0 | 0 | 0 | 0 |
chitra/cli/main.py | aniketmaurya/Chitra | 158 | 1754358 | import typer
from chitra import __version__
from chitra.cli import builder
app = typer.Typer(
name="chitra CLI ✨",
add_completion=False,
)
app.add_typer(
builder.app,
name="builder",
)
@app.command()
def version():
typer.echo(f"Hey 👋! You're running chitra version={__version__} ✨")
| 0 | 0 | 0 | 0 | 0 | 0 |
components/idf_test/integration_test/TestCaseScript/WiFiStress/WifiSmartConfig.py | Mixerito/esp-idf | 104 | 1754370 | import random
import os
import time
import copy
from TCAction import TCActionBase
from NativeLog import NativeLog
from Utility import Encoding
from Utility import MakeFolder
AP_PROP = ("ssid", "ssid_len", "pwd",
"pwd_len", "channel", "enc", "apc")
SMART_TYPE = ("esp-touch", "airkiss")
TEST_METHOD = ("ssi... | 0 | 0 | 0 | 0 | 0 | 0 |
openbook_notifications/models/connection_confirmed_notification.py | TamaraAbells/okuna-api | 164 | 1754385 | from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from openbook_auth.models import User
from openbook_notifications.models.notification import Notification
cla... | 0 | 1 | 0 | 0 | 1 | 0 |
py/c/variables.py | pombredanne/debin | 322 | 1754395 | from common import utils
from common.constants import FUN_ARG, LOC_VAR, ENUM_ABBREV_CODE, UNKNOWN_LABEL
from common.constants import VOID, INT, TTYPES
from collections import Counter
from elements.regs import Reg
from elements.offsets import IndirectOffset
def make_variables(locs, binary) -> object:
variables =... | 0 | 3 | 0 | 4 | 7 | 0 |
questions/60354837/autobowgui.py | LoicGRENON/stackoverflow | 302 | 1754409 | from __future__ import annotations
import configparser
from PyQt5 import QtCore, QtGui, QtWidgets
from autobowgui_ui import Ui_Dialog
class AutoBowGui(QtWidgets.QDialog, Ui_Dialog):
def __init__(self, parent: object | None=None):
super(AutoBowGui, self).__init__(parent)
self.setupUi(self)
... | 1 | 0 | 0 | 0 | 1 | 0 |
yolo/frontend.py | sak1sham/Reconciliation---Meter-Reading-Entered-Manually-Vs-Photograph-2 | 251 | 1754450 | # -*- coding: utf-8 -*-
# This module is responsible for communicating with the outside of the yolo package.
# Outside the package, someone can use yolo detector accessing with this module.
from __future__ import annotations
import os
import numpy as np
from yolo.backend.decoder import YoloDecoder
from yolo.backend.l... | 20 | 6 | 0 | 0 | 26 | 0 |
base.py | Aareon/tinycoin | 105 | 1754451 | <reponame>Aareon/tinycoin
from ecdsa import SigningKey, VerifyingKey
import hashlib
import sys
import ast
import random
import tornado
import tornado.websocket
from tornado.queues import Queue
from tornado import gen
from tornado.ioloop import IOLoop
import datetime
def sha(x):
return hashlib.sha256(x).hexdigest()
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/packager/packager/test/test_metadata.py | peturingi/opae-sdk | 220 | 1754468 | <gh_stars>100-1000
import unittest
import packager
import filecmp
import metadata.constants
import struct
import os
import json
from collections import OrderedDict
filepath = os.path.dirname(os.path.realpath(__file__))
afu_json = (
'{"version": 1, "afu-image": {"clock-frequency-low": 50, '
'"slot-type-uuid": ... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Tests/TestData/Grammar/RawBytes.py | techkey/PTVS | 695 | 1754470 | rb'\fob'
rb'''\fob'''
rb"\fob"
rb"""\fob"""
Rb'\fob'
Rb'''\fob'''
Rb"\fob"
Rb"""\fob"""
rB'\fob'
rB'''\fob'''
rB"\fob"
rB"""\fob"""
RB'\fob'
RB'''\fob'''
RB"\fob"
RB"""\fob"""
| 0 | 0 | 0 | 0 | 0 | 0 |
utils_nlp/models/pytorch_modules/conditional_gru.py | rsadaphule/nlp | 4,407 | 1754471 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""A Gated Recurrent Unit (GRU) cell with peepholes."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConditionalGRU(nn.Module):
"""A Gated Recurrent Unit (GRU) cel... | 0 | 0 | 0 | 0 | 0 | 0 |
easyreg/mermaid_iter.py | ebrahimebrahim/easyreg | 107 | 1754482 | from __future__ import annotations
from .base_mermaid import MermaidBase
from .utils import *
import mermaid.utils as py_utils
import mermaid.simple_interface as SI
class MermaidIter(MermaidBase):
def name(self) -> str:
return 'mermaid-iter'
def initialize(self,opt):
"""
:param opt: Par... | 3 | 10 | 0 | 0 | 13 | 0 |
apex/transformer/pipeline_parallel/_timers.py | Muflhi01/apex | 6,523 | 1754485 | import time
import torch
class _Timer:
"""Timer."""
def __init__(self, name):
self.name_ = name
self.elapsed_: float = 0.0
self.started_: bool = False
self.start_time = time.time()
def start(self):
"""Start the timer."""
assert not self.started_, "timer h... | 5 | 2 | 0 | 3 | 10 | 0 |
examples/basic/mesh_map2cell.py | evanphilip/vedo | 836 | 1754507 | """Map an array which is defined on
the vertices of a mesh to its cells"""
from vedo import *
mesh1 = Mesh(dataurl+'icosahedron.vtk').lineWidth(0.1).flat()
doc = Text2D(__doc__, pos="bottom-left")
# let the scalar be the z coordinate of the mesh vertices
msg1 = Text2D("Scalar originally defined on points..", pos="to... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/decompose_images.py | johnbanq/modl | 135 | 1754515 | <reponame>johnbanq/modl
# Author: <NAME>
# License: BSD
import time
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
from modl.datasets.image import load_image
from modl.decomposition.image import ImageDictFact, DictionaryScorer
from modl.feature_extraction.image import LazyCleanPatchExtract... | 0 | 0 | 0 | 0 | 0 | 0 |
Fastformer.py | dumpmemory/Fastformer-PyTorch | 123 | 1754557 | <filename>Fastformer.py
import einops
from einops import rearrange
import torch
import torch.nn as nn
class Fastformer(nn.Module):
def __init__(self, dim = 3, decode_dim = 16):
super(Fastformer, self).__init__()
# Generate weight for Wquery、Wkey and Wvalue
self.to_qkv = nn.Linear(dim, decod... | 0 | 0 | 0 | 0 | 0 | 0 |
web/views/views_api.py | nonomal/oh-my-rss | 270 | 1754558 |
from django.http import HttpResponseNotFound, HttpResponseServerError, JsonResponse, HttpResponseForbidden
import django
from web.models import *
from web.utils import incr_view_star, get_visitor_subscribe_feeds, get_user_subscribe_feeds, get_login_user, \
add_user_sub_feeds, del_user_sub_feed, get_user_unread_cou... | 0 | 9 | 0 | 0 | 9 | 0 |
tests/test_load_legal_docs.py | 18F/openFEC | 246 | 1754580 | <reponame>18F/openFEC
import unittest
from unittest.mock import patch
from webservices.legal_docs import (
delete_murs_from_es,
delete_murs_from_s3,
index_regulations,
index_statutes,
load_archived_murs,
create_docs_index
)
from webservices.legal_docs.load_legal_docs import (
get_subject_tr... | 0 | 0 | 0 | 0 | 0 | 0 |
python/akg/composite/build_module.py | mindspore-ai/akg | 286 | 1754595 | <filename>python/akg/composite/build_module.py<gh_stars>100-1000
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2020-2021 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... | 0 | 0 | 0 | 0 | 0 | 0 |
image_segmentation/utils/model_helpers.py | wisespa/fritz-models | 277 | 1754633 | from __future__ import annotations
import tempfile
import os
import coremltools
import tensorflow as tf
import PIL.Image
import skimage.transform
import skimage.filters
import numpy
from tensorflow.python.platform import gfile
from image_segmentation import data_generator
import image_segmentation
import requests
from... | 12 | 9 | 0 | 1 | 22 | 0 |
kglib/utils/graph/thing/queries_to_graph.py | jmsfltchr/research | 416 | 1754663 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you m... | 1 | 4 | 0 | 0 | 5 | 0 |
tuplex/python/tests/test_arithmetic.py | rahulyesantharao/tuplex | 778 | 1754675 | #!/usr/bin/env python3
#----------------------------------------------------------------------------------------------------------------------#
# #
# Tuplex: Blazing... | 0 | 2 | 0 | 0 | 2 | 0 |
backend/src/baserow/contrib/database/views/validators.py | cjh0613/baserow | 839 | 1754711 | from django.core.exceptions import ValidationError
EMPTY_VALUES = (None, "", b"", [], (), {}, False)
def required_validator(value):
if value in EMPTY_VALUES:
raise ValidationError("This field is required.", code="required")
| 0 | 0 | 0 | 0 | 0 | 1 |
model_hub/examples/huggingface/text-classification/xnli_trial.py | shiyuann/determined | 1,729 | 1754726 | <reponame>shiyuann/determined
"""
This example is largely based on the XNLI text-classification example in the huggingface
transformers library. The license for the example in the transformer's library is reproduced below.
================================================================================================... | 0 | 0 | 0 | 0 | 0 | 0 |
unittest/scripts/auto/py_shell/scripts/cmd_edit_norecord.py | mueller/mysql-shell | 119 | 1754727 | #@ initialization
import os
import os.path
shell = os.path.join(__bin_dir, "mysqlsh")
helper = os.path.join(__data_path, "py", "edit_command.py")
command = "{0} --file {1}".format(shell, helper)
#@ connect to a server
\connect <<<__mysqluripwd>>>
# WL12763-TSFR2_3 - When the system variables `EDITOR` and/or `VISUAL`... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ext/test_json.py | wyfo/typical | 157 | 1754766 | from __future__ import annotations
import importlib
import sys
from unittest import mock
import pytest
@pytest.fixture
def drop_orjson():
import orjson
del orjson
with mock.patch.dict(sys.modules, values={"orjson": None}):
yield
@pytest.fixture
def drop_ujson():
import ujson
del ujso... | 2 | 1 | 0 | 0 | 3 | 0 |
external/deep-object-reid/tests/sc_input_params_validation/helpers.py | opencv/openvino_training_extensions | 775 | 1754769 | <gh_stars>100-1000
"""
OTE parameters validation tests helpers
"""
import numpy as np
from ote_sdk.entities.annotation import (
Annotation,
AnnotationSceneEntity,
AnnotationSceneKind,
)
from ote_sdk.entities.dataset_item import DatasetItemEntity
from ote_sdk.entities.datasets import DatasetEntity
from ote... | 0 | 0 | 0 | 0 | 0 | 0 |
automask.py | lukas-blecher/AutoMask | 112 | 1754795 |
from __future__ import annotations
from __future__ import print_function
import bpy
from bpy.types import Operator, Panel, PropertyGroup, WindowManager
from bpy.props import PointerProperty, StringProperty, IntProperty, FloatProperty, BoolProperty
import sys
paths = [
#PYTHON_PATH,
PROJECT_DIR
]
for p in path... | 4 | 12 | 25 | 0 | 41 | 0 |
src/datasets/common.py | jlsneto/hmr | 1,359 | 1754817 | from __future__ import annotations
"""
Helpers for tfrecord conversion.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
class ImageCoder(object):
"""Helper class that provides TensorFlow image coding util... | 2 | 12 | 0 | 0 | 14 | 0 |
caffe2/python/tutorials/helpers.py | KevinKecc/caffe2 | 585 | 1754866 | <reponame>KevinKecc/caffe2
# Copyright (c) 2016-present, Facebook, 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 ... | 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.