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 |
|---|---|---|---|---|
cudamat/cudamat_conv.py | zwenaing/unsupervised-videos | 293 | 11084074 | import ctypes as ct
import math
import pdb
_ConvNet = ct.cdll.LoadLibrary('libcudamat_conv.so')
def DivUp(a, b):
return (a + b - 1) / b
def AddAtAllLocs(h, b):
batch_size, size_x, size_y, num_channels = h.shape4d
b_shape = b.shape
h.reshape((-1, num_channels))
b.reshape((1, -1))
assert b.shape[1] == num_c... |
image-superresolution/esrgan/discriminator_arch.py | AaratiAkkapeddi/nnabla-examples | 228 | 11084081 | # Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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 ... |
jactorch/data/dataloader/__init__.py | dapatil211/Jacinle | 114 | 11084097 | <filename>jactorch/data/dataloader/__init__.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : __init__.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 03/09/2020
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import torch
if torch.__version__ < '0.3.1':
from .datalo... |
deploy/tx2_run_tvm.py | tolleybot/fast-depth | 759 | 11084113 | import tvm
import numpy as np
import argparse
import os
import time
def run_model(model_dir, input_fp, output_fp, warmup_trials, run_trials, cuda, try_randin):
# import compiled graph
print("=> [TVM on TX2] using model files in {}".format(model_dir))
assert(os.path.isdir(model_dir))
print("=> [TVM on ... |
ropper/z3helper.py | cbayet/Ropper | 1,502 | 11084126 | # coding=utf-8
# Copyright 2018 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer... |
tests/test_ngram.py | pemistahl/lingua-py | 119 | 11084155 | #
# Copyright © 2022 <NAME> <EMAIL>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
targets/minispartan6/crg.py | skiphansen/litex-buildenv | 198 | 11084195 | # Support for the MiniSpartan6+ - https://www.scarabhardware.com/minispartan6/
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
class _CRG(Module):
def __init__(self, platform, clk_freq):
self.clock_domains.cd_sys = ClockDomain()
self.c... |
mayan/apps/documents/tests/mixins/document_type_mixins.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11084198 | from django.db.models import Q
from ...classes import BaseDocumentFilenameGenerator
from ...models.document_type_models import DocumentType, DocumentTypeFilename
from ..literals import (
TEST_DOCUMENT_TYPE_DELETE_PERIOD, TEST_DOCUMENT_TYPE_DELETE_TIME_UNIT,
TEST_DOCUMENT_TYPE_LABEL, TEST_DOCUMENT_TYPE_LABEL_E... |
gryphon/tests/logic/exchange_wrappers/bitstamp_test.py | qiquanzhijia/gryphon | 1,109 | 11084201 | <gh_stars>1000+
import pyximport; pyximport.install()
from gryphon.lib.exchange.bitstamp_btc_usd import BitstampBTCUSDExchange
from gryphon.tests.logic.exchange_wrappers.public_methods import ExchangePublicMethodsTests
class TestBitstampPublicMethods(ExchangePublicMethodsTests):
def setUp(self):
self.exc... |
CircuitPython_MacroPad_NKRO/boot.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 11084209 | <gh_stars>100-1000
import usb_hid
REPORT_ID = 0x4
REPORT_BYTES = 16
bitmap_keyboard_descriptor = bytes((
0x05, 0x01, # Usage Page (Generic Desktop),
0x09, 0x06, # Usage (Keyboard),
0xA1, 0x01, # Collection (Application),
0x85, ... |
presidio-analyzer/tests/test_us_itin_recognizer.py | kubistika/presidio | 1,408 | 11084222 | <filename>presidio-analyzer/tests/test_us_itin_recognizer.py
import pytest
from tests import assert_result_within_score_range
from presidio_analyzer.predefined_recognizers import UsItinRecognizer
@pytest.fixture(scope="module")
def recognizer():
return UsItinRecognizer()
@pytest.fixture(scope="module")
def ent... |
misc/generate_site_positions.py | epifluidlab/juicer | 204 | 11084226 | #!/usr/bin/env python
# Generate site positions in genome from given restriction enzyme
# Juicer 1.5
from __future__ import print_function
import sys
import re
def usage():
print('Usage: {} <restriction enzyme> <genome> [location]'.format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
# ---------------------------... |
python/py-pil/files/patch-setup.py | davidlrichmond/macports-ports | 1,199 | 11084235 | <gh_stars>1000+
--- setup.py.orig 2006-12-03 04:37:29.000000000 -0700
+++ setup.py 2009-09-18 19:58:45.000000000 -0600
@@ -33,12 +33,12 @@
#
# TIFF_ROOT = libinclude("/opt/tiff")
-TCL_ROOT = None
-JPEG_ROOT = None
-ZLIB_ROOT = None
-TIFF_ROOT = None
-FREETYPE_ROOT = None
-LCMS_ROOT = None
+TCL_ROOT = "__PREFIX__/li... |
kik_unofficial/protobuf/messagepath/v1/adaptive_cards_pb2.py | 3dik/kik-bot-api-unofficial | 120 | 11084262 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: messagepath/v1/adaptive_cards.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impor... |
Alignment/MuonAlignment/python/MCScenario_CRAFT1_22X.py | ckamtsikis/cmssw | 852 | 11084270 | <reponame>ckamtsikis/cmssw<filename>Alignment/MuonAlignment/python/MCScenario_CRAFT1_22X.py
# To use this script:
# it's an ordinary Python script, not a CMSSW configuration file (though it writes and runs CMSSW configuration files)
# * you MUST have an inertGlobalPositionRcd.db in your working directory
# ... |
DQMServices/Components/python/DQMMessageLoggerClient_cfi.py | ckamtsikis/cmssw | 852 | 11084285 | import FWCore.ParameterSet.Config as cms
DQMMessageLoggerClient = cms.EDAnalyzer ("DQMMessageLoggerClient",
Directory = cms.string("MessageLogger")
)
|
env/lib/python3.8/site-packages/plotly/validators/layout/mapbox/__init__.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 11084288 | <reponame>acrucetta/Chicago_COVI_WebApp
import sys
if sys.version_info < (3, 7):
from ._zoom import ZoomValidator
from ._uirevision import UirevisionValidator
from ._style import StyleValidator
from ._pitch import PitchValidator
from ._layerdefaults import LayerdefaultsValidator
from ._layers i... |
integration/rpc/controller/controller_pb2_grpc.py | meldafrawi/longhorn-engine | 160 | 11084308 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import controller_pb2 as controller__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class ControllerServiceStub(object):
# missing associated documentation comment in .proto file
pass
def __init_... |
vimfiles/bundle/vim-python/submodules/pylint/tests/benchmark/test_baseline_benchmarks.py | ciskoinch8/vimrc | 463 | 11084352 | <filename>vimfiles/bundle/vim-python/submodules/pylint/tests/benchmark/test_baseline_benchmarks.py<gh_stars>100-1000
""" Profiles basic -jX functionality """
# Copyright (c) 2020-2021 <NAME> <<EMAIL>>
# Copyright (c) 2020 hippo91 <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# L... |
terrascript/resource/hashicorp/dns.py | mjuenema/python-terrascript | 507 | 11084358 | <filename>terrascript/resource/hashicorp/dns.py
# terrascript/resource/hashicorp/dns.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:19 UTC)
import terrascript
class dns_a_record_set(terrascript.Resource):
pass
class dns_aaaa_record_set(terrascript.Resource):
pass
class dns_cname_reco... |
tests/asr/spokestack/test_speech_recognizer.py | spokestack/spokestack-python | 139 | 11084425 | <filename>tests/asr/spokestack/test_speech_recognizer.py
"""
This module tests the cloud speech recognizer
"""
import json
from unittest import mock
import numpy as np
from spokestack.asr.spokestack.speech_recognizer import CloudSpeechRecognizer
from spokestack.context import SpeechContext
def test_recognize():
... |
scripts/discourse_1291.py | gmatteo/awesome-panel | 179 | 11084475 | # imports
import pandas as pd
import panel as pn
pn.extension()
# initialize list of lists
data = [
["A", "January", 10],
["A", "February", 7],
["A", "March", 5],
["B", "January", 4],
["B", "February", 8],
["B", "March", 12],
]
# Create the pandas DataFrame
df = pd.DataFrame(... |
src/betterproto/plugin/models.py | hsh-nids/python-betterproto | 708 | 11084477 | <reponame>hsh-nids/python-betterproto
"""Plugin model dataclasses.
These classes are meant to be an intermediate representation
of protobuf objects. They are used to organize the data collected during parsing.
The general intention is to create a doubly-linked tree-like structure
with the following types of reference... |
ironic/common/nova.py | yanndegat/ironic | 350 | 11084518 | <filename>ironic/common/nova.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
examples/bayesian_optimization.py | gautam1858/autograd | 6,119 | 11084521 | """This Bayesian optimization demo using gradient-based optimization
to find the next query point."""
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import value_and_grad
from... |
test/uscg_test.py | quiet-oceans/libais | 161 | 11084543 | <gh_stars>100-1000
"""Tests for ais.uscg."""
import unittest
from ais import uscg
METADATA_TYPES = r"""
# pylint: disable=line-too-long
# S
!SAVDM,1,1,1,A,13mHu<001Kr7KRN=oHCkLjj00<0P,0*29,d-98,S0,t000000.00,T00.004775,D07MN-KW-PRIBS1,1428796800
!SAVDM,1,1,7,B,18158j001ErSVGdE>>1Unlcp0l1n,0*44,d-105,S2235,t000059.0... |
examples/legacy/seq2seq/convert_model_to_fp16.py | liminghao1630/transformers | 50,404 | 11084548 | <reponame>liminghao1630/transformers
#!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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.apach... |
src/probnum/quad/_integration_measures.py | christopheroates/probnum | 226 | 11084618 | """Contains integration measures."""
import abc
from typing import Optional, Tuple, Union
import numpy as np
import scipy.stats
from probnum.randvars import Normal
from probnum.typing import FloatArgType, IntArgType
class IntegrationMeasure(abc.ABC):
"""An abstract class for a measure against which a target fu... |
robel/scripts/reset_hardware.py | Del9fina/robel | 109 | 11084654 | <gh_stars>100-1000
# Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
third_party/inspector_protocol/concatenate_protocols.py | RiyoCoder/v8 | 5,964 | 11084660 | #!/usr/bin/env python
# Copyright 2016 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.path
import sys
try:
import json
except ImportError:
import simplejson as json
import pdl
def main(argv):
if l... |
tests/test_check_playbook_file_removed_and_added.py | deperrone/content | 1,138 | 11084701 | <filename>tests/test_check_playbook_file_removed_and_added.py<gh_stars>1000+
import os
import pytest
from .test_ansible_file_removed_and_added import check_playbook_file_removed_and_added
def test_file_removed_and_added():
playbook_path = os.path.join(os.path.dirname(__file__),
"... |
89_Tic-Tac-Toe/python/tictactoe2.py | jcoehoorn/basic-computer-games | 7,880 | 11084705 | <reponame>jcoehoorn/basic-computer-games<gh_stars>1000+
#!/usr/bin/env python3
from enum import Enum
class OccupiedBy(Enum):
COMPUTER=-1
EMPTY=0
PLAYER=1
class Winner(Enum):
NONE=0
COMPUTER=1
PLAYER=2
DRAW=3
class Space(Enum):
TOP_LEFT = 0
TOP_CENTER = 1
TOP_RIGHT = 2
M... |
utils/validation.py | suspiria/MelNet | 190 | 11084708 | import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from .gmm import sample_gmm
def validate(args, model, melgen, tierutil, testloader, criterion, writer, step):
model.eval()
# torch.backends.cudnn.benchmark = False
test_loss = []
loader = tqdm(testloader, desc=... |
modules/arp_monitor.py | Lola224/hakkuframework | 250 | 11084716 | <filename>modules/arp_monitor.py<gh_stars>100-1000
# Copyright (C) 2015 – 2021 <NAME> (4shadoww)
from core.hakkuframework import *
import scapy.all as scapy
conf = {
"name": "arp_monitor", # Module's name (should be same as file name)
"version": "1.0", # Module version
"shortdesc": "arp packet monitor", #... |
e2e/fixtures/python/relative/simple.py | FivemStorescripts/OctoLinker | 2,677 | 11084744 | <gh_stars>1000+
a = "test"
_B = "test"
def my_func():
pass
class MyClass():
pass
|
examples/basic/mesh_threshold.py | hadivafaii/vedo | 836 | 11084776 | <filename>examples/basic/mesh_threshold.py
"""Extracts cells of a Mesh which satisfy
the threshold criterion: 37 < scalar < 37.5"""
from vedo import *
man = Mesh(dataurl+"man.vtk")
scals = man.points()[:, 0] + 37 # pick y coords of vertices
man.cmap("cool", scals).addScalarBar(title="threshold", horizontal=True)
#... |
static/ppdet/modeling/anchor_heads/fcos_head.py | leakyH/PaddleDetection | 7,782 | 11084830 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
Lib/objc/_DeviceIdentity.py | snazari/Pyto | 701 | 11084832 | """
Classes from the 'DeviceIdentity' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
GestaltHlprDeviceIdentity = _Class("GestaltHlprDevice... |
18-asyncio/charfinder/http_charfinder.py | yyang99/fluent_python_notebooks | 199 | 11084866 | <gh_stars>100-1000
#!/usr/bin/env python3
import sys
import asyncio
from aiohttp import web
from charfinder import UnicodeNameIndex
TEMPLATE_NAME = 'http_charfinder.html'
CONTENT_TYPE = 'text/html; charset=UTF-8'
SAMPLE_WORDS = ('bismillah chess cat circled Malayalam digit'
' Roman face Ethiopic blac... |
xv_leak_tools/test_components/open_wrt/__init__.py | UAEKondaya1/expressvpn_leak_testing | 219 | 11084879 | <gh_stars>100-1000
from xv_leak_tools.test_components.open_wrt.open_wrt_builder import OpenWRTBuilder
def register(factory):
factory.register(OpenWRTBuilder())
|
release/scripts/freestyle/styles/sequentialsplit_sketchy.py | rotoglup/blender | 365 | 11084881 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
histomicstk/utils/girder_convenience_utils.py | sunaifei/HistomicsTK | 249 | 11084895 | <gh_stars>100-1000
"""
Created on Thu Dec 12 13:19:18 2019
@author: tageldim
"""
# import os
import os
import girder_client
import json
from histomicstk.workflows.workflow_runner import Workflow_runner, \
Slide_iterator, Annotation_iterator
# import warnings
# warnings.simplefilter('once', UserWarning)
def conn... |
simple-DCGAN/model.py | riciche/SimpleCVReproduction | 923 | 11084897 | <filename>simple-DCGAN/model.py
import torch
import torch.nn as nn
class NetG(nn.Module):
'''
generator
'''
def __init__(self, opt):
super(NetG, self).__init__()
num_gen_feature = opt.ngf
# 输入为nz维度的噪声(nz*1*1)
"""
out = (in-1)*stride-2*padding+kernel_size
... |
models/__init__.py | benbijituo/OpenNRE-PyTorch | 224 | 11084900 | from .Model import Model
from .CNN_ATT import CNN_ATT
from .PCNN_ATT import PCNN_ATT
from .CNN_AVE import CNN_AVE
from .PCNN_AVE import PCNN_AVE
from .CNN_ONE import CNN_ONE
from .PCNN_ONE import PCNN_ONE
|
crosshair/opcode_intercept_test.py | pschanely/CrossHair | 785 | 11084925 | from crosshair.statespace import MessageType
from crosshair.test_util import check_states
def test_dict_index():
a = {"two": 2, "four": 4, "six": 6}
def numstr(x: str) -> int:
"""
post: _ != 4
raises: KeyError
"""
return a[x]
assert check_states(numstr) == {Messag... |
ch3/dependency-parser-nivre/app/transitionparser/deciders.py | thundercrawl/book-of-qna-code | 121 | 11084932 | <reponame>thundercrawl/book-of-qna-code
# Copyright 2010 <NAME>
##
# This 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 version.
##
# This sof... |
armi/bookkeeping/visualization/__init__.py | keckler/armi | 162 | 11084952 | # Copyright 2020 TerraPower, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
multi/input.py | JinchengShi/ATRank | 393 | 11084977 | <reponame>JinchengShi/ATRank
import math
import numpy as np
class DataInput:
def __init__(self, data, batch_size):
self.batch_size = batch_size
self.data = data
self.epoch_size = math.ceil(len(self.data) / self.batch_size)
self.i = 0
def __iter__(self):
return self
... |
applications/tensorflow/dynamic_sparsity/ipu_sparse_ops/tests/test_sparse_training.py | payoto/graphcore_examples | 260 | 11085025 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
from examples_tests.test_util import SubProcessChecker
from pathlib import Path
import os
import sys
import numpy as np
import pytest
cwd = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(1, os.path.join(cwd, '..', '..'))
def asser... |
IoT_Environment_Sensor/air_quality.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 11085098 | <reponame>gamblor21/Adafruit_Learning_System_Guides<gh_stars>100-1000
"""
IoT environmental sensor node.
Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!
Written by <NAME> for Adafruit Industries
Copyright (c) 2... |
ddparser/parser/data_struct/field.py | ishine/DDParser | 779 | 11085133 | <reponame>ishine/DDParser
# -*- coding: UTF-8 -*-
################################################################################
#
# Copyright (c) 2020 Baidu, 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 Licens... |
tools/grit/grit/tool/xmb.py | zealoussnow/chromium | 14,668 | 11085157 | # 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.
"""The 'grit xmb' tool.
"""
from __future__ import print_function
import getopt
import os
import sys
from xml.sax import saxutils
import six
from gr... |
src/python_minifier/rename/mapper.py | tudstlennkozh/python-minifier | 301 | 11085167 | """
For each node in an AST set the namespace to use for name binding and resolution
"""
import ast
from python_minifier.rename.util import is_namespace
from python_minifier.util import is_ast_node
def add_parent_to_arguments(arguments, func):
arguments.parent = func
arguments.namespace = func
for arg ... |
venv/lib/python3.8/site-packages/soupsieve/css_types.py | willBear/willBear-Fundamental_Analysis | 124 | 11085170 | """CSS selector structure items."""
import copyreg
from collections.abc import Hashable, Mapping
__all__ = (
'Selector',
'SelectorNull',
'SelectorTag',
'SelectorAttribute',
'SelectorContains',
'SelectorNth',
'SelectorLang',
'SelectorList',
'Namespaces',
'CustomSelectors'
)
SEL... |
LeetCode/python3/1048.py | ZintrulCre/LeetCode_Archiver | 279 | 11085196 | class Solution:
def longestStrChain(self, words: List[str]) -> int:
dp = {}
for word in sorted(words, key=len):
dp[word] = 1
for i in range(len(word)):
temp = word[:i] + word[i + 1:]
dp[word] = max(dp.get(word, 0), dp.get(temp, 0) + 1)
... |
unittest/test_Syntax.py | baidu/broc | 127 | 11085198 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
test case for Syntax
Authors: liruiha... |
segmentation_models_pytorch/fpn/__init__.py | yida2311/segmentation_models.pytorch | 5,325 | 11085200 | from .model import FPN |
tests/test_errors.py | muhammadvellani/Adafruit_IO_Python | 136 | 11085251 | # Copyright (c) 2014 Adafruit Industries
# Author: <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, copy, modify,... |
testing/scripts/rust/rust_main_program_unittests.py | chromium/chromium | 14,668 | 11085282 | <gh_stars>1000+
#!/usr/bin/env vpython3
# 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
from pyfakefs import fake_filesystem_unittest
import tempfile
import unittest
from test_results import Te... |
db/regex.py | bigblue/pynab | 161 | 11085283 | additions = [
# start above 200k for pynab regex
{
'id': 200000,
'group_name': '.*',
'regex': '/^trtk\d{4,8} (?:repost )?(?:- )?\[\d{1,5}\/\d{1,5}\] - "(?P<name>.+?)\.(?:nzb|vol\d+(?:\+\d+){1,}?\.par2|part\d+\.rar|par2|r\d{1,})" yEnc/i',
'ordinal': 1,
'status': True,
... |
setup.py | daniellawrence/graphitesend | 122 | 11085289 | <filename>setup.py
#!/usr/bin/env python
from distutils.core import setup
setup(
name='graphitesend',
version='0.10.0',
description='A simple interface for sending metrics to Graphite',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/daniellawrence/graphitesend',
packages=[... |
dl_lib/network/__init__.py | PeizeSun/CenterNet-better | 543 | 11085296 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
from .backbone import Backbone, ResnetBackbone
from .centernet import CenterNet
from .head import CenternetDeconv, CenternetHead
from .loss.reg_l1_loss import reg_l1_loss
|
lumopt/lumerical_methods/lumerical_scripts.py | jbellevi/lumopt | 101 | 11085298 | <reponame>jbellevi/lumopt
""" Copyright chriskeraly
Copyright (c) 2019 Lumerical Inc. """
import numpy as np
import scipy as sp
import scipy.constants
import lumapi
from lumopt.utilities.fields import Fields, FieldsNoInterp
def get_fields_on_cad(fdtd, monitor_name, field_result_name, get_eps, get_D, get_H, nointe... |
saleor/graphql/core/filters.py | siyoola/saleor | 1,392 | 11085316 | <reponame>siyoola/saleor<gh_stars>1000+
import django_filters
import graphene
from django.core.exceptions import ValidationError
from django.forms import CharField, Field, MultipleChoiceField
from django_filters import Filter, MultipleChoiceFilter
from graphql_relay import from_global_id
from ..utils.filters import fi... |
env/lib/python3.6/site-packages/xlwt/__init__.py | anthowen/duplify | 5,079 | 11085331 | <filename>env/lib/python3.6/site-packages/xlwt/__init__.py
__VERSION__ = '1.3.0'
from .Workbook import Workbook
from .Worksheet import Worksheet
from .Row import Row
from .Column import Column
from .Formatting import Font, Alignment, Borders, Pattern, Protection
from .Style import XFStyle, easyxf, easyfont, add_palett... |
syplatform/platform.py | larrycameron80/outis | 129 | 11085339 | <filename>syplatform/platform.py
class Platform:
""" Platform: abstract platform of the agent """
# noinspection PyUnusedLocal
def __init__(self, handler):
raise NotImplementedError("Platform.init should have been implemented by platform module")
def isstaged(self):
"""
is the... |
sahara/tests/unit/service/edp/data_sources/swift/test_swift_type.py | openstack/sahara | 161 | 11085343 | # Copyright (c) 2017 OpenStack Foundation
#
# 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 ... |
kpm/formats/kub.py | ericchiang/kpm | 121 | 11085357 | <reponame>ericchiang/kpm
import logging
import os.path
from collections import OrderedDict
import hashlib
import yaml
import json
import jsonpatch
from kpm.platforms.kubernetes import Kubernetes, get_endpoint
from kpm.utils import colorize, mkdir_p
from kpm.display import print_deploy_result
from kpm.formats.kub_base i... |
model_repos/CycleMLP/mcloader/__init__.py | gsc2001/ConvexNet | 207 | 11085361 | <reponame>gsc2001/ConvexNet<gh_stars>100-1000
from .classification import ClassificationDataset
from .data_prefetcher import DataPrefetcher
|
__scraping__/fantasy.premierleague.com/main-1.py | whitmans-max/python-examples | 140 | 11085363 |
# author: https://blog.furas.pl
# date: 2020.06.22
# link: https://stackoverflow.com/questions/62521126/table-web-scraping-issues-with-python/
from urllib.request import urlopen
import json
import pandas as pd
#url = 'https://fantasy.premierleague.com/player-list'
url = 'https://fantasy.premierleague.com/api/bootstr... |
test/restful/test_rooms_acl.py | thenetcircle/dino | 150 | 11085398 | <reponame>thenetcircle/dino<gh_stars>100-1000
from datetime import datetime
from datetime import timedelta
from uuid import uuid4 as uuid
from dino.auth.redis import AuthRedis
from dino.config import ApiActions, SessionKeys, RedisKeys
from dino.rest.resources.rooms_acl import RoomsAclResource
from test.base import Bas... |
tests/graph/test_node_graph.py | emekdahl/fal | 360 | 11085404 | <reponame>emekdahl/fal<gh_stars>100-1000
from typing import Dict, List
import networkx as nx
from unittest.mock import MagicMock, PropertyMock
from unittest.mock import patch
from fal.node_graph import NodeGraph, _add_after_scripts, _add_before_scripts
from utils import assert_contains_only, create_mock_model
@patch... |
src/python/nimbusml/tests/preprocessing/test_tostring.py | montehoover/NimbusML | 134 | 11085431 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import distro
import unittest
impo... |
tools/bundle_sdk.py | dartino/fletch | 144 | 11085447 | #!/usr/bin/env python
# Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# This script is creating a self contained directory with all the tools,
# librar... |
tests/requests_client/equality_test.py | educatedguessing/bravado | 600 | 11085456 | # -*- coding: utf-8 -*-
import pytest
from bravado.requests_client import RequestsClient
from bravado.requests_client import RequestsFutureAdapter
@pytest.fixture
def http_client():
return RequestsClient()
def test_equality_of_the_same_http_client(http_client):
assert http_client == http_client
def test_... |
src/sagemaker/serverless/predictor.py | longyuzhao/sagemaker-python-sdk | 1,690 | 11085492 | <filename>src/sagemaker/serverless/predictor.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/... |
demo/demo.py | hanranCode/mega.pytorch | 521 | 11085498 | import glob
import os
import argparse
from mega_core.config import cfg
from predictor import VIDDemo
parser = argparse.ArgumentParser(description="PyTorch Object Detection Visualization")
parser.add_argument(
"method",
choices=["base", "dff", "fgfa", "rdn", "mega"],
default="base",
type=str,
help=... |
benchmarks/orc/runorc-write.py | rahulyesantharao/tuplex | 778 | 11085503 | import tuplex
import time
import sys
import json
import os
import glob
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Write to Orc file format')
parser.add_argument('--path', type=str, dest='data_path', default='data/large100MB.csv',
help='path ... |
homeassistant/components/iammeter/sensor.py | learn-home-automation/core | 22,481 | 11085530 | <filename>homeassistant/components/iammeter/sensor.py
"""Support for iammeter via local API."""
import asyncio
from datetime import timedelta
import logging
import async_timeout
from iammeter import real_time_api
from iammeter.power_meter import IamMeterError
import voluptuous as vol
from homeassistant.components.sen... |
opticspy/ray_tracing/surface.py | Graylien/opticspy | 306 | 11085546 | <reponame>Graylien/opticspy
from __future__ import division as __division__
import numpy as __np__
import matplotlib.pyplot as __plt__
from . import glass_funcs
# Ray Class
class Surface(object):
'''
Surface Class
'''
def __init__(self,wavelength_list,number,radius,thickness,glass,STO,__diameter__):
... |
rasa/nlu/extractors/mitie_entity_extractor.py | fintzd/rasa | 9,701 | 11085551 | from __future__ import annotations
import logging
from rasa.nlu.tokenizers.tokenizer import Tokenizer
import typing
from typing import Any, Dict, List, Optional, Text, Type
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
from rasa.engine.sto... |
windows_packages_gpu/torch/nn/qat/modules/__init__.py | codeproject/DeepStack | 353 | 11085626 | <filename>windows_packages_gpu/torch/nn/qat/modules/__init__.py
from .linear import Linear
from .conv import Conv2d
__all__ = [
'Linear',
'Conv2d',
]
|
py/testdir_single_jvm/test_PCA_ignore_enums_fvec.py | gigliovale/h2o | 882 | 11085627 | <gh_stars>100-1000
import unittest, random, sys, time, string
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_pca, h2o_jobs as h2j
def write_syn_dataset(csvPathname, rowCount, colCount, SEED):
# do we need more than one random generator?
r1 = random.Rand... |
tests/circular_c.py | matan-h/friendly | 287 | 11085678 | <reponame>matan-h/friendly
# Attribute error for partially initialize module
import circular_c
a = circular_c.something
|
tests/test_eraserhead_output.py | yozlet/django-eraserhead | 216 | 11085698 | <filename>tests/test_eraserhead_output.py
# encoding: utf-8
import sys
import os
import re
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from django.test import TestCase, override_settings
from django.apps import apps
from django.conf import settings
import term
from bar.mode... |
braintree/disbursement.py | futureironman/braintree_python | 182 | 11085727 | from decimal import Decimal
from braintree.resource import Resource
from braintree.transaction_search import TransactionSearch
from braintree.merchant_account import MerchantAccount
class Disbursement(Resource):
class Type(object):
"""
"""
Credit = "credit"
Debit = "debit"
def... |
common/tests/test_markdown.py | aolin480/openpilot | 37,508 | 11085760 | <filename>common/tests/test_markdown.py
#!/usr/bin/env python3
from markdown_it import MarkdownIt
import os
import unittest
from common.basedir import BASEDIR
from common.markdown import parse_markdown
class TestMarkdown(unittest.TestCase):
# validate that our simple markdown parser produces the same output as `ma... |
qanta/guesser/abstract.py | Pinafore/qb | 122 | 11085775 | import os
import importlib
import warnings
from collections import defaultdict, namedtuple, Counter
from abc import ABCMeta, abstractmethod
from typing import List, Dict, Tuple, Optional, NamedTuple
import pickle
import matplotlib
with warnings.catch_warnings():
warnings.simplefilter("ignore")
matplotlib.use(... |
tools/pythonpkg/tests/fast/arrow/test_dictionary_arrow.py | AldoMyrtaj/duckdb | 2,816 | 11085785 | import duckdb
try:
import pyarrow as pa
import pyarrow.parquet
import numpy as np
from pandas import Timestamp
import datetime
import pandas as pd
can_run = True
except:
can_run = False
class TestArrowDictionary(object):
def test_dictionary(self,duckdb_cursor):
if not can_r... |
tools.py | suyukun666/UFO | 122 | 11085824 | import numpy as np
def custom_print(context, log_file, mode):
#custom print and log out function
if mode == 'w':
fp = open(log_file, mode)
fp.write(context + '\n')
fp.close()
elif mode == 'a+':
print(context)
fp = open(log_file, mode)
print(context, file=fp)
... |
dojo/engagement/queries.py | dant24/django-DefectDojo | 249 | 11085843 | <reponame>dant24/django-DefectDojo
from crum import get_current_user
from django.db.models import Exists, OuterRef, Q
from dojo.models import Engagement, Product_Member, Product_Type_Member, \
Product_Group, Product_Type_Group
from dojo.authorization.authorization import get_roles_for_permission, user_has_global_pe... |
colossalai/nn/lr_scheduler/multistep.py | RichardoLuo/ColossalAI | 1,630 | 11085876 | <filename>colossalai/nn/lr_scheduler/multistep.py
from typing import List
from torch.optim.lr_scheduler import MultiStepLR as _MultiStepLR
from colossalai.registry import LR_SCHEDULERS
from .delayed import WarmupScheduler
@LR_SCHEDULERS.register_module
class MultiStepLR(_MultiStepLR):
"""Decays the learning rat... |
glue/viewers/matplotlib/qt/tests/test_toolbar_mode.py | HPLegion/glue | 550 | 11085898 | <gh_stars>100-1000
from glue.viewers.matplotlib.tests.test_mouse_mode import TestMouseMode, Event
from ..toolbar_mode import ContrastMode
class TestContrastMode(TestMouseMode):
def mode_factory(self):
return ContrastMode
def test_move_ignored_if_not_right_drag(self):
e = Event(1, 2, button=... |
recipes/Python/578135_Markov_EncryptiModule/recipe-578135.py | tdiprima/code | 2,023 | 11085924 | import random
import sys
import collections
################################################################################
_CHAOS = random.SystemRandom()
def slots(names=''):
sys._getframe(1).f_locals['__slots__'] = \
tuple('__' + name for name in names.replace(',', ' ').split())
#####################... |
docs/examples/changing_parameters/SIR_change_tau.py | uluturki/Mathematics-of-Epidemics-on-Networks | 136 | 11085949 | import networkx as nx
import EoN
import matplotlib.pyplot as plt
r'''This code demonstrates a change in parameters at time t1. To do this, it
will run to time t1 and then stop, and restart with the new parameters.
To demonstrate that stopping and restarting doesn't do anything weird, we first
run to time t0, stop, ... |
preprocess/face_align.py | JinxedQAQ/Generating-Talking-Face-with-Controllable-Eye-Movements-by-Disentangled-Blinking-Feature | 706 | 11085955 | from __future__ import print_function, division
import torch.utils.data as data
from torch.utils.data import Dataset, DataLoader
import torch
import numpy as np
import os
import os.path
import cv2
import scipy.io as scio
def transformation_from_points(points1, scale):
points = [[70, 112],
[110, 112... |
zip_file_example/append_directory/main.py | DazEB2/SimplePyScripts | 117 | 11085987 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import zipfile
import os
def make_zipfile(source_dir, output_filename):
relroot = os.path.abspath(os.path.join(source_dir, os.pardir))
with zipfile.ZipFile(output_filename, "w", zipfile.ZIP_DEFLATED) as zip:
for root, dirs, file... |
salesforce/backend/base.py | agilentia/django-salesforce | 251 | 11085999 | # django-salesforce
#
# by <NAME>
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
"""
Salesforce database backend for Django. (like django,db.backends.*.base)
"""
from typing import Any, Dict, Optional, TYPE_CHECKING
from django.conf import settings
from django.db.... |
torch_geometric/datasets/gemsec.py | NucciTheBoss/pytorch_geometric | 2,350 | 11086034 | import os.path as osp
from typing import Callable, Optional
import numpy as np
import torch
from torch_geometric.data import Data, InMemoryDataset, download_url
class GemsecDeezer(InMemoryDataset):
r"""The Deezer User Network datasets introduced in the
`"GEMSEC: Graph Embedding with Self Clustering"
<ht... |
examples/scatterplot_sizes.py | amirhosseindavoody/seaborn | 8,852 | 11086037 | """
Scatterplot with continuous hues and sizes
==========================================
_thumb: .51, .44
"""
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the example planets dataset
planets = sns.load_dataset("planets")
cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True)
g = sns.relplot(
data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.