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 |
|---|---|---|---|---|---|---|---|---|---|---|
pyppeteer/target.py | Sab0tag3d/pyppeteer | 3,747 | 3219468 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Target module."""
import asyncio
from typing import Any, Callable, Coroutine, Dict, List, Optional
from typing import TYPE_CHECKING
from pyppeteer.connection import CDPSession
from pyppeteer.page import Page
if TYPE_CHECKING:
from pyppeteer.browser import Browse... | 9 | 11 | 0 | 1 | 21 | 0 |
dashboard/dashboard/migrate_test_names_test.py | Martijnve23/catapult | 1,894 | 3219469 | # Copyright 2015 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
import webapp2
import webtest
... | 3 | 0 | 0 | 0 | 3 | 0 |
python/ql/test/experimental/query-tests/Security/CWE-091/xslt.py | vadi2/codeql | 4,036 | 3219473 | from lxml import etree
from io import StringIO
from flask import Flask, request
app = Flask(__name__)
@app.route("/xslt")
def bad():
xsltQuery = request.args.get('xml', '')
xslt_root = etree.XML(xsltQuery)
f = StringIO('<foo><bar></bar></foo>')
tree = etree.parse(f)
result_tree = tree.xslt(xslt_r... | 0 | 0 | 0 | 0 | 0 | 0 |
src/transformers/models/mt5/modeling_tf_mt5.py | ArneBinder/transformers | 309 | 3219493 | # coding=utf-8
# Copyright 2020 Mesh TensorFlow authors, T5 Authors and HuggingFace Inc. team.
#
# 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 | 3 | 0 | 3 | 0 |
codigo_das_aulas/aula_11/aula_11_08.py | VeirichR/curso-python-selenium | 234 | 3219511 | from selenium.webdriver import Firefox
browser = Firefox()
browser.get('http://selenium.dunossauro.live/aula_11_c')
print(f'Janelas: {len(browser.window_handles)}')
browser.find_element_by_tag_name('button').click()
print(f'Janelas: {len(browser.window_handles)}')
| 0 | 0 | 0 | 0 | 0 | 0 |
Src/StdLib/Lib/site-packages/win32comext/axscript/test/leakTest.py | cwensley/ironpython2 | 1,078 | 3219514 | import sys
from win32com.axscript.server.error import Exception
from win32com.axscript import axscript
from win32com.axscript.server import axsite
import pythoncom
from win32com.server import util, connect
import win32com.server.policy
class MySite(axsite.AXSite):
def OnScriptError(self, error):
exc = error.Get... | 0 | 0 | 0 | 0 | 0 | 0 |
installer/common/file_utils.py | farazmd/microk8s | 6,286 | 3219525 | <gh_stars>1000+
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2019 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is... | 0 | 0 | 0 | 0 | 0 | 0 |
speechbrain/alignment/__init__.py | JasonSWFu/speechbrain | 3,913 | 3219527 | <reponame>JasonSWFu/speechbrain
"""Tools for aligning transcripts and speech signals
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
recipes/calceph/all/conanfile.py | rockandsalt/conan-center-index | 562 | 3219549 | from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
from contextlib import contextmanager
import os
required_conan_version = ">=1.33.0"
class CalcephConan(ConanFile):
name: str = "calceph"
description = "C Library de... | 0 | 4 | 10 | 0 | 14 | 0 |
helperfns.py | charlesincharge/DeepKoopman | 199 | 3219579 | import datetime
import pickle
import time
import numpy as np
import tensorflow as tf
def stack_data(data, num_shifts, len_time) -> object:
"""Stack data from a 2D array into a 3D array.
Arguments:
data -- 2D data array to be reshaped
num_shifts -- number of shifts (time steps) t... | 0 | 4 | 0 | 0 | 4 | 0 |
alg/asac/Data_Generation_Y.py | loramf/mlforhealthlabpub | 171 | 3219599 | # -*- coding: utf-8 -*-
import numpy as np
#%% Corresponding Y generation
def Syn_Generation_Y1(X, W, sigma) -> object:
# No of samples
n = len(X)
t = len(X[0][:,0])
# Initialization
Output_Y = list()
for i in range(n):
Temp_X = X[i]
Temp_Y = np.zeros([t,])
... | 0 | 3 | 0 | 0 | 3 | 0 |
prml/nn/optimizer/gradient.py | jinmang2/PRML | 11,017 | 3219632 | <filename>prml/nn/optimizer/gradient.py<gh_stars>1000+
from prml.nn.optimizer.optimizer import Optimizer
class Gradient(Optimizer):
def __init__(self, parameter, learning_rate=1e-3):
super().__init__(parameter, learning_rate)
def update(self):
for param in self.parameter.values():
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_all.py | nondejus/crypto-detector | 109 | 3219633 | from __future__ import annotations
"""
Copyright (c) 2017 Wind River Systems, 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 b... | 4 | 5 | 1 | 0 | 10 | 0 |
tests/components/deconz/test_siren.py | liangleslie/core | 30,023 | 3219643 | """deCONZ switch platform tests."""
from unittest.mock import patch
from homeassistant.components.siren import ATTR_DURATION, DOMAIN as SIREN_DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
STATE_UNAVAILABLE,
)
from .test_gatewa... | 0 | 0 | 0 | 0 | 0 | 0 |
src/Gon/ifengspyder.py | majiajue/Listed-company-news-crawl-and-text-analysis | 635 | 3219651 | """
凤凰财经网:https://finance.ifeng.com
上市公司:https://finance.ifeng.com/shanklist/1-62-83-
大盘评述:https://finance.ifeng.com/shanklist/1-62-85-
证券要闻:https://finance.ifeng.com/shanklist/1-62-84-
""" | 0 | 0 | 0 | 0 | 0 | 0 |
refinery/bnpy/bnpy-dev/bnpy/learnalg/__init__.py | csa0001/Refinery | 103 | 3219662 | """
The:mod:`learnalg' module provides standard learning algorithms such as EM and VB (Variational Bayes)
"""
from .LearnAlg import LearnAlg
from .VBLearnAlg import VBLearnAlg
from .StochasticOnlineVBLearnAlg import StochasticOnlineVBLearnAlg
from .MemoizedOnlineVBLearnAlg import MemoizedOnlineVBLearnAlg
import MergeMo... | 0 | 0 | 0 | 0 | 0 | 0 |
awx/main/migrations/0063_v350_org_host_limits.py | bhyunki/awx | 11,396 | 3219686 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-02-15 20:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('main', '0062_v350_new_playbook_stats'),
]
operations: list[... | 0 | 0 | 2 | 0 | 2 | 0 |
bot/exts/holidays/valentines/pickuplines.py | hedyhli/pydis-lance | 122 | 3219699 | 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__)
PICKUP_LINES = loads(Path("bot/resources/holidays/valentines/pickup_lines.json").read_text("utf8"))... | 2 | 2 | 0 | 0 | 4 | 0 |
callbacks_model.py | tucan9389/mobile-pose-estimation-for-TF2 | 122 | 3219714 | <reponame>tucan9389/mobile-pose-estimation-for-TF2
# Copyright 2019 <NAME> (<EMAIL>)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/classicalartmemes/app.py | mainyordle/reddit2telegram | 187 | 3219742 | #encoding:utf-8
subreddit = 'trippinthroughtime'
t_channel = '@classicalartmemes'
def send_post(submission, r2t) -> object:
return r2t.send_simple(submission, img=True)
| 0 | 1 | 0 | 0 | 1 | 0 |
ForgeGit/forgegit/tests/test_git_app.py | rohankumardubey/allura | 113 | 3219753 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | 0 | 0 | 0 | 0 | 0 | 0 |
GetStarted/05_map_function.py | monocilindro/qgis-earthengine-examples | 646 | 3219758 | import ee
from ee_plugin import Map
# This function gets NDVI from Landsat 8 imagery.
def addNDVI(image) -> object:
return image.addBands(image.normalizedDifference(['B5', 'B4']))
# Load the Landsat 8 raw data, filter by location and date.
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1') \
.filterBou... | 0 | 1 | 0 | 0 | 1 | 0 |
model/__init__.py | eugenelet/Meta-rPPG | 102 | 3219759 | """This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: ... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter01/c1_19_flatten_function.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 3219771 | # -*- coding: utf-8 -*-
"""
Name : c1_19_flatten_function.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import numpy as np
#
x=np.array([[1,2],[5,6],[7,9]]) # a 3 by 2 array
print(x)
y=x.... | 0 | 0 | 0 | 0 | 0 | 0 |
firefly/dbentrust/memobject.py | genghaolove/firefly | 675 | 3219778 | <filename>firefly/dbentrust/memobject.py
#coding:utf8
'''
Created on 2012-7-10
memcached 关系对象
通过key键的名称前缀来建立
各个key-value 直接的关系
@author: lan (www.9miao.com)
'''
class MemObject:
'''memcached 关系对象
'''
def __init__(self,name,mc):
'''
@param name: str 对象的名称
@param _lock: int 对象锁 为... | 0 | 0 | 0 | 0 | 0 | 0 |
mozillians/common/__init__.py | divyamoncy/mozillians | 202 | 3219793 | default_app_config = 'mozillians.common.apps.CommonConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
conans/server/service/common/common.py | matthiasng/conan | 6,205 | 3219824 | <reponame>matthiasng/conan<gh_stars>1000+
from conans import DEFAULT_REVISION_V1
from conans.model.ref import PackageReference
class CommonService(object):
def _get_latest_pref(self, pref):
ref = self._get_latest_ref(pref.ref)
pref = PackageReference(ref, pref.id)
tmp = self._server_store... | 0 | 0 | 0 | 0 | 0 | 0 |
pants-plugins/grapl_setup_py/grapl_setupargs.py | msilvey/grapl | 313 | 3219837 | import logging
from pants.backend.python.goals.setup_py import SetupKwargs, SetupKwargsRequest
from pants.engine.fs import DigestContents, GlobMatchErrorBehavior, PathGlobs
from pants.engine.rules import Get, collect_rules, rule
from pants.engine.target import Target
from pants.engine.unions import UnionRule
logger =... | 2 | 3 | 0 | 0 | 5 | 0 |
tutorials/05_coarse_to_fine_estimation.py | aferrall/redner | 1,146 | 3219846 | import pyredner
import torch
import scipy
import scipy.ndimage
import numpy as np
# Joint material & camera pose estimation with global illumination
# using coarse to fine estimation
# This time we will learn the following through a Cornell box example.
# - Loading from a Mitsuba scene file
# - Global illumination an... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/links_tests/readout_tests/test_general_readout.py | pfnet/chainerchem | 184 | 3219866 | from chainer import cuda
from chainer import functions
from chainer import gradient_check
import numpy
import pytest
from chainer_chemistry.config import MAX_ATOMIC_NUM
from chainer_chemistry.links.readout.general_readout import GeneralReadout
from chainer_chemistry.utils.permutation import permute_node
atom_size = 5... | 0 | 2 | 0 | 0 | 2 | 0 |
ttp/group/contains.py | showipintbri/ttp | 254 | 3219883 | <gh_stars>100-1000
def contains(data, *args):
# args = ('v4address', 'v4mask',)
for var in args:
if var in data:
if var in _ttp_["results_object"].record["DEFAULTS"]:
if _ttp_["results_object"].record["DEFAULTS"][var] == data[var]:
return data, False
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/legacy/test_api_with_blueprint.py | OpenTechStrategies/flask-restplus-csrf | 2,885 | 3219912 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import flask
from flask import Blueprint, request
import flask_restplus as restplus
# Add a dummy Resource to verify that the app is properly set.
class HelloWorld(restplus.Resource):
def get(self) -> dict[object,object]:
return {}
class... | 0 | 3 | 0 | 0 | 3 | 0 |
torchsat_imc/cli/calcuate_mean_std.py | Exdenta/torchsat | 316 | 3219929 | <gh_stars>100-1000
import argparse
import os
import random
from glob import glob
from pathlib import Path
import click
import numpy as np
import tifffile
from PIL import Image
from tqdm import tqdm
def img_loader(fp):
if Path(fp).suffix.lower() in [".jpg", ".jpeg", ".png"]:
arr = np.array(Image.open(fp))... | 0 | 0 | 0 | 0 | 0 | 0 |
python/oneflow/compatible/single_client/data.py | wangyuyue/oneflow | 3,285 | 3219944 | <reponame>wangyuyue/oneflow<filename>python/oneflow/compatible/single_client/data.py<gh_stars>1000+
"""
Copyright 2020 The OneFlow 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_bijections.py | jejjohnson/jax-flows | 198 | 3219961 | <reponame>jejjohnson/jax-flows<filename>tests/test_bijections.py<gh_stars>100-1000
import unittest
import jax.numpy as np
from jax import random
from jax.experimental import stax
import flows
def is_bijective(
test, init_fun, inputs=random.uniform(random.PRNGKey(0), (20, 4), minval=-10.0, maxval=10.0), tol=1e-3... | 0 | 0 | 0 | 0 | 0 | 0 |
test/local/test_local_functional.py | thunder-project/bolt | 178 | 3219999 | <reponame>thunder-project/bolt
from numpy import arange, repeat
from bolt import array
from bolt.utils import allclose
import generic
def test_map():
import random
random.seed(42)
x = arange(2*3*4).reshape(2, 3, 4)
b = array(x)
# Test all generic map functionality
generic.map_suite(x, b)
... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/catapult/telemetry/telemetry/core/exceptions.py | zipated/src | 2,151 | 3220015 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import annotations
import logging
import sys
class Error(Exception):
"""Base class for Telemetry exceptions."""
def __init__(self, msg:... | 9 | 6 | 0 | 6 | 21 | 0 |
bigtop-packages/src/charm/hadoop/layer-hadoop-plugin/reactive/apache_bigtop_plugin.py | sekikn2/bigtop | 371 | 3220018 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/conduit/python/t_python_conduit_node.py | francois-kitware/conduit | 120 | 3220045 | # Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Conduit.
"""
file: t_python_conduit_node.py
description: Unit tests for conduit::Node python m... | 0 | 0 | 0 | 0 | 0 | 0 |
mapproxy/service/wmts.py | cunha17/mapproxy | 347 | 3220051 | # This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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... | 11 | 19 | 6 | 2 | 38 | 0 |
mmdet/core/bbox/geometry.py | ar90n/ttfnet | 483 | 3220052 | import torch
def bbox_overlaps(bboxes1, bboxes2, mode: str='iou', is_aligned: bool=False) -> object:
"""Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes... | 3 | 2 | 0 | 0 | 5 | 0 |
PyInstaller/hooks/rthooks/pyi_rth_gdkpixbuf.py | hawkhai/pyinstaller | 9,267 | 3220059 | #-----------------------------------------------------------------------------
# Copyright (c) 2015-2021, PyInstaller Development Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# The full license is in the file COPYING.txt, ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/_cffi_src/build_padding.py | balabit-deps/balabit-os-6-python-cryptography | 333 | 3220071 | <filename>src/_cffi_src/build_padding.py
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import os
from _cffi_src.utils ... | 0 | 0 | 0 | 0 | 0 | 0 |
autosklearn/data/xy_data_manager.py | Louquinze/auto-sklearn | 6,390 | 3220074 | # -*- encoding: utf-8 -*-
from typing import Dict, Optional, Union, cast
import numpy as np
import pandas as pd
from scipy import sparse
from autosklearn.constants import (
BINARY_CLASSIFICATION,
MULTICLASS_CLASSIFICATION,
MULTILABEL_CLASSIFICATION,
MULTIOUTPUT_REGRESSION,
REGRESSION,
)
from aut... | 7 | 0 | 0 | 0 | 7 | 0 |
recipes/Python/414200_MetropolisHastings_Sampler/recipe-414200.py | tdiprima/code | 2,023 | 3220089 | <filename>recipes/Python/414200_MetropolisHastings_Sampler/recipe-414200.py
#!/usr/bin/env python
# Author: <NAME>
# License: GPL
from math import *
from RandomArray import *
from matplotlib.pylab import *
def sdnorm(z):
"""
Standard normal pdf (Probability Density Function)
"""
return exp(-z... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/geodata/neighborhoods/reverse_geocode.py | Fillr/libpostal | 3,489 | 3220101 | <filename>scripts/geodata/neighborhoods/reverse_geocode.py
# -*- coding: utf-8 -*-
import argparse
import logging
import operator
import os
import re
import six
import subprocess
import sys
import yaml
this_dir = os.path.realpath(os.path.dirname(__file__))
sys.path.append(os.path.realpath(os.path.join(os.pardir, os.pa... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ray/serve/batching.py | 77loopin/ray | 21,382 | 3220108 | <filename>python/ray/serve/batching.py
import asyncio
from functools import wraps
from inspect import iscoroutinefunction
import time
from typing import Any, Callable, List, Optional, overload, Tuple, TypeVar
from ray.serve.exceptions import RayServeException
class _BatchQueue:
def __init__(self,
... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/tree/traversal/__init__.py | Heart-throb-Rajnish/algorithms | 22,426 | 3220141 | <reponame>Heart-throb-Rajnish/algorithms<filename>algorithms/tree/traversal/__init__.py<gh_stars>1000+
from .preorder import *
from .postorder import *
from .inorder import *
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/utilities/font.py | zarumaru/codeface | 6,402 | 3220142 | DEFAULT_SIZE = "14"
font_list = [
["Input Mono", {'size': DEFAULT_SIZE, 'filename': 'input-mono'}],
["Envy Code R", {'size': DEFAULT_SIZE, 'filename': 'envy-code-r'}],
["Klartext Mono", {'size': DEFAULT_SIZE, 'filename': 'klartext-mono'}],
["Monofonto", {'size': DEFAULT_SIZE, 'filename': 'monofonto'}],... | 0 | 0 | 0 | 0 | 0 | 0 |
pollbot/telegram/filters.py | shubham-king/poll | 112 | 3220143 | <reponame>shubham-king/poll
from typing import cast
from telegram import Poll as NativePoll
from telegram.ext import MessageFilter
class _Quiz(MessageFilter):
name = "Filters.quiz"
def filter(self, message):
return (
bool(message.poll)
and cast(NativePoll, message.poll).type ... | 0 | 0 | 0 | 0 | 0 | 0 |
pysrc/hashlin.py | CrackerCat/xed | 1,261 | 3220163 | #!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2019 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 | 8 | 0 | 0 | 10 | 0 |
libs/colorDialog.py | PaKyong/labelImg | 535 | 3220179 | <gh_stars>100-1000
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QColorDialog, QDialogButtonBox
except ImportError:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
BB = QDialogButtonBox
class ColorDialog(QColorDialog):
def __init__(self, parent=No... | 0 | 0 | 0 | 0 | 0 | 0 |
other/Imaging-1.1.7/build/lib.macosx-10.7-intel-2.7/TarIO.py | dguo/headlines | 112 | 3220188 | <gh_stars>100-1000
#
# The Python Imaging Library.
# $Id$
#
# read files from within a tar file
#
# History:
# 95-06-18 fl Created
# 96-05-28 fl Open files in binary mode
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) <NAME> 1995-96.
#
# See the README file for information on usage and redistribution.
#
im... | 0 | 0 | 0 | 0 | 0 | 0 |
data/rand.py | luozhengrong/BraTS-DMFNet | 159 | 3220189 | <gh_stars>100-1000
import random
class Uniform(object):
def __init__(self, a, b):
self.a = a
self.b = b
def sample(self):
return random.uniform(self.a, self.b)
class Gaussian(object):
def __init__(self, mean, std):
self.mean = mean
self.std = std
... | 0 | 0 | 0 | 0 | 0 | 0 |
tutel/experts/ffn.py | microsoft/tutel | 156 | 3220198 | <filename>tutel/experts/ffn.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
from ..net import zero_gather
class FusedExpertsNetwork(torch.nn.Module):
def __init__(self, hidden_size_per_expert, activation_fn=None, activation_fn_with_self=None, output_dim=None):
supe... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/scripts/test081-totp.py | LibreZimbra/zm-openldap | 336 | 3220199 | <reponame>LibreZimbra/zm-openldap<filename>tests/scripts/test081-totp.py
# -*- coding: utf-8 -*-
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2016-2021 <NAME>, Symas Corp.
## Copyright 2021 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and us... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_compiler/test_flags.py | mananpal1997/cinder | 1,886 | 3220203 | <reponame>mananpal1997/cinder
import __future__
import ast
import dis
import sys
import unittest
from compiler.consts import (
CO_ASYNC_GENERATOR,
CO_COROUTINE,
CO_GENERATOR,
CO_NESTED,
CO_NEWLOCALS,
CO_NOFREE,
CO_OPTIMIZED,
)
from dis import opmap, opname
from unittest import TestCase
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
egs/wham/FilterbankDesign/train.py | ldelebec/asteroid | 722 | 3220213 | <reponame>ldelebec/asteroid<gh_stars>100-1000
import os
import argparse
import torch
from torch.utils.data import DataLoader
from asteroid.data.wham_dataset import WhamDataset
from asteroid.engine.system import System
from asteroid.losses import PITLossWrapper, pairwise_neg_sisdr
from model import make_model_and_optim... | 0 | 0 | 0 | 0 | 0 | 0 |
models/official/detection/serving/segmentation.py | GerinTang/tpu | 5,098 | 3220214 | # Lint as: python2, 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
#
... | 0 | 3 | 0 | 0 | 3 | 0 |
VisualBERT/tests/models/test_mmf_transformer.py | Fostereee/Transformer-MM-Explainability | 322 | 3220223 | <reponame>Fostereee/Transformer-MM-Explainability
# Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import tests.test_utils as test_utils
from VisualBERT.mmf.utils.build import build_model
from VisualBERT.mmf.utils.configuration import Configuration
from VisualBERT.mmf.utils.env import setup_imports
... | 0 | 0 | 0 | 0 | 0 | 0 |
specutils/io/default_loaders/galah.py | havok2063/specutils | 118 | 3220242 | from specutils import SpectrumList
from specutils.io.registers import data_loader
from .dc_common import FITS_FILE_EXTS, SINGLE_SPLIT_LABEL
from ..parsing_utils import read_fileobj_or_hdulist
GALAH_5EXT_CONFIG = {
"hdus": {
"0": {
"purpose": "science",
"units": {"flux_unit": "count... | 0 | 2 | 0 | 0 | 2 | 0 |
rocketchat_API/APISections/channels.py | dudanogueira/rocketchat_API | 210 | 3220252 | from __future__ import annotations
import json
from rocketchat_API.APIExceptions.RocketExceptions import RocketMissingParamException
from rocketchat_API.APISections.base import RocketChatBase
class RocketChatChannels(RocketChatBase):
def channels_list(self, **kwargs) -> object:
"""Retrieves all of the ch... | 16 | 37 | 0 | 0 | 53 | 0 |
containerregistry/client/v2_2/docker_session_.py | suomitekai/fairing | 334 | 3220253 | # 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 required by applicable law or ag... | 5 | 16 | 0 | 0 | 21 | 0 |
Plugins/Aspose_Words_Java_for_Jython/asposewords/programming_documents/ExtractContent.py | freedomloveme/Aspose.Words-for-Java | 274 | 3220258 | <reponame>freedomloveme/Aspose.Words-for-Java
from asposewords import Settings
from com.aspose.words import Document
from com.aspose.words import NodeType
from com.aspose.words import NodeImporter
from com.aspose.words import ImportFormatMode
from com.aspose.words import SaveFormat
from com.aspose.words import Document... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | priamai/soc-faker | 122 | 3220281 | from setuptools import setup, find_packages
import os
def parse_requirements(requirement_file) -> object:
with open(requirement_file) as f:
return f.readlines()
setup(
name='soc-faker',
version='4.0.0',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='A Python pa... | 0 | 1 | 0 | 0 | 1 | 0 |
tensorflow/contrib/data/python/ops/unique.py | PaulWang1905/tensorflow | 848 | 3220293 | # Copyright 2017 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 required by applica... | 0 | 1 | 0 | 0 | 1 | 0 |
test/toolset_defaults.py | loongson-zn/build | 215 | 3220296 | #!/usr/bin/python
# Copyright 2018 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Test the handling of toolset.add-defaults
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0, ignore_toolset_requirements=False... | 0 | 0 | 0 | 0 | 0 | 0 |
send2trash/plat_win.py | thecodechef/sublime-sidebar-enhancements-extended | 1,225 | 3220304 | <gh_stars>1000+
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from ctypes import windll... | 0 | 0 | 0 | 0 | 0 | 0 |
bin_mean_shift.py | loicmagne/PlanarReconstruction | 327 | 3220317 | <filename>bin_mean_shift.py<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class Bin_Mean_Shift(nn.Module):
def __init__(self, train_iter=5, test_iter=10, bandwidth=0.5, device='cpu'):
super(Bin_Mean_Shift, self).__init__()
self.train_iter =... | 0 | 0 | 0 | 0 | 0 | 0 |
pts/model/transformer/transformer_network.py | nitinthedreamer/pytorch-ts | 647 | 3220325 | <reponame>nitinthedreamer/pytorch-ts
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from gluonts.core.component import validated
from gluonts.torch.modules.distribution_output import DistributionOutput
from pts.modules import MeanScaler, NOPScaler, FeatureEmbedder
def prod(xs):
p = ... | 0 | 0 | 0 | 0 | 0 | 0 |
melt/voxelizer.py | xuhao1/taichi_three | 152 | 3220326 | <filename>melt/voxelizer.py
from tina.advans import *
@ti.func
def inside(p, a, b, c):
u = (a - p).cross(b - p)
v = (b - p).cross(c - p)
w = (c - p).cross(a - p)
ccw = u >= 0 and v >= 0 and w >= 0
cw = u <= 0 and v <= 0 and w <= 0
return ccw or cw
@ti.data_oriented
class MeshVoxelizer:
d... | 0 | 0 | 0 | 0 | 0 | 0 |
chroot-etc/xbmc-cycle.py | drinkcat/chroagh | 229 | 3220333 | #!/usr/bin/env python
# Copyright (c) 2014 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Python script to call croutoncycle. This is needed to let the
# hotkeys ctr-shift-alt F1/F2 work when xbmc is in fullscreen.
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
arcade/examples/sprite_moving_platforms.py | janscas/arcade | 824 | 3220368 | <gh_stars>100-1000
"""
Sprite with Moving Platforms
Artwork from https://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_moving_platforms
"""
import arcade
from pyglet.math import Vec2
SPRITE_SCALING = 0.5
SCREEN_WIDTH = 1000
SCREEN_... | 0 | 0 | 0 | 0 | 0 | 0 |
mmflow/ops/warp.py | hologerry/mmflow | 481 | 3220405 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from .builder import OPERATORS
def coords_grid(flow: Tensor) -> Tensor:
"""Generate shifted coordinate grid based based input flow.
Args:
flow (Tensor): Estimat... | 7 | 4 | 0 | 0 | 11 | 0 |
python/depthcharge/register/fdt.py | justinforbes/depthcharge | 133 | 3220420 | # SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
Implements FDTCrashRegisterReader
"""
from ..operation import Operation
from .data_abort import DataAbortRegisterReader
class FDTCrashRegisterReader(DataAbortRegisterReader):
"""
This is a :py:class:`~.DataA... | 0 | 2 | 1 | 0 | 3 | 0 |
tests/missing_data/test_missing_data_ozone_DiscardRow_Mean.py | shaido987/pyaf | 377 | 3220429 | <filename>tests/missing_data/test_missing_data_ozone_DiscardRow_Mean.py
import tests.missing_data.test_missing_data_ozone_generic as gen
gen.test_ozone_missing_data('DiscardRow', 'Mean')
| 0 | 0 | 0 | 0 | 0 | 0 |
data/mlt.py | robtu328/TextDetCorner | 331 | 3220436 | <reponame>robtu328/TextDetCorner<filename>data/mlt.py
#!/usr/bin/python
#-*- coding:utf-8 -*-
import os
import os.path
import sys
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
from PIL import Image, ImageDraw, ImageFont
import cv2
import numpy as np
import math
from utils ... | 0 | 0 | 0 | 0 | 0 | 0 |
zeeb_src/utils/logger.py | th3cyb3rc0p/Zeebsploit | 186 | 3220450 | <reponame>th3cyb3rc0p/Zeebsploit<gh_stars>100-1000
import logging
from colorlog import ColoredFormatter
def logger(name):
format_ = ColoredFormatter(
'%(log_color)s%(levelname)s%(reset)s %(message)s',
log_colors={
'[+]':'blue',
'[!]':'yellow',
'[-]':'red',
... | 0 | 0 | 0 | 0 | 0 | 0 |
.buildozer/android/platform/build-armeabi-v7a/build/other_builds/numpy-python3/armeabi-v7a__ndk_target_21/numpy/benchmarks/benchmarks/bench_lib.py | VPetras/mobile-test-app | 130 | 3220469 | """Benchmarks for `numpy.lib`."""
from __future__ import absolute_import, division, print_function
from .common import Benchmark
import numpy as np
class Pad(Benchmark):
"""Benchmarks for `numpy.pad`."""
param_names: list[str] = ["shape", "pad_width", "mode"]
params: list[list[int | tuple[int, int]] ... | 0 | 0 | 2 | 0 | 2 | 0 |
git_contributions_importer/generators/Generator.py | femellone/mock-repo | 238 | 3220486 | <reponame>femellone/mock-repo
#!/usr/bin/python3
import random
class Generator:
def __init__(self):
pass
def random_string(self, length=10):
return ''.join([chr(int(random.random() * (ord('z') - ord('a'))) + ord('a')) for c in range(length)])
def random_phrase(self, length=10, word_len... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/optimization/multiobjective/nsga2jpq.py | sveilleux1/pybrain | 2,208 | 3220492 | from __future__ import print_function
#!/usr/bin/env python
""" An illustration of using the NSGA-II multi-objective optimization algorithm
on Unconstrained Multi-Objective Optimization benchmark function. """
__author__ = '<NAME>, <EMAIL>'
from pybrain.optimization import MultiObjectiveGA
from pybrain.rl.environmen... | 0 | 0 | 0 | 0 | 0 | 0 |
vedastr/models/bodies/feature_extractors/encoders/backbones/registry.py | csmasters/vedastr | 475 | 3220512 | from vedastr.utils import Registry
BACKBONES = Registry('backbone')
| 0 | 0 | 0 | 0 | 0 | 0 |
common/ffi_wrapper.py | Neptos/openpilot | 251 | 3220515 | from __future__ import annotations
import os
import sys
import fcntl
import hashlib
import platform
from cffi import FFI
def suffix() -> str:
if platform.system() == "Darwin":
return ".dylib"
else:
return ".so"
def ffi_wrap(name, c_code, c_header, tmpdir: str="/tmp/ccache", cflags: str="", libraries: obje... | 5 | 3 | 0 | 0 | 8 | 0 |
tests/test_future_behaviour.py | superjkl/python-modernize-division-warnings | 220 | 3220533 | # Tests for problem with multiple futures added to single file
from __future__ import generator_stop
import os
import shutil
import tempfile
from utils import check_on_input
from modernize.__main__ import main as modernize_main
SINGLE_PRINT_CONTENT = """
print 'world'
"""
TWO_PRINTS_CONTENT = """
print 'Hello'
pr... | 1 | 1 | 0 | 0 | 2 | 0 |
sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py | xolve/azure-sdk-for-python | 2,728 | 3220543 | <filename>sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py
#
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ----------... | 0 | 0 | 0 | 0 | 0 | 0 |
somaticseq/utilities/split_Bed_into_equal_regions.py | bioinform/somaticseq | 159 | 3220547 | <reponame>bioinform/somaticseq<gh_stars>100-1000
#!/usr/bin/env python3
import sys, os, argparse, shutil, math, re
def run():
# argparse Stuff
parser = argparse.ArgumentParser(description='Given an input bed file, this program will output a number of bed files, each will have same number of total base pairs... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/fuse_gmock_files.py | LineageOS/android_external_gmock | 4,071 | 3220550 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# 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 copyright
# notice, this list... | 0 | 0 | 0 | 0 | 0 | 0 |
src/detext/layers/lstm_layer.py | StarWang/detext | 1,229 | 3220566 | from __future__ import annotations
import tensorflow as tf
from detext.layers.embedding_layer import create_embedding_layer
from detext.utils.layer_utils import get_sorted_dict
from detext.utils.parsing_utils import InputFtrType, InternalFtrType
class LstmLayer(tf.keras.layers.Layer):
def __init__(self, bidirect... | 1 | 8 | 0 | 1 | 10 | 0 |
cozy/synthesis/high_level_interface.py | mernst/cozy | 188 | 3220590 | from __future__ import annotations
"""High-level synthesis routine for whole implementations.
This module exports one important function:
- improve_implementation
"""
from collections import OrderedDict
import datetime
import itertools
from typing import Callable, Any
import sys
import os
import pickle
from queue im... | 13 | 4 | 0 | 0 | 17 | 0 |
mmtbx/max_lik/tst_maxlik.py | dperl-sol/cctbx_project | 155 | 3220597 | from __future__ import absolute_import, division, print_function
from cctbx import crystal
from cctbx import sgtbx
from cctbx import xray
from cctbx.array_family import flex
from cctbx import miller
from mmtbx import max_lik
from mmtbx.max_lik import maxlik
from libtbx.test_utils import approx_equal
from libtbx.utils i... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/monitoring/cron-send-ssl-check.py | fahlmant/openshift-tools | 164 | 3220603 | #!/usr/bin/env python
from __future__ import annotations
""" check ssl cert info"""
# We just want to see any exception that happens
# don't want the script to die under any cicumstances
# script must try to clean itself up
# pylint: disable=broad-except
# main() function has a lot of setup and error handling
# pylin... | 1 | 2 | 0 | 0 | 3 | 0 |
api/models/export.py | AlexRogalskiy/smart-social-distancing | 113 | 3220609 | import logging
from enum import Enum
from datetime import date
from pydantic import Field, root_validator
from typing import List, Optional
from .base import SnakeModel
logger = logging.getLogger(__name__)
class ExportDataType(str, Enum):
raw_data: str = "raw_data"
occupancy: str = "occupancy"
social_di... | 0 | 2 | 14 | 0 | 16 | 0 |
examples/shapes_from_glsl/grid.py | szabolcsdombi/zengl | 116 | 3220627 | <filename>examples/shapes_from_glsl/grid.py
import zengl
def grid_pipeline(ctx: zengl.Pipeline, framebuffer):
return ctx.pipeline(
vertex_shader='''
#version 330
#include "defaults"
const int N = 17;
void main() {
vec2 point = vec2(float(g... | 0 | 0 | 0 | 0 | 0 | 0 |
src/scenic/__init__.py | abol-karimi/Scenic | 141 | 3220633 | <filename>src/scenic/__init__.py
"""A compiler and scene generator for the Scenic scenario description language.
.. raw:: html
<h2>Submodules</h2>
.. autosummary::
:toctree:
core
domains
formats
simulators
syntax
"""
from .syntax.translator import scenarioFromFile, scenarioFromString
import s... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/sqlalchemy/ext/asyncio/exc.py | ajayiagbebaku/NFL-Model | 5,383 | 3220647 | # ext/asyncio/exc.py
# Copyright (C) 2020-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from ... import exc
class AsyncMethodRequired(exc.InvalidRequestError):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
test/geocoders/util.py | jmasselink/geopy | 3,259 | 3220659 | <reponame>jmasselink/geopy
import json
import os
from abc import ABC, abstractmethod
from unittest.mock import ANY, patch
import pytest
from async_generator import async_generator, asynccontextmanager, yield_
from geopy import exc
from geopy.adapters import BaseAsyncAdapter
from geopy.location import Location
_env =... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gluonts/core/_base.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 3220667 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 1 | 1 | 0 | 0 | 2 | 0 |
plaso/cli/psort_tool.py | log2timeline/plaso | 1,253 | 3220670 | <reponame>log2timeline/plaso<filename>plaso/cli/psort_tool.py<gh_stars>1000+
# -*- coding: utf-8 -*-
"""The psort CLI tool."""
import argparse
import collections
import os
# The following import makes sure the filters are registered.
from plaso import filters # pylint: disable=unused-import
# The following import m... | 0 | 0 | 0 | 0 | 0 | 0 |
census/tftransformestimator/input_metadata/__init__.py | VanessaDo/cloudml-samples | 1,552 | 3220677 | <reponame>VanessaDo/cloudml-samples<filename>census/tftransformestimator/input_metadata/__init__.py
"""Init module for input_metadata"""
# pylint: disable=wildcard-import
from input_metadata import *
# pylint: enable=wildcard-import
| 0 | 0 | 0 | 0 | 0 | 0 |
moveit_ros/moveit_servo/launch/pose_tracking_example.launch.py | corycrean/moveit2 | 383 | 3220702 | <reponame>corycrean/moveit2
import os
import yaml
from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import xacro
def load_file(package_name, file_path):
package_path = get_package_s... | 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.