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 |
|---|---|---|---|---|
rpython/memory/test/test_generational_gc.py | nanjekyejoannah/pypy | 381 | 12695205 | <reponame>nanjekyejoannah/pypy
from rpython.memory.test import test_semispace_gc
class TestGenerationalGC(test_semispace_gc.TestSemiSpaceGC):
from rpython.memory.gc.generation import GenerationGC as GCClass
|
tools/print_system_info.py | BenjaminWegener/tensorflow-directml | 351 | 12695219 | <filename>tools/print_system_info.py
import sys
import subprocess
import tempfile
import os
import platform
import pkg_resources
import xml.etree.ElementTree as ET
# Determine version of tensorflow-directml
installed_packages = pkg_resources.working_set
tfdml_version = [p.version for p in installed_packages if p.key =... |
wouso/interface/apps/pages/__init__.py | AlexandruGhergut/wouso | 117 | 12695263 | __author__ = 'alex'
|
model/transformers/blocks.py | ishine/Comprehensive-Transformer-TTS | 147 | 12695268 | import torch
import torch.nn as nn
import numpy as np
from torch.nn import functional as F
import math
from utils.tools import make_positions
def Embedding(num_embeddings, embedding_dim, padding_idx=None):
m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx)
nn.init.normal_(m.weight, mean... |
04. Chapter_4/timing_hash_function.py | Mikma03/High-performance-Python | 223 | 12695288 | <filename>04. Chapter_4/timing_hash_function.py
import string
import timeit
class BadHash(str):
def __hash__(self):
return 42
class GoodHash(str):
def __hash__(self):
"""
This is a slightly optimized version of twoletter_hash
"""
return ord(self[1]) + 26 * ord(self[0]... |
tests/test_parallelism.py | colindean/peru | 525 | 12695323 | <reponame>colindean/peru
from textwrap import dedent
from peru import plugin
import shared
def assert_parallel(n):
# The plugin module keep a global counter of all the jobs that run in
# parallel, so that we can write these tests.
if plugin.DEBUG_PARALLEL_MAX != n:
raise AssertionError('Expected... |
Ryven/packages/auto_generated/doctest/nodes.py | tfroehlich82/Ryven | 2,872 | 12695354 | <filename>Ryven/packages/auto_generated/doctest/nodes.py
from NENV import *
import doctest
class NodeBase(Node):
pass
class Docfilesuite_Node(NodeBase):
"""
A unittest suite for one or more doctest files.
The path to each doctest file is given as a string; the
interpretation of that string de... |
data/server/king_phisher/alembic/env.py | chachabooboo/king-phisher | 1,143 | 12695419 | <filename>data/server/king_phisher/alembic/env.py
from __future__ import with_statement
from alembic import context
from sqlalchemy import create_engine, pool
from logging.config import fileConfig
import os
import sys
kp_path = os.path.dirname(os.path.abspath(__file__))
kp_path = os.path.normpath(os.path.join(kp_path,... |
source_code_in_theano/news_group_data.py | wasiahmad/paraphrase_identification | 126 | 12695426 | import numpy as np
from nltk import wordpunct_tokenize
import nltk
import itertools
import operator
import sklearn
import re, string
import math
SENTENCE_START_TOKEN = "sentence_<PASSWORD>"
SENTENCE_END_TOKEN = "sentence_<PASSWORD>"
UNKNOWN_TOKEN = "<PASSWORD>"
def load_data(loc='./data/'):
trainloc = loc + '20_... |
Algo and DSA/LeetCode-Solutions-master/Python/knight-probability-in-chessboard.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12695453 | # Time: O(k * n^2)
# Space: O(n^2)
class Solution(object):
def knightProbability(self, N, K, r, c):
"""
:type N: int
:type K: int
:type r: int
:type c: int
:rtype: float
"""
directions = \
[[ 1, 2], [ 1, -2], [ 2, 1], [ 2, -1], \
... |
pytorch_tutorials/dqn/visualize.py | paulrschrater/tutorials | 118 | 12695470 | <filename>pytorch_tutorials/dqn/visualize.py
import io
import time
import cv2
import numpy as np
import pyglet
import tensorflow as tf
import tensorflow.keras.backend as K
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from pyglet.gl import *
from sklearn.decomposition... |
questions/binary-tree-tilt/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 12695472 | """
Given the root of a binary tree, return the sum of every tree node's tilt.
The tilt of a tree node is the absolute difference between the sum of all left subtree node values and all right subtree node values. If a node does not have a left child, then the sum of the left subtree node values is treated as 0. The ru... |
cle/backends/static_archive.py | Atipriya/cle | 317 | 12695474 | import logging
from . import Backend, register_backend
from ..errors import CLEError
try:
import arpy
except ImportError:
arpy = None
l = logging.getLogger(__name__)
class StaticArchive(Backend):
@classmethod
def is_compatible(cls, stream):
stream.seek(0)
return stream.read(8) == b'!... |
recipes/sota/2019/lm_corpus_and_PL_generation/generate_uniq.py | Zilv1128/test1 | 5,921 | 12695489 | <filename>recipes/sota/2019/lm_corpus_and_PL_generation/generate_uniq.py
import sys
pl_data = []
with open(sys.argv[1], "r") as f:
for line in f:
pl_data.append(line.strip())
pl_data = set(pl_data)
with open(sys.argv[1] + ".unique", "w") as f:
for elem in pl_data:
f.write(elem + "\n")
|
elastichq/common/JobPool.py | billboggs/elasticsearch-HQ | 2,026 | 12695498 | from elastichq.globals import scheduler
# TODO: rename this to Metrics Service and move to service package
class JobPool():
app = None
def init_app(self, app):
self.app = app
return self
def blah(self):
JOB = {
'trigger': 'interval',
'seconds': 3 # ,
... |
01_BlueBorne/l2cap_infra/l2cap_infra.py | Charmve/BLE-Security-Att-Def | 149 | 12695499 | <gh_stars>100-1000
import sys
from scapy.layers.bluetooth import *
import binascii
from traced_bt_user_sock import BluetoothUserSocket_WithTrace
# TODO: Allocate scid dynamically (currently it is hard coded to OUR_LOCAL_SCID)
OUR_LOCAL_SCID = 0x40
def hci_devid(dev):
# Replacement to bluez's hci_devid because we ... |
mindsdb/api/mysql/mysql_proxy/datahub/__init__.py | yarenty/mindsdb | 261 | 12695500 | <reponame>yarenty/mindsdb
from mindsdb.api.mysql.mysql_proxy.datahub.datahub import init_datahub |
neural_sp/models/modules/mocha/mocha_test.py | ishine/neural_sp | 577 | 12695506 | <gh_stars>100-1000
# Copyright 2021 Kyoto University (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Chunkwise attention in MoChA at test time."""
import logging
import numpy as np
import torch
logger = logging.getLogger(__name__)
def hard_chunkwise_attention(alpha, u, mask, chunk_size, H_c... |
tools/device_file_generator/dfg/avr/avr_writer.py | roboterclubaachen/xpcc | 161 | 12695516 | <reponame>roboterclubaachen/xpcc
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Roboterclub Aachen e.V.
# All rights reserved.
#
# The file is part of the xpcc library and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# ------------------------------------... |
problems/euler/45/pentagonal.py | vidyadeepa/the-coding-interview | 1,571 | 12695523 | from itertools import takewhile, combinations
def triangle_generator(start):
n = 1
while True:
num = n*(n+1)/2
if num >= start:
yield num
n = n + 1
def pentagonal_generator(start):
n = 1
while True:
num = n*(3*n-1)/2
if num >= start:
yield num
n = n + 1
def hexagonal_gener... |
quokka/admin/forms.py | songshansitulv/quokka | 1,141 | 12695529 | # coding: utf-8
from flask_admin.babel import Translations
from flask_admin.form import rules # noqa
from flask_admin.form.fields import (DateTimeField, JSONField, Select2Field,
Select2TagsField, TimeField)
from flask_admin.form.widgets import Select2TagsWidget
from flask_admin.mo... |
pinion/common.py | dzarda/Pinion | 233 | 12695553 | <filename>pinion/common.py
import os
PKG_BASE = os.path.dirname(__file__)
RESOURCES = os.path.join(PKG_BASE, "resources")
|
pose_test.py | WestCityInstitute/DeepSFM | 235 | 12695614 | import argparse
import os.path as Path
import warnings
import custom_transforms
import time
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.optim
import torch.utils.data
from logger import AverageMeter
from transforms3d.axangles import mat2axangle
from convert import *
from demon_met... |
src/pyhf/__init__.py | Saransh-cpp/pyhf | 188 | 12695626 | from pyhf.tensor import BackendRetriever as tensor
from pyhf.optimize import OptimizerRetriever as optimize
from pyhf._version import version as __version__
from pyhf.exceptions import InvalidBackend, InvalidOptimizer, Unsupported
from pyhf import events
tensorlib = None
optimizer = None
def get_backend():
"""
... |
src/oci/cloud_guard/models/recommendation_summary.py | Manny27nyc/oci-python-sdk | 249 | 12695631 | <filename>src/oci/cloud_guard/models/recommendation_summary.py<gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apa... |
radon/tests/test_cli_colors.py | DolajoCZ/radon | 943 | 12695661 | import radon.cli.colors as colors
def test_color_enabled_yes(monkeypatch):
monkeypatch.setenv("COLOR", "yes")
assert colors.color_enabled()
def test_color_enabled_no(monkeypatch):
monkeypatch.setenv("COLOR", "no")
assert not colors.color_enabled()
def test_color_enabled_auto(monkeypatch, mocker):
... |
examples/spark_dataset_converter/utils.py | rizalgowandy/petastorm | 1,393 | 12695695 | <reponame>rizalgowandy/petastorm<gh_stars>1000+
import os
import tempfile
import requests
def download_mnist_libsvm(mnist_data_dir):
mnist_data_path = os.path.join(mnist_data_dir, "mnist.bz2")
data_url = "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/mnist.bz2"
r = requests.get(data_... |
pymdp/envs/visual_foraging.py | spetey/pymdp | 108 | 12695708 | <reponame>spetey/pymdp
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Visual Foraging Environment
__author__: <NAME>, <NAME>, <NAME>
"""
from pymdp.envs import Env
import numpy as np
LOCATION_ID = 0
SCENE_ID = 1
class VisualForagingEnv(Env):
def __init__(self, scenes=None, n_features=2):
if scenes... |
lib/zuora/views.py | goztrk/django-htk | 206 | 12695735 | <filename>lib/zuora/views.py
# Python Standard Library Imports
import json
# Django Imports
from django.http import Http404
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
# HTK Imports
from htk.lib.zuora.utils import get_... |
runners/__init__.py | ShenYujun/genforce | 827 | 12695743 | # python3.7
"""Collects all runners."""
from .stylegan_runner import StyleGANRunner
from .encoder_runner import EncoderRunner
__all__ = ['StyleGANRunner', 'EncoderRunner']
|
src/utils/logs.py | MrRobertYuan/docklet | 273 | 12695784 | #!/usr/bin/python3
from utils import env
import json, os
from utils.log import logger
from werkzeug.utils import secure_filename
logsPath = env.getenv('FS_PREFIX') + '/local/log/'
class logsClass:
setting = {}
def list(*args, **kwargs):
if ( ('user_group' in kwargs) == False):
return {"s... |
numpy_native_slower_than_translated.py | pmolfese/AppleSiliconForNeuroimaging | 188 | 12695801 | <filename>numpy_native_slower_than_translated.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import measure
#example where translated code (Python 3.8.3, NumPy version 1.19.4) is x10 faster than native code (Python 3.9.1rc1, NumPy version 1.19.4)
rng = np.rand... |
sacredboard/app/data/pymongo/genericdao.py | emited/sacredboard | 188 | 12695803 | <filename>sacredboard/app/data/pymongo/genericdao.py<gh_stars>100-1000
"""
Generic DAO object for safe access to the MongoDB.
Issue: https://github.com/chovanecm/sacredboard/issues/61
"""
import pymongo
from pymongo.errors import InvalidName
from sacredboard.app.data import DataSourceError
from .mongocursor import Mo... |
tests/test_summary.py | deeplearningforfun/torch-tools | 353 | 12695810 | <filename>tests/test_summary.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author : DevinYang(<EMAIL>)
import torch
from torchtoolbox.tools import summary
from torchvision.models.resnet import resnet50
from torchvision.models.mobilenet import mobilenet_v2
model1 = resnet50()
model2 = mobilenet_v2()
def test_summ... |
tests/integration-tests/tests/common/osu_common.py | enrico-usai/cfncluster | 279 | 12695818 | <filename>tests/integration-tests/tests/common/osu_common.py<gh_stars>100-1000
# Copyright 2021 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 locat... |
tests/shared/core/training_data/test_visualization.py | Next-Trends/rasa | 3,603 | 12695822 | <filename>tests/shared/core/training_data/test_visualization.py
from pathlib import Path
from typing import Text
import rasa.shared.utils.io
from rasa.shared.core.domain import Domain
from rasa.shared.core.events import ActionExecuted, SlotSet, UserUttered
from rasa.shared.core.training_data import visualization
impor... |
machina/apps/forum_conversation/forum_polls/__init__.py | BrendaH/django-machina | 572 | 12695860 | default_app_config = 'machina.apps.forum_conversation.forum_polls.apps.ForumPollsAppConfig'
|
src/zero_config.py | scy6500/large-scale-lm-tutorials | 128 | 12695872 | <reponame>scy6500/large-scale-lm-tutorials
"""
src/zero_args.py
"""
from datasets import load_dataset
from torch.optim import Adam
from torch.utils.data import DataLoader
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import deepspeed
import torch.distributed as dist
model = GPT2LMHeadModel.from_pretrained("g... |
alipay/aop/api/domain/KbAdvertIdentifyResponse.py | snowxmas/alipay-sdk-python-all | 213 | 12695873 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KbAdvertIdentifyResponse(object):
def __init__(self):
self._benefit_ids = None
self._benefit_type = None
self._code = None
self._ext_info = None
self._iden... |
examples/files/make_example_files.py | shawnbrown/dbfread | 179 | 12695880 | #!/usr/bin/env python2
"""
This creates the example file people.dbf.
You need the dbfpy library to run this.
"""
from __future__ import print_function
from dbfpy import dbf
def make_example_file(filename, fields, records, delete_last_record=False):
field_names = [field[0] for field in fields]
print('Creating... |
archai/algos/didarts/didarts_arch_trainer.py | shatadru99/archai | 344 | 12695882 | <reponame>shatadru99/archai<gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Mapping, Optional, Union, Tuple
import copy
import torch
from torch.utils.data import DataLoader
from torch import Tensor, nn, autograd
from torch.nn.modules.loss import _... |
Python3/1323.py | rakhi2001/ecom7 | 854 | 12695905 | __________________________________________________________________________________________________
class Solution:
def maximum69Number (self, num: int) -> int:
for idx in range(len(str(num))):
if str(num)[idx]=='6':
return int(str(num)[:idx]+'9'+str(num)[idx+1:])
return n... |
tests/pytests/unit/runners/test_network.py | waynegemmell/salt | 9,425 | 12695907 | """
Unit tests for Network runner
"""
import logging
import pytest
import salt.runners.network as network
from tests.support.mock import MagicMock, patch
log = logging.getLogger(__name__)
@pytest.fixture
def mac_addr_list():
test_list_mac_addresses = [
"08:00:27:82:b2:ca",
"52:54:00:ee:eb:e1",
... |
readthedocs/projects/migrations/0067_change_max_length_feature_id.py | mforbes/readthedocs.org | 4,054 | 12695994 | <filename>readthedocs/projects/migrations/0067_change_max_length_feature_id.py
# Generated by Django 2.2.17 on 2020-11-24 17:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0066_make_imported_file_slug_nullable'),
]
operations = ... |
train.py | liucongg/GPT2-NewsTitle | 540 | 12696012 | # -*- coding:utf-8 -*-
# @project: GPT2-NewsTitle
# @filename: train.py
# @author: 刘聪NLP
# @contact: <EMAIL>
# @time: 2020/12/16 16:28
"""
文件说明:
通过新闻正文生成新闻标题的GPT2模型的训练文件
"""
import torch
import os
import random
import numpy as np
import argparse
import logging
from transformers.modeling_gpt2 import GPT2Config
... |
usaspending_api/references/v2/views/total_budgetary_resources.py | ststuck/usaspending-api | 217 | 12696033 | <gh_stars>100-1000
from django.db.models import Sum
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.exceptions import InvalidParameterException
from usaspending_api.common.validator.t... |
indra/tests/test_tas.py | zebulon2/indra | 136 | 12696043 | <filename>indra/tests/test_tas.py<gh_stars>100-1000
from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the tot... |
tests/test_org_indexer.py | halhenke/promnesia | 1,327 | 12696047 | <reponame>halhenke/promnesia<filename>tests/test_org_indexer.py
from typing import Optional
from promnesia.common import Visit
from promnesia.sources.org import extract_from_file
from common import tdata, throw
def declrf(s: Optional[str]) -> Optional[str]:
if s is None:
return None
# meh.. not sure ... |
multi_AdaBoost/Bayes.py | wu546300070/weiboanalysis | 685 | 12696066 | <reponame>wu546300070/weiboanalysis<gh_stars>100-1000
'''
多类的朴素贝叶斯实现
'''
import random
import re
import traceback
import jieba
import matplotlib.pyplot as plt
import numpy as np
from pylab import mpl
from sklearn.externals import joblib
from sklearn.naive_bayes import MultinomialNB
jieba.load_userdict("../train/word.... |
workflows/pipe-common/pipeline/run_stats.py | msleprosy/cloud-pipeline | 126 | 12696076 | # Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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... |
tencentcloud/tcr/v20190924/errorcodes.py | PlasticMem/tencentcloud-sdk-python | 465 | 12696080 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... |
examples/pytorch/transformer/optims/__init__.py | ketyi/dgl | 9,516 | 12696082 | from .noamopt import *
|
sunpy/net/tests/test_baseclient.py | RhnSharma/sunpy | 628 | 12696103 | import re
import pytest
from sunpy.net import base_client, dataretriever, jsoc, vso
from sunpy.net.base_client import QueryResponseTable, convert_row_to_table
from sunpy.net.dataretriever.sources.norh import NoRHClient
_REGEX = re.compile(r"Client")
CLIENT_LIST = []
for a_import in [vso, jsoc, dataretriever]:
... |
mmocr/models/textrecog/backbones/resnet_abi.py | yuexy/mmocr | 2,261 | 12696106 | <reponame>yuexy/mmocr
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import BaseModule, Sequential
import mmocr.utils as utils
from mmocr.models.builder import BACKBONES
from mmocr.models.textrecog.layers import BasicBlock
@BACKBONES.register_module()
class ResNetABI(BaseModul... |
voice/Chat/files/utils/pattern_lister/pattern_lister.py | muhammadbilalakbar021/driverDrowsiness | 345 | 12696114 | <reponame>muhammadbilalakbar021/driverDrowsiness<gh_stars>100-1000
import sys
import os.path
import xml.etree.ElementTree as ET
if __name__ == '__main__':
aiml_dir = sys.argv[1]
csv_file = sys.argv[2]
print("aiml_dir:", aiml_dir)
print("csv_file:", csv_file)
questions = []
files = 0
fo... |
gcloud/iam_auth/view_interceptors/base_template.py | DomineCore/bk-sops | 881 | 12696123 | <filename>gcloud/iam_auth/view_interceptors/base_template.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (... |
pex/venv/bin_path.py | alexey-tereshenkov-oxb/pex | 2,160 | 12696126 | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from pex.enum import Enum
class BinPath(Enum["BinPath.Value"]):
class Value(Enum.Value):
pass
FALSE = Value("false")
PREPEND ... |
backend/projects/migrations/0023_auto_20190621_1129.py | donroyco/falco | 796 | 12696152 | # Generated by Django 2.2 on 2019-06-21 09:29
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("projects", "0022_availableauditparameters_is_active"),
... |
onnx_tf/handlers/backend/dropout.py | malisit/onnx-tensorflow | 1,110 | 12696160 | <filename>onnx_tf/handlers/backend/dropout.py
import copy
import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_func
@onnx_op("Dropout")
@tf_func(tf.nn.dropout)
class Dropout(BackendHandler):
@class... |
examples/embed/server_session/bokeh_app.py | kevin1kevin1k/bokeh | 15,193 | 12696171 | import numpy as np
from bokeh.io import curdoc
from bokeh.plotting import figure
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
"#%02x%02x%02x" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)
]
p = figure(tools="", toolbar_... |
rojak-analyzer/rojak.py | pyk/rojak | 107 | 12696198 | import csv
import click
import MySQLdb as mysql
# Custom tokenizer
# TODO: fix this, we can't load the model without this declaration
# something wrong with the pickle stuff
def whitespace_tokenizer(s):
return s.split(' ')
# Change class below to use different method
#from rojak_fasttext import RojakFastTextWrap... |
InvenTree/part/migrations/0054_auto_20201109_1246.py | ArakniD/InvenTree | 656 | 12696199 | # Generated by Django 3.0.7 on 2020-11-09 12:46
from django.db import migrations, models
import part.settings
class Migration(migrations.Migration):
dependencies = [
('part', '0052_partrelated'),
]
operations = [
migrations.AlterField(
model_name='part',
name='ac... |
notebook/pandas_index.py | vhn0912/python-snippets | 174 | 12696203 | import pandas as pd
df = pd.read_csv('data/src/sample_pandas_normal.csv', index_col=0)
print(df)
# age state point
# name
# Alice 24 NY 64
# Bob 42 CA 92
# Charlie 18 CA 70
# Dave 68 TX 70
# Ellen 24 CA 88
# Frank 30 NY 5... |
flocker/testtools/_testhelpers.py | stackriot/flocker | 2,690 | 12696221 | <filename>flocker/testtools/_testhelpers.py
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Helpers for testing our test code.
Only put stuff here that is specific to testing code about unit testing.
"""
from hypothesis.strategies import sampled_from
import unittest
from testtools.matchers import (
... |
foreman/data_refinery_foreman/foreman/management/commands/check_missing_results.py | AlexsLemonade/refinebio | 106 | 12696226 | from django.core.management.base import BaseCommand
from data_refinery_common.models import Sample
from data_refinery_common.performant_pagination.pagination import PAGE_SIZE, PerformantPaginator
class Command(BaseCommand):
def handle(self, *args, **options):
samples = Sample.processed_objects.all()
... |
netcal/metrics/__init__.py | by-liu/calibration-framework | 148 | 12696230 | # Copyright (C) 2019-2021 Ruhr West University of Applied Sciences, Bottrop, Germany
# AND Elektronische Fahrwerksysteme GmbH, Gaimersheim Germany
#
# This Source Code Form is subject to the terms of the Apache License 2.0
# If a copy of the APL2 was not distributed with this
# file, You can obtain one at https://www.a... |
lintreview/tools/yamllint.py | jsoref/lint-review | 271 | 12696232 | <reponame>jsoref/lint-review
import os
import lintreview.docker as docker
from lintreview.review import IssueComment
from lintreview.tools import Tool, process_quickfix, extract_version
class Yamllint(Tool):
name = 'yamllint'
def version(self):
output = docker.run('python2', ['yamllint', '--version... |
design/dynamics/annotate.py | ParikhKadam/cycloid | 156 | 12696240 | import cv2
import numpy as np
import params
METERS_PER_ENCODER_TICK = params.WHEEL_TICK_LENGTH
def draw_steering(bgr, steering, servo, center=(320, 420)):
# make steering wheel, lower center
#servo = 128*(servo - 125)/70.0
servo = steering
# sdeg = steering # just 1:1 i guess?
sdeg = params.STE... |
litex/soc/cores/bitbang.py | osterwood/litex | 1,501 | 12696243 | <gh_stars>1000+
#
# This file is part of LiteX.
#
# Copyright (c) 2019 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from migen.fhdl.specials import Tristate
from litex.soc.interconnect.csr import *
# I2C Master Bit-Banging --------------------------------------------------------------... |
face_detection/detection/sfd/__init__.py | zhaniya-meruki/ZhaniyaKoishybayevaMasterThesis | 5,863 | 12696263 | from .sfd_detector import SFDDetector as FaceDetector |
3_detector/grad_cam.py | meliketoy/gradcam.pytorch | 125 | 12696268 | #!/usr/bin/env python
# coding: utf-8
#
# Author: <NAME>
# URL: http://kazuto1011.github.io
# Created: 2017-05-26
from __future__ import print_function
from collections import OrderedDict
import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import... |
chempy/properties/__init__.py | bertiewooster/chempy | 340 | 12696304 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
This package implements various parameterisations of properties from the
litterature with relevance in chemistry.
"""
|
recipes/Python/438119_shell__Easily_call_executables/recipe-438119.py | tdiprima/code | 2,023 | 12696308 | <filename>recipes/Python/438119_shell__Easily_call_executables/recipe-438119.py
shell.py:
import sys
class Shell:
def __init__(self):
self.prefix = '/bin'
self.env = {}
self.stdout = None
self.stderr = None
self.wait = False
def __getattr__(self, command):
def _... |
sdk/machinelearning/azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 12696350 | <gh_stars>1000+
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator... |
neuralDX7/solvers/dx7_vae.py | boldsort/NeuralDX7 | 119 | 12696385 | import torch
from torch.nn import functional as F
from importlib import import_module
from torch.optim import AdamW
from torch.distributions.kl import kl_divergence
from torch.distributions import Normal
from agoge import AbstractSolver
from .utils import sigmoidal_annealing
class DX7VAE(AbstractSolver):
"""
... |
tests/chainer_tests/functions_tests/math_tests/test_minmax.py | zaltoprofen/chainer | 3,705 | 12696397 | <filename>tests/chainer_tests/functions_tests/math_tests/test_minmax.py
import unittest
import numpy
import chainer
from chainer import functions
from chainer import testing
from chainer import utils
@testing.parameterize(*testing.product({
'function_name': ['max', 'min'],
'shape': [(3, 2, 4)],
'dtype':... |
lib/simplejson/tests/test_indent.py | nirzari18/Query-Analysis-Application-on-Google-App-Engine | 5,079 | 12696411 | <gh_stars>1000+
from unittest import TestCase
import textwrap
import simplejson as json
from simplejson.compat import StringIO
class TestIndent(TestCase):
def test_indent(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh',
'i-vhbjkhnth',
{'nifty': 87}, {'field': 'y... |
timesformer_pytorch/__init__.py | halixness/generative_timesformer_pytorch | 565 | 12696439 | from timesformer_pytorch.timesformer_pytorch import TimeSformer
|
gluonfr/utils/lr_scheduler.py | OmoooJ/gluon-facex | 257 | 12696450 | <reponame>OmoooJ/gluon-facex<filename>gluonfr/utils/lr_scheduler.py
# @File : lr_scheduler.py
# @Author: X.Yang
# @Contact : <EMAIL>
# @Date : 18-12-27
from __future__ import division
from math import pi, cos
from mxnet import lr_scheduler
class IterLRScheduler(lr_scheduler.LRScheduler):
r"""Learning Rate Sche... |
skbio/stats/distance/_utils.py | jolespin/scikit-bio | 643 | 12696472 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
musicautobot/__init__.py | HalleyYoung/musicautobot | 402 | 12696506 | from .utils.setup_musescore import setup_musescore
setup_musescore() |
mmfashion/models/losses/mse_loss.py | RyanJiang0416/mmfashion | 952 | 12696515 | <reponame>RyanJiang0416/mmfashion
import torch.nn as nn
import torch.nn.functional as F
from ..registry import LOSSES
@LOSSES.register_module
class MSELoss(nn.Module):
def __init__(self,
ratio=1,
size_average=None,
reduce=None,
reduction='mean'... |
active_selection/regional_vote_entropy.py | hitman996/pytorch-deeplab-xception | 126 | 12696523 | from dataloader.paths import PathsDataset
from dataloader import indoor_scenes
from active_selection.vote_entropy import VoteEntropySelector
from utils.misc import turn_on_dropout, visualize_entropy, visualize_spx_dataset
import constants
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import... |
starthinker/task/dv_targeter/targeting.py | arbrown/starthinker | 138 | 12696547 | ###########################################################################
#
# Copyright 2020 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/l... |
src/example_extract_finetune.py | OlegJakushkin/s3prl | 856 | 12696554 | <reponame>OlegJakushkin/s3prl<gh_stars>100-1000
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ example_extract_finetune.py ]
# Synopsis [ an example code of using the wrapper class for downstream feature extraction o... |
src/coverage_test_helper.py | jmhodges/atheris | 964 | 12696587 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
testing/test_metastep_mixin.py | Neuraxio/Neuraxle | 519 | 12696592 | <gh_stars>100-1000
from neuraxle.pipeline import Pipeline
from neuraxle.base import BaseStep, MetaStepMixin
from neuraxle.union import Identity
from testing.mocks.step_mocks import SomeMetaStepWithHyperparams
class SomeMetaStep(MetaStepMixin, BaseStep):
def __init__(self, wrapped: BaseStep):
BaseStep.__i... |
ptm/__init__.py | Devyadav1994/python-topic-model | 200 | 12696606 | from .lda_gibbs import GibbsLDA
from .lda_vb import vbLDA
from .slda_gibbs import GibbsSupervisedLDA
from .collabotm import CollaborativeTopicModel
from .rtm import RelationalTopicModel
from .diln import DILN
from .hmm_lda import HMM_LDA
from .at_model import AuthorTopicModel
|
tests/test_parser.py | vultureofficial/Vulture | 107 | 12696608 | <filename>tests/test_parser.py<gh_stars>100-1000
import unittest
from abrvalg import ast
from abrvalg.lexer import Lexer, TokenStream
from abrvalg.parser import Parser
class ParserTest(unittest.TestCase):
def _parse(self, s):
return Parser().parse(TokenStream(Lexer().tokenize(s))).body
def _assertNo... |
pygithub3/services/git_data/references.py | teamorchard/python-github3 | 107 | 12696666 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pygithub3.services.base import Service
class References(Service):
"""Consume `References API <http://developer.github.com/v3/git/refs/>`_"""
def get(self, ref, user=None, repo=None):
""" Get a reference
:param str ref: The name of the ref... |
scripts/export_function_js/export_function.py | Justin-Fisher/webots | 1,561 | 12696674 | <reponame>Justin-Fisher/webots
#!/usr/bin/env python3
# Copyright 1996-2021 Cyberbotics 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.... |
model/db/zd_znode.py | knightoning/zkdash | 748 | 12696687 | <filename>model/db/zd_znode.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""
Copyright (c) 2014,掌阅科技
All rights reserved.
摘 要: zd_znode.py
创 建 者: zhuangshixiong
创建日期: 2015-06-16
"""
from peewee import CharField
from peewee import IntegerField
from peewee import SQL
from model.db.... |
tests/integration/test_format_schema_on_server/test.py | chalice19/ClickHouse | 8,629 | 12696720 | <gh_stars>1000+
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance("instance", clickhouse_path_dir="clickhouse_path")
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
instance.query("CREATE D... |
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/menu/urls.py | Nahid-Hassan/fullstack-software-development | 297 | 12696725 | from django.urls import path
from django.views.generic import TemplateView
app_name='menu'
urlpatterns = [
path('', TemplateView.as_view(template_name='menu/main_menu.html'), name='main'),
path('page1', TemplateView.as_view(template_name='menu/main_menu.html'), name='page1'),
path('page2', TemplateView.as_... |
testsuite/splineinverse-knots-ascend-reg/run.py | luyatshimbalanga/OpenShadingLanguage | 1,105 | 12696738 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_spl... |
tests/test_subclassing.py | andrzejnovak/boost-histogram | 105 | 12696739 | import boost_histogram as bh
def test_subclass():
NEW_FAMILY = object()
class MyHist(bh.Histogram, family=NEW_FAMILY):
pass
class MyRegular(bh.axis.Regular, family=NEW_FAMILY):
__slots__ = ()
class MyIntStorage(bh.storage.Int64, family=NEW_FAMILY):
pass
class MyPowTrans... |
src/iris/webhooks/rackspace.py | minhaz1/iris | 694 | 12696755 | <gh_stars>100-1000
from __future__ import absolute_import
from falcon import HTTPBadRequest
from iris.webhooks.webhook import webhook
class rackspace(webhook):
def validate_post(self, body):
if not all(k in body for k in("event_id", "details")):
raise HTTPBadRequest('missing event_id and/or ... |
voltron/entry.py | jonasmr/voltron | 5,856 | 12696756 | """
This is the main entry point for Voltron from the debugger host's perspective.
This file is loaded into the debugger through whatever means the given host
supports.
LLDB:
(lldb) command script import /path/to/voltron/entry.py
GDB:
(gdb) source /path/to/voltron/entry.py
VDB:
(vdb) script /path/to/v... |
src/modules/model.py | imatge-upc/rsis | 132 | 12696761 | <reponame>imatge-upc/rsis
import torch
import torch.nn as nn
from clstm import ConvLSTMCell
import argparse
import torch.nn.functional as f
from torch.autograd import Variable
from torchvision import transforms, models
import torch.nn as nn
import math
from vision import VGG16, ResNet34, ResNet50, ResNet101
i... |
Mariana/tests/datasetmaps_tests.py | rsumner31/Mariana-212 | 182 | 12696764 | import unittest
import Mariana.layers as ML
import Mariana.layers as ML
import Mariana.decorators as dec
import Mariana.costs as MC
import Mariana.regularizations as MR
import Mariana.scenari as MS
import Mariana.activations as MA
import Mariana.training.datasetmaps as MD
import theano.tensor as tt
import numpy
clas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.