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 |
|---|---|---|---|---|---|---|---|---|---|---|
mgmtworker/mgmtworker/monitoring.py | ilan-WS/cloudify-manager | 124 | 1602635 | from __future__ import annotations
from os import kill, sep
from os.path import join
from shutil import move
from signal import SIGHUP
from subprocess import check_output
import json
import re
import yaml
from jinja2 import Template
from tempfile import NamedTemporaryFile
from cloudify.utils import setup_logger
log... | 2 | 5 | 0 | 0 | 7 | 0 |
examples/tensorflow/object_detection/yolo_v3/utils.py | intelkevinputnam/lpot-docs | 172 | 1602655 | import tensorflow as tf
import numpy as np
from PIL import Image
from tensorflow.core.framework import graph_pb2
from tensorflow.python.platform import gfile
from tensorflow.python.data.experimental import parallel_interleave
from tensorflow.python.data.experimental import map_and_batch
def read_graph(input_graph) ->... | 2 | 7 | 0 | 0 | 9 | 0 |
contrib/devtools/benchmark_diff.py | MONIMAKER365/BitcoinUnlimited | 535 | 1602696 | #!/usr/bin/env python3
# Copyright (c) 2020 freetrader
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import annotations
"""Compares bench_bitcoin outputs and displays percentage changes.
Changes are computed betw... | 6 | 8 | 0 | 3 | 17 | 0 |
tests/r/test_card.py | hajime9652/observations | 199 | 1602738 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.card import card
def test_card():
"""Test module card.py by downloading
card.csv and testing shape of
extracted data has 3010 rows and 34 ... | 0 | 0 | 0 | 0 | 0 | 0 |
fastcore/docments.py | jnothman/fastcore | 726 | 1602746 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/06_docments.ipynb (unless otherwise specified).
from __future__ import annotations
__all__ = ['docments']
# Cell
from tokenize import tokenize,COMMENT
from ast import parse,FunctionDef
from io import BytesIO
from textwrap import dedent
from types import SimpleNamespace
... | 3 | 7 | 0 | 0 | 10 | 0 |
eod/models/necks/__init__.py | Helicopt/EOD | 196 | 1602749 | from .fpn import FPN # noqa | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/498096_Recursively_look_groups_Active/recipe-498096.py | tdiprima/code | 2,023 | 1602751 | <reponame>tdiprima/code<gh_stars>1000+
""" Script to enumerate the members of groups in the domain"""
import sys
from win32com.client import *
## The values should be the groups you wish to examine, use the group's sAMAccountName
groups = ['Administrators', 'Account Operators', 'Backup Operators',
'Server ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/runner.py | tanjie123/hello-ltr | 109 | 1602756 | # Notebook test runner, adapted from
# https://www.blog.pythonlibrary.org/2018/10/16/testing-jupyter-notebooks/
from __future__ import annotations
import nbformat
import os
from nbconvert.preprocessors import ExecutePreprocessor
def hours(hours):
""" Hours as seconds """
hours * 60 * 60
def run_notebook(note... | 1 | 1 | 0 | 0 | 2 | 0 |
nodes/1.x/python/RevitBoundingBox.FromDynamoBoundingBox.py | andydandy74/ClockworkForDynamo | 147 | 1602775 | <reponame>andydandy74/ClockworkForDynamo<filename>nodes/1.x/python/RevitBoundingBox.FromDynamoBoundingBox.py
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import Revit... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_maintenance_jobs.py | LaudateCorpus1/squest | 112 | 1602783 | import os
import shutil
from django.core.files import File
from django.conf import settings
from service_catalog.maintenance_jobs import cleanup_ghost_docs_images
from service_catalog.models import Doc
from tests.test_service_catalog.base import BaseTest
class TestMaintenanceJob(BaseTest):
def setUp(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
ckan/migration/versions/007_1928d4af1cda_add_system_roles.py | ziveo/ckan | 2,805 | 1602788 | # encoding: utf-8
"""007 Add system roles
Revision ID: <KEY>
Revises: c83955e7acb6
Create Date: 2018-09-04 17:42:00.367475
"""
from alembic import op
import sqlalchemy as sa
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'c839... | 0 | 1 | 0 | 0 | 1 | 0 |
learntools/game_ai/ex3.py | roannav/learntools | 359 | 1602792 | from learntools.core import *
class WorseHeuristic(ThoughtExperiment):
_hint = ("The first heuristic assigns a score of 0 to column 2, and a score of -99 to "
"column 3. What scores do you get with the second heuristic?")
_solution = ("The first heuristic is guaranteed to select column 2 to block... | 0 | 0 | 9 | 0 | 9 | 0 |
technology/lab1/src/SymmetricShape.py | tonykozlovsky/bsu | 113 | 1602837 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from src.RegularShape import RegularShape
class SymmetricShape(RegularShape):
# def _count_points(self, num):
# line = get_line(self.points[0], self.points[1])
@staticmethod
def name() -> str:
return 'Symmetric Shape'
| 0 | 1 | 0 | 0 | 1 | 0 |
mapproxy/script/conf/layers.py | cunha17/mapproxy | 347 | 1602844 | <reponame>cunha17/mapproxy
# -:- encoding: utf-8 -:-
# This file is part of the MapProxy project.
# Copyright (C) 2013 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 Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
src/qrcode/pyqart/qr/data/exception.py | lapinozz/ArtCoder | 525 | 1602880 | # Added at : 2016.7.28
# Author : 7sDream
# Usage : Exception when encode data is not invalid.
from __future__ import annotations
from ..exception import QrException
__all__ = ['QrDataInvalidException', 'QrEncodingException',
'QrSpaceNotEnoughException']
class QrDataInvalidException(QrException):
... | 1 | 2 | 0 | 0 | 3 | 0 |
yabgp/message/attribute/pmsitunnel.py | mengjunyi/yabgp | 203 | 1602911 | # Copyright 2016 Cisco Systems, 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 requi... | 2 | 7 | 0 | 0 | 9 | 0 |
pypy/tool/asterisk.py | nanjekyejoannah/pypy | 381 | 1602946 | # some analysis of global imports
"""
The idea:
compile a module's source text and walk recursively
through the code objects. Find out which globals
are used.
Then examine each 'import *' by importing that module
and looking for those globals.
Replace the 'import *' by the list found.
More advanced: If the new import ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/setup.py | Ulukele/neuron_poker | 403 | 1602956 | <filename>tools/setup.py
"""Setup py distutils"""
# pylint: skip-file
from distutils.core import setup
from Cython.Build import cythonize
setup(name='montecarlo_cython',
ext_modules=cythonize("montecarlo_cython.pyx"))
| 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/other/test_xwebkitcspdeprecated.py | th3cyb3rc0p/securityheaders | 151 | 1602994 | import unittest
from securityheaders.checkers.other import XWebKitCSPDeprecatedChecker
class XWebKitCSPDeprecatedCheckerTest(unittest.TestCase):
def setUp(self):
self.x = XWebKitCSPDeprecatedChecker()
def test_checkNoHeader(self):
nox = dict()
nox['test'] = 'value'
self.assertEqua... | 0 | 0 | 0 | 0 | 0 | 0 |
dataparser/__init__.py | idxn/sublime-robot-framework-assistant | 103 | 1602999 | """Modules under the dataparser module are run from the Python where the
Robot Framework is installed. These modules must not be run the from the
Python included in the Sublime Text
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
ufora/FORA/test/test.py | ufora/ufora | 571 | 1603006 | <filename>ufora/FORA/test/test.py
# Copyright 2015 Ufora 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/13_sw_layout.py | tgolsson/appJar | 666 | 1603028 | from appJar import gui
def show(btn): app.showSubWindow("sub")
def hide(btn): app.hideSubWindow("sub")
app=gui()
app.addLabel("l1", "Sub Window Demo")
app.addButton("PRESS", show)
app.startSubWindow("sub")
app.addLabel("s1", "sub")
app.addButton("Stop", hide)
app.stopSubWindow()
app.setSubWindowLocation("sub", 400,4... | 0 | 0 | 0 | 0 | 0 | 0 |
robel/components/tracking/virtual_reality/client.py | Del9fina/robel | 109 | 1603029 | <filename>robel/components/tracking/virtual_reality/client.py<gh_stars>100-1000
# Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | 0 | 0 | 0 | 0 | 0 | 0 |
rupo/stress/test_dict.py | dagrigorev/rupo | 171 | 1603033 | <reponame>dagrigorev/rupo
# -*- coding: utf-8 -*-
# Автор: <NAME>
# Описание: Тесты для словаря ударений.
import unittest
from rupo.stress.dict import StressDict
from rupo.stress.word import Stress, StressedWord
from rupo.util.preprocess import VOWELS
from rupo.settings import RU_GRAPHEME_STRESS_PATH, ZALYZNYAK_DICT,... | 0 | 0 | 0 | 0 | 0 | 0 |
dataprep/eda/distribution/compute/common.py | Waterpine/dataprep-1 | 1,229 | 1603034 | """Common used methods for plot function"""
from typing import Union, Optional, Tuple, Dict
import pandas as pd
import dask.dataframe as dd
from ...dtypes_v2 import LatLong
def _gen_latlong(df: Union[pd.DataFrame, dd.DataFrame], x: LatLong) -> dd.Series:
"""
Merge Latlong into one new column.
"""
# ... | 6 | 2 | 2 | 0 | 10 | 0 |
Geometry/EcalAlgo/python/EcalGeometryDBWriter_cfi.py | ckamtsikis/cmssw | 852 | 1603049 | <filename>Geometry/EcalAlgo/python/EcalGeometryDBWriter_cfi.py
from Geometry.EcalAlgo.EcalEndcapGeometryDBWriter_cfi import *
from Geometry.EcalAlgo.EcalPreshowerGeometryDBWriter_cfi import *
from Geometry.EcalAlgo.EcalBarrelGeometryDBWriter_cfi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
extra_apps/DjangoUeditor/test_try.py | Starrynighty0917/FoodMarket | 335 | 1603072 | # coding:utf-8
from utils import FileSize
MF = FileSize("36723678")
print(MF)
| 0 | 0 | 0 | 0 | 0 | 0 |
bruges/attribute/test/energy_test.py | mycarta/bruges | 209 | 1603086 | # -*- coding: utf-8 -*-
"""
Tests.
"""
import unittest
from numpy import linspace, sin, pi, amax
from bruges.attribute import energy
class EnergyTest(unittest.TestCase):
def setUp(self):
"""
Makes a simple sin wave with 1 amplitude to use as test data.
"""
self.n_samples = 1001
... | 0 | 0 | 0 | 0 | 0 | 0 |
mindboggle/guts/compute.py | cemlyn007/mindboggle | 118 | 1603152 | <filename>mindboggle/guts/compute.py
#!/usr/bin/env python
"""
Compute functions.
Authors:
- <NAME>, 2012-2016 (<EMAIL>) http://binarybottle.com
Copyright 2016, Mindboggle team (http://mindboggle.info), Apache v2.0 License
"""
def distcorr(X, Y):
"""
Compute the distance correlation function.
... | 0 | 0 | 0 | 0 | 0 | 0 |
巡线例程/main.py | ToanTech/py-apple-dynamics | 125 | 1603180 | <filename>巡线例程/main.py<gh_stars>100-1000
import _thread
import padog
import time
from machine import Timer
from machine import UART
from padog import g,m
uart6=UART(2,115200)
t = Timer(1)
def OpenMV_Run(t):
command=""
DIS=0
if uart6.any():
read = uart6.read(1).decode('gbk')
while read != '/':
comman... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/rest_api/test_invitations.py | ACHultman/cvat | 4,197 | 1603271 | # Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from http import HTTPStatus
import pytest
from .utils.config import post_method
class TestCreateInvitations:
def _test_post_invitation_201(self, user, data, invitee, **kwargs):
response = post_method(user, 'invitations', data, **kwarg... | 0 | 2 | 0 | 0 | 2 | 0 |
habu/lib/extract.py | riccigrj/habu | 461 | 1603281 | from __future__ import annotations
import ipaddress
from collections import OrderedDict
import tldextract
import validators
def valid_domain(item) -> bool | object:
if validators.domain(item) is not True:
return False
x = tldextract.extract(item)
return x.subdomain is ''
def valid_fqdn(item) ... | 0 | 7 | 0 | 0 | 7 | 0 |
sphinx/source/docs/user_guide/examples/geo_gmap.py | kevin1kevin1k/bokeh | 15,193 | 1603296 | <reponame>kevin1kevin1k/bokeh
from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, GMapOptions
from bokeh.plotting import gmap
output_file("gmap.html")
map_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=11)
# For GMaps to function, Google requires you obtain an... | 0 | 0 | 0 | 0 | 0 | 0 |
twitch/helix/models/__init__.py | sotif/Twitch-Python | 177 | 1603333 | from typing import List, Callable
from .clip import Clip
from .follow import Follow
from .game import Game
from .model import Model
from .stream import Stream
from .user import User
from .video import Video
__all__: List[Callable] = [
Clip,
Follow,
Game,
Model,
Stream,
User,
Video,
]
| 0 | 0 | 1 | 0 | 1 | 0 |
Python3/997.py | rakhi2001/ecom7 | 854 | 1603394 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 796 ms submission
class Solution:
def findJudge(self, N: int, trust: List[List[int]]) -> int:
# makes a list of people that trust people
# if True then they trust, if F... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/extract_from_log.py | nyu-dl/dl4mt-multi | 143 | 1603448 | """
Extracts fields from log into file
"""
import argparse
import numpy
import cPickle as pkl
parser = argparse.ArgumentParser()
parser.add_argument("--log-file", type=str, help="Log file")
parser.add_argument("--item", help='Variable to extract', type=str,
default='logprob')
parser.add_argument('... | 0 | 0 | 0 | 0 | 0 | 0 |
modoboa/parameters/api/v2/serializers.py | Ranoiaetep/modoboa | 1,602 | 1603459 | <reponame>Ranoiaetep/modoboa
"""Parameters serializers."""
from rest_framework import serializers
class ApplicationSerializer(serializers.Serializer):
"""Application serializer."""
name = serializers.CharField()
label = serializers.CharField()
class ParameterChoiceSerializer(serializers.Serializer):
... | 0 | 0 | 0 | 0 | 0 | 0 |
ark_nlp/factory/loss_function/r_drop_cross_entropy_loss.py | Zrealshadow/ark-nlp | 258 | 1603513 | <gh_stars>100-1000
import torch.nn.functional as F
from torch import Tensor
from typing import Optional
from torch.nn.modules.loss import _WeightedLoss
class RDropCrossEntropyLoss(_WeightedLoss):
r"""
"""
__constants__ = ['ignore_index', 'reduction']
ignore_index: int
def __init__(
self,... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/404.py | rakhi2001/ecom7 | 854 | 1603520 | __________________________________________________________________________________________________
sample 20 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sumOfLeftL... | 0 | 0 | 0 | 0 | 0 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/models/m_sync/__init__.py | disrupted/Trakttv.bundle | 1,346 | 1603585 | from plugin.models.m_sync.result import SyncResult, SyncResultError, SyncResultException
from plugin.models.m_sync.status import SyncStatus
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/ConfigInfo.py | antopen/alipay-sdk-python-all | 213 | 1603588 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AttachmentExplain import AttachmentExplain
class ConfigInfo(object):
def __init__(self):
self._attachment_explain = None
self._collect_atta... | 0 | 0 | 0 | 0 | 0 | 0 |
src/backend/common/sitevars/notifications_enable.py | ofekashery/the-blue-alliance | 266 | 1603602 | from backend.common.sitevars.sitevar import Sitevar
class NotificationsEnable(Sitevar[bool]):
@staticmethod
def key() -> str:
return "notifications.enable"
@staticmethod
def description() -> str:
return "For enabling/disabling all notifications"
@staticmethod
def default_valu... | 1 | 5 | 0 | 0 | 6 | 0 |
lib/fpm/package/pyfpm/__init__.py | jcbollinger/fpm | 6,996 | 1603633 | __all__ = [ "get_metadata" ]
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/steamist/test_switch.py | MrDelik/core | 30,023 | 1603657 | <reponame>MrDelik/core
"""Tests for the steamist switch."""
from __future__ import annotations
from datetime import timedelta
from unittest.mock import AsyncMock
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.c... | 0 | 0 | 0 | 0 | 0 | 0 |
apex/pyprof/prof/dropout.py | oyj0594/apex | 6,523 | 1603660 | from collections import OrderedDict
from .utility import Utility
from .base import OperatorLayerBase
class Dropout(OperatorLayerBase):
def __init__(self, d) -> None:
marker = eval(d.argMarker[0])
mod = marker['mod']
op = marker['op']
args = marker['args']
self.marker = marker
self.mod_ = mod
self.op_ ... | 0 | 8 | 0 | 0 | 8 | 0 |
demos/common/python/openvino/model_zoo/model_api/adapters/utils.py | alpkn/open_model_zoo | 2,201 | 1603709 | from __future__ import annotations
"""
Copyright (C) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 4 | 5 | 0 | 0 | 9 | 0 |
recipes/Python/578596_2_very_basic_text_games/recipe-578596.py | tdiprima/code | 2,023 | 1603713 | <gh_stars>1000+
############################################################
# - My version on the game "Dragon Realm".
# - taken from the book "invent with python" by <NAME>.
# - thanks for a great book Mr Sweigart.
# - this code takes advantage of python 3.
############################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/test_supervisor.py | agners/hassio | 584 | 1603727 | <gh_stars>100-1000
"""Test Supervisor API."""
# pylint: disable=protected-access
import pytest
from supervisor.api.const import ATTR_AVAILABLE_UPDATES
from supervisor.coresys import CoreSys
from tests.const import TEST_ADDON_SLUG
@pytest.mark.asyncio
async def test_api_supervisor_options_debug(api_client, coresys: ... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/Grasshopper/Kernel/Expressions.py | htlcnn/ironpython-stubs | 182 | 1603738 | # encoding: utf-8
# module Grasshopper.Kernel.Expressions calls itself Expressions
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
class GH_CharType(Enum,ICompar... | 0 | 0 | 0 | 0 | 0 | 0 |
rlgraph/tests/components/test_prioritized_replay.py | RLGraph/RLGraph | 290 | 1603761 | <reponame>RLGraph/RLGraph<gh_stars>100-1000
# Copyright 2018/2019 The RLgraph 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/licen... | 0 | 0 | 0 | 0 | 0 | 0 |
fbpic/particles/elementary_process/ionization/read_atomic_data.py | fractional-ray/fbpic | 131 | 1603766 | # Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
from __future__ import annotations
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It contains a helper function that parses the data file atomic_data.txt
"""
import re, os
import numpy as np
from scip... | 0 | 2 | 0 | 0 | 2 | 0 |
07_compiling/pythran/calculate.py | siddheshmhatre/high_performance_python | 698 | 1603789 | import numpy as np
# pythran export calculate_z(int, complex[], complex[], int[])
def calculate_z(maxiter, zs, cs, output) -> object:
"""Calculate output list using Julia update rule"""
# omp parallel for schedule(guided)
for i in range(len(zs)):
n = 0
z = zs[i]
c = cs[i]
... | 0 | 1 | 0 | 0 | 1 | 0 |
exercises/beer-song/beer_song.py | kishankj/python | 1,177 | 1603801 | <gh_stars>1000+
def recite(start, take=1):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractYurikatransWordpressCom.py | fake-name/ReadableWebProxy | 193 | 1603807 | from __future__ import annotations
def extractYurikatransWordpressCom(item) -> bool | object | None:
'''
Parser for 'yurikatrans.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
titlemap = [
('... | 0 | 1 | 0 | 0 | 1 | 0 |
aurora/nn/utils.py | upul/Aurora | 111 | 1603808 | import numpy as np
def softmax_func(x) -> object:
"""
Numerically stable softmax function. For more details
about numerically calculations please refer:
http://www.deeplearningbook.org/slides/04_numerical.pdf
:param x:
:return:
"""
stable_values = x - np.max(x, axis=1, keepdims=True)
... | 6 | 4 | 0 | 0 | 10 | 0 |
src/python/nimbusml/decomposition/__init__.py | michaelgsharp/NimbusML | 134 | 1603840 | <reponame>michaelgsharp/NimbusML
from .factorizationmachinebinaryclassifier import \
FactorizationMachineBinaryClassifier
from .pcaanomalydetector import PcaAnomalyDetector
from .pcatransformer import PcaTransformer
__all__ = [
'FactorizationMachineBinaryClassifier',
'PcaAnomalyDetector',
'PcaTransform... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 09/uppertst5.py | gredman/HelloSilicon | 687 | 1603869 | from ctypes import *
libupper = CDLL("/Users/below/lib/libup.dylib")
libupper.mytoupper.argtypes = [c_char_p, c_char_p]
libupper.mytoupper.restype = c_int
inStr = create_string_buffer(b"This is a test!")
outStr = create_string_buffer(250)
len = libupper.mytoupper(inStr, outStr)
print(inStr.value)
print(outStr.valu... | 0 | 0 | 0 | 0 | 0 | 0 |
JavaScripts/FeatureCollection/ComputedAreaFilter_qgis.py | c11/earthengine-py-notebooks | 1,008 | 1603889 | import ee
from ee_plugin import Map
# Computed area filter.
# Find US counties smaller than 3k square kilometers in area.
# Load counties from TIGER boundaries table
counties = ee.FeatureCollection('TIGER/2016/Counties')
# Map a function over the counties to set the area of each.
def func_blc(f) -> object:
# Co... | 0 | 1 | 0 | 0 | 1 | 0 |
EventFilter/EcalRawToDigi/python/EcalUnpackerMapping_cfi.py | ckamtsikis/cmssw | 852 | 1604032 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# ----- For the EE Mapping :
from Geometry.EcalMapping.EcalMapping_cfi import *
from Geometry.EcalMapping.EcalMappingRecord_cfi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
src/homework/tests/api/tests_answer_create.py | denkasyanov/education-backend | 151 | 1604078 | import pytest
from homework.models import Answer
pytestmark = [
pytest.mark.django_db,
pytest.mark.usefixtures('purchase'),
]
@pytest.fixture
def _no_purchase(purchase):
purchase.setattr_and_save('paid', None)
def get_answer() -> object:
return Answer.objects.last()
def test_creation(api, questi... | 0 | 1 | 0 | 0 | 1 | 0 |
python/MPRNet.py | opteroncx/MoePhoto | 192 | 1604157 | # <NAME> https://github.com/swz30/MPRNet
from __future__ import annotations
import torch
import torch.nn as nn
from models import Conv3x3, FRM
##########################################################################
conv = lambda in_channels, out_channels, kernel_size, bias=False, stride = 1:\
nn.Conv2d(in_channel... | 10 | 9 | 0 | 0 | 19 | 0 |
scripts/dataset_tools/stamp_state_est_using_matches.py | XueLianjie/rpg_trajectory_evaluation | 636 | 1604226 | #!/usr/bin/env python2
import os
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='stamp state estimate that are marked using id')
parser.add_argument('state_est',
help='state estimate file that starts with id')
pa... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_external_tf_models.py | cambiegroup/aizynthfinder | 219 | 1604270 | <gh_stars>100-1000
import pytest
import numpy as np
import tensorflow as tf
import aizynthfinder.utils.models as models
from aizynthfinder.utils.models import ExternalModelViaREST, ExternalModelViaGRPC
@pytest.fixture()
def setup_rest_mock(mocker):
models.TF_SERVING_HOST = "localhost"
models.TF_SERVING_REST_... | 0 | 0 | 0 | 0 | 0 | 0 |
shellpython/constants.py | wujuguang/shellpy | 706 | 1604320 | SHELLPY_PARAMS = 'SHELLPY_PARAMS'
| 0 | 0 | 0 | 0 | 0 | 0 |
DSC/test/test_compare_pkg_version.py | shridpant/azure-linux-extensions | 266 | 1604347 | #!/usr/bin/env python
#
# DSC Extension For Linux
#
# Copyright 2014 Microsoft 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/115418_OpenGL_TTF_TrueType_Font_FPS_Frames_Per_Second/recipe-115418.py | tdiprima/code | 2,023 | 1604381 | <reponame>tdiprima/code
"""
font.py -- Displays FPS in OpenGL using TrueType fonts.
Copyright (c) 2002. <NAME>. All rights reserved.
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 Sof... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/data_generation/generate_mortality_prediction_mimic_demo.py | pyvonpyton/PyHealth | 485 | 1604386 | # -*- coding: utf-8 -*-
"""Mortality Prediction Label Generation
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 2 clause
import os
import pandas as pd
import json
from tqdm import tqdm
import sys
# temporary solution for relative imports in case combo is not installed
# if combo is installed, no need to use the follo... | 0 | 0 | 0 | 0 | 0 | 0 |
utils.py | Mrgemy95/visual-interaction-networks-pytorch | 103 | 1604411 | import os
import matplotlib.pyplot as plt
def create_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def make_image2(xy,img_folder,prefix):
if not os.path.exists(img_folder):
os.makedirs(img_folder);
fig_num=len(xy);
mydpi=100;
for i in range(fig_num):
#fig = plt.figure(figsize=(32... | 0 | 0 | 0 | 0 | 0 | 0 |
pox/messenger/tcp_transport.py | TummanapallyAnuraag/pox | 416 | 1604477 | # Copyright 2011,2012 <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 required by applicable law or agreed to in writing,... | 9 | 4 | 1 | 4 | 18 | 0 |
gunicorn_entrypoint.py | kant/gratipay.com | 517 | 1604517 | from aspen import log
from gratipay.application import Application
log('Instantiating Application from gunicorn_entrypoint')
website = Application().website
| 0 | 0 | 0 | 0 | 0 | 0 |
nlp_profiler/high_level_features/sentiment_polarity.py | EpcLoler/nlp_profiler | 221 | 1604519 | import math
from textblob import TextBlob
from nlp_profiler.constants import NOT_APPLICABLE, NaN
### Sentiment analysis
def sentiment_polarity_summarised(polarity: str) -> str:
if (not polarity) or (polarity == NOT_APPLICABLE):
return NOT_APPLICABLE
if 'negative' in polarity.lower():
return... | 3 | 3 | 0 | 0 | 6 | 0 |
api/client/src/test/test_describe_cluster_response_content.py | enrico-usai/cfncluster | 415 | 1604530 | """
ParallelCluster
ParallelCluster API # noqa: E501
The version of the OpenAPI document: 3.0.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import pcluster.client
from pcluster.client.model.cloud_formation_status import CloudFormationStatus
from pcluster.client.mode... | 0 | 0 | 0 | 0 | 0 | 0 |
torch2trt/converters/Linear.py | PogChamper/torch2trt | 3,363 | 1604584 | from torch2trt.torch2trt import *
from torch2trt.module_test import add_module_test
@tensorrt_converter('torch.nn.functional.linear')
def convert_Linear(ctx):
input = ctx.method_args[0]
weight = get_arg(ctx, 'weight', 1, None)
bias = get_arg(ctx, 'bias', 2, None)
input_trt = add_missing_trt_tensors(ct... | 0 | 2 | 0 | 0 | 2 | 0 |
wetterdienst/api.py | bh-chaker/wetterdienst | 155 | 1604586 | # -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
from typing import Union
from wetterdienst.exceptions import InvalidEnumeration, ProviderError
from wetterdienst.metadata.kind import Kind
from wetterdienst.metadata.provider... | 2 | 2 | 0 | 0 | 4 | 0 |
pytorch_ares/pytorch_ares/attack_torch/spsa.py | thu-ml/realsafe | 107 | 1604664 | from __future__ import annotations
import numpy as np
from scipy.fftpack import ss_diff
import torch
from torch import optim
class SPSA(object):
def __init__(self, model,norm, device, eps, learning_rate, delta, spsa_samples, sample_per_draw,
nb_iter, data_name, early_stop_loss_threshold: object ... | 2 | 8 | 0 | 2 | 12 | 0 |
pysph/sph/sph_compiler.py | nauaneed/pysph | 293 | 1604671 | <gh_stars>100-1000
class SPHCompiler(object):
def __init__(self, acceleration_evals, integrator):
"""Compiles the acceleration evaluator and integrator to produce a
fast version using one of the supported backends. If the backend is
not given, one is automatically chosen based on the configu... | 0 | 0 | 0 | 0 | 0 | 0 |
text-classifier/python/sentiment_classifier.py | meghanaravikumar/sigopt-examples | 213 | 1604699 | <gh_stars>100-1000
import json, math, numpy
import sigopt
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn import cross_validation
#load text training data
POSITIVE_TEXT = json.load(open("POSITIVE_list.json"))
NEGATIVE_TEXT = json.load(open("NEGATI... | 0 | 0 | 0 | 0 | 0 | 0 |
software/nuke/menu.py | kei-iketani/plex | 153 | 1604702 | #*********************************************************************
# content = menu Nuke
# version = 0.1.0
# date = 2019-12-01
#
# license = MIT <https://github.com/alexanderrichtertd>
# author = <NAME> <<EMAIL>>
#*********************************************************************
import os
import... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet/ops/polygon_geo/polygon_geo.py | cameronchoi/r3det-docker | 176 | 1604719 | <gh_stars>100-1000
from . import polygon_geo_cpu
def polygon_iou(poly1, poly2):
return polygon_geo_cpu.polygon_iou(poly1, poly2)
| 0 | 0 | 0 | 0 | 0 | 0 |
ppapi/generators/idl_log.py | zealoussnow/chromium | 14,668 | 1604749 | <gh_stars>1000+
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Error and information logging for IDL """
import sys
class IDLLog(object):
"""Captures and routes logging output.
Caputres lo... | 0 | 0 | 0 | 0 | 0 | 0 |
chrome/installer/mac/signing/signing_test.py | zealoussnow/chromium | 14,668 | 1604758 | # 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.
import unittest
from . import model, signing, test_common, test_config
mock = test_common.import_mock()
# python2 support.
try:
FileNotFoundError
exce... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflowServingWeb/auto_run.py | xrxiang/tensorflow2.0-coding | 102 | 1604813 | # coding=utf-8
#导入所需要的依赖包
import os
import signal
import subprocess
import getConfig
gConfig={}
gConfig=getConfig.get_config()
tf_model_server=''
flask_server=''
port=gConfig['server_port']
exeport_dir=gConfig['exeport_dir']
try:
#先启动TensorFlow Serving服务,将模型完成部署
tf_model_server = subprocess.Popen(["tensorflow... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/syft/tests/syft/lib/python/string/string_reverse_test.py | jackbandy/PySyft | 8,428 | 1604837 | <reponame>jackbandy/PySyft<gh_stars>1000+
# syft absolute
import syft as sy
def test_string_reversed() -> None:
s = sy.lib.python.String("dog")
t = ""
for i in reversed(s):
t += i
assert t == "god"
| 0 | 0 | 0 | 0 | 0 | 0 |
test/io/testcjsonreader.py | pstjohn/cclib | 224 | 1604853 | <filename>test/io/testcjsonreader.py
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Unit tests for the CJSON reader."""
import os
import unittest
import tempfile
im... | 0 | 0 | 0 | 0 | 0 | 0 |
slyd/slyd/splash/qtutils.py | rmcwilliams2004/PAscrape | 6,390 | 1604862 | <gh_stars>1000+
try:
from PyQt5.QtCore import QObject
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWebKit import QWebElement
from PyQt5.QtNetwork import QNetworkRequest
except ImportError:
from PyQt4.QtCore import QObject
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtWebKit import QWebEl... | 0 | 0 | 0 | 0 | 0 | 0 |
elpis/engines/common/output/__init__.py | guillaume-wisniewski/elpis | 118 | 1604919 | from .ctm_to_textgrid import *
from .textgrid_to_elan import *
from .raw_to_elan import *
| 0 | 0 | 0 | 0 | 0 | 0 |
TopQuarkAnalysis/TopEventProducers/python/producers/StGenEvtProducer_cfi.py | ckamtsikis/cmssw | 852 | 1604932 | import FWCore.ParameterSet.Config as cms
#
# module to combine the persistent genParticles
# from the top decay and top mothers
#
genEvtSingleTop = cms.EDProducer("StGenEventReco",
src = cms.InputTag("decaySubset"),
init = cms.InputTag("initSubset")
)
| 0 | 0 | 0 | 0 | 0 | 0 |
office365/teams/channels/channel_collection.py | rikeshtailor/Office365-REST-Python-Client | 544 | 1604935 | from __future__ import annotations
from office365.entity_collection import EntityCollection
from office365.teams.channels.channel import Channel
class ChannelCollection(EntityCollection):
"""Team's collection"""
def __init__(self, context, resource_path: object | None=None):
super(ChannelCollection, ... | 2 | 1 | 0 | 0 | 3 | 0 |
testsuite/complement-reg/run.py | luyatshimbalanga/OpenShadingLanguage | 1,105 | 1604961 | <reponame>luyatshimbalanga/OpenShadingLanguage
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 32 32 -od uint8 v_complement -o cout v_comp.tif ... | 0 | 0 | 0 | 0 | 0 | 0 |
django_common/management/commands/generate_secret_key.py | vaskoMAYA/django-common-wbh | 157 | 1604963 | from __future__ import print_function, unicode_literals, with_statement, division
from django.core.management.base import BaseCommand
from django.utils.crypto import get_random_string
from django.utils.translation import ugettext as _
import string
class Command(BaseCommand):
help = _('This command generates SE... | 0 | 0 | 1 | 0 | 1 | 0 |
tests/serialise/xml_utils.py | jonnyrocks/pyangbind | 176 | 1605038 | <gh_stars>100-1000
def xml_tree_equivalence(e1, e2):
"""
Rough XML comparison function based on https://stackoverflow.com/a/24349916/1294458.
This is necessary to provide some sort of structural equivalence of a generated XML
tree; however there is no XML deserialisation implementation yet. A naive text... | 0 | 0 | 0 | 0 | 0 | 0 |
models/FaceDetectorAndRecognition/LFFD.py | Dou-Yu-xuan/deep-learning-visal | 150 | 1605054 | import torch
import torch.nn as nn
def Conv1x1ReLU(in_channels,out_channels) -> object:
return nn.Sequential(
nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1),
nn.ReLU6(inplace=True)
)
def Conv3x3ReLU(in_channels,out_channels,stride,padding) ->... | 2 | 5 | 0 | 0 | 7 | 0 |
1 File handle/File handle binary/search record in binary file.py | sulphatet/Python | 28,321 | 1605063 | #binary file to search a given record
import pickle
def binary_search():
F=open("studrec.dat",'rb')
# your file path will be different
value=pickle.load(F)
search=0
rno=int(input("Enter the roll number of the student"))
for i in value:
if i[0]== rno:
print("... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data/importer/simple_pkg/ping.py | msaladna/mitogen | 1,526 | 1605106 | <filename>tests/data/importer/simple_pkg/ping.py<gh_stars>1000+
def ping(*args):
return args
| 0 | 0 | 0 | 0 | 0 | 0 |
actions/actions.py | bob329/rasa_ch_faq | 114 | 1605117 | # This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import mimetypes
import random
from typing import Any, Te... | 33 | 21 | 1 | 0 | 55 | 0 |
tests/alltests.py | jlsajfj/NBT | 241 | 1605125 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import unittest
try:
from unittest import skip as _skip
except ImportError:
# Python 2.6 has an older unittest API. The backported package is available from pypi.
import unittest2 as unittest
testmodules = ['examplestests', 'nbttests... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/bigquery-cross-project-slot-monitoring/bigquery_slots_monitoring/schema.py | ruchirjain86/professional-services | 2,116 | 1605137 | # Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/libs/window_view/__init__.py | PranjalPansuriya/JavaScriptEnhancements | 690 | 1605152 | <reponame>PranjalPansuriya/JavaScriptEnhancements
from .window_view_manager import window_view_manager
from .window_view import WindowView
from .window_view import JavascriptEnhancementsWindowViewKeypressCommand
from .window_view import JavascriptEnhancementsWindowViewEventListener
__all__ = [
"window_view_manager",... | 0 | 0 | 0 | 0 | 0 | 0 |
src/qrcode/pyqart/qr/ec/rsencoder.py | lapinozz/ArtCoder | 525 | 1605167 | <reponame>lapinozz/ArtCoder
from .poly import GF28Poly
from ...common import Bits
class _RSGenPolynomials(object):
def __init__(self):
self._table = [None, GF28Poly.from_index_list([0, 0], 1)]
def __getitem__(self, index):
while index > len(self._table) - 1:
c = len(self._table) -... | 0 | 0 | 0 | 0 | 0 | 0 |
src/jsonapi/v1/changesets.py | piwaniuk/critic | 216 | 1605192 | <reponame>piwaniuk/critic<filename>src/jsonapi/v1/changesets.py
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2017 the Critic contributors, Opera Software ASA
#
# 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 ... | 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.