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/data/callbacks.py
jamesdarke/gwader
309
11132580
def on_download_start(api, gid): print("started " + gid) def on_download_pause(api, gid): print("paused " + gid)
tests/unit/portcon/order_sizer/test_long_short.py
calumrussell/qstrader
2,220
11132582
<gh_stars>1000+ from unittest.mock import Mock import pandas as pd import pytest import pytz from qstrader.portcon.order_sizer.long_short import ( LongShortLeveragedOrderSizer ) @pytest.mark.parametrize( "gross_leverage,expected", [ (-1.0, None), (0.0, None), (0.01, 0.01), ...
validators/i18n/es.py
vphilippon/validators
586
11132603
# -*- coding: utf-8 -*- from validators.utils import validator __all__ = ('es_cif', 'es_nif', 'es_nie', 'es_doi',) def nif_nie_validation(doi, number_by_letter, special_cases): """ Validate if the doi is a NIF or a NIE. :param doi: DOI to validate. :return: boolean if it's valid. """ doi = do...
tests/test_pipelines_fill_mask.py
liminghao1630/transformers
8,028
11132651
<reponame>liminghao1630/transformers<filename>tests/test_pipelines_fill_mask.py # Copyright 2020 The HuggingFace Team. 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 # #...
lib_pypy/_ssl_build.py
nanjekyejoannah/pypy
333
11132655
<reponame>nanjekyejoannah/pypy import sys from _cffi_ssl import _cffi_src sys.modules['_cffi_src'] = _cffi_src # from _cffi_ssl._cffi_src.build_openssl import (build_ffi_for_binding, _get_openssl_libraries, extra_link_args, compiler_type) if sys.platform == "win32": pypy_win32_extra = ["pypy_win32_extra"] ...
pgoapi/protos/pogoprotos/data/quests/quest_goal_pb2.py
aroo135/pgoapi
842
11132661
<filename>pgoapi/protos/pogoprotos/data/quests/quest_goal_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: pogoprotos/data/quests/quest_goal.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from ...
spartan/expr/mathematics.py
GabrielWen/spartan
156
11132665
''' Basic numpy style mathematics operations on arrays. These include -- * ''' import sys import __builtin__ import numpy as np import scipy.sparse as sp from .operator.map import map, map2 from .operator.map_with_location import map_with_location from .operator.reduce import reduce from .operator.ndarray import nda...
sunpy/map/__init__.py
johan12345/sunpy
628
11132689
""" SunPy Map isort:skip_file """ from sunpy.map.mapbase import GenericMap from sunpy.map import sources from sunpy.map.header_helper import * from sunpy.map.map_factory import Map from sunpy.map.maputils import * from .compositemap import CompositeMap from .mapsequence import MapSequence
tests/test_paginators.py
bduzik/api-client
112
11132690
from unittest.mock import Mock import pytest from apiclient import APIClient, JsonRequestFormatter, JsonResponseHandler, paginated from apiclient.authentication_methods import NoAuthentication from apiclient.paginators import set_strategy from apiclient.request_strategies import BaseRequestStrategy, RequestStrategy f...
glumpy/transforms/panzoom.py
antoineMoPa/glumpy
1,074
11132703
# ----------------------------------------------------------------------------- # Copyright (c) 2009-2016 <NAME>. All rights reserved. # Distributed under the (new) BSD License. # ----------------------------------------------------------------------------- import numpy as np from glumpy import library from . transform...
test/tst_masked3.py
timgates42/netcdf4-python
574
11132720
<reponame>timgates42/netcdf4-python import unittest import os import tempfile import numpy as np from numpy import ma from numpy.testing import assert_array_almost_equal from netCDF4 import Dataset, default_fillvals # Test automatic conversion of masked arrays (set_auto_mask()) class SetAutoMaskTestBase(unittest.Tes...
examples/contrib/traffic_lights.py
AlohaChina/or-tools
8,273
11132727
<filename>examples/contrib/traffic_lights.py # Copyright 2010 <NAME> <EMAIL> # # 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 requ...
data_loader.py
yongbozhi/Deep-Mutual-Learning
104
11132731
# -*- coding: utf-8 -*- """ Created on Wed Jul 10 14:12:10 2019 @author: chxy """ import numpy as np import torch from torchvision import datasets from torchvision import transforms def get_train_loader(data_dir, batch_size, random_seed, ...
plugins/modules/oci_events_rule.py
slmjy/oci-ansible-collection
108
11132736
#!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
tests/test_api.py
kingosticks/mopidy-soundcloud
161
11132748
import os.path import unittest from unittest import mock import vcr import mopidy_soundcloud from mopidy.models import Track from mopidy_soundcloud import Extension from mopidy_soundcloud.soundcloud import SoundCloudClient, readable_url local_path = os.path.abspath(os.path.dirname(__file__)) my_vcr = vcr.VCR( se...
raft/rpc.py
shunliz/raft
113
11132767
<filename>raft/rpc.py import json import socket class Rpc(object): def __init__(self, addr=None, timeout=None): self.ss = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) if addr: self.bind(tuple(addr)) if timeout: self.ss.settimeout(timeout) def bind(self, add...
astropy/uncertainty/core.py
mehrdad-shokri/astropy
445
11132785
<filename>astropy/uncertainty/core.py # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Distribution class and associated machinery. """ import numpy as np from astropy import units as u from astropy import stats __all__ = ['Distribution'] # we set this by hand because th...
PhysicsTools/PythonAnalysis/examples/MCTruth.py
ckamtsikis/cmssw
852
11132787
<reponame>ckamtsikis/cmssw<filename>PhysicsTools/PythonAnalysis/examples/MCTruth.py from __future__ import print_function from PhysicsTools.PythonAnalysis import * from ROOT import * # prepare the FWLite autoloading mechanism gSystem.Load("libFWCoreFWLite.so") ROOT.FWLiteEnabler.enable() # load the file with the gener...
src/pretix/base/migrations/0071_auto_20170729_1616.py
pajowu/pretix
1,248
11132799
<reponame>pajowu/pretix # -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-29 16:16 from __future__ import unicode_literals import i18nfield.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pretixbase', '0070_auto_20170719_0910'), ...
examples/emb_fasttext_demo.py
msgi/nlp-tour
1,559
11132807
from smartnlp.embedding.fasttext_model import FastTextModel if __name__ == '__main__': # cbow 模型 model = FastTextModel('data/tianlong_seg.txt', 'model/fasttext/model.vec', model_type='cbow') # skipgram 模型 # model = FastTextModel('data/tianlong_seg.txt', 'model/fasttext/model') print(model.get_neare...
hydrachain/tests/test_base.py
bts/hydrachain
406
11132810
<gh_stars>100-1000 # from hydrachain import protocol from hydrachain.consensus.base import Vote, VoteBlock, VoteNil, LockSet, ishash, Ready from hydrachain.consensus.base import DoubleVotingError, InvalidVoteError, MissingSignatureError from hydrachain.consensus.base import BlockProposal, genesis_signing_lockset, Inval...
xlsxwriter/test/vml/test_write_div.py
DeltaEpsilon7787/XlsxWriter
2,766
11132812
<reponame>DeltaEpsilon7787/XlsxWriter ############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2021, <NAME>, <EMAIL> # import unittest from io import StringIO from ...vml import Vml class TestWriteDiv(unittest.TestCase): """ Test the Vm...
drip/admin.py
pureblue/django-drip
261
11132817
<reponame>pureblue/django-drip<gh_stars>100-1000 import base64 import json from django import forms from django.contrib import admin from drip.models import Drip, SentDrip, QuerySetRule from drip.drips import configured_message_classes, message_class_for from drip.utils import get_user_model class QuerySetRuleInlin...
tests/feature/test_multiline.py
epkanol/pytest-bdd
944
11132833
<filename>tests/feature/test_multiline.py """Multiline steps tests.""" import textwrap import pytest @pytest.mark.parametrize( ["feature_text", "expected_text"], [ ( textwrap.dedent( '''\ Feature: Multiline Scenario: Multiline step using sub ind...
tests/seleniumwire/test_backend.py
wkeeling/selenium-wire
975
11132861
<filename>tests/seleniumwire/test_backend.py import json import os import ssl import urllib.error import urllib.request from unittest import TestCase from urllib.parse import parse_qs, urlsplit from seleniumwire import backend from tests import utils as testutils class BackendIntegrationTest(TestCase): """This i...
tests/layer_tests/tensorflow_tests/test_tf_Floor.py
monroid/openvino
2,406
11132869
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.layer_test_class import check_ir_version from common.tf_layer_test_class import CommonTFLayerTest from unit_tests.utils.graph import build_graph class TestFloor(CommonTFLayerTest): def create_floor_net(se...
biostar/recipes/test/test_navigation.py
tangibleai/biostar-central
477
11132900
<gh_stars>100-1000 import logging, os from django.test import TestCase, override_settings from django.test import Client from biostar.recipes import auth from biostar.recipes import models from django.conf import settings from biostar.utils.helpers import get_uuid from django.urls import reverse from django.test impor...
pycwr/configure/location_config.py
1271756664/study
144
11132928
# -*- coding: utf-8 -*- import cartopy.io.shapereader as shpreader import pandas as pd import os ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) Radar_info_Path = os.path.join(ROOT_DIR, "data", "radar_info.json") CN_shp_path = os.path.join(ROOT_DIR, "data", "CHN_pronvices.shp") last_open_dir = o...
crawlers/python/python_crawler.py
bhanuteja2001/conrad
244
11132931
# -*- coding: utf-8 -*- import os import json import datetime as dt from bs4 import BeautifulSoup from googleapiclient.discovery import build from google.oauth2.service_account import Credentials from ..base import BaseCrawler class PythonCrawler(BaseCrawler): def get_events(self): credentials = Creden...
tests/test_cli_config.py
st--/jupytext
5,378
11132932
<reponame>st--/jupytext import nbformat import pytest from nbformat.v4.nbbase import new_code_cell, new_notebook from jupytext.cli import jupytext from jupytext.compare import compare from jupytext.header import header_to_metadata_and_cell from jupytext.jupytext import read, write def test_pairing_through_config_lea...
bindings/python/performance.py
tbrekalo/edlib
396
11132938
<reponame>tbrekalo/edlib #!/usr/bin/env python import timeit import edlib import editdistance import Levenshtein with open('../../test_data/Enterobacteria_Phage_1/mutated_90_perc_oneline.fasta', 'r') as f: queryFull = f.readline() print('Read query: ', len(queryFull) ,' characters.') with open('../../test_data/...
up/tasks/det/models/utils/bbox_helper.py
ModelTC/EOD
196
11132941
# Standard Library from up.utils.general.fp16_helper import to_float32 import time # Import from third library import numpy as np import torch from up.utils.general.global_flag import ALIGNED_FLAG from up.extensions import gpu_iou_overlap GPU_MEMORY = None def allow_empty_tensor(num=1, empty_shape=(0, 4)): """...
roman_numbers/main.py
DazEB2/SimplePyScripts
117
11132958
<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: https://github.com/zopefoundation/roman import roman print(roman.toRoman(5)) # V print(roman.toRoman(9)) # IX print(roman.toRoman(10)) # X print(roman.toRoman(13)) # XIII print(roman.toRoman(255)) #...
release/scripts/presets/render/TV_PAL_4_colon_3.py
rbabari/blender
365
11132980
<reponame>rbabari/blender import bpy bpy.context.scene.render.resolution_x = 720 bpy.context.scene.render.resolution_y = 576 bpy.context.scene.render.resolution_percentage = 100 bpy.context.scene.render.pixel_aspect_x = 12 bpy.context.scene.render.pixel_aspect_y = 11 bpy.context.scene.render.fps = 25 bpy.context.scene....
rojak-pantau/rojak_pantau/spiders/metrotvnews.py
pyk/rojak
107
11132984
<filename>rojak-pantau/rojak_pantau/spiders/metrotvnews.py # -*- coding: utf-8 -*- from datetime import datetime from scrapy import Request from scrapy.exceptions import CloseSpider from scrapy.loader import ItemLoader from rojak_pantau.items import News from rojak_pantau.i18n import _ from rojak_pantau.util.wib_to_ut...
src/fuzzingtool/utils/file_utils.py
NESCAU-UFLA/FuzzingTool
131
11132999
# Copyright (c) 2020 - present <NAME> <https://github.com/VitorOriel> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, ...
plugins/modules/oci_resource_manager_template_category_facts.py
slmjy/oci-ansible-collection
108
11133023
<filename>plugins/modules/oci_resource_manager_template_category_facts.py #!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.g...
earthpy/tests/test_plot_bands.py
nkorinek/earthpy
350
11133038
<filename>earthpy/tests/test_plot_bands.py """Tests for the plot bands function""" import pytest import matplotlib.pyplot as plt import matplotlib.colors as colors import earthpy.plot as ep import numpy as np plt.show = lambda: None @pytest.fixture def one_band_3dims(): """Return a 3-dim numpy array vals 0-9"""...
tests/test_api_v1_firewall_traffic_shaper_queue.py
jaredhendrickson13/pfsense-api
311
11133048
<filename>tests/test_api_v1_firewall_traffic_shaper_queue.py # Copyright 2022 <NAME> # # 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 # # Unl...
slack_sdk/socket_mode/aiohttp/__init__.py
priya1puresoftware/python-slack-sdk
2,486
11133055
"""aiohttp based Socket Mode client * https://api.slack.com/apis/connections/socket * https://slack.dev/python-slack-sdk/socket-mode/ * https://pypi.org/project/aiohttp/ """ import asyncio import logging import time from asyncio import Future, Lock from asyncio import Queue from logging import Logger from typing impo...
xirl/configs/xmagical/pretraining/tcn.py
xxdreck/google-research
23,901
11133056
# 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...
tools/generator/misp-galaxy.py
wagner-certat/misp-taxonomies
209
11133066
<reponame>wagner-certat/misp-taxonomies import json import requests debug = False galaxy_url = 'https://raw.githubusercontent.com/MISP/misp-galaxy/main/clusters/' elements = ['tools.json', 'threat-actors.json'] # elements = ['threat-actor-tools.json'] taxonomy = {} taxonomy['namespace'] = 'misp-galaxy' taxonomy['desc...
tensorboard/plugin_util.py
Digitaltransform/tensorboard
6,139
11133070
<reponame>Digitaltransform/tensorboard # Copyright 2017 The TensorFlow 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/LIC...
stix/utils/__init__.py
saegel/python-stix
194
11133080
<gh_stars>100-1000 # Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import contextlib import functools import keyword import warnings import lxml.etree from mixbox.entities import Entity, EntityList import mixbox.xml from mixbox.vendor.six import iteritems, stri...
Lib/test/test_zipapp.py
tai271828/RustPython
11,058
11133084
<reponame>tai271828/RustPython """Test harness for the zipapp module.""" import io import pathlib import stat import sys import tempfile import unittest import zipapp import zipfile from test.support import requires_zlib from unittest.mock import patch class ZipAppTest(unittest.TestCase): """Tes...
src/tests/ftest/server/daos_server_config.py
grom72/daos
429
11133114
#!/usr/bin/python """ (C) Copyright 2020-2021 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ from apricot import TestWithServers from server_utils import ServerFailed class DaosServerConfigTest(TestWithServers): """Daos server configuration tests. Test Class Description: S...
homeassistant/components/joaoapps_join/__init__.py
basicpail/core
22,481
11133125
<filename>homeassistant/components/joaoapps_join/__init__.py """Support for Joaoapps Join services.""" import logging from pyjoin import ( get_devices, ring_device, send_file, send_notification, send_sms, send_url, set_wallpaper, ) import voluptuous as vol from homeassistant.const import C...
isserviceup/services/hashicorp.py
EvgeshaGars/is-service-up
182
11133127
<reponame>EvgeshaGars/is-service-up from isserviceup.services.models.statuspage import StatusPagePlugin class HashiCorp(StatusPagePlugin): name = 'HashiCorp' status_url = 'https://status.hashicorp.com/' icon_url = '/images/icons/hashicorp.png'
mvpa2/testing/__init__.py
nno/PyMVPA
227
11133134
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
utils/metrics.py
jeromerony/dml_cross_entropy
139
11133193
from typing import Dict, List, Optional import faiss import torch import torch.nn.functional as F class AverageMeter: """Computes and stores the average and current value on device""" def __init__(self, device, length): self.device = device self.length = length self.reset() def ...
Chapter15/gensim/word2vec_wiki.py
kksonge/Hands-On-Machine-Learning-for-Algorithmic-Trading
944
11133215
<reponame>kksonge/Hands-On-Machine-Learning-for-Algorithmic-Trading<filename>Chapter15/gensim/word2vec_wiki.py<gh_stars>100-1000 # coding: utf-8 from pathlib import Path from argparse import ArgumentParser from time import time import pandas as pd import numpy as np from gensim.models import Word2Vec from gensim.mode...
tensorflow/contrib/timeseries/python/timeseries/state_management.py
PaulWang1905/tensorflow
848
11133236
<gh_stars>100-1000 # Copyright 2017 The TensorFlow 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 ...
dd_1/Part 2/Section 09 - Project 4/project_4_goal_3/playground.py
Rebell-Leader/bg
3,266
11133298
import itertools from datetime import datetime import constants import parse_utils # for fname, class_name, parser in zip(constants.fnames, constants.class_names, constants.parsers): # file_iter = parse_utils.iter_file(fname, class_name, parser) # print(fname) # for _ in range(3): # print(next(fil...
dist/ba_data/python/bastd/game/ninjafight.py
Bartixxx32/Bombsquad-Ballistica-Modded-Server
317
11133304
# Released under the MIT License. See LICENSE for details. # """Provides Ninja Fight mini-game.""" # ba_meta require api 6 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations import random from typing import TYPE_CHECKING import ba from bastd.actor.spazbot import SpazBotSet, Charg...
venv/Lib/site-packages/nipype/interfaces/afni/svm.py
richung99/digitizePlots
585
11133321
<reponame>richung99/digitizePlots<gh_stars>100-1000 # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """AFNI's svm interfaces.""" from ..base import TraitedSpec, traits, File from .base import AFNICommand, AFNICommandInputSpec, AF...
source/msoAutoShapeTypes.py
XLTechie/nvdaTests
1,592
11133331
<filename>source/msoAutoShapeTypes.py #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2017 NV Access Limited #This file is covered by the GNU General Public License. import controlTypes msoShape10pointStar=149 msoShape12pointStar=150 msoShape16pointStar=94 msoShape24pointStar=95 msoShape32pointSt...
psutil_example/process_management/process_pid_list.py
DazEB2/SimplePyScripts
117
11133333
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # pip install psutil import psutil process_pid_list = psutil.pids() print('Process pid list ({}): {}'.format(len(process_pid_list), process_pid_list))
lib/django-1.3/django/core/management/commands/startapp.py
MiCHiLU/google_appengine_sdk
790
11133335
import os from django.core.management.base import copy_helper, CommandError, LabelCommand from django.utils.importlib import import_module class Command(LabelCommand): help = "Creates a Django app directory structure for the given app name in the current directory." args = "[appname]" label = 'application...
snorkel/classification/task.py
melonwater211/snorkel
2,906
11133340
<reponame>melonwater211/snorkel import logging from functools import partial from typing import Callable, List, Mapping, Optional, Sequence, Tuple, Union import torch import torch.nn.functional as F from torch import nn from snorkel.analysis import Scorer Outputs = Mapping[str, List[torch.FloatTensor]] class Opera...
tests/components/datadog/test_init.py
MrDelik/core
30,023
11133342
"""The tests for the Datadog component.""" from unittest import mock from unittest.mock import MagicMock, patch import homeassistant.components.datadog as datadog from homeassistant.const import ( EVENT_LOGBOOK_ENTRY, EVENT_STATE_CHANGED, STATE_OFF, STATE_ON, ) import homeassistant.core as ha from home...
tests/misc/test_startup_time.py
wenliangzhao2018/d2go
687
11133362
<filename>tests/misc/test_startup_time.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest from d2go.initializer import ( REGISTER_D2_DATASETS_TIME, REGISTER_TIME, SETUP_ENV_TIME, ) class TestStartupTime(unittest.TestCase): @unittest.skip...
social_core/backends/gitlab.py
sg4e/social-core
745
11133380
""" GitLab OAuth2 backend, docs at: https://python-social-auth.readthedocs.io/en/latest/backends/gitlab.html Thanks to [@saily](https://github.com/saily) who published an implementation for GitLab support on his blog post [Weblate with GitLab as OAuth provider](http://widerin.net/blog/weblate-gitlab-oauth-login/)....
src/datasets/dataset_factory.py
xiaoyuliu/AttentionalPoolingAction
270
11133383
"""A factory-pattern class which returns classification image/label pairs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from datasets import mpii from datasets import hmdb51 from datasets import charades from datasets import hico from datasets import ...
var/spack/repos/builtin/packages/ncdu/package.py
LiamBindle/spack
2,360
11133384
# 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) from spack import * class Ncdu(Package): """Ncdu is a disk usage analyzer with an ncurses interface. It is designed ...
data-science-onramp/vertex-ai/modules/trainer/tfkeras_model/task.py
InstantDomain/python-docs-samples
5,938
11133389
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
examples/showcase/src/uiHelpers.py
takipsizad/pyjs
739
11133393
<gh_stars>100-1000 """ uiHelpers.py This module contains various helper classes and functions to make it easier to build a Pyjamas application. """ from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.DockPanel import DockPanel from pyjamas.ui.HTML import HTML from pyjamas.ui.SimplePanel import SimplePan...
src/OFS/tests/test_userfolder.py
rbanffy/Zope
289
11133406
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # 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 SOFTWARE IS PROVIDED "AS I...
typic/constraints/factory.py
wyfo/typical
157
11133424
from __future__ import annotations import collections import dataclasses import enum import inspect import datetime import ipaddress import pathlib import re import uuid from collections import deque, abc from decimal import Decimal from typing import ( Mapping, Type, Union, Optional, List, Any...
kitsune/products/tests/test_templates.py
erdal-pb/kitsune
929
11133426
from django.conf import settings from django.core.cache import cache from nose.tools import eq_ from pyquery import PyQuery as pq from kitsune.products.models import HOT_TOPIC_SLUG from kitsune.products.tests import ProductFactory, TopicFactory from kitsune.questions.models import QuestionLocale from kitsune.search.te...
leo/modes/shtml.py
ATikhonov2/leo-editor
1,550
11133430
# Leo colorizer control file for shtml mode. # This file is in the public domain. # Properties for shtml mode. properties = { "commentEnd": "-->", "commentStart": "<!--", } # Attributes dict for shtml_main ruleset. shtml_main_attributes_dict = { "default": "null", "digit_re": "", "esc...
botenv/lib/python3.9/site-packages/redis/commands/json/decoders.py
0xtuytuy/unit-crypto-ski-week-poap-bot
483
11133445
<filename>botenv/lib/python3.9/site-packages/redis/commands/json/decoders.py import copy import re from ..helpers import nativestr def bulk_of_jsons(d): """Replace serialized JSON values with objects in a bulk array response (list). """ def _f(b): for index, item in enumerate(b): ...
datasets/jigsaw_unintended_bias/jigsaw_unintended_bias.py
WojciechKusa/datasets
10,608
11133471
# coding=utf-8 # Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice...
objectModel/Python/cdm/objectmodel/cdm_import.py
jocubeit/CDM
265
11133523
<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. from typing import Optional, TYPE_CHECKING import warnings from cdm.utilities import logger, ResolveOptions from cdm.enums import CdmObjectType...
python/jittor/test/test_searchsorted_op.py
Exusial/jittor
2,571
11133525
# *************************************************************** # Copyright (c) 2020 Jittor. Authors: # <NAME> <<EMAIL>> # <NAME> <<EMAIL>>. # All Rights Reserved. # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. # ***************...
dadmatools/models/flair/parser/utils/embedding.py
njzr/DadmaTools
161
11133544
<filename>dadmatools/models/flair/parser/utils/embedding.py<gh_stars>100-1000 # -*- coding: utf-8 -*- import torch class Embedding(object): def __init__(self, tokens, vectors, unk=None): super(Embedding, self).__init__() self.tokens = tokens self.vectors = torch.tensor(vectors) ...
torchbenchmark/models/drq/__init__.py
xuzhao9/benchmark
384
11133627
<filename>torchbenchmark/models/drq/__init__.py<gh_stars>100-1000 import copy import math import pickle as pkl import numpy as np import torch import os import sys import torch.nn as nn import torch.nn.functional as F from gym import spaces from ...util.model import BenchmarkModel from torchbenchmark.tasks import REIN...
datadog_checks_base/tests/openmetrics/test_transformers/test_temporal_percent.py
vbarbaresi/integrations-core
663
11133633
# (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import pytest from datadog_checks.dev.testing import requires_py3 from ..utils import get_check pytestmark = [ requires_py3, pytest.mark.openmetrics, pytest.mark.openmetrics_transformers, ...
ikalog/scenes/result_detail.py
fetus-hina/IkaLog
285
11133648
<reponame>fetus-hina/IkaLog #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IkaLog # ====== # Copyright (C) 2015 <NAME> # # 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:...
Graph Traversal/BFS/bfs.py
Subrato-oid/cs-algorithms
239
11133651
import collections def bfs(graph, root): visited, queue = [], collections.deque([root]) visited.append(root) while queue: vertex = queue.popleft() for neighbour in graph[vertex]: if neighbour not in visited: visited.append(neighbour) queue.app...
steamctl/commands/hlmaster/__init__.py
rossengeorgiev/steamctl
138
11133654
<filename>steamctl/commands/hlmaster/__init__.py from steamctl.argparser import register_command @register_command('hlmaster', help='Query master server and server information') def setup_arg_parser(cp): def print_help(*args, **kwargs): cp.print_help() cp.set_defaults(_cmd_func=print_help) sub_c...
trove/common/db/mysql/models.py
sapcc/trove
244
11133679
<gh_stars>100-1000 # Copyright 2016 Tesora, 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 # # ...
transit-network-analysis-tools/parallel_cpap.py
ArcGIS/public-transit-tools
130
11133692
############################################################################ ## Tool name: Transit Network Analysis Tools ## Created by: <NAME>, Esri ## Last updated: 6 August 2021 ############################################################################ """Do the core logic for the Create Percent Access Polygo...
viberbot/api/messages/typed_message.py
TeamCodeCreator/ViberBot
169
11133698
from future.utils import python_2_unicode_compatible from abc import abstractmethod from viberbot.api.messages.message import Message class TypedMessage(Message): def __init__(self, message_type, tracking_data=None, keyboard=None, min_api_version=None, alt_text=None): super(TypedMessage, self).__init__(tracking_da...
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotTemporaryStatesEnum.py
htlcnn/ironpython-stubs
182
11133723
<reponame>htlcnn/ironpython-stubs class dotTemporaryStatesEnum(Enum): """ enum dotTemporaryStatesEnum,values: DOT_TEMPORARY_STATE_ACCEPTED (8),DOT_TEMPORARY_STATE_ACTIVE (6),DOT_TEMPORARY_STATE_DELETED (3),DOT_TEMPORARY_STATE_DM_ONGOING (4),DOT_TEMPORARY_STATE_MODIFIED (2),DOT_TEMPORARY_STATE_NEW (1),DOT_TEMPORARY_STA...
training/utils.py
oseiskar/autosubsync
244
11133770
<filename>training/utils.py """ Leftover utilities useful for Jypyter notebooks and development but not strictly required. """ def read_srt_to_data_frame(fn): "Read SRT file to a pandas.DataFrame" from autosubsync import srt_io import pandas as pd rows = [list(x) for x in srt_io.read_file_tuples(fn)]...
pajbot/models/pleblist.py
JoachimFlottorp/pajbot
128
11133818
import logging from pajbot import utils from pajbot.managers.db import Base from sqlalchemy import INT, TEXT, Column, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy_utc import UtcDateTime log = logging.getLogger("pajbot") class PleblistSong(Base): __tablename__ = "pleblist_song" id = C...
running_modes/curriculum_learning/update_watcher.py
lilleswing/Reinvent-1
183
11133823
import json import os import time from running_modes.configurations import GeneralConfigurationEnvelope from running_modes.configurations.curriculum_learning import CurriculumLearningComponents, \ CurriculumLearningConfiguration class UpdateWatcher: def __init__(self, runner): self.runner = runner ...
tests/features/mail/test_terminal.py
cercos/masonite
1,816
11133856
<filename>tests/features/mail/test_terminal.py from tests import TestCase from src.masonite.mail import Mailable class Welcome(Mailable): def build(self): return ( self.to("<EMAIL>") .subject("Masonite 4") .from_("<EMAIL>") .text("Hello from Masonite!") ...
src/server/jobs/schema.py
monosidev/monosi
156
11133895
<reponame>monosidev/monosi from server.pipeline import monitors_pipeline from .base import CollectorJob class SchemaCollectorJob(CollectorJob): def pipelines(self): return [monitors_pipeline] def configuration(self): return { 'monitors': [ { 'type': 'schema' } ] }
LeetCode/python/1052.py
ZintrulCre/LeetCode_Archiver
279
11133900
class Solution(object): def maxSatisfied(self, customers, grumpy, X): """ :type customers: List[int] :type grumpy: List[int] :type X: int :rtype: int """ res, n = 0, len(customers) for i in range(n): res += customers[i] * (grumpy[i] ^ 1) ...
interactive_demo/models/mobile_resnet_generator.py
wxy347/gan-compression
1,005
11133926
<filename>interactive_demo/models/mobile_resnet_generator.py import functools from torch import nn from models.mobile_modules import SeparableConv2d class MobileResnetBlock(nn.Module): def __init__(self, dim, padding_type, norm_layer, dropout_rate, use_bias): super(MobileResnetBlock, self).__init__() ...
src/tox/interpreters/windows/__init__.py
snsnlou/tox
2,811
11133961
<reponame>snsnlou/tox from __future__ import unicode_literals from threading import Lock import tox from ..common import base_discover from ..py_spec import CURRENT from ..via_path import check_with_path @tox.hookimpl def tox_get_python_executable(envconfig): spec, path = base_discover(envconfig) if path i...
gerapy_auto_extractor/patterns/title.py
Insutanto/GerapyAutoExtractor
214
11133962
METAS = [ '//meta[starts-with(@property, "og:title")]/@content', '//meta[starts-with(@name, "og:title")]/@content', '//meta[starts-with(@property, "title")]/@content', '//meta[starts-with(@name, "title")]/@content', '//meta[starts-with(@property, "page:title")]/@content', ]
kur/loss/loss.py
greedyuser/kur
867
11133976
""" Copyright 2016 Deepgram 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, software distri...
runtimes/alibi-explain/tests/helpers/tf_model.py
SeldonIO/MLServer
191
11134013
import os from pathlib import Path import tensorflow as tf from mlserver import MLModel from mlserver.codecs import NumpyCodec from mlserver.types import InferenceRequest, InferenceResponse def get_tf_mnist_model_uri() -> Path: return Path(os.path.dirname(__file__)).parent / "data" / "tf_mnist" / "model.h5" c...
conans/test/integration/deprecated/test_deprecated.py
Wonders11/conan
6,205
11134016
import unittest from conans.test.utils.tools import TestClient, GenConanfile class DeprecatedTestCase(unittest.TestCase): def test_no_deprecated(self): t = TestClient() t.save({'taskflow.py': GenConanfile("cpp-taskflow", "1.0").with_deprecated("''")}) t.run("create taskflow.py") ...
src_python/habitat_sim/registry.py
narekvslife/habitat-sim
1,457
11134019
#!/usr/bin/env python3 # 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 collections import re from typing import DefaultDict, Optional, Type __all__ = ["registry"] def _camel_to_snak...
examples/tutorial/employee.py
nucleic/atom
222
11134021
<gh_stars>100-1000 # -------------------------------------------------------------------------------------- # Copyright (c) 2013-2021, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # -------------------...
test_installation_script.py
textext/textext
508
11134025
""" This file is part of TexText, an extension for the vector illustration program Inkscape. Copyright (c) 2006-2021 TexText developers. TexText is released under the 3-Clause BSD license. See file LICENSE.txt or go to https://github.com/textext/textext for full license details. This script creates fake executables ...
torchbenchmark/models/BERT_pytorch/bert_pytorch/model/embedding/__init__.py
Chillee/benchmark
5,013
11134042
from .bert import BERTEmbedding