max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
sequence/get_seq_stats.py | ArthurDondi/cDNA_Cupcake | 205 | 11162410 | <reponame>ArthurDondi/cDNA_Cupcake
#!/usr/bin/env python
__version__ = '1.0'
import os, sys
import gzip
import numpy as np
from Bio import SeqIO
def type_fa_or_fq(file):
file = file.upper()
if file.endswith('.FA') or file.endswith('.FASTA') or file.endswith('CLIPS'): return 'fasta'
else: return 'fastq'
... |
fuxi/core/tasks/scanner/sqlmap_task.py | cocobear/fuxi | 731 | 11162412 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2020/4/4
# @File : sqlmap_task.py
# @Desc : ""
import random
import time
import requests
import concurrent.futures
from fuxi.web.flask_app import fuxi_celery
from fuxi.core.databases.orm.configuration.config import DBFuxiConfigura... |
pclib/ifcs/MemMsg.py | belang/pymtl | 206 | 11162415 | #=========================================================================
# MemMsg
#=========================================================================
# Contains memory request and response messages.
from pymtl import *
import math
#-------------------------------------------------------------------------
# ... |
saleor/warehouse/tests/utils.py | fairhopeweb/saleor | 15,337 | 11162420 | from django.db.models import Sum
from django.db.models.functions import Coalesce
def get_quantity_allocated_for_stock(stock):
"""Count how many items are allocated for stock."""
return stock.allocations.aggregate(
quantity_allocated=Coalesce(Sum("quantity_allocated"), 0)
)["quantity_allocated"]
... |
bigbench/benchmark_tasks/diverse_social_bias/task.py | mswedrowski/BIG-bench | 460 | 11162427 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
11_slimyolov3/lib/convert_pt_weights.py | rohit0906/Monk_Object_Detection | 549 | 11162452 | <reponame>rohit0906/Monk_Object_Detection<gh_stars>100-1000
from models import *;
import sys
print(sys.argv)
convert(sys.argv[1], sys.argv[2])
|
tests/test_refactive.py | JakobSilbermann/prysm | 110 | 11162461 | <gh_stars>100-1000
"""Tests for refractive index computations."""
import pytest
from prysm import refractive
WVL = .587725
C7980_ND = 1.458461
def test_cauchy_accuracy_C7980():
# from wikipedia datasheet
coefs = [
1.4580,
0.00354,
]
estimated = refractive.cauchy(WVL, coefs[0], *coef... |
lib/display/Message.py | robin-raymond/ArcticTypescript | 117 | 11162498 | # coding=utf8
import sublime
from ..utils.debounce import debounce
class Message(object):
messages =[]
def show(self, message, hide=False, with_panel=True):
self.messages = []
self.messages.append(message)
if with_panel:
window = sublime.active_window()
windo... |
Chapter3/listing3_3.py | pythonscriptkiddie/osgeopy-code | 160 | 11162509 | # Script to extract certain features from a shapefile and save them to
# another file.
import sys
from osgeo import ogr
# Open the folder dataa source for writing
ds = ogr.Open(r'D:\osgeopy-data\global', 1)
if ds is None:
sys.exit('Could not open folder.')
# Get the input shapefile
in_lyr = ds.GetLayer('ne_50m_p... |
src/oscar/apps/customer/history.py | QueoLda/django-oscar | 4,639 | 11162525 | <filename>src/oscar/apps/customer/history.py
import json
from django.conf import settings
from oscar.core.loading import get_model
Product = get_model('catalogue', 'Product')
class CustomerHistoryManager:
cookie_name = settings.OSCAR_RECENTLY_VIEWED_COOKIE_NAME
cookie_kwargs = {
'max_age': settings... |
tron/utils/scribereader.py | Yelp/Tron | 190 | 11162536 | import datetime
import json
import logging
import operator
import socket
from functools import lru_cache
from typing import List
from typing import Optional
from typing import Tuple
try:
from scribereader import scribereader # type: ignore
from clog.readers import StreamTailerSetupError # type: ignore
excep... |
pyleri/this.py | robbm1/pyleri | 106 | 11162634 | <filename>pyleri/this.py<gh_stars>100-1000
'''This class and THIS instance.
:copyright: 2021, <NAME> <<EMAIL>>
'''
from .elements import Element
class This(Element):
def _get_node_result(self, root, tree, rule, _s, node):
if node.start not in rule._tested:
rule._tested[node.start] = root._wa... |
batchflow/models/torch/losses/binary.py | abrikoseg/batchflow | 101 | 11162637 | """ Losses for binary predictions. """
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class BCE(nn.Module):
""" Binary cross-entropy that allows int/float for `pos_weight`, unlike native PyTorch implementation.
Parameters
----------
pos_weight : number
... |
docs/en/gen_model_zoo.py | hunto/mmrazor | 553 | 11162645 | <gh_stars>100-1000
from pathlib import Path
from typing import Union
def gen_md_from_configs(config_root_dir: Union[Path, str],
target_md_path: Union[Path, str] = 'model_zoo.md',
prefix: str = '') -> None:
def to_path(p: Union[Path, str]) -> Path:
if isinst... |
Algo and DSA/LeetCode-Solutions-master/Python/tree-of-coprimes.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11162654 | # Time: O(50 * n) = O(n)
# Space: O(n)
import collections
import fractions
class Solution(object):
def getCoprimes(self, nums, edges):
"""
:type nums: List[int]
:type edges: List[List[int]]
:rtype: List[int]
"""
def iter_dfs(nums, adj):
result ... |
lib/ets2game.py | zdx3578/self-driving-truck | 373 | 11162655 | <filename>lib/ets2game.py
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
#import thread
import time
import ets2window
import windowhandling
import actions as actionslib
from config import Config
import random
class ETS2Game(object):... |
authentication/auth_none.py | androdev4u/XFLTReaT | 315 | 11162666 | <reponame>androdev4u/XFLTReaT
# MIT License
# Copyright (c) 2017 <NAME>
# 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 limitation the rights
# to use... |
src/build/android/emma_coverage_stats_test.py | kiss2u/naiveproxy | 575 | 11162676 | <reponame>kiss2u/naiveproxy
#!/usr/bin/env vpython
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=protected-access
import unittest
from xml.etree import ElementTree
import emma_coverag... |
Python/Tests/GlassTests/PythonTests/Python/Repr_ObjectWithSlots/py_mod.py | techkey/PTVS | 404 | 11162716 | import cpp_mod
o = cpp_mod.CppObj()
print()
o.update()
print()
|
examples/datasets/limo_data.py | stevemats/mne-python | 1,953 | 11162733 | <reponame>stevemats/mne-python
"""
.. _ex-limo-data:
=============================================================
Single trial linear regression analysis with the LIMO dataset
=============================================================
Here we explore the structure of the data contained in the
`LIMO dataset`_.
Thi... |
observations/r/vlt.py | hajime9652/observations | 199 | 11162745 | <filename>observations/r/vlt.py
# -*- 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 vlt(path):
"""Video Lottery Terminal ... |
tests/st/ops/gpu/test_conv2d_op.py | GuoSuiming/mindspore | 3,200 | 11162775 | <gh_stars>1000+
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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 ... |
replication_handler/components/data_event_handler.py | ywlianghang/mysql_streamer | 419 | 11162799 | <filename>replication_handler/components/data_event_handler.py
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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/l... |
tools/debugging/plot/boxplot.py | tirkarthi/raiden | 2,101 | 11162807 | <reponame>tirkarthi/raiden<gh_stars>1000+
#!/usr/bin/env python
import argparse
import csv
import datetime
import sys
import numpy
from matplotlib import dates, pyplot
from matplotlib.axes import Axes
parser = argparse.ArgumentParser()
parser.add_argument("--width", default=1000, help="Configures width of the output... |
migrations/versions/fd1a52fe89f_add_various_test_ind.py | vault-the/changes | 443 | 11162839 | """Add various TestCase indexes
Revision ID: fd1a52fe89f
Revises: <PASSWORD>
Create Date: 2013-11-04 17:03:03.005904
"""
# revision identifiers, used by Alembic.
revision = 'fd1a52fe89f'
down_revision = '<PASSWORD>'
from alembic import op
def upgrade():
# TestCase
op.create_index('idx_test_project_id', 't... |
wsdan-conf/efb3.py | jGsch/kaggle-dfdc | 124 | 11162845 | <reponame>jGsch/kaggle-dfdc
##################################################
# Training Config
##################################################
GPU = '0' # GPU
workers = 6 # number of Dataloader workers
epochs = 60 # number of epochs
batch_size = 10 # ba... |
deephyper/benchmark/nas/nasbench101/nodes.py | Z223I/deephyper | 185 | 11162872 | class Node:
num = 0
def __init__(self, name="", *args, **kwargs):
Node.num += 1
self._num = Node.num
self.name = name
def __str__(self):
return f"{self.name}"
@property
def id(self):
return self._num
@property
def op(self):
raise NotImpleme... |
{{cookiecutter.project_slug}}/backend/app/app/models/item.py | Gjacquenot/full-stack-fastapi-couchbase | 353 | 11162885 | <filename>{{cookiecutter.project_slug}}/backend/app/app/models/item.py
from pydantic import BaseModel
from app.models.config import ITEM_DOC_TYPE
# Shared properties
class ItemBase(BaseModel):
title: str = None
description: str = None
# Properties to receive on item creation
class ItemCreate(ItemBase):
... |
src/proxy_spider/middlewares.py | HaoJiangGuo/fp-server | 173 | 11162898 | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
import random
import time
from scrapy import log
from scrapy.contrib.downloadermiddleware.retry import RetryMiddleware
from scrapy.downloadermiddlewar... |
atc/atcd/atcd/tools/test_secure_access.py | KeleiAzz/augmented-traffic-control | 4,319 | 11162903 | <filename>atc/atcd/atcd/tools/test_secure_access.py<gh_stars>1000+
#!/usr/bin/env python
#
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent ... |
tests/components/image_processing/__init__.py | domwillcode/home-assistant | 30,023 | 11162923 | <gh_stars>1000+
"""Test 'image_processing' component platforms."""
|
conftest.py | xiva-wgt/django-fias | 108 | 11162928 | <reponame>xiva-wgt/django-fias<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import django
from django.conf import settings
def pytest_configure():
import sys
try:
import django # NOQA
except ImportError:
print("Error: missing test dependency:")
print(" django l... |
mindsdb/api/mysql/mysql_proxy/data_types/mysql_packet.py | yarenty/mindsdb | 261 | 11162960 | """
*******************************************************
* Copyright (C) 2017 MindsDB Inc. <<EMAIL>>
*
* This file is part of MindsDB Server.
*
* MindsDB Server can not be copied and/or distributed without the express
* permission of MindsDB Inc
*******************************************************
"""
imp... |
RecoBTag/Skimming/python/btagMC_ttbar_SkimPaths_cff.py | ckamtsikis/cmssw | 852 | 11162962 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from RecoBTag.Skimming.btagMC_ttbar_cfi import *
btagMC_ttbarPath = cms.Path(btagMC_ttbar)
|
querybook/tests/test_lib/test_scheduled_datadoc/test_export.py | shivammmmm/querybook | 1,144 | 11162987 | from unittest import mock
from const.query_execution import QueryExecutionStatus
from lib.scheduled_datadoc.export import (
group_export_by_cell_id,
_export_query_cell,
)
def test_group_export_by_cell_id():
assert group_export_by_cell_id(
[
{"exporter_cell_id": 1, "exporter_name": "foo... |
dataset/oulu.py | ZGSLZL/LGSC-for-FAS | 195 | 11162995 | import os
import cv2
import paddle.fluid as fluid
import numpy as np
import pickle
from .datasetbase import DatasetBase
class OULU(DatasetBase):
Prot = ['Prot.1', 'Prot.2']
Prot.extend(['Prot.3_{}'.format(i) for i in range(1, 7)])
Prot.extend(['Prot.4_{}'.format(i) for i in range(1, 7)])
def __init__... |
discum/__init__.py | BalaM314/Discord-S.C.U.M | 383 | 11163017 | from .__version__ import __version__
from .discum import Client |
leetcode.com/python/973_K_Closest_Points_to_Origin.py | vansh-tiwari/coding-interview-gym | 713 | 11163030 |
import heapq
# Using MAX Heap
class Solution(object):
def kClosest(self, points, K):
"""
:type points: List[List[int]]
:type K: int
:rtype: List[List[int]]
"""
if len(points) <= K:
return points
maxHeap = []
for i in range(K):
... |
utest/test_cookie.py | leeuwe/robotframework-browser | 219 | 11163040 | <reponame>leeuwe/robotframework-browser
import sys
from datetime import datetime
import pytest
from Browser.keywords import Cookie
@pytest.fixture(scope="module")
def cookie():
return Cookie(None)
def test_cookie_as_dot_dict_expiry(cookie: Cookie):
epoch = 1604698517
data = cookie._cookie_as_dot_dict(... |
SkoarPyon/skoarmantics.py | sofakid/Skoarcery | 343 | 11163052 | # ============
# Skoarmantics
# ============
#
# We went depth first so our children should be defined
#
def msg_chain_node(skoar, noad):
pass
def beat(skoar, noad):
noad.absorb_toke()
noad.beat = noad.toke
noad.is_beat = True
def meter_beat(skoar, noad):
noad.absorb_toke()
noad.beat = no... |
omrdatasettools/OmrDataset.py | apacha/OMR-Datasets | 195 | 11163059 | <filename>omrdatasettools/OmrDataset.py
from enum import Enum, auto
from typing import Dict
class OmrDataset(Enum):
"""
The available OMR datasets that can be automatically downloaded with Downloader.py
"""
#: The Audiveris OMR dataset from https://github.com/Audiveris/omr-dataset-tools, Copyrigh... |
test/jit/test_data_parallel.py | Hacky-DH/pytorch | 60,067 | 11163090 | <gh_stars>1000+
import os
import sys
import unittest
import torch
import torch.nn as nn
import torch.nn.parallel as dp
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils im... |
doc/stack_imgs.py | GCBallesteros/imreg_dft | 167 | 11163115 | import argparse as ap
import scipy as sp
import scipy.misc
import matplotlib
matplotlib.use('Cairo')
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
_LABELS = "abcde"
def parse():
parser = ap.ArgumentParser()
parser.add_argument(
"infiles", n... |
egs2/slurp_entity/asr1/local/evaluation/metrics/metrics.py | texpomru13/espnet | 5,053 | 11163136 | from collections import defaultdict
from copy import copy
from typing import Dict, List, Set, Tuple
from .distance import Distance
METRIC_OPTIONS = {"f1", "span_f1", "span_distance_f1", "slu_f1"}
class ErrorMetric:
"""
An abstract class representing a metric which accumulates TPs, FPs, and FNs.
:param ... |
AutotestWebD/apps/myadmin/TeamService.py | yangjourney/sosotest | 422 | 11163141 | <gh_stars>100-1000
from apps.common.func.WebFunc import *
from apps.common.model.RedisDBConfig import RedisCache
from apps.common.config.permissionConst import PermissionConst
class TeamService(object):
@staticmethod
def updateTeam(teamData):
tbModel = TbAdminTeam.objects.filter(id=teamData["id"])
... |
recipes/Python/542194_Iterating_over_fixed_size_blocks/recipe-542194.py | tdiprima/code | 2,023 | 11163143 | <filename>recipes/Python/542194_Iterating_over_fixed_size_blocks/recipe-542194.py<gh_stars>1000+
from itertools import islice, chain, repeat
def iterblocks(iterable, size, **kwds):
'''Break an iterable into blocks of a given size.
The optional keyword parameters determine the type of each block and what to
... |
spytest/apis/security/user.py | shubav/sonic-mgmt | 132 | 11163304 | <gh_stars>100-1000
# This file contains the list of API's which performs User operations.
# Author : <NAME> (<EMAIL>)
import re
from spytest import st
from utilities.common import filter_and_select, make_list
from apis.security.rbac import add_user
from apis.system.rest import config_rest, delete_rest
import os, base64... |
libcloud/test/test_file_fixtures.py | zimventures/libcloud | 1,435 | 11163307 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version... |
python/119_Pascal's_Triangle_II.py | dvlpsh/leetcode-1 | 4,416 | 11163320 | <reponame>dvlpsh/leetcode-1
class Solution(object):
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
last = [1]
res = [1]
for r in range(1, rowIndex + 1):
res = [1]
for index in range(len(last) - 1):
... |
3]. Competitive Programming/03]. LeetCode/1]. Problems/Python/0022)_ii_Generate_Parentheses.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 11163370 | <reponame>MLinesCode/The-Complete-FAANG-Preparation<gh_stars>1000+
class Solution:
def generateParenthesis(self, n):
ans = ['()']
for _ in range(2, n + 1):
new = set()
for s in ans:
for i in range(len(s)):
a = s[:i] + '()' + s[i:]
... |
applications/cli/commands/workflow/logs.py | nparkstar/nauta | 390 | 11163371 | <gh_stars>100-1000
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
monitor/collectors/__init__.py | danielsemkowicz/chia-monitor | 148 | 11163391 | <reponame>danielsemkowicz/chia-monitor<filename>monitor/collectors/__init__.py
from monitor.collectors.collector import Collector
from monitor.collectors.rpc_collector import RpcCollector
from monitor.collectors.ws_collector import WsCollector
|
server/api/blueprints/user.py | brayest/testcode | 652 | 11163393 | <filename>server/api/blueprints/user.py<gh_stars>100-1000
import flask
from cloudinary.uploader import upload
from flask import Blueprint
from flask_babel import gettext
from flask_login import current_user, login_required
from loguru import logger
from sqlalchemy import and_
from server.api.blueprints import teacher_... |
hs_access_control/management/commands/access_provenance.py | tommac7/hydroshare | 178 | 11163420 | """
This prints the provenance of an access control relationship between a user and a resource.
This is invaluable for access control debugging.
"""
from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
from hs_access_control.models.utilities import access_provenance
from hs_core... |
addons/io_scene_gltf_ksons/vnode.py | Andgonag/gltf-blender-importer | 199 | 11163425 | <reponame>Andgonag/gltf-blender-importer
from math import pi
from mathutils import Matrix, Quaternion, Vector, Euler
from .compat import mul
from .mesh import mesh_name
# The node graph in glTF needs to fixed up quite a bit before it will work for
# Blender. We first create a graph of "virtual nodes" to match the grap... |
media/tools/layout_tests/trend_graph.py | kjthegod/chromium | 777 | 11163431 | <gh_stars>100-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.
"""A module for manipulating trend graph with analyzer result history."""
import os
import layouttest_analyzer_helpers
DEFAULT_TREN... |
crestify/views/settings.py | punto1/crestify | 214 | 11163448 | <gh_stars>100-1000
'''Routes and Views for the Settings'''
from flask import render_template, request, redirect, url_for
from flask_security import login_required, current_user
from flask_security.forms import ChangePasswordForm
from crestify import app
from crestify.models import User
from crestify.forms import PerPag... |
recipes/Python/440678_Memoizaticache_cleared_return_last/recipe-440678.py | tdiprima/code | 2,023 | 11163457 | import cPickle
# Public domain.
def memoize(f):
"""
Memoize function, clear cache on last return.
"""
count = [0]
cache = {}
def g(*args, **kwargs):
count[0] += 1
try:
try:
if len(kwargs) != 0: raise ValueError
hash(args)
key = (args,)
except:
key = cPick... |
tests/syntax/def_forward_slash_4.py | matan-h/friendly | 287 | 11163493 | def test(a, /, b, /):
pass
|
analysis/performance.py | MahmudulAlam/Unified-Gesture-and-Fingertip-Detection | 200 | 11163496 | import cv2
import time
import numpy as np
from statistics import mean
from unified_detector import Fingertips
images = np.load('../dataset/test/images.npy')
test_x = np.load('../dataset/test/test_x.npy')
test_y_prob = np.load('../dataset/test/test_y_prob.npy')
test_y_keys = np.load('../dataset/test/test_y_keys.npy')
c... |
NVIDIA/benchmarks/ssd/implementations/pytorch/nhwc/resnet_nhwc_cifar10.py | mengkai94/training_results_v0.6 | 180 | 11163513 | <filename>NVIDIA/benchmarks/ssd/implementations/pytorch/nhwc/resnet_nhwc_cifar10.py
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
tests/neptune/internal/hardware/resources/test_system_resource_info_factory.py | Raalsky/neptune-client | 254 | 11163527 | #
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... |
examples/catalyst_rl/sampler.py | gr33n-made/catalyst | 2,693 | 11163552 | <reponame>gr33n-made/catalyst
# flake8: noqa
from typing import TYPE_CHECKING
from abc import ABC, abstractmethod
import gc
import time
import gym
from torch import nn
from catalyst import utils
if TYPE_CHECKING:
from db import IRLDatabase
from misc import Trajectory
class ISampler(ABC):
def __init__(
... |
neural_exploration/visualize/apps.py | brookefitzgerald/neural_exploration | 160 | 11163602 | <filename>neural_exploration/visualize/apps.py
from django.apps import AppConfig
class VisualizeConfig(AppConfig):
name = 'visualize'
|
codes/models/modules/HCFlowNet_SR_arch.py | CJWBW/HCFlow | 123 | 11163605 | <reponame>CJWBW/HCFlow
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils.util import opt_get
from models.modules import Basic, thops
class HCFlowNet_SR(nn.Module):
def __init__(self, opt, step=None):
super(HCFlowNet_SR, self).__init__()
self.opt = o... |
tools/skinCluster.py | fsanges/glTools | 165 | 11163606 | import maya.mel as mm
import maya.cmds as mc
import glTools.data.skinClusterData
import glTools.tools.copyPasteWeights
import glTools.utils.component
import glTools.utils.selection
import glTools.utils.skinCluster
import copy
def loadWorldSpaceData(geo='',search='',replace=''):
'''
'''
# Load Data
skinData = S... |
torchsparse/nn/functional/voxelize.py | collector-m/torchsparse | 428 | 11163644 | <reponame>collector-m/torchsparse
import torch
from torch.autograd import Function
from torch.cuda.amp import custom_bwd, custom_fwd
import torchsparse.backend
__all__ = ['spvoxelize']
class VoxelizeFunction(Function):
@staticmethod
@custom_fwd(cast_inputs=torch.half)
def forward(ctx, feats: torch.Tens... |
examples/Kane1985/Chapter4/Ex8.6.py | jcrist/pydy | 298 | 11163677 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 8.6 from Kane 1985."""
from __future__ import division
from sympy import cos, sin, solve, simplify, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dynamicsymbols
from util import msprint, subs, partial_velo... |
tests/test_chains.py | profintegra/stumpy | 2,296 | 11163695 | <filename>tests/test_chains.py
import numpy as np
import numpy.testing as npt
from stumpy import atsc, allc
import pytest
test_data = [
(
np.array([47, 32, 1, 22, 2, 58, 3, 36, 4, -5, 5, 40], dtype=np.int64),
np.array([11, 7, 4, 7, 6, 11, 8, 11, 10, 10, 11, -1], dtype=np.int64),
np.array([-... |
tools/skottie-wasm-perf/parse_perf_csvs.py | mohad12211/skia | 6,304 | 11163701 | <reponame>mohad12211/skia<gh_stars>1000+
#!/usr/bin/python2
#
# Copyright 2019 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Helper script that takes as input 2 CSVs downloaded from perf.skia.org and
# outputs a CSV with test_name, avg_value1 (fr... |
vnpy/data/mongo/mongo_data.py | howyu88/vnpy2 | 323 | 11163711 | <gh_stars>100-1000
# encoding: UTF-8
# Mongodb 数据服务
import sys
from time import sleep
from pymongo import MongoClient, ASCENDING
from pymongo.errors import ConnectionFailure, AutoReconnect
class MongoData(object):
db_client = None # 全局连接对象
db_has_connected = False # 是否已经连接
def __init__(self, host: s... |
biaoqingbao/search.py | wusirs/learn_python3_spider | 9,953 | 11163743 | #-*- coding:UTF-8 -*-
import glob
import time
import itchat
from itchat.content import TEXT, PICTURE
imgs = []
def searchImage(text):
print('收到关键词: ', text)
for name in glob.glob('/home/wistbean/biaoqingbao/*'+text+'*.jpg'):
imgs.append(name)
@itchat.msg_register([PICTURE, TEXT])
def text_reply(ms... |
Python3/640.py | rakhi2001/ecom7 | 854 | 11163756 | __________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def solveEquation(self, equation: str) -> str:
z = eval(equation.replace('x', 'j').replace('=', '-(') + ')', {'j': 1j})
a, x = z.real, -z.imag
return 'x=... |
DQMOffline/Hcal/python/HcalNoiseRatesClient_cfi.py | ckamtsikis/cmssw | 852 | 11163773 | <filename>DQMOffline/Hcal/python/HcalNoiseRatesClient_cfi.py
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
hcalNoiseRatesClient = DQMEDHarvester("HcalNoiseRatesClient",
# outputFile = cms.untracked.string('NoiseRatesHarvestingME.root'),
outputFile = cms.u... |
app/controllers/config/system/webpush.py | ctxis/crackerjack | 237 | 11163809 | from .. import bp
from flask_login import login_required
from flask import render_template, redirect, url_for, flash, request
from app.lib.base.provider import Provider
from app.lib.base.decorators import admin_required
@bp.route('/webpush', methods=['GET'])
@login_required
@admin_required
def webpush():
return r... |
catboost/libs/data/benchmarks_ut/test_perf.py | ZhekehZ/catboost | 6,989 | 11163814 | import yatest
def test(metrics):
metrics.set_benchmark(yatest.common.execute_benchmark("catboost/libs/data/benchmarks/benchmarks"))
|
terraform/stacks/bot/lambdas/python/slack_automation_bot/slack_bolt/adapter/socket_mode/base_handler.py | houey/cloud-sniper | 160 | 11163823 | <reponame>houey/cloud-sniper
import logging
import signal
import sys
from threading import Event
from slack_sdk.socket_mode.client import BaseSocketModeClient
from slack_sdk.socket_mode.request import SocketModeRequest
from slack_bolt import App
from slack_bolt.util.utils import get_boot_message
class BaseSocketMod... |
tests/test_concurrencymetainfo.py | saxix/django-concurrency | 327 | 11163825 | <reponame>saxix/django-concurrency
from django.test import TransactionTestCase
from demo.models import ConcurrencyDisabledModel, SimpleConcurrentModel
from concurrency.exceptions import RecordModifiedError
class TestCustomConcurrencyMeta(TransactionTestCase):
concurrency_model = ConcurrencyDisabledModel
con... |
tests/util/statistics_test.py | thecoblack/CompilerGym | 562 | 11163853 | <reponame>thecoblack/CompilerGym<filename>tests/util/statistics_test.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for //compiler_gym/util:statistics."""
from pytest import... |
examples/tf/GATNE/custom_inductive.py | YaoPu2021/galileo | 115 | 11163886 | <reponame>YaoPu2021/galileo
# Copyright 2020 JD.com, Inc. Galileo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
setup.py | charlesincharge/vae-seq | 161 | 11163893 | # 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 writin... |
tests/transformers/grobid_service_test.py | elifesciences/sciencebeam | 272 | 11163897 | <gh_stars>100-1000
from unittest.mock import patch, ANY
import pytest
from sciencebeam.transformers.grobid_service import (
GrobidServiceConfigEnvVariables,
GrobidServiceConfig,
get_grobid_service_config,
get_request_data_for_config,
grobid_service as create_grobid_service
)
BASE_URL = 'http://g... |
ASR/waveminionet/utils.py | ishine/pase | 428 | 11163910 | import json
import torch
import torch.nn as nn
def waveminionet_parser(cfg_fname):
with open(cfg_fname, 'r') as cfg_f:
cfg_all = json.load(cfg_f)
# change loss section to select those
# from nn package
for i, cfg in enumerate(cfg_all):
cfg_all[i]['loss'] = getattr(nn,
... |
roll_engine/models/actions.py | js882829/tars | 371 | 11163928 | from __future__ import absolute_import
from django.db import models
from roll_engine.db import TimestampedModel
class DeploymentAction(TimestampedModel):
action = models.CharField(max_length=255, null=True, blank=True)
message = models.CharField(max_length=255, null=True, blank=True)
operator = models.C... |
telegrambot/test/factories/user.py | matteing/django-telegram-bot | 156 | 11163932 | # coding=utf-8
from factory import Sequence, DjangoModelFactory, PostGenerationMethodCall
from django.conf import settings
class UserWebFactory(DjangoModelFactory):
username = Sequence(lambda n: 'user_name_%d' % n)
email = Sequence(lambda n: '<EMAIL>' % n)
password = PostGenerationMethodCall('set_password'... |
scripts/lambda.updateprimaryworkgroup.py | avrios/data-lake-as-code | 106 | 11163957 | <reponame>avrios/data-lake-as-code
import json
import logging
import cfnresponse
import boto3
client = boto3.client('athena')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def main(event, context):
responseData = {}
try:
logger.info('got event {}'.format(event))
... |
library/oci_service_gateway_facts.py | slmjy/oci-ansible-modules | 106 | 11163991 | #!/usr/bin/python
# Copyright (c) 2018, 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for ... |
lib/tool_shed/util/xml_util.py | rikeshi/galaxy | 1,085 | 11164008 | from galaxy.util.tool_shed.xml_util import * # noqa: F401,F403
|
tests/test_driver_management.py | nmandery/rasterio | 1,479 | 11164023 | import logging
import rasterio
from rasterio._env import driver_count
def test_drivers():
with rasterio.Env() as m:
assert driver_count() > 0
assert type(m) == rasterio.Env
assert driver_count() > 0
def test_drivers_bwd_compat():
with rasterio.Env() as m:
assert driver_count() >... |
demo_layout/layout.py | vdaytona/statistical-arbitrage-18-19 | 163 | 11164085 | <filename>demo_layout/layout.py
# utilities
import os
import sys
import glob
import pandas as pd
import numpy as np
from datetime import date
# figure plotting
import bokeh.models as bkm
from bokeh.io import show, curdoc
from bokeh.layouts import column, gridplot
from bokeh.models import ColumnDataSource, ... |
misc/update/python/lib/pynntp/nntp/fifo.py | sy3kic/nZEDb | 472 | 11164093 | #!/usr/bin/python
"""
A reasonably efficient FIFO buffer.
Copyright (C) 2013 <NAME>
This program 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
(at your option) any later ver... |
debug/typ.py | strint/myia | 222 | 11164138 | from dataclasses import dataclass
from myia.abstract import (
ANYTHING as ANY,
TYPE,
VALUE,
AbstractScalar,
from_value,
)
from myia.xtype import Bool, Float, Int
B = AbstractScalar({VALUE: ANY, TYPE: Bool})
i16 = AbstractScalar({VALUE: ANY, TYPE: Int[16]})
i32 = AbstractScalar({VALUE: ANY, TYPE: ... |
petl/test/transform/test_reductions.py | vishalbelsare/petl | 495 | 11164143 | from __future__ import absolute_import, print_function, division
import operator
from collections import OrderedDict
from petl.test.helpers import ieq
from petl.util import strjoin
from petl.transform.reductions import rowreduce, aggregate, \
mergeduplicates, Conflict, fold
def test_rowreduce():
tabl... |
tests/components/deluge/__init__.py | liangleslie/core | 30,023 | 11164150 | <gh_stars>1000+
"""Tests for the Deluge integration."""
from homeassistant.components.deluge.const import (
CONF_WEB_PORT,
DEFAULT_RPC_PORT,
DEFAULT_WEB_PORT,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
CONF_DATA = {
CONF_HOST: "1.2.3.4",
CONF_USERNAME: "us... |
packages/syft/src/syft/core/node/common/node_service/association_request/association_request_messages.py | vishalbelsare/PySyft | 8,428 | 11164156 | <gh_stars>1000+
# stdlib
from typing import Dict
from typing import List
from typing import Optional
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
from typing_extensions import final
# relative
from ...... import serialize
from ......proto.grid.messages.association_messages_pb2 imp... |
examples/calculate_geodetic_distances.py | yorak/VeRyPy | 156 | 11164158 | <reponame>yorak/VeRyPy
# -*- coding: utf-8 -*-
import numpy as np
from cvrp_io import _haversine
points = [[24.42, 54.44], [24.44, 54.60], [24.42, 54.53]]
n_incl_depot = len(points)
geodesic_D = np.zeros( (n_incl_depot, n_incl_depot) )
for i, p1 in enumerate(points):
for j, p2 in enumerate(points):
geo... |
Code/Chenglong/utils/dist_utils.py | ChenglongChen/Kaggle_Homedepot | 465 | 11164202 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
@brief: utils for distance computation
"""
import sys
import warnings
warnings.filterwarnings("ignore")
try:
import lzma
import Levenshtein
except:
pass
import numpy as np
from difflib import SequenceMatcher
from sklearn.metrics.pai... |
Codes/Liam/434_number_of_segments_in_a_string.py | liuxiaohui1221/algorithm | 256 | 11164260 | <gh_stars>100-1000
# 执行用时 : 104 ms
# 内存消耗 : 28.7 MB
# 方案:python内置字符切分函数
class Solution:
def countSegments(self, s: str) -> int:
return len(s.split())
|
docs/tutorials/classification/dive_deep_imagenet.py | Kh4L/gluon-cv | 5,447 | 11164300 | """5. Train Your Own Model on ImageNet
==========================================
``ImageNet`` is the most well-known dataset for image classification.
Since it was published, most of the research that advances the state-of-the-art
of image classification was based on this dataset.
Although there are a lot of availab... |
isobar/io/signalflow/__init__.py | rvega/isobar | 241 | 11164323 | <reponame>rvega/isobar
from .output import SignalFlowOutputDevice
__all__ = ["SignalFlowOutputDevice"]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.