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 |
|---|---|---|---|---|
scripts/stl/udp_1pkt_1mac_override.py | ajitkhaparde/trex-core | 956 | 11018603 | from trex_stl_lib.api import *
import argparse
# 1 clients MAC override the LSB of destination
# overide the src mac 00:bb:12:34:56:01 - 00:bb:12:34:56:0a
class STLS1(object):
def __init__ (self):
self.fsize =64; # the size of the packet
def create_stream (self):
# Create base packet an... |
modules/zenmapCore_Kvasir/Version.py | noraj/Kvasir | 194 | 11018621 | VERSION = "6.41SVN"
|
PWGJE/EMCALJetTasks/Tracks/analysis/old/CompareRawSpectraTriggers.py | maroozm/AliPhysics | 114 | 11018646 | <reponame>maroozm/AliPhysics
#! /usr/bin/env python
from Helper import ReadHistList, MakeRatio, HistNotFoundException
from Graphics import Frame, Style
from SpectrumContainer import DataContainer
from ROOT import TCanvas, TLegend, TPaveText
from ROOT import kBlack, kRed, kBlue, kGreen, kOrange
gPlot = None
class Plo... |
src/sage/categories/examples/manifolds.py | fchapoton/sage | 1,742 | 11018663 | <gh_stars>1000+
"""
Examples of manifolds
"""
# ****************************************************************************
# Copyright (C) 2015 <NAME> <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# https://www.gnu.org/licenses/
# ******************... |
tests/admin/clush-tests/MsgTreeTest.py | utdsimmons/ohpc | 692 | 11018667 | <filename>tests/admin/clush-tests/MsgTreeTest.py
#!/usr/bin/env python
# ClusterShell test suite
# Written by <NAME> 2010-02-03
"""Unit test for ClusterShell MsgTree Class"""
from operator import itemgetter
import sys
import unittest
sys.path.insert(0, '../lib')
from ClusterShell.MsgTree import *
class MsgTreeTe... |
databuilder/example/scripts/sample_deltalake_metadata.py | jdavidheiser/amundsen | 139 | 11018692 | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
"""
This is a example script for extracting Delta Lake Metadata Results
"""
from pyhocon import ConfigFactory
from pyspark.sql import SparkSession
from databuilder.extractor.delta_lake_metadata_extractor import DeltaLakeMetadataE... |
fengshen/data/task_dataloader/task_datasets.py | dumpmemory/Fengshenbang-LM | 265 | 11018702 | # coding=utf8
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from transformers import AutoTokenizer
import json
import torch
import pytorch_lightning as pl
import os
class LCSTSDataset(Dataset):
'''
Dataset Used for LCSTS summary task.
'''
def __init__(self, data_path, args):
... |
riak_repl/tests/test_check.py | davidlrosenblum/integrations-extras | 158 | 11018711 | <filename>riak_repl/tests/test_check.py
import pytest
from datadog_checks.base.errors import CheckException
from datadog_checks.dev.utils import get_metadata_metrics
from datadog_checks.riak_repl import RiakReplCheck
from .common import INSTANCE
def test_config():
c = RiakReplCheck('riak_repl', {}, {}, None)
... |
models/modules/context_embedder_base.py | niloofar17/MetaDialog | 204 | 11018713 | <gh_stars>100-1000
#!/usr/bin/env python
import torch
import logging
import sys
from transformers import BertModel, ElectraModel
from torchnlp.word_to_vector import GloVe
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m/%d/%Y %H:%M:%S',
... |
applications/tensorflow/dynamic_sparsity/dataset_encoder/utils.py | payoto/graphcore_examples | 260 | 11018715 | <filename>applications/tensorflow/dynamic_sparsity/dataset_encoder/utils.py
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import logging
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--dataset-dir", type=str, default="./datasets",
... |
tests/basics/zip.py | peterson79/pycom-micropython-sigfox | 303 | 11018722 | <filename>tests/basics/zip.py
print(list(zip()))
print(list(zip([1], {2,3})))
|
test_project/many_to_one/api.py | peopleticker/django-url-filter-py3 | 303 | 11018748 | <reponame>peopleticker/django-url-filter-py3
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet
from url_filter.backends.sqlalchemy import SQLAlchemyFilterBackend
from url_filte... |
PyObjCTest/test_nsopenpanel.py | Khan/pyobjc-framework-Cocoa | 132 | 11018749 | from AppKit import *
from PyObjCTools.TestSupport import *
class TestOpenPanel (TestCase):
def dont_testOpenPanelSignature(self):
"""
This test failed sometime after the 1.0b1 release (on Panther).
"""
o = NSOpenPanel.openPanel()
sig = o.beginSheetForDirectory_file_types_mo... |
auctioning_platform/foundation/foundation/method_dispatch.py | nhdinh/smp-modulith | 299 | 11018754 | import functools
from typing import Any, Callable
def method_dispatch(func: Callable[..., Any]) -> Callable[..., Any]:
dispatcher = functools.singledispatch(func)
def wrapper(*args, **kw): # type: ignore
return dispatcher.dispatch(args[1].__class__)(*args, **kw)
wrapper.register = dispatcher.re... |
examples/backups.py | doziya/hpeOneView | 107 | 11018755 | # -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... |
leetcode.com/python/904_Fruit_Into_Baskets.py | XSoyOscar/Algorithms | 713 | 11018767 | class Solution(object):
# outer for loop runs for all characters and the inner while loop processes each character only once,
# therefore the time complexity of the algorithm will be O(N+N) which is asymptotically equivalent to O(N)
# algorithm runs in constant space O(1)
def totalFruit(self, tree):
... |
vmoe/data/input_pipeline.py | google-research/vmoe | 205 | 11018768 | <reponame>google-research/vmoe
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
oidc_provider/migrations/0012_auto_20160405_2041.py | jbking/django-oidc-provider | 370 | 11018788 | <filename>oidc_provider/migrations/0012_auto_20160405_2041.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-05 20:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('oidc_provider', '0011_client_clie... |
examples/print_invalid_values.py | shawnbrown/dbfread | 179 | 11018789 | """
A field parser that returns invalid values as InvalidValue objects
instead of raising ValueError.
"""
from dbfread import DBF, FieldParser, InvalidValue
class MyFieldParser(FieldParser):
def parse(self, field, data):
try:
return FieldParser.parse(self, field, data)
except ValueError... |
tracklater/models.py | Eerovil/thyme-toggl-cli | 110 | 11018849 | <gh_stars>100-1000
from sqlalchemy import Column, Integer, String, DateTime, Text, PickleType
from datetime import datetime, timedelta
from typing import Optional
from tracklater.database import db
from tracklater import settings
import logging
logger = logging.getLogger(__name__)
class ApiCall(db.Model):
pk: i... |
src/scripts/simpleidml_indesign_save_as.py | kylehodgson/SimpleIDML | 136 | 11018850 | <reponame>kylehodgson/SimpleIDML
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from builtins import map
import os
from simple_idml.indesign import indesign
from simple_idml.commands import InDesignSoapCommand
class InDesignSaveAsCommand(InDesignSoapCommand):
description = """SOAP call to an InDesign Server to sa... |
tools/ensure-secret.py | kuraby1389Lab/bolt | 795 | 11018862 | <gh_stars>100-1000
#!/usr/bin/env python
# ensure-secret.py --- Initialize a js module file with Firebase secret.
#
# Copyright 2015 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 ... |
ADC_function.py | yoshiko2/Movie_Data_Capture | 562 | 11018886 | from os import replace
import requests
# import hashlib
from pathlib import Path
import secrets
import os.path
import os
import uuid
import json
import time
from lxml import etree
import re
import config
import typing
from urllib.parse import urljoin
import mechanicalsoup
from requests.adapters import HTTPAdapter
from ... |
tests/trac/test-trac-0091.py | eLBati/pyxb | 123 | 11018900 | <reponame>eLBati/pyxb
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.binding.basis
import pyxb.utils.domutils
import os.path
xsd='''<?xml version="1.0" encoding="... |
datashader/data_libraries/pandas.py | pyviz/datashader | 758 | 11018903 | from __future__ import absolute_import, division
import pandas as pd
from datashader.core import bypixel
from datashader.compiler import compile_components
from datashader.glyphs.points import _PointLike, _GeometryLike
from datashader.glyphs.area import _AreaToLineLike
from datashader.utils import Dispatcher
from col... |
neuralcompression/entropy_coders/jax_arithemetic_coder.py | tallamjr/NeuralCompression | 233 | 11018935 | <reponame>tallamjr/NeuralCompression<filename>neuralcompression/entropy_coders/jax_arithemetic_coder.py
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
This implementation is based on ... |
recipes/Python/440656_List_mixin/recipe-440656.py | tdiprima/code | 2,023 | 11018940 | <filename>recipes/Python/440656_List_mixin/recipe-440656.py
import copy
import sys
# Public domain
class ListMixin(object):
"""
Defines all list operations from a small subset of methods.
Subclasses should define _get_element(i), _set_element(i, value),
__len__(), _resize_region(start, end, new_size) and
_c... |
terrascript/pagerduty/r.py | mjuenema/python-terrascript | 507 | 11018953 | <gh_stars>100-1000
# terrascript/pagerduty/r.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class pagerduty_addon(terrascript.Resource):
pass
class pagerduty_business_servi... |
floobits.py | zedtux/floobits-sublime | 124 | 11018972 | # coding: utf-8
import sys
import os
import time
import subprocess
import threading
import sublime
PY2 = sys.version_info < (3, 0)
SOCK_SINGLE_READ = False
if PY2 and sublime.platform() == 'windows':
try:
import select
assert select
# Change behavior of some low-level socket stuff so that... |
DDDProxy/mime.py | wdongxv/DDDProxy | 139 | 11018986 | <reponame>wdongxv/DDDProxy<gh_stars>100-1000
import os
def get_mime_type(filename):
filename_type = os.path.splitext(filename)[1][1:]
type_list = {
'html' : 'text/html',
'htm' : 'text/html',
'shtml' : 'text/html',
'css' : 'text/css',
'xml' : 'text/xml',
'gif' : 'image/gif',
'jpeg' : 'image/jpeg',
'jpg' : 'ima... |
dataset/step3_make_database.py | giTorto/uszipcode-project | 179 | 11019005 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cconstruct a zipcode sqlite database for uszipcode extension.
"""
from __future__ import print_function
from pprint import pprint as ppt
from sqlite4dummy import *
import pandas as pd
df = pd.read_csv("zipcode.txt", sep="\t")
engine = Sqlite3Engine("zipcode.sqlite3")... |
examples/raygun_example.py | pbsds/sanic | 1,883 | 11019011 | <reponame>pbsds/sanic
from os import getenv
from raygun4py.raygunprovider import RaygunSender
from sanic import Sanic
from sanic.exceptions import SanicException
from sanic.handlers import ErrorHandler
class RaygunExceptionReporter(ErrorHandler):
def __init__(self, raygun_api_key=None):
super().__init__... |
bin/average_checkpoints.py | GingerBear/texar | 2,325 | 11019023 | <gh_stars>1000+
"""Checkpoint averaging script."""
# This script is modified version of
# https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/bin/t2t_avg_all.py
# which comes with the following license and copyright notice:
# Copyright 2017 The Tensor2Tensor Authors.
#
# Licensed under the Apache Li... |
hwt/hdl/types/structCast.py | ufo2011/hwt | 134 | 11019029 | <gh_stars>100-1000
from hwt.code import Concat
from hwt.doc_markers import internal
from hwt.hdl.types.array import HArray
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.hdlType import default_reinterpret_cast_fn, HdlType
from hwt.hdl.types.struct import HStruct
from hwt.hdl.value import HValue
from hwt.interfa... |
pymtl3/stdlib/ifcs/xcel_ifcs.py | kevinyuan/pymtl3 | 152 | 11019077 | """
==========================================================================
xcel_ifcs.py
==========================================================================
Accelerator interface implementations at FL, CL, and RTL.
Author: <NAME>
Date: June 3, 2019
"""
from greenlet import greenlet
from pymtl3 import *... |
cmdline_helpers.py | Danilum/self-ensemble-visual-domain-adapt | 190 | 11019126 | import os
def intens_aug_options(intens_scale_range, intens_offset_range):
intens_scale_range_lower = intens_scale_range_upper = None
if intens_scale_range != '':
if ':' not in intens_scale_range:
print('Invalid intens_scale_range format; should be float:float')
return
l... |
laikad.py | Techie4Life83/USBKIOSK | 750 | 11019139 | #!/usr/bin/env python
# Copyright 2015 Lockheed Martin 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... |
benchmarks/parsing_penn_treebank/scripts/fix_conll_format.py | apjanco/projects | 823 | 11019140 | import typer
from pathlib import Path
def main(in_loc: Path, out_loc: Path):
"""Fix the POS tag column in the test file. In this format it provides
the predicted tags, it should provide coarse tags.
"""
fixed = []
with in_loc.open() as input_file:
with out_loc.open("w") as output_file:
... |
transforms/unet_transforms.py | lonestar686/pytorch-saltnet | 289 | 11019159 | """Transforms for UNet.
Many methods are taken from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/63974.
"""
__author__ = '<NAME>, <NAME>'
import cv2
import random
import numpy as np
class PrepareImageAndMask(object):
"""Prepare images and masks like fixing channel numbers."""
def... |
setup.py | kwmiebach/nbflow | 163 | 11019215 | #!/usr/bin/env python
# coding: utf-8
# Distributed under the terms of the Modified BSD License.
import os
from distutils.core import setup
# get paths to all the extension files
extension_files = []
for (dirname, dirnames, filenames) in os.walk("nbflow/example"):
root = os.path.relpath(dirname, "nbflow")
i... |
cvpods/data/transforms/auto_aug.py | reinforcementdriving/cvpods | 758 | 11019301 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) BaseDetection, Inc. and its affiliates. All Rights Reserved
import math
import random
import numpy as np
import PIL
from PIL import Image, ImageEnhance, ImageOps
from cvpods.data.transforms import Transform
_PIL_VER = tuple([int(x) for x in PIL.__versio... |
emukit/quadrature/kernels/bounds.py | ndalchau/emukit | 152 | 11019356 | <filename>emukit/quadrature/kernels/bounds.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from typing import Tuple, List
from ...core.continuous_parameter import ContinuousParameter
class BoxBounds:
"""
Box bounds
""... |
fastmri_recon/training_scripts/denoising/generic_train.py | samiulshuvo/fastmri-reproducible-benchmark | 105 | 11019392 | import os.path as op
from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint
from tensorflow_addons.callbacks import TQDMProgressBar
from tf_fastmri_data.datasets.noisy import NoisyFastMRIDatasetBuilder
from fastmri_recon.config import *
from fastmri_recon.models.subclassed_models.denoisers.proposed_param... |
examples/310.cryptocurrencies/strategy.py | fja05680/pinkfish | 197 | 11019421 | <reponame>fja05680/pinkfish
"""
The SMA-ROC-portfolio stategy.
This is SMA-ROC strategy applied to a portfolio.
SMA-ROC is a rate of change calculation smoothed by
a moving average.
This module allows us to examine this strategy and try different
period, stop loss percent, margin, and whether to use a regime filter
o... |
Block-Cipher/Attack-CBC-Padding-Oracle/Challenges/Secret-Server/secretserver.py | amoniaka-knabino/Crypton | 1,175 | 11019425 | <gh_stars>1000+
import os, base64, time, random, string
from Crypto.Cipher import AES
from Crypto.Hash import *
key = os.urandom(16)
def pad(msg):
pad_length = 16-len(msg)%16
return msg+chr(pad_length)*pad_length
def unpad(msg):
return msg[:-ord(msg[-1])]
def encrypt(iv,msg):
msg = pad(msg)
ciph... |
macaw/core/retrieval/doc.py | SouvickG/macaw | 146 | 11019426 | """
The document class and some util functions useful for retrieval result list.
Authors: <NAME> (<EMAIL>)
"""
import re
import justext
class Document:
def __init__(self, id, title, text, score):
"""
A simple class representing a document for retrieval.
Args:
id(str): Do... |
mode/examples/Topics/Shaders/DomeProjection/DomeProjection.pyde | timgates42/processing.py | 1,224 | 11019436 | <reponame>timgates42/processing.py
"""
DomeProjection
This sketch uses use environmental mapping to render the output
on a full spherical dome.
Based on the FullDomeTemplate code from <NAME>:
https://github.com/mphasize/FullDome
"""
import java.nio.IntBuffer
cubemapShader = None
domeSphere = None
fbo = None
rbo = ... |
tests/test_basic_math.py | timwuu/deep-learning-from-scratch-3 | 539 | 11019439 | import unittest
import numpy as np
from dezero import Variable
from dezero.utils import gradient_check, array_equal
import dezero.functions as F
class TestAdd(unittest.TestCase):
def test_forward1(self):
x0 = np.array([1, 2, 3])
x1 = Variable(np.array([1, 2, 3]))
y = x0 + x1
res =... |
lemur/certificates/utils.py | dck25/lemur | 1,656 | 11019448 | """
Utils to parse certificate data.
.. module: lemur.certificates.hooks
:platform: Unix
:copyright: (c) 2019 by <NAME>, see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from cryptography import x509
from cryptography.hazmat.backends import defau... |
tests/extmod/ure_debug.py | sebastien-riou/micropython | 13,648 | 11019468 | # test printing debugging info when compiling
try:
import ure
ure.DEBUG
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
ure.compile("^a|b[0-9]\w$", ure.DEBUG)
|
llpython/opcode_util.py | KennethNielsen/llvmpy | 140 | 11019496 | <reponame>KennethNielsen/llvmpy<filename>llpython/opcode_util.py
# ______________________________________________________________________
import dis
import opcode
# ______________________________________________________________________
# Module data
hasjump = opcode.hasjrel + opcode.hasjabs
hascbranch = [op for op i... |
contact/tests.py | sreekanth1990/djangoproject.com | 1,440 | 11019499 | <filename>contact/tests.py
from unittest import skipIf
import requests
from django.core import mail
from django.test import TestCase
from django.test.utils import override_settings
def check_network_connection():
try:
requests.get('https://djangoproject.com')
except requests.exceptions.ConnectionErro... |
brownie/utils/output.py | x3devships/brownie | 1,595 | 11019529 | from typing import List, Optional, Sequence
def build_tree(
tree_structure: Sequence,
multiline_pad: int = 1,
pad_depth: Optional[List[int]] = None,
_indent_data: Optional[list] = None,
) -> str:
"""
Build a tree graph from a nested list.
Each item in the list if a top-level value to be a... |
ch4/lightnn/lightnn/layers/core.py | thundercrawl/book-of-qna-code | 131 | 11019538 | <reponame>thundercrawl/book-of-qna-code
# -*- encoding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from ..base import activations
from ..base.activations import Sigmoid, Identity
from ..base.initializers import xavier_unifor... |
Python3/665.py | rakhi2001/ecom7 | 854 | 11019563 | <reponame>rakhi2001/ecom7<filename>Python3/665.py
__________________________________________________________________________________________________
sample 192 ms submission
class Solution:
def checkPossibility(self, nums: List[int]) -> bool:
for i in range(len(nums) - 1):
if nums[i] > nums[i + ... |
detectron/modeling/fast_rcnn_heads.py | zkqiu/softer-NMS | 371 | 11019571 | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
RecoBTag/PerformanceDB/python/measure/Btag_btagMistagAB.py | ckamtsikis/cmssw | 852 | 11019592 | import FWCore.ParameterSet.Config as cms
BtagPerformanceESProducer_MISTAGCSVLAB = cms.ESProducer("BtagPerformanceESProducer",
# this is what it makes available
ComponentName = cms.string('MISTAGCSVLAB'),
# this is where it gets the payload from
PayloadName = cms.... |
tests/test_regex_search.py | astrapi/auracle | 261 | 11019602 | #!/usr/bin/env python
# SPDX-License-Identifier: MIT
import auracle_test
class TestRegexSearch(auracle_test.TestCase):
def testFragmentTooShort(self):
r = self.Auracle(['search', 'f'])
self.assertNotEqual(0, r.process.returncode)
self.assertIn('insufficient for searching by regular expres... |
tests/directory_tests.py | meeehow/GiftStick | 117 | 11019608 | <filename>tests/directory_tests.py
# -*- coding: utf-8 -*-
# Copyright 2018 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
#
# ... |
test/test_addresses.py | cynepiaadmin/mailer | 166 | 11019629 | <filename>test/test_addresses.py
# encoding: utf-8
"""Test the TurboMail Message class."""
from __future__ import unicode_literals
import pytest
from marrow.mailer.address import Address, AddressList, AutoConverter
from marrow.util.compat import bytes, unicode
class TestAddress(object):
def test_punycode(self):
... |
sdk/python/pulumi_azure/analysisservices/server.py | henriktao/pulumi-azure | 109 | 11019646 | # 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, Union, overload
from .. import... |
geofree/models/transformers/geogpt.py | phygitalism/geometry-free-view-synthesis | 241 | 11019726 | <gh_stars>100-1000
import torch
import time
import torch.nn.functional as F
import pytorch_lightning as pl
from torch.optim.lr_scheduler import LambdaLR
from einops import rearrange
from geofree.main import instantiate_from_config
from geofree.modules.warp.midas import Midas
def disabled_train(self, mode=True):
... |
scripts/test/run_auto_unittests.py | gonnavis/devtools-frontend | 2,389 | 11019790 | <reponame>gonnavis/devtools-frontend<filename>scripts/test/run_auto_unittests.py
#!/usr/bin/env vpython
#
# Copyright 2019 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.
"""
Run unit tests on a pinned version of chrome aft... |
sematch/application.py | dhimmel/sematch | 397 | 11019801 | <reponame>dhimmel/sematch
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2017 <NAME>- Grupo de Sistemas Inteligentes
# gzhu[at]dit.upm.es
# DIT, UPM
#
# 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... |
mitsuba-af602c6fd98a/build/config-macos10.8-gcc-x86_64.py | NTForked-ML/pbrs | 139 | 11019861 | <filename>mitsuba-af602c6fd98a/build/config-macos10.8-gcc-x86_64.py
BUILDDIR = '#build/release'
DISTDIR = '#Mitsuba.app'
CXX = 'clang++'
CC = 'clang'
CCFLAGS = ['-arch', 'x86_64', '-mmacosx-version-min=10.8', '-march=nocona', '-msse2', '-ftree-vectorize', '-funsafe-math-optimi... |
presentation-api/receiving-ua/support/stash.py | meyerweb/wpt | 14,668 | 11019868 | <filename>presentation-api/receiving-ua/support/stash.py
def main(request, response):
key = request.GET.first(b"id")
if request.method == u"POST":
request.server.stash.put(key, request.body)
return b"ok"
else:
value = request.server.stash.take(key)
assert request.server.stas... |
tests/highlander_tests.py | chriscannon/highlander | 255 | 11019879 | from os import unlink, mkdir
from tempfile import mkstemp, mkdtemp
from unittest import TestCase, TestLoader, TestSuite, TextTestRunner
from os.path import isfile, realpath, join, isdir
from shutil import rmtree
from psutil import Process
from highlander import InvalidPidFileError, PidFileExistsError
from highlander.... |
examples/flow_2d.py | tonyduan/hybrid-models | 238 | 11019894 | import numpy as np
import itertools
import logging
import matplotlib.pyplot as plt
import torch
import torch.optim as optim
import torch.nn.functional as F
from argparse import ArgumentParser
from torch.distributions import MultivariateNormal
from nf.flows import *
from nf.models import NormalizingFlowModel
def gen... |
tests/test_vmtkScripts/test_vmtkmarchingcubes.py | michelebucelli/vmtk | 217 | 11019901 | <filename>tests/test_vmtkScripts/test_vmtkmarchingcubes.py
## Program: VMTK
## Language: Python
## Date: January 10, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## t... |
scripts/west_commands/zspdx/walker.py | lviala-zaack/zephyr | 6,224 | 11019902 | # Copyright (c) 2020-2021 The Linux Foundation
#
# SPDX-License-Identifier: Apache-2.0
import os
from west import log
from west.util import west_topdir, WestNotFound
from zspdx.cmakecache import parseCMakeCacheFile
from zspdx.cmakefileapijson import parseReply
from zspdx.datatypes import DocumentConfig, Document, Fi... |
redbot/message/headers/accept_ranges.py | Malvoz/redbot | 167 | 11019905 | <reponame>Malvoz/redbot
#!/usr/bin/env python
from redbot.message import headers
from redbot.speak import Note, categories, levels
from redbot.syntax import rfc7233
from redbot.type import AddNoteMethodType
class accept_ranges(headers.HttpHeader):
canonical_name = "Accept-Ranges"
description = """\
The `Acce... |
src/beanmachine/ppl/compiler/tests/bmg_types_test.py | feynmanliang/beanmachine | 177 | 11019906 | <reponame>feynmanliang/beanmachine
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Tests for bmg_types.py"""
import unittest
from beanmachine.ppl.compiler.bm_graph_builder import BMGra... |
ml-agents/mlagents/envs/communicator_objects/engine_configuration_proto_pb2.py | icaro56/ml-agents | 134 | 11019916 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mlagents/envs/communicator_objects/engine_configuration_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _me... |
Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py | ckamtsikis/cmssw | 852 | 11019920 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
process = cms.Process("EcalGeometryTest",Run3_dd4hep)
process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff')
process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff... |
sdk/python/v1beta1/kubeflow/katib/models/v1beta1_early_stopping_rule.py | alexeykaplin/katib | 1,177 | 11019922 | <reponame>alexeykaplin/katib
# coding: utf-8
"""
Katib
Swagger description for Katib # noqa: E501
The version of the OpenAPI document: v1beta1-0.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubeflow.katib.configuration import Configurat... |
lib/setup.py | wjbKimberly/DetectAndTrack-wjb | 1,007 | 11019927 | ##############################################################
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################
# Co... |
weakref_tutorial.py | NightmareQAQ/python-notes | 106 | 11019970 | # ref.
# https://docs.python.org/3/library/weakref.html#finalizer-objects
# https://docs.python.org/3/library/weakref.html#module-weakref
# A primary use for weak references is to implement caches or mappings holding large objects,
# where it’s desired that a large object not be kept alive solely
# because it appears ... |
pyncm/apis/miniprograms/radio.py | asdMild/pyncm | 133 | 11019997 | '''私人FM - Raido APIs'''
from . import EapiCryptoRequest
from .. import LoginRequiredApi
@EapiCryptoRequest
@LoginRequiredApi
def GetMoreRaidoContent(limit=3,e_r=True):
'''PC 端 - 拉取更多FM内容
Args:
limit (int, optional): 获取数目. Defaults to 3.
e_r (bool, optional): 暂存. Defaults to True.
Ret... |
examples/bench/fib.py | htsign/kinx | 241 | 11020001 |
def fib(n):
if n < 3:
return n
return fib(n-2) + fib(n-1)
print fib(34)
|
bot/exts/holidays/valentines/savethedate.py | hedyhli/pydis-lance | 122 | 11020017 | <reponame>hedyhli/pydis-lance
import logging
import random
from json import loads
from pathlib import Path
import discord
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Colours
log = logging.getLogger(__name__)
HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sp... |
orders/app/api_v1/orders.py | ehsangolshani/test | 188 | 11020035 | from flask import request
from . import api
from .. import db
from ..models import Order, Customer
from ..decorators import json, paginate
@api.route('/orders/', methods=['GET'])
@json
@paginate('orders')
def get_orders():
return Order.query
@api.route('/customers/<int:id>/orders/', methods=['GET'])
@json
@pagin... |
ensemble_dist.py | chrisbyd/AICITY2020_DMT_VehicleReID | 181 | 11020037 | <reponame>chrisbyd/AICITY2020_DMT_VehicleReID
import numpy as np
import os
base_dir = '/data/model/'
distmat = np.load(base_dir + '0402_6/dist_mat.npy')
distmat += np.load(base_dir + '0407_1/dist_mat.npy')
distmat += np.load(base_dir + '0408_6/dist_mat.npy')
distmat += np.load(base_dir + '0409_2/dist_mat.npy')
dist... |
tests/test_minimizers.py | pckroon/symfit | 192 | 11020041 | <reponame>pckroon/symfit<filename>tests/test_minimizers.py
# SPDX-FileCopyrightText: 2014-2020 <NAME>
#
# SPDX-License-Identifier: MIT
from __future__ import division, print_function
import pytest
import warnings
import numpy as np
import pickle
import multiprocessing as mp
from symfit import (
Variable, Paramet... |
tools/tpm2_pkcs11/pkcs11t.py | calderonth/tpm2-pkcs11 | 155 | 11020045 | <gh_stars>100-1000
# SPDX-License-Identifier: BSD-2-Clause
# These CK* values come from the PKCS#11 spec
CKO_CERTIFICATE = 0x1
CKO_PUBLIC_KEY = 0x2
CKO_PRIVATE_KEY = 0x3
CKO_SECRET_KEY = 0x4
CKK_RSA = 0x0
CKK_EC = 0x3
CKK_GENERIC_SECRET = 0x10
CKK_AES = 0x1f
CKK_SHA_1_HMAC = 0x28
CKK_SHA256_HMAC=0x2b
CKK_SHA384_HMAC=... |
bmtk/simulator/bionet/default_setters/synaptic_weights.py | GregGlickert/bmtk | 216 | 11020069 | # Copyright 2017. <NAME>. All rights reserved
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# dis... |
dataloaders/voxceleb2_segm.py | lichnost/latent-pose-reenactment | 103 | 11020094 | <reponame>lichnost/latent-pose-reenactment
import torch
import torch.utils.data
import numpy as np
from .common import voxceleb, augmentation
from pathlib import Path
import cv2
import logging
logger = logging.getLogger('dataloader')
class Dataset:
@staticmethod
def get_args(parser):
parser.add('--da... |
tests/test_sparkle.py | trathborne/nvchecker | 320 | 11020100 | <reponame>trathborne/nvchecker
# MIT licensed
# Copyright (c) 2020 lilydjwg <<EMAIL>>, et al.
# Copyright (c) 2020 Sunlei <<EMAIL>>
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_sparkle(get_version):
assert await get_version("example", {
"source": "sparkle",
... |
segmentation/libs/models/deeplabv1.py | LvJC/CONTA | 121 | 11020159 | <reponame>LvJC/CONTA<gh_stars>100-1000
#!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import _ResLayer, _Stem
class DeepLabV1(nn.Sequential):
"""
DeepLab v1: Dilated ResNet + 1x1 Con... |
boto3_type_annotations/boto3_type_annotations/firehose/client.py | cowboygneox/boto3_type_annotations | 119 | 11020169 | <gh_stars>100-1000
from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
def can_paginate(self, operation_name: str = None):
... |
descarteslabs/client/services/raster/geotiff_utils.py | descarteslabs/descarteslabs-python | 167 | 11020172 | <reponame>descarteslabs/descarteslabs-python
from typing import List, Tuple, Union
from enum import Enum
import numpy as np
from affine import Affine
from tifffile import TiffWriter
##############################################################################
# GeoTiff Tags
##########################################... |
sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_constants.py | rsdoherty/azure-sdk-for-python | 2,728 | 11020189 | # ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from enum im... |
aicsimageio/exceptions.py | brisvag/aicsimageio | 110 | 11020201 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
class ConflictingArgumentsError(Exception):
"""
This exception is returned when 2 arguments to the same function are in conflict.
"""
class InvalidDimensionOrderingError(Exception):
"""
A general except... |
luminoth/tools/dataset/readers/object_detection/__init__.py | jsdussanc/luminoth | 2,584 | 11020218 | from .object_detection_reader import ObjectDetectionReader # noqa
from .coco import COCOReader # noqa
from .csv_reader import CSVReader # noqa
from .flat_reader import FlatReader # noqa
from .imagenet import ImageNetReader # noqa
from .openimages import OpenImagesReader # noqa
from .pascalvoc import PascalVOCRea... |
ckan/migration/versions/091_0ffc0b277141_group_extra_group_id_index.py | ziveo/ckan | 2,805 | 11020240 | # encoding: utf-8
"""group_extra group_id index
Revision ID: 0ffc0b277141
Revises: <KEY>
Create Date: 2019-09-11 12:16:42.792661
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = u'<KEY>'
down_revision = u'<KEY>'
branch_labels = None
depends_on = None
def upgrade():
op.create_ind... |
plugins/jira/setup.py | sainivinit/alerta-contrib | 114 | 11020248 | <gh_stars>100-1000
from setuptools import setup, find_packages
version = '1.0.0'
setup(
name="alerta-jira",
version=version,
description='Alerta plugin for create tasks in jira',
url='https://github.com/alerta/alerta-contrib',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
pac... |
color_extractor/resize.py | hcoura/color-extractor | 276 | 11020283 | <gh_stars>100-1000
import numpy as np
from skimage.transform import resize
from .task import Task
class Resize(Task):
"""
Resizes and crops given images to the specified shape. As most fashion
have the subject centered, cropping may help reducing the background
and help discarding background from for... |
fetch/fetch.py | AndydeCleyre/fetch | 194 | 11020317 | <filename>fetch/fetch.py<gh_stars>100-1000
#!/usr/bin/env python3
import argparse
from fetch import info
import sys
parser = argparse.ArgumentParser()
parser.add_argument("-s","--search",help="Search any topic")
parser.add_argument("-i","--info",help="Get info on any topic(Use correct name)")
parser.add_argument("-q",... |
src/platform/coldfusion/deployers/lfi_stager.py | 0x27/clusterd | 539 | 11020344 | from src.platform.coldfusion.interfaces import CINTERFACES
from src.module.deploy_utils import parse_war_path, _serve, waitServe, killServe
from threading import Thread
from base64 import b64encode
from os.path import abspath
from urllib import quote_plus
from requests import get
from log import LOG
import state
import... |
SimGeneral/MixingModule/python/HiMixNoPU_cff.py | ckamtsikis/cmssw | 852 | 11020501 | import FWCore.ParameterSet.Config as cms
# this is a minimum configuration of the Mixing module,
# to run it in the zero-pileup mode
#
from SimGeneral.MixingModule.mixNoPU_cfi import *
mix.mixObjects.mixHepMC.makeCrossingFrame = True
|
python/ql/test/query-tests/Imports/cyclic-module/module8.py | vadi2/codeql | 4,036 | 11020529 | <reponame>vadi2/codeql
import module1
class Foo(object):
a = module1.a1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.