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 |
|---|---|---|---|---|
tests/components/generic_thermostat/__init__.py | MrDelik/core | 30,023 | 11096029 | """generic_thermostat tests."""
|
vint/linting/lint_target.py | mosheavni/vint | 538 | 11096033 | <gh_stars>100-1000
from typing import Optional # noqa: F401
from pathlib import Path
from io import BufferedIOBase
class AbstractLintTarget(object):
def __init__(self, path): # type: (Path) -> None
self.path = path
def read(self): # type: () -> bytes
raise NotImplementedError()
class L... |
examples/cairns_excel/flow_through_cross_sections.py | samcom12/anuga_core | 136 | 11096044 | <filename>examples/cairns_excel/flow_through_cross_sections.py
"""
Post-processing code to compute flux through cross-sections. Implementation
currently uses an approximate method
The user must hard-code the polylines directionay (defining the cross-sections) below.
See the help for 'get_approximate_discharge_timeser... |
test/pre_train/model_stats_perf.py | chao1412732094/tensorwatch | 3,453 | 11096053 | import copy
import tensorwatch as tw
import torchvision.models
import torch
import time
model = getattr(torchvision.models, 'densenet201')()
def model_timing(model):
st = time.time()
for _ in range(20):
batch = torch.rand([64, 3, 224, 224])
y = model(batch)
return time.time()-st
print(mod... |
tests/converters/test_odbc_uplink_converter.py | linxingchao/tb_gateway_with_extension | 1,123 | 11096065 | <filename>tests/converters/test_odbc_uplink_converter.py
# Copyright 2020. ThingsBoard
#
# 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/licens... |
src/gluonts/mx/distribution/bijection_output.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 11096087 | <reponame>Xiaoxiong-Liu/gluon-ts<filename>src/gluonts/mx/distribution/bijection_output.py
# Copyright 2018 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 Licen... |
myia/operations/prim_split.py | strint/myia | 222 | 11096096 | <reponame>strint/myia<gh_stars>100-1000
"""Definitions for the primitive `split`."""
import numpy as np
from ..lib import (
SHAPE,
TYPE,
AbstractTuple,
bprop_to_grad_transform,
standard_prim,
)
from ..operations import concat, zeros_like
from . import primitives as P
def pyimpl_split(x, sections... |
pycket/test/test_prims.py | namin/pycket | 129 | 11096099 | <gh_stars>100-1000
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# A place for testing primitives
#
import pytest
import os
import sys
from pycket import values
from pycket.values import w_true
from pycket.test.testhelper import check_all, check_none, check_equal, run_flo, run_fix, run, run_mod, run_mod_expr... |
contrib/stack/stripmapStack/unpackFrame_ROIPAC_raw.py | vincentschut/isce2 | 1,133 | 11096104 | <reponame>vincentschut/isce2
#!/usr/bin/env python3
import isce
from isceobj.Sensor import createSensor
import shelve
import argparse
import glob
from isceobj.Util import Poly1D
from isceobj.Planet.AstronomicalHandbook import Const
import os
from mroipac.dopiq.DopIQ import DopIQ
import copy
def cmdLinePa... |
hs_core/tests/api/native/test_set_public.py | hydroshare/hydroshare | 178 | 11096115 | <reponame>hydroshare/hydroshare
import os
import tempfile
import shutil
from unittest import TestCase, skip
from django.contrib.auth.models import Group, User
from django.core.exceptions import ValidationError
from hs_core.hydroshare import resource
from hs_core.models import GenericResource
from hs_core.testing imp... |
tracing/tracing/metrics/discover_unittest.py | tingshao/catapult | 2,151 | 11096130 | # Copyright (c) 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 unittest
from tracing.metrics import discover
class MetricsDiscoverUnittest(unittest.TestCase):
def testMetricsDiscoverEmpty(self):
self.a... |
nmigen/compat/sim/__init__.py | psumesh/nmigen | 528 | 11096150 | from amaranth.compat.sim import *
from amaranth.compat.sim import __all__
import warnings
warnings.warn("instead of nmigen.compat.sim, use amaranth.compat.sim",
DeprecationWarning, stacklevel=2)
|
src/richie/apps/courses/migrations/0012_add_translation_model_for_licence_fields.py | leduong/richie | 174 | 11096151 | # Generated by Django 2.2.9 on 2020-01-02 15:07
import django.db.models.deletion
from django.db import migrations, models
import parler.models
import richie.apps.core.fields.multiselect
class Migration(migrations.Migration):
dependencies = [("courses", "0011_deprecate_untranslated_licence_fields")]
opera... |
histolab/data/_registry.py | Toughee/histolab | 149 | 11096172 | <reponame>Toughee/histolab
# flake8: noqa
# in legacy datasets we need to put our sample data within the data dir
legacy_datasets = ["cmu_small_region.svs"]
# Registry of datafiles that can be downloaded along with their SHA256 hashes
# To generate the SHA256 hash, use the command
# openssl sha256 filename
registry =... |
semtorch/models/archs/backbones/__init__.py | WaterKnight1998/SemTorch | 145 | 11096185 | from .build import BACKBONE_REGISTRY, get_segmentation_backbone
from .xception import *
from .mobilenet import *
from .resnet import * |
tests/test_vectorizer.py | vj1494/kindred | 141 | 11096212 | <reponame>vj1494/kindred
import numpy as np
import kindred
import os
import json
from kindred.datageneration import generateData,generateTestData
def check(valueName,value):
write = False
scriptDir = os.path.dirname(__file__)
jsonPath = os.path.join(scriptDir,'data','vectorizer','expected.json')
if os.path.isfil... |
blackstone/displacy_palette.py | DeNeutoy/Blackstone | 541 | 11096216 | ner_displacy_palette = {
"CASENAME": "#da3650",
"CITATION": "#67328b",
"JUDGE": "#00a594",
"COURT": "#fcd548",
"PROVISION": "#007bac",
"INSTRUMENT": "#6c63a5",
"CONCEPT": "#df5a35",
}
ner_displacy_options = {
"ents": [
"CASENAME",
"CITATION",
"JUDGE",
"CO... |
tests/layer_tests/onnx_tests/test_argmax.py | ryanloney/openvino-1 | 1,127 | 11096235 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.layer_test_class import check_ir_version
from common.onnx_layer_test_class import OnnxRuntimeLayerTest
from unit_tests.utils.graph import build_graph
class TestArgMax(OnnxRuntimeLayerTest):... |
metadrive/component/road_network/__init__.py | liuzuxin/metadrive | 125 | 11096241 | from metadrive.component.road_network.road import Road, Route
from metadrive.component.road_network.node_road_network import NodeRoadNetwork
|
raw_packet/Tests/Unit_tests/Scripts/Apple/test_apple_arp_dos.py | Vladimir-Ivanov-Git/raw_packet | 146 | 11096249 | # region Description
"""
test_apple_arp_dos.py: Unit tests for Raw-packet script: apple_arp_dos.py
Author: <NAME>
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from sys import path
from os.path import dirname, abspath
from os import system, kill
from signal import SIGTERM
from time im... |
nuplan/common/utils/split_state.py | motional/nuplan-devkit | 128 | 11096250 | from dataclasses import dataclass
from typing import Any, List
@dataclass
class SplitState:
"""Dataclass representing a state split between fixed states, linear states and angular states."""
linear_states: List[Any] # Variable states
angular_states: List[float] # Variable states, representing angles, w... |
guillotina/component/globalregistry.py | vinissimus/guillotina | 173 | 11096257 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
tests/test_mask_utils_detectron2.py | mintar/mseg-api | 213 | 11096279 | <filename>tests/test_mask_utils_detectron2.py
#!/usr/bin/env python3
import cv2
import matplotlib.pyplot as plt
import numpy as np
from mseg.utils.mask_utils_detectron2 import Visualizer
def test_visualizer1() -> None:
"""
label map with four quadrants.
| Sky | Road |
----------------
| Pers... |
sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test_ecs.py | willarmiros/opentelemetry-python-contrib | 208 | 11096289 | # Copyright The OpenTelemetry 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 or agreed to in ... |
tests/components/homekit/conftest.py | MrDelik/core | 30,023 | 11096302 | """HomeKit session fixtures."""
from contextlib import suppress
import os
from unittest.mock import patch
from pyhap.accessory_driver import AccessoryDriver
import pytest
from homeassistant.components.device_tracker.legacy import YAML_DEVICES
from homeassistant.components.homekit.const import EVENT_HOMEKIT_CHANGED
f... |
tests/test_ast.py | odinsemvosem/SKompiler | 112 | 11096320 | <reponame>odinsemvosem/SKompiler<gh_stars>100-1000
#pylint: disable=wildcard-import,unused-wildcard-import,no-member
import numpy as np
from skompiler.ast import *
from skompiler.dsl import *
def test_dsl():
assert isinstance(ident('x'), Identifier)
assert isinstance(ident('x', 1), VectorIdentifier)
asser... |
sketchy/controllers/tasks.py | fakeNetflix/sketchy | 790 | 11096321 | # Copyright 2014 Netflix, 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... |
utils/gyb_benchmark_support.py | francisvm/swift | 427 | 11096330 | <reponame>francisvm/swift
# ===--- gyb_benchmark_support.py --------------------*- coding: utf-8 -*-===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See h... |
src/zeep/wsse/__init__.py | vascohenriques/python-zeep | 1,763 | 11096353 | <filename>src/zeep/wsse/__init__.py
from .compose import Compose # noqa
from .signature import BinarySignature, MemorySignature, Signature # noqa
from .username import UsernameToken # noqa
|
tableschema/types/duration.py | vincentchevrier/tableschema-py | 224 | 11096374 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
import datetime
import isodate
from ..config import ERROR
# Module API
def cast_duration(format, value, **options... |
src/vm_test.py | laubonghaudoi/Cantonese | 1,188 | 11096401 | <reponame>laubonghaudoi/Cantonese
import register_vm as r_vm
import stack_vm as s_vm
def test_register_vm() -> None:
CantoneseState = r_vm.CanState("")
CantoneseState.push_boolean(True)
CantoneseState.dump()
CantoneseState.push_integer(10)
CantoneseState.dump()
CantoneseState.push_null()
Ca... |
ztag/annotations/FtpSoftAtHome.py | justinbastress/ztag | 107 | 11096424 | <reponame>justinbastress/ztag
import re
from ztag.annotation import Manufacturer
from ztag.annotation import Annotation
from ztag.annotation import Type
from ztag.annotation import OperatingSystem
from ztag import protocols
import ztag.test
class FtpSoftAtHome(Annotation):
protocol = protocols.FTP
subprotocol... |
src/scriv/gitinfo.py | kurtmckee/scriv | 110 | 11096438 | <filename>src/scriv/gitinfo.py
"""Get information from git."""
import logging
import os
import subprocess
import sys
from pathlib import Path
import click
from .shell import run_command, run_simple_command
logger = logging.getLogger()
def user_nick() -> str:
"""
Get a short name for the current user.
... |
backdoors/shell/pyth.py | mehrdad-shokri/backdoorme | 796 | 11096461 | <reponame>mehrdad-shokri/backdoorme<filename>backdoors/shell/pyth.py
from backdoors.backdoor import *
class Pyth(Backdoor):
prompt = Fore.RED + "(py) " + Fore.BLUE + ">> " + Fore.RESET
def __init__(self, core):
cmd.Cmd.__init__(self)
self.intro = GOOD + "Using Python module..."
self.core = core
self.opti... |
mindspore/python/mindspore/_extends/remote/kernel_build_server_ascend.py | PowerOlive/mindspore | 3,200 | 11096474 | <reponame>PowerOlive/mindspore
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
VisualBERT/mmf/trainers/core/evaluation_loop.py | Fostereee/Transformer-MM-Explainability | 322 | 11096498 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
from abc import ABC
from typing import Any, Dict, Tuple, Type
import torch
import tqdm
from VisualBERT.mmf.common.meter import Meter
from VisualBERT.mmf.common.report import Report
from VisualBERT.mmf.common.sample import to_device
from VisualBERT.mmf.... |
onir/datasets/query_iter.py | tgeral68/OpenNIR | 140 | 11096510 | from onir import util
@util.allow_redefinition_iter
def query_iter(dataset,
fields: set,
shuf: bool = False,
random=None
):
qids = dataset.all_query_ids()
if shuf:
qids = list(qids)
random.shuffle(qids)
for qid in qids:
rec... |
torch/distributed/constants.py | MagiaSN/pytorch | 206 | 11096521 | from datetime import timedelta
# Default process group wide timeout, if applicable.
# This only applies to the gloo and nccl backends
# (only if NCCL_BLOCKING_WAIT or NCCL_ASYNC_ERROR_HANDLING is set to 1).
# To make an attempt at backwards compatibility with THD, we use an
# extraordinarily high default timeout, give... |
alipay/aop/api/response/AlipayFundJointaccountDetailQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 11096542 | <filename>alipay/aop/api/response/AlipayFundJointaccountDetailQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.JointAccountQuotaRespDTO import JointAccountQuotaRespDTO
from alipay.aop.api.domain.Autho... |
pywt/tests/test_wpnd.py | tbbharaj/pywt | 1,435 | 11096551 | <gh_stars>1000+
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from itertools import product
from functools import reduce
import operator
import numpy as np
from numpy.testing import (assert_allclose, assert_, assert_raises,
assert_equal)
import pywt... |
cinder/tests/unit/backup/drivers/test_backup_glusterfs.py | helenwalsh/cinder | 571 | 11096601 | # Copyright (c) 2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
dnachisel/biotools/formatting_operations.py | simone-pignotti/DnaChisel | 124 | 11096646 | """Text and number formatting operations"""
from copy import deepcopy
import json
import numpy as np
def round_all_numbers_in_dict(d, rounding_digits=2, outplace=True):
""" Return a new version of dict d with all floats rounded to N digits."""
if outplace:
d = deepcopy(d)
for k, v in d.items():
... |
qf_lib_tests/unit_tests/portfolio_construction/test_black_litterman.py | webclinic017/qf-lib | 198 | 11096675 | <gh_stars>100-1000
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... |
tests/unpickle-strtree.py | Jeremiah-England/Shapely | 2,382 | 11096700 | # See test_strtree.py::test_pickle_persistence
import sys
import os
sys.path.append(os.getcwd())
import pickle
from shapely.geometry import Point
from shapely.geos import geos_version
if __name__ == "__main__":
pickled_strtree = sys.stdin.buffer.read()
print("received pickled strtree:", repr(pickled_strtre... |
pylayers/antprop/examples/ex_antenna2.py | usmanwardag/pylayers | 143 | 11096710 | from pylayers.antprop.antenna import *
from pylayers.antprop.antvsh import *
import matplotlib.pylab as plt
from numpy import *
import pdb
"""
This test :
1 : loads a measured antenna
2 : applies an electrical delay obtained from data with getdelay method
3 : evaluate the antenna vsh coefficient with a dow... |
greykite/sklearn/uncertainty/base_uncertainty_model.py | kenzie-q/greykite | 1,503 | 11096727 | # BSD 2-CLAUSE LICENSE
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# Redistributions i... |
test/test_wrong_exception_protocolbase_getitem.py | Duiesel/python-jsonschema-objects | 329 | 11096739 | import pytest
import python_jsonschema_objects as pjo
@pytest.fixture
def base_schema():
return {
"title": "example",
"type": "object",
"additionalProperties": False,
"properties": {
"dictLike": {"additionalProperties": {"type": "integer"}, "type": "object"}
},... |
unsilence/lib/intervals/Interval.py | RomanKornev/unsilence | 236 | 11096756 | class Interval:
"""
Represents a section in time where the media file is either silent or audible
"""
def __init__(self, start=0, end=0, is_silent=False):
"""
Initializes an Interval object
:param start: Start time of the interval in seconds
:param end: End time of the i... |
mahotas/features/tas.py | langner/mahotas | 541 | 11096777 | <reponame>langner/mahotas
# Copyright (C) 2008-2012, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
# Carnegie Mellon University
#
# License: MIT (see COPYING file)
import numpy as np
from ..convolve import convolve
from ..thresholding import otsu
__all__ = ['pftas', 'tas']
_M2 = np.ones((3, 3))
... |
test/functions/lambda7.py | kylebarron/MagicPython | 1,482 | 11096790 | <filename>test/functions/lambda7.py
anon = lambda a, c={'key':
555}, e=fff: None
anon : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
lambda : meta.lambda-function.python, s... |
axes/__init__.py | LucienC/django-axes | 831 | 11096813 | <gh_stars>100-1000
from pkg_resources import get_distribution
import django
if django.VERSION < (3, 2):
default_app_config = "axes.apps.AppConfig"
__version__ = get_distribution("django-axes").version
|
17-it-generator/tree/extra/drawtree.py | fluentpython/example-code-2e | 990 | 11096833 | from tree import tree
SP = '\N{SPACE}'
HLIN = '\N{BOX DRAWINGS LIGHT HORIZONTAL}' # ─
ELBOW = f'\N{BOX DRAWINGS LIGHT UP AND RIGHT}{HLIN*2}{SP}' # └──
TEE = f'\N{BOX DRAWINGS LIGHT VERTICAL AND RIGHT}{HLIN*2}{SP}' # ├──
PIPE = f'\N{BOX DRAWINGS LIGHT VERTICAL}{SP*3}' ... |
build/build/root/opt/bin/py-chrome-history.py | scobiehague/dotfiles | 117 | 11096842 | <reponame>scobiehague/dotfiles<filename>build/build/root/opt/bin/py-chrome-history.py<gh_stars>100-1000
#!/usr/bin/python2
# py-chrome-history
#
# A script to convert Google Chrome's history file to the standard HTML-ish
# bookmarks file format.
#
# Copyright (c) 2011 <NAME>. This program is released under the ISC
# ... |
lib/screenscan.py | nkrios/flashlight | 197 | 11096859 | <filename>lib/screenscan.py
try:
import re
import shlex
import datetime
import subprocess
from lib.core.core import Core
from lib.screen.webscan import WebScan
from lib.core.threadpool import Worker,ThreadPool
except ImportError, err:
from lib.core.core import Core
Core.print_error(err)
class ScreenScan(We... |
configs/detection/attention_rpn/coco/attention-rpn_r50_c4_4xb2_coco_official-10shot-fine-tuning.py | BIGWangYuDong/mmfewshot | 376 | 11096860 | <reponame>BIGWangYuDong/mmfewshot
_base_ = [
'../../_base_/datasets/query_aware/few_shot_coco.py',
'../../_base_/schedules/schedule.py', '../attention-rpn_r50_c4.py',
'../../_base_/default_runtime.py'
]
# classes splits are predefined in FewShotCocoDataset
# FewShotCocoDefaultDataset predefine ann_cfg for m... |
deep-rl/lib/python2.7/site-packages/OpenGL/GL/ARB/vertex_type_2_10_10_10_rev.py | ShujaKhalid/deep-rl | 210 | 11096866 | '''OpenGL extension ARB.vertex_type_2_10_10_10_rev
This module customises the behaviour of the
OpenGL.raw.GL.ARB.vertex_type_2_10_10_10_rev to provide a more
Python-friendly API
Overview (from the spec)
This extension adds the following data formats:
Two new vertex attribute data formats: a signed 2.10.10.10 ... |
dex/parsers.py | qintangtao/python.dex | 291 | 11096876 | __author__ = 'eric'
import re
from utils import pretty_json, small_json, yamlfy
from time import strptime, mktime
from datetime import datetime
import traceback
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
##################################################... |
src/benchmarks/cmp_NA19240.py | npinter/cuteSV | 116 | 11096887 | <filename>src/benchmarks/cmp_NA19240.py
import sys
import argparse
import logging
import time
callset = {1: "cuteSV", 2: "Sniflles", 3: "PBSV", 4: "SVIM"}
USAGE="""\
Evaluate SV callset on NA19240 dataset
"""
def parseArgs(argv):
parser = argparse.ArgumentParser(prog="NA19240_eval", description=USAGE, formatter_cl... |
mindinsight/lineagemgr/common/utils.py | fapbatista/mindinsight | 216 | 11096895 | <filename>mindinsight/lineagemgr/common/utils.py
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
stix_shifter_modules/msatp/tests/stix_translation/test_query_constructor_func.py | pyromaneact/stix-shifter | 129 | 11096953 | from stix_shifter_modules.msatp.stix_translation import query_constructor
from stix_shifter_modules.msatp.stix_translation.query_constructor import QueryStringPatternTranslator
import unittest
class MergeDictTests(unittest.TestCase):
def test_with_overlapping_keys(self):
dict_01 = {1: 'a', 2: 'b', 3: 'c',... |
tests/apps/core/test_templates_richie_homepage.py | regisb/richie | 174 | 11096960 | """
Test suite for the Open Graph of the homepage
"""
import re
from django.test.utils import override_settings
from cms.test_utils.testcases import CMSTestCase
from richie.apps.core.helpers import create_i18n_page
class TemplatesRichieHomepageTestCase(CMSTestCase):
"""Testing the base.html template"""
de... |
String/809. Expressive Words.py | beckswu/Leetcode | 138 | 11096984 | <filename>String/809. Expressive Words.py
"""
809. Expressive Words
Example:
Input:
S = "heeellooo"
words = ["hello", "hi", "helo"]
Output: 1
Explanation:
We can extend "e" and "o" in the word "hello" to get "heeellooo".
We can't extend "helo" to get "heeellooo" because the group "ll" is not extended.
"""... |
src/main.py | alpayuz/DeepDeblur-PyTorch | 158 | 11097015 | <reponame>alpayuz/DeepDeblur-PyTorch
"""main file that does everything"""
from utils import interact
from option import args, setup, cleanup
from data import Data
from model import Model
from loss import Loss
from optim import Optimizer
from train import Trainer
def main_worker(rank, args):
args.rank = rank
a... |
python/ql/test/3/library-tests/modules/general/confused_elements/__init__.py | vadi2/codeql | 4,036 | 11097027 | from .a import b as a |
rootpy/plotting/canvas.py | masonproffitt/rootpy | 146 | 11097036 | """
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""
from __future__ import absolute_import
from .. import ROOT, QROOT, asrootpy
from .base import convert_color
from ..base import NamedObject
from ..context import invisible_canvas
from ..decorators i... |
flaskerize/render.py | ehoeffner/flaskerize | 119 | 11097038 | <gh_stars>100-1000
import os
import argparse
from typing import Any, Callable, Dict, List, Optional
import fs
from termcolor import colored
from flaskerize.parser import FzArgumentParser
DEFAULT_TEMPLATE_PATTERN = ["**/*.template"]
class SchematicRenderer:
"""Render Flaskerize schematics"""
# Path to schem... |
var/spack/repos/builtin/packages/intel-oneapi-vtune/package.py | BenWibking/spack | 2,360 | 11097046 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
from spack import *
class IntelOneapiVtune(IntelOneApiPackage):
"""Intel oneAPI VTune Profiler.
... |
examples/python-base64.py | alexmv/go-camo | 161 | 11097063 | # Copyright (c) 2012-2019 <NAME>
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file.
import hashlib
import hmac
import base64
CAMO_HOST = 'https://img.example.com'
def camo_url(hmac_key, image_url):
if image_url.startswith("https:"):
return image_url
... |
effects/pacman.py | Bosken85/hyperion.ng | 1,808 | 11097070 | import hyperion, time
from random import randint
#get args
rotationTime = float(hyperion.args.get('rotationTime', 4))
marginPos = float(hyperion.args.get('margin-pos', 2))
# define pacman
pacman = bytearray((255, 255, 0))
# define ghosts
redGuy = bytearray((255, 0, 0))
pinkGuy = bytearray((255, 184, 255))
blueGu... |
app/jwt_utils.py | ristekoss/susunjadwal-backend | 155 | 11097103 | <filename>app/jwt_utils.py
import jwt
from flask import current_app as app
def encode_token(data):
return jwt.encode(data, app.config["SECRET_KEY"], algorithm='HS256').decode()
def decode_token(token):
try:
data = jwt.decode(token, app.config["SECRET_KEY"], algorithm='HS256')
except:
ret... |
examples/python/main.py | timfjord/sublime_debugger | 225 | 11097104 |
import time
from threading import Thread
import sys
import os
print(sys.version)
# print(os.environ)
def some_random_variables():
string = "abc"
integer = 1
floating = 2.345
array = [string, integer, floating]
table = {
'string': string,
'intger': integer,
'float': floating,
'array': array,
}
print(... |
api/integrations/slack/permissions.py | mevinbabuc/flagsmith | 1,259 | 11097112 | <filename>api/integrations/slack/permissions.py
from rest_framework.permissions import BasePermission
from environments.models import Environment
class OauthInitPermission(BasePermission):
def has_permission(self, request, view):
environment = Environment.objects.get(
api_key=view.kwargs.get(... |
scvi/_utils.py | njbernstein/scvi-tools | 398 | 11097130 | from textwrap import dedent
def _doc_params(**kwds):
"""\
Docstrings should start with "\" in the first line for proper formatting.
"""
def dec(obj):
obj.__orig_doc__ = obj.__doc__
obj.__doc__ = dedent(obj.__doc__).format_map(kwds)
return obj
return dec
|
tests/utils/test_dbus.py | pnjongang/supervisor | 597 | 11097142 | """Check dbus-next implementation."""
from dbus_next.signature import Variant
from supervisor.coresys import CoreSys
from supervisor.utils.dbus import DBus, _remove_dbus_signature
def test_remove_dbus_signature():
"""Check D-Bus signature clean-up."""
test = _remove_dbus_signature(Variant("s", "Value"))
... |
python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline_run_stats.py | dbatten5/dagster | 4,606 | 11097149 | import graphene
from dagster import check
from dagster.core.storage.pipeline_run import PipelineRunStatsSnapshot
from ..errors import GraphenePythonError
class GraphenePipelineRunStatsSnapshot(graphene.ObjectType):
id = graphene.NonNull(graphene.String)
runId = graphene.NonNull(graphene.String)
stepsSucc... |
tomviz/python/ReinterpretSignedToUnsigned.py | sankhesh/tomviz | 284 | 11097168 | <reponame>sankhesh/tomviz
def transform(dataset):
"""Reinterpret a signed integral array type as its unsigned counterpart.
This can be used when the bytes of a data array have been interpreted as a
signed array when it should have been interpreted as an unsigned array."""
import numpy as np
scalars... |
tg/models.py | horacexd/clist | 166 | 11097172 | <reponame>horacexd/clist
from django.db import models
from pyclist.models import BaseModel
from true_coders.models import Coder
class Chat(BaseModel):
chat_id = models.CharField(max_length=100, blank=True, null=True, unique=True)
coder = models.ForeignKey(Coder, on_delete=models.CASCADE)
title = models.C... |
Silver_Badges/Ayuba_hub_silver_badge/form.py | adeagaoluwaseun/Voting | 764 | 11097177 | from flask_wtf import FlaskForm
from wtforms.validators import DataRequired,Length
class VoterForm(FlaskForm):
username = StringField('Username',validators=[DataRequired(),Length(min=2,max=20)])
nin = IntegerField('Country Code', [validators.required()])
submit = SubmitField('Add Voter') |
desktop/core/src/desktop/lib/paginator.py | kokosing/hue | 5,079 | 11097179 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
qt__pyqt__pyside__pyqode/pyqt5__QTreeView_QFileSystemModel.py | DazEB2/SimplePyScripts | 117 | 11097205 | <reponame>DazEB2/SimplePyScripts<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtWidgets import QTreeView, QFileSystemModel, QApplication
from PyQt5.QtCore import QDir
if __name__ == '__main__':
app = QApplication([])
model = QFileSystemModel()
mod... |
augly/video/augmenters/ffmpeg/overlay.py | iAdityaEmpire/AugLy | 4,610 | 11097229 | <reponame>iAdityaEmpire/AugLy
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from augly.utils import is_image_file, is_v... |
ros/create_dockerfiles.py | christophebedard/docker_images-1 | 328 | 11097232 | <filename>ros/create_dockerfiles.py<gh_stars>100-1000
#!/usr/bin/env python3
import os
import sys
import yaml
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from em import Interpreter
from docker_templates.argparse import DockerfileArgParser
from docker_templates.create impor... |
build/android/gyp/proguard.py | zipated/src | 2,151 | 11097266 | #!/usr/bin/env python
#
# Copyright 2013 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 optparse
import os
import sys
from util import build_utils
from util import proguard_util
_DANGEROUS_OPTIMIZATIONS = [
... |
rnn_translator/pytorch/seq2seq/inference/inference.py | omshri22121999/training | 567 | 11097270 | import contextlib
import logging
import os
import subprocess
import time
import torch
import torch.distributed as dist
import seq2seq.data.config as config
from seq2seq.inference.beam_search import SequenceGenerator
from seq2seq.utils import AverageMeter
from seq2seq.utils import barrier
from seq2seq.utils import get... |
servers/docker-python/nohandler/server_app.py | veaba/ncov | 288 | 11097276 | import json
import socketio
from aiohttp import web
# from socket_app import socket_app
from mongo import update_news, query_list
sio = socketio.AsyncServer(cors_allowed_origins='*')
app = web.Application()
sio.attach(app)
async def index(request):
return web.Response(text="Hello Python socket.io", content_type=... |
h2o-py/tests/testdir_algos/glm/pyunit_glm_regularization_path.py | ahmedengu/h2o-3 | 6,098 | 11097296 | import sys
sys.path.insert(1,"../../../")
import h2o
from builtins import range
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator as glm
def reg_path_glm():
# read in the dataset and construct training set (and validation set)
d = h2o.import_file(path=pyunit_utils.loca... |
learning_python/modules/collateral/module_basics/use_module2b.py | fallenfuzz/pynet | 528 | 11097349 | from my_module2 import dns_ip
dns_ip()
dns_ip(dns="1.1.1.1")
|
tools/SDKTool/src/ui/tree/ai_tree/action_rain_bow_data.py | Passer-D/GameAISDK | 1,210 | 11097352 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
eeg_modelling/eeg_viewer/waveform_data_service.py | deepneuralmachine/google-research | 23,901 | 11097362 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
docs/conf.py | Leanny/mmpy_bot | 196 | 11097363 | # -*- coding: utf-8 -*-
import os
from mmpy_bot import __version__
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo"]
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = "mmpy_bot"
copyright = "2016, "
version = __version__
rele... |
recipes/opencore-amr/all/conanfile.py | rockandsalt/conan-center-index | 562 | 11097378 | <gh_stars>100-1000
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from contextlib import contextmanager
import os
required_conan_version = ">=1.33.0"
class OpencoreAmrConan(ConanFile):
name = "opencore-amr"
homepage = "https://sourceforge.net/projects/opencore-amr/"
description = "OpenCOR... |
samples/python/logpolar.py | thisisgopalmandal/opencv | 56,632 | 11097390 | <reponame>thisisgopalmandal/opencv<gh_stars>1000+
#!/usr/bin/env python
'''
plots image as logPolar and linearPolar
Usage:
logpolar.py
Keys:
ESC - exit
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
def main():
import sys
try:
fn... |
underworld/libUnderworld/config/packages/libm.py | longgangfan/underworld2 | 116 | 11097394 | from config import Package
class libm(Package):
def gen_locations(self):
yield ('/usr/local', ['/usr/local'], ['/usr/local'])
def gen_envs(self, loc):
for env in Package.gen_envs(self, loc):
self.headers = ['math.h']
if self.find_libraries(loc[2], 'm'):
... |
indra/tests/test_omnipath.py | zebulon2/indra | 136 | 11097421 | <reponame>zebulon2/indra
import requests
from indra.sources.omnipath import OmniPathProcessor
from indra.sources.omnipath.api import op_url
from indra.statements import Agent
from indra.ontology.standardize import standardize_agent_name
BRAF_UPID = 'P15056'
JAK2_UPID = 'O60674'
CALM1_UPID = 'P0DP23'
TRPC3_UPID = 'Q135... |
brew/metrics/evaluation.py | va26/brew | 344 | 11097437 | import numpy as np
import sklearn
import sklearn.metrics
class Evaluator(object):
def __init__(self, metric='auc'):
if metric == 'auc':
self.metric = auc_score
elif metric == 'acc':
self.metric = acc_score
def calculate(self, y_true, y_pred):
return self.metr... |
data_structures/trees/treap.py | vinta/fuck-coding-interviews | 590 | 11097443 | # coding: utf-8
"""
Treap
https://en.wikipedia.org/wiki/Treap
Treap is a self-balancing binary search tree which satisfies some extra properties:
- Each node has a random priority.
- Each random priority satisfies the properties of a heap.
- The parent's priority is less than or equal to children's priorities.
... |
beartype_test/a00_unit/a20_api/vale/_factory/test_valeisobj.py | vcokltfre/beartype | 1,056 | 11097445 | <filename>beartype_test/a00_unit/a20_api/vale/_factory/test_valeisobj.py
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
**Beartype code-based object data validation unit tests.**... |
Acceleration/memcached/regressionSims/testgen/memlib_example.py | pooyaww/Vivado_HLS_Samples | 326 | 11097449 | #!/usr/bin/python
import memlib
## FORMATTING A KV-PAIR #######################################################
# V1
ShortTest = memlib.kv_pair("k", "v", "DEADBEEF", 42)
# V2
Integration1 = {
"key" : "this-is-the-key-that-i'll-be-using-for-the-next-time-to-test-the-longest-of-all-keys",
"value" : "aa... |
drawBot/context/icnsContext.py | andyclymer/drawbot | 302 | 11097455 | <filename>drawBot/context/icnsContext.py<gh_stars>100-1000
import Quartz
import os
import shutil
import tempfile
from drawBot.misc import executeExternalProcess, DrawBotError
from drawBot.context.imageContext import ImageContext
class ICNSContext(ImageContext):
fileExtensions = ["icns"]
allowedPageSizes = ... |
app.py | sahilt20/fastapi-mongo | 120 | 11097472 | <reponame>sahilt20/fastapi-mongo
from fastapi import FastAPI, Depends
from auth.jwt_bearer import JWTBearer
from routes.student import router as StudentRouter
from routes.admin import router as AdminRouter
app = FastAPI()
token_listener = JWTBearer()
@app.get("/", tags=["Root"])
async def read_root():
return {"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.