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 |
|---|---|---|---|---|---|---|---|---|---|---|
bindings/python/race.py | racepwn/racepwn | 234 | 1761522 | <reponame>racepwn/racepwn<gh_stars>100-1000
import librace
class RaceRawParam:
def __init__(self, data, count):
self.data = data
self.count = count
class RaceParam:
def __init__(self, type, delay_time_usec, last_chunk_size):
self.type = type
self.delay_time_usec = delay_time_... | 0 | 0 | 0 | 0 | 0 | 0 |
pipenv_pipes/core.py | harper25/pipenv-pipes | 128 | 1761524 |
from __future__ import annotations
import os
import shutil
import time
from collections import namedtuple
from .pipenv import call_python_version
from .utils import (
get_project_name,
get_project_dir_filepath,
)
Environment = namedtuple('Environment', [
'envpath',
'envname',
'project_name',
... | 0 | 7 | 0 | 0 | 7 | 0 |
tempest/tests/cmd/test_subunit_describe_calls.py | cityofships/tempest | 254 | 1761558 | # Copyright 2016 Rackspace
#
# 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... | 0 | 1 | 1 | 0 | 2 | 0 |
src/model_configurations.py | waddupitzme/graph-neural-pde | 125 | 1761581 | <gh_stars>100-1000
from function_transformer_attention import ODEFuncTransformerAtt
from function_GAT_attention import ODEFuncAtt
from function_laplacian_diffusion import LaplacianODEFunc
from block_transformer_attention import AttODEblock
from block_constant import ConstantODEblock
from block_mixed import MixedODEbloc... | 0 | 0 | 0 | 0 | 0 | 0 |
data/challenges/reversing/pydis2ctf/solution/solution.py | mister-hai/meeplabben | 114 | 1761610 | <gh_stars>100-1000
# solution to cipher one :
# after converting to python code:
def substitution_cipher(text):
ret_text=""
for i in list(text):
ret_text += chr(2*ord(i)-len(text))
return ret_text
#reversing :
def reverse_substitution_cipher(text):
ret_text=""
for i in list(text):
... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayBossFncSettleSettlementbillCancelModel.py | antopen/alipay-sdk-python-all | 213 | 1761624 | <reponame>antopen/alipay-sdk-python-all<filename>alipay/aop/api/domain/AlipayBossFncSettleSettlementbillCancelModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi
c... | 0 | 0 | 0 | 0 | 0 | 0 |
mqtt-iot/1.11/device/device.py | devops-circle/demos | 108 | 1761636 | <gh_stars>100-1000
#!/usr/bin/env python
"""
MQTT generator
"""
import random
import time
import uuid
import json
from argparse import ArgumentParser
import paho.mqtt.client as mqtt
parser = ArgumentParser()
parser.add_argument("-b", "--broker", dest="broker_address",
required=True, help="MQTT bro... | 0 | 0 | 0 | 0 | 0 | 0 |
opzoo/Softmax/test_softmax.py | wkcn/MobulaOP | 161 | 1761648 | import time
import mxnet as mx
import numpy as np
import mobula
from mobula.testing import assert_almost_equal, gradcheck
import unittest
mobula.op.load('Softmax')
T = np.float32
atol = 2e-3
rtol = 2e-3
def test_softmax1d():
N = 20
data = mx.random.uniform(0, 1, shape=(N, ))
out = mobula.op.Softmax(data... | 0 | 0 | 0 | 0 | 0 | 0 |
src/contrib/thriftdatanode/gen-py/hadoopdatanode/ThriftHadoopDatanode.py | cantbesure/hadoop-20 | 194 | 1761659 | #
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from __future__ import annotations
from thrift.Thrift import *
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtoco... | 27 | 56 | 8 | 2 | 93 | 0 |
joerd/source/ned_topobathy.py | Hivemapper/HM-colony-joerd | 207 | 1761663 | from ned_base import NEDBase
import re
import os.path
TOPOBATHY_PATTERN = re.compile('^ned19_' \
'([ns])([0-9]{2})x([0257][05])_' \
'([ew])([0-9]{3})x([0257][05])_' \
'[a-z]{2}_[a-z]+_topobathy_20[0-9]{2}.' \
... | 1 | 8 | 0 | 0 | 9 | 0 |
backend/server/main.py | EdenBD/MultiModalStory-demo | 154 | 1761665 | <reponame>EdenBD/MultiModalStory-demo<gh_stars>100-1000
from functools import lru_cache
import argparse
from typing import *
import numpy as np
# For form submission
import json
import os
import uuid
from fastapi import FastAPI
from fastapi.responses import FileResponse, RedirectResponse
from fastapi.middleware.cors i... | 0 | 0 | 0 | 0 | 0 | 0 |
CondCore/Utilities/python/CondDBFW/tests/data_formats_tests.py | ckamtsikis/cmssw | 852 | 1761689 | <gh_stars>100-1000
from __future__ import print_function
import unittest
import sys
import datetime
import pprint
import subprocess
import os
import CondCore.Utilities.CondDBFW.querying as querying
import CondCore.Utilities.CondDBFW.data_sources as data_sources
import CondCore.Utilities.CondDBFW.data_formats as data_f... | 0 | 0 | 0 | 0 | 0 | 0 |
cryptography/hamming_distance/python/hamming_char_dist.py | CarbonDDR/al-go-rithms | 1,253 | 1761697 | """
Determine the hamming distance, at the character level, between two equal length strings a and b.
"""
def hamming_char_dist(a,b) -> object:
if len(a) != len(b):
raise ValueError("a and b are unequal lengths")
dist = 0
for i in range(len(a)):
if(a[i] != b[i]):
dist += 1
re... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_models/test_decoder/test_maskflownets_decoder.py | hologerry/mmflow | 481 | 1761756 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmflow.models.decoders.maskflownet_decoder import (BasicDeformWarpBlock,
DeformWarpBlock,
MaskFlowNetSDecoder,
... | 0 | 1 | 0 | 0 | 1 | 0 |
code/data.py | jeonghyunkeem/structurenet | 212 | 1761758 | <filename>code/data.py
"""
This file defines the Hierarchy of Graph Tree class and PartNet data loader.
"""
import sys
import os
import json
import torch
import numpy as np
from torch.utils import data
from pyquaternion import Quaternion
from sklearn.decomposition import PCA
from collections import nam... | 0 | 0 | 0 | 0 | 0 | 0 |
claf/model/sequence_classification/structured_self_attention.py | GMDennis/claf | 225 | 1761829 | <filename>claf/model/sequence_classification/structured_self_attention.py
from overrides import overrides
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from claf.decorator import register
from claf.model.base import ModelWithTokenEmbedder
from claf.model.sequence_classificatio... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/disco/worker/modutil.py | pooya/disco | 786 | 1761842 | <reponame>pooya/disco
"""
:mod:`disco.worker.modutil` -- Parse and find module dependencies
=========================================================================
.. versionadded:: 0.2.3
This module provides helper functions to be used with the ``required_modules``
parameter in :class:`~disco.worker.classic.worker... | 0 | 0 | 0 | 0 | 0 | 0 |
src/Python/Visualization/SphereTexture.py | cvandijck/VTKExamples | 309 | 1761875 | #!/usr/bin/env python
##
# This example shows how to apply an vtkImageData texture to an sphere
# vtkPolyData object.
# Note: Input jpg file can be located in the VTKData repository.
#
# @author JBallesteros
##
import vtk
def get_program_parameters() -> object:
import argparse
description = 'Texture an obje... | 0 | 1 | 0 | 0 | 1 | 0 |
controller/spacecraft_instruments_controller.py | Chandru01061997/pythonDB | 409 | 1761884 | from __future__ import annotations
import codecs
from flask import Blueprint, request
from flask_cors import CORS
from service.astra_service import astra_service
spacecraft_instruments_controller = Blueprint('spacecraft_instruments_controller', __name__)
CORS(spacecraft_instruments_controller)
# This controller ha... | 0 | 4 | 0 | 0 | 4 | 0 |
data/omnimatte_dataset.py | cperales/omnimatte | 521 | 1761893 | <filename>data/omnimatte_dataset.py
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 0 | 0 | 0 | 0 | 0 | 0 |
nautobot/utilities/tests/test_config.py | psmware-ltd/nautobot | 384 | 1761914 | """Test cases for nautobot.utilities.config module."""
from constance.test import override_config
from django.test import TestCase, override_settings
from nautobot.utilities.config import get_settings_or_config
class GetSettingsOrConfigTestCase(TestCase):
"""Test the get_settings_or_config() helper function."""... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/projectupdate/0001_project/pyexample/example/code.py | patgoley/gordon | 2,204 | 1761924 | <filename>tests/projectupdate/0001_project/pyexample/example/code.py
def handler(event, context):
print("value1 = " + event['key1'])
return event['key1']
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | Nearoo/pygame-text-input | 138 | 1761930 | <gh_stars>100-1000
import pathlib
from setuptools import setup
here = pathlib.Path(__file__).parent
readme = (here / "README.md").read_text()
setup(
name="pygame-textinput",
version="1.0.0",
description="Enter text using pygame",
long_description=readme,
long_description_content_type="text/markdown... | 0 | 0 | 0 | 0 | 0 | 0 |
care/users/migrations/0038_user_alt_phone_number.py | gigincg/care | 189 | 1761938 | <gh_stars>100-1000
# Generated by Django 2.2.11 on 2021-06-01 19:32
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0037_auto_20210519_1826'),
]
operations = [
migrations.AddField(
mode... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/purview/azure-purview-scanning/tests/_util.py | praveenkuttappan/azure-sdk-for-python | 2,728 | 1761939 | <gh_stars>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.
# -----------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
idaes/power_generation/unit_models/tests/test_heat_exchanger2D.py | carldlaird/idaes-pse | 112 | 1761943 | <reponame>carldlaird/idaes-pse
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright... | 0 | 0 | 0 | 0 | 0 | 0 |
Documentation/DataFormats/python/L1Trigger_dataformats.py | ckamtsikis/cmssw | 852 | 1761971 | '''
Created on Jun 26, 2013
@author: <NAME>
@contact: <EMAIL>
http://cmsdoxy.web.cern.ch/cmsdoxy/dataformats/
@responsible:
'''
json = {
"full": {
"title": "L1Trigger collections (in RECO and AOD)",
"data": [
]
},
"aod": {
"title": "L1Trigger co... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_config.py | abhicantdraw/pandas-profiling | 8,107 | 1762025 | <filename>tests/unit/test_config.py
from pandas_profiling import ProfileReport
def test_set_variable():
r = ProfileReport(pool_size=3)
assert r.config.pool_size == 3
assert r.config.html.minify_html
r.config.pool_size = 1
assert r.config.pool_size == 1
r.config.html.minify_html = Fals... | 0 | 0 | 0 | 0 | 0 | 0 |
semisup/tools/synth_signs.py | hansroh/learning_by_association | 162 | 1762049 | <gh_stars>100-1000
from __future__ import division
from __future__ import print_function
import pickle
import numpy as np
from PIL import Image
import csv
import data_dirs
DATADIR = data_dirs.synth_signs
NUM_LABELS = 43
IMAGE_SHAPE = [40, 40, 3]
def get_data(name):
"""Utility for convenient data loading."""
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_tqdm_utils.py | WojciechKusa/datasets | 10,608 | 1762054 | from unittest.mock import patch
import datasets
from datasets import Dataset
def test_set_progress_bar_enabled():
dset = Dataset.from_dict({"col_1": [3, 2, 0, 1]})
with patch("tqdm.auto.tqdm") as mock_tqdm:
datasets.set_progress_bar_enabled(True)
dset.map(lambda x: {"col_2": x["col_1"] + 1})... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mylib/albumentations/augmentations/transforms.py | murez/mobile-semantic-segmentation | 713 | 1762063 | <filename>src/mylib/albumentations/augmentations/transforms.py
import numpy as np
from albumentations import CoarseDropout
def cutout(img, holes):
# Make a copy of the input image since we don't want to modify it directly
img = img.copy()
for x1, y1, x2, y2 in holes:
img[y1:y2, x1:x2] = np.random.... | 0 | 0 | 0 | 0 | 0 | 0 |
deep_photo.py | xuelongmu/deep-photo-styletransfer | 219 | 1762096 | import argparse
import os
import shutil
import subprocess
import scipy.misc as spm
import scipy.ndimage as spi
import scipy.sparse as sps
import numpy as np
def getlaplacian1(i_arr: np.ndarray, consts: np.ndarray, epsilon: float = 0.0000001, win_size: int = 1) -> object:
neb_size = (win_size * 2 + 1) ** 2
h, w... | 5 | 3 | 0 | 0 | 8 | 0 |
synapse/tests/test_model_crypto.py | ackroute/synapse | 216 | 1762124 | import hashlib
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.tests.utils as s_t_utils
BITS = 2048
HEXSTR_MODULUS = '<KEY>' \
'b500a06247ec2f3294891a8e62c317ee648f933ec1bf760a9d7e9a5ea4706b2a2c3f6376079114ddcc7a15d3fecf001458f' \
'22f0551802a25ef95cf46... | 0 | 0 | 0 | 0 | 0 | 0 |
labs/04_conv_nets/solutions/representations.py | soufiomario/labs-Deep-learning | 1,398 | 1762129 | <filename>labs/04_conv_nets/solutions/representations.py
# Proportion of zeros in the vector of the first image:
print("proportion of zeros (first image):", np.mean(out_tensors[0] == 0.0))
# Proportion of negative values in the full representation tensor
print("proportion of strictly negative values:", np.mean(out_ten... | 0 | 0 | 0 | 0 | 0 | 0 |
src/scripts/locations/generate_iso_3166_1.py | weimingguo/open-covid-19-data | 129 | 1762138 | # 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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/model_tests/test_networks.py | comerford/nsot | 387 | 1762150 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
import pytest
# Allow everything in there to access the DB
pytestmark = pytest.mark.django_db
from django.db import IntegrityError
from django.db.models import ProtectedError
from django.core.exceptions import Valid... | 0 | 0 | 0 | 0 | 0 | 0 |
bigg/bigg/data_process/data_util.py | deepneuralmachine/google-research | 23,901 | 1762152 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 5 | 7 | 0 | 0 | 12 | 0 |
pypykatz/commons/winapi/local/function_defs/privileges_types.py | wisdark/pypykatz | 1,861 | 1762160 | #!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import enum
class PrivilegeValues(enum.Enum):
SE_CREATE_TOKEN: int = 2
SE_ASSIGNPRIMARYTOKEN: int = 3
SE_LOCK_MEMORY: int = 4
SE_INCREASE_QUOTA: int = 5
SE_UNSOLICITED_INPUT: int = 6
SE_TCB: int = 7
SE_SECURITY: int = 8
SE_TAKE_OWNERSHIP: int = 9
SE_L... | 0 | 0 | 69 | 0 | 69 | 0 |
aiida/orm/nodes/data/folder.py | azadoks/aiida-core | 180 | 1762171 | <reponame>azadoks/aiida-core<gh_stars>100-1000
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/flow/tests_sanitizer.py | matipan/RedisAI | 652 | 1762180 | import redis
from functools import wraps
import multiprocessing as mp
from includes import *
'''
python -m RLTest --test tests_sanitizer.py --module path/to/redisai.so
'''
def test_sanitizer_dagrun_mobilenet_v1(env) -> None:
if (not TEST_TF or not TEST_PT):
return
con = get_connection(env, '{s}')
... | 0 | 2 | 0 | 0 | 2 | 0 |
benchmark/operations/test/test_wait.py | stackriot/flocker | 2,690 | 1762189 | <filename>benchmark/operations/test/test_wait.py
# Copyright 2015 ClusterHQ Inc. See LICENSE file for details.
from twisted.internet.task import Clock
from flocker.testtools import TestCase
from benchmark.operations import Wait
class WaitOperationTests(TestCase):
"""
Test Wait operation
"""
def te... | 0 | 0 | 0 | 0 | 0 | 0 |
Machine Learning/Query Optimization/qopt/search.py | endorama/examples | 2,561 | 1762193 | <reponame>endorama/examples
import multiprocessing
import random
import string
from contextlib import contextmanager
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import RequestError
from functools import partial
from .util import load_json
@contextmanager
def temporary_search_template(es, te... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/node_converters/pad_test.py | ENOT-AutoDL/onnx2torch | 144 | 1762212 | import numpy as np
import onnx
import pytest
from tests.utils.common import check_onnx_model
from tests.utils.common import make_model_from_nodes
def _test_pad(
input_array: np.ndarray,
opset_version: int,
**kwargs,
) -> None:
test_inputs = {
'x': input_array,
}
if opset... | 5 | 2 | 0 | 0 | 7 | 0 |
src/unittest/python/test_state.py | PeerXu/fysom3 | 277 | 1762216 | <reponame>PeerXu/fysom3
# coding=utf-8
#
# fysom - pYthOn Finite State Machine - this is a port of Jake
# Gordon's javascript-state-machine to python
# https://github.com/jakesgordon/javascript-state-machine
#
# Copyright (C) 2011 <NAME> <<EMAIL>>, <NAME>
# and oth... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter11/listing11_6.py | hohsieh/osgeopy-code | 160 | 1762217 | <filename>Chapter11/listing11_6.py
# Script that uses SciPy to smooth a DEM.
import os
import scipy.ndimage
from osgeo import gdal
import ospybook as pb
in_fn = r"D:\osgeopy-data\Nepal\everest.tif"
out_fn = r'D:\Temp\everest_smoothed.tif'
in_ds = gdal.Open(in_fn)
in_data = in_ds.GetRasterBand(1).ReadAsArray()
# Use... | 0 | 0 | 0 | 0 | 0 | 0 |
gpu_ver/refcode/models/layers/batchnorm.py | bigaidream-projects/drmad | 119 | 1762225 | import numpy as np
import theano
import theano.tensor as T
import theano.tensor.nnet.bn as bn
eps = np.float32(1e-6)
zero = np.float32(0.)
one = np.float32(1.)
def bn_shared(params, outFilters, index):
''' Setup BN shared variables.
'''
normParam = {}
template = np.ones((outFilters,)... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Exercises/Phonenumbers/mapper-2.0.py | Gjacquenot/training-material | 115 | 1762241 | #!/usr/bin/env python
from argparse import ArgumentParser
import sys
class Mapper(object):
def __init__(self, dict_file_name):
self._mapping: dict[str,str] = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',... | 0 | 3 | 0 | 1 | 4 | 0 |
tests/regressiontests/transactions_regress/models.py | kix/django | 790 | 1762262 | from django.db import models
class Mod(models.Model):
fld = models.IntegerField()
class M2mA(models.Model):
others = models.ManyToManyField('M2mB')
class M2mB(models.Model):
fld = models.IntegerField()
| 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/tkrzw/package.py | LiamBindle/spack | 2,360 | 1762303 | <filename>var/spack/repos/builtin/packages/tkrzw/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Tkrzw(AutotoolsPackage):
"""Tk... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/django-1.5/django/db/backends/mysql/validation.py | MiCHiLU/google_appengine_sdk | 285 | 1762320 | <gh_stars>100-1000
from django.db.backends import BaseDatabaseValidation
class DatabaseValidation(BaseDatabaseValidation):
def validate_field(self, errors, opts, f):
"""
MySQL has the following field length restriction:
No character (varchar) fields can have a length exceeding 255
c... | 0 | 0 | 0 | 0 | 0 | 0 |
stellar_sdk/xdr/fee_bump_transaction.py | MartinThoma/py-stellar-base | 341 | 1762351 | <reponame>MartinThoma/py-stellar-base<filename>stellar_sdk/xdr/fee_bump_transaction.py
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from xdrlib import Packer, Unpacker
from .fee_bump_transaction_ext import FeeBumpTransactionExt
from .fee_bump_transaction_inn... | 0 | 0 | 0 | 0 | 0 | 0 |
cddd/inference.py | neelbhandari6/cddd | 149 | 1762360 | <reponame>neelbhandari6/cddd
"""Helper functions to run inference on trained models"""
import argparse
import os
import numpy as np
import tensorflow as tf
import multiprocessing as mp
import json
import os
from cddd.input_pipeline import InputPipelineInferEncode, InputPipelineInferDecode
from cddd.hyperparame... | 0 | 0 | 0 | 0 | 0 | 0 |
6-consumer/lessons/3-spoken-feedback/code-spoken-response/virtual-iot-device/smart-timer/app.py | yash7raut/IoT-For-Beginners | 9,718 | 1762387 | <reponame>yash7raut/IoT-For-Beginners<filename>6-consumer/lessons/3-spoken-feedback/code-spoken-response/virtual-iot-device/smart-timer/app.py
import requests
import threading
import time
from azure.cognitiveservices.speech import SpeechConfig, SpeechRecognizer, SpeechSynthesizer
speech_api_key = '<key>'
location = '<... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/geodata/tests/test_address_configs.py | Fillr/libpostal | 3,489 | 1762416 | from __future__ import annotations
import re
import six
import unittest
from geodata.addresses.entrances import *
from geodata.addresses.floors import *
from geodata.intersections.query import *
from geodata.addresses.po_boxes import *
from geodata.addresses.postcodes import *
from geodata.addresses.staircases import ... | 9 | 1 | 0 | 0 | 10 | 0 |
CorpusToolkit/ply_parser/token.py | howl-anderson/tools_for_corpus_of_people_daily | 243 | 1762432 | class Token(object):
def __init__(self):
self.token: None = None
self.pinyin: str = '_'
self.pos: None = None
self.ner: str = 'O'
| 0 | 0 | 0 | 4 | 4 | 0 |
DialogueGCN-mianzhang/dgcn/__init__.py | NouamaneTazi/conv-emotion | 488 | 1762437 | import dgcn.utils
from .Sample import Sample
from .Dataset import Dataset
from .Coach import Coach
from .model.DialogueGCN import DialogueGCN
from .Optim import Optim
| 0 | 0 | 0 | 0 | 0 | 0 |
raftos/cryptors.py | snkprdhn/raftos | 338 | 1762455 | <gh_stars>100-1000
import base64
from .log import logger
try:
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
crypto_enabled = True
e... | 0 | 0 | 0 | 0 | 0 | 0 |
test/samples-python/geolite.py | voltek62/vscode-ipe | 227 | 1762493 | <filename>test/samples-python/geolite.py
from IPython.display import GeoJSON
GeoJSON(
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "<NAME>",
"marker-color": "#0000ff",
"marker-symbol": "rail-me... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data/fixtures/tree_fixtures.py | benhamill/ramlfications | 281 | 1762507 | <filename>tests/data/fixtures/tree_fixtures.py<gh_stars>100-1000
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Spotify AB
from __future__ import absolute_import, division, print_function
from termcolor import colored
# NOTE: I know that these should be caps being constants but I'm
# not liking t... | 0 | 0 | 0 | 0 | 0 | 0 |
basis_set_exchange/tests/test_convert_slow.py | ltalirz/basis_set_exchange | 108 | 1762532 | <gh_stars>100-1000
"""
Tests functions for reading in formatted basis sets
"""
import basis_set_exchange as bse
import os
import pytest
from basis_set_exchange import convert
from .common_testvars import bs_read_formats, bs_write_formats, bs_names_sample
# We only want formats that we can actually write out and read... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/apps/cases/slack.py | FroggyTaipei/froggy-service | 174 | 1762571 | <reponame>FroggyTaipei/froggy-service<filename>backend/apps/cases/slack.py
from django.conf import settings
from slack_sdk import WebClient
def new_case_notify(case, topic='froggyservice'):
"""
helper method to post notify while new case is created.
"""
context = f"""
有新的案件進來了!! :tada: :tada:
標題: {ca... | 0 | 0 | 0 | 0 | 0 | 0 |
det/maskrcnn_benchmark/distributed_syncbn/syncbn.py | megvii-model/MABN | 182 | 1762614 | import math
from queue import Queue
from IPython import embed
import torch
import torch.distributed as dist
import torch.cuda.comm as comm
from torch.autograd.function import once_differentiable
from torch.nn.modules.batchnorm import _BatchNorm
import torch.nn.functional as F
import syncbn_gpu
class DistributedSync... | 9 | 3 | 0 | 0 | 12 | 0 |
pulsar/apps/wsgi/__init__.py | PyCN/pulsar | 1,410 | 1762629 | <reponame>PyCN/pulsar<gh_stars>1000+
"""This is the most important :ref:`pulsar application <application-api>`.
The server is a specialized :ref:`socket server <apps-socket>`
for web applications conforming with the python web server
gateway interface (`WSGI 1.0.1`_).
The server can be used in conjunction with several ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/lmdb/plot_lmdb.py | jysh1214/pytorch-yolo2 | 304 | 1762635 | import lmdb
import cv2
import numpy as np
env = lmdb.open('data/face_test_lmdb',
max_readers=1,
readonly=True,
lock=False,
readahead=False,
meminit=False)
with env.begin(write=False) as txn:
nSamples = int(txn.get('num-samples'))
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/chainer_tests/functions_tests/pooling_tests/test_upsampling_2d.py | zjzh/chainer | 3,705 | 1762691 | <filename>tests/chainer_tests/functions_tests/pooling_tests/test_upsampling_2d.py
import unittest
import numpy
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.utils import conv
... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 1762693 | <reponame>rsdoherty/azure-sdk-for-python
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/data-structures/trees/min_height_bst.py | ayushijain218/python | 204 | 1762712 | <filename>algorithms/data-structures/trees/min_height_bst.py
class Node:
def __init__(self,data):
self.data = data
self.left = None
self.right = None
class BST:
def __init__(self):
self.root = None
def getRoot(self):
return self.root
def add(self,data):
... | 0 | 0 | 0 | 0 | 0 | 0 |
vega/algorithms/nas/modnas/metrics/predefined/stats.py | This-50m/vega | 724 | 1762717 | <gh_stars>100-1000
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY... | 0 | 0 | 0 | 0 | 0 | 0 |
hpy/debug/__init__.py | krishp058/hpy | 476 | 1762746 | from .leakdetector import HPyDebugError, HPyLeakError, LeakDetector
| 0 | 0 | 0 | 0 | 0 | 0 |
example/pyctp2/testbed/scheduler.py | mmmaaaggg/pyctp_lovelylain | 358 | 1762763 | # -*- coding:utf-8 -*-
import sched
import time
import threading
def ev(sobj):
print("Current Time:", time.strftime("%y-%m-%d %H:%M:%S"))
sobj.enter(3,1,ev,argument=(sobj,))
def tsched():
s = sched.scheduler(time.time, time.sleep)
s.enter(3,1,ev,argument=(s,))
s.run()
print('xxxxxxxxxxxxx')
... | 0 | 0 | 0 | 0 | 0 | 0 |
gluoncv/model_zoo/action_recognition/slowfast.py | Kh4L/gluon-cv | 5,447 | 1762776 | <reponame>Kh4L/gluon-cv
"""SlowFast, implemented in Gluon. https://arxiv.org/abs/1812.03982.
Code adapted from https://github.com/r1ch88/SlowFastNetworks."""
# pylint: disable=line-too-long,too-many-lines,missing-docstring,arguments-differ,unused-argument
__all__ = ['SlowFast', 'slowfast_4x16_resnet50_kinetics400', 's... | 0 | 0 | 0 | 0 | 0 | 0 |
manga_py/crypt/sunday_webry_com.py | sonvt1710/manga-py | 337 | 1762801 | from PIL import Image
# DO NOT SEE HERE! IT WORKED!
class MatrixSunday:
__image_src: None = None
__image_dst: None = None
def de_scramble(self, path_src: str, path_dst: str, data: list):
self.__image_src = Image.open(path_src, 'r')
self.__process(data)
self.__image_dst.save(path... | 13 | 7 | 3 | 0 | 23 | 0 |
rankers/LevenshteinRanker/tests/test_levenshteinranker.py | strawberrypie/jina-hub | 106 | 1762882 | <filename>rankers/LevenshteinRanker/tests/test_levenshteinranker.py
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from jina.executors.rankers import Match2DocRanker
from .. import LevenshteinRanker
def test_levenshteinranker():
queries_metas = [{'text': 'c... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/21.corebot-app-insights/bots/dialog_and_welcome_bot.py | Aliacf21/BotBuilder-Samples | 1,998 | 1762884 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Main dialog to welcome users."""
import json
import os.path
from typing import List
from botbuilder.dialogs import Dialog
from botbuilder.core import (
TurnContext,
ConversationState,
UserState,
BotTelemetr... | 8 | 2 | 0 | 0 | 10 | 0 |
image_utils/image_utils.py | webart82/Web2Executable | 752 | 1762893 | from io import BytesIO
try:
from PIL import Image as im
IMAGE_UTILS_AVAILABLE = True
Image = im.open
def resize(image, size) -> object:
output = BytesIO()
back = im.new('RGBA', size, (0,0,0,0))
image.thumbnail(size, im.ANTIALIAS)
offset = [0,0]
if image.size[0] >=... | 0 | 2 | 0 | 0 | 2 | 0 |
saleor/attribute/tests/test_utils.py | fairhopeweb/saleor | 15,337 | 1762896 | import pytest
from ...product.models import ProductType
from ..utils import associate_attribute_values_to_instance
def test_associate_attribute_to_non_product_instance(color_attribute):
instance = ProductType()
attribute = color_attribute
value = color_attribute.values.first()
with pytest.raises(Ass... | 0 | 0 | 0 | 0 | 0 | 0 |
profiling/sampling/__init__.py | MJ111/profiling | 2,287 | 1762901 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
profiling.sampling
~~~~~~~~~~~~~~~~~~
Statistical profiling.
:copyright: (c) 2014-2017, What! Studio
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from profiling import sortkeys
from profiling.profiler import Profil... | 0 | 0 | 0 | 0 | 0 | 0 |
test/fixtures/python/graphing/conditional/conditional.py | matsubara0507/semantic | 8,844 | 1762925 | cond = True
if cond:
def merle(): pass
merle()
else:
def taako(): pass
taako()
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/opencl/convolution.py | sakehl/kernel_tuner | 104 | 1762938 | <filename>examples/opencl/convolution.py<gh_stars>100-1000
#!/usr/bin/env python
import numpy
import kernel_tuner
from collections import OrderedDict
with open('convolution.cl', 'r') as f:
kernel_string = f.read()
problem_size = (4096, 4096)
size = numpy.prod(problem_size)
input_size = (problem_size[0]+16) * (pro... | 0 | 0 | 0 | 0 | 0 | 0 |
pixiedust/display/chart/renderers/mapbox/mapBoxBaseDisplay.py | elgalu/pixiedust | 598 | 1762954 | <reponame>elgalu/pixiedust
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2018
#
# 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
#
# h... | 0 | 0 | 0 | 0 | 0 | 0 |
linear_regression.py | manailin/tensorflow___examples | 156 | 1762963 | <filename>linear_regression.py
#!/usr/bin/env python
import numpy as np
import tensorflow as tf
# Prepare train data
train_X = np.linspace(-1, 1, 100)
train_Y = 2 * train_X + np.random.randn(*train_X.shape) * 0.33 + 10
# Define the model
X = tf.placeholder("float")
Y = tf.placeholder("float")
w = tf.Variable(0.0, na... | 0 | 0 | 0 | 0 | 0 | 0 |
retriever/engines/msaccess.py | Nageshbansal/retriever | 254 | 1763003 | <reponame>Nageshbansal/retriever
import os
import platform
from retriever.lib.defaults import DATA_DIR
from retriever.lib.models import Engine
class engine(Engine):
"""Engine instance for Microsoft Access."""
name = "Microsoft Access"
instructions = ("Create a database in Microsoft Access, close Access.... | 0 | 0 | 0 | 0 | 0 | 0 |
readthedocs/core/mixins.py | mehrdad-khojastefar/readthedocs.org | 2,092 | 1763007 | """Common mixin classes for views."""
from django.contrib.auth.mixins import LoginRequiredMixin
from vanilla import ListView
class ListViewWithForm(ListView):
"""List view that also exposes a create form."""
def get_context_data(self, **kwargs) -> object:
context = super().get_context_data(**kwargs... | 0 | 1 | 1 | 0 | 2 | 0 |
src/utils/getEventAdminRole.py | lin483/Funny-Nations | 126 | 1763023 | from discord import Guild, Role
from src.utils.readConfig import getAdminListConfig
from typing import List
from loguru import logger
async def getEventAdminRole(myGuild: Guild) -> object:
"""
:param myGuild:
:return:
dict{
'roleName': role,
'roleName': role
}
"""
event... | 1 | 1 | 1 | 0 | 3 | 0 |
dev/google_communicator/searcher.py | dapatil211/deep_architect | 272 | 1763034 | from __future__ import absolute_import
from dev.regularized_evolution.searcher.regularized_evolution_searcher import EvolutionSearcher, mutatable
# from dev.enas.searcher.enas_searcher import ENASSearcher
import deep_architect.searchers.random as ra
from deep_architect.searchers.smbo_mcts import SMBOSearcherWithMCTSOpt... | 0 | 0 | 0 | 0 | 0 | 0 |
nuplan/database/nuplan_db/frame.py | motional/nuplan-devkit | 128 | 1763048 | <filename>nuplan/database/nuplan_db/frame.py
from enum import IntEnum
class Frame(IntEnum):
"""Coordinate frames."""
GLOBAL = 0 # Global frame
VEHICLE = 1 # Vehicle frame
SENSOR = 2 # Sensor frame
| 0 | 0 | 0 | 0 | 0 | 0 |
testing/test_bytecode.py | jweinraub/hippyvm | 289 | 1763078 |
import py, tempfile
from hippy.objspace import getspace
from hippy.phpcompiler import compile_php
from hippy.bytecode import unserialize
from hippy.bytecode_cache import BytecodeCache
from hippy.interpreter import get_printable_location
from testing.test_interpreter import MockInterpreter, BaseTestInterpreter
class ... | 0 | 0 | 0 | 0 | 0 | 0 |
yotta/lib/cmakegen.py | microbit-foundation/yotta | 176 | 1763089 | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
from __future__ import annotations
import os
import logging
import re
import itertools
from collections import defaultdict
from collections import OrderedDict
# bsd licensed ... | 7 | 13 | 0 | 5 | 25 | 0 |
cachebrowser/pipes/__init__.py | zhenyihan/cachebrowser | 1,206 | 1763147 | SKIP_PIPES = "skip_pipes" | 0 | 0 | 0 | 0 | 0 | 0 |
pyjobs/marketing/migrations/0002_auto_20191101_0912.py | Mdslino/PyJobs | 132 | 1763152 | <reponame>Mdslino/PyJobs<filename>pyjobs/marketing/migrations/0002_auto_20191101_0912.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-11-01 09:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("ma... | 0 | 0 | 0 | 0 | 0 | 0 |
pycuda/sparse/inner.py | hesom/pycuda | 1,264 | 1763179 | <filename>pycuda/sparse/inner.py
from __future__ import division
from __future__ import absolute_import
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import atexit
STREAM_POOL = []
def get_stream():
if STREAM_POOL:
return STREAM_POOL.pop()
else:
return drv.Stream()
class ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/fx/object_detection/maskrcnn/pytorch/maskrcnn_benchmark/modeling/backbone/backbone.py | intelkevinputnam/lpot-docs | 567 | 1763194 | # Copyright (c) 2021, 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 0 | 4 | 0 | 0 | 4 | 0 |
Python3/661.py | rakhi2001/ecom7 | 854 | 1763218 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 468 ms submission
import math
class Solution:
def imageSmoother(self, M):
if not M:
return
row = len(M)
col = 0
if M[0]:
col = l... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/tfhub/tfhub_mobile_food_segmenter_V1.py | LoicDagnas/tensorflow-onnx | 1,473 | 1763220 | # SPDX-License-Identifier: Apache-2.0
import os
import numpy
from _tools import generate_random_images, benchmark
import tf2onnx
import onnxruntime as ort
def main(opset: int=13):
url = "https://tfhub.dev/google/seefood/segmenter/mobile_food_segmenter_V1/1?tf-hub-format=compressed"
dest = "tf-mobile_food_segm... | 1 | 0 | 0 | 0 | 1 | 0 |
examples/full-screen/dummy-app.py | timgates42/python-prompt-toolkit | 4,028 | 1763244 | #!/usr/bin/env python
"""
This is the most simple example possible.
"""
from prompt_toolkit import Application
app = Application(full_screen=False)
app.run()
| 0 | 0 | 0 | 0 | 0 | 0 |
Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonFilter_Output_cff.py | ckamtsikis/cmssw | 852 | 1763251 | import FWCore.ParameterSet.Config as cms
# output block for alcastream HCAL HEMuon
# output module
# module alcastreamHcalHEMuonOutput = PoolOutputModule
OutALCARECOHcalCalHEMuonFilter_noDrop = cms.PSet(
# use this in case of filter available
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vst... | 0 | 0 | 0 | 0 | 0 | 0 |
Data Structures/Trees/path_to_node_binary_tree.py | siddhi-244/CompetitiveProgrammingQuestionBank | 931 | 1763286 | <reponame>siddhi-244/CompetitiveProgrammingQuestionBank
"""
Binary tree do not store data in sorted manner, so to find an element we cant decide left or right subtree, we need to traverse whole tree,
also as we do not know if the element is in left or right subtree, we cant store values on our way from root to node,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_endpoint.py | zhu327/doge | 163 | 1763314 | <reponame>zhu327/doge<gh_stars>100-1000
# coding: utf-8
import gevent
import pytest
from gevent.server import StreamServer
from doge.cluster.endpoint import EndPoint
from doge.common.context import Context
from doge.common.doge import Request
from doge.common.url import URL
from doge.rpc.server import DogeRPCServer
... | 0 | 0 | 0 | 0 | 0 | 0 |
trainer/trainer.py | Dieg0Alejandr0/EquiBind | 128 | 1763322 | <reponame>Dieg0Alejandr0/EquiBind
import copy
import inspect
import os
import shutil
from typing import Dict, Callable
import pyaml
import torch
import numpy as np
from datasets.samplers import HardSampler
from models import * # do not remove
from trainer.lr_schedulers import WarmUpWrapper # do not remove
from tor... | 0 | 0 | 0 | 0 | 0 | 0 |
PyEngine3D/Common/Command.py | ubuntunux/PyEngine3D | 121 | 1763325 | <gh_stars>100-1000
import os
import re
import traceback
from multiprocessing import Queue, Pipe
# logger
from PyEngine3D.Utilities import AutoEnum, MINOR_INFO
from PyEngine3D.Common import logger
# UTIL : call stack function for log
reTraceStack = re.compile("File \"(.+?)\", line (\d+?), .+") # [0] filename, [1] lin... | 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.