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
openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py
oterrier/openapi-python-client
172
12646381
<reponame>oterrier/openapi-python-client<filename>openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py from typing import Dict, List SecurityRequirement = Dict[str, List[str]] """ Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a...
mpunet/evaluate/loss_functions.py
alexsosn/MultiPlanarUNet
156
12646384
import tensorflow as tf from tensorflow.python.keras.losses import LossFunctionWrapper def _to_tensor(x, dtype): """Convert the input `x` to a tensor of type `dtype`. OBS: Code implemented by Tensorflow # Arguments x: An object to be converted (numpy array, list, tensors). dtype: The des...
objectModel/Python/tests/persistence/test_persistence_layer.py
rt112000/CDM
884
12646404
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. import asyncio import datetime import multiprocessing import os import unittest from cdm.enums import CdmStatusLevel, CdmObjectType, CdmLogCode from cdm.objectmodel...
nnutils/train_utils.py
NVlabs/UMR
184
12646440
<filename>nnutils/train_utils.py # ----------------------------------------------------------- # Code adapted from: # https://github.com/akanazawa/cmr/blob/master/nnutils/train_utils.py # # MIT License # # Copyright (c) 2018 akanazawa # # Permission is hereby granted, free of charge, to any person obtaining a copy ...
python/pmercury/utils/tls_crypto.py
raj-apoorv/mercury
299
12646467
import os import sys import struct from binascii import hexlify, unhexlify # crypto primitive imports from cryptography.hazmat.primitives.hmac import HMAC from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers.modes...
nlp_gym/envs/common/action_space.py
lipucky/nlp-gym
120
12646472
from typing import List from gym.spaces.discrete import Discrete class ActionSpace(Discrete): def __init__(self, actions: List[str]): self.actions = actions self._ix_to_action = {ix: action for ix, action in enumerate(self.actions)} self._action_to_ix = {action: ix for ix, action in enumer...
mayan/apps/mailer/models.py
eshbeata/open-paperless
2,743
12646486
<reponame>eshbeata/open-paperless from __future__ import unicode_literals import json import logging from django.core import mail from django.db import models from django.utils.module_loading import import_string from django.utils.translation import ugettext_lazy as _ from .utils import split_recipient_list logger ...
python/tree/leetocde/average_levels_binary_tree.py
googege/algo-learn
153
12646492
<gh_stars>100-1000 from typing import List # 二叉树的层平均值 class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # 广度优先 def averageOfLevels_1(self, root: TreeNode) -> List[float]: queue, res = [root], [] while len(queu...
script_tests/line_select_tests.py
mr-c/bx-python
122
12646513
import unittest import base class Test(base.BaseScriptTest, unittest.TestCase): command_line = "./scripts/line_select.py ${features}" input_features = base.TestFile("""0 1 1 0 ...
fastpunct/__init__.py
notAI-tech/fastpunct
208
12646516
<gh_stars>100-1000 from .fastpunct import FastPunct
deepdish/core.py
raphaelquast/deepdish
253
12646528
from __future__ import division, print_function, absolute_import import time import warnings import numpy as np import itertools as itr import sys from contextlib import contextmanager warnings.simplefilter("ignore", np.ComplexWarning) _is_verbose = False _is_silent = False class AbortException(Exception): """ ...
image_registration/fft_tools/downsample.py
Experimentica/image_registration
122
12646561
<reponame>Experimentica/image_registration<gh_stars>100-1000 import numpy as np try: try: from numpy import nanmean except ImportError: from scipy.stats import nanmean except ImportError as ex: print("Image-registration requires either numpy >= 1.8 or scipy.") raise ex def downsample(my...
hpfeeds_server/hpfeeds_server.py
bryanwills/honssh
388
12646589
<gh_stars>100-1000 from honssh import log import os import struct import hashlib import json import socket BUFSIZ = 16384 OP_ERROR = 0 OP_INFO = 1 OP_AUTH = 2 OP_PUBLISH = 3 OP_SUBSCRIBE = 4 MAXBUF = 1024 ** 2 SIZES = { OP_ERROR: 5 + MAXBUF, OP_INFO: 5 + 256 + 20, OP_AUTH: 5 + 256 + 20, OP_PUBLISH: ...
gfsa/model/model_util_test.py
deepneuralmachine/google-research
23,901
12646591
# 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...
userOperation/logout.py
fsdsoyu/xxqg
317
12646623
# -*- encoding: utf-8 -*- from random import uniform from time import sleep from custom.xuexi_chrome import XuexiChrome def logout(browser: XuexiChrome): browser.xuexi_get('https://www.xuexi.cn/') sleep(round(uniform(1, 2), 2)) logoutBtn = browser.find_element_by_class_name('logged-link') logoutBtn.cl...
tests/_projects/large_without_circle/run.py
marek-trmac/pycycle
319
12646634
from a_module.a_file import a_func if __name__ == '__main__': a_func()
models/classifiers/resnext.py
daili0015/ModelFeast
247
12646635
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: zcy # @Date: 2019-02-10 12:44:46 # @Last Modified by: zcy # @Last Modified time: 2019-02-11 11:52:19 import logging # 引入logging模块 import torch, os import torch.nn as nn from torch import load as TorchLoad import torch.utils.model_zoo as model_zoo...
app/server/labml_app/docs.py
elgalu/labml
463
12646651
from labml_app.db import job SAMPLE_SPECS_DICT = {'parameters': [], 'definitions': {}, 'response': {}} sync = { "parameters": [ { "name": "computer_uuid", "in": "query", "type": "string", "required": "true", "description": "0c112ffda506f10f9f793c...
unique_paths_ii/solution2.py
mahimadubey/leetcode-python
528
12646684
""" Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the grid. For example, There is one obstacle in the middle of a 3x3 grid as illustrated below. [ [0,0,0], [0,1,0], [0,...
cakechat/dialog_model/quality/logging.py
sketscripter/emotional-chatbot-cakechat
1,608
12646701
import csv import os from datetime import datetime import pandas as pd from cakechat.config import PREDICTION_MODE_FOR_TESTS, MAX_PREDICTIONS_LENGTH from cakechat.dialog_model.inference import get_nn_responses from cakechat.dialog_model.model_utils import transform_context_token_ids_to_sentences from cakechat.dialog_...
modin/core/dataframe/algebra/default2pandas/any.py
Rubtsowa/modin
7,258
12646702
<filename>modin/core/dataframe/algebra/default2pandas/any.py # Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the...
mozi/log.py
hycis/Mozi
122
12646713
from datetime import datetime import os import sys import logging import cPickle import sqlite3 import operator import copy import numpy as np import theano from theano.sandbox.cuda.var import CudaNdarraySharedVariable floatX = theano.config.floatX class Log: def __init__(self, experiment_name="experiment", de...
datafiles/__init__.py
colltoaction/datafiles
151
12646716
# pylint: disable=unused-import from dataclasses import field from . import converters, settings from .decorators import auto, datafile from .manager import Missing from .model import Model
Python/58. length_of_last_word.py
nizD/LeetCode-Solutions
263
12646717
<filename>Python/58. length_of_last_word.py ''' PROBLEM: Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string. If the last word does not exist, re...
Python3/583.py
rakhi2001/ecom7
854
12646726
__________________________________________________________________________________________________ sample 208 ms submission class Solution: def minDistance(self, s: str, t: str) -> int: """Modified Wagner-Fischer algorithm""" if len(s) < len(t): s, t = t, s pre = [None] * (len(t...
examples/FastAPI/data/database.py
Aliemeka/supabase-py
181
12646732
<reponame>Aliemeka/supabase-py # variables for database and url configuration from config import Config from supabase import Client, create_client class SupabaseDB: """ class instance for database connection to supabase :str: url: configuration for database url for data inside supafast project :str:...
sanic/constants.py
Varriount/sanic
4,959
12646739
from enum import Enum, auto class HTTPMethod(str, Enum): def _generate_next_value_(name, start, count, last_values): return name.upper() def __eq__(self, value: object) -> bool: value = str(value).upper() return super().__eq__(value) def __hash__(self) -> int: return hash...
templates/go/payloads/go_memorymodule.py
ohoph/Ebowla
738
12646768
<reponame>ohoph/Ebowla imports="" loader=""" //handle := C.MemoryLoadLibrary(unsafe.Pointer(&full_payload[0]),(C.size_t)(len(full_payload))) handle := C.MemoryLoadLibraryEx(unsafe.Pointer(&full_payload[0]), (C.size_t)(len(full_payload)), (*[0]by...
tests/test_data.py
jerryc05/python-progressbar
806
12646774
import pytest import progressbar @pytest.mark.parametrize('value,expected', [ (None, ' 0.0 B'), (1, ' 1.0 B'), (2 ** 10 - 1, '1023.0 B'), (2 ** 10 + 0, ' 1.0 KiB'), (2 ** 20, ' 1.0 MiB'), (2 ** 30, ' 1.0 GiB'), (2 ** 40, ' 1.0 TiB'), (2 ** 50, ' 1.0 PiB'), (2 ** 60, ' 1.0 E...
ahmia/ahmia/models.py
donno2048/ahmia-site
185
12646781
<gh_stars>100-1000 """Models for the database of ahmia.""" import logging from datetime import timedelta from django.conf import settings from django.db import models, DatabaseError from django.utils import timezone from . import utils from .validators import validate_onion_url, validate_status, validate_onion logge...
bigflow_python/python/bigflow/util/test/path_util_test.py
tushushu/bigflow
1,236
12646787
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################## # # Copyright (c) 2017 Baidu, Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
homeassistant/components/citybikes/__init__.py
domwillcode/home-assistant
30,023
12646792
<reponame>domwillcode/home-assistant """The citybikes component."""
iceoryx_integrationtest/iceoryx_integrationtest/test_complexdata_example.py
ijnek/iceoryx
560
12646834
<reponame>ijnek/iceoryx<gh_stars>100-1000 # Copyright (c) 2021 by Apex.AI 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/LICE...
endpoints/appr/test/test_digest_prefix.py
ibazulic/quay
2,027
12646854
import pytest from endpoints.appr.models_cnr import _strip_sha256_header @pytest.mark.parametrize( "digest,expected", [ ( "sha256:251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a", "251b6897608fb18b8a91ac9abac686e2e95245d5a041f2d1e78fe7a815e6480a", ), ...
src/genie/libs/parser/nxos/show_fabricpath.py
balmasea/genieparser
204
12646860
<gh_stars>100-1000 # Python (this imports the Python re module for RegEx) import re from genie.metaparser import MetaParser from genie.metaparser.util.schemaengine import Any, Or, Optional from genie.libs.parser.utils.common import Common # ============================== # Schema for 'show fabricpath isis adjacency' #...
neural_compressor/ux/components/db_manager/db_manager.py
intel/neural-compressor
172
12646919
<reponame>intel/neural-compressor # -*- coding: utf-8 -*- # Copyright (c) 2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
torchelie/models/attention.py
maxferrari/Torchelie
117
12646941
<reponame>maxferrari/Torchelie import torch import torchelie.utils as tu import torch.nn as nn import torchelie.nn as tnn from torchelie.models import ClassificationHead from typing import Optional from collections import OrderedDict Block = tnn.PreactResBlockBottleneck class UBlock(nn.Module): inner: Optional[n...
data_wrangling/get_song_lyrics.py
eutychius/encore.ai
314
12646969
from bs4 import BeautifulSoup import urllib2 import os from random import random import time import sys BASE_URL = 'http://www.azlyrics.com/' def download_lyrics(artist, url): print url time.sleep(random() + 2) page = urllib2.urlopen(url).read() soup = BeautifulSoup(page, 'html.parser') # Get the song tit...
spectral/database/usgs.py
wwlswj/spectral
398
12646970
<gh_stars>100-1000 ''' Code for reading and managing USGS spectral library data. References: <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., and <NAME>., 2017, USGS Spectral Library Version 7: U.S. Geological Survey Data Series 1035, 61 p., https://doi.org/10.3133/...
chapter10/docker/images/movielens-fetch/scripts/fetch_ratings.py
add54/Data_PipeLine_Apache_Airflow
303
12646981
#!/usr/bin/env python from pathlib import Path import logging import json import click import requests logging.basicConfig(level=logging.INFO) @click.command() @click.option( "--start_date", type=click.DateTime(formats=["%Y-%m-%d"]), required=True, help="Start date for ratings.", ) @click.option(...
tests/test_audience_summary.py
hiribarne/twitter-python-ads-sdk
162
12646985
import responses import unittest from tests.support import with_resource, with_fixture, characters from twitter_ads.account import Account from twitter_ads.client import Client from twitter_ads.targeting import AudienceSummary from twitter_ads import API_VERSION @responses.activate def test_audience_summary(): ...
src/sage/schemes/hyperelliptic_curves/jacobian_generic.py
UCD4IDS/sage
1,742
12647086
<filename>src/sage/schemes/hyperelliptic_curves/jacobian_generic.py """ Jacobian of a general hyperelliptic curve """ # **************************************************************************** # Copyright (C) 2006 <NAME> <<EMAIL>> # Distributed under the terms of the GNU General Public License (GPL) # ...
fabtools/tests/functional_tests/test_shorewall.py
timgates42/fabtools
308
12647098
import pytest pytestmark = pytest.mark.network @pytest.fixture(scope='module') def firewall(): from fabtools.require.shorewall import firewall import fabtools.shorewall firewall( rules=[ fabtools.shorewall.Ping(), fabtools.shorewall.SSH(), fabtools.shorewall.H...
dbaas/physical/forms/plan_admin.py
didindinn/database-as-a-service
303
12647123
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging from django.utils.translation import ugettext_lazy as _ from django import forms from ckeditor.widgets import CKEditorWidget from system.models import Configuration from .. import models log = logging.getLogger(__name__) ...
contrib/gen-scripts/gen-write_reverse_arrays.py
zyedidia/boolector
209
12647146
<reponame>zyedidia/boolector #! /usr/bin/env python3 # Boolector: Satisfiablity Modulo Theories (SMT) solver. # # Copyright (C) 2007-2021 by the authors listed in the AUTHORS file. # # This file is part of Boolector. # See COPYING for more information on using this software. # from argparse import ArgumentParser def...
client/verta/verta/registry/stage_change/_production.py
vishalbelsare/modeldb
835
12647152
<gh_stars>100-1000 # -*- coding: utf-8 -*- from verta._protos.public.registry import StageService_pb2 from . import _stage_change class Production(_stage_change._StageChange): """The model version is in production. Parameters ---------- comment : str, optional Comment associated with this s...
usaspending_api/download/tests/integration/test_download_disaster.py
ststuck/usaspending-api
217
12647180
<filename>usaspending_api/download/tests/integration/test_download_disaster.py import json import pytest import re from model_mommy import mommy from rest_framework import status from usaspending_api.download.lookups import JOB_STATUS from usaspending_api.etl.award_helpers import update_awards from usaspending_api.re...
climt/_components/dcmip/__init__.py
Ai33L/climt
116
12647211
<reponame>Ai33L/climt<gh_stars>100-1000 from .component import DcmipInitialConditions __all__ = (DcmipInitialConditions)
tests/batching_test.py
gglin001/poptorch
128
12647244
<gh_stars>100-1000 #!/usr/bin/env python3 # Copyright (c) 2020 Graphcore Ltd. All rights reserved. import torch import pytest import helpers import poptorch def test_inferenceBatching(): torch.manual_seed(42) model = torch.nn.Linear(6, 20) # Actually batched by 100. input = torch.randn([10, 1, 5, 6...
Src/Plugins/GLShaderEdit/scite/scripts/CheckMentioned.py
vinjn/glintercept
468
12647252
# CheckMentioned.py # Find all the symbols in scintilla/include/Scintilla.h and check if they # are mentioned in scintilla/doc/ScintillaDoc.html. import string srcRoot = "../.." incFileName = srcRoot + "/scintilla/include/Scintilla.h" docFileName = srcRoot + "/scintilla/doc/ScintillaDoc.html" identCharacters = "_" + s...
rl_coach/saver.py
jl45621/coach
1,960
12647272
<reponame>jl45621/coach # # Copyright (c) 2017 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
examples/cifar_isonet/model.py
Be-Secure/pykale
324
12647313
<filename>examples/cifar_isonet/model.py """ Define the ISONet model for the CIFAR datasets. """ import kale.predict.isonet as isonet def get_config(cfg): """ Sets the hypermeters (architecture) for ISONet using the config file Args: cfg: A YACS config object. """ config_params = { ...
scale/job/test/test_models.py
kaydoh/scale
121
12647314
from __future__ import unicode_literals from __future__ import absolute_import import copy import datetime import json import time import django import django.utils.timezone as timezone from django.test import TestCase, TransactionTestCase import error.test.utils as error_test_utils import job.test.utils as job_test...
azure-cs-functions/functions/Hello/__init__.py
jandom/examples
1,628
12647316
<gh_stars>1000+ # Copyright 2016-2021, Pulumi Corporation. All rights reserved. import azure.functions as func def main(req: func.HttpRequest) -> func.HttpResponse: body = 'Hello there {}'.format(req.params.get('name')) return func.HttpResponse( body, status_code=200)
paas-ce/paas/paas/saas/urls.py
renmcc/bk-PaaS
767
12647341
<filename>paas-ce/paas/paas/saas/urls.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT Lice...
firefly/models/consts.py
matrixorz/firefly
247
12647354
<reponame>matrixorz/firefly # coding=utf-8 KEYBOARD_URL_MAPS = { 'default': [ [ 'Site wide shortcuts', # keyboard category [ # ('keyboard shortcut', 'keyboard info') ('s', 'Focus search bar'), ('g n', 'Go to Notifications'), ...
tests/comparison/leopard/report.py
suifengzhuliu/impala
1,523
12647379
<reponame>suifengzhuliu/impala # 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 License, Version 2.0 (...
venv/Lib/site-packages/altair/examples/density_stack.py
ajayiagbebaku/NFL-Model
6,831
12647385
<gh_stars>1000+ """ Stacked Density Estimates ------------------------- To plot a stacked graph of estimates, use a shared ``extent`` and a fixed number of subdivision ``steps`` to ensure that the points for each area align well. Density estimates of measurements for each iris flower feature are plot in a stacked meth...
test_with_saved_features.py
Aamer98/cdfsl-benchmark
184
12647391
<gh_stars>100-1000 import torch import numpy as np from torch.autograd import Variable import torch.nn as nn import torch.optim import json import torch.utils.data.sampler import os import glob import random import time import configs import backbone import data.feature_loader as feat_loader from data.datamgr import S...
Python3/488.py
rakhi2001/ecom7
854
12647393
__________________________________________________________________________________________________ sample 28 ms submission class Solution: def findMinStep(self, board: str, hand: str) -> int: from collections import Counter balls_count = Counter(hand) return self.dfs(board,...
backend/www/admin/formatters.py
sleepingAnt/viewfinder
645
12647409
# Copyright 2012 Viewfinder Inc. All Rights Reserved. """Customization for display of database tables. Default: default display of a table row *: customized versions by table """ __author__ = '<EMAIL> (<NAME>)' import logging import pprint import time from tornado.escape import url_escape, xhtml_escape from vi...
nested_admin/tests/nested_polymorphic/test_polymorphic_add_filtering/admin.py
jpic/django-nested-admin
580
12647420
<reponame>jpic/django-nested-admin<filename>nested_admin/tests/nested_polymorphic/test_polymorphic_add_filtering/admin.py<gh_stars>100-1000 from django.contrib import admin from django.db import models from django import forms import nested_admin from .models import ( FreeText, Poll, Question, MultipleChoiceGroup...
stonesoup/updater/information.py
Red-Portal/Stone-Soup-1
157
12647428
# -*- coding: utf-8 -*- from functools import lru_cache import numpy as np from ..base import Property from ..types.prediction import GaussianMeasurementPrediction from ..types.update import Update from ..models.measurement.linear import LinearGaussian from ..updater.kalman import KalmanUpdater class InformationKa...
examples/docs_snippets_crag/docs_snippets_crag/concepts/partitions_schedules_sensors/schedules/preset_helper.py
dbatten5/dagster
4,606
12647434
from dagster import daily_schedule # start_preset_helper def daily_schedule_definition_from_pipeline_preset(pipeline, preset_name, start_date): preset = pipeline.get_preset(preset_name) if not preset: raise Exception( "Preset {preset_name} was not found " "on pipeline {pipelin...
keras/test.py
desperado11/BraTs
124
12647439
<reponame>desperado11/BraTs import argparse from data import * from unet import * def test(args): # Data Load testset = dataset(args, mode='test') # Model Load model = unet(args) model.load_weights(args.ckpt_path) # Model Test results = model.predict_generator(testset, steps=1, verbose...
mimic/plugins/heat_plugin.py
ksheedlo/mimic
141
12647468
<gh_stars>100-1000 """ Plugin for Rackspace Cloud Orchestration mock. """ from mimic.rest.heat_api import HeatApi heat = HeatApi()
sdk/python/pulumi_aws/glue/get_connection.py
chivandikwa/pulumi-aws
260
12647541
# 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, Optional, Sequence, Union, overload from .. import...
WebMirror/management/rss_parser_funcs/feed_parse_extractLilBlissNovels.py
fake-name/ReadableWebProxy
193
12647560
<filename>WebMirror/management/rss_parser_funcs/feed_parse_extractLilBlissNovels.py def extractLilBlissNovels(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if ':' in item['title'] and 'Side Story' i...
text/src/autogluon/text/text_prediction/constants.py
zhiqiangdon/autogluon
4,462
12647589
<reponame>zhiqiangdon/autogluon<filename>text/src/autogluon/text/text_prediction/constants.py<gh_stars>1000+ # Column/Label Types NULL = 'null' CATEGORICAL = 'categorical' TEXT = 'text' NUMERICAL = 'numerical' ENTITY = 'entity' # Feature Types ARRAY = 'array'
flambe/nn/mos.py
ethan-asapp/flambe
148
12647607
# type: ignore[override] import torch import torch.nn as nn from torch import Tensor from flambe.nn.mlp import MLPEncoder from flambe.nn.module import Module class MixtureOfSoftmax(Module): """Implement the MixtureOfSoftmax output layer. Attributes ---------- pi: FullyConnected softmax laye...
mrgeo-python/src/test/python/mrgeotest.py
ngageoint/mrgeo
198
12647610
<gh_stars>100-1000 import os import shutil import sys from osgeo import gdal from unittest import TestCase from py4j.java_gateway import java_import import gdaltest from pymrgeo.instance import is_instance_of from pymrgeo.mrgeo import MrGeo class MrGeoTests(TestCase): GENERATE_BASELINE_DATA = False classna...
fastrunner/apps.py
huanjoyous/FasterRunner20190716
227
12647628
<filename>fastrunner/apps.py<gh_stars>100-1000 from django.apps import AppConfig class FastrunnerConfig(AppConfig): name = 'fastrunner'
boto3_type_annotations/boto3_type_annotations/amplify/paginator.py
cowboygneox/boto3_type_annotations
119
12647698
<reponame>cowboygneox/boto3_type_annotations<filename>boto3_type_annotations/boto3_type_annotations/amplify/paginator.py<gh_stars>100-1000 from typing import Dict from botocore.paginate import Paginator class ListApps(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: pass class List...
src/oci/encryption/internal/serialization.py
Manny27nyc/oci-python-sdk
249
12647699
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
aioch/utils.py
maxmouchet/aioch
119
12647720
from functools import partial def run_in_executor(executor, loop, func, *args, **kwargs): if kwargs: func = partial(func, **kwargs) return loop.run_in_executor(executor, func, *args)
datasets/mat2dic_maskrcnn.py
qianrusun1015/Disentangled-Person-Image-Generation
165
12647725
<filename>datasets/mat2dic_maskrcnn.py import scipy.io import numpy as np import os, sys, pdb, pickle ######## Mask-RCNN keypoint order ######## # % 1: nose # % 2: left eye # % 3: right eye # % 4: left ear # % 5: right ear # % 6: left shoulder # % 7: right shoulder # % 8: left elbow # % 9: right elbow # % 10: left wri...
Data Structure/Array Or Vector/Sort An Array of 0s and 1s/SolutionByPK.py
dream-achiever/Programmers-Community
261
12647744
<filename>Data Structure/Array Or Vector/Sort An Array of 0s and 1s/SolutionByPK.py def next0(A,n,x): while x<n and A[x]!=0: x+=1 return x n=int(input()) A=[int(j) for j in input().split()] b=0 for i in range(n): if A[i]==1: b=next0(A,n,max(b,i)) if b==n: break ...
pyhawkes/utils/utils.py
nticea/superhawkes
221
12647760
import os import numpy as np def initialize_pyrngs(): from gslrandom import PyRNG, get_omp_num_threads if "OMP_NUM_THREADS" in os.environ: num_threads = os.environ["OMP_NUM_THREADS"] else: num_threads = get_omp_num_threads() assert num_threads > 0 # Choose random seeds seeds = ...
dataviva/api/sc/models.py
joelvisroman/dataviva-site
126
12647785
<filename>dataviva/api/sc/models.py from dataviva import db from dataviva.utils.auto_serialize import AutoSerialize from dataviva.api.attrs.models import Bra, Course_sc, School class Sc(db.Model, AutoSerialize): __abstract__ = True year = db.Column(db.Integer(4), primary_key=True) age = db.Column(db.Float...
ch6/string_matching.py
lyskevin/cpbook-code
1,441
12647788
import time, random MAX_N = 200010 def naiveMatching(T, P): n = len(T) m = len(P) freq = 0 for i in range(n): found = True for j in range(m): if not found: break if i+j >= n or P[j] != T[i+j]: found = False if found: freq += 1 return freq b = [0] * MAX_N de...
maskrcnn_benchmark/solver/__init__.py
witwitchayakarn/6DVNET
295
12647838
<gh_stars>100-1000 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .build import make_optimizer from .build import make_lr_scheduler from .lr_scheduler import WarmupMultiStepLR
notebook/float_to_hex.py
vhn0912/python-snippets
174
12647844
import struct import sys f_max = sys.float_info.max print(f_max) # 1.7976931348623157e+308 print(struct.pack('>d', f_max)) # b'\x7f\xef\xff\xff\xff\xff\xff\xff' print(type(struct.pack('>d', f_max))) # <class 'bytes'> print(struct.pack('<d', f_max)) # b'\xff\xff\xff\xff\xff\xff\xef\x7f' print(struct.unpack('>Q', s...
api/tests/integration/tests/basic/rsite.py
tsingdao-Tp/Indigo
204
12647859
<filename>api/tests/integration/tests/basic/rsite.py import os import sys import errno sys.path.append('../../common') from env_indigo import * indigo = Indigo() indigo.setOption("molfile-saving-skip-date", "1") if not os.path.exists(joinPathPy("out", __file__)): try: os.makedirs(joinPathPy("out", __file...
pyltr/metrics/tests/test_dcg.py
Haiga/pyltr
432
12647865
""" Testing for (Normalized) DCG metric. """ from . import helpers import itertools import numpy as np import pyltr class TestDCG(helpers.TestMetric): def get_metric(self): return pyltr.metrics.DCG(k=3) def get_queries_with_values(self): yield [], 0.0 yield [0], 0.0 yield [...
scripts/lib/clean_unused_caches.py
Pulkit007/zulip
17,004
12647874
<reponame>Pulkit007/zulip #!/usr/bin/env python3 import argparse import os import sys ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ZULIP_PATH) from scripts.lib import clean_emoji_cache, clean_node_cache, clean_venv_cache, clean_yarn_cache from scripts.lib.zu...
examples/pgu/gui/theme.py
h-vetinari/pybox2d
421
12647885
<reponame>h-vetinari/pybox2d # theme.py """ """ import os, re import pygame from .const import * from . import widget from . import surface from .basic import parse_color, is_color __file__ = os.path.abspath(__file__) def _list_themes(dir): d = {} for entry in os.listdir(dir): if os.path.exists(os.p...
holoviews/plotting/mpl/heatmap.py
pyviz/holoviews
304
12648035
from __future__ import absolute_import, division, unicode_literals from itertools import product import numpy as np import param from matplotlib.patches import Wedge, Circle from matplotlib.collections import LineCollection, PatchCollection from ...core.data import GridInterface from ...core.util import dimension_s...
sdss/fields.py
juandesant/astrometry.net
460
12648060
<gh_stars>100-1000 #! /usr/bin/env python3 # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE from __future__ import print_function from __future__ import absolute_import from astrometry.util.fits import * from astrometry.util.starutil_numpy import * from astro...
src/chime_dash/app/components/menu.py
covidcaremap/chime
222
12648065
"""component/menu Dropdown menu which appears on the navigation bar at the top of the screen refactor incoming """ from typing import List from dash.development.base_component import ComponentMeta import dash_bootstrap_components as dbc from chime_dash.app.components.base import Component class Menu(Component): ...
TopQuarkAnalysis/TopEventProducers/python/tqafSequences_old_cff.py
ckamtsikis/cmssw
852
12648091
<filename>TopQuarkAnalysis/TopEventProducers/python/tqafSequences_old_cff.py<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms ## produce ttGenEvent from TopQuarkAnalysis.TopEventProducers.sequences.ttGenEvent_cff import * ## produce event solution from TopQuarkAnalysis.TopEventProducers.producers.TtSemiEvtSo...
Analysis/TMAP/scripts/util/sam2hpstats.py
konradotto/TS
125
12648109
<gh_stars>100-1000 #!/usr/bin/env python # Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved import os import re import sys from optparse import OptionParser import pysam import string # MATCH = 0 # INS = 1 # DEL = 2 # REF_SKIP = 3 # SOFT_CLIP = 4 # HARD_CLIP = 5 # PAD = 6 def ...
varken/lidarr.py
hpalmete/Varken
920
12648110
from logging import getLogger from requests import Session, Request from datetime import datetime, timezone, date, timedelta from varken.structures import LidarrQueue, LidarrAlbum from varken.helpers import hashit, connection_handler class LidarrAPI(object): def __init__(self, server, dbmanager): self.db...
pml/LibFFMClassifier.py
gatapia/py_ml_utils
183
12648125
from __future__ import print_function, absolute_import import os, sys, subprocess, shlex, tempfile, time, sklearn.base, math import numpy as np import pandas as pd from pandas_extensions import * from ExeEstimator import * class LibFFMClassifier(ExeEstimator, sklearn.base.ClassifierMixin): ''' options:...
koku/api/report/ocp/view.py
rubik-ai/koku
157
12648173
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """View for OpenShift Usage Reports.""" from api.common.permissions.openshift_access import OpenShiftAccessPermission from api.models import Provider from api.report.ocp.query_handler import OCPReportQueryHandler from api.report.ocp.serializers imp...
pyvgdlmaster/examples/gridphysics/missilecommand.py
LRHammond/pv4dsrl
111
12648186
''' VGDL example: Missile Command. @author: <NAME> and <NAME> ''' missilecommand_level = """ w m m m m w w w w w w w w w w w w A w w w w w w...
static/ppdet/modeling/architectures/input_helper.py
violetweir/PaddleDetection
7,782
12648193
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
.modules/.recon-ng/modules/reporting/csv.py
termux-one/EasY_HaCk
1,103
12648219
<filename>.modules/.recon-ng/modules/reporting/csv.py from recon.core.module import BaseModule import csv import os class Module(BaseModule): meta = { 'name': 'CSV File Creator', 'author': '<NAME> (@LaNMaSteR53)', 'description': 'Creates a CSV file containing the specified harvested data.'...
tools/third_party/h2/test/test_events.py
meyerweb/wpt
2,479
12648225
<filename>tools/third_party/h2/test/test_events.py<gh_stars>1000+ # -*- coding: utf-8 -*- """ test_events.py ~~~~~~~~~~~~~~ Specific tests for any function that is logically self-contained as part of events.py. """ import inspect import sys from hypothesis import given from hypothesis.strategies import ( integers...
rl/replay_buffer.py
qbetterk/user-simulator
534
12648238
from collections import deque import random class ReplayBuffer(object): def __init__(self, buffer_size): self.buffer_size = buffer_size self.num_experiences = 0 self.buffer = deque() def getBatch(self, batch_size): # random draw N return random.sample(self.buffer, batch_size) def size(sel...
nbtutor/ipython/factories/trace_step_factory.py
vincentxavier/nbtutor
423
12648239
<filename>nbtutor/ipython/factories/trace_step_factory.py from typing import Dict, List, Optional from ..factories.stack_frame_factory import create_stack from ..models.heap_object import HeapObject from ..models.stack import StackFrame from ..models.trace_step import TraceStep def create_trace_step( stack_f...