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 |
|---|---|---|---|---|---|---|---|---|---|---|
eve/io/base.py | perrani/eve | 3,122 | 193333 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
eve.io.base
~~~~~~~~~~~
Standard interface implemented by Eve data layers.
:copyright: (c) 2017 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
import datetime
import simplejson as json
from copy import copy
from flask imp... | 11 | 5 | 1 | 2 | 19 | 0 |
dexy/parsers/__init__.py | dsoto/dexy | 136 | 193338 | import dexy.parsers.doc
import dexy.parsers.environment
| 0 | 0 | 0 | 0 | 0 | 0 |
KD_Lib/KD/vision/CSKD/cskd.py | PiaCuk/KD_Lib | 360 | 193362 | <reponame>PiaCuk/KD_Lib
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import matplotlib.pyplot as plt
from copy import deepcopy
from KD_Lib.KD.common import BaseClass
class CSKD(BaseClass):
"""
Implementation of "Regularizing Class-wise Predictions via Self-k... | 0 | 0 | 0 | 0 | 0 | 0 |
meshreg/warping/imgflowarp.py | pgrady3/handobjectconsist | 103 | 193374 | """
get_spatial_meshgrid and warp functions are extracted from
https://github.com/NVlabs/PWC-Net/blob/master/PyTorch/models/PWCNet.py#L139
"""
import torch
def get_spatial_meshgrid(x: torch.Tensor, scale: bool=False) -> object:
"""
Get grid which contains spatial coordinates at each pixel location
Args:
... | 13 | 5 | 0 | 0 | 18 | 0 |
extra_tests/snippets/extra_bool_eval.py | mainsail-org/RustPython | 11,058 | 193432 | # Python carefully avoids evaluating bools more than once in a variety of situations.
# Eg:
# In the statement
# if a or b:
# it doesn't simply compute (a or b) and then evaluate the result to decide whether to
# jump. If a is true it jumps directly to the body of the if statement.
# We can confirm that this behaviour... | 0 | 1 | 0 | 1 | 2 | 0 |
keras/datasets/__init__.py | tsheaff/keras | 37,222 | 193447 | <gh_stars>1000+
"""Small NumPy datasets for debugging/testing."""
| 0 | 0 | 0 | 0 | 0 | 0 |
mars/learn/contrib/lightgbm/core.py | hxri/mars | 2,413 | 193449 | <filename>mars/learn/contrib/lightgbm/core.py
# Copyright 1999-2021 Alibaba Group Holding 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
telemetry/telemetry/internal/platform/profiler/perf_profiler_unittest.py | bopopescu/catapult-2 | 925 | 193469 | <gh_stars>100-1000
# Copyright 2013 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.
import logging
import os
import unittest
from telemetry.core import util
from telemetry.internal.platform.profiler import perf_profiler
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/util.py | amazon-research/video-contrastive-learning | 123 | 193472 | <filename>utils/util.py<gh_stars>100-1000
"""The functions for some tools
Code partially borrowed from
https://github.com/YihengZhang-CV/SeCo-Sequence-Contrastive-Learning/blob/main/seco/util.py.
MIT License
Copyright (c) 2020 YihengZhang-CV
"""
import argparse
import random
import torch
import torch.distributed as d... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/image_reader_test.py | tdml13/NiftyNet | 1,403 | 193486 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import numpy as np
import tensorflow as tf
from niftynet.io.image_reader import ImageReader
from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
from niftynet.layer.discrete_label_normalisation import \
Discre... | 0 | 0 | 0 | 0 | 0 | 0 |
python36/06_fou/call_convolution_general.py | aborodya/dawp | 484 | 193524 | #
# Call Option Pricing with Circular Convolution (General)
# 06_fou/call_convolution_general.py
#
# (c) Dr. <NAME>
# Derivatives Analytics with Python
#
import numpy as np
from convolution import revnp, convolution
from parameters import *
# Parmeter Adjustments
M = 3 # number of time steps
dt, df, u, d, q = get_bin... | 0 | 0 | 0 | 0 | 0 | 0 |
pyang/transforms/__init__.py | JieZhang0822/pyang | 466 | 193536 | """Package pyang.transforms: transform plugins for YANG.
Modules:
* edit: YANG edit transform plugin
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
care/facility/migrations/0194_auto_20201009_1936.py | gigincg/care | 189 | 193537 | <reponame>gigincg/care<filename>care/facility/migrations/0194_auto_20201009_1936.py
# Generated by Django 2.2.11 on 2020-10-09 14:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('facility', '0193_auto_20201004_1458'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
bleak/exc.py | Jc2k/bleak | 753 | 193553 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from typing import Optional
class BleakError(Exception):
"""Base Exception for bleak."""
pass
class BleakDBusError(BleakError):
"""Specialized exception type for D-Bus errors."""
def __init__(self, dbus_error: str, error_body: list):
"""
A... | 0 | 0 | 0 | 0 | 0 | 0 |
code/ch5-viewmodels/services/user_service.py | mtgeekman/web-applications-with-fastapi-course | 225 | 193570 | def user_count() -> int:
return 73_874
| 0 | 1 | 0 | 0 | 1 | 0 |
hubspot/crm/pipelines/__init__.py | Ronfer/hubspot-api-python | 117 | 193575 | # coding: utf-8
# flake8: noqa
"""
CRM Pipelines
Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When... | 0 | 0 | 0 | 0 | 0 | 0 |
prepare_dataset/model.py | rmwu/SubGNN | 107 | 193580 | # Pytorch
import torch
import torch.nn as nn
from torch.nn import Linear, LayerNorm, ReLU
from torch_geometric.nn import GINConv, GCNConv
import torch.nn.functional as F
# General
import numpy as np
import torch
import utils
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class TrainNet(nn.... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/schema/test_update_end_transaction_id.py | vhermecz/sqlalchemy-continuum | 401 | 193601 | <reponame>vhermecz/sqlalchemy-continuum
from sqlalchemy_continuum import version_class
from sqlalchemy_continuum.schema import update_end_tx_column
from tests import TestCase
class TestSchemaTools(TestCase):
versioning_strategy = 'validity'
def _insert(self, values):
table = version_class(self.Articl... | 0 | 0 | 0 | 0 | 0 | 0 |
yt/tests/test_load_errors.py | lconaboy/yt | 360 | 193615 | import pytest
from yt.data_objects.static_output import Dataset
from yt.geometry.grid_geometry_handler import GridIndex
from yt.loaders import load, load_simulation
from yt.utilities.exceptions import (
YTAmbiguousDataType,
YTSimulationNotIdentified,
YTUnidentifiedDataType,
)
from yt.utilities.object_regis... | 0 | 4 | 0 | 0 | 4 | 0 |
AppServer/google/appengine/ext/deferred/deferred.py | loftwah/appscale | 790 | 193621 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 0 | 7 | 0 | 0 | 7 | 0 |
APIs/Telegram API/telethon/crypto/authkey.py | Gregor-Davies/Awesome-Scripts-1 | 141 | 193634 | """
This module holds the AuthKey class.
"""
import struct
from hashlib import sha1
from ..extensions import BinaryReader
class AuthKey:
"""
Represents an authorization key, used to encrypt and decrypt
messages sent to Telegram's data centers.
"""
def __init__(self, data):
"""
Ini... | 0 | 5 | 0 | 0 | 5 | 0 |
examples/02-plot/clear.py | sampotter/pyvista | 1,107 | 193635 | """
Clearing a Mesh or the Entire Plot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This example demonstrates how to remove elements from a scene.
"""
# sphinx_gallery_thumbnail_number = 3
import pyvista as pv
###############################################################################
plotter = pv.Plotter()
actor = plot... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/imw2020.py | CaiYingFeng/ASLFeat | 235 | 193650 | import os
import glob
import h5py
import tensorflow as tf
from utils.common import Notify
from .base_dataset import BaseDataset
class Imw2020(BaseDataset):
default_config: dict[str,None | int] = {
'num_parallel_calls': 10, 'truncate': None
}
def _init_dataset(self, **config) -> object:
p... | 0 | 1 | 1 | 0 | 2 | 0 |
model.py | ivendrov/order-embedding | 180 | 193665 | <reponame>ivendrov/order-embedding
"""
Model specification
"""
import theano
import theano.tensor as tensor
from theano.tensor.extra_ops import fill_diagonal
from collections import OrderedDict
from utils import _p, ortho_weight, norm_weight, xavier_weight, tanh, l2norm
from layers import get_layer, param_init_fflaye... | 0 | 0 | 0 | 0 | 0 | 0 |
atest/testdata/standard_libraries/builtin/FailUntilSucceeds.py | rdagum/robotframework | 7,073 | 193706 | import time
class FailUntilSucceeds:
ROBOT_LIBRARY_SCOPE: str = 'TESTCASE'
def __init__(self, times_to_fail: int=0):
self.times_to_fail = int(times_to_fail)
def set_times_to_fail(self, times_to_fail):
self.__init__(times_to_fail)
def fail_until_retried_often_enough(self, message: st... | 3 | 1 | 1 | 0 | 5 | 0 |
controllers/proc.py | himansu1997/eden | 205 | 193738 | <reponame>himansu1997/eden
# -*- coding: utf-8 -*-
"""
Procurement
A module to handle Procurement
Currently handles
Suppliers
Planned Procurements
Purchase Orders (POs)
@ToDo: Extend to
Purchase Requests (PRs)
"""
if not settings.has_module(c):
raise HTTP(404, bo... | 0 | 0 | 0 | 0 | 0 | 0 |
activflow/core/templatetags/core_tags.py | faxad/ActivFlow | 567 | 193757 | from __future__ import annotations
"""Template Tags"""
import itertools
from importlib import import_module
from collections import OrderedDict
from django.apps import apps
from django import template
from activflow.core.constants import REQUEST_IDENTIFIER
from activflow.core.helpers import (
activity_config,
... | 1 | 8 | 0 | 0 | 9 | 0 |
torchkit/loss/__init__.py | sarvex/TFace | 764 | 193798 | from torch.nn import CrossEntropyLoss
from torchkit.loss.dist_softmax import DistCrossEntropy
from torchkit.loss.focal import FocalLoss
from torchkit.loss.ddl import DDL
_loss_dict = {
'Softmax': CrossEntropyLoss(),
'DistCrossEntropy': DistCrossEntropy(),
'FocalLoss': FocalLoss(),
'DDL': DDL()
}
def ... | 0 | 1 | 0 | 0 | 1 | 0 |
server/tests-py/validate.py | robhayesmba/graphql-engine | 27,416 | 193832 | #!/usr/bin/env python3
from __future__ import annotations
import time
import ruamel.yaml as yaml
from ruamel.yaml.compat import ordereddict, StringIO
from ruamel.yaml.comments import CommentedMap
import json
import copy
import graphql
import os
import base64
import jsondiff
import jwt
import queue
import random
import... | 29 | 14 | 0 | 0 | 43 | 0 |
pclib/rtl/Bus.py | belang/pymtl | 206 | 193852 | <reponame>belang/pymtl
#=======================================================================
# Bus.py
#=======================================================================
from pymtl import *
class Bus( Model ):
def __init__( s, nports, dtype ):
sel_nbits = clog2( nports )
s.in_ = [ InPort ( dtype... | 0 | 0 | 0 | 0 | 0 | 0 |
intake/catalog/base.py | dwr-psandhu/intake | 149 | 193863 | <gh_stars>100-1000
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#-----------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/dbnd/src/dbnd/_core/task/decorated_callable_task.py | busunkim96/dbnd | 224 | 193874 | from __future__ import annotations
import logging
from dbnd._core.constants import TaskType
from dbnd._core.errors.friendly_error.task_execution import (
failed_to_assign_result,
failed_to_process_non_empty_result,
)
from dbnd._core.task.pipeline_task import PipelineTask
from dbnd._core.task.python_task import... | 2 | 3 | 2 | 0 | 7 | 0 |
skvideo/measure/niqe.py | samgal/scikit-video | 615 | 193883 | <reponame>samgal/scikit-video<filename>skvideo/measure/niqe.py<gh_stars>100-1000
from ..utils import *
from ..utils.image import imresize
import numpy as np
import scipy.misc
import scipy.io
from os.path import dirname
from os.path import join
# only used during training
#from skimage.util.shape import view_as_windo... | 0 | 0 | 0 | 0 | 0 | 0 |
sql_server/pyodbc/management/commands/install_regex_clr.py | aceofwings/django-mssql-backend | 155 | 193915 | <reponame>aceofwings/django-mssql-backend<filename>sql_server/pyodbc/management/commands/install_regex_clr.py
# Add regex support in SQLServer
# Code taken from django-mssql (see https://bitbucket.org/Manfre/django-mssql)
from django.core.management.base import BaseCommand
from django.db import connection
class Comm... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/tests/test_tuples.py | BadDevCode/lumberyard | 1,738 | 193920 | <filename>dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/tests/test_tuples.py
from __future__ import print_function, division, absolute_import
import collections
import itertools
import numpy as np
from numba import unittest_support as unittest
from numba.compiler import compile_isolated
from numba import n... | 0 | 0 | 0 | 0 | 0 | 0 |
ansible/old/gce.py | otus-devops-2019-02/artem198315_infra | 250 | 193929 | #!/usr/bin/env python
# Copyright: (c) 2013, Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import annotations
'''
GCE external inventory script
=================================
Generates inventory that Ansible can understand by making API re... | 8 | 11 | 0 | 2 | 21 | 0 |
Rotary_Trinkey/CircuitPython_Volume_Knob_Example/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 193954 | """Rotary Trinkey Volume and Mute HID example"""
import rotaryio
import board
import usb_hid
import digitalio
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
print("Rotary Trinkey volume and mute example")
encoder = rotaryio.IncrementalEncod... | 0 | 0 | 0 | 0 | 0 | 0 |
bayesiancoresets/coreset/hilbert.py | trevorcampbell/hilbert-coresets | 118 | 193961 | <filename>bayesiancoresets/coreset/hilbert.py
import numpy as np
from ..util.errors import NumericalPrecisionError
from ..snnls.giga import GIGA
from .coreset import Coreset
class HilbertCoreset(Coreset):
def __init__(self, data, ll_projector, n_subsample=None, snnls=GIGA, **kw):
if n_subsample is None:
#... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/test_dir/test_fixture_demo.py | taylortaurus/seldom | 374 | 193977 | <gh_stars>100-1000
import seldom
class BaiduTest(seldom.TestCase):
"""
* start_class/end_class
* start/end
"""
def start_class(self):
print("test class start")
self.max_window()
def end_class(self):
print("test class end")
def start(self):
print("test cas... | 0 | 0 | 0 | 0 | 0 | 0 |
library/test/test_compiler/sbs_code_tests/03_set_unpack_2.py | creativemindplus/skybison | 278 | 193985 | <filename>library/test/test_compiler/sbs_code_tests/03_set_unpack_2.py
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
{*[1,2,3], *[4,5,6]}
# EXPECTED:
[
...,
BUILD_SET_UNPACK(2),
...
]
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf_expectations/make_expectations.py | kjthegod/chromium | 231 | 194033 | #!/usr/bin/env python
# Copyright (c) 2012 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.
# For instructions see:
# http://www.chromium.org/developers/tree-sheriffs/perf-sheriffs
import hashlib
import math
import optpars... | 0 | 0 | 0 | 0 | 0 | 0 |
src/prefect/utilities/git.py | concreted/prefect | 8,633 | 194052 | <reponame>concreted/prefect<filename>src/prefect/utilities/git.py
from tempfile import TemporaryDirectory
from typing import Any
class TemporaryGitRepo:
"""
Temporary cloning and interacting with a git repository
Args:
- git_clone_url (str): Url to git clone
- branch_name (str, optional):... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun-python-sdk-dybaseapi/aliyunsdkdybaseapi/mns/mns_http.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 194061 | <filename>aliyun-python-sdk-dybaseapi/aliyunsdkdybaseapi/mns/mns_http.py
# coding=utf-8
# 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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
indy_node/test/node_control_utils/test_node_control_util.py | Rob-S/indy-node | 627 | 194062 | import pytest
import shutil
from common.version import DigitDotVersion
from indy_common.constants import APP_NAME
from indy_common.version import src_version_cls
from indy_node.utils.node_control_utils import (
NodeControlUtil, ShellError, DebianVersion
)
# TODO
# - conditionally skip all tests for non-debian sy... | 0 | 4 | 0 | 0 | 4 | 0 |
losses.py | alexanderfroeber/cyclegan-1 | 246 | 194130 | <gh_stars>100-1000
"""Contains losses used for performing image-to-image domain adaptation."""
import tensorflow as tf
def cycle_consistency_loss(real_images, generated_images):
"""Compute the cycle consistency loss.
The cycle consistency loss is defined as the sum of the L1 distances
between the real im... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/module/__pypy__/test/test_intop.py | m4sterchain/mesapy | 381 | 194148 |
class AppTestIntOp:
spaceconfig: dict[object,object] = dict(usemodules=['__pypy__'])
def w_intmask(self, n) -> object:
import sys
n &= (sys.maxsize*2+1)
if n > sys.maxsize:
n -= 2*(sys.maxsize+1)
return int(n)
def test_intmask(self):
import sys
... | 0 | 1 | 1 | 0 | 2 | 0 |
tg/i18n.py | TurboGears/tg2 | 812 | 194189 | from __future__ import annotations
import copy
import logging, os
import gettext as _gettext
from gettext import NullTranslations, GNUTranslations
import warnings
import tg
from tg.util import lazify
from tg._compat import PY3, string_type
log = logging.getLogger(__name__)
class LanguageError(Exception):
"""Exce... | 8 | 13 | 0 | 0 | 21 | 0 |
tests/unit/test_auth_sigv4.py | doc-E-brown/botocore | 1,063 | 194202 | <filename>tests/unit/test_auth_sigv4.py<gh_stars>1000+
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.ama... | 0 | 0 | 0 | 0 | 0 | 0 |
pix2pix/utils/logger.py | Kajiyu/pix2pix-keras | 144 | 194244 | import matplotlib.pyplot as plt
import numpy as np
def inverse_normalization(X) -> object:
return X * 255.0
def plot_generated_batch(X_full, X_sketch, generator_model, epoch_num, dataset_name, batch_num):
# Generate images
X_gen = generator_model.predict(X_sketch)
X_sketch = inverse_normalization(X_... | 0 | 1 | 0 | 0 | 1 | 0 |
frontend/email_css.py | mepsd/CLAC | 126 | 194249 | <reponame>mepsd/CLAC
import pathlib
from django.utils.safestring import mark_safe
CSS_PATH = (pathlib.Path(__file__).resolve().parent /
'static' / 'frontend' / 'built' / 'style' / 'email.min.css')
def get():
return mark_safe(CSS_PATH.read_text(encoding='utf-8')) # nosec
| 0 | 0 | 0 | 0 | 0 | 0 |
zentral/contrib/santa/filebeat.py | arubdesu/zentral | 634 | 194262 | from __future__ import annotations
from django import forms
class SantaLogInputForm(forms.Form):
path = forms.CharField(initial="/var/db/santa/santa.log")
def get_filebeat_input(self) -> dict[str,list[object] | str]:
return {"type": "log",
"paths": [self.cleaned_data["path"]]}
input... | 0 | 1 | 0 | 0 | 1 | 0 |
pulumi/infra/path.py | inickles/grapl | 313 | 194271 | <gh_stars>100-1000
from pathlib import Path
def path_from_root(from_root: str) -> Path:
"""
To access something in the Grapl repo root, we have to reference two dirs
up because the Pulumi cwd is `${GRAPL_ROOT}/pulumi/grapl`
"""
return Path("../..") / from_root
| 0 | 0 | 0 | 0 | 0 | 0 |
src/python/turicreate/toolkits/object_detector/_tf_image_augmenter.py | cookingcodewithme/turicreate | 11,356 | 194278 | # -*- coding: utf-8 -*-
# Copyright © 2019 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import annotations
from __future__ import print_function as _
from _... | 0 | 13 | 0 | 1 | 14 | 0 |
horizon/contrib/staticfiles/finders.py | hemantsonawane95/horizon-apelby | 930 | 194294 | # Copyright 2016 IBM Corp.
#
# 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, s... | 1 | 0 | 0 | 0 | 1 | 0 |
sentence-encoding/main.py | dumpmemory/serverless-transformers-on-aws-lambda | 103 | 194297 | <gh_stars>100-1000
from sklearn import pipeline
from src.sentence_encoder import SentenceEncoder
pipeline = SentenceEncoder()
def lambda_handler(event, context):
try:
return pipeline(event)
except Exception as e:
raise
| 0 | 0 | 0 | 0 | 0 | 0 |
selfdrive/car/ford/values.py | shoes22/openpilot | 37,508 | 194300 | <gh_stars>1000+
# flake8: noqa
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
MAX_ANGLE = 87. # make sure we never command the extremes (0xfff) which cause latching fault
class CAR:
FUSION = "FORD FUSION 2018"
DBC = {
CAR.FUSION: dbc_dict('ford_fusion_2018_pt', 'ford_fusion_2... | 0 | 0 | 0 | 0 | 0 | 0 |
rrd/view/index.py | liuzongqing/dashboard | 389 | 194313 | #-*- coding:utf-8 -*-
# Copyright 2017 Xiaomi, 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... | 2 | 6 | 0 | 0 | 8 | 0 |
mode/examples/Topics/Simulate/SimpleParticleSystem/SimpleParticleSystem.pyde | timgates42/processing.py | 1,224 | 194343 | <gh_stars>1000+
"""
Simple Particle System
by <NAME>.
Particles are generated each cycle through draw(),
fall with gravity and fade out over time
A ParticleSystem object manages a variable size list
of particles.
"""
from particle_system import ParticleSystem
ps = None
def setup():
global ps
size(640,... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578640_Pachebel_Cannon_in_C/recipe-578640.py | tdiprima/code | 2,023 | 194349 | <reponame>tdiprima/code
#####################################
## <NAME> in C
#####################################
import winsound
import time
t = 250
p = .50
llC = 65
lC = 131
lDb = 139
lD = 147
lEb = 156
lE = 165
lF = 175
lGb = 185
lG = 196
lAb = 208
lA = 220
lBb = 233
lB = 247
C = 262
Db = 277
D = 2... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/tools/openwebtext-to-jsonl.py | adammoody/Megatron-DeepSpeed | 106 | 194371 | #!/usr/bin/env python
# generate a jsonl version of a small slice of a dataset that can be fed to megatron-lm preprocessor
import sys
from datasets import load_dataset
dataset_name = "stas/openwebtext-10k"
# subset to jsonlines
n_samples = 1000
ds = load_dataset(dataset_name, split='train')
ds_small = ds.select(ran... | 0 | 0 | 0 | 0 | 0 | 0 |
rltime/acting/ray_pool.py | frederikschubert/rltime | 147 | 194374 | <filename>rltime/acting/ray_pool.py<gh_stars>100-1000
import numpy as np
import pickle
import math
from threading import Lock
from collections import OrderedDict
import logging
# Don't assume/require ray or LZ4 to be installed unless using them
try:
import ray
except ImportError:
ray = None
try:
import lz4... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/test_function.py | mzmzm/taichi | 11,699 | 194388 | import pytest
import taichi as ti
@ti.test(experimental_real_function=True)
def test_function_without_return():
x = ti.field(ti.i32, shape=())
@ti.func
def foo(val: ti.i32):
x[None] += val
@ti.kernel
def run():
foo(40)
foo(2)
x[None] = 0
run()
assert x[None]... | 16 | 16 | 0 | 0 | 32 | 0 |
python/seldon/luigi/spark.py | smsahu/seldon-server | 1,645 | 194389 | <gh_stars>1000+
import luigi
from subprocess import call
import logging
from seldon.misc.item_similarity import *
from seldon.misc.most_popular import *
from luigi.contrib.spark import SparkSubmitTask
#
# Item Similarity
#
class ItemSimilaritySparkJob(luigi.Task):
"""
Spark job for running item similarity mod... | 0 | 0 | 0 | 0 | 0 | 0 |
library/panos_loopback_interface.py | PauloLuna/ansible-pan | 227 | 194402 | <filename>library/panos_loopback_interface.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 Palo Alto Networks, 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 th... | 0 | 0 | 0 | 0 | 0 | 0 |
pyqtgraph/canvas/TransformGuiTemplate_pyqt.py | sneakers-the-rat/pyqtgraph | 150 | 194410 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqtgraph/canvas/TransformGuiTemplate.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribute... | 0 | 3 | 0 | 0 | 3 | 0 |
src/super_gradients/training/models/classification_models/pnasnet.py | Deci-AI/super-gradients | 308 | 194426 | <reponame>Deci-AI/super-gradients
'''PNASNet in PyTorch.
Paper: Progressive Neural Architecture Search
https://github.com/kuangliu/pytorch-cifar/blob/master/models/pnasnet.py
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from super_gradients.training.models.sg_module import SgModule
class S... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py | dan-zheng/llvm-project | 765 | 194430 | """Test that a global ObjC object found before the process is started updates correctly."""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestObjCGlobalVar(TestBase):
mydir = TestBase.co... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/treadmill/cli/cell.py | vrautela/treadmill | 133 | 194438 | <gh_stars>100-1000
"""List Treadmill cells.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import click
from treadmill import cli
from treadmill import context
from treadmill import restclient
_... | 0 | 0 | 0 | 0 | 0 | 0 |
ulid/providers/time/base.py | xkortex/ulid | 303 | 194452 | """
ulid/time/base
~~~~~~~~~~~~~~
Contains time abstract providers.
"""
import abc
from ... import hints
class Provider(metaclass=abc.ABCMeta):
"""
Abstract class that defines providers for current time values.
"""
@abc.abstractmethod
def milliseconds(self) -> hints.Int:
"""
... | 0 | 2 | 0 | 0 | 2 | 0 |
model_decoder.py | andreasjansson/VQMIVC | 168 | 194469 | from __future__ import annotations
import torch
import torch.nn as nn
import torch.nn.functional as F
# import numpy as np
'''
reference from: https://github.com/auspicious3000/autovc/blob/master/model_vc.py
'''
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias: bool=True, w_init_gain: st... | 18 | 5 | 0 | 0 | 23 | 0 |
third_party/chromite/lib/clactions_metrics_unittest.py | zipated/src | 2,151 | 194481 | # -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS 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
"""Unit tests for clactions methods."""
from __future__ import print_function
import datetime... | 3 | 2 | 0 | 0 | 5 | 0 |
superpaper/spanmode.py | Aetf/superpaper | 757 | 194495 | <gh_stars>100-1000
"""Control host OS desktop background spanning mode when needed."""
import os
import platform
import subprocess
if platform.system() == "Windows":
import winreg
def set_spanmode():
"""Sets host OS desktop background to span all displays."""
pltf = platform.system()
if pltf == "Windo... | 0 | 0 | 0 | 0 | 0 | 0 |
models/__init__.py | MarcAntoineAlex/DenseNAS-1 | 107 | 194503 | <reponame>MarcAntoineAlex/DenseNAS-1<gh_stars>100-1000
from .wideresnet import *
| 0 | 0 | 0 | 0 | 0 | 0 |
src/rayoptics/raytr/opticalspec.py | mjhoptics/ray-optics | 106 | 194507 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2018 <NAME>
from __future__ import annotations
""" Container class for optical usage information
.. Created on Thu Jan 25 11:01:04 2018
.. codeauthor: <NAME>
"""
import math
import numpy as np
from rayoptics.parax.firstorder import compute_first_order, li... | 19 | 25 | 3 | 15 | 62 | 0 |
a01_model_low_weights_digit_detector.py | aaronferrucci/Verilog-Generator-of-Neural-Net-Digit-Detector-for-FPGA | 218 | 194517 | # coding: utf-8
__author__ = '<NAME> (ZFTurbo), IPPM RAS'
def keras_model_low_weights_digit_detector() -> object:
from keras.models import Model
from keras.layers import Input, Dense, GlobalAveragePooling2D, GlobalMaxPooling2D
from keras.layers import Conv2D, MaxPooling2D, Activation
use_bias = False... | 0 | 1 | 0 | 0 | 1 | 0 |
catalyst/contrib/utils/image.py | gr33n-made/catalyst | 2,693 | 194518 | <reponame>gr33n-made/catalyst
# flake8: noqa
from typing import Tuple, Union
import logging
import os
import pathlib
import tempfile
import imageio
import numpy as np
from skimage.color import rgb2gray # label2rgb
from catalyst.settings import SETTINGS
logger = logging.getLogger(__name__)
if SETTINGS.use_libjpeg_t... | 0 | 0 | 0 | 0 | 0 | 0 |
seldom/db_operation/mongo_db.py | defnngj/pyse | 250 | 194527 | <filename>seldom/db_operation/mongo_db.py
try:
from pymongo import MongoClient
except ModuleNotFoundError:
raise ModuleNotFoundError("Please install the library. https://github.com/mongodb/mongo-python-driver")
class MongoDB:
def __new__(cls, host, port, db):
"""
Connect the mongodb datab... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/undocumented/python/multiclass_id3classifiertree.py | gf712/shogun | 2,753 | 194538 | <reponame>gf712/shogun<filename>examples/undocumented/python/multiclass_id3classifiertree.py
#!/usr/bin/env python
from numpy import array
# create data
train_data = array([[1.0, 2.0, 1.0, 3.0, 1.0, 3.0, 2.0, 2.0, 3.0, 1.0, 2.0, 2.0, 3.0, 1.0, 2.0],
[2.0, 1.0, 2.0, 1.0, 2.0, 1.0, 1.0, 2.0, 2.0, 2.0, 1.0, 2.0, 2.0, 2.0... | 0 | 0 | 0 | 0 | 0 | 0 |
src/connectors/redis/base_redis_application.py | jayvdb/sci-pype | 114 | 194539 | import json, sys, os
sys.path.append("/opt/src")
from connectors.redis.redis_wrapper import RedisWrapper
class BaseRedisApplication:
def __init__(self, name, redis_address, port, redis_queue, logger, request_key_name=None, response_key_name=None, debug=False):
self.m_name = name
... | 0 | 0 | 0 | 0 | 0 | 0 |
spider/instances/inst_save.py | Zcyd25/PSpider | 1,894 | 194541 | # _*_ coding: utf-8 _*_
"""
inst_save.py by xianhu
"""
class Saver(object):
"""
class of Saver, must include function working()
"""
def working(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object):
"""
working function, must "try-except" and don't chan... | 10 | 2 | 0 | 0 | 12 | 0 |
fuxi/web/flask_app.py | cocobear/fuxi | 731 | 194559 | <reponame>cocobear/fuxi
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2019/7/5
# @File : flask_app.py
# @Desc : ""
import sys
from flask import Flask
from celery import Celery
from flask_cors import CORS
from secrets import token_urlsafe
from instance.config import config
from... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unitary/PoolProxy/test_proxy_burn.py | AqualisDAO/curve-dao-contracts | 217 | 194570 | <reponame>AqualisDAO/curve-dao-contracts
import brownie
import pytest
from brownie import ETH_ADDRESS, ZERO_ADDRESS
burner_mock = """
# @version 0.2.7
is_burned: public(HashMap[address, bool])
@payable
@external
def burn(coin: address) -> bool:
self.is_burned[coin] = True
return True
"""
@pytest.fixture(sc... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | FabienArcellier/cornell | 123 | 194581 | <gh_stars>100-1000
from unittest.mock import MagicMock
import pytest
from cornell.cornell_server import app, _setup_app_config
from cornell.signals import process_cassette_file
TEST_URL = "http://some-address.com/some/path"
@pytest.fixture
def cornell_proxy(tmpdir, monkeypatch):
_setup_app_config(app=app, casset... | 0 | 0 | 0 | 0 | 0 | 0 |
dl/VGG-16/vgg16.py | SounakMandal/AlgoBook | 191 | 194590 | import torch
import torch.nn as nn
from torchvision import datasets, transforms
IMAGES_PATH = 'image_path'
transform = transforms.Compose([transforms.Resize(256),
transforms.RandomCrop(224),
transforms.ToTensor()])
trainset = datasets.ImageFolder(IMAGES... | 0 | 2 | 0 | 0 | 2 | 0 |
tensortools/optimize/ncp_hals.py | warnerwarner/tensortools | 122 | 194602 | from __future__ import annotations
"""
Nonnegative CP decomposition by Hierarchical alternating least squares (HALS).
Author: <NAME> <<EMAIL>>
"""
import numpy as np
import numba
from tensortools.operations import unfold, khatri_rao
from tensortools.tensors import KTensor
from tensortools.optimize import FitResult, ... | 5 | 1 | 0 | 0 | 6 | 0 |
04. Chapter_4/custom_vs_default_hash.py | Mikma03/High-performance-Python | 223 | 194605 | class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
class PointHash(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __hash__(self) -> object:
return hash((self.x, self.y))
def __eq__(self, other) -> object:
return self.x == other.x and se... | 0 | 2 | 0 | 0 | 2 | 0 |
Algorithms/Python/InterpolationSearch.py | Shaswat-2203/HacktoberfestForBeginners | 115 | 194607 | <gh_stars>100-1000
"""
This is pure python implementation of interpolation search algorithm
"""
"""Pure implementation of interpolation search algorithm in Python
Be careful collection must be ascending sorted, otherwise result will be
unpredictable
"""
def interpolation_search(sorted_collection, item):
left = 0
... | 0 | 0 | 0 | 0 | 0 | 0 |
txdav/who/idirectory.py | backwardn/ccs-calendarserver | 462 | 194625 | # -*- test-case-name: txdav.who.test -*-
##
# Copyright (c) 2014-2017 Apple 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/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
boto3_type_annotations/boto3_type_annotations/codecommit/paginator.py | cowboygneox/boto3_type_annotations | 119 | 194633 | <reponame>cowboygneox/boto3_type_annotations
from typing import Dict
from botocore.paginate import Paginator
class DescribePullRequestEvents(Paginator):
def paginate(self, pullRequestId: str, pullRequestEventType: str = None, actorArn: str = None, PaginationConfig: Dict = None) -> Dict:
pass
class GetCo... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/grid/apps/worker/src/main/core/infrastructure/providers/gcp/gcp.py | exityan/PySyft | 425 | 194642 | # stdlib
import subprocess
# third party
from PyInquirer import prompt
import click
# grid relative
from ..deploy import base_setup
from ..tf import *
from ..utils import Config
from ..utils import styles
from .provider import *
class GCloud:
def projects_list(self) -> object:
proc = subprocess.Popen(
... | 4 | 9 | 0 | 0 | 13 | 0 |
Research/encoders.py | ylzhang29/GAN-for-tabular-data | 272 | 194662 | from typing import List
import numpy as np
import pandas as pd
from category_encoders.backward_difference import BackwardDifferenceEncoder
from category_encoders.cat_boost import CatBoostEncoder
from category_encoders.helmert import HelmertEncoder
from category_encoders.james_stein import JamesSteinEncoder
from catego... | 0 | 0 | 0 | 0 | 0 | 1 |
pennylane/transforms/decompositions/two_qubit_unitary.py | ral9000/pennylane | 712 | 194680 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... | 0 | 9 | 0 | 0 | 9 | 0 |
src/oci/analytics/models/create_private_access_channel_details.py | Manny27nyc/oci-python-sdk | 249 | 194684 | <reponame>Manny27nyc/oci-python-sdk<filename>src/oci/analytics/models/create_private_access_channel_details.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/series/test_es_match.py | szabosteve/eland | 335 | 194686 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/insteon/fan.py | mtarjoianu/core | 30,023 | 194688 | """Support for INSTEON fans via PowerLinc Modem."""
from __future__ import annotations
import math
from homeassistant.components.fan import (
DOMAIN as FAN_DOMAIN,
FanEntity,
FanEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
fro... | 7 | 6 | 0 | 0 | 13 | 0 |
custom_components/xiaomi_miot/alarm_control_panel.py | toyan/hass-xiaomi-miot | 919 | 194719 | from __future__ import annotations
"""Support alarm_control_panel entity for Xiaomi Miot."""
import logging
from homeassistant.const import * # noqa: F401
from homeassistant.components.alarm_control_panel import (
DOMAIN as ENTITY_DOMAIN,
AlarmControlPanelEntity,
)
from homeassistant.components.alarm_control_... | 9 | 9 | 0 | 1 | 19 | 0 |
research/multi_representation_adversary/multi_representation_adversary/attacks.py | srihari-humbarwadi/neural-structured-learning | 939 | 194744 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 16 | 14 | 0 | 1 | 31 | 0 |
demo_caffe.py | bingqingsuimeng/MobileNetv2-SSDLite | 468 | 194754 | import numpy as np
import sys,os
import cv2
caffe_root = '/home/yaochuanqi/work/tmp/ssd/'
sys.path.insert(0, caffe_root + 'python')
import caffe
net_file= 'ssdlite/coco/deploy.prototxt'
caffe_model='ssdlite/deploy.caffemodel'
test_dir = "images"
caffe.set_mode_cpu()
net = caffe.Net(net_file,caffe_model,caf... | 0 | 3 | 0 | 0 | 3 | 0 |
third_party/pyelftools/elftools/dwarf/die.py | zipated/src | 2,151 | 194795 | <reponame>zipated/src
#-------------------------------------------------------------------------------
# elftools: dwarf/die.py
#
# DWARF Debugging Information Entry
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#-------------------------------------------------------------------------------
from collections... | 0 | 0 | 0 | 0 | 0 | 0 |
platformio/package/pack.py | franzbischoff/platformio-core | 4,744 | 194806 | <filename>platformio/package/pack.py
# Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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
#
# Un... | 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.