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 |
|---|---|---|---|---|---|---|---|---|---|---|
AutotestWebD/apps/ui_globals/views/global_text_conf.py | yangjourney/sosotest | 422 | 1657939 | from apps.common.func.CommonFunc import *
from apps.common.func.LanguageFunc import *
from django.shortcuts import render, HttpResponse
from urllib import parse
from apps.common.config import commonWebConfig
from apps.common.func.WebFunc import *
from apps.ui_globals.services.global_textService import global_textServic... | 0 | 6 | 0 | 0 | 6 | 0 |
Python/Tests/TestData/TestDiscoverer/ImportErrorPytest/test_import_error.py | techkey/PTVS | 404 | 1657969 | <gh_stars>100-1000
import doesnotexist
def test_not_discovered():
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
26数据结构/day03/05_quick_sort.py | HaoZhang95/PythonAndMachineLearning | 937 | 1657970 |
def quick_sort(alist, first, last) -> None:
"""
快速排序不像之前的那样把序列分成两部分
而是第一个元素通过一个low一个high游标相夹, low的左边都比第一个元素小,high的右边都比第一个元素大
以此来确定第一个元素在序列中的位置
时间复杂度O(nlogn) 第一次分成2部分,2部分分成4部分,也就是 2*2*2*...=n 也就是logn次才能变成一个个单独元素的数组推出递归
如果9个元素的话,n = log2为底9,结果为3,横向为n,纵向为logn总体最优复杂度为O(nlogn),最... | 0 | 1 | 0 | 0 | 1 | 0 |
fast_adv/utils/visualization.py | xuguozhi/fast_adversarial | 145 | 1657978 | # From https://github.com/luizgh/visdom_logger
from __future__ import annotations
import visdom
import torch
from collections import defaultdict
class VisdomLogger:
def __init__(self, port):
self.vis = visdom.Visdom(port=port)
self.windows = defaultdict(lambda: None)
def scalar(self, name, x... | 1 | 0 | 0 | 0 | 1 | 0 |
103_EfficientDet_lite/test.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 1657993 | <filename>103_EfficientDet_lite/test.py
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
#===============================================================================================
import tensorflow_hub as hub
import numpy as np
detector = hub.load("https://tfhub.dev/tensorflow/efficientdet/lite0/detection/1")... | 0 | 0 | 0 | 0 | 0 | 0 |
performance/grapple/generate_policy.py | Raman-sh/cusplibrary | 270 | 1658001 | <reponame>Raman-sh/cusplibrary
#!/usr/bin/python
import os, sys, re, glob
from os.path import join, split, splitext
def process_file(project_base_dir, fobj, filename, base_list, project_name) :
enum_ids = [];
policy_tag_str = 'template\s*?<\s*?typename DerivedPolicy.*?>.*?;';
inc_filename = filename.repl... | 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/tests/test_data_tools/redisgraph_graph.py | manesioz/graphql-compiler | 521 | 1658052 | <filename>graphql_compiler/tests/test_data_tools/redisgraph_graph.py
# Copyright 2019-present Kensho Technologies, LLC.
from typing import Callable
import redis
from redisgraph import Graph
REDISGRAPH_SERVER = "localhost"
REDISGRAPH_PORT = 6380
def get_test_redisgraph_graph(
graph_name: str, generate_data_func... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/Marketplace/Tests/remove_existing_pack_from_private_id_set_test.py | diCagri/content | 799 | 1658072 | <filename>Tests/Marketplace/Tests/remove_existing_pack_from_private_id_set_test.py
from Tests.Marketplace.remove_existing_pack_from_private_id_set import remove_old_pack_from_private_id_set
PRIVATE_ID_SET = {
"scripts": [],
"playbooks": [],
"integrations": [
{
"Accessdata": {
... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter_9/sset/example_of_range.py | LifeOfGame/mongodb_redis | 183 | 1658096 | <filename>chapter_9/sset/example_of_range.py
import redis
client = redis.Redis()
rank_100_1000 = client.zrange('rank', 0, 4, desc=True, withscores=True)
for index, one in enumerate(rank_100_1000):
print(f'用户id: {one[0].decode()}, 积分:{one[1]},排名第:{index + 1}')
client.zcount() | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_main.py | source-foundry/font-lines | 146 | 1658104 | <reponame>source-foundry/font-lines<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import pytest
# ///////////////////////////////////////////////////////
#
# pytest capsys capture tests
# confirms capture of std output and std error streams
#
# ////////////////////////////////////////... | 0 | 0 | 0 | 0 | 0 | 0 |
bark/runtime/scenario/__init__.py | RdecKa/bark | 174 | 1658125 | from .scenario import Scenario
from .scenario import SetMapfileDirectory
from .scenario import GetMapfileDirectory
__all__ = [
"Scenario",
"SetMapfileDirectory",
"GetMapfileDirectory"
]
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/build-docs.py | macprog-guy/sailfish | 369 | 1658160 | <reponame>macprog-guy/sailfish
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
def build_docs(input_dir: str, output_dir: str):
subprocess.call('mkdocs build', shell=True, cwd=input_dir)
site_dir = os.path.join(input_dir, 'site')
shutil.copytree(site_dir, output_d... | 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/tests/test_testing_invariants.py | manesioz/graphql-compiler | 521 | 1658164 | <filename>graphql_compiler/tests/test_testing_invariants.py
# Copyright 2017-present Kensho Technologies, LLC.
"""Common GraphQL test inputs and expected outputs."""
import unittest
from . import test_input_data as test_input_data
from .test_helpers import get_function_names_from_module, get_test_function_names_from_c... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data.py | hbrodin/polytracker | 304 | 1658169 | <reponame>hbrodin/polytracker
import subprocess
import sys
from pathlib import Path
from typing import Optional, Union
from polytracker.containerization import CAN_RUN_NATIVELY, DockerContainer
_DOCKER: Optional[DockerContainer] = None
def to_native_path(host_path: Union[str, Path]) -> str:
if CAN_RUN_NATIVEL... | 0 | 0 | 0 | 0 | 0 | 0 |
src/dataset.py | sangkny/pytorch-unet-segmentation | 195 | 1658173 | import numpy as np
from PIL import Image
import glob
import torch
import torch.nn as nn
from torch.autograd import Variable
from random import randint
from torch.utils.data.dataset import Dataset
from pre_processing import *
from mean_std import *
Training_MEAN = 0.4911
Training_STDEV = 0.1658
class SEMDataTrain(Dat... | 6 | 6 | 0 | 0 | 12 | 0 |
recipes/Python/577188_Sudoku_solver_functionalprogramming/recipe-577188.py | tdiprima/code | 2,023 | 1658204 | import re
import sys
def copy_board(board, sets) -> object:
"""Return a copy of board setting new squares from 'sets' dictionary."""
return [[sets.get((r, c), board[r][c]) for c in range(9)] for r in range(9)]
def get_alternatives_for_square(board, nrow, ncolumn) -> object:
"""Return sequence ... | 1 | 6 | 0 | 0 | 7 | 0 |
king_phisher/ics.py | chachabooboo/king-phisher | 1,143 | 1658238 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/ics.py
#
# 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 of... | 9 | 5 | 1 | 0 | 15 | 0 |
samples/dcgan/hiragana.py | Ryoich/python_zero | 203 | 1658241 | import random
import sys
from PIL import Image, ImageDraw, ImageFont
import numpy as np
FONT_PATH = "/mnt/c/Windows/Fonts/"
fonts = []
fonts.append("NIS_R10N.ttc")
fonts.append("NIS_R10N.ttc")
fonts.append("NIS_SAI8N.ttc")
num_images = 10000
#num_images = 100
images = np.empty((num_images, 28, 28), dtype=np.uint8)
... | 0 | 0 | 0 | 0 | 0 | 0 |
graphsim/iter/HS03.py | vishalbelsare/graphsim | 153 | 1658248 | #!/usr/bin/env python
# Copyright (C) 2015 by
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
import itertools
import numpy as np
import networkx as nx
from typedecorator import params, returns
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__all__ = ['nsim_hs03']
@params(G1=nx.DiGraph, G2=nx.DiGraph, max_it... | 2 | 1 | 0 | 0 | 3 | 0 |
quarkchain/evm/common.py | anshulkusa/pyquarkchain | 237 | 1658271 | import rlp
from quarkchain.utils import sha3_256
class FakeHeader():
""" A Fake Minor Block Header
TODO: Move non-root-chain
"""
def __init__(self, hash=b'\x00' * 32, number: int=0, timestamp: int=0, difficulty: int=1,
gas_limit: int=3141592, gas_used: int=0, uncles_hash=sha3_256(rlp... | 5 | 1 | 0 | 0 | 6 | 0 |
projects/pointnav_baselines/experiments/pointnav_base.py | klemenkotar/dcrl | 187 | 1658303 | from abc import ABC
from typing import Optional, Sequence, Union
from allenact.base_abstractions.experiment_config import ExperimentConfig
from allenact.base_abstractions.preprocessor import Preprocessor
from allenact.base_abstractions.sensor import Sensor
from allenact.utils.experiment_utils import Builder
class Po... | 0 | 0 | 11 | 1 | 12 | 0 |
DaPy/methods/core/pagerank.py | huihui7987/DaPy | 552 | 1658327 | from __future__ import annotations
from time import clock
from DaPy.core import LogInfo, Series
from .base import BaseEngineModel
class PageRank(BaseEngineModel):
def __init__(self, engine: str='numpy', random_walk_rate: float=0.85):
BaseEngineModel.__init__(self, engine)
self.random_walk_rate = ... | 8 | 3 | 0 | 0 | 11 | 0 |
components/mpas-seaice/testing_and_setup/testcases/advection/aggregate_tracers.py | Fa-Li/E3SM | 235 | 1658381 | <filename>components/mpas-seaice/testing_and_setup/testcases/advection/aggregate_tracers.py<gh_stars>100-1000
from netCDF4 import Dataset
import numpy as np
#-------------------------------------------------------------------------------
def aggregate_tracers():
advectionMethods = ["IR","upwind"]
icTypes = ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/xlnet/utils/data_utils.py | qinzzz/texar-pytorch | 746 | 1658429 | <filename>examples/xlnet/utils/data_utils.py
# Copyright 2019 The Texar 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/L... | 0 | 0 | 0 | 0 | 0 | 0 |
api/tokens/serializers.py | gaybro8777/osf.io | 628 | 1658461 | <reponame>gaybro8777/osf.io<gh_stars>100-1000
from rest_framework import serializers as ser
from rest_framework import exceptions
from osf.exceptions import ValidationError
from osf.models import ApiOAuth2PersonalToken, ApiOAuth2Scope
from api.base.exceptions import format_validation_error
from api.base.serializers i... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/meteor-1.5/mt-diff/mt-diff.py | Kundjanasith/EMSE-DeepCom | 107 | 1658506 | <reponame>Kundjanasith/EMSE-DeepCom<gh_stars>100-1000
#!/usr/bin/env python
import math, os, re, shutil, subprocess, sys, tempfile
# MT-Diff: measure changes in segment-level quality between two systems
# according to BLEU and Meteor
bleu_script = os.path.abspath(os.path.join(os.path.dirname(__file__), \
'files', ... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/sna_ex.py | hajime9652/observations | 199 | 1658547 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def sna_ex(path) -> tuple[object, object]:
"""Simulated Example of Social... | 0 | 1 | 0 | 0 | 1 | 0 |
api/tacticalrmm/scripts/migrations/0007_script_args.py | infinite8co/tacticalrmm | 903 | 1658570 | # Generated by Django 3.1.7 on 2021-04-01 14:52
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('scripts', '0006_script_default_timeout'),
]
operations: list[object] = [
migrat... | 0 | 0 | 2 | 0 | 2 | 0 |
robomimic/config/hbc_config.py | akolobov/robomimic | 107 | 1658581 | <reponame>akolobov/robomimic<filename>robomimic/config/hbc_config.py
"""
Config for HBC algorithm.
"""
from robomimic.config.base_config import BaseConfig
from robomimic.config.gl_config import GLConfig
from robomimic.config.bc_config import BCConfig
class HBCConfig(BaseConfig):
ALGO_NAME = "hbc"
def train_... | 0 | 0 | 0 | 0 | 0 | 0 |
libsaas/services/instagram/locations.py | MidtownFellowship/libsaas | 155 | 1658588 | from __future__ import annotations
from libsaas import http, parsers
from libsaas.services import base
from . import resource, media
class LocationBase(resource.ReadonlyResource):
path: str = 'locations'
class Locations(LocationBase):
path: str = 'locations/search'
@base.apimethod
def get(self, ... | 5 | 2 | 2 | 0 | 9 | 0 |
bayespy/inference/vmp/nodes/dirichlet.py | dungvtdev/upsbayescpm | 622 | 1658647 | <filename>bayespy/inference/vmp/nodes/dirichlet.py
################################################################################
# Copyright (C) 2011-2012,2014 <NAME>
#
# This file is licensed under the MIT License.
################################################################################
"""
Module for the... | 0 | 0 | 0 | 0 | 0 | 0 |
elpa/floobits-20180801.524/floo/common/event_emitter.py | llacom/emacs.d | 166 | 1658660 | class EventEmitter(object):
def __init__(self):
self._on_handlers: dict[object,object] = {}
self._once_handlers: dict[object,object] = {}
def on(self, event, handler):
if event not in self._on_handlers:
self._on_handlers[event] = []
self._on_handlers[event].append(ha... | 0 | 0 | 0 | 2 | 2 | 0 |
bootcamp/articles/forms.py | elviva404/bootcamp | 115 | 1658674 | <gh_stars>100-1000
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Article
class ArticleForm(forms.ModelForm):
status = forms.CharField(widget=forms.HiddenInput())
title = forms.CharField(
widget=forms.TextInput(attrs={'class': 'form-control'}),
... | 0 | 0 | 0 | 0 | 0 | 0 |
mesh_reconstruction/optimizers.py | mrguz170/3D-sneaker | 1,075 | 1658725 | """
Custom optimizers.
- do not update a weight if the gradient is zero.
- use parameter-wise learning rate specified by param.lr.
"""
import chainer
class AdamRule(chainer.optimizers.adam.AdamRule):
def update_core_cpu(self, param):
raise NotImplementedError
def update_core_gpu(self, param) -> None:... | 0 | 2 | 0 | 0 | 2 | 0 |
benchexec/tools/aprove.py | fhowar/benchexec | 137 | 1658733 | <reponame>fhowar/benchexec
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
import benchexec.result as result
... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/js_code_coverage/coverage_modules.py | zealoussnow/chromium | 14,668 | 1658739 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright 2021 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 os
def PathToNyc():
return os.path.join(
os.path.dirname(__file__), 'node_modules', 'nyc', 'bin', 'nyc... | 0 | 0 | 0 | 0 | 0 | 0 |
release/src/router/samba3/source/stf/stf.py | ghsecuritylab/tomato_egg | 278 | 1658815 | <gh_stars>100-1000
#!/usr/bin/python
#
# Samba Testing Framework for Unit-testing
#
import os, string, re
import osver
def get_server_list_from_string(s):
server_list = []
# Format is a list of server:domain\username%password separated
# by commas.
for entry in string.split(s, ","):
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
commands/core.py | Commodoreprime/Command-Block-Assembly | 223 | 1658820 | <gh_stars>100-1000
import abc
from collections import namedtuple
class CommandBlock:
def __init__(self, command, conditional=True, mode='CHAIN', auto=True,
opposite=False, single_use=True):
self.command = command
self.cond = conditional
self.mode = mode
self.auto = ... | 0 | 0 | 0 | 0 | 0 | 0 |
neural-artistic-style/model.py | shinoyuki222/torch-light | 310 | 1658858 | import torch
import torch.nn as nn
import copy
class GramMatrix(nn.Module):
def forward(self, input) -> object:
_, channels, h, w = input.size()
out = input.view(-1, h * w)
out = torch.mm(out, out.t())
return out.div(channels * h * w)
class StyleLoss(nn.Module):
def __init__... | 0 | 4 | 0 | 0 | 4 | 0 |
python/piling-up.py | gajubadge11/HackerRank-1 | 340 | 1658868 | #!/usr/bin/env python3
from collections import deque
if __name__ == "__main__":
t = int(input().strip())
for _ in range(t):
num_cnt = int(input().strip())
deq = deque(list(map(int, input().strip().split(' '))))
prev = max(deq[0], deq[-1])
while deq:
if... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gluonnlp/data/tokenizers/__init__.py | leezu/gluon-nlp | 2,461 | 1658889 | <reponame>leezu/gluon-nlp<gh_stars>1000+
"""Tokenizers"""
from .base import *
from .huggingface import *
from .jieba import *
from .moses import *
from .sentencepiece import *
from .spacy import *
from .subword_nmt import *
from .whitespace import *
from .yttm import *
__all__ = base.__all__ +\
huggingface.... | 0 | 0 | 0 | 0 | 0 | 0 |
txweb2/dav/test/test_static.py | backwardn/ccs-calendarserver | 462 | 1658892 | <filename>txweb2/dav/test/test_static.py
##
# Copyright (c) 2005-2017 Apple Inc. 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 Software without restriction, including without ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/template_prefixes/loader_test.py | jwminton/voila | 2,977 | 1658900 | """Tests loading template of jinja2 templates"""
import os
from jinja2 import Environment, FileSystemLoader
from voila.paths import collect_paths
HERE = os.path.dirname(__file__)
ROOT_DIRS = [os.path.join(HERE, 'user'), os.path.join(HERE, 'system')]
def test_loader_default_nbconvert():
paths = collect_paths(['... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_no_auth.py | m4ta1l/aiohttp-security | 203 | 1658945 | from aiohttp import web
from aiohttp_security import authorized_userid, permits
async def test_authorized_userid(loop, aiohttp_client) -> object:
async def check(request) -> object:
userid = await authorized_userid(request)
assert userid is None
return web.Response()
app = web.Applic... | 0 | 4 | 0 | 0 | 4 | 0 |
Contents/Code/interface/advanced.py | jippo015/Sub-Zero.bundle | 1,553 | 1658957 | # coding=utf-8
from __future__ import annotations
import datetime
import StringIO
import glob
import os
import traceback
import urlparse
from zipfile import ZipFile, ZIP_DEFLATED
from subzero.language import Language
from subzero.lib.io import FileIO
from subzero.constants import PREFIX, PLUGIN_IDENTIFIER
from menu_... | 24 | 19 | 0 | 0 | 43 | 0 |
l10n_br_eletronic_document/models/__init__.py | kaoecoito/odoo-brasil | 181 | 1658969 | from . import res_company
from . import base_account
from . import account_move
from . import eletronic_document
from . import nfe_models
from . import nfe
from . import fiscal_position
from . import res_config_settings
from . import res_partner | 0 | 0 | 0 | 0 | 0 | 0 |
questions/search-in-rotated-sorted-array-ii/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 1658983 | """
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).
You are given a target value to search. If found in the array return true, otherwise return false.
Example 1:
Input: nums = [2,5,6,0,0,1,2], target = 0
Output: tru... | 2 | 1 | 0 | 0 | 3 | 0 |
tools/android/python_utils/git_metadata_utils.py | zealoussnow/chromium | 14,668 | 1659016 | <gh_stars>1000+
# Lint as: python3
# Copyright 2021 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.
"""Helper module for retrieving git repository metadata."""
import datetime as dt
import functools
import pathlib
from typ... | 0 | 0 | 0 | 0 | 0 | 0 |
nodes/0.7.x/python/Element.Type.py | jdehotin/Clockworkfordynamo | 147 | 1659021 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
items = UnwrapElement(IN[0])
typelist = list()
for item in items:
try:
typelist.appe... | 0 | 0 | 0 | 0 | 0 | 0 |
malwareconfig/modules.py | BA7JCM/RATDecoders | 905 | 1659023 | <filename>malwareconfig/modules.py
import importlib
import inspect
import pkgutil
from malwareconfig.common import Decoder, PreProcessor
from malwareconfig import decoders
from malwareconfig import preprocessors
def load_decoders():
dec_modules = dict()
# Walk recursively through all modules and packages.
... | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/26c0affcb18a_add_jobstep_data.py | vault-the/changes | 443 | 1659073 | """Add JobStep.data
Revision ID: 26c0affcb18a
Revises: <KEY>
Create Date: 2014-01-07 16:44:48.524027
"""
# revision identifiers, used by Alembic.
revision = '26c0affcb18a'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('jobstep', sa.Column('data', sa.JSONEn... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/kvpy/lc_multikvs.py | efeslab/hse | 558 | 1659095 | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
"""
This test inserts keys in 2 KVSes and makes sure that a cursor over one kvs returns keys only
from that kvs. This test is focussed mainly on LC.
To add keys to LC and make sure that an... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdeploy/pytorch/functions/size.py | grimoire/mmdeploy | 746 | 1659114 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='torch.Tensor.size', backend='ncnn')
def tensor__size__ncnn(ctx, self, *args) -> object:
"""Rewrite `size` for ncnn backend.
ONNX Shape node is not sup... | 0 | 1 | 0 | 0 | 1 | 0 |
yotta/lib/vcs.py | microbit-foundation/yotta | 176 | 1659133 | <reponame>microbit-foundation/yotta<gh_stars>100-1000
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import os
import subprocess
import tempfile
import logging
import errno
git_logger = logging.getLogger('git')
hg_logger ... | 0 | 0 | 0 | 0 | 0 | 0 |
skills_ml/datasets/onet_cache.py | bhagyaramgpo/skills-ml | 147 | 1659139 | from __future__ import annotations
import contextlib
import os
import csv
import io
import boto
from skills_utils.s3 import split_s3_path
from skills_ml.datasets.onet_source import OnetToMemoryDownloader
from skills_ml.storage import InMemoryStore
class OnetCache(object):
"""
An object that downloads and ca... | 1 | 1 | 0 | 0 | 2 | 0 |
sdk/core/azure-core/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py | rsdoherty/azure-sdk-for-python | 2,728 | 1659155 | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# ---------------------------------------------------------------------... | 0 | 1 | 0 | 0 | 1 | 0 |
jarviscli/tests/test_directions_to.py | WWFelina/Jarvis | 2,605 | 1659168 | import unittest
from mock import patch
from packages import directions_to, mapps
class TestDirectionsTo(unittest.TestCase):
"""
A test class that contains test cases for the main method of
directions_to.
"""
@patch.object(mapps, 'directions')
def test_directions_with_start_and_destination_cit... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/main.py | mariogeiger/pytorch_sparse | 623 | 1659206 | import time
import os.path as osp
import itertools
import argparse
import wget
import torch
from scipy.io import loadmat
from torch_scatter import scatter_add
from torch_sparse.tensor import SparseTensor
short_rows = [
('DIMACS10', 'citationCiteseer'),
('SNAP', 'web-Stanford'),
]
long_rows = [
('Janna', ... | 1 | 7 | 0 | 0 | 8 | 0 |
Company-Project/src/nextjs/factories.py | joshuadavidthomas/Wagtail-Pipit | 124 | 1659237 | import factory
from wagtail.core.models import PageViewRestriction, BaseViewRestriction
from wagtail_factories import PageFactory
class PageViewRestrictionFactory(factory.django.DjangoModelFactory):
page = factory.SubFactory(PageFactory)
restriction_type = BaseViewRestriction.PASSWORD
class Meta:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/softlearning/replay_pools/trajectory_replay_pool_test.py | brickerino/tqc | 362 | 1659250 | import pickle
import unittest
import numpy as np
from softlearning.replay_pools.trajectory_replay_pool import (
TrajectoryReplayPool)
def create_pool(max_size: int=100) -> object:
return TrajectoryReplayPool(
observation_space=None,
action_space=None,
max_size=max_size,
)
def ve... | 1 | 1 | 0 | 0 | 2 | 0 |
doc/tutorial/scripts/give_me_some_credit.py | ikingye/sqlflow | 4,742 | 1659254 | <filename>doc/tutorial/scripts/give_me_some_credit.py
#!/bin/env python
# Copyright 2020 The SQLFlow 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... | 0 | 0 | 0 | 0 | 0 | 0 |
mealie/schema/shopping_list.py | BryceStevenWilley/mealie | 1,927 | 1659268 | <reponame>BryceStevenWilley/mealie
from typing import Optional
from fastapi_camelcase import CamelModel
from mealie.db.models.shopping_list import ShoppingList
from pydantic.utils import GetterDict
class ListItem(CamelModel):
title: Optional[str]
text: str = ""
quantity: int = 1
checked: bool = False... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter10/10_deep_learning/04_framework_profile/tensorflow/RN50v1.5/utils/hooks/__init__.py | feitang0/Learn-CUDA-Programming | 405 | 1659292 | <reponame>feitang0/Learn-CUDA-Programming<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from utils.hooks.training_hooks import *
from utils.hooks.benchmark_hooks import *
from utils.hooks.prefill_hook import *
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/cts_density_model.py | LihaoR/tensorflow-rl | 193 | 1659305 | <filename>utils/cts_density_model.py
# -*- encoding: utf-8 -*-
import numpy as np
from cts import CTS
from skimage.transform import resize
class CTSDensityModel(object):
"""
Implementation of CTS Density Model described in the paper
"Unifying Count-Based Exploration and Intrinsic Motivation" (https//arxiv.org/abs/... | 0 | 0 | 0 | 0 | 0 | 0 |
deps/go_core_deps.bzl | heartless-clown/rules_proto | 249 | 1659306 | """
GENERATED FILE - DO NOT EDIT (created via @build_stack_rules_proto//cmd/depsgen)
"""
load("@bazel_gazelle//:deps.bzl", "go_repository")
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)
def go_core_deps():
com_github_golang_protobuf() ... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/examples/models/session.py | jessicadelrio/HandyHouse | 1,573 | 1659320 | from gluon.utils import web2py_uuid
cookie_key = cache.ram('cookie_key',lambda: web2py_uuid(),None)
session.connect(request,response,cookie_key=cookie_key)
| 0 | 0 | 0 | 0 | 0 | 0 |
training_and_testing/tensorflow_backend.py | khizerawan/SSR-Net | 530 | 1659337 | <gh_stars>100-1000
import tensorflow as tf
from keras.backend import tensorflow_backend as KTF
from keras.backend.common import image_data_format
#from keras.backend.tensorflow_backend import _preprocess_conv2d_input
#from keras.backend.tensorflow_backend import _postprocess_conv2d_output
py_all = all
def _preprocess... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/regenerate.py | DavidHickman/sugardough | 193 | 1659364 | <reponame>DavidHickman/sugardough<filename>bin/regenerate.py
#!/usr/bin/env python
"""Script for regenerating a test project from the sugardough template.
Usage:
regenerate.py [--watch]
regenerate.py (-h | --help)
Options:
-h --help Show this screen.
--watch Watch template directory for changes and regene... | 0 | 0 | 0 | 0 | 0 | 0 |
wooey/migrations/0033_add-script-checksum.py | fridmundklaus/wooey | 1,572 | 1659372 | <reponame>fridmundklaus/wooey
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-18 09:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wooey', '0032_rename-new-sv'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
smoke-test/tests/domains/domains_test.py | bskim45/datahub | 1,603 | 1659411 | import pytest
import time
from tests.utils import FRONTEND_ENDPOINT
from tests.utils import GMS_ENDPOINT
from tests.utils import ingest_file_via_rest
from tests.utils import delete_urns_from_file
@pytest.fixture(scope="module", autouse=False)
def ingest_cleanup_data(request):
print("ingesting domains test data")
... | 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/csp/cspcheck_plainurlschemes.py | th3cyb3rc0p/securityheaders | 151 | 1659412 | <reponame>th3cyb3rc0p/securityheaders<filename>securityheaders/checkers/csp/cspcheck_plainurlschemes.py
from securityheaders.checkers import Finding, FindingType, FindingSeverity
from securityheaders import Util
from .cspcheck import CSPCheck
class CSPCheckPlainUrlSchemes(CSPCheck):
def __init__(self, csp, ef... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_current_clocksource.py | mglantz/insights-core | 121 | 1659419 | from insights.parsers.current_clocksource import CurrentClockSource
from insights.tests import context_wrap
CLKSRC = """
tsc
"""
def test_get_current_clksr():
clksrc = CurrentClockSource(context_wrap(CLKSRC))
assert clksrc.data == "tsc"
assert clksrc.is_kvm is False
assert clksrc.is_vmi_timer != clks... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/training/deepspeed/ds_fairseq.py | allanj/lightseq | 1,985 | 1659428 | import math
import torch
from torch import nn
import torch.distributed as dist
import deepspeed
from deepspeed.utils import log_dist
from fairseq import tasks, distributed_utils
from fairseq.logging import metrics
from examples.training.deepspeed.ds_fairseq_data import BatchIterator
from examples.training.deepspeed.d... | 1 | 6 | 1 | 0 | 8 | 0 |
Recursion/105. Construct Binary Tree from Preorder and Inorder Traversal.py | beckswu/Leetcode | 138 | 1659443 | <gh_stars>100-1000
"""
105. Construct Binary Tree from Preorder and Inorder Traversal
For example, given
preorder = [3,9,20,15,7]
inorder = [9,3,15,20,7]
Return the following binary tree:
3
/ \
9 20
/ \
15 7
preorder = [3,9,1,2,20,15,7]
inorder = [1,9,2,3,15,20,7]
3
/ ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/recipes/test_leveldb.py | ht-thomas/python-for-android | 6,278 | 1659464 | import unittest
from tests.recipes.recipe_lib_test import BaseTestForCmakeRecipe
class TestLeveldbRecipe(BaseTestForCmakeRecipe, unittest.TestCase):
"""
An unittest for recipe :mod:`~pythonforandroid.recipes.leveldb`
"""
recipe_name: str = "leveldb"
| 0 | 0 | 1 | 0 | 1 | 0 |
inside/Tools/Requests.py | kangzai228/learning-power | 318 | 1659470 | <reponame>kangzai228/learning-power<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author : lisztomania
# @Date : 2021/1/21
# @Software : Pycharm
# @Version : Python 3.8.5
# @File : Requests.py
# @Function : requests初始化
from typing import Dict
import requests
import urllib3
from requests... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayEcoRebateBalanceSendModel.py | antopen/alipay-sdk-python-all | 213 | 1659481 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.RebateGood import RebateGood
class AlipayEcoRebateBalanceSendModel(object):
def __init__(self):
self._items: None = None
se... | 0 | 5 | 0 | 3 | 8 | 0 |
deepneuro/models/blocks.py | ysuter/DeepNeuro | 113 | 1659489 | from __future__ import annotations
import numpy as np
from deepneuro.models.dn_ops import DnConv, DnPixelNorm, DnUpsampling, DnMaxPooling, DnBatchNormalization, DnDropout, DnAveragePooling
from deepneuro.models.ops import leaky_relu, minibatch_state_concat
def generator(model, latent_var, depth: int=1, initial_size:... | 15 | 3 | 0 | 0 | 18 | 0 |
mmflow/models/decoders/gma_decoder.py | hologerry/mmflow | 481 | 1659501 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
import torch.nn as nn
from mmcv.runner import BaseModule
from ..builder import DECODERS
from .raft_decoder import ConvGRU, RAFTDecoder
class RelPosEmb(BaseModule):
"""Relative position embedding.
Separate embedding vec... | 18 | 8 | 0 | 0 | 26 | 0 |
data_analysis/study_numpy/numpy_polynomial_poly1d.py | 2581676612/python | 112 | 1659539 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/7/30 13:44
# @Author : Tom.lee
# @File : numpy_polynomial_poly1d.py
# @Software: PyCharm
"""
多项式
"""
import numpy as np
# 构造多项式
p1 = np.poly1d([1]) # 1
p2 = np.poly1d([1, 2]) # x + 2
p3 = np.poly1d([1, 2, 3]) # x^2 + 2x + 3
p4 =... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/helpers/classes/test_repository_data.py | ludeeus/HARM | 456 | 1659559 | from custom_components.hacs.repositories.base import RepositoryData
def test_guarded():
data = RepositoryData.create_from_dict({"full_name": "test"})
assert data.name == "test"
data.update_data({"name": "new"})
assert data.name != "new"
test = data.to_json()
test["name"] = "new"
assert ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/api/netease/__init__.py | ANONSENSEBOT/HibiAPI | 394 | 1659613 | # flake8:noqa:F401
from .api import (
BitRateType,
EndpointsType,
NeteaseEndpoint,
RecordPeriodType,
SearchType,
)
from .constants import NeteaseConstants
from .net import NetRequest
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/scatter_example.py | kail85/mpldatacursor | 165 | 1659629 | <gh_stars>100-1000
import numpy as np
import matplotlib.pyplot as plt
import mpldatacursor
x, y, z = np.random.random((3, 10))
fig, ax = plt.subplots()
ax.scatter(x, y, c=z, s=100*np.random.random(10))
mpldatacursor.datacursor()
plt.show()
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/addons/dxf2code.py | jkjt/ezdxf | 515 | 1659660 | from pathlib import Path
import ezdxf
from ezdxf.addons.dxf2code import entities_to_code
FILENAME = "A_000217"
CADKIT = Path(ezdxf.EZDXF_TEST_FILES) / "CADKitSamples"
OUTBOX = Path("~/Desktop/Outbox").expanduser()
DXF_FILE = CADKIT / f"{FILENAME}.dxf"
SOURCE_CODE_FILE = OUTBOX / f"{FILENAME}.py"
doc = ezdxf.readfile... | 0 | 0 | 0 | 0 | 0 | 0 |
maintainers/scripts/doc/escape-code-markup.py | siddhantk232/nixpkgs | 9,717 | 1659661 | #! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=channel:nixos-unstable -i python3 -p python3 -p python3.pkgs.lxml
"""
Pandoc will strip any markup within code elements so
let’s escape them so that they can be handled manually.
"""
import lxml.etree as ET
import re
import sys
def replace_element_by_text(el: ET.Elem... | 3 | 2 | 0 | 0 | 5 | 0 |
exponential.py | susan120433/distribution-is-all-you-need | 1,390 | 1659678 | <filename>exponential.py
"""
Code by <NAME>(@graykode)
https://en.wikipedia.org/wiki/Exponential_distribution
"""
import numpy as np
from matplotlib import pyplot as plt
def exponential(x, lamb):
y = lamb * np.exp(-lamb * x)
return x, y, np.mean(y), np.std(y)
for lamb in [0.5, 1, 1.5]:
x = np.ara... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/dkrr/convert_dkrr_format_to_topic_file.py | d1shs0ap/pyserini | 451 | 1659686 | <gh_stars>100-1000
#
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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 |
livestream_dl/utils.py | NabiKAZ/instagram-livestream-downloader | 128 | 1659727 | from __future__ import annotations
import logging
import json
import codecs
import sys
import os
import re
import itertools
import warnings
from instagram_private_api.compat import compat_urllib_request
class TerminalColors:
HEADER: str = '\033[95m'
OKBLUE: str = '\033[94m'
OKGREEN: str = '\033[92m'
... | 6 | 24 | 8 | 0 | 38 | 0 |
tests_nntrainer/__init__.py | mzolfaghari/coot-videotext | 213 | 1659766 | <reponame>mzolfaghari/coot-videotext
"""
Tests for package nntrainer.
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/exps/old/jct.py | SymbioticLab/Salus | 104 | 1659767 | # -*- coding: future_fstrings -*-
#
# Copyright 2019 <NAME> <<EMAIL>>
#
# This file is part of Salus
# (see https://github.com/SymbioticLab/Salus).
#
# 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 Lice... | 0 | 4 | 0 | 0 | 4 | 0 |
example/pandas_sink_example.py | akar5h/obsei | 359 | 1659773 | import logging
import sys
from pandas import DataFrame
from obsei.analyzer.classification_analyzer import (
ClassificationAnalyzerConfig,
ZeroShotClassificationAnalyzer,
)
from obsei.misc.utils import obj_to_json
from obsei.sink.pandas_sink import PandasSink, PandasSinkConfig
from obsei.source.playstore_scrap... | 0 | 0 | 0 | 0 | 0 | 0 |
tfgraphviz/__init__.py | DEKHTIARJonathan/tfgraphviz | 187 | 1659782 | # coding: utf-8
from .graphviz_wrapper import board
__author__ = "akimach"
__version__ = "0.0.6"
__license__ = "MIT"
| 0 | 0 | 0 | 0 | 0 | 0 |
datasets/tnews_dataset.py | chinaliwenbo/ChineseBert | 298 | 1659788 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : tnews_dataset.py
@author: zijun
@contact : <EMAIL>
@date : 2020/11/20 10:57
@version: 1.0
@desc :
"""
import json
import os
from functools import partial
from typing import List
import tokenizers
import torch
from pypinyin import pinyin, Style
from tokenizer... | 3 | 4 | 0 | 0 | 7 | 0 |
etl/parsers/etw/Microsoft_Windows_DeviceAssociationService.py | IMULMUL/etl-parser | 104 | 1659798 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-DeviceAssociationService
GUID : 56c71c31-cfbd-4cdd-8559-505e042bbbe1
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/guide/user-guide/_examples/_metadata_1.py | LaudateCorpus1/graphpipe | 722 | 1659815 | from graphpipe import remote
url = "http://localhost:9000"
metadata = remote.metadata(url)
print(metadata.Outputs)
| 0 | 0 | 0 | 0 | 0 | 0 |
python/024 Swap Nodes in Pairs.py | allandproust/leetcode-share | 156 | 1659957 | <filename>python/024 Swap Nodes in Pairs.py
'''
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed.
... | 0 | 0 | 0 | 0 | 0 | 0 |
lightbus_examples/ex01_quickstart/another_service/check_password.py | gcollard/lightbus | 178 | 1659993 | <filename>lightbus_examples/ex01_quickstart/another_service/check_password.py
# File: ./another_service/check_password.py
# Import our service's bus client
from bus import bus
# Call the check_password() procedure on our auth API
valid = bus.auth.check_password(username="admin", password="<PASSWORD>")
# Show the res... | 0 | 0 | 0 | 0 | 0 | 0 |
NAS/AngleNAS/utils/__init__.py | naviocean/SimpleCVReproduction | 923 | 1660058 | <filename>NAS/AngleNAS/utils/__init__.py<gh_stars>100-1000
from .imagenet import *
from .nas_utils import * | 0 | 0 | 0 | 0 | 0 | 0 |
examples/parallel/run_advection.py | GeoscienceAustralia/anuga_core | 136 | 1660063 | #import pdb
#pdb.set_trace()
#========================================================================
from anuga.config import g, epsilon
#from Numeric import allclose, array, zeros, ones, Float
from anuga.advection import Domain, Transmissive_boundary, Dirichlet_boundary
#from Numeric import array
import numpy as... | 0 | 0 | 0 | 0 | 0 | 0 |
model/general_recommender/NGCF.py | jasonshere/NeuRec | 978 | 1660086 | <filename>model/general_recommender/NGCF.py
"""
Reference: <NAME> et al. "Neural Graph Collaborative Filtering." in SIGIR2019
Source code: https://github.com/xiangwang1223/neural_graph_collaborative_filtering
@author: wubin
"""
import tensorflow as tf
import numpy as np
import scipy.sparse as sp
from time import time
f... | 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.