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 |
|---|---|---|---|---|---|---|---|---|---|---|
tensorflow/python/ops/ragged/ragged_batch_gather_with_default_op.py | PaulWang1905/tensorflow | 848 | 3235642 | <filename>tensorflow/python/ops/ragged/ragged_batch_gather_with_default_op.py
# 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
#
#... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_fold/loom/calculator_example/model.py | shkarupa-alex/fold | 2,020 | 3235651 | <reponame>shkarupa-alex/fold
# Copyright 2017 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
#
# Unless re... | 0 | 0 | 0 | 0 | 0 | 0 |
nimfa/examples/orl_images.py | askerdb/nimfa | 325 | 3235662 | <reponame>askerdb/nimfa
"""
####################################
ORL Images (``examples.orl_images``)
####################################
In this example of image processing we consider the image problem presented in [Hoyer2004]_.
We used the ORL face database composed of 400 images of ... | 0 | 0 | 0 | 0 | 0 | 0 |
GON.py | RKelln/GON-lightning | 154 | 3235670 | import torch
import torch.nn as nn
import torchvision
import numpy as np
import os
plot_dir = 'imgs'
os.makedirs(plot_dir, exist_ok=True)
# image data
dataset_name = 'mnist' # choices - ['mnist', 'fashion']
img_size = 32
nc = 1
# training info
lr = 1e-4
batch_size = 64
nz = 32
ngf = 16
device = torch.device('cuda' i... | 0 | 1 | 0 | 0 | 1 | 0 |
rosetta/cmdutils/row_filter.py | UnitedLexCorp/rosetta | 132 | 3235681 | #!/usr/bin/env python
"""
Removes rows in csv file (or stdin) with header where columns meet
certain criteria.
"""
import argparse
import sys
import csv
import re
# Set the limit to 1 billion columns
#csv.field_size_limit(10000000)
def _cli():
epilog = r"""
Examples
---------
Keep rows in curriculum.... | 0 | 3 | 0 | 0 | 3 | 0 |
iPERCore/models/networks/criterions/faceloss.py | JSssssss/iPERCore | 2,223 | 3235721 | <reponame>JSssssss/iPERCore
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
__all__ = ["SENet", "Sphere20a", "senet50", "FaceLoss"]
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 con... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit3/test_filter_map_zip.py | timmartin/skulpt | 2,671 | 3235755 | <gh_stars>1000+
""" Unit testing for builtin objects filter, map, and zip"""
import unittest
#examples for testing
def add_one(num):
"""function for testing"""
if num != 2 and num != 6.0 and num != -151.5:
return num + 1
lst1 = [1, 2, 3, 4, 5]
lst2 = [2, 4, 6, 8, 10]
lst3 = [-150, -151, -151.49, -151.5... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-svm/app.py | JeroenvdSande/dash-sample-apps | 2,332 | 3235767 | <filename>apps/dash-svm/app.py
import time
import importlib
import dash
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
from dash.dependencies import Input, Output, State
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from... | 0 | 0 | 0 | 0 | 0 | 0 |
menpofit/error/stats.py | Szustarol/menpofit | 124 | 3235809 | <reponame>Szustarol/menpofit<gh_stars>100-1000
from __future__ import division
import numpy as np
from scipy.integrate import simps
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc
def compute_cumulative_error(errors, bins):
r"""
Computes the v... | 0 | 0 | 0 | 0 | 0 | 0 |
via/tweens.py | mattdricker/via-1 | 113 | 3235883 | def robots_tween_factory(handler, _registry) -> object:
def robots_tween(request) -> object:
response = handler(request)
# If the view hasn't set its own X-Robots-Tag header then set one that
# tells Google (and most other crawlers) not to index the page and not
# to follow links on... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_sched.py | maxferrari/Torchelie | 117 | 3235902 | <reponame>maxferrari/Torchelie
import torch
from torch.optim import SGD
from torchelie.lr_scheduler import *
def test_curriculum():
x = torch.randn(3, requires_grad=True)
opt = SGD([x], 1)
sched = CurriculumScheduler(opt, [[0, 1, 1], [10, 0, 0]])
opt.step()
sched.step()
def test_onecycle():
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/fate_arch/_standalone.py | rubenlozanoaht3m/DataDogm | 715 | 3235923 | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 60 | 82 | 3 | 6 | 151 | 0 |
configs/case_studies/bittorrent_leaks.py | UAEKondaya1/expressvpn_leak_testing | 219 | 3235930 | from xv_leak_tools.test_templating.templating import TemplateEvaluator, Replacee, Each
# This list will contain all the individual test configurations
TESTS = []
TEMPLATE = {
'name': "TestTorrentTrackerIPLeakNet",
'devices': [
{
"discovery_keys": {
"device_id": "localhost"
... | 0 | 0 | 0 | 0 | 0 | 0 |
lbry/wallet/orchstr8/service.py | nishp77/lbry-sdk | 4,996 | 3235938 | import asyncio
import logging
from aiohttp.web import Application, WebSocketResponse, json_response
from aiohttp.http_websocket import WSMsgType, WSCloseCode
from lbry.wallet.util import satoshis_to_coins
from .node import Conductor
PORT = 7954
class WebSocketLogHandler(logging.Handler):
def __init__(self, se... | 2 | 7 | 0 | 1 | 10 | 0 |
SMPyBandits/Environment/MAB.py | balbok0/SMPyBandits | 309 | 3235940 | # -*- coding: utf-8 -*-
from __future__ import annotations
""" :class:`MAB`, :class:`MarkovianMAB`, :class:`ChangingAtEachRepMAB`, :class:`IncreasingMAB`, :class:`PieceWiseStationaryMAB` and :class:`NonStationaryMAB` classes to wrap the arms of some Multi-Armed Bandit problems.
Such class has to have *at least* these ... | 65 | 65 | 0 | 28 | 158 | 0 |
ivi/agilent/agilent436A.py | sacherjj/python-ivi | 161 | 3235954 | <reponame>sacherjj/python-ivi<filename>ivi/agilent/agilent436A.py<gh_stars>100-1000
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | 0 | 0 | 0 | 0 | 0 | 0 |
neurst/data/datasets/audio/librispeech.py | ishine/neurst | 208 | 3235971 | # Copyright 2020 ByteDance 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 writin... | 5 | 5 | 0 | 1 | 11 | 0 |
ctools/worker/agent/agent_template.py | XinyuJing/DI-star | 267 | 3235973 | import torch
import copy
from typing import Any, Optional
from collections import OrderedDict
from ctools.worker.agent import BaseAgent, AgentAggregator
# ######################## Learner ######################################
def create_dqn_learner_agent(model: torch.nn.Module, is_double: bool = True) -> BaseAgent:
... | 39 | 19 | 0 | 0 | 58 | 0 |
seqlike/utils/sequences.py | ericmjl/seqlike | 186 | 3235988 | from __future__ import annotations
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from ..alphabets import gap_letter
def add_seqnums_to_letter_annotations(seqrec, include_gaps: bool=True) -> object:
# If seqnums is already present, don't override it.
if "seqnums" in seqrec.letter_annotations:
... | 3 | 4 | 0 | 0 | 7 | 0 |
neutron/extensions/local_ip.py | congnt95/neutron | 1,080 | 3236018 | <gh_stars>1000+
# Copyright 2021 Huawei, 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
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
fluent.syntax/tests/syntax/test_stream.py | shlomyb-di/python-fluent | 155 | 3236023 | <reponame>shlomyb-di/python-fluent
import unittest
from fluent.syntax.stream import ParserStream
class TestParserStream(unittest.TestCase):
def test_next(self):
ps = ParserStream("abcd")
self.assertEqual('a', ps.current_char)
self.assertEqual(0, ps.index)
self.assertEqual('b', ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/ge2e/config.py | yt605155624/Parakeet | 501 | 3236026 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 1 | 0 | 0 | 1 | 0 |
fengshen/models/model_utils.py | dumpmemory/Fengshenbang-LM | 265 | 3236058 | from pytorch_lightning import LightningModule
from pytorch_lightning.strategies import DeepSpeedStrategy
from deepspeed.ops.adam import DeepSpeedCPUAdam, FusedAdam
from transformers.optimization import AdamW, get_scheduler
def add_module_args(parent_args) -> object:
parser = parent_args.add_argument_group('Basic... | 1 | 2 | 0 | 0 | 3 | 0 |
pypower/t/t_hasPQcap.py | Bengt/PYPOWER | 221 | 3236062 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Tests for C{hasPQcap}.
"""
from numpy import array
from pypower.hasPQcap import hasPQcap
from pypower.t.t_begin import t_begin
from pypower.t.t_is import t_i... | 1 | 0 | 0 | 0 | 1 | 0 |
glslc/test/option_fauto_combined_image_sampler.py | TheMindVirus/shaderc | 1,358 | 3236097 | # Copyright 2018 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 0 | 0 | 4 | 0 | 4 | 0 |
tests/test_schedule.py | NAnnamalai/gramex | 130 | 3236170 | from . import TestGramex
from datetime import datetime
from gramex.http import OK
from gramex.services import info
from nose.tools import eq_
class TestSchedule(TestGramex):
def test_startup(self):
# Check if code in schedules with startup: true are executed
self.check('/schedule-key', text='1', c... | 0 | 0 | 0 | 0 | 0 | 0 |
keanu-python/keanu/vertex/generated.py | rs992214/keanu | 153 | 3236171 | <reponame>rs992214/keanu
## This is a generated file. DO NOT EDIT.
from typing import Collection, Optional
from py4j.java_gateway import java_import
from keanu.context import KeanuContext
from .base import Vertex, Double, Integer, Boolean, vertex_constructor_param_types
from keanu.vertex.label import _VertexLabel
from... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonAPI/carissma_project/lib/python3.5/site-packages/mpl_toolkits/axisartist/parasite_axes.py | AbdulHoffmann/carla_carissma | 445 | 3236189 | <reponame>AbdulHoffmann/carla_carissma<filename>PythonAPI/carissma_project/lib/python3.5/site-packages/mpl_toolkits/axisartist/parasite_axes.py
from mpl_toolkits.axes_grid1.parasite_axes import (
host_axes_class_factory, parasite_axes_class_factory,
parasite_axes_auxtrans_class_factory, subplot_class_factory)
... | 0 | 0 | 0 | 0 | 0 | 0 |
inquirer/render/console/_list.py | SteinRobert/python-inquirer | 640 | 3236211 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from readchar import key
from .base import BaseConsoleRender, MAX_OPTIONS_DISPLAYED_AT_ONCE, half_options
from inquirer import errors
class List(BaseConsoleRender):
def __init__(self, *args, **kwargs):
super(List, self).__init__(*args, **kwargs)
self.cur... | 0 | 0 | 0 | 0 | 0 | 0 |
falsy/netboy/request.py | marco-souza/falsy | 127 | 3236268 | <reponame>marco-souza/falsy<filename>falsy/netboy/request.py
import uuid
from io import BytesIO
from urllib.parse import urlencode
import aiohttp
import pycurl
from bs4 import UnicodeDammit, BeautifulSoup
import re
import json
from falsy.loader.func import load
from falsy.netboy.curl_loop import CurlLoop
from falsy.n... | 0 | 0 | 0 | 0 | 0 | 0 |
fastT5/onnx_models_structure.py | swcrazyfan/fastT5 | 288 | 3236269 | <reponame>swcrazyfan/fastT5<gh_stars>100-1000
import torch
class DecoderWithLMhead(torch.nn.Module):
""" Creation of a class to combine the decoder and the lm head """
def __init__(self, decoder, lm_head, config):
super().__init__()
self.decoder = decoder
self.lm_head = lm_head
... | 0 | 0 | 0 | 0 | 0 | 0 |
dir_test.py | nicetone/Python | 28,321 | 3236300 | # Script Name : dir_test.py
# Author : <NAME>
# Created : 29th November 2011
# Last Modified : by- <NAME> 05 Oct 2020
# Version : 1.0
# Modifications :
# Description : Tests to see if the directory testdir exists, if not it will create the directory for you if you want it created.
from __future__ import... | 0 | 0 | 0 | 0 | 0 | 0 |
unittest/scripts/auto/py_shell/validation/shell_reports_thread_norecord.py | mueller/mysql-shell | 119 | 3236349 | <filename>unittest/scripts/auto/py_shell/validation/shell_reports_thread_norecord.py<gh_stars>100-1000
#@ create a new session
|<ClassicSession:<<<__mysql_uri>>>>|
#@ create test user
||
#@ create test connection
||
#@ get IDs
||
#@ create database
||
#@ WL11651-TSFR12_1 - Validate that a new report named thread i... | 0 | 0 | 0 | 0 | 0 | 0 |
posts/api.py | ujlbu4/vas3k.club | 496 | 3236358 | from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from auth.helpers import api_required
from posts.models.post import Post
@api_required
def md_show_post(request, post_type, post_slug) -> object:
post = get_object_or_404(Post, slug=post_slug)
... | 0 | 2 | 0 | 0 | 2 | 0 |
src/programy/dialog/question.py | cdoebler1/AIML2 | 345 | 3236364 | from __future__ import annotations
"""
Copyright (c) 2016-2020 <NAME> http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation... | 10 | 18 | 0 | 2 | 30 | 0 |
XssEyeCelery/common/system_util.py | tt9133github/hunter | 322 | 3236378 | #!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://www.zto.com/
#
# 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 r... | 2 | 12 | 0 | 0 | 14 | 0 |
torch_audiomentations/__init__.py | VuongDinhCong/torch-audiomentations | 430 | 3236417 | from .augmentations.background_noise import AddBackgroundNoise
from .augmentations.colored_noise import AddColoredNoise
from .augmentations.band_pass_filter import BandPassFilter
from .augmentations.gain import Gain
from .augmentations.high_pass_filter import HighPassFilter
from .augmentations.impulse_response import A... | 0 | 0 | 0 | 0 | 0 | 0 |
example/mnist_demo/baseline.py | huangwei19/9nfl | 103 | 3236422 | #-*-encoding=utf-8-*-
# Copyright 2020 The 9nFL Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | 1 | 4 | 0 | 0 | 5 | 0 |
text_extensions_for_pandas/jupyter/widget/core.py | CODAIT/text-extensions-for-pandas | 193 | 3236438 | #
# Copyright (c) 2021 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 writi... | 7 | 4 | 3 | 4 | 18 | 0 |
wsgi.py | jnclt/simple_tensorflow_serving | 771 | 3236447 | <reponame>jnclt/simple_tensorflow_serving
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from simple_tensorflow_serving.server import application
def main():
application.run()
if __name__ == "__main__":
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/network/rtpdump.py | SabheeR/hobbits | 304 | 3236449 | <filename>src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/network/rtpdump.py
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
import collections
... | 0 | 0 | 0 | 0 | 0 | 0 |
calvin/runtime/north/plugins/storage/storage_factory.py | gabrielcercel/calvin-base | 334 | 3236474 | <filename>calvin/runtime/north/plugins/storage/storage_factory.py<gh_stars>100-1000
# -*- 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
colossus/apps/subscribers/migrations/0005_auto_20180816_1855.py | CreativeWurks/emailerpro | 372 | 3236502 | # Generated by Django 2.1 on 2018-08-16 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('subscribers', '0004_auto_20180816_1748'),
]
operations: list[object] = [
migrations.AlterField(
model_name=... | 0 | 0 | 2 | 0 | 2 | 0 |
generator/smatch/setup.py | ttslr/gtos | 172 | 3236519 | <reponame>ttslr/gtos
#!/usr/bin/env python
import sys
import os
try:
from setuptools import setup, find_packages
except ImportError:
from disutils.core import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md")) as f:
README = f.read()
setup(name="smatch",
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/bench/test_websocket.py | PyCN/pulsar | 1,410 | 3236530 | <gh_stars>1000+
from random import randint
import unittest
from pulsar.utils.websocket import frame_parser
def i2b(args):
return bytes(bytearray(args))
class TestCParser(unittest.TestCase):
__benchmark__ = True
__number__ = 10000
_sizes = {'tiny': 10,
'small': 200,
'norm... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/run_booknlp.py | ishine/booknlp | 539 | 3236538 | <reponame>ishine/booknlp<filename>examples/run_booknlp.py
from booknlp.booknlp import BookNLP
model_params={
"pipeline":"entity,quote,supersense,event,coref",
"model":"big"
}
booknlp=BookNLP("en", model_params)
# Input file to process
input_file="158_emma.txt"
# Output directory to store re... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/time_series/heartbeats/model.py | Locust2520/path_explain | 145 | 3236585 | <gh_stars>100-1000
"""
Builds a cnn for sequence classification. Taken from
https://www.kaggle.com/coni57/model-from-arxiv-1805-00794
"""
import tensorflow as tf
from path_explain.utils import softplus_activation
def cnn_model(signal_length=187,
num_signals=1,
for_interpretation=False):
... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_azure/mediaservices/outputs.py | ScriptBox99/pulumi-azure | 109 | 3236611 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 19 | 13 | 0 | 0 | 32 | 0 |
data/conceptual-captions/utils/check_valid.py | xiling42/VL-BERT | 671 | 3236616 | import sys
from PIL import Image
import warnings
warnings.filterwarnings("ignore", "(Possibly )?corrupt EXIF data", UserWarning)
try:
im = Image.open(sys.argv[1]).convert('RGB')
# remove images with too small or too large size
if (im.size[0] < 10 or im.size[1] < 10 or im.size[0] > 10000 or im.size[1] > 1... | 0 | 0 | 0 | 0 | 0 | 0 |
Emotion_Analysis/turkish_emotion_classification.py | kiliczsh/fixy | 166 | 3236647 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import pandas as pd
df = pd.read_csv('KarışıkDuygular.csv')
df.tail(15)
del df['ID']
# kategorileri integer değerlere map ediyoruz, sınıflandırmanın yapılabilmesi için
df["category_id"] = df.OriginalEmotion.map({'Happy':0,'Disgust':1,'Surprise':2,'Fear':3,'Anger':4,'Sadnes... | 0 | 0 | 0 | 0 | 0 | 0 |
wasmtime/_value.py | primecoin/wasmtime-py | 140 | 3236657 | <reponame>primecoin/wasmtime-py
from ._error import WasmtimeError
from ._ffi import *
from ._types import ValType
import ctypes
import typing
@ctypes.CFUNCTYPE(None, c_void_p)
def _externref_finalizer(extern_id: int) -> None:
Val._id_to_ref_count[extern_id] -= 1
if Val._id_to_ref_count[extern_id] == 0:
... | 0 | 0 | 0 | 0 | 0 | 0 |
Presentations/WG2_11/GlassBR_Code/fromGOOL/python/Calculations.py | Danki567/Drasil | 114 | 3236695 | <reponame>Danki567/Drasil<filename>Presentations/WG2_11/GlassBR_Code/fromGOOL/python/Calculations.py
from __future__ import print_function
import sys
import math
import InputParameters
def calc_q_hat(q, inparams):
q_hat = ((q * ((inparams.a * inparams.b) ** 2.0)) / (inparams.E * (inparams.h ** 4.0))) * (1.0 / inp... | 0 | 0 | 0 | 0 | 0 | 0 |
parsifal/apps/activities/urls.py | ShivamPytho/parsifal | 342 | 3236719 | <filename>parsifal/apps/activities/urls.py
from django.urls import path
from parsifal.apps.activities import views
app_name = "activities"
urlpatterns = [
path("follow/", views.follow, name="follow"),
path("unfollow/", views.unfollow, name="unfollow"),
path("update_followers_count/", views.update_followe... | 0 | 0 | 0 | 0 | 0 | 0 |
data/collect_indoor3d_data.py | qianguih/RSNet | 117 | 3236760 | import os
import sys
import argparse
from utils import indoor3d_util
#---- input arguments
parser = argparse.ArgumentParser(description='Process input arguments.')
parser.add_argument('--raw_data_dir',
help='directory where raw dataset is stored')
parser.add_argument('--output_folder', default='... | 0 | 0 | 0 | 0 | 0 | 0 |
docs_src/examples/use_cases/example_subsampling.py | jabader97/backpack | 395 | 3236796 | """Mini-batch sub-sampling
==========================
By default, BackPACK's extensions consider all samples in a mini-batch. Some extensions
support limiting the computations to a subset of samples. This example shows how to
restrict the computations to such a subset of samples.
This may be interesting for applicati... | 0 | 0 | 0 | 0 | 0 | 0 |
holoviews/ipython/widgets.py | TheoMathurin/holoviews | 864 | 3236829 | from __future__ import annotations
import sys, math, time
from unittest import SkipTest
try:
import IPython
from IPython.core.display import clear_output
except:
clear_output = None
raise SkipTest("IPython extension requires IPython >= 0.12")
# IPython 0.13 does not have version_info
ipython2 = hasatt... | 6 | 2 | 2 | 1 | 11 | 0 |
official/vision/beta/projects/yolo/optimization/optimizer_factory.py | KiryanovKD/models | 82,518 | 3236836 | <filename>official/vision/beta/projects/yolo/optimization/optimizer_factory.py<gh_stars>1000+
# Copyright 2021 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 th... | 0 | 0 | 0 | 0 | 0 | 0 |
letter_combinations_of_a_phone_number/solution3.py | mahimadubey/leetcode-python | 528 | 3236862 | <filename>letter_combinations_of_a_phone_number/solution3.py
class Solution:
# @return a list of strings, [s1, s2]
def letterCombinations(self, digits):
d = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter11/Ch11/tkedit/textarea.py | henrryyanez/Tkinter-GUI-Programming-by-Example | 127 | 3236865 | from __future__ import annotations
import tkinter as tk
import tkinter.messagebox as msg
class TextArea(tk.Text):
def __init__(self, master, **kwargs):
super().__init__(**kwargs)
self.master = master
self.config(wrap=tk.WORD) # CHAR NONE
self.tag_configure('find_match', backgro... | 6 | 7 | 0 | 2 | 15 | 0 |
RetinaFace/rcnn/processing/assign_levels.py | Talgin/facerec | 1,991 | 3236874 | <filename>RetinaFace/rcnn/processing/assign_levels.py
from rcnn.config import config
import numpy as np
def compute_assign_targets(rois, threshold):
rois_area = np.sqrt((rois[:, 2] - rois[:, 0] + 1) * (rois[:, 3] - rois[:, 1] + 1))
num_rois = np.shape(rois)[0]
assign_levels = np.zeros(num_rois, dtype=np.u... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/core/src/RPA/core/locators/containers.py | amisol/rpaframework | 518 | 3236887 | from dataclasses import dataclass, asdict, fields, MISSING
from typing import Optional
@dataclass
class Locator:
"""Baseclass for a locator entry."""
def __str__(self) -> object:
values = []
for field in fields(self):
if field.default is not MISSING:
break
... | 0 | 3 | 19 | 0 | 22 | 0 |
k3d/test/test_visual_mesh.py | mjpolak/K3D-jupyter | 704 | 3236904 | import k3d
import numpy as np
import pytest
from .plot_compare import *
from k3d.helpers import download
import vtk
from vtk.util import numpy_support
vertices = [
-10, 0, -1,
10, 0, -1,
10, 0, 1,
-10, 0, 1,
]
indices = [
0, 1, 3,
1, 2, 3
]
def test_mesh():
global vertices, indices
... | 0 | 0 | 0 | 0 | 0 | 0 |
nncf/tensorflow/sparsity/utils.py | sarthakpati/nncf | 310 | 3236921 | """
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | 5 | 2 | 0 | 0 | 7 | 0 |
experiments/signals.py | PetrDlouhy/django-experiments | 237 | 3236927 | from django.dispatch import Signal
user_enrolled = Signal(providing_args=['experiment', 'alternative', 'user', 'session'])
| 0 | 0 | 0 | 0 | 0 | 0 |
mmselfsup/core/hooks/odc_hook.py | mitming/mmselfsup | 355 | 3236942 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from mmcv.runner import HOOKS, Hook
from mmcv.utils import print_log
@HOOKS.register_module()
class ODCHook(Hook):
"""Hook for ODC.
This hook includes the online clustering process in ODC.
Args:
centroids_update_interval (int): F... | 1 | 0 | 0 | 0 | 1 | 0 |
views/view_assessment.py | TomasTorresB/nerve | 365 | 3236947 | <reponame>TomasTorresB/nerve<filename>views/view_assessment.py
from core.security import session_required
from flask import Blueprint, render_template
assessment = Blueprint('assessment', __name__,
template_folder='templates')
@assessment.route('/assessment')
@session_required
def view_assessm... | 0 | 0 | 0 | 0 | 0 | 0 |
code/source/LambdaRDS_TestHarness.py | ab-group/aws-lambda-manage-rds-connections | 211 | 3236953 | <filename>code/source/LambdaRDS_TestHarness.py
import sys
import boto3
import botocore
import json
import os
# Get the service resource.
lambdaClient = boto3.client('lambda')
testFunctionARN = os.environ['TEST_FUNCTION_ARN']
def invokeTestLambda(functionARN, operation, iterations):
if operation == 'unit':
... | 0 | 0 | 0 | 0 | 0 | 0 |
layers/eight_mile/calibration/metrics/__init__.py | sagnik/baseline | 241 | 3236965 | <filename>layers/eight_mile/calibration/metrics/__init__.py
from eight_mile.calibration.metrics.calibration_error import expected_calibration_error, maximum_calibration_error
| 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/python_tutorials/code/connect.py | Jarvan-Wang/k2 | 491 | 3236976 | import k2
s1 = '''
0 0 1 0.1
0 1 2 0.2
1 2 -1 0.3
2
'''
s2 = '''
0 1 1 1
0 1 2 2
1 2 -1 3
2
'''
a_fsa = k2.Fsa.from_str(s1)
b_fsa = k2.Fsa.from_str(s2)
c_fsa = k2.intersect(a_fsa, b_fsa)
connected = k2.connect(c_fsa)
a_fsa.draw('a_fsa_1.svg', title='a_fsa')
b_fsa.draw('b_fsa_1.svg', title='b_fsa')
c_fsa.draw('before_co... | 0 | 0 | 0 | 0 | 0 | 0 |
packnet_sfm/networks/layers/minkowski.py | TheMarshalMole/packnet-sfm | 982 | 3237022 | <reponame>TheMarshalMole/packnet-sfm<filename>packnet_sfm/networks/layers/minkowski.py
# Copyright 2021 Toyota Research Institute. All rights reserved.
import MinkowskiEngine as ME
import torch
def sparsify_features(x):
"""
Sparsify features
Parameters
----------
x : Dense feature map [B,C,H,W... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/r-illuminahumanmethylationepicmanifest/package.py | LiamBindle/spack | 2,360 | 3237032 | <filename>var/spack/repos/builtin/packages/r-illuminahumanmethylationepicmanifest/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 R... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_loss/test_regression_losses.py | carolchenyx/mmpose | 367 | 3237048 | import torch
from mmpose.models import build_loss
def test_smooth_l1_loss():
# test SmoothL1Loss without target weight
loss_cfg = dict(type='SmoothL1Loss')
loss = build_loss(loss_cfg)
fake_pred = torch.zeros((1, 3, 2))
fake_label = torch.zeros((1, 3, 2))
assert torch.allclose(loss(fake_pred,... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/pylightning/lightning/__init__.py | Bladez1753/lightning | 2,288 | 3237050 | <reponame>Bladez1753/lightning<gh_stars>1000+
from pyln.client import LightningRpc, RpcError, Millisatoshi, __version__, Plugin, monkey_patch
__all__ = [
"__version__",
"LightningRpc",
"RpcError",
"Millisatoshi",
"Plugin",
"monkey_patch",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
office365/sharepoint/likes/likedByInformation.py | juguerre/Office365-REST-Python-Client | 544 | 3237062 | <reponame>juguerre/Office365-REST-Python-Client<filename>office365/sharepoint/likes/likedByInformation.py<gh_stars>100-1000
from office365.sharepoint.base_entity import BaseEntity
class LikedByInformation(BaseEntity):
@property
def like_count(self):
return self.properties.get("LikeCount", None)
... | 0 | 0 | 0 | 0 | 0 | 0 |
models/common.py | entc-17-fyp-05/diffusion-point-cloud | 138 | 3237065 | from __future__ import annotations
import torch
from torch.nn import Module, Linear
from torch.optim.lr_scheduler import LambdaLR
import numpy as np
def reparameterize_gaussian(mean, logvar) -> object:
std = torch.exp(0.5 * logvar)
eps = torch.randn(std.size()).to(mean)
return mean + std * eps
def gaussi... | 3 | 8 | 0 | 0 | 11 | 0 |
release/stubs.min/System/Windows/Media/Animation_parts/IEasingFunction.py | htlcnn/ironpython-stubs | 182 | 3237085 | <gh_stars>100-1000
class IEasingFunction:
""" Defines the basic functionality of an easing function. """
def Ease(self,normalizedTime):
"""
Ease(self: IEasingFunction,normalizedTime: float) -> float
Transforms normalized time to control the pace of an animation.
normalizedTime: Normali... | 0 | 0 | 0 | 0 | 0 | 0 |
vibora/templates/__init__.py | brettcannon/vibora | 6,238 | 3237098 | <gh_stars>1000+
from .template import *
from .engine import *
| 0 | 0 | 0 | 0 | 0 | 0 |
Contributions/num_pyramid.py | sattwik21/Hacktoberfest2021-1 | 215 | 3237109 | <reponame>sattwik21/Hacktoberfest2021-1<filename>Contributions/num_pyramid.py
rows = 5
for i in range(rows, 0, -1):
num = i
for j in range(0, i):
print(num, end=' ')
print("\r") | 0 | 0 | 0 | 0 | 0 | 0 |
lib/data_utils/h36m_utils.py | Bob130/TCMR_RELEASE | 167 | 3237116 | import os
import cv2
import glob
import h5py
import json
import joblib
import argparse
import numpy as np
from tqdm import tqdm
import os.path as osp
import scipy.io as sio
import sys
sys.path.append('.')
from lib.models import spin
from lib.core.config import TCMR_DB_DIR, BASE_DATA_DIR
from lib.utils.utils import tq... | 2 | 5 | 0 | 0 | 7 | 0 |
build/win/generate_crosswalk_zip.py | gaurangkumar/crosswalk | 2,211 | 3237142 | <reponame>gaurangkumar/crosswalk
#!/usr/bin/env python
#
# Copyright (c) 2016 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This program generates a ZIP file containing Crosswalk and supporting files and
directories wit... | 0 | 0 | 0 | 0 | 0 | 0 |
python/cusignal/filtering/filtering.py | jrc-exp/cusignal | 606 | 3237172 | # Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 18 | 15 | 0 | 0 | 33 | 0 |
TrackProblems/trackproblems/templates/__init__.py | tongpa/TrackProblems | 128 | 3237184 | <filename>TrackProblems/trackproblems/templates/__init__.py
# -*- coding: utf-8 -*-
"""Templates package for the application."""
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/issues/issue235_but.py | tgolsson/appJar | 666 | 3237216 | <filename>examples/issues/issue235_but.py<gh_stars>100-1000
import sys
sys.path.append("../../")
from appJar import gui
def change(btn):
print(btn, "change")
def submit(btn):
print(btn, "submit")
def drop(btn):
print(btn, "drop")
def press(btn):
print(btn)
app.button("PRESS", bg="red")
wi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_notice_center.py | DuXiao1997/lyrebird | 737 | 3237239 | <filename>tests/test_notice_center.py
from typing import NamedTuple
from lyrebird.mock import context
from lyrebird.notice_center import NoticeCenter
from lyrebird import reporter
from lyrebird import application
from lyrebird.event import EventServer
from lyrebird.task import BackgroundTaskServer
import pytest
MockC... | 0 | 0 | 0 | 0 | 0 | 0 |
app/grandchallenge/components/validators.py | kaczmarj/grand-challenge.org | 101 | 3237242 | <reponame>kaczmarj/grand-challenge.org
from django.core.exceptions import SuspiciousFileOperation, ValidationError
from django.utils._os import safe_join
def validate_safe_path(value):
"""Ensures that the path is safe and normalised."""
base = "/input/"
try:
new_path = safe_join(base, value)
... | 0 | 0 | 0 | 0 | 0 | 0 |
anuga/pmesh/visualmesh.py | samcom12/anuga_core | 136 | 3237245 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import str
from past.utils import old_div
from builtins import object
try:
from . import mesh
except:
import mesh
fr... | 0 | 13 | 0 | 1 | 14 | 0 |
sdk/python/pulumi_gcp/sql/user.py | la3mmchen/pulumi-gcp | 121 | 3237261 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 62 | 22 | 0 | 0 | 84 | 0 |
generate/lib/run-firefox/cuddlefish/rdf.py | flamencist/browser-extensions | 102 | 3237263 | import os
import xml.dom.minidom
import StringIO
RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
EM_NS = "http://www.mozilla.org/2004/em-rdf#"
class RDF(object):
def __str__(self):
# real files have an .encoding attribute and use it when you
# write() unicode into them: they read()/write() ... | 0 | 0 | 0 | 0 | 0 | 0 |
mango/mangoinstruction.py | dendisuhubdy/mango-explorer | 131 | 3237315 | <gh_stars>100-1000
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, D... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/functional_tests/doc_tests/test_issue145/support/package1/test_module.py | kokosing/hue | 5,079 | 3237316 | import unittest
def test_function():
pass
class TestClass:
def test_class(self):
pass
class TestCase(unittest.TestCase):
def test(self):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/multi_output_models.py | sim-san/scikeras | 111 | 3237320 | from __future__ import annotations
from typing import List
import numpy as np
from sklearn.utils.multiclass import type_of_target
from tensorflow.keras.backend import floatx as tf_floatx
from scikeras.utils.transformers import ClassifierLabelEncoder
from scikeras.wrappers import KerasClassifier
class MultiLabelTra... | 7 | 5 | 0 | 0 | 12 | 0 |
python/266_Palindrome_Permutation.py | dvlpsh/leetcode-1 | 4,416 | 3237330 | class Solution(object):
def canPermutePalindrome(self, s) -> bool:
"""
:type s: str
:rtype: bool
"""
dic = {}
for c in s:
dic[c] = dic.get(c, 0) + 1
odd, even = 0, 0
for c in dic:
if dic[c] % 2 == 0:
even += 1
... | 0 | 1 | 0 | 0 | 1 | 0 |
gyp/build.gyp | mathisloge/mapnik-vector-tile | 247 | 3237346 | <reponame>mathisloge/mapnik-vector-tile
{
"includes": [
"common.gypi"
],
'variables': {
'MAPNIK_PLUGINDIR%': '',
'enable_sse%':'true',
'common_defines' : [
'MAPNIK_VECTOR_TILE_LIBRARY=1'
]
},
"targets": [
{
'target_name': 'make_vector_tile',
'type': 'none',
... | 0 | 0 | 0 | 0 | 0 | 0 |
8.3 Tensorboard debugging.py | tvquynh/Machine-Learning-for-Finance | 239 | 3237353 | <filename>8.3 Tensorboard debugging.py
# coding: utf-8
# In[1]:
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# In[2]:
from keras.models import Sequential
from keras.layers import Dense
x_train.shape = (60000, 28 * 28)
x_test.shape = (10000, 28 * 28)
x_train = x... | 0 | 0 | 0 | 0 | 0 | 0 |
orders/tests/unit/test_get_order.py | Al-bambino/aws-serverless-ecommerce-platform | 758 | 3237355 | from __future__ import annotations
import copy
import datetime
import decimal
import json
import uuid
import pytest
from boto3.dynamodb.types import TypeSerializer
from botocore import stub
from fixtures import context, lambda_module # pylint: disable=import-error
from helpers import compare_dict # pylint: disable=impo... | 0 | 2 | 0 | 0 | 2 | 0 |
hs_access_control/tests/test_public_groups.py | tommac7/hydroshare | 178 | 3237369 |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import PrivilegeCodes, GroupAccess
from hs_core import hydroshare
from hs_core.testing import MockIRODSTestCaseMixin
from hs_access_control.tests.utilities import global_reset, is_equal_to_as_set
class T01P... | 0 | 0 | 0 | 0 | 0 | 0 |
run_pretraining.py | minikuro/cc-albert | 211 | 3237376 | <reponame>minikuro/cc-albert
# coding=utf-8
# Copyright 2019 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
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577628_Dynamically_modifying_class_attributes_at/recipe-577628.py | tdiprima/code | 2,023 | 3237396 | <gh_stars>1000+
'''
Created on Mar 31, 2011
@author: <NAME>
'''
def noop(*args,**kwargs):
pass
def modify_class(cls,name=None,default=noop):
"""
Modify an class attribute/method.
This decorator factory returns a decorator which modifies on the fly (i.e. monkeypatches)
the class "cls" by addin... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/performance/perf_load/perf_processes.py | Rob-S/indy-node | 627 | 3237397 | <filename>scripts/performance/perf_load/perf_processes.py
#! /usr/bin/env python3
import json
import time
import os
import sys
import asyncio
import argparse
import multiprocessing
import concurrent
import signal
import functools
from datetime import datetime
import yaml
import logging
import shutil
from indy import ... | 0 | 0 | 0 | 0 | 0 | 0 |
run_simulation_yaml.py | larrycameron80/metta | 940 | 3237431 | <filename>run_simulation_yaml.py<gh_stars>100-1000
# author <NAME> - Uber
# additions Maus - Uber
# additions author <NAME> - Riot Games
# adversarial simulation engine
from __future__ import print_function
import datetime
import json
import logging
import os
import subprocess
import sys
import time
from argparse imp... | 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.