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 |
|---|---|---|---|---|
corehq/apps/builds/management/commands/add_commcare_build.py | andyasne/commcare-hq | 471 | 11101047 | from github import Github
from django.core.management.base import BaseCommand, CommandError
from corehq.apps.builds.models import CommCareBuild, CommCareBuildConfig, BuildMenuItem, BuildSpec
class Command(BaseCommand):
help = ('Adds a commcare build, labeled with the version (x.y.z) and build_number (an incremen... |
unittest/scripts/auto/py_devapi/validation/collection_create_index.py | mueller/mysql-shell | 119 | 11101080 | #@<OUT> Create an index on a single field. 1 (WL10858-FR1_1)
*************************** 1. row ***************************
Table: my_coll
Non_unique: 1
Key_name: myIndex
Seq_in_index: 1
Column_name: <<<idx_col_1>>>
Collation: A
Cardinality: 0
Sub_part: 10
Packed: NULL
Null... |
rllib/examples/env/utils/interfaces.py | mgelbart/ray | 21,382 | 11101138 | ##########
# Contribution by the Center on Long-Term Risk:
# https://github.com/longtermrisk/marltoolbox
##########
from abc import ABC, abstractmethod
class InfoAccumulationInterface(ABC):
@abstractmethod
def _init_info(self):
raise NotImplementedError()
@abstractmethod
def _reset_info(self)... |
loris/utils.py | munnellg/loris | 150 | 11101145 | <filename>loris/utils.py
import errno
import logging
import os
import shutil
import uuid
logger = logging.getLogger(__name__)
def symlink(src, dst):
"""Create a symlink from ``src`` to ``dst``.
Creates any required intermediate directories, and overrides any existing
file at ``dst``.
"""
if sr... |
omega_miya/utils/bilibili_utils/request_utils.py | rinrini001/omega-miya | 120 | 11101165 | from nonebot import get_driver
from omega_miya.utils.omega_plugin_utils import HttpFetcher, PicEncoder
from omega_miya.database import Result
__GLOBAL_CONFIG = get_driver().config
BILI_SESSDATA = __GLOBAL_CONFIG.bili_sessdata
BILI_CSRF = __GLOBAL_CONFIG.bili_csrf
BILI_UID = __GLOBAL_CONFIG.bili_uid
class BiliReques... |
cassiopeia/dto/league.py | artemigkh/cassiopeia | 437 | 11101235 | <gh_stars>100-1000
from .common import DtoObject
class MiniSeriesDto(DtoObject):
pass
class LeagueEntryDto(DtoObject):
pass
class LeagueDto(DtoObject):
pass
class LeagueSummonerEntriesDto(DtoObject):
pass
class LeagueEntriesDto(DtoObject):
pass
class ChallengerLeagueListDto(DtoObject):
... |
tests/openwisp2/sample_integration_device/apps.py | scloudvn/openwisp-network-topology | 105 | 11101258 | from openwisp_network_topology.integrations.device.apps import (
OpenwispTopologyDeviceConfig as BaseAppConfig,
)
class OpenwispTopologyDeviceConfig(BaseAppConfig):
name = 'openwisp2.sample_integration_device'
label = 'sample_integration_device'
|
venv/lib/python3.9/site-packages/pendulum/lang/pl.py | qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | 224 | 11101260 | # -*- coding: utf-8 -*-
translations = {
# Days
'days': {
0: 'niedziela',
1: 'poniedziałek',
2: 'wtorek',
3: 'środa',
4: 'czwartek',
5: 'piątek',
6: 'sobota'
},
'days_abbrev': {
0: 'Nd',
1: 'Pn',
2: 'Wt',
3: 'Śr',
... |
tests/classification/interpret/sst_test.py | shunk031/allennlp-models | 402 | 11101278 | <reponame>shunk031/allennlp-models
import pytest
def test_gradient_visualization():
from allennlp.predictors.predictor import Predictor
predictor = Predictor.from_path(
"https://storage.googleapis.com/allennlp-public-models/sst-roberta-large-2020.06.08.tar.gz"
)
sentence = "a very well-made, ... |
utils/maintenance.py | goztrk/django-htk | 206 | 11101299 | # HTK Imports
from htk.utils import htk_setting
def is_maintenance_mode():
maintenance_mode = htk_setting('HTK_MAINTENANCE_MODE', False)
return maintenance_mode
|
tekore/_client/api/player/modify.py | evanofslack/tekore | 135 | 11101301 | <reponame>evanofslack/tekore
from typing import Union
from tekore._auth import scope
from tekore.model import RepeatState
from tekore._convert import to_uri
from ...base import SpotifyBase
from ...decor import send_and_process, scopes
from ...process import nothing
def offset_to_dict(offset: Union[int, str]):
""... |
scripts/build_sdk_ios.py | eliatlas/unity_sdk | 111 | 11101337 | from scripting_utils import *
def build(root_dir, ios_submodule_dir, with_test_lib):
# ------------------------------------------------------------------
# Paths.
src_dir = '{0}/sdk'.format(ios_submodule_dir)
lib_out_dir = '{0}/Assets/Adjust/iOS'.format(root_dir)
lib_out_dir... |
PR_BCI_team/Team_StarLab/DKHan/examples/giga_cnn/model_openbmi.py | PatternRecognition/OpenBMI | 217 | 11101369 | <gh_stars>100-1000
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
i... |
hpccm/primitives/runscript.py | robertmaynard/hpc-container-maker | 340 | 11101415 | <filename>hpccm/primitives/runscript.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 at
#
# http://www.apache.org/licenses/... |
contrib/notebooks/deep_learning/model_scripts/ConvNet_CIFAR10.py | hebinhuang/batch-shipyard | 279 | 11101426 | <filename>contrib/notebooks/deep_learning/model_scripts/ConvNet_CIFAR10.py
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __f... |
saleor/checkout/migrations/0028_auto_20200824_1019.py | fairhopeweb/saleor | 15,337 | 11101437 | # Generated by Django 3.1 on 2020-08-24 10:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("checkout", "0027_auto_20200810_1415"),
]
operations = [
migrations.AddField(
model_name="checkout",
name="redirect_url... |
tests/utils/test_array_utils.py | llv22/baal_tf2.4_mac | 575 | 11101449 | <reponame>llv22/baal_tf2.4_mac
import numpy as np
import pytest
import torch
from scipy.special import softmax, expit
from baal.utils import array_utils
from baal.utils.array_utils import to_prob
from baal.utils.iterutils import map_on_tensor
@pytest.fixture()
def a_tensor():
return torch.randn([10, 3, 32, 32])
... |
examples/command_send_message.py | tvorogme/pytg | 385 | 11101512 | # -*- coding: utf-8 -*-
"""
Simplest way to just send a message.
Without complicated message receiving stuff.
"""
from pytg.sender import Sender
__author__ = 'luckydonald'
def main():
sender = Sender("127.0.0.1", 4458)
# you need a CLI already running in json mode on port 4458.
res = sender.msg("@usernam... |
easyreg/ants_iter.py | ebrahimebrahim/easyreg | 107 | 11101530 | <filename>easyreg/ants_iter.py
from .base_toolkit import ToolkitBase
from .ants_utils import *
class AntsRegIter(ToolkitBase):
"""
The AntsRegIter provides an interface to [AntsPy](https://github.com/ANTsX/ANTsPy),
the version we work on is 0.1.4, though the newest version is 0.2.0
AntsPy is not fully ... |
recipes/Python/577758_Sleepsort_processes/recipe-577758.py | tdiprima/code | 2,023 | 11101531 | import os
import time
def sleepsort(l):
"""Another dumb sorting algorithm."""
pids = []
def reap():
while pids:
os.waitpid(pids.pop(), 0)
# Setup communication.
startr, startw = os.pipe()
resr, resw = os.pipe()
try:
for i, x in enumerate(l):
pid = os.... |
website/registries/utils.py | gaybro8777/osf.io | 628 | 11101601 | <gh_stars>100-1000
REG_CAMPAIGNS = {
'prereg': 'OSF Preregistration',
'osf-registered-reports': 'Registered Report Protocol Preregistration',
}
def get_campaign_schema(campaign):
from osf.models import RegistrationSchema
if campaign not in REG_CAMPAIGNS:
raise ValueError('campaign must be one o... |
libnd4j/include/graph/generated/nd4j/graph/ByteOrder.py | rghwer/testdocs | 13,006 | 11101621 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: graph
class ByteOrder(object):
LE = 0
BE = 1
|
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_infra_fti_cfg.py | CiscoDevNet/ydk-py | 177 | 11101633 | <reponame>CiscoDevNet/ydk-py
""" Cisco_IOS_XR_infra_fti_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR infra\-fti package configuration.
This module contains definitions
for the following management objects\:
dci\-fabric\-interconnect\: Configure FTI
parameters/sub\-parameters
Cop... |
LRC/train_mixup.py | houj04/AutoDL | 155 | 11101648 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
colossus/apps/templates/models.py | CreativeWurks/emailerpro | 372 | 11101661 | <gh_stars>100-1000
from django.db import models
from django.template.loader import get_template
from django.urls import reverse
from django.utils import timezone
from django.utils.html import mark_safe
from django.utils.translation import gettext_lazy as _
from .utils import wrap_blocks
class EmailTemplateManager(mo... |
languages/python/oso/polar/variable.py | connec/oso | 2,167 | 11101715 | class Variable(str):
"""An unbound variable type, can be used to query the KB for information"""
def __repr__(self):
return f"Variable({super().__repr__()})"
def __str__(self):
return repr(self)
def __eq__(self, other):
return super().__eq__(other)
def __hash__(self):
... |
extras/mysteryHex.py | Manny27nyc/BitcoinArmory | 505 | 11101750 | <reponame>Manny27nyc/BitcoinArmory<filename>extras/mysteryHex.py
#! /usr/bin/python
from os import path
import sys
from optparse import OptionParser
sys.path.append('..')
from pybtcengine import *
HASHCODE_HEADER = 1
HASHCODE_MERKLE = 2
HASHCODE_TX = 3
############################################################... |
src/programy/clients/polling/twitter/config.py | cdoebler1/AIML2 | 345 | 11101768 | <gh_stars>100-1000
"""
Copyright (c) 2016-2020 <NAME> http://www.keithsterling.com
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 u... |
env/Lib/site-packages/OpenGL/GL/ARB/ES3_2_compatibility.py | 5gconnectedbike/Navio2 | 210 | 11101785 | <filename>env/Lib/site-packages/OpenGL/GL/ARB/ES3_2_compatibility.py
'''OpenGL extension ARB.ES3_2_compatibility
This module customises the behaviour of the
OpenGL.raw.GL.ARB.ES3_2_compatibility to provide a more
Python-friendly API
Overview (from the spec)
This extension adds support for features of OpenGL ES 3... |
desktop/core/ext-py/odfpy-1.4.1/examples/subobject.py | yetsun/hue | 5,079 | 11101845 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2007 <NAME>, European Environment Agency
#
# This is free software. You may redistribute it under the terms
# of the Apache license and the GNU General Public License Version
# 2 or at your option any later version.
#
# This program is distr... |
eeauditor/auditors/aws/Amazon_VPC_Auditor.py | kbhagi/ElectricEye | 442 | 11101846 | <reponame>kbhagi/ElectricEye
#This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#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 ... |
Arrays/random_sample.py | techsavvyy/coding-problems | 2,647 | 11101853 | <filename>Arrays/random_sample.py
'''
Random Sample
Given an array and length of the sample, find a random sample from that array.
Input: [1, 2, 3, 4], 2
Output: This is a nondeterministic algorithm, C(N, K) combinations exist.
In this case 4! / (2! * (4 - 2)!) = 6. All combinations are a valid solution.
[1, ... |
tests/test_torch_hub.py | unitaryai/detoxify | 404 | 11101862 | <reponame>unitaryai/detoxify
import torch
import gc
def test_torch_hub_models():
result = torch.hub.list("unitaryai/detoxify")
def test_torch_hub_bert():
model = torch.hub.load('unitaryai/detoxify', 'toxic_bert')
del model
gc.collect()
def test_torch_hub_roberta():
model = torch.hub.load('unitary... |
sample/tensorflow/unit_test/fused_QKV_multihead_attention_unit_test.py | dujiangsu/FasterTransformer | 777 | 11101876 | <filename>sample/tensorflow/unit_test/fused_QKV_multihead_attention_unit_test.py
# Copyright (c) 2021, 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 a... |
animatplot/blocks/vectors.py | ianhi/animatplot | 402 | 11101881 | <reponame>ianhi/animatplot
from .base import Block
from .image_like import Pcolormesh
import numpy as np
class Quiver(Block):
"""
A block for animated quiver plots
Parameters
----------
X : 1D or 2D numpy array
The x positions of the arrows. Cannot be animated.
Y : 1D or 2D numpy arra... |
RecoTracker/FinalTrackSelectors/python/trackListMerger_cfi.py | ckamtsikis/cmssw | 852 | 11101883 | import FWCore.ParameterSet.Config as cms
#
# ctf tracks parameter-set entries for module
#
# TrackListMerger
#
# located in
#
# RecoTracker/FinalTrackSelectors
#
#
# sequence dependency:
#
#
#
# cleans and merges ctf and rs Track lists and put new list back in Event
trackListMerger = cms.EDProducer("TrackListMerger"... |
etl/parsers/etw/Microsoft_Windows_RemoteApp_and_Desktop_Connections.py | IMULMUL/etl-parser | 104 | 11101904 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-RemoteApp and Desktop Connections
GUID : 1b8b402d-78dc-46fb-bf71-46e64aedf165
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTim... |
ib/ext/cfg/EWrapperMsgGenerator.py | LewisW/IbPy | 1,260 | 11101906 | <filename>ib/ext/cfg/EWrapperMsgGenerator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ib.ext.cfg.EWrapperMsgGenerator -> config module for EWrapperMsgGenerator.java.
"""
from java2python.config.default import modulePrologueHandlers
modulePrologueHandlers += [
'from ib.ext.AnyWrapperMsgGenerator import Any... |
project/game/ai/riichi.py | MahjongRepository/tenhou-python-bot | 201 | 11101931 | <filename>project/game/ai/riichi.py<gh_stars>100-1000
from typing import List
from game.ai.defence.enemy_analyzer import EnemyAnalyzer
from game.ai.discard import DiscardOption
from game.ai.placement import Placement
from mahjong.tile import TilesConverter
from mahjong.utils import is_chi, is_honor, is_pair, is_termin... |
test/visuals/test_interpolation.py | colinmford/coldtype | 142 | 11101949 | from coldtype.test import *
ov = Font("assets/ColdtypeObviously.designspace")
@test((1000, 1000), rstate=1)
def test_mouse_interp(r, rs):
ri = r.inset(100)
sx, sy = ri.ipos(rs.mouse)
return [
DATPen().rect(ri).f(None).s(hsl(0.9, a=0.3)).sw(10),
(StyledString("COLD",
Style(ov, 2... |
app/core/lldbEvents.py | ant4g0nist/vegvisir | 209 | 11101991 | <gh_stars>100-1000
import json
import logging
from ..config import config
from threading import Thread
verbose = config.verbose
logging.basicConfig(name="lldb",level=logging.DEBUG)
def logEvent(eventType, event):
if verbose:
logging.debug("[:EVENT:] Type %d (%s)\n" %(eventType, str(event)))
def msgProces... |
src/modules/python/webapp/mods/io.vertx~example-web-app~1.0/app.py | vietj/vertx-examples | 143 | 11102025 | import vertx
from core.event_bus import EventBus
# Our application config - you can maintain it here or alternatively you could
# stick it in a conf.json text file and specify that on the command line when
# starting this verticle
# Configuration for the web server
web_server_conf = {
# Normal web server stuff
... |
tests/integration/advanced/graph/fluent/test_graph_explicit_execution.py | LaudateCorpus1/python-driver | 1,163 | 11102047 | # Copyright DataStax, 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 writing, softwa... |
zeus/common/util/benchmark_data.py | TianQi-777/xingtian | 240 | 11102065 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... |
sknetwork/clustering/__init__.py | HerrZYZ/scikit-network | 457 | 11102082 | <reponame>HerrZYZ/scikit-network
"""clustering module"""
from sknetwork.clustering.base import BaseClustering
from sknetwork.clustering.kmeans import KMeans
from sknetwork.clustering.louvain import Louvain
from sknetwork.clustering.metrics import modularity, bimodularity, comodularity, normalized_std
from sknetwork.clu... |
tests/test_botvars.py | KennethBlaney/rivescript-python | 154 | 11102089 | <reponame>KennethBlaney/rivescript-python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from .config import RiveScriptTestCase
class BotvarTests(RiveScriptTestCase):
"""Test bot variables."""
def test_bot_variables(self):
self.new("""
... |
tools/pot/openvino/tools/pot/engines/simplified_engine.py | pazamelin/openvino | 2,406 | 11102091 | <gh_stars>1000+
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from .ie_engine import IEEngine
from .utils import append_stats
class SimplifiedEngine(IEEngine):
@staticmethod
def _process_batch(batch):
""" Processes batch data and returns lists of annotations, image... |
apps/interface/models/interfacecase.py | rainydaygit/testtcloudserver | 349 | 11102111 | from library.api.db import EntityWithNameModel, db
class InterfaceCase(EntityWithNameModel):
ACTIVE = 0
DISABLE = 1
num = db.Column(db.Integer(), nullable=True, comment='用例序号')
name = db.Column(db.String(128), nullable=True, comment='用例名称')
desc = db.Column(db.String(256), comment='用例描述')
fun... |
Tools/sqfvalidator/sqf/expressions.py | Rowantrek/A3-Antistasi | 161 | 11102134 | from sqf.types import Keyword, Nothing, Anything, Type
from sqf.interpreter_types import InterpreterType
class Expression:
"""
A generic class to represent an expression. The expression matches according to the
types of their elements, listed in `types`.
"""
def __init__(self, types_or_values, ret... |
clpy/_version.py | fixstars/clpy | 142 | 11102138 | __version__ = '2.1.0rc1'
|
lib/astc-encoder/Test/astc_test_python.py | atteneder/KTX-Software | 619 | 11102156 | <filename>lib/astc-encoder/Test/astc_test_python.py
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
# Copyright 2020 Arm Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file ex... |
observations/r/accident.py | hajime9652/observations | 199 | 11102176 | # -*- 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 accident(path):
"""Ship Accidents
a cross-section
*number of ob... |
pygithub3/requests/repos/watchers.py | teamorchard/python-github3 | 107 | 11102206 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from . import Request
from pygithub3.resources.users import User
from pygithub3.resources.repos import Repo
class List(Request):
uri = 'repos/{user}/{repo}/watchers'
resource = User
class List_repos(Request):
uri = 'users/{user}/watched'
resource = ... |
external/android/xorpt.gyp | gordonjohnpatrick/XobotOS | 263 | 11102207 |
{
'includes': [
'../skia/gyp/common.gypi',
],
'targets': [
{
'target_name': 'xorpt',
'type': 'executable',
'mac_bundle' : 1,
'include_dirs' : [
'include'
],
'conditions': [
[ 'skia_os == "linux"', {
'cflags': [
'-fPIC', '-Wall'
... |
src/python/grpcio_tests/tests_aio/unit/channel_ready_test.py | warlock135/grpc | 36,552 | 11102212 | <filename>src/python/grpcio_tests/tests_aio/unit/channel_ready_test.py
# Copyright 2020 The gRPC 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... |
local/speaker-id-from-server.py | slckl/kaldi-offline-transcriber | 199 | 11102224 | #! /usr/bin/env python3
import argparse
import requests
import json
import sys
from urllib3.filepost import encode_multipart_formdata, choose_boundary
from urllib3.fields import RequestField
import subprocess
def encode_multipart_related(fields, boundary=None):
if boundary is None:
boundary = choose_boundary()... |
build/plugins/credits.py | mjjohns1/catboost | 6,989 | 11102276 | from _common import rootrel_arc_src
def oncredits_disclaimer(unit, *args):
if unit.get('WITH_CREDITS'):
unit.message(["warn", "CREDITS WARNING: {}".format(' '.join(args))])
def oncheck_contrib_credits(unit, *args):
module_path = rootrel_arc_src(unit.path(), unit)
for arg in args:
if modul... |
torcms/script/autocrud/html_tpl.py | bukun/TorCMS | 243 | 11102293 | # -*- coding:utf-8 -*-
'''
Tempaltes for CRUD.
'''
TPL_ADD = '''
{% extends "../../tmpl_kkkk/tpl_add.html" %}
{% block header %}
<h1>{{ header_text }}</h1>
{% end %}
{% block extrainfo %}
<div id="iga_add_rec_box">
xxxxxx
</div>
{% end %}
{% block footer %}
<p>{{ footer_t... |
src/prod/tools/linux/lldb/fabdbg.py | gridgentoo/ServiceFabricAzure | 2,542 | 11102298 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
"""
service fabric lldb extension
... |
pyroomacoustics/adaptive/data_structures.py | Womac/pyroomacoustics | 915 | 11102330 | <reponame>Womac/pyroomacoustics
from __future__ import division, print_function
import numpy as np
class Buffer:
"""
A simple buffer class with amortized cost
Parameters
----------
length: int
buffer length
dtype: numpy.type
data type
"""
def __init__(self, length=20... |
applications/smart-distancing/libs/loggers/csv_logger.py | mhsekhavat/neuralet | 228 | 11102339 | <gh_stars>100-1000
import csv
import os
from datetime import date
from tools.objects_post_process import extract_violating_objects
import numpy as np
def prepare_object(detected_object, frame_number):
"""Construct a dictionary that is appropriate for csv writer.
This function transform a dictionary with lis... |
exp_ssl.py | noskill/nips14-ssl | 496 | 11102343 | import learn_yz_x_ss
import sys
learn_yz_x_ss.main(n_passes=3000, n_labeled=int(sys.argv[1]), dataset='mnist_2layer', n_z=50, n_hidden=tuple([int(sys.argv[2])]*int(sys.argv[3])), seed=int(sys.argv[4]), alpha=0.1, comment='')
|
alg/compartmental_gp/pyro_model/exponential_break.py | loramf/mlforhealthlabpub | 171 | 11102347 | import torch
import torch.nn as nn
import logging
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer import MCMC, NUTS, SVI, TraceEnum_ELBO
from pyro.infer.autoguide import AutoNormal, init_to_sample
from pyro.infer.predictive import _guess_max_plate_nesting
from pyro.nn.module... |
backend/config/settings/development.py | stungkit/doccano | 2,082 | 11102440 | from .base import * # noqa: F403
MIDDLEWARE.append("api.middleware.RangesMiddleware") # noqa: F405
CORS_ORIGIN_WHITELIST = ("http://127.0.0.1:3000", "http://0.0.0.0:3000", "http://localhost:3000")
CSRF_TRUSTED_ORIGINS = CORS_ORIGIN_WHITELIST
# LOGGING = {
# 'version': 1,
# 'handlers': {
# 'console': ... |
tools/mac/rewrite_modern_objc.py | zipated/src | 2,151 | 11102456 | #!/usr/bin/env python
# Copyright 2018 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.
"""Runs clang's "modern objective-c" rewriter on chrome code.
Does the same as Xcode's Edit->Convert->To Modern Objective-C Syntax.
No... |
problems/euler/13/largesum.py | vidyadeepa/the-coding-interview | 1,571 | 11102466 | <reponame>vidyadeepa/the-coding-interview
numbers = [37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538,
74324986199524741059474233309513058123726617309629,
91942213363574161572522430563301811072406154908250,
23067588207539346171171980310421047513778063246676,
8926167... |
src/lib/weakref.py | DTenore/skulpt | 2,671 | 11102505 | import _sk_fail; _sk_fail._("weakref")
|
tests/utils/common.py | niobeus/onnx2torch | 144 | 11102511 | <filename>tests/utils/common.py
import io
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import Type
from typing import Union
import torch
import numpy as np
import onnx
imp... |
RecoVertex/BeamSpotProducer/test/BeamFit_LumiBased_Workflow.py | ckamtsikis/cmssw | 852 | 11102545 | import FWCore.ParameterSet.Config as cms
process = cms.Process("BSworkflow")
# initialize MessageLogger
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load("RecoVertex.BeamSpotProducer.d0_phi_analyzer_cff")
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/expre... |
orgsrc/plantuml.py | Sinamore/orgextended | 120 | 11102546 | <gh_stars>100-1000
import sublime
import sublime_plugin
import sys
import io
import re
import logging
import subprocess, os
import threading, time, signal
from shutil import copyfile
import OrgExtended.asettings as sets
# Python Babel Mode
def Extension(cmd):
return ".pu"
def WrapStart(cmd):
return "@startuml"
de... |
auctioning_platform/auctions/auctions/tests/test_bidding.py | nhdinh/smp-modulith | 299 | 11102560 | <reponame>nhdinh/smp-modulith
from datetime import datetime, timedelta
from typing import Optional
from unittest.mock import Mock, call
from freezegun import freeze_time
import pytest
import pytz
from foundation.events import EventBus
from foundation.value_objects.factories import get_dollars
from auctions import Be... |
utils/data_util.py | taha-a/image | 161 | 11102568 | import numpy as np
import pandas as pd
from collections import Counter
from nltk.tokenize import word_tokenize
import pickle
import json
import os
max_len = 20
word_threshold = 2
counter = None
def prepare_coco_captions(filename="Dataset/captions_val2014.json"):
'''
Prepare COCO Captions in the Flickr annotat... |
hl7apy/factories.py | ryoung29/hl7apy | 163 | 11102629 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018, CRS4
#
# 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... |
am4/rom/tools/disa29.py | yshestakov/cpu11 | 118 | 11102650 | <reponame>yshestakov/cpu11<filename>am4/rom/tools/disa29.py<gh_stars>100-1000
#!/usr/bin/python3
#
# Disassembler for M4 processor Am2900 microcode
# Copyright 2015 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3
... |
examples/hf_transformers/custom/loss.py | AhmedHussKhalifa/torchdistill | 576 | 11102701 | import torch
from torch import nn
from torch.nn import functional
from torchdistill.losses.single import register_org_loss
from torchdistill.losses.util import register_func2extract_org_output
@register_func2extract_org_output
def extract_transformers_loss(org_criterion, student_outputs, teacher_outputs, targets, us... |
falkon/hopt/optimization/gd_train.py | mohamad-amin/falkon | 130 | 11102705 | import time
from functools import reduce
from typing import Dict, List, Any, Optional
import numpy as np
import torch
from falkon.hopt.objectives.objectives import HyperoptObjective, FakeTorchModelMixin
from falkon.hopt.optimization.reporting import pred_reporting, EarlyStop, epoch_bookkeeping
__all__ = [
"train... |
libsortvis/algos/mergesort.py | tknuth/sortvis | 117 | 11102767 | <gh_stars>100-1000
def mergesort(lst, left=0, right=None):
if right is None:
right = len(lst) - 1
if left >= right:
return
middle = (left + right) // 2
mergesort(lst, left, middle)
mergesort(lst, middle + 1, right)
i, end_i, j = left, middle, middle + 1
while i <= end_i and ... |
tests/__init__.py | peddamat/home-assistant-supervisor-test | 597 | 11102774 | <filename>tests/__init__.py
"""Supervisor Testframework."""
|
etl/parsers/etw/Microsoft_Windows_OneX.py | IMULMUL/etl-parser | 104 | 11102831 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-OneX
GUID : ab0d8ef9-866d-4d39-b83f-453f3b8f6325
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.parser... |
05-record-like/cards.py | hdcpereira/example-code-2e | 990 | 11102840 | <gh_stars>100-1000
from dataclasses import dataclass
@dataclass(order=True)
class Card:
rank: str
suit: str
ranks = [str(n) for n in range(2, 10)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
|
aif360/metrics/mdss/generator.py | sumacm/fairattr | 982 | 11102875 | <reponame>sumacm/fairattr
import pandas as pd
import numpy as np
def get_entire_subset():
"""
Returns the entire subset, which is an empty dictionary
:return: empty dictionary
"""
return {}
def get_random_subset(coordinates: pd.DataFrame, prob: float, min_elements: int = 0):
"""
Returns ... |
recipes/Python/552739_Mixing_features_tree_md5sum__treemd5_/recipe-552739.py | tdiprima/code | 2,023 | 11102882 | <gh_stars>1000+
#!/usr/bin/python
import os
import os.path
import sys
import md5
from stat import *
from optparse import OptionParser
class Stats:
def __init__(self):
self.filenb = 0
self.dirnb = 0
self.othernb = 0
self.unstatablenb = 0
def scan_tree(lst, maxlen, dirname, dirpath, prefix, nxt_prefix, option... |
fugue/extensions/_builtins/processors.py | kvnkho/fugue | 547 | 11102922 | <reponame>kvnkho/fugue
from typing import Any, List, Type, no_type_check
from fugue.collections.partition import PartitionCursor
from fugue.dataframe import (
ArrayDataFrame,
DataFrame,
DataFrames,
LocalDataFrame,
to_local_bounded_df,
)
from fugue.column import ColumnExpr, SelectColumns as ColumnsS... |
chapter5_语音降噪/C5_4_y.py | busyyang/python_sound_open | 165 | 11102960 | from chapter2_基础.soundBase import *
from chapter5_语音降噪.Wavelet import *
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
def awgn(x, snr):
snr = 10 ** (snr / 10.0)
xpower = np.sum(x ** 2) / len(x)
npower = xpower / snr
return x + np.random.randn(len(x... |
jsonrpcserver/main.py | bcb/jsonrpcserver | 144 | 11102982 | <gh_stars>100-1000
"""The public functions.
These three public functions all perform the same function of dispatching a JSON-RPC
request, but they each give a different return value.
- dispatch_to_responses: Returns Response(s) (or None for notifications).
- dispatch_to_serializable: Returns a Python dict or list of ... |
packages/core/minos-microservice-common/minos/common/testing/database/__init__.py | minos-framework/minos-python | 247 | 11103000 | <gh_stars>100-1000
from .clients import (
MockedDatabaseClient,
)
from .factories import (
MockedLockDatabaseOperationFactory,
MockedManagementDatabaseOperationFactory,
)
from .operations import (
MockedDatabaseOperation,
)
|
backend/conduit/settings/docker.py | fivehoho75/aws-workshop | 135 | 11103012 | <filename>backend/conduit/settings/docker.py
import json
import os
from conduit.settings.defaults import *
DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True'
STATIC_ROOT = '/data/static/'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'E... |
backend/category/ssh/ssh_connection.py | zerlee/open-cmdb | 126 | 11103027 | import paramiko
from rest_framework.exceptions import ParseError
'''
https://blog.csdn.net/qq_24674131/article/details/95618304
免密登陆的用户
1. 本机到远程做免密
2. 远程用户加入sudoers,并设置免密sudo
'''
class SSHConnection:
# 初始化连接创建Transport通道
def __init__(self, host='xxx.xxx.xxx.xxx', port=22, user='xxx', pwd='<PASSWORD>', key_... |
src/pretix/helpers/escapejson.py | fabm3n/pretix | 1,248 | 11103065 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free... |
test/specs/openapi/parameters/test_simple_payloads.py | gluhar2006/schemathesis | 659 | 11103068 | <gh_stars>100-1000
"""Tests for behavior not specific to forms."""
import pytest
from schemathesis.parameters import PayloadAlternatives
from schemathesis.specs.openapi.parameters import OpenAPI20Body, OpenAPI30Body
@pytest.mark.parametrize(
"consumes",
(
["application/json"],
# Multiple valu... |
tests/nlu_hc_tests/training_tests/chunk_resolution/chunk_resolver_tests.py | milyiyo/nlu | 480 | 11103078 | <gh_stars>100-1000
import unittest
import pandas as pd
import nlu
from sparknlp.annotator import BertSentenceEmbeddings
import tests.nlu_hc_tests.secrets as sct
class ChunkResolverTrainingTests(unittest.TestCase):
def test_chunk_resolver_training(self):
"""When training a chunk resolver, word_embedding are... |
2017-07_Seminar/Session 3 - Relation CNN/code/cnn.py | dineshsonachalam/deeplearning4nlp-tutorial | 593 | 11103110 | <reponame>dineshsonachalam/deeplearning4nlp-tutorial
"""
This is a CNN for relation classification within a sentence. The architecture is based on:
<NAME>, <NAME>, <NAME>, <NAME> and <NAME>, 2014, Relation Classification via Convolutional Deep Neural Network
Performance (without hyperparameter optimization):
Accuracy... |
keanu-python/tests/test_proposal_distributions.py | rs992214/keanu | 153 | 11103117 | <filename>keanu-python/tests/test_proposal_distributions.py<gh_stars>100-1000
import numpy as np
import pytest
from keanu import BayesNet, Model
from keanu.algorithm._proposal_distribution import ProposalDistribution
from keanu.vertex import Gamma, Gaussian
from keanu.vartypes import tensor_arg_types
@pytest.fixture... |
pliers/utils/__init__.py | nickduran/pliers | 229 | 11103181 | <filename>pliers/utils/__init__.py
""" Utilities """
from .base import (listify, flatten, batch_iterable, classproperty, isiterable,
isgenerator, progress_bar_wrapper, attempt_to_import,
EnvironmentKeyMixin, verify_dependencies, set_iterable_type,
APIDependent, ... |
src/ralph/dashboards/migrations/0003_graph_push_to_statsd.py | DoNnMyTh/ralph | 1,668 | 11103200 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboards', '0002_auto_20170509_1404'),
]
operations = [
migrations.AddField(
model_name='graph',
n... |
template_filters.py | simon987/od-database | 133 | 11103248 | <filename>template_filters.py
import datetime
import time
import od_util
def setup_template_filters(app):
app.jinja_env.globals.update(truncate_path=od_util.truncate_path)
app.jinja_env.globals.update(get_color=od_util.get_color)
app.jinja_env.globals.update(get_mime=od_util.get_category)
@app.temp... |
2021/visuals/day_02/submarine/commands.py | salt-die/Advent-of-Code | 105 | 11103256 | import yaml
import re
from pathlib import Path
_THIS_DIR = Path(__file__).parent
_INPUTS = _THIS_DIR.parent.parent.parent / "aoc_helper" / "inputs.yaml"
_RAW = yaml.full_load(_INPUTS.read_text())["2"]
COMMANDS = [
(command, int(amount))
for command, amount in re.findall(r"(\w+) (\d+)", _RAW)
]
|
tests/integration/exception_test.py | markowanga/stweet | 101 | 11103276 | import pytest
import stweet as st
from stweet import WebClient
from stweet.auth import SimpleAuthTokenProvider
from stweet.exceptions import RefreshTokenException, ScrapBatchBadResponse
from stweet.exceptions.too_many_requests_exception import TooManyRequestsException
from stweet.http_request import RequestResponse
fr... |
InvenTree/stock/migrations/0066_stockitem_scheduled_for_deletion.py | carlos-riquelme/InvenTree | 656 | 11103349 | <reponame>carlos-riquelme/InvenTree<filename>InvenTree/stock/migrations/0066_stockitem_scheduled_for_deletion.py
# Generated by Django 3.2.4 on 2021-09-07 06:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0065_auto_20210701_0509'),
]
... |
sdk/python/pulumi_gcp/compute/get_health_check.py | sisisin/pulumi-gcp | 121 | 11103356 | <reponame>sisisin/pulumi-gcp<gh_stars>100-1000
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Opt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.