max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
core/modules/modules.py | WoojuLee24/spvnas | 149 | 12680917 | <filename>core/modules/modules.py
import random
from abc import abstractmethod
import torch.nn as nn
__all__ = ['RandomModule', 'RandomChoice', 'RandomDepth']
class RandomModule(nn.Module):
@abstractmethod
def random_sample(self):
pass
@abstractmethod
def clear_sample(self):
pass
... |
mmaction/datasets/samplers/__init__.py | kiyoon/Video-Swin-Transformer | 648 | 12680918 | from .distributed_sampler import (ClassSpecificDistributedSampler,
DistributedSampler)
__all__ = ['DistributedSampler', 'ClassSpecificDistributedSampler']
|
core/basestore.py | miguelvm/PyTrendFollow | 158 | 12680923 | <filename>core/basestore.py
from config.settings import quotes_storage
"""
This file imports data read/write methods for a local storage depending on the user's choice.
These methods are used in core.contract_store.
"""
if quotes_storage == 'hdf5':
from core.hdfstore import read_symbol, read_contract, write_dat... |
mysql2pgsql/lib/config.py | asvedr/py-mysql2pgsql | 275 | 12680936 | from __future__ import with_statement, absolute_import
import os.path
from yaml import load
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from .errors import ConfigurationFileInitialized,\
ConfigurationFileNotFound
class ConfigBase(objec... |
mayan/apps/documents/serializers/document_version_serializers.py | bonitobonita24/Mayan-EDMS | 343 | 12680955 | <filename>mayan/apps/documents/serializers/document_version_serializers.py
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.serializers import ContentTypeSerializer
from mayan.apps.rest_api import serializers
from mayan.apps.rest_api.relations import MultiKwargHyperlinkedIdentityField
fr... |
sacrebleu/metrics/helpers.py | jhcross/sacrebleu | 373 | 12680970 | """Various utility functions for word and character n-gram extraction."""
from collections import Counter
from typing import List, Tuple
def extract_all_word_ngrams(line: str, min_order: int, max_order: int) -> Tuple[Counter, int]:
"""Extracts all ngrams (min_order <= n <= max_order) from a sentence.
:param... |
py4web/utils/dbstore.py | DonaldMcC/py4web | 133 | 12680976 | from datetime import datetime, timedelta
class DBStore:
def __init__(self, db, name="py4web_session"):
self.__prerequisites__ = [db]
Field = db.Field
self.db = db
if not name in db.tables:
db.define_table(
name,
Field("rkey", "string"),
... |
chitra/serve/api.py | rajatscibi/chitra | 158 | 12680979 | <reponame>rajatscibi/chitra
from typing import Callable, Dict, Optional
import uvicorn
from fastapi import FastAPI, File, UploadFile
from chitra.__about__ import documentation_url
from chitra.serve import schema
from chitra.serve.base import ModelServer
from chitra.serve.constants import IMAGE_CLF, OBJECT_DETECTION, ... |
pontoon/base/management/commands/heroku_deploy_setup.py | foss4/pontoon | 1,145 | 12680984 | <reponame>foss4/pontoon
import os
from urllib.parse import urlparse, urljoin
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from pontoon.base.models import Project, User
class Command(BaseCommand):
help = "Setup an instance of Pontoon deployed via Heroku Deploy... |
stringsifter/lib/stats.py | noraj/stringsifter | 523 | 12681042 | <reponame>noraj/stringsifter
# Copyright (C) 2019 FireEye, Inc. All Rights Reserved.
"""
english letter probabilities
table from http://en.algoritmy.net/article/40379/Letter-frequency-English
"""
english_letter_probs_percent = [
['a', 8.167],
['b', 1.492],
['c', 2.782],
['d', 4.253],
['e', 12.702... |
test/watchdog_test/test_get_current_local_nfs_mounts.py | openshift-bot/aws-efs-utils | 196 | 12681051 | <filename>test/watchdog_test/test_get_current_local_nfs_mounts.py
#
# Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved.
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
#
import ... |
tests/models/test_managers.py | operatorai/modelstore | 151 | 12681061 | <filename>tests/models/test_managers.py
# Copyright 2020 <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... |
deephar/data/mpii.py | steuwe/deephar | 343 | 12681071 | import os
import numpy as np
import scipy.io as sio
from PIL import Image
from deephar.utils import *
def load_mpii_mat_annotation(filename):
mat = sio.loadmat(filename)
annot_tr = mat['annot_tr']
annot_val = mat['annot_val']
# Respect the order of TEST (0), TRAIN (1), and VALID (2)
rectidxs = ... |
hummingbot/connector/exchange/digifinex/digifinex_exchange.py | cardosofede/hummingbot | 542 | 12681081 | import asyncio
import logging
import math
import time
from decimal import Decimal
from typing import Any, AsyncIterable, Dict, List, Optional
from hummingbot.connector.exchange.digifinex import digifinex_utils
from hummingbot.connector.exchange.digifinex.digifinex_global import DigifinexGlobal
from hummingbot.connecto... |
dart_fss/xbrl/table.py | dveamer/dart-fss | 243 | 12681131 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import re
import pandas as pd
from pandas import DataFrame
from dateutil.relativedelta import relativedelta
from arelle.ModelXbrl import ModelXbrl
from arelle import XbrlConst
from dart_fss.utils import str_to_regex
from dart_fss.xbrl.helper import (cls_label_check, get_la... |
tests/nnapi/specs/V1_2/rsqrt_4D_float_nnfw.mod.py | bogus-sudo/ONE-1 | 255 | 12681141 | # model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}")
i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2, 2}")
model = model.Operation("RSQRT", i1).To(i3)
# Example 1. Input in operand 0,
input0 = {i1: # input 0
[1.0, 36.0, 2.0, 90, 4.0, 16.0, 25.0, 100.0,
23.0, 19.0, 40.0, 256.0, 4.0,... |
endless_pagination/tests/integration/test_callbacks.py | bjinwright/django-endless-pagination | 124 | 12681143 | <reponame>bjinwright/django-endless-pagination<gh_stars>100-1000
"""Javascript callbacks integration tests."""
from __future__ import unicode_literals
from endless_pagination.tests.integration import SeleniumTestCase
class CallbacksTest(SeleniumTestCase):
view_name = 'callbacks'
def notifications_loaded(s... |
src/oci/database_management/models/awr_db_parameter_summary.py | Manny27nyc/oci-python-sdk | 249 | 12681144 | <gh_stars>100-1000
# 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.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... |
powerline_shell/segments/php_version.py | Dakedres/powerline-shell | 2,656 | 12681149 | import subprocess
from ..utils import ThreadedSegment, decode
class Segment(ThreadedSegment):
def run(self):
self.version = None
try:
output = decode(
subprocess.check_output(['php', '-r', 'echo PHP_VERSION;'],
stderr=subprocess.S... |
gslib/commands/hmac.py | stanhu/gsutil | 649 | 12681150 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2019 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... |
scripts/gen_gcov_files.py | maxvankessel/zephyr | 6,224 | 12681151 | #!/usr/bin/env python3
#
# Copyright (c) 2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""This script will parse the serial console log file and create the required
gcda files.
"""
import argparse
import os
import re
def retrieve_data(input_file):
extracted_coverage_info = {}
capture_data ... |
lingvo/core/sendrecv.py | Harshs27/lingvo | 2,611 | 12681160 | # Lint as: python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
exhale/configs.py | matz-e/exhale | 169 | 12681165 | <filename>exhale/configs.py
# -*- coding: utf8 -*-
########################################################################################
# This file is part of exhale. Copyright (c) 2017-2019, <NAME>. #
# Full BSD 3-Clause license available here: #
# ... |
scudcloud/downloader.py | p-mongo/scudcloud | 1,480 | 12681191 | from urllib import request
from PyQt5.QtCore import QThread
class Downloader(QThread):
def __init__(self, wrapper, icon, path):
QThread.__init__(self)
self.wrapper = wrapper
self.icon = icon
self.path = path
def run(self):
try:
file_name, headers = request... |
opendeep/utils/midi/MidiInFile.py | vitruvianscience/OpenDeep | 252 | 12681201 | <filename>opendeep/utils/midi/MidiInFile.py
# -*- coding: ISO-8859-1 -*-
from __future__ import absolute_import
from .RawInstreamFile import RawInstreamFile
from .MidiFileParser import MidiFileParser
class MidiInFile:
"""
Parses a midi file, and triggers the midi events on the outStream
... |
src/bindings/python/tests/test_inference_engine/test_output_const_node.py | opencv/dldt | 1,127 | 12681207 | <filename>src/bindings/python/tests/test_inference_engine/test_output_const_node.py
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
from ..conftest import model_path
import openvino.runtime.opset8 as ops
from openvino.runtime import (
ConstOutput... |
batchflow/batch_image.py | analysiscenter/dataset | 101 | 12681228 | """ Contains Batch classes for images """
import os
import warnings
from numbers import Number
import numpy as np
import PIL
import PIL.ImageOps
import PIL.ImageChops
import PIL.ImageFilter
import PIL.ImageEnhance
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates... |
FWCore/Services/test/test_resource_succeed_cfg.py | ckamtsikis/cmssw | 852 | 12681237 | <filename>FWCore/Services/test/test_resource_succeed_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.source = cms.Source("EmptySource")
process.add_(cms.Service("ResourceEnforcer",
maxVSize = cms.untracked.double(1.0),
maxRSS = cm... |
pyNastran/dev/bdf_vectorized/cards/elements/solid/ctetra4.py | luzpaz/pyNastran | 293 | 12681241 | <reponame>luzpaz/pyNastran<gh_stars>100-1000
from itertools import count
import numpy as np
from numpy import zeros, arange, dot, cross, searchsorted, array, eye, ones
#from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.bdf_interface.assign_type import integer
from pyNastran.dev.bdf_vectorized.... |
picotui/screen.py | timeopochin/picotui | 739 | 12681253 | import os
import signal
class Screen:
@staticmethod
def wr(s):
# TODO: When Python is 3.5, update this to use only bytes
if isinstance(s, str):
s = bytes(s, "utf-8")
os.write(1, s)
@staticmethod
def wr_fixedw(s, width):
# Write string in a fixed-width fiel... |
src/genie/libs/parser/ios/tests/ShowNtpAssociations/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 12681325 | <reponame>balmasea/genieparser<gh_stars>100-1000
expected_output = {
"clock_state": {
"system_status": {
"associations_address": "10.16.2.2",
"associations_local_mode": "client",
"clock_offset": 27.027,
"clock_refid": "127.127.1.1",
"clock_state": ... |
bcbio/hla/groups.py | a113n/bcbio-nextgen | 418 | 12681330 | <reponame>a113n/bcbio-nextgen
"""Place HLA calls into group for validation and presentation.
Uses p-groups with identical protein sequences in the antigen binding domains:
http://hla.alleles.org/alleles/p_groups.html
HLA allele nomenclature:
https://www.ebi.ac.uk/ipd/imgt/hla/
https://github.com/jrob119/IMGTHLA
HL... |
desktop/core/ext-py/opentracing-2.2.0/opentracing/mocktracer/tracer.py | yetsun/hue | 5,079 | 12681333 | <reponame>yetsun/hue
# Copyright (c) The OpenTracing Authors.
#
# 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 the rights
# to use, copy, mo... |
strategies/gekko-japonicus-master/promoterz/webServer/graphs.py | tobby2002/tradyai-api | 229 | 12681336 | <filename>strategies/gekko-japonicus-master/promoterz/webServer/graphs.py<gh_stars>100-1000
#!/bin/python
import dash_core_components as dcc
from evaluation.gekko.statistics import epochStatisticsNames, periodicStatisticsNames
def updateWorldGraph(app, WORLD):
environmentData = [
{
}
]
p... |
peregrinearb/utils/__init__.py | kecheon/peregrine | 954 | 12681348 | <reponame>kecheon/peregrine<gh_stars>100-1000
from .drawing import *
from .general import *
from .multi_exchange import create_multi_exchange_graph, create_weighted_multi_exchange_digraph, \
multi_graph_to_log_graph
from .single_exchange import load_exchange_graph, create_exchange_graph, FeesNotAvailable
from .misc... |
django/contrib/localflavor/hr/hr_choices.py | kix/django | 790 | 12681350 | <filename>django/contrib/localflavor/hr/hr_choices.py
# -*- coding: utf-8 -*-
"""
Sources:
Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR
Croatia doesn't have official abbreviations for counties.
The ones provided are in common use.
"""
from __future__ import unicode_literals
from django.ut... |
OnePy/custom_module/trade_log_analysis.py | Chandlercjy/OnePyfx | 321 | 12681352 | <reponame>Chandlercjy/OnePyfx
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
import pandas as pd
import plotly
from dash.dependencies import Input, Output, State
from plotly import graph_objs as go
from OnePy.sys_module.metabase_env import OnePyEn... |
python/tests/test_ir.py | clayne/gtirb | 230 | 12681353 | <filename>python/tests/test_ir.py
import os
import tempfile
import unittest
import gtirb
IR_FILE = tempfile.mktemp(suffix=".gtirb")
class IRTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
ir = gtirb.IR()
m = gtirb.Module(
binar... |
devito/builtins/arithmetic.py | reguly/devito | 204 | 12681354 | <filename>devito/builtins/arithmetic.py
import numpy as np
import devito as dv
from devito.builtins.utils import MPIReduction
__all__ = ['norm', 'sumall', 'inner', 'mmin', 'mmax']
@dv.switchconfig(log_level='ERROR')
def norm(f, order=2):
"""
Compute the norm of a Function.
Parameters
----------
... |
ppcls/loss/pairwisecosface.py | TxT1212/PaddleClas | 3,763 | 12681355 | # 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 app... |
python/src/main/python/cmd_helpers.py | KishkinJ10/graphicsfuzz | 519 | 12681367 |
# Copyright 2018 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
tests/runner.py | feedhq/feedhq | 361 | 12681381 | <filename>tests/runner.py
from django.conf import settings
from django.core.management import call_command
from django.test.runner import DiscoverRunner
from elasticsearch.exceptions import NotFoundError
from feedhq import es
class ESTestSuiteRunner(DiscoverRunner):
def setup_test_environment(self):
supe... |
todo/views/list_detail.py | Sowmya-1998/https-github.com-shacker-django-todo | 567 | 12681390 | import bleach
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
from ... |
scripts/rmg2to3.py | tza0035/RMG-Py | 250 | 12681397 | #!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... |
libs/SettingDialog_EN.py | lzx1413/labelImgPlus | 218 | 12681401 | from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtWidgets
import socket
import re
class SettingDialog(QtWidgets.QDialog):
enable_color_map = False
label_font_size = 10
task_mode = 0 #0=det, 1=seg, 2=cls
signal_conn = pyqtSignal(list)
def __init__(self, parent,config):
... |
dreamer/tools/chunk_sequence.py | jsikyoon/dreamer-1 | 546 | 12681407 | # Copyright 2019 The Dreamer 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 applicabl... |
py-bindings/ompl/morse/addons/ompl_addon.py | ericpairet/ompl | 837 | 12681411 | <filename>py-bindings/ompl/morse/addons/ompl_addon.py<gh_stars>100-1000
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or witho... |
example_configs/text2speech/centaur_float.py | VoiceZen/OpenSeq2Seq | 1,459 | 12681427 | <filename>example_configs/text2speech/centaur_float.py
# pylint: skip-file
import os
import tensorflow as tf
from open_seq2seq.data import Text2SpeechDataLayer
from open_seq2seq.decoders import CentaurDecoder
from open_seq2seq.encoders import CentaurEncoder
from open_seq2seq.losses import Text2SpeechLoss
from open_se... |
api/features/workflows/core/migrations/0001_initial.py | SolidStateGroup/Bullet-Train-API | 126 | 12681442 | <filename>api/features/workflows/core/migrations/0001_initial.py
# Generated by Django 3.2.12 on 2022-03-25 14:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_lifecycle.mixins
class Migration(migrations.Migration):
initial = True
d... |
parl/remote/tests/test_import_module/main_abs_test.py | lp2333/PARL | 3,172 | 12681456 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
tests/test_argoverse_tracking_loader.py | gargrohin/argoverse-api | 560 | 12681461 | <gh_stars>100-1000
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
"""Tracking Loader unit tests"""
import pathlib
import numpy as np
import pytest
from argoverse.data_loading.argoverse_tracking_loader import ArgoverseTrackingLoader
from argoverse.utils.camera_stats import CAMERA_LIST
TEST_DATA_LO... |
tests/basics/int_big_unary.py | learnforpractice/micropython-cpp | 13,648 | 12681466 | <filename>tests/basics/int_big_unary.py
# test bignum unary operations
i = 1 << 65
print(bool(i))
print(+i)
print(-i)
print(~i)
|
lpips.py | JiangtaoFeng/MaskGIT-pytorch | 163 | 12681484 | <reponame>JiangtaoFeng/MaskGIT-pytorch<filename>lpips.py
import torch
import torch.nn as nn
from torchvision.models import vgg16
from collections import namedtuple
import os
import hashlib
import requests
from tqdm import tqdm
URL_MAP = {
"vgg_lpips": "https://heibox.uni-heidelberg.de/f/607503859c864bc... |
mayan/apps/common/views.py | atitaya1412/Mayan-EDMS | 343 | 12681506 | from django.contrib import messages
from django.templatetags.static import static
from django.utils.translation import ugettext_lazy as _
from django.views.generic import RedirectView
from stronghold.views import StrongholdPublicMixin
from mayan.apps.views.generics import ConfirmView, SimpleView
from mayan.apps.views... |
pyjswidgets/pyjamas/XMLDoc.browser.py | takipsizad/pyjs | 739 | 12681511 | <filename>pyjswidgets/pyjamas/XMLDoc.browser.py
def create_xml_doc(text):
JS("""
try //Internet Explorer
{
var xmlDoc=new ActiveXObject("Microsoft['XMLDOM']");
xmlDoc['async']="false";
xmlDoc['loadXML'](@{{text}});
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
var parser=new DOMParser();... |
mava/systems/tf/vdn/system.py | sash-a/Mava | 337 | 12681525 | # python3
# Copyright 2021 InstaDeep Ltd. 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... |
tests/basics/except_match_tuple.py | learnforpractice/micropython-cpp | 13,648 | 12681531 | # test exception matching against a tuple
try:
fail
except (Exception,):
print('except 1')
try:
fail
except (Exception, Exception):
print('except 2')
try:
fail
except (TypeError, NameError):
print('except 3')
try:
fail
except (TypeError, ValueError, Exception):
print('except 4')
|
tools/mo/openvino/tools/mo/front/tf/extractors/pack.py | pazamelin/openvino | 2,406 | 12681561 | <reponame>pazamelin/openvino<gh_stars>1000+
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
def tf_pack_ext(pb):
assert (pb.attr["N"].i == len(pb.input))
return {
'axis': pb.attr["axis"].i,
'N': pb.attr["N"].i,
'infer': None
}
|
sdk/python/kubeflow/pytorchjob/constants/constants.py | happy2048/pytorch-operator | 312 | 12681573 | # Copyright 2019 kubeflow.org.
#
# 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,... |
examples/modal_component/app.py | adamlwgriffiths/vue.py | 274 | 12681585 | from vue import VueComponent
class Modal(VueComponent):
template = "#modal-template"
Modal.register()
class App(VueComponent):
template = "#main"
show_modal = False
App("#app")
|
testcases/elichika_tests/node/Functions/MinMax.py | vermashresth/chainer-compiler | 116 | 12681587 | <reponame>vermashresth/chainer-compiler
# coding: utf-8
import numpy as np
import chainer
import chainer.functions as F
import chainer.links as L
from chainer_compiler.elichika import testtools
class Simple(chainer.Chain):
def __init__(self, func):
super().__init__()
self.func = func
def forw... |
web400-8/bug_flask/flaskweb/app/__init__.py | mehrdad-shokri/CTF_web | 664 | 12681591 | import os
from flask import Flask, redirect, url_for, session, render_template, flash
from flask_script import Manager
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from config import config
from werkzeug.routing impor... |
tests/test_tradeexecutor.py | nhatminhbeo/mango-explorer | 131 | 12681593 | import typing
from .context import mango
from .fakes import fake_context, fake_wallet
from decimal import Decimal
def test_trade_executor_constructor() -> None:
succeeded = False
try:
mango.TradeExecutor() # type: ignore[abstract]
except TypeError:
# Can't instantiate the abstract base ... |
SpriteEncoder/decode.py | rmnvgr/CorsixTH | 2,323 | 12681600 | #!/usr/bin/env python3
"""
Program to decode the first sprite of a CTHG 2 file.
Mainly intended as a test for the checking the encoder, but also a
demonstration of how to decode.
"""
_license = """
Copyright (c) 2013 Alberth "Alberth" Hofkamp
Permission is hereby granted, free of charge, to any person obtaining a cop... |
voicefixer/base.py | ishine/voicefixer | 159 | 12681621 | import librosa.display
from voicefixer.tools.pytorch_util import *
from voicefixer.tools.wav import *
from voicefixer.restorer.model import VoiceFixer as voicefixer_fe
import os
EPS = 1e-8
class VoiceFixer(nn.Module):
def __init__(self):
super(VoiceFixer, self).__init__()
self._model = voicefixer... |
CTFd/schemas/submissions.py | nox237/CTFd | 3,592 | 12681623 | from marshmallow import fields
from CTFd.models import Submissions, ma
from CTFd.schemas.challenges import ChallengeSchema
from CTFd.utils import string_types
class SubmissionSchema(ma.ModelSchema):
challenge = fields.Nested(ChallengeSchema, only=["name", "category", "value"])
class Meta:
model = Su... |
apps/iterm.py | zachbarrow/talon_community | 125 | 12681627 | from talon.voice import Key, Context
ctx = Context("iterm", bundle="com.googlecode.iterm2")
keymap = {
"broadcaster": Key("cmd-alt-i"),
"password": Key("cmd-alt-f"),
# Pane creation and navigation
"split horizontal": Key("cmd-shift-d"),
"split vertical": Key("cmd-d"),
"pane next": Key("cmd-]")... |
Blending/BP_Regression.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 12681644 | #-*- coding:utf-8 -*-
# &Author AnFany
# 适用于多维输出
import numpy as np
import tensorflow as tf
'''基于TensorFlow构建训练函数'''
# 创建激活函数
def activate(input_layer, weights, biases, actfunc):
layer = tf.add(tf.matmul(input_layer, weights), biases)
if actfunc == 'relu':
return tf.nn.relu(layer)
el... |
var/spack/repos/builtin/packages/nvptx-tools/package.py | LiamBindle/spack | 2,360 | 12681652 | # 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 NvptxTools(AutotoolsPackage):
"""nvptx-tools: A collection of tools for use with nvptx-non... |
fusesoc/provider/github.py | idex-biometrics/fusesoc | 829 | 12681660 | # Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
import logging
import os.path
import sys
import tarfile
from fusesoc.provider.provider import Provider
logger = logging.getLogger(__name__)
if sys.version_info[0] >= 3:
im... |
clients/python/lipstick/lipstick.py | OpenEarthDemo/Lipstick | 238 | 12681671 | <filename>clients/python/lipstick/lipstick.py
import requests
from .graph import *
from .template import Template
class BaseClient(object):
def __init__(self, base_url):
if base_url.startswith("http"):
self.base_url = base_url
else:
self.base_url = "http://"+base_url
... |
NVLL/data/preprocess_yelp13_to_ptb_format.py | jennhu/vmf_vae_nlp | 159 | 12681681 | <reponame>jennhu/vmf_vae_nlp
"""
Format: [sent_bit] [w0] [w1] ...
"""
def remove_ids(fname, trunc=50):
with open(fname, 'r', errors='ignore') as fd:
lines = fd.read().splitlines()
bag = []
for l in lines:
l = l.replace(" <sssss>", "")
tokens = l.split("\t")
assert len(token... |
bauh/gems/arch/__init__.py | Flash1232/bauh | 507 | 12681718 | <gh_stars>100-1000
import os
from pathlib import Path
from bauh.api.constants import CACHE_PATH, CONFIG_PATH, TEMP_DIR
from bauh.commons import resource
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_DIR = '{}/arch'.format(TEMP_DIR)
ARCH_CACHE_PATH = CACHE_PATH + '/arch'
CATEGORIES_FILE_PATH = ARCH_CACHE... |
tests/test_agent.py | PLPeeters/reppy | 137 | 12681720 | <filename>tests/test_agent.py
import unittest
from reppy.robots import Agent, Robots
class AgentTest(unittest.TestCase):
'''Tests about the Agent.'''
def parse(self, content, name):
'''Parse the robots.txt in content and return the agent of the provided name.'''
return Robots.parse('http://e... |
mmflow/core/hooks/multistagelr_updater.py | ArlenCHEN/mmflow | 481 | 12681721 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Any, Sequence
from mmcv.runner import HOOKS, IterBasedRunner, LrUpdaterHook
@HOOKS.register_module()
class MultiStageLrUpdaterHook(LrUpdaterHook):
"""Multi-Stage Learning Rate Hook.
Args:
milestone_lrs (Sequence[fl... |
python/boxdraw_test.py | nino/vim-boxdraw | 165 | 12681773 | from boxdraw import *
from pprint import pprint
# --------- Test utilities --------
def assert_cmd(cmd, cur1, cur2, lines, *args):
assert len(lines) % 2 == 0
input_lines = [lines[i] for i in range(0, len(lines), 2)]
expected = [lines[i] for i in range(1, len(lines), 2)]
# Determine coordinates from '... |
egs2/dirha_wsj/asr1/local/prepare_dirha_ir.py | texpomru13/espnet | 5,053 | 12681777 | <reponame>texpomru13/espnet
#!/usr/bin/env python3
import argparse
from pathlib import Path
from typing import Optional
import resampy
import scipy.io
import soundfile
def prepare(
dirha_dir: str,
fs: int,
audio_dir: str,
data_dir: Optional[str],
audio_format: str = "flac",
):
dirha_dir = Pat... |
boost_adaptbx/tests/tst_string_representation.py | dperl-sol/cctbx_project | 155 | 12681815 | from __future__ import absolute_import, division, print_function
from six.moves import range
def exercise():
import boost_adaptbx.boost.python as bp
csr = bp.ext.string_representation
from libtbx.str_utils import py_string_representation as psr
for sr in [csr, psr]:
assert sr("a", '"', "'") == '"a"'
as... |
tests/test_data/testpkgs/pkg1/sub/__main__.py | int19h/ptvsd | 349 | 12681822 | <reponame>int19h/ptvsd
from debug_me import backchannel
backchannel.send("ok")
|
pyhanko_tests/layout_test_utils.py | peteris-zealid/pyHanko | 161 | 12681824 | <reponame>peteris-zealid/pyHanko
import logging
import os
import subprocess
import tempfile
import pytest
__all__ = ['with_layout_comparison', 'compare_output']
from pyhanko.pdf_utils.writer import BasePdfFileWriter
logger = logging.getLogger(__name__)
SKIP_LAYOUT = False
SKIP_LAYOUT_REASON = "pdftoppm or compare ... |
src/borg/patterns.py | phil294/borg | 8,680 | 12681834 | import argparse
import fnmatch
import os.path
import re
import sys
import unicodedata
from collections import namedtuple
from enum import Enum
from . import shellpattern
from .helpers import clean_lines
from .helpers.errors import Error
def parse_patternfile_line(line, roots, ie_commands, fallback):
"""Parse a p... |
tutorial/example_repo/jobs/hive_jobs.py | DotModus/pinball | 1,143 | 12681859 | # Copyright 2015, Pinterest, 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 writ... |
packages/jet_bridge_base/jet_bridge_base/paginators/page_number.py | KrunchMuffin/jet-bridge | 1,247 | 12681864 | <filename>packages/jet_bridge_base/jet_bridge_base/paginators/page_number.py
from collections import OrderedDict
import math
from jet_bridge_base.exceptions.missing_argument_error import MissingArgumentError
from jet_bridge_base.paginators.pagination import Pagination
from jet_bridge_base.responses.json import JSONRes... |
unitest/common.py | HyeongminMoon/PatrickStar | 494 | 12681877 | # BSD 3-Clause License
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrig... |
PC/layout/support/catalog.py | shawwn/cpython | 52,316 | 12681883 | <gh_stars>1000+
"""
File generation for catalog signing non-binary contents.
"""
__author__ = "<NAME> <<EMAIL>>"
__version__ = "3.8"
import sys
__all__ = ["PYTHON_CAT_NAME", "PYTHON_CDF_NAME"]
def public(f):
__all__.append(f.__name__)
return f
PYTHON_CAT_NAME = "python.cat"
PYTHON_CDF_NAME = "python.cdf... |
HetSANN_MR/utils/layers.py | xhhszc/hetsann | 116 | 12681890 | import numpy as np
import tensorflow as tf
conv1d = tf.layers.conv1d
def attn_head(seq, out_sz, bias_mat, activation, in_drop=0.0, coef_drop=0.0, residual=False):
with tf.name_scope('my_attn'):
if in_drop != 0.0:
seq = tf.nn.dropout(seq, 1.0 - in_drop)
seq_fts = tf.layers.conv1d(seq, ... |
deep-rl/lib/python2.7/site-packages/OpenGL/WGL/NV/present_video.py | ShujaKhalid/deep-rl | 210 | 12681898 | '''OpenGL extension NV.present_video
This module customises the behaviour of the
OpenGL.raw.WGL.NV.present_video to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a mechanism for displaying textures and
renderbuffers on auxiliary video output devices. It allows an
applicat... |
components/aws/sagemaker/delete_simulation_app/src/robomaker_delete_simulation_app_component.py | Iuiu1234/pipelines | 2,860 | 12681904 | <filename>components/aws/sagemaker/delete_simulation_app/src/robomaker_delete_simulation_app_component.py
"""RoboMaker component for deleting a simulation application."""
# 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... |
sysidentpy/polynomial_basis/simulation.py | neylsoncrepalde/sysidentpy | 107 | 12681919 | <filename>sysidentpy/polynomial_basis/simulation.py
""" Simulation methods for Polynomial NARMAX models """
# Authors:
# <NAME> <<EMAIL>>
# License: BSD 3 clause
from sysidentpy.parameter_estimation.estimators import Estimators
from ..base import GenerateRegressors
from ..base import InformationMatrix
from ... |
logomaker/src/examples.py | ruxi/logomaker | 125 | 12681927 | <reponame>ruxi/logomaker
import pandas as pd
import os
import gzip
from logomaker.src.error_handling import check, handle_errors
# load directory of file
matrix_dir = os.path.dirname(os.path.abspath(__file__)) \
+ '/../examples/matrices'
# load directory of file
data_dir = os.path.dirname(os.path.abspath... |
docs/plot_visualise.py | vishalbelsare/pycobra | 119 | 12681935 | <filename>docs/plot_visualise.py
"""
COBRA Visualisations
--------------------
This notebook will cover the visulaisation and plotting offered by
pycobra.
"""
# %matplotlib inline
import numpy as np
from pycobra.cobra import Cobra
from pycobra.ewa import Ewa
from pycobra.visualisation import Visualisation
from pycob... |
src/train/TrainOneClassifier.py | SurajK7/kaggle-rsna18 | 220 | 12681963 | <gh_stars>100-1000
###########
# IMPORTS #
###########
import os
WDIR = os.path.dirname(os.path.abspath(__file__))
import sys
sys.path.insert(0, os.path.join(WDIR, "gradient-checkpointing"))
import memory_saving_gradients
sys.path.insert(0, os.path.join(WDIR, "../grayscale-models"))
from inception_resnet_v2_gray imp... |
readtwice/models/checkpoint_utils_test.py | DionysisChristopoulos/google-research | 23,901 | 12681966 | <reponame>DionysisChristopoulos/google-research<gh_stars>1000+
# 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.... |
hanlp/components/srl/span_rank/inference_utils.py | antfootAlex/HanLP | 27,208 | 12681968 | # Adopted from https://github.com/KiroSummer/A_Syntax-aware_MTL_Framework_for_Chinese_SRL
# Inference functions for the SRL model.
import numpy as np
def decode_spans(span_starts, span_ends, span_scores, labels_inv):
"""
Args:
span_starts: [num_candidates,]
span_scores: [num_candidates, num_labe... |
recipes/Python/578399_alternative_way_draw_parallels_meridians/recipe-578399.py | tdiprima/code | 2,023 | 12681975 | <filename>recipes/Python/578399_alternative_way_draw_parallels_meridians/recipe-578399.py<gh_stars>1000+
#!/usr/bin/env python3
'''An alternative way to draw parallels and meridians with basemap.
Basemap is a toolkit of matplotlib used to plot geographic maps.
With this function you can:
* Draw the latitude/longitu... |
tests/test_misc.py | Alindil/python-plexapi | 749 | 12681981 | # -*- coding: utf-8 -*-
import os
import shlex
import subprocess
from os.path import abspath, dirname, join
import pytest
SKIP_EXAMPLES = ["Example 4"]
@pytest.mark.skipif(os.name == "nt", reason="No make.bat specified for Windows")
def test_build_documentation():
docroot = join(dirname(dirname(abspath(__file__... |
qiskit/providers/ibmq/random/utils.py | dowem/qiskit-ibmq-provider | 199 | 12681988 | <reponame>dowem/qiskit-ibmq-provider<filename>qiskit/providers/ibmq/random/utils.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or a... |
tests/install/test.py | nacl/rules_pkg | 123 | 12681994 | #!/usr/bin/env python3
# Copyright 2021 The Bazel 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 r... |
sdk/python/pulumi_gcp/accesscontextmanager/service_perimeters.py | sisisin/pulumi-gcp | 121 | 12682012 | <reponame>sisisin/pulumi-gcp
# 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, U... |
tests/Exscript/servers/SSHdTest.py | saveshodhan/exscript | 226 | 12682017 | from __future__ import absolute_import
import sys
import unittest
import re
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from .ServerTest import ServerTest
from Exscript.servers import SSHd
from Exscript.protocols import SSH2
class SSHdTest(ServerTest):
CORRELATE = SSHd
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.