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 |
|---|---|---|---|---|---|---|---|---|---|---|
arachne/extensions.py | sliderSun/arachne | 137 | 3269772 | from scrapy import signals
from scrapy import version_info as SCRAPY_VERSION
if SCRAPY_VERSION <= (1, 0, 0):
from scrapy.contrib.exporter import CsvItemExporter, JsonItemExporter
else:
from scrapy.exporters import CsvItemExporter, JsonItemExporter
class ExportData(object):
def __init__(self):
sel... | 0 | 2 | 0 | 2 | 4 | 0 |
builds/Resources/mkBuild_Dir.py | darius-bluespec/Flute | 271 | 3269779 | #!/usr/bin/python3
# Copyright (c) 2018-2021 Bluespec, Inc.
# See LICENSE for license details
# ================================================================
from __future__ import annotations
usage_line = (
"Usage:\n"
" $ CMD <repo> <arch> <privs> <cache_org> <sim> <debug?> <tohost?> <tv?>\n"
... | 1 | 2 | 0 | 0 | 3 | 0 |
tracardi/process_engine/action/v1/consents/add_consent_action/model/payload.py | DawidekZagajnik/tracardi | 153 | 3269794 | <gh_stars>100-1000
from pydantic import BaseModel
from datetime import datetime
from typing import Dict, Union
class Configuration(BaseModel):
consents: str
class Consents(BaseModel):
__root__: Dict[str, bool]
def __iter__(self):
for item in self.__root__.items():
yield item
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_bitbucket_server.py | Turiok/atlassian-python-api | 779 | 3269813 | from unittest import TestCase
from atlassian.bitbucket import Bitbucket
from .mockup import mockup_server
class TestWebhook(TestCase):
def setUp(self):
self.bitbucket = Bitbucket(
"{}/bitbucket/server".format(mockup_server()), username="username", password="password"
)
self.p... | 0 | 0 | 0 | 0 | 0 | 0 |
coapthon/resource_directory/registration.py | Dalanke/CoAPthon | 237 | 3269836 | <filename>coapthon/resource_directory/registration.py<gh_stars>100-1000
from coapthon.resources.resource import Resource
from databaseManager import DatabaseManager
from coapthon import defines
__author__ = '<NAME>'
class Registration(Resource):
"""
Implementation of the registration resource.
"""
de... | 0 | 0 | 0 | 0 | 0 | 0 |
abm-ants-pheromone.py | RachidStat/PyCX | 176 | 3269845 | import pycxsimulator
from pylab import *
width = 50
height = 50
populationSize = 3000
evaporationRate = 0.02
diffusionCoefficient = 0.8
hillClimbingProb = 0.95
def initialize():
global time, agents, envir, nextenvir
time = 0
agents = []
for i in range(populationSize):
... | 0 | 1 | 0 | 0 | 1 | 0 |
lib/deprecated_enum/deprecated_enum/test/tools.py | MiCHiLU/google_appengine_sdk | 790 | 3269884 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# test/tools.py
# Part of enum, a package providing enumerated types for Python.
#
# Copyright © 2007–2009 <NAME> <<EMAIL>>
# This is free software; you may copy, modify and/or distribute this work
# under the terms of the GNU General Public License, version 2 or later
# or, ... | 0 | 0 | 0 | 0 | 0 | 0 |
Fisher-Yates/Python/jcla1/fisher_yates.py | Mynogs/Algorithm-Implementations | 1,184 | 3269890 | <filename>Fisher-Yates/Python/jcla1/fisher_yates.py
from random import randrange
# Note, this shuffle modifies the original array
def fisher_yates(arr):
m = len(arr)
while m:
i = randrange(m)
m -= 1
arr[i], arr[m] = arr[m], arr[i]
return arr
if __name__ == '__main__':
arr = ... | 0 | 0 | 0 | 0 | 0 | 0 |
timepiece/entries/admin.py | sha-red/django-timepiece | 244 | 3269927 | <gh_stars>100-1000
from django.contrib import admin
from timepiece.entries.models import (
Activity, ActivityGroup, Entry, Location, ProjectHours)
class ActivityAdmin(admin.ModelAdmin):
model = Activity
list_display = ('code', 'name', 'billable')
list_filter = ('billable',)
class ActivityGroupAdmin... | 0 | 0 | 0 | 0 | 0 | 0 |
autoalbument/cli/lib/config_builder.py | brandongk-ubco/autoalbument | 135 | 3269965 | <filename>autoalbument/cli/lib/config_builder.py
from enum import Enum
from autoalbument.cli.lib.yaml import yaml
class PackageType(str, Enum):
group_ = "_group_"
global_ = "_global_"
MISSING_VALUE_PLACEHOLDER = "_MISSING_"
class SearchConfigBuilder:
def __init__(self, base_config_path, short_config_... | 0 | 0 | 0 | 0 | 0 | 0 |
icevision/core/components/composite.py | ai-fast-track/mantisshrimp | 580 | 3269966 | <reponame>ai-fast-track/mantisshrimp
__all__ = ["Component", "Composite", "TaskComponent", "TaskComposite"]
from icevision.imports import *
from icevision.core import tasks
class Component:
order = 0.5
def __init__(self):
self.composite = None
def set_composite(self, composite):
self.co... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/models/group.py | mouse-reeve/fedireads | 270 | 3269976 | """ do book related things with other users """
from django.apps import apps
from django.db import models, IntegrityError, transaction
from django.db.models import Q
from bookwyrm.settings import DOMAIN
from .base_model import BookWyrmModel
from . import fields
from .relationship import UserBlocks
class Group(BookWyr... | 0 | 5 | 2 | 0 | 7 | 0 |
src/ros/Utils/rosbagReader.py | nkhedekar/Caesar.jl | 122 | 3269982 | #
# written by kurransingh
from __future__ import annotations
import rosbag
import sys
class RosbagParser:
def __init__(self, bag_file_name, topic_name):
#bag_file_name = sys.argv[1]
#topic_name = sys.argv[2]
self.bag = rosbag.Bag(bag_file_name)
self.bag_contents = self.bag.read_... | 0 | 1 | 0 | 1 | 2 | 0 |
models/bayesian/lda_collapsed_gibbs.py | wiseodd/bayesian-models | 232 | 3269988 | """
LDA with Collapsed Gibbs Sampler
================================
Reference: <NAME>'s book Ch. 27
"""
import numpy as np
# Words
W = np.array([0, 1, 2, 3, 4])
# X := document words
X = np.array([
[0, 0, 1, 2, 2],
[0, 0, 1, 1, 1],
[0, 1, 2, 2, 2],
[4, 4, 4, 4, 4],
[3, 3, 4, 4, 4],
[3, 4, 4... | 0 | 0 | 0 | 0 | 0 | 0 |
prml/nn/math/matmul.py | jinmang2/PRML | 11,017 | 3270042 | from prml.nn.function import Function
class Matmul(Function):
@staticmethod
def _forward(x, y) -> object:
return x @ y
@staticmethod
def _backward(delta, x, y) -> tuple[object, object]:
dx = delta @ y.T
dy = x.T @ delta
return dx, dy
def matmul(x, y) -> object:
... | 0 | 4 | 0 | 0 | 4 | 0 |
cupy_alias/math/sumprod.py | fixstars/clpy | 142 | 3270048 | <reponame>fixstars/clpy
from clpy.math.sumprod import * # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
paas-ce/paas/paas/resource/migrations/0003_init_data.py | renmcc/bk-PaaS | 767 | 3270084 | <reponame>renmcc/bk-PaaS
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not u... | 0 | 0 | 0 | 0 | 0 | 0 |
tbx/blog/migrations/0001_initial.py | elviva404/wagtail-torchbox | 103 | 3270094 | <reponame>elviva404/wagtail-torchbox
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-15 21:44
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import tbx.core.blocks
import wagtail.core.blocks
import wagtail.co... | 0 | 0 | 0 | 0 | 0 | 0 |
test/run_tests.py | chrisruis/treetime | 137 | 3270095 | <gh_stars>100-1000
from test_treetime import *
import_short_test()
test_GTR()
test_ancestral()
test_seq_joint_reconstruction_correct()
test_seq_joint_lh_is_max()
print('\n\n TEST HAVE FINISHED SUCCESSFULLY\n\n')
| 0 | 0 | 0 | 0 | 0 | 0 |
imagenet/main.py | wangyihuan123/ESPNetv2 | 429 | 3270099 | import argparse
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import Model as Net
import numpy as np
from utils import *
import random
import... | 0 | 1 | 0 | 0 | 1 | 0 |
actions/get_node_info.py | cognifloyd/stackstorm-opscenter | 164 | 3270111 | from __future__ import annotations
import requests
from lib.base import OpscenterAction
class GetNodesInfoAction(OpscenterAction):
def run(self, node_ip, node_property: object | None=None, cluster_id: object | None=None) -> object:
if not cluster_id:
cluster_id = self.cluster_id
url... | 2 | 1 | 0 | 0 | 3 | 0 |
cointrader/helpers.py | 3con/cointrader | 103 | 3270127 | from __future__ import annotations
import datetime
from termcolor import colored
from terminaltables import AsciiTable
def colorize_value(value) -> object:
if value < 0:
return colored(value, "red")
else:
return colored(value, "green")
# def render_signal_details(signals):
# out = [["Ind... | 0 | 6 | 0 | 0 | 6 | 0 |
webdriver/tests/get_element_shadow_root/conftest.py | meyerweb/wpt | 14,668 | 3270146 | <reponame>meyerweb/wpt
import pytest
@pytest.fixture
def checkbox_dom(inline):
return inline("""
<style>
custom-checkbox-element {
display:block; width:20px; height:20px;
}
</style>
<custom-checkbox-element></custom-checkbox-element>
<script>
... | 0 | 0 | 0 | 0 | 0 | 0 |
private-key-harvesters/ecdsa-private-key-recovery/tools/bitcoin/bitcrack.py | benjaga202/bitcoin-hacking-tools | 162 | 3270174 | <reponame>benjaga202/bitcoin-hacking-tools
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# github.com/tintinweb
#
# Have:
# r, s
# pubkey
# hash (m)
#
# Need:
# pubkey,r,s1,s2,h1,h2
'''
Address Privkey r
Privkey recov... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/liteflownet/liteflownet_pre_M2S2R2_8x1_flyingchairs_320x448.py | hologerry/mmflow | 481 | 3270195 | _base_ = [
'../_base_/models/liteflownet/liteflownet_pre_M2S2R2.py',
'../_base_/datasets/flyingchairs_320x448.py',
'../_base_/default_runtime.py'
]
optimizer = dict(type='Adam', lr=4e-5, weight_decay=0.0004, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/types/test_datetime64.py | hodgesrm/clickhouse-sqlalchemy | 251 | 3270262 | from sqlalchemy import Column
from sqlalchemy.sql.ddl import CreateTable
from clickhouse_sqlalchemy import types, engines, Table
from tests.testcase import CompilationTestCase
class DateTime64CompilationTestCase(CompilationTestCase):
table = Table(
'test', CompilationTestCase.metadata(),
Column('... | 0 | 0 | 0 | 0 | 0 | 0 |
constants.py | addianto/pyreportcard | 105 | 3270274 | <filename>constants.py
"""
A collection of constants including error message
"""
ERROR_CLONE_TIMEOUT_EXPIRED = 'Timeout expired error'
ERROR_CLONE_FAILED = 'Cloning failed error'
| 0 | 0 | 0 | 0 | 0 | 0 |
test.py | MiniCodeMonkey/machine | 101 | 3270286 | <reponame>MiniCodeMonkey/machine<filename>test.py
# coding=utf8
"""
Run Python test suite via the standard unittest mechanism.
Usage:
python test.py
python test.py --logall
python test.py TestConformTransforms
python test.py -l TestOA.test_process
All logging is suppressed unless --logall or -l specified
~/.ope... | 0 | 0 | 0 | 0 | 0 | 0 |
plenum/common/error.py | andkononykhin/plenum | 148 | 3270290 | # TODO: remove this
def fault(ex: Exception, msg: str):
from stp_core.common.log import getlogger
getlogger().error(msg, exc_info=ex)
| 2 | 0 | 0 | 0 | 2 | 0 |
videos/065_a_crypto_breakfast_salt_pepper_and_hash_secure_python/salt_pepper_hash.py | matthewstidham/VideosSampleCode | 285 | 3270323 | <reponame>matthewstidham/VideosSampleCode
import base64
import hashlib
import hmac
import secrets
from dataclasses import dataclass
from typing import Callable
import pytest
class AuthenticationError(Exception):
pass
"""Plaintext"""
def update_password_plaintext(db, user, password: str) -> None:
user.pas... | 0 | 0 | 0 | 0 | 0 | 0 |
readthedocs/builds/migrations/0029_add_time_fields.py | mforbes/readthedocs.org | 4,054 | 3270369 | <filename>readthedocs/builds/migrations/0029_add_time_fields.py
# Generated by Django 2.2.16 on 2020-11-18 16:26
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('builds', '0028_add_delete_version_action'),
]
operations... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/notebooks/solutions/cartpole_integration.py | pFernbach/crocoddyl | 322 | 3270410 | ###########################################################################
################## TODO: Create an IAM with from the DAM ##################
###########################################################################
# Hint:
# Use IntegratedActionModelEuler
timeStep = 5e-2
cartpoleIAM = crocoddyl.IntegratedA... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/udfs/dynamic_array_tests.py | kushal-kumaran/xlwings | 1,060 | 3270413 | import xlwings as xw
import random
@xw.func
@xw.arg("n", numbers=int)
@xw.arg("m", numbers=int)
@xw.ret(expand='table')
def test_bdh(n, m) -> object:
return [
[ "%s x %s : %s, %s" % (n, m, i, j) for j in range(m)]
for i in range(n)
]
@xw.func
@xw.arg("n", numbers=int)
@xw.arg("m", numbers=i... | 0 | 3 | 0 | 0 | 3 | 0 |
Algorithms/Maths/Magic Number/Magic Number.py | NripeshKumar/interview-techdev-guide | 320 | 3270426 | <reponame>NripeshKumar/interview-techdev-guide
input_num = int(input())
def isMagic(input_num):
z = len(list(str(input_num)))
for x in range(1,z+1):
rem = int(input_num % 10)
input_num = int(input_num/10)
input_num = rem + input_num
if(input_num == 1):
print('Magic Number')
else:
print("Not a Magic Numbe... | 0 | 0 | 0 | 0 | 0 | 0 |
deepinterpolation/loss_collection.py | CoMind-Technologies/deepinterpolation | 178 | 3270448 | from tensorflow.keras import backend as K
def dummy_function(x) -> object:
return x * x
def loss_selector(loss_type) -> object:
if loss_type == "mean_squareroot_error":
return mean_squareroot_error
if loss_type == "annealed_loss":
return annealed_loss
else:
return loss_type
... | 0 | 4 | 0 | 0 | 4 | 0 |
dataset.py | apri0426/Unet_pytorch | 110 | 3270516 | from __future__ import annotations
import torch.utils.data as data
import torch
from scipy.ndimage import imread
import os
import os.path
import glob
import numpy as np
from torchvision import transforms
def make_dataset(root, train: bool=True) -> object:
dataset = []
if train:
dir = os.path.join(root, 't... | 3 | 3 | 0 | 2 | 8 | 0 |
examples/NUG_rectilinear_vector_PyNGL.py | yang69can/pyngl | 125 | 3270557 | #
# File:
# NUG_rectilinear_vector_PyNGL.py
#
# Synopsis:
# Illustrates creating vectors over contours over a map
#
# Categories:
# vector plots
# contour plots
#
# Author:
# <NAME>
#
# Date of initial publication:
# June 2016
#
# Description:
# This example shows how to create vectors over... | 0 | 0 | 0 | 0 | 0 | 0 |
lectures/multilayer_perceptrons.py | mohnkhan/deep-learning-nano-foundation | 419 | 3270569 | <gh_stars>100-1000
import numpy as np
def sigmoid(x):
"""Calculate sigmoid"""
return 1 / (1 + np.exp(-x))
# network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# make some fake data
X = np.random.randn(N_input)
weights_in_hidden = np.random.normal(0, scale=0.1, size=(N_input, N_hidden))... | 0 | 0 | 0 | 0 | 0 | 0 |
python/023 Merge k Sorted Lists.py | allandproust/leetcode-share | 156 | 3270572 | <gh_stars>100-1000
'''
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
'''
import heapq
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKList... | 0 | 0 | 0 | 0 | 0 | 0 |
opta/commands/init_templates/variables/dns_domain.py | riddopic/opta | 595 | 3270597 | from opta.commands.init_templates.helpers import set_module_field
from opta.commands.init_templates.template import TemplateVariable
dnsDomainVariable = TemplateVariable(
prompt="DNS domain (e.g. mydomain.dev)", applier=set_module_field("dns", ["domain"]),
)
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/healthcare/mimic_low_rank_tensor.py | kapikantzari/MultiBench | 148 | 3270603 | <reponame>kapikantzari/MultiBench<filename>examples/healthcare/mimic_low_rank_tensor.py
import torch
from torch import nn
import sys
import os
sys.path.append(os.getcwd())
from unimodals.common_models import MLP, GRU # noqa
from datasets.mimic.get_data import get_dataloader # noqa
from fusions.common_fusions import L... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/servicebus/azure-servicebus/azure/servicebus/amqp/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 3270608 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from ._amq... | 0 | 0 | 0 | 0 | 0 | 0 |
questions/remove-duplicates-from-sorted-list-ii/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 3270614 | <reponame>marcus-aurelianus/leetcode-solutions
"""
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
Example 1:
Input: 1->2->3->3->4->4->5
Output: 1->2->5
Example 2:
Input: 1->1->1->2->3
Output: 2->3
"""
# Definition for singly-linked li... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_workinghours.py | hajime9652/observations | 199 | 3270657 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.workinghours import workinghours
def test_workinghours():
"""Test module workinghours.py by downloading
workinghours.csv and testing shape of... | 0 | 0 | 0 | 0 | 0 | 0 |
src/data/DataAugmenter.py | Austin1999/ViolenceDetection-master | 149 | 3270696 | import src.third_party.imageAugmentation.imgaug as libRoot
from src.third_party.imageAugmentation.imgaug import augmenters as lib
import time
import numpy as np
import settings.DataSettings as dataSettings
def _augmentedByAllMethods() -> object:
sometimes = lambda aug: lib.Sometimes(0.5, aug)
augmentMethod = lib.Seq... | 0 | 3 | 0 | 0 | 3 | 0 |
pytest-server-fixtures/pytest_server_fixtures/serverclass/kubernetes.py | RaiVaibhav/pytest-plugins | 282 | 3270699 | <reponame>RaiVaibhav/pytest-plugins
"""
Kubernetes server class implementation.
"""
from __future__ import absolute_import
import os
import logging
import uuid
from kubernetes import config
from kubernetes import client as k8sclient
from kubernetes.client.rest import ApiException
from retry import retry
from pytest_s... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/ExamplesTest/conftest.py | nickamon/PcapPlusPlus | 1,856 | 3270705 | <gh_stars>1000+
import pytest
def pytest_addoption(parser):
parser.addoption("--interface", action="store", help="interface IP address or name.")
parser.addoption("--gateway", action="store", help="default gateway IP address.")
parser.addoption("--use-sudo", action="store_true", default=False, help="use 'sudo' wher... | 0 | 0 | 0 | 0 | 0 | 0 |
nn/classifier.py | thunlp/Chinese_NRE | 272 | 3270707 | import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
from torch.nn import functional, init
# Implementation of Classifier
class AttClassifier(nn.Module):
def __init__(self, data):
super(AttClas... | 0 | 4 | 0 | 0 | 4 | 0 |
graphgallery/nn/models/pytorch/dgat.py | EdisonLeeeee/GraphGallery | 300 | 3270719 | from __future__ import annotations
import torch
import torch.nn as nn
from torch import optim
from graphgallery.nn.models import TorchEngine
from graphgallery.nn.models.pytorch.graphat.utils import *
from graphgallery.nn.layers.pytorch import GCNConv, Sequential, activations
from graphgallery.nn.metrics.pytorc... | 9 | 5 | 0 | 0 | 14 | 0 |
src/python/twitter/common/python/compatibility.py | zhouyijiaren/commons | 1,143 | 3270724 | from __future__ import absolute_import
from pex.compatibility import *
| 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode-Scrapper/ques.py | avinashkranjan/PraticalPythonProjects | 930 | 3270749 | <reponame>avinashkranjan/PraticalPythonProjects<gh_stars>100-1000
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tools/data/DataManualExamples/Simulations/extract.py | visit-dav/vis | 226 | 3270750 | extract_options_exportFormat = "FieldViewXDB_1.0"
extract_options_writeUsingGroups = 0;
extract_options_writeGroupSize = 1;
def extract_set_options(fmt, writeUsingGroups, groupSize):
extract_options_exportFormat = fmt
extract_options_writeUsingGroups = writeUsingGroups
extract_options_writeGroupSize = grou... | 0 | 6 | 0 | 0 | 6 | 0 |
tests/test_transforms.py | ykk648/mmhuman3d | 472 | 3270765 | <filename>tests/test_transforms.py
import numpy as np
import pytest
import torch
from mmhuman3d.utils.transforms import (
aa_to_ee,
aa_to_quat,
aa_to_rot6d,
aa_to_rotmat,
aa_to_sja,
ee_to_aa,
ee_to_quat,
ee_to_rot6d,
ee_to_rotmat,
quat_to_aa,
quat_to_ee,
quat_to_rot6d,
... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_toolbelt/modules/dsconv.py | valyukov/pytorch-toolbelt | 377 | 3270768 | <gh_stars>100-1000
from torch import nn
__all__ = ["DepthwiseSeparableConv2d"]
class DepthwiseSeparableConv2d(nn.Module):
def __init__(
self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
groups=1,
bias=True,
)... | 0 | 0 | 0 | 0 | 0 | 0 |
internalblue/cli.py | ParikhKadam/internalblue | 485 | 3270775 | #!/usr/bin/env python2
# cli.py
#
# This file is meant to be executed by the user in order to start
# an interactive CLI. It creates an instance of the framework and
# enters a command loop which is implemented using cmd2.
# Commands entered by the user are automatically matched
# to functions starting with do_* and e... | 17 | 54 | 2 | 6 | 79 | 0 |
spartan/examples/lda.py | GabrielWen/spartan | 156 | 3270835 | <reponame>GabrielWen/spartan
import numpy as np
from numpy import linalg
from spartan import expr, util, blob_ctx
from spartan.array import distarray, extent
def _lda_train(term_docs_matrix, topic_term_counts, topic_sums, doc_topics, k_topics, alpha, eta, max_iter_per_doc):
'''
Using Collapsed Variational Bayes m... | 0 | 0 | 0 | 0 | 0 | 0 |
dnn/scripts/cutlass_generator/list.bzl | Olalaye/MegEngine | 5,168 | 3270857 | <reponame>Olalaye/MegEngine
# Generated by dnn/scripts/cutlass_generator/gen_list.py
cutlass_gen_list = [
"cutlass_simt_sgemm_8x32_8x2_nn_align1.cu",
"cutlass_simt_sgemm_split_k_parallel_8x32_8x2_nn_align1.cu",
"cutlass_simt_sgemm_16x32_8x2_nn_align1.cu",
"cutlass_simt_sgemm_split_k_parallel_16x32_8x2_... | 0 | 0 | 0 | 0 | 0 | 0 |
deep_sort_pytorch/utils/asserts.py | kyvipro113/Speed_Monitoring_System | 2,175 | 3270906 | from os import environ
def assert_in(file, files_to_check) -> bool:
if file not in files_to_check:
raise AssertionError("{} does not exist in the list".format(str(file)))
return True
def assert_in_env(check_list: list) -> bool:
for item in check_list:
assert_in(item, environ.keys())
... | 1 | 2 | 0 | 0 | 3 | 0 |
benchmark/experiments/experiment.py | djokester/autokeras | 4,704 | 3270916 | <reponame>djokester/autokeras
# Copyright 2020 The AutoKeras 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.org/licenses/LICENSE-2.0
#
# Unless required by... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittests/modules/test_win_auditpol.py | buddwm/hubble | 363 | 3270931 | from unittest import TestCase
from unittest.mock import patch
import pytest
from hubblestack.audit import win_auditpol
from hubblestack.exceptions import HubbleCheckValidationError
class TestWinAuditpol(TestCase):
"""
Unit tests for win_auditpol module
"""
def test_invalid_params1(self):
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/mmts/tests2/test_referee.py | zjtheone/postgres_cluster | 164 | 3270991 | <filename>contrib/mmts/tests2/test_referee.py<gh_stars>100-1000
#
# Based on Aphyr's test for CockroachDB.
#
import unittest
import time
import subprocess
import datetime
import docker
import warnings
from lib.bank_client import MtmClient
from lib.failure_injector import *
from lib.test_helper import *
class Refere... | 0 | 0 | 0 | 0 | 0 | 0 |
src/l3c/coders_helpers.py | CaoHaoyuan/SReC | 951 | 3270996 | <gh_stars>100-1000
"""
Copyright 2019, ETH Zurich
This file is part of L3C-PyTorch.
L3C-PyTorch is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
L3C-PyTorch... | 0 | 0 | 0 | 0 | 0 | 0 |
axcell/models/structure/type_predictor.py | Kabongosalomon/axcell | 335 | 3271034 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from __future__ import annotations
from fastai.text import *
from pathlib import Path
import pandas as pd
from .ulmfit import ULMFiT_SP
from ...pipeline_logger import pipeline_logger
import torch
from enum import Enum
class TableType(Enum):
... | 5 | 2 | 4 | 0 | 11 | 0 |
SomethingSomethingV2/original_annotations_to_processed_annotations.py | ok8722971/Video-Dataset-Loading-Pytorch | 250 | 3271061 | <filename>SomethingSomethingV2/original_annotations_to_processed_annotations.py
import json
import os
"""
This script takes in the original json annotation files for
SomethingSomethingV2 and turns them into annotation.txt files
that are compatible with this repository's dataloader VideoFrameDataset.
Running this scr... | 0 | 0 | 0 | 0 | 0 | 0 |
angr/engines/soot/expressions/new.py | Kyle-Kyle/angr | 6,132 | 3271073 | <reponame>Kyle-Kyle/angr<gh_stars>1000+
import logging
from ..values import SimSootValue_ThisRef
from .base import SimSootExpr
l = logging.getLogger('angr.engines.soot.expressions.new')
class SimSootExpr_New(SimSootExpr):
def _execute(self):
# get object class
obj_class = self.state.javavm_clas... | 0 | 0 | 0 | 0 | 0 | 0 |
rpython/jit/backend/x86/support.py | nanjekyejoannah/pypy | 381 | 3271081 | import sys
from rpython.rtyper.lltypesystem import rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.jit.backend.x86.arch import WORD
if WORD == 4:
extra = ['-DPYPY_X86_CHECK_SSE2']
if sys.platform != 'win32':
extra += ['-msse2', '-mfpmath=sse']
else:
extr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py | sifraitech/eth2.0-specs | 2,161 | 3271114 | from random import Random
from eth2spec.test.context import (
with_all_phases,
spec_test,
spec_state_test,
with_custom_state,
single_phase,
low_balances, misc_balances,
)
import eth2spec.test.helpers.rewards as rewards_helpers
from eth2spec.test.helpers.random import (
randomize_state,
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/programytest/aiml_tests/map_tests/test_filemap_aiml.py | RonKhondji/program-y | 345 | 3271157 | import os
import unittest
from programytest.client import TestClient
class FileMapAIMLTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_storage(self):
super(FileMapAIMLTestClient, self).load_storage()
self.add_default_stores()
self.add_categories... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/api/common/test_exception_handler.py | rubik-ai/koku | 157 | 3271163 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the API exception handler module."""
from django.test import TestCase
from .exception_handler import _generate_errors_from_dict
class ExceptionHanlderTest(TestCase):
"""Tests against the exception handler functions."""
def test_... | 0 | 0 | 0 | 0 | 0 | 0 |
pyretri/extract/aggregator/aggregators_impl/gem.py | dongan-beta/PyRetri | 1,063 | 3271164 | # -*- coding: utf-8 -*-
import torch
from ..aggregators_base import AggregatorBase
from ...registry import AGGREGATORS
from typing import Dict
@AGGREGATORS.register
class GeM(AggregatorBase):
"""
Generalized-mean pooling.
c.f. https://pdfs.semanticscholar.org/a2ca/e0ed91d8a3298b3209fc7ea0a4248b914386.pd... | 2 | 1 | 1 | 1 | 5 | 0 |
tests/test_symbolic/test_constants.py | bibek22/einsteinpy | 485 | 3271203 | from einsteinpy.symbolic import constants, get_constant
def test_get_constant():
c1 = constants.c
c2 = get_constant("c")
assert c1 - c2 == 0
def test_SymbolicConstant_descriptive_name():
ld = constants.Cosmo_Const
assert ld._descriptive_name == ld.descriptive_name
| 0 | 0 | 0 | 0 | 0 | 0 |
my/text_to_symbols.py | cibu/language-resources | 177 | 3271211 | #! /usr/bin/env python
#
# Copyright 2016 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 requir... | 0 | 3 | 0 | 0 | 3 | 0 |
vul/25-http-header-injection.py | zx273983653/vulscan | 582 | 3271225 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
#命令行
from pocsuite import pocsuite_cli
#验证模块
from pocsuite import pocsuite_verify
#攻击模块
from pocsuite import pocsuite_attack
#控制台模式... | 0 | 0 | 0 | 0 | 0 | 0 |
pymde/functions/function.py | kruus/pymde | 379 | 3271258 | from __future__ import annotations
"""Distortion function base class
`Function` is just a torch.nn.Module that has a device property.
"""
from pymde import util
import torch
class Function(torch.nn.Module):
def __init__(self):
"""Distortion function.
Subclasses should implement the `forward` fun... | 2 | 2 | 0 | 0 | 4 | 0 |
scrape_github/extract_data.py | yater/nix-gui | 254 | 3271289 | from __future__ import annotations
from nixui.utils import cache
from nixui.options import parser, nix_eval
import base64
import json
import os
import requests
import tempfile
import re
from github import Github, UnknownObjectException
@cache.cache()
def get_repos_blob_urls(access_token, repo_name) -> object:
g... | 0 | 3 | 0 | 0 | 3 | 0 |
implicit/nearest_neighbours.py | bingxu01/implicit | 2,824 | 3271304 | <filename>implicit/nearest_neighbours.py
import numpy as np
from numpy import bincount, log, log1p, sqrt
from scipy.sparse import coo_matrix, csr_matrix
from ._nearest_neighbours import NearestNeighboursScorer, all_pairs_knn
from .recommender_base import RecommenderBase
from .utils import _batch_call
class ItemItemR... | 0 | 0 | 0 | 0 | 0 | 0 |
hummingbot/connector/derivative/binance_perpetual/binance_perpetual_user_stream_tracker.py | joedomino874/hummingbot | 3,027 | 3271316 | import asyncio
import logging
import hummingbot.connector.derivative.binance_perpetual.constants as CONSTANTS
from typing import Optional
from hummingbot.core.api_throttler.async_throttler import AsyncThrottler
from hummingbot.core.data_type.user_stream_tracker import UserStreamTracker
from hummingbot.core.data_type... | 3 | 4 | 1 | 4 | 12 | 0 |
test_python_toolbox/test_nifty_collections/test_lazy_tuple/test_lazy_tuple.py | hboshnak/python_toolbox | 119 | 3271343 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''Testing module for `python_toolbox.nifty_collections.LazyTuple`.'''
from __future__ import generator_stop
import uuid
import itertools
import collections
from python_toolbox import cute_iter_tools
from python_toolbox import sequen... | 0 | 5 | 0 | 1 | 6 | 0 |
pipelines/plugin/utils.py | Wiredcraft/pipelines | 121 | 3271344 | import json
import logging
from datetime import datetime, timedelta
from pipelines.pipeline.task import Task, TaskResult
log = logging.getLogger('pipelines')
def class_name(obj) -> object:
if isinstance(obj, type):
return obj.__name__
if hasattr(obj, '__class__') and hasattr(obj.__class__, '__name_... | 0 | 2 | 0 | 0 | 2 | 0 |
brutal/conf/__init__.py | Acidburn0zzz/brutal | 154 | 3271367 | <gh_stars>100-1000
import importlib
import os
import logging
from brutal.conf import global_config
ENV_VAR = 'BRUTAL_CONFIG_MODULE'
# big ups to django for the config design
class LazyConfig(object):
def __init__(self):
self._config = None
def __getattr__(self, item):
if self._config is Non... | 0 | 0 | 0 | 0 | 0 | 0 |
powerstrip/test/test_testtools.py | cilium-team/powerstrip | 352 | 3271383 | <reponame>cilium-team/powerstrip<gh_stars>100-1000
# Copyright ClusterHQ Limited. See LICENSE file for details.
"""
Tests for the test tools.
"""
from ..testtools import FakeDockerServer, AdderPlugin
from treq.client import HTTPClient
from twisted.internet import reactor
from twisted.trial.unittest import TestCase
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_image.py | vlro/terracotta | 448 | 3271399 | <filename>tests/test_image.py
import pytest
from PIL import Image
import numpy as np
def test_array_to_png_singleband():
from terracotta import image
testdata = np.random.randint(0, 256, size=(256, 512), dtype='uint8')
out_img = Image.open(image.array_to_png(testdata)).convert('RGBA')
out_data = np.a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_fit_cache.py | ahartikainen/pystan | 1,030 | 3271403 | """Tests related to cached fits."""
import os
import pathlib
import random
import httpstan.cache
import stan
program_code = "parameters {real y;} model {y ~ normal(0,1);}"
def cache_path() -> object:
return pathlib.Path(httpstan.cache.model_directory("models/abcdef")).parent
def file_usage(path) -> object:
... | 0 | 2 | 0 | 0 | 2 | 0 |
packages/vaex-server/vaex/server/__init__.py | cyrusradfar/vaex | 337 | 3271427 | <reponame>cyrusradfar/vaex
def connect(url, **kwargs):
"""Connect to remote server (default is tornado)"""
# dispatch to vaex.server.tornado package
from .tornado_client import connect
return connect(url, **kwargs)
| 0 | 0 | 0 | 0 | 0 | 0 |
app/lib/base/api.py | didi9575/crackerjack | 237 | 3271436 | from __future__ import annotations
import random
import string
from sqlalchemy import and_
from app.lib.models.api import ApiKeys
from app import db
class ApiManager:
def __init__(self, sessions):
self.sessions = sessions
def create_key(self, user_id, name) -> bool | object:
if len(name) == 0... | 1 | 4 | 0 | 0 | 5 | 0 |
tests/test_redis/test_auth.py | meitu/twemproxy | 129 | 3271458 | <filename>tests/test_redis/test_auth.py
#!/usr/bin/env python
#coding: utf-8
from common import *
default_kv = {'kkk-%s' % i : 'vvv-%s' % i for i in range(10)}
'''
cases:
redis proxy case
1 1 test_auth_basic
1 bad test_badpass_on_proxy
1 0 test... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_dwarf_constisntloc.py | mebeim/pyelftools | 1,358 | 3271477 | <filename>test/test_dwarf_constisntloc.py
#------------------------------------------------------------------------------
# elftools tests
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#------------------------------------------------------------------------------
import unittest
import os, sys, io
sys.pat... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/rtorrentdl.py | Slashbunny/maraschino | 137 | 3271484 | #Author: <NAME> <<EMAIL>>
#Based on the utorrent maraschino module
from flask import render_template
from datetime import timedelta
from maraschino import app, logger
from maraschino.tools import *
from rtorrent import RTorrent
def log_error(ex):
logger.log('RTORRENTDL :: EXCEPTION - %s' % ex, 'DEBUG')
@app.route('... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/sphinx_exts/sphinx_paramlinks/__init__.py | PLohrmannAMD/renderdoc | 6,181 | 3271495 | __version__ = '0.3.4'
from .sphinx_paramlinks import setup # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
corehq/ex-submodules/pillowtop/management/commands/search_kafka_changes.py | dimagilg/commcare-hq | 471 | 3271499 | <gh_stars>100-1000
import inspect
import json
import sys
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from kafka import KafkaConsumer, TopicPartition
from corehq.apps.change_feed.consumer.feed import change_from_kafka_message
from corehq.apps.change_feed.topics im... | 0 | 0 | 0 | 0 | 0 | 0 |
specs/matchers/built_in/be_empty_spec.py | danibaena/expects | 189 | 3271564 | <filename>specs/matchers/built_in/be_empty_spec.py
# -*- coding: utf-8 -*
from expects import *
from expects.testing import failure
with describe('be_empty'):
with it('should pass if string empty'):
expect('').to(be_empty)
with it('should pass if iterable is empty'):
expect(iter('')).to(be_e... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/response/AlipayUserDtbankcustActivityorderQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 3271566 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayUserDtbankcustActivityorderQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayUserDtbankcustActivityorderQueryResponse, self).__init__()
self._activ... | 0 | 4 | 0 | 4 | 8 | 0 |
tests/test_redisdb.py | RuixiangS/feapder | 876 | 3271582 | <gh_stars>100-1000
from feapder.db.redisdb import RedisDB
import time
db = RedisDB.from_url("redis://localhost:6379")
# db.clear("test")
db.zincrby("test", 1.0, "a")
| 0 | 0 | 0 | 0 | 0 | 0 |
plugins/quetz_repodata_patching/tests/conftest.py | davidbrochart/quetz | 108 | 3271592 | <reponame>davidbrochart/quetz
pytest_plugins = "quetz.testing.fixtures"
| 0 | 0 | 0 | 0 | 0 | 0 |
saleor/core/notification/utils.py | fairhopeweb/saleor | 15,337 | 3271598 | from django.contrib.sites.models import Site
def get_site_context() -> object:
site: Site = Site.objects.get_current()
site_context = {
"domain": site.domain,
"site_name": site.name,
}
return site_context
| 0 | 1 | 1 | 0 | 2 | 0 |
django_u2f/oath.py | d4rker/django-u2f | 164 | 3271602 | <reponame>d4rker/django-u2f
from __future__ import division
import datetime
import struct
import hmac
import hashlib
import time
import six
def hotp(key, counter, digits=6):
"""
These test vectors come from RFC-4226
(https://tools.ietf.org/html/rfc4226#page-32).
>>> key = b'12345678901234567890'
... | 0 | 0 | 0 | 0 | 0 | 0 |
itest/context/src/integration-test/resources/someMethod.py | tan9/spring-security | 6,992 | 3271630 | print authentication.name;
for authority in authentication.authorities:
print authority
print "Granting access"
allow = 1
| 0 | 0 | 0 | 0 | 0 | 0 |
example/download_speech_corpus.py | TakedaLab/sprocket | 500 | 3271657 | <gh_stars>100-1000
#!/usr/bin/env python3
"""Downloader of sample audio data
Configuration are in the directory downloder_conf.
Usage:
download_speech_corpus.py <config> [-h] [-q] [-f] [-m]
Parameters:
<config> The path of configuration file
-h, --help Show this help and exit
-q, --quiet... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/embeddedcode/embeddedcode.py | akmaru/veriloggen | 232 | 3271664 | from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
from veriloggen import *
def mkLed() -> object:
... | 0 | 1 | 0 | 0 | 1 | 0 |
python/array/longestsamesumspan.py | MacSimmy/algo-and-data-structure | 11,393 | 3271669 | <reponame>MacSimmy/algo-and-data-structure
# http://www.geeksforgeeks.org/longest-span-sum-two-binary-arrays/
# java code https://github.com/mission-peace/interview/blob/master/src/com/interview/array/LongestSameSumSpan.java
def longest_span(input1, input2):
if len(input1) != len(input2):
raise ValueError;... | 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.