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
FingersExtras/Python/cycle through CC lanes (keep lane heights constant).py
nikolalkc/sws
285
11167826
cmdId = RPR_NamedCommandLookup("_FNG_CYCLE_CC_LANE_KEEP_HEIGHT") RPR_Main_OnCommand(cmdId, 0)
barbican/api/controllers/secretstores.py
mail2nsrajesh/barbican
177
11167836
<reponame>mail2nsrajesh/barbican<filename>barbican/api/controllers/secretstores.py # (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP # # 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 ...
examples/classification/classification_example_base.py
bkaandemir/zemberek_deneme
113
11167837
""" Zemberek: Classification Example Base Documentation: https://bit.ly/2BNKPmP Original Java Example: https://bit.ly/2Prce6m fastText Documentation: https://bit.ly/31YVBS8 """ import re from pathlib import Path from typing import List from jpype import JClass, JString, java __all__: List[str] = ['ClassificationExam...
packages/pyright-internal/src/tests/samples/project_src_with_extra_paths/src/module1.py
sasano8/pyright
4,391
11167890
<reponame>sasano8/pyright from vendored1 import MSG print(MSG)
demo_sites/simple_image_upload/models.py
zhangyi886/django-aliyun-oss2-storage
104
11167899
from __future__ import unicode_literals from django.db import models # Create your models here. class Images(models.Model): image = models.ImageField(blank=False, upload_to="image/%Y/%m/%d")
tracardi/service/wf/domain/entity.py
bytepl/tracardi
153
11167971
<reponame>bytepl/tracardi from pydantic import BaseModel class Entity(BaseModel): id: str
Other/clone_datablock/clone_datablock.py
FreeNightKnight/ogre-next
701
11167987
<filename>Other/clone_datablock/clone_datablock.py #!/usr/bin/python import argparse import clang.cindex import io; import os; import sys #import hashlib if not sys.platform.startswith("win32"): from ctypes.util import find_library def setup_clang(library): if library == None: # LibClang shared libr...
examples/example_utils.py
rohanraja/cgt_distributed
698
11168031
<reponame>rohanraja/cgt_distributed<filename>examples/example_utils.py<gh_stars>100-1000 import cPickle as pickle import os, os.path as osp, shutil, numpy as np, urllib def train_val_test_slices(n, trainfrac, valfrac, testfrac): assert trainfrac+valfrac+testfrac==1.0 ntrain = int(np.round(n*trainfrac)) nva...
fuse/fuse.py
darwinharianto/pvnet-rendering
143
11168039
import pickle import numpy as np import os import time import cv2 from glob import glob from PIL import ImageFile, Image from plyfile import PlyData from skimage.io import imread, imsave from concurrent.futures import ProcessPoolExecutor from config import cfg class ModelAligner(object): rotation_transform = n...
datasets/div2k.py
KamranAlipour/NLRN
177
11168069
"""DIV2K dataset """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import argparse from PIL import Image import numpy as np import tensorflow as tf import datasets REMOTE_URL = 'http://data.vision.ee.ethz.ch/cvl/DIV2K/' TRAIN_LR_ARCHIVE_NAME ...
src/0053.maximum-subarray/maximum-subarray.py
lyphui/Just-Code
782
11168075
<gh_stars>100-1000 class Solution: def maxSubArray(self, nums: List[int]) -> int: best = curr = nums[0] for i in range(1, len(nums)): curr = max(nums[i], curr + nums[i]) best = max(best, curr) return best
tests/st/func/mindconverter/data/lenet_script.py
fapbatista/mindinsight
216
11168093
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
tests/gui/test_state.py
preeti98/sleap
156
11168104
import pytest from sleap.gui.state import GuiState def test_gui_state(): state = GuiState() # use a global var to count how many times callback is called times_x_changed = 0 def count_change_callback(): nonlocal times_x_changed times_x_changed += 1 # make sure that value can be...
optuna_dashboard/search_space.py
SCUTJcfeng/optuna-dashboard
177
11168120
<reponame>SCUTJcfeng/optuna-dashboard import copy import threading from typing import Dict from typing import List from typing import Optional from typing import Set from typing import Tuple from optuna.distributions import BaseDistribution from optuna.trial import FrozenTrial from optuna.trial import TrialState Sea...
unit/test_uvm_reg_block.py
rodrigomelo9/uvm-python
140
11168123
<gh_stars>100-1000 import unittest from uvm.reg.uvm_reg import UVMReg from uvm.reg.uvm_reg_block import UVMRegBlock from uvm.reg.uvm_reg_model import * class TestUVMRegBlock(unittest.TestCase): def test_add_reg(self): rb = UVMRegBlock("rb_blk") rb.create_map("", 0, 1, UVM_BIG_ENDIAN) reg...
sponsors/migrations/0006_auto_20201016_1517.py
ewjoachim/pythondotorg
911
11168150
# Generated by Django 2.0.13 on 2020-10-16 15:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("sponsors", "0005_auto_20201015_0908"), ] operations = [ migrations.RenameModel( old_name="SponsorshipLevel", new_na...
Filters/Points/Testing/Python/TestPointSmoothingFilter3.py
txwhhny/vtk
1,755
11168179
<reponame>txwhhny/vtk #!/usr/bin/env python # -*- coding: utf-8 -*- import vtk import vtk.test.Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Control test resolution NPts = 1500 math = vtk.vtkMath() math.RandomSeed(31415) # Controls the plane normal and view plane normal normal =...
donkey_gym/envs/__init__.py
araffin/learning-to-drive-in-a-day
260
11168183
from donkey_gym.envs.vae_env import *
cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_platform_software_oper.py
CiscoDevNet/ydk-py
177
11168204
<reponame>CiscoDevNet/ydk-py """ Cisco_IOS_XE_platform_software_oper This module contains a collection of YANG definitions for monitoring platform software in a Network Element """ from collections import OrderedDict from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataL...
tests/test_json.py
joaoTrevizoli/flask-mongoengine
675
11168218
import flask import pytest from flask_mongoengine import MongoEngine @pytest.fixture() def extended_db(app): app.json_encoder = DummyEncoder app.config["MONGODB_HOST"] = "mongodb://localhost:27017/flask_mongoengine_test_db" test_db = MongoEngine(app) db_name = test_db.connection.get_database("flask_m...
kAFL-Fuzzer/kafl_debug.py
SafeBreach-Labs/hAFL2
102
11168219
<gh_stars>100-1000 #!/usr/bin/env python3 # # Copyright (C) 2017-2019 <NAME>, <NAME>, <NAME> # Copyright (C) 2019-2020 Intel Corporation # # SPDX-License-Identifier: AGPL-3.0-or-later """ Execute a given kAFL target with individual test inputs for purpose of debug/inspection. """ import os import sys import common.c...
romp/lib/visualization/socket_utils.py
vltmedia/ROMP
385
11168221
<filename>romp/lib/visualization/socket_utils.py import socket import time from threading import Thread from queue import Queue import cv2 import numpy as np import json def myarray2string(array, separator=', ', fmt='%.3f', indent=8): assert len(array.shape) == 2, 'Only support MxN matrix, {}'.format(array.shape) ...
seahub/shortcuts.py
weimens/seahub
420
11168243
<filename>seahub/shortcuts.py # Copyright (c) 2012-2016 Seafile Ltd. # encoding: utf-8 def get_first_object_or_none(queryset): """ A shortcut to obtain the first object of a queryset if it exists or None otherwise. """ try: return queryset[:1][0] except IndexError: return None
ykdl/mediainfo.py
SeaHOH/ykdl
136
11168280
import sys import json import random import logging from collections import defaultdict from datetime import datetime from html import unescape from urllib.parse import unquote from .util import log from .util.fs import legitimize from .util.human import human_size, _format_time, human_time, stream_index from .util.ma...
tests/torch/test_attention_cell_torch.py
leezu/gluon-nlp
2,461
11168310
import numpy as np from numpy.testing import assert_allclose import torch as th from gluonnlp.torch import attention_cell as ac def check_attention_cell_basic(attention_cell, q_channel, k_channel, v_channel, use_mask, multi_head=False, num_heads=None, layout='NTK'): for query_length...
runtime/python/Lib/lib2to3/tests/data/bom.py
hwaipy/InteractionFreeNode
207
11168312
# coding: utf-8 print "BOM BOOM!"
scrapple/utils/config.py
scrappleapp/scrapple
331
11168318
""" scrapple.utils.config ~~~~~~~~~~~~~~~~~~~~~ Functions related to traversing the configuration file """ from __future__ import print_function from colorama import Back, Fore, init init() class InvalidConfigException(Exception): """Exception class for invalid config file. Example: duplicate field names""" ...
homeassistant/components/system_bridge/binary_sensor.py
liangleslie/core
30,023
11168326
<filename>homeassistant/components/system_bridge/binary_sensor.py<gh_stars>1000+ """Support for System Bridge binary sensors.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, ...
tests/probes/test_feeds_views.py
janheise/zentral
634
11168328
<reponame>janheise/zentral from functools import reduce import json import operator from unittest.mock import patch, MagicMock from django.contrib.auth.models import Group, Permission from django.db.models import Q from django.urls import reverse from django.utils.crypto import get_random_string from django.test import...
scrapy/generate-urls-at-start/main.py
whitmans-max/python-examples
140
11168331
<reponame>whitmans-max/python-examples #!/usr/bin/env python3 # # https://stackoverflow.com/a/47722953/1832058 # import scrapy class MySpider(scrapy.Spider): name = 'myspider' allowed_domains = ['http://quotes.toqoute.com'] #start_urls = [] tags = ['love', 'inspirational', 'life', 'humo...
api/schema_responses/serializers.py
gaybro8777/osf.io
628
11168333
<gh_stars>100-1000 from api.base.exceptions import Conflict from api.base.serializers import JSONAPISerializer, LinksField, TypeField from api.base.utils import absolute_reverse, get_object_or_error from rest_framework import serializers as ser from rest_framework.exceptions import ValidationError from api.base.serial...
src/UnitTests/TestData/Grammar/NamedExpressionScopeErrors.py
shayash22/python-language-server
695
11168334
<gh_stars>100-1000 [x for x, y in (pairs2 := pairs) if x % 2 == 0] [x for x, y in ([1, 2, 3, pairs2 := pairs]) if x % 2 == 0] {x: y for x, y in (pairs2 := pairs) if x % 2 == 0} {x for x, y in (pairs2 := pairs) if x % 2 == 0} foo = (x for x, y in ([1, 2, 3, pairs2 := pairs]) if x % 2 == 0) [[(j := j) for i in range(5)]...
recs/content_based_recommender.py
shandou/moviegeek
806
11168352
from decimal import Decimal from django.db.models import Q from analytics.models import Rating from recommender.models import MovieDescriptions, LdaSimilarity from recs.base_recommender import base_recommender lda_path = './lda/' class ContentBasedRecs(base_recommender): def __init__(self, min_sim=0.1): ...
utils/syscall.h.py
skyzh/core-os-riscv
239
11168371
<reponame>skyzh/core-os-riscv #!/usr/bin/env python3 ### Copyright (c) 2020 <NAME> ### ### This software is released under the MIT License. ### https://opensource.org/licenses/MIT from syscall import syscalls print("""//! This file is automatically generated with `syscall.h.py`, //! which contains all syscall ID. "...
blueapps/contrib/bk_commands/management/commands/celerybeat.py
qqqqqie/bk-sops
881
11168379
<filename>blueapps/contrib/bk_commands/management/commands/celerybeat.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 THL A29 Limited, a Tencent company. All rights reserved. Licensed unde...
xcessiv/config.py
KhaledTo/xcessiv
1,362
11168382
REDIS_HOST = 'localhost' REDIS_PORT = 6379 REDIS_DB = 8 QUEUES = ['default'] XCESSIV_PORT = 1994 NUM_WORKERS = 1 XCESSIV_META_FEATURES_FOLDER = 'meta-features' XCESSIV_NOTEBOOK_NAME = 'xcnb.db'
shorttext/__init__.py
vishalbelsare/PyShortTextCategorization
481
11168387
from . import utils from . import data from . import classifiers from . import generators from . import stack from .smartload import smartload_compact_model from . import metrics from . import spell
Python/imdb.py
thefool76/hacktoberfest2021
448
11168399
from bs4 import BeautifulSoup #Importing the Beautiful Soup Library import requests #Importing the requests library import time #Importing the time library import csv #Importing the csv module response = requests.get('https://www.imdb.com/chart/top') soup = BeautifulSoup(response.text, 'lxml') sra...
deep-rl/lib/python2.7/site-packages/OpenGL/WGL/NV/multisample_coverage.py
ShujaKhalid/deep-rl
210
11168404
<filename>deep-rl/lib/python2.7/site-packages/OpenGL/WGL/NV/multisample_coverage.py '''OpenGL extension NV.multisample_coverage This module customises the behaviour of the OpenGL.raw.WGL.NV.multisample_coverage to provide a more Python-friendly API Overview (from the spec) The ARB_multisample extension provides ...
app/lib/base/provider.py
grepleria/SnitchDNS
152
11168443
from app.lib.users.user_manager import UserManager from app.lib.base.settings import SettingsManager from app.lib.dns.manager import DNSManager from app.lib.dns.zone_manager import DNSZoneManager from app.lib.dns.record_manager import DNSRecordManager from app.lib.dns.log_manager import DNSLogManager from app.lib.dns.s...
examples/gslm/sampler.py
an918tw/textlesslib
198
11168447
<gh_stars>100-1000 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import typing as tp from fairseq import hub_utils, utils from fairseq.hub_utils import GeneratorHubInterface class UnitLa...
solution/greedy/2812/main.py
jungyoonoh/baekjoon-1
2,236
11168509
<gh_stars>1000+ # Authored by : cieske # Co-authored by : - # Link : http://boj.kr/632e2f63fb4a44caacbddb53207f2279 import sys def input(): return sys.stdin.readline().rstrip() n, k = map(int, input().split()) t = k # 미래를 위해 저장 num = list(input()) stack = [] # 정답 저장 및 지울 후보 저장 for i in range(n): while k>0 and...
attic/concurrency/parallel/llize_ex.py
matteoshen/example-code
5,651
11168517
import os from time import sleep, time from parallelize import parallelize, per_item DELAY = .2 def loiter(serial, delay): pid = os.getpid() print('%2d pid = %d' % (serial, pid)) sleep(delay) return pid t0 = time() results = [] for i in parallelize(range(15), fork=per_item): res = loiter(i, DEL...
samples/snippets/noxfile_config.py
DigitalCPR/pandas-gbq
281
11168533
# Copyright (c) 2021 pandas-gbq Authors All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. TEST_CONFIG_OVERRIDE = { "ignored_versions": ["2.7", "3.6"], }
desktop/core/ext-py/odfpy-1.4.1/examples/odtmerge.py
yetsun/hue
5,079
11168609
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2008 <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 distributed in the ho...
tests/test_sonify.py
PRamoneda/mir_eval
431
11168611
<filename>tests/test_sonify.py """ Unit tests for sonification methods """ import mir_eval import numpy as np import scipy def test_clicks(): # Test output length for a variety of parameter settings for times in [np.array([1.]), np.arange(10)*1.]: for fs in [8000, 44100]: click_signal = m...
scripts/ambisonic_to_binaural.py
facebookresearch/sound-spaces
171
11168614
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its 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. import subprocess from concurrent.futures import ThreadPoolExecutor import os def binauralize_ambi...
vim/rplugin/python3/denite/source/fast_file_mru.py
petobens/dotfiles
131
11168637
"""Slightly faster version of neomru source.""" from pathlib import Path from denite.base.source import Base class Source(Base): """Gather files from neomru a bit faster than default version.""" def __init__(self, vim): super().__init__(vim) self.name = 'fast_file_mru' self.kind = '...
examples/sharepoint/lists/read_list_via_query.py
theodoriss/Office365-REST-Python-Client
544
11168675
from office365.sharepoint.client_context import ClientContext from office365.sharepoint.listitems.caml.caml_query import CamlQuery from tests import test_client_credentials, test_team_site_url def print_progress(items_read): print("Items read: {0}".format(items_read)) def create_paged_query(page_size): qry ...
lldb/test/API/commands/settings/quoting/TestQuoting.py
acidburn0zzz/llvm-project
250
11168684
""" Test quoting of arguments to lldb commands. """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class SettingsCommandTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) output_file_name = "output.txt" @classmetho...
denet/layer/denet_corner.py
lachlants/denet
121
11168697
<reponame>lachlants/denet<gh_stars>100-1000 import theano import theano.tensor as tensor import numpy import math import time import denet.common as common import denet.common.logging as logging import denet.common.theano_util as theano_util from denet.layer import AbstractLayer, InitialLayer from denet.layer.convolu...
tests/test_logger.py
madkote/fastapi-plugins
211
11168699
<reponame>madkote/fastapi-plugins #!/usr/bin/env python # -*- coding: utf-8 -*- # tests.test_logger ''' :author: madkote :contact: madkote(at)bluewin.ch :copyright: Copyright 2021, madkote tests.test_logger ----------------- Logger tests ''' from __future__ import absolute_import import asyncio import copy impo...
wiener_filtering_hadamard.py
fevorl/BM3D_py
157
11168705
<gh_stars>100-1000 import numpy as np from scipy.linalg import hadamard def wiener_filtering_hadamard(group_3D_img, group_3D_est, sigma, doWeight): """ :wiener_filtering after hadamard transform :param group_3D_img: :param group_3D_est: :param sigma: :param doWeight: :return: """ a...
solarpi/charts/__init__.py
ActualReverend/solarpi
105
11168726
"""The data module.""" from . import views
Python/FiniteStateParser/oo_fs_parser.py
Gjacquenot/training-material
115
11168743
#!/usr/bin/env python '''Module containing a parser for a simple block enocded data format''' import re class ParseError(Exception): '''Exception thrown when a parse error occurs''' def __init__(self, msg): '''constructor taking a message''' Exception.__init__(self) self.msg = msg ...
data_structures/b_trees/tests/test_b_plus_tree.py
vinta/fuck-coding-interviews
590
11168747
# coding: utf-8 import random import unittest from data_structures.b_trees.b_plus_tree import BPlusTree class BPlusTreeTest(unittest.TestCase): def setUp(self): with self.assertRaises(ValueError): BPlusTree(order=2) self.b_plus_tree = BPlusTree(order=5) self.size = random.ran...
server/intrinsic/management/commands/intrinsic_import_ec2.py
paulu/opensurfaces
137
11168779
<reponame>paulu/opensurfaces import glob import time import timeit from django.core.management.base import BaseCommand from intrinsic.tasks import import_ec2_task class Command(BaseCommand): args = '' help = 'Import image algorithms run on ec2' def handle(self, *args, **options): indir = '/vol/c...
tests/standalone-pt/docker/plotting/correlate.py
bmwcarit/joynr
151
11168793
<reponame>bmwcarit/joynr import csv from datetime import datetime import os import re import sys # amount of cmd line args if len(sys.argv) != 2: print("Missing path argument") exit(1) # results directory dir = sys.argv[1] if not os.path.isdir(dir): print("unable to find directory: {:s}".format(dir)) ...
fhir/resources/STU3/signature.py
cstoltze/fhir.resources
144
11168809
# -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/Signature Release: STU3 Version: 3.0.2 Revision: 11917 Last updated: 2019-10-24T11:53:00+11:00 """ import typing from pydantic import Field, root_validator from pydantic.error_wrappers import ErrorWrapper, ValidationError from pydantic.errors...
Python/Unittest/PyTest/Fixtures/test_wc.py
Gjacquenot/training-material
115
11168861
<reponame>Gjacquenot/training-material from pathlib import Path import pytest from subprocess import check_output @pytest.fixture(scope='module') def text_file(): file_path = Path('my_text.txt') with open(file_path, 'w') as out_file: for line_nr in range(1, 11): for word_nr in range(1, line...
Packs/PassiveTotal/Scripts/RiskIQPassiveTotalHostPairChildrenScript/RiskIQPassiveTotalHostPairChildrenScript.py
diCagri/content
799
11168914
<reponame>diCagri/content from CommonServerPython import * result = demisto.executeCommand('pt-get-host-pairs', {'direction': 'children', 'query': demisto.args().get('indicator_value')} ) demisto.results(result)
modules/dbnd/test_dbnd/parameters/test_parameters.py
ipattarapong/dbnd
224
11168932
import enum from typing import List, Tuple import pytest from dbnd import parameter from targets.types import NullableStr class MyEnum(enum.Enum): A = 1 class TestParameters(object): def test_enum_param_valid(self): p = parameter.enum(MyEnum)._p assert MyEnum.A == p.parse_from_str("A") ...
tests/test_cli/commands/example.py
matyasrichter/prisma-client-py
518
11168952
<gh_stars>100-1000 import click @click.command() def cli() -> None: """Example command""" click.echo('Hello from example command!')
pymodules/elf_parser.py
mewbak/bin2llvm
118
11168960
# # Copyright 2017 The bin2llvm 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 w...
app/utils/case_logger.py
cdlaimin/pity
135
11168972
from datetime import datetime class CaseLog(object): def __init__(self): self.log = list() def append(self, content, end=True): if end: self.log.append("[{}]: 步骤结束 -> {}".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), content)) else: self.log.append("[{}...
office-plugin/windows-office/program/pythonloader.py
jerrykcode/kkFileView
6,660
11168994
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # ...
pyinstaller/maigret_standalone.py
elGrandeGato/maigret
1,156
11168996
<gh_stars>1000+ #!/usr/bin/env python3 import asyncio import maigret if __name__ == "__main__": asyncio.run(maigret.cli())
eth/_utils/blake2/compression.py
ggs134/py-evm
1,641
11169004
import struct from typing import ( Tuple, ) doc = """ Lovingly lifted from https://github.com/buggywhip/blake2_py with this license: Copyright (c) 2009-2018 <NAME>, Kent, WA, USA Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is here...
kolibri/core/auth/test/test_middleware.py
MBKayro/kolibri
545
11169023
<filename>kolibri/core/auth/test/test_middleware.py from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from django.test import override_settings from django.test import TestCase from ..middleware ...
third_party/gdb_pretty_printer/nlohmann-json.py
theShmoo/json
2,111
11169024
import gdb import re class JsonValuePrinter: "Print a json-value" def __init__(self, val): self.val = val def to_string(self): if self.val.type.strip_typedefs().code == gdb.TYPE_CODE_FLT: return ("%.6f" % float(self.val)).rstrip("0") return self.val def json_lookup_fu...
python/Microsoftpython/Class 01:print/class 01:print.py
HeisenbergChueng/python-studynote
453
11169030
<filename>python/Microsoftpython/Class 01:print/class 01:print.py<gh_stars>100-1000 print('第一節') print() print('hello world') print() print('出現了helloworld,注意print框內用單引雙引號都可以,但要一直使用不要換') print() print('其實如果有單引號衝突的時候,更推薦用轉義符右斜槓號(delete下面果個)就不用還雙引了') print() print('例如') print('it\'s a fucking world') print() print() print...
patroni/daemon.py
kmoppel/patroni
4,759
11169037
import abc import os import signal import six import sys from threading import Lock @six.add_metaclass(abc.ABCMeta) class AbstractPatroniDaemon(object): def __init__(self, config): from patroni.log import PatroniLogger self.setup_signal_handlers() self.logger = PatroniLogger() ...
py2app_tests/app_with_scripts/subdir/helper2.py
flupke/py2app
193
11169047
import code import foo print("Helper 2: %s"%(foo.sq_2,))
tests/ext/test_pandas/conftest.py
zyfra/ebonite
270
11169058
<gh_stars>100-1000 import io from datetime import datetime, timezone import pandas as pd import pytest from ebonite.core.analyzer.dataset import DatasetAnalyzer PD_DATA_FRAME = pd.DataFrame([ {'int': 1, 'str': 'a', 'float': .1, 'dt': datetime.now(), 'bool': True, 'dt_tz': datetime.now(timezone.utc)}, {'int':...
src/desktopvirtualization/azext_desktopvirtualization/manual/tests/latest/test_desktopvirtualization_scenario.py
Mannan2812/azure-cli-extensions
207
11169071
# -------------------------------------------------------------------------- # 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. # Changes may cause incor...
pyro/ops/integrator.py
Jayanth-kumar5566/pyro
4,959
11169090
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from torch.autograd import grad def velocity_verlet( z, r, potential_fn, kinetic_grad, step_size, num_steps=1, z_grads=None ): r""" Second order symplectic integrator that uses the velocity verlet algorithm. :par...
scripts/geodata/addresses/conjunctions.py
Fillr/libpostal
3,489
11169095
import six from geodata.addresses.config import address_config from geodata.encoding import safe_decode from geodata.math.sampling import weighted_choice class Conjunction(object): DEFAULT_WHITESPACE_JOIN = ', ' DEFAULT_NON_WHITESPACE_JOIN = '' key = 'and' @classmethod def join(cls, phrases, lang...
mapbox/services/static_style.py
Verdova/mapbox-sdk-py
319
11169101
<filename>mapbox/services/static_style.py<gh_stars>100-1000 import json import warnings from uritemplate import URITemplate from mapbox import errors from mapbox.services.base import Service from mapbox.utils import normalize_geojson_featurecollection def validate_lat(val): if val < -85.0511 or val > 85.0511: ...
pypykatz/alsadecryptor/packages/ssp/templates.py
wisdark/pypykatz
1,861
11169126
<reponame>wisdark/pypykatz<gh_stars>1000+ #!/usr/bin/env python3 # # Author: # <NAME> (@skelsec) # from pypykatz.commons.common import KatzSystemArchitecture, WindowsMinBuild, WindowsBuild from pypykatz.alsadecryptor.win_datatypes import ULONG, LUID, KIWI_GENERIC_PRIMARY_CREDENTIAL, POINTER from pypykatz.alsadecrypt...
tests/test_file.py
miketheman/pydeps
981
11169131
<reponame>miketheman/pydeps # -*- coding: utf-8 -*- import os from tests.filemaker import create_files from tests.simpledeps import simpledeps def test_file(): files = """ a.py: | import collections """ with create_files(files) as workdir: assert simpledeps('a.py') == set() ...
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/t/typing/typing_consider_using_alias.py
ciskoinch8/vimrc
463
11169156
"""Test pylint.extension.typing - consider-using-alias 'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'. With 'from __future__ import annotations' present. """ # pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long from __future__ import annotations import collections imp...
themes/development/Black/generate.py
dmg103/TGUI
543
11169238
<reponame>dmg103/TGUI import os import json from string import Template mapping = {} with open('out.json', 'r') as f: data = json.load(f) for imageFilename in data['frames']: frame = data['frames'][imageFilename]['frame'] filenameWithoutExtension = os.path.splitext(imageFilename)[0] map...
petl/io/pandas.py
arturponinski/petl
435
11169239
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import inspect from petl.util.base import Table def todataframe(table, index=None, exclude=None, columns=None, coerce_float=False, nrows=None): """ Load data from the given `table` into a `pandas <...
webhooks-with-cloud-run/Monolith/main.py
suganyaprasad27/serverless-expeditions
105
11169253
# Copyright 2019 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, ...
tests/basic_checks/test_pearson.py
shaido987/pyaf
377
11169258
import numpy as np from scipy import stats import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info) a = np.array([0, 0, 0, 1, 1, 1, 1]) b = np.arange(7) pearson1 = stats.pearsonr(a, b) a1 = a * 1e90 b1 = b * 1e90 pearson2 = stats.pearsonr(a1, b1) print(pearson1 , pearson2) # see https...
genbmm/opt/hmm.py
harvardnlp/cascaded-generation
122
11169264
import sys import os import time import torch import numpy as np #TVM_HOME = '/n/home11/yuntian/tvm/python/tvm' #os.environ['LD_LIBRARY_PATH'] = ( # os.environ['LD_LIBRARY_PATH'] # + f":{TVM_HOME}/build" ## #+ os.environ["LLVM_LIB"] # ) import tvm from t...
h2o-docs/src/booklets/v2_2015/source/DeepLearning_Vignette_code_examples/deeplearning_importfile_example.py
ahmedengu/h2o-3
6,098
11169301
<gh_stars>1000+ import h2o # Start H2O cluster with all available cores (default) h2o.init() train = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/mnist/train.csv.gz") test = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/mnist/test.csv.gz") # Get a bri...
tests/syntax/unmatched_closing_paren.py
matan-h/friendly
287
11169317
<gh_stars>100-1000 """Should raise SyntaxError: invalid syntax for Python < 3.8 otherwise, SyntaxError: unmatched ')' """ a = (1, 2, 3, 4,)) b = 3
image_classification/VOLO/fold.py
no-name-xiaosheng/PaddleViT
993
11169320
<reponame>no-name-xiaosheng/PaddleViT<filename>image_classification/VOLO/fold.py # Copyright (c) 2021 PPViT Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #...
NNClassify.py
Samuraiwarm/NNTwitterBot
112
11169348
<reponame>Samuraiwarm/NNTwitterBot # tensorflow will be our main library for the neural network from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf if type(tf.contrib) != type(tf): tf.contrib._warning = None from tensorflow.keras import datasets, layers, models fro...
trove/tests/unittests/guestagent/datastore/postgres/test_manager.py
a4913994/openstack_trove
244
11169407
<gh_stars>100-1000 # Copyright 2021 Catalyst Cloud # # 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 app...
examples/stockquotes/phase3/stockmarket.py
brubbel/Pyro4
638
11169419
from __future__ import print_function import random import time import Pyro4 HOST_IP = "127.0.0.1" # Set accordingly (i.e. "192.168.1.99") HOST_PORT = 9092 # Set accordingly (i.e. 9876) @Pyro4.expose class StockMarket(object): def __init__(self, marketname, symbols): self._name = marketname ...
experiments/librispeech/evaluation/save_ctc_prob.py
sundogrd/tensorflow_end2end_speech_recognition
351
11169439
<filename>experiments/librispeech/evaluation/save_ctc_prob.py #! /usr/bin/env python # -*- coding: utf-8 -*- """Save the trained CTC posteriors (Librispeech corpus).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import numpy as np...
CalibMuon/DTCalibration/python/DTCalibMuonSelection_cfi.py
ckamtsikis/cmssw
852
11169449
import FWCore.ParameterSet.Config as cms DTCalibMuonSelection = cms.EDFilter("DTCalibMuonSelection", filter = cms.bool(True), src = cms.InputTag("muons"), etaMin = cms.double(-1.25), etaMax = cms.double(1.25), ptMin = cms.double(3.) )
B03898_10_codes/TrinomialTreeOption.py
prakharShuklaOfficial/Mastering-Python-for-Finance-source-codes
446
11169464
""" README ====== This file contains Python codes. ====== """ """ Price an option by the Boyle trinomial tree """ from BinomialTreeOption import BinomialTreeOption import math import numpy as np class TrinomialTreeOption(BinomialTreeOption): def _setup_parameters_(self): """ Required calculations for th...
mpunet/database/__init__.py
alexsosn/MultiPlanarUNet
156
11169473
from .db_conn import DBConnection
tf/backend/utils.py
conansherry/Ultra-Light-Fast-Generic-Face-Detector-1MB
6,602
11169524
import json import numpy as np import tensorflow as tf import torch def post_processing(reg_list, cls_list, num_classes, image_size, feature_map_wh_list, min_boxes, center_variance, size_variance, conf_threshold=0.6, nms_max_output_size=100, nms_iou_threshold=0.3, top_k=100): ...
airflow/utils/log/non_caching_file_handler.py
ChaseKnowlden/airflow
15,947
11169549
<reponame>ChaseKnowlden/airflow<gh_stars>1000+ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache Licens...
mgz/__init__.py
happyleavesaoc/mgz
117
11169557
"""Entry point for reading MGZ.""" # pylint: disable=invalid-name,no-name-in-module from construct import (Struct, CString, Const, Int32ul, Embedded, Float32l, Terminated, If, Computed, this, Peek) from mgz.util import MgzPrefixed, ZlibCompressed, Version, VersionAdapter, get_version from mgz.header.ai import ai from...
Tests/test_recursion.py
mfkiwl/Pyjion
1,137
11169566
<reponame>mfkiwl/Pyjion<gh_stars>1000+ import pyjion def test_basic(): def _f(): def add_a(z): if len(z) < 5: z.append('a') return add_a(z) return z return add_a([]) assert _f() == ['a', 'a', 'a', 'a', 'a'] inf = pyjion.info(_f) ...