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
mindsdb/api/http/initialize.py
mindsdb/main
261
17263
from distutils.version import LooseVersion import requests import os import shutil import threading import webbrowser from zipfile import ZipFile from pathlib import Path import traceback import tempfile # import concurrent.futures from flask import Flask, url_for, make_response from flask.json import dumps from flask_...
14Django/day04/BookManager/introduction1.py
HaoZhang95/PythonAndMachineLearning
937
17267
<gh_stars>100-1000 """ 模板语言: {{ 变量 }} {% 代码段 %} {% 一个参数时:变量|过滤器, Book.id | add: 1 <= 2 当前id+1来和2比较 两个参数时:变量|过滤器:参数 %}, 过滤器最多只能传2个参数,过滤器用来对传入的变量进行修改 {% if book.name|length > 4 %} 管道|符号的左右不能有多余的空格,否则报错,其次并不是name.length而是通过管道来过滤 {{ book.pub_date|date:'Y年m月j日' }} 日期的转换管道 """ """ ...
lhotse/dataset/sampling/utils.py
stachu86/lhotse
353
17269
import warnings from typing import Dict, Tuple from lhotse import CutSet from lhotse.dataset.sampling.base import CutSampler def find_pessimistic_batches( sampler: CutSampler, batch_tuple_index: int = 0 ) -> Tuple[Dict[str, CutSet], Dict[str, float]]: """ Function for finding 'pessimistic' batches, i.e. ...
aqg/utils/summarizer.py
Sicaida/Automatic_Question_Generation
134
17284
<gh_stars>100-1000 from __future__ import absolute_import from __future__ import division, print_function, unicode_literals from sumy.parsers.html import HtmlParser from sumy.parsers.plaintext import PlaintextParser from sumy.nlp.tokenizers import Tokenizer #from sumy.summarizers.lsa import LsaSummarizer as Summarizer...
tests/spot/sub_account/test_sub_account_deposit_address.py
Banging12/binance-connector-python
512
17308
<reponame>Banging12/binance-connector-python import responses from tests.util import random_str from tests.util import mock_http_response from binance.spot import Spot as Client from binance.lib.utils import encoded_string from binance.error import ParameterRequiredError mock_item = {"key_1": "value_1", "key_2": "val...
aea/helpers/pipe.py
bryanchriswhite/agents-aea
126
17340
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
vue/decorators/base.py
adamlwgriffiths/vue.py
274
17351
from vue.bridge import Object import javascript class VueDecorator: __key__ = None __parents__ = () __id__ = None __value__ = None def update(self, vue_dict): base = vue_dict for parent in self.__parents__: base = vue_dict.setdefault(parent, {}) if self.__id__...
setup.py
tgolsson/appJar
666
17355
from setuptools import setup, find_packages __name__ = "appJar" __version__ = "0.94.0" __author__ = "<NAME>" __desc__ = "An easy-to-use, feature-rich GUI wrapper for tKinter. Designed specifically for use in the classroom, but powerful enough to be used anywhere." __author_email__ = "<E...
office-plugin/windows-office/program/wizards/ui/event/RadioDataAware.py
jerrykcode/kkFileView
6,660
17382
# # 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/. # # This file incorporates work covered by the following license noti...
odin-libraries/python/odin_test.py
gspu/odin
447
17394
""" Runs tests for Ptyhon Odin SDK """ import unittest from os import environ import random from pymongo import MongoClient import pyodin as odin class OdinSdkTest(unittest.TestCase): """ Establish OdinSdkTest object """ def setUp(self): client = MongoClient(environ.get('ODIN_MONGODB')) mongo...
artemis/general/test_dict_ops.py
peteroconnor-bc/artemis
235
17395
from artemis.general.dict_ops import cross_dict_dicts, merge_dicts __author__ = 'peter' def test_cross_dict_dicts(): assert cross_dict_dicts({'a':{'aa': 1}, 'b':{'bb': 2}}, {'c': {'cc': 3}, 'd': {'dd': 4}}) == { ('a','c'):{'aa':1, 'cc':3}, ('a','d'):{'aa':1, 'dd':4}, ('b','c'):{'bb':2, 'c...
scripts/redact_cli_py/redact/io/blob_reader.py
jhapran/OCR-Form-Tools
412
17426
<filename>scripts/redact_cli_py/redact/io/blob_reader.py # 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 List from pathlib import Path from azure.storage.blob import ContainerClient from re...
Modules/ego_planner/ego-planner-swarm/src/uav_simulator/Utils/multi_map_server/src/multi_map_server/msg/_VerticalOccupancyGridList.py
473867143/Prometheus
1,217
17429
"""autogenerated by genpy from multi_map_server/VerticalOccupancyGridList.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class VerticalOccupancyGridList(genpy.Message): _md5sum = "7ef85cc95b82747f51eb01a16bd7c795" _type = "multi_map_server/Verti...
docs/examples/timer.py
vlcinsky/nameko
3,425
17441
<gh_stars>1000+ from nameko.timer import timer class Service: name ="service" @timer(interval=1) def ping(self): # method executed every second print("pong")
app/controllers/config/system/slack.py
grepleria/SnitchDNS
152
17442
<reponame>grepleria/SnitchDNS from .. import bp from flask import request, render_template, flash, redirect, url_for from flask_login import current_user, login_required from app.lib.base.provider import Provider from app.lib.base.decorators import admin_required @bp.route('/slack', methods=['GET']) @login_required @...
test/test_base_metric.py
Spraitazz/metric-learn
547
17460
import pytest import re import unittest import metric_learn import numpy as np from sklearn import clone from test.test_utils import ids_metric_learners, metric_learners, remove_y from metric_learn.sklearn_shims import set_random_state, SKLEARN_AT_LEAST_0_22 def remove_spaces(s): return re.sub(r'\s+', '', s) def ...
examples/geomopt/20-callback.py
QuESt-Calculator/pyscf
501
17461
<reponame>QuESt-Calculator/pyscf #!/usr/bin/env python ''' Optimize molecular geometry within the environment of QM/MM charges. ''' from pyscf import gto, scf from pyscf.geomopt import berny_solver from pyscf.geomopt import geometric_solver mol = gto.M(atom=''' C 0.000000 0.000000 -0.542500 O ...
atlas/foundations_contrib/src/foundations_contrib/helpers/shell.py
DeepLearnI/atlas
296
17485
<gh_stars>100-1000 def find_bash(): import os if os.name == 'nt': return _find_windows_bash() return '/bin/bash' def _find_windows_bash(): winreg = _winreg_module() import csv StringIO = _get_string_io() from os.path import dirname sub_key = 'Directory\\shell\\git_shell\\com...
test/unit/vint/ast/plugin/scope_plugin/stub_node.py
mosheavni/vint
538
17511
<reponame>mosheavni/vint from vint.ast.node_type import NodeType from vint.ast.plugin.scope_plugin.identifier_attribute import ( IDENTIFIER_ATTRIBUTE, IDENTIFIER_ATTRIBUTE_DYNAMIC_FLAG, IDENTIFIER_ATTRIBUTE_DECLARATION_FLAG, IDENTIFIER_ATTRIBUTE_MEMBER_FLAG, IDENTIFIER_ATTRIBUTE_FUNCTION_FLAG, I...
dot_dotfiles/mail/dot_offlineimap.py
TheRealOne78/dots
758
17543
#! /usr/bin/env python2 # -*- coding: utf8 -*- from subprocess import check_output def get_pass(): return check_output("pass gmail/me", shell=True).strip("\n")
macro_benchmark/SSD_Tensorflow/caffe_to_tensorflow.py
songhappy/ai-matrix
180
17578
"""Convert a Caffe model file to TensorFlow checkpoint format. Assume that the network built is a equivalent (or a sub-) to the Caffe definition. """ import tensorflow as tf from nets import caffe_scope from nets import nets_factory slim = tf.contrib.slim # ==========================================================...
gwd/converters/spike2kaggle.py
kazakh-shai/kaggle-global-wheat-detection
136
17590
import argparse import os.path as osp from glob import glob import cv2 import pandas as pd from tqdm import tqdm from gwd.converters import kaggle2coco def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--image-pattern", default="/data/SPIKE_images/*jpg") parser.add_argument("--an...
emissary/controllers/load.py
LukeB42/Emissary
193
17592
<gh_stars>100-1000 # This file contains functions designed for # loading cron tables and storing new feeds. from emissary import db from sqlalchemy import and_ from emissary.controllers.utils import spaceparse from emissary.controllers.cron import parse_timings from emissary.models import APIKey, Feed, FeedGroup def ...
tests/test_utils/test_textio.py
hongxuenong/mmocr
2,261
17605
# Copyright (c) OpenMMLab. All rights reserved. import tempfile from mmocr.utils import list_from_file, list_to_file lists = [ [], [' '], ['\t'], ['a'], [1], [1.], ['a', 'b'], ['a', 1, 1.], [1, 1., 'a'], ['啊', '啊啊'], ['選択', 'noël', 'Информацией', 'ÄÆä'], ] def test_list_t...
notes-to-self/trace.py
guilledk/trio
4,681
17617
import trio import os import json from itertools import count # Experiment with generating Chrome Event Trace format, which can be browsed # through chrome://tracing or other mechanisms. # # Screenshot: https://files.gitter.im/python-trio/general/fp6w/image.png # # Trace format docs: https://docs.google.com/document/d...
python/array/leetcode/move_zero.py
googege/algo-learn
153
17624
<reponame>googege/algo-learn<filename>python/array/leetcode/move_zero.py from typing import List # 移动零 class Solution: # 新开一个数组 def moveZeroes1(self, nums: List[int]) -> None: temp, k = [0] * len(nums), 0 for n in nums: if n != 0: temp[k] = n k +=...
tests/tests_main.py
insilications/tqdm-clr
22,617
17629
<filename>tests/tests_main.py """Test CLI usage.""" import logging import subprocess # nosec import sys from functools import wraps from os import linesep from tqdm.cli import TqdmKeyError, TqdmTypeError, main from tqdm.utils import IS_WIN from .tests_tqdm import BytesIO, _range, closing, mark, raises def restore_...
tools/replace_version.py
jasmcaus/image-deep-learning-keras
681
17632
import os def replace_version(old_version, new_version): if not isinstance(old_version, tuple) or not isinstance(new_version, tuple): raise ValueError("`old_version` and `new_version` must be a version tuple. Eg: (1.2.3)") major, minor, micro = old_version[:3] old_version = f'{major}.{minor}.{mic...
wifi_dos_own.py
Mr-Cracker-Pro/red-python-scripts
1,353
17694
<filename>wifi_dos_own.py #!/usr/bin/env python3 # Disclaimer: # This script is for educational purposes only. # Do not use against any network that you don't own or have authorization to test. #!/usr/bin/python3 # We will be using the csv module to work with the data captured by airodump-ng. import csv # If we m...
api/base/views/__init__.py
simpsonw/atmosphere
197
17709
from .version import VersionViewSet, DeployVersionViewSet __all__ = ["VersionViewSet", "DeployVersionViewSet"]
amaranth/vendor/xilinx_spartan_3_6.py
psumesh/nmigen
528
17710
<reponame>psumesh/nmigen<filename>amaranth/vendor/xilinx_spartan_3_6.py import warnings from .xilinx import XilinxPlatform __all__ = ["XilinxSpartan3APlatform", "XilinxSpartan6Platform"] XilinxSpartan3APlatform = XilinxPlatform XilinxSpartan6Platform = XilinxPlatform # TODO(amaranth-0.4): remove warnings.warn("i...
synapse/handlers/room_member_worker.py
lukaslihotzki/synapse
9,945
17771
# Copyright 2018-2021 The Matrix.org Foundation C.I.C. # # 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...
object_detection/det_heads/retinaNet_head/retinanet_head.py
no-name-xiaosheng/PaddleViT
993
17796
<reponame>no-name-xiaosheng/PaddleViT<gh_stars>100-1000 # 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 # # http://www.apache.or...
OcCo_Torch/models/pointnet_util.py
sun-pyo/OcCo
158
17814
<reponame>sun-pyo/OcCo # Copyright (c) 2020. <NAME>, <EMAIL> # Ref: https://github.com/fxia22/pointnet.pytorch/pointnet/model.py import torch, torch.nn as nn, numpy as np, torch.nn.functional as F from torch.autograd import Variable def feature_transform_regularizer(trans): d = trans.size()[1] I = torch.ey...
Kernel/kernel.py
y11en/BranchMonitoringProject
122
17838
<filename>Kernel/kernel.py # Kernel introspection module to enrich branch collected data # This code is part of BranchMonitoring framework # Written by: <NAME> - 2017 # Federal University of Parana (UFPR) from xml.etree.ElementTree import ElementTree # Parse XML import subprocess ...
cv2/wxPython-CV-widget/main.py
whitmans-max/python-examples
140
17843
import wx import cv2 #---------------------------------------------------------------------- # Panel to display image from camera #---------------------------------------------------------------------- class WebcamPanel(wx.Window): # wx.Panel, wx.Control def __init__(self, parent, camera, fps=15, flip=Fals...
datapackage_pipelines/generators/utilities.py
gperonato/datapackage-pipelines
109
17848
def arg_to_step(arg): if isinstance(arg, str): return {'run': arg} else: return dict(zip(['run', 'parameters', 'cache'], arg)) def steps(*args): return [arg_to_step(arg) for arg in args]
src/UQpy/Distributions/baseclass/DistributionContinuous1D.py
marrov/UQpy
132
17858
import numpy as np import scipy.stats as stats from UQpy.Distributions.baseclass.Distribution import Distribution class DistributionContinuous1D(Distribution): """ Parent class for univariate continuous probability distributions. """ def __init__(self, **kwargs): super().__init__(**kwargs) ...
malaya_speech/supervised/unet.py
ishine/malaya-speech
111
17881
from malaya_speech.utils import ( check_file, load_graph, generate_session, nodes_session, ) from malaya_speech.model.tf import UNET, UNETSTFT, UNET1D def load(model, module, quantized=False, **kwargs): path = check_file( file=model, module=module, keys={'model': 'model.pb...
qtapps/skrf_qtwidgets/analyzers/analyzer_rs_zva.py
mike0164/scikit-rf
379
17906
<gh_stars>100-1000 from skrf.vi.vna import rs_zva class Analyzer(rs_zva.ZVA): DEFAULT_VISA_ADDRESS = "GPIB::16::INSTR" NAME = "Rhode & Schwartz ZVA" NPORTS = 4 NCHANNELS = 32 SCPI_VERSION_TESTED = ''
silver/api/pagination.py
DocTocToc/silver
222
17916
# Copyright (c) 2015 Presslabs SRL # # 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 writ...
tests/cpydiff/modules_array_deletion.py
learnforpractice/micropython-cpp
692
17921
""" categories: Modules,array description: Array deletion not implemented cause: Unknown workaround: Unknown """ import array a = array.array('b', (1, 2, 3)) del a[1] print(a)
homeassistant/components/hue/v2/helpers.py
MrDelik/core
30,023
17927
"""Helper functions for Philips Hue v2.""" from __future__ import annotations def normalize_hue_brightness(brightness: float | None) -> float | None: """Return calculated brightness values.""" if brightness is not None: # Hue uses a range of [0, 100] to control brightness. brightness = float((...
source_code/3-2-download.py
VickyMin1994/easy-scraping-tutorial
708
17946
<gh_stars>100-1000 import os os.makedirs('./img/', exist_ok=True) IMAGE_URL = "https://mofanpy.com/static/img/description/learning_step_flowchart.png" def urllib_download(): from urllib.request import urlretrieve urlretrieve(IMAGE_URL, './img/image1.png') # whole document def request_download(): i...
make_json.py
jfalcou/infra
135
17963
<reponame>jfalcou/infra<gh_stars>100-1000 from configparser import ConfigParser import os import json obj = {} config = ConfigParser() config.read(os.path.join(os.getenv("HOME"), ".aws", "credentials")) obj["MY_ACCESS_KEY"] = config.get("default", "aws_access_key_id", fallback="") obj["MY_SECRET_KEY"] = config.get("de...
python-sdk/nuimages/scripts/render_images.py
bjajoh/nuscenes-devkit
1,284
17972
# nuScenes dev-kit. # Code written by <NAME>, 2020. import argparse import gc import os import random from typing import List from collections import defaultdict import cv2 import tqdm from nuimages.nuimages import NuImages def render_images(nuim: NuImages, mode: str = 'all', ca...
controllers/social_auth/kivyauth/__init__.py
richierh/SalesKivyMD
126
17977
<filename>controllers/social_auth/kivyauth/__init__.py from kivy.logger import Logger from kivy.utils import platform __version__ = "2.3.2" _log_message = "KivyAuth:" + f" {__version__}" + f' (installed at "{__file__}")' __all__ = ("login_providers", "auto_login") Logger.info(_log_message)
tests/resources/selenium/test_nfc.py
Avi-Labs/taurus
1,743
18011
# coding=utf-8 import logging import random import string import sys import unittest from time import time, sleep import apiritif import os import re from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, TimeoutException from selenium.webdriver.common.by import By from seleniu...
contrib/opencensus-ext-datadog/opencensus/ext/datadog/transport.py
Flared/opencensus-python
650
18088
<reponame>Flared/opencensus-python import platform import requests class DDTransport(object): """ DDTransport contains all the logic for sending Traces to Datadog :type trace_addr: str :param trace_addr: trace_addr specifies the host[:port] address of the Datadog Trace Agent. """ def __init_...
SCSCons/Variables/PackageVariable.py
Relintai/pandemonium_engine
1,403
18096
<reponame>Relintai/pandemonium_engine # MIT License # # Copyright The SCons Foundation # # 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 th...
tests/guinea-pigs/unittest/expected_failure.py
Tirzono/teamcity-messages
105
18108
<filename>tests/guinea-pigs/unittest/expected_failure.py # coding=utf-8 import sys from teamcity.unittestpy import TeamcityTestRunner if sys.version_info < (2, 7): from unittest2 import main, TestCase, expectedFailure else: from unittest import main, TestCase, expectedFailure class TestSkip(TestCase): de...
_Dist/NeuralNetworks/b_TraditionalML/MultinomialNB.py
leoatchina/MachineLearning
1,107
18117
<filename>_Dist/NeuralNetworks/b_TraditionalML/MultinomialNB.py<gh_stars>1000+ import numpy as np from sklearn.preprocessing import OneHotEncoder class MultinomialNB: """ Naive Bayes algorithm with discrete inputs Parameters ---------- alpha : float, optional (default=1.) Smooth parameter use...
batch_score.py
Lufedi/reaper
106
18120
<reponame>Lufedi/reaper #!/usr/bin/env python3 import argparse import os import sys import traceback from lib import core, utilities, run from lib.attributes import Attributes from lib.database import Database def process_arguments(): """ Uses the argparse module to parse commandline arguments. Returns...
tests/data/samplers/bucket_batch_sampler_test.py
MSLars/allennlp
11,433
18165
<gh_stars>1000+ from allennlp.common import Params from allennlp.data import Instance, Token, Batch from allennlp.data.fields import TextField from allennlp.data.samplers import BucketBatchSampler from allennlp.data.data_loaders import MultiProcessDataLoader from .sampler_test import SamplerTest class TestBucketSamp...
river/compose/renamer.py
online-ml/creme
1,105
18196
<filename>river/compose/renamer.py from typing import Dict from river import base __all__ = ["Renamer", "Prefixer", "Suffixer"] class Renamer(base.Transformer): """Renames features following substitution rules. Parameters ---------- mapping Dictionnary describing substitution rules. Keys in...
recipes/LibriSpeech/ASR/CTC/train_with_wav2vec.py
mj-kh/speechbrain
3,913
18204
#!/usr/bin/env/python3 """Recipe for training a wav2vec-based ctc ASR system with librispeech. The system employs wav2vec as its encoder. Decoding is performed with ctc greedy decoder. To run this recipe, do the following: > python train_with_wav2vec.py hparams/train_with_wav2vec.yaml The neural network is trained on C...
crits/core/fields.py
dutrow/crits
738
18226
import datetime from dateutil.parser import parse from mongoengine import DateTimeField, FileField from mongoengine.connection import DEFAULT_CONNECTION_NAME #from mongoengine.python_support import str_types from six import string_types as str_types import io from django.conf import settings if settings.FILE_DB == se...
cluster/image/pro_seafile_7.1/scripts_7.1/start.py
chaosbunker/seafile-docker
503
18229
#!/usr/bin/env python3 #coding: UTF-8 import os import sys import time import json import argparse from os.path import join, exists, dirname from upgrade import check_upgrade from utils import call, get_conf, get_script, get_command_output, get_install_dir installdir = get_install_dir() topdir = dirname(installdir) ...
sktime/datatypes/_panel/_examples.py
marcio55afr/sktime
5,349
18238
<filename>sktime/datatypes/_panel/_examples.py<gh_stars>1000+ # -*- coding: utf-8 -*- """Example generation for testing. Exports dict of examples, useful for testing as fixtures. example_dict: dict indexed by triple 1st element = mtype - str 2nd element = considered as this scitype - str 3rd element = int - ind...
pettingzoo/test/max_cycles_test.py
RedTachyon/PettingZoo
846
18244
<filename>pettingzoo/test/max_cycles_test.py import numpy as np def max_cycles_test(mod): max_cycles = 4 parallel_env = mod.parallel_env(max_cycles=max_cycles) observations = parallel_env.reset() dones = {agent: False for agent in parallel_env.agents} test_cycles = max_cycles + 10 # allows envir...
solutionbox/structured_data/mltoolbox/_structured_data/preprocess/local_preprocess.py
freyrsae/pydatalab
198
18258
<gh_stars>100-1000 # Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
mne/datasets/kiloword/__init__.py
fmamashli/mne-python
1,953
18270
"""MNE visual_92_categories dataset.""" from .kiloword import data_path, get_version
mmdeploy/codebase/mmdet/models/roi_heads/test_mixins.py
zhiqwang/mmdeploy
746
18328
<reponame>zhiqwang/mmdeploy<filename>mmdeploy/codebase/mmdet/models/roi_heads/test_mixins.py<gh_stars>100-1000 # Copyright (c) OpenMMLab. All rights reserved. import torch from mmdeploy.core import FUNCTION_REWRITER @FUNCTION_REWRITER.register_rewriter( 'mmdet.models.roi_heads.test_mixins.BBoxTestMixin.simple_te...
slm_lab/agent/memory/replay.py
jmribeiro/SLM-Lab
1,074
18351
<reponame>jmribeiro/SLM-Lab from collections import deque from copy import deepcopy from slm_lab.agent.memory.base import Memory from slm_lab.lib import logger, math_util, util from slm_lab.lib.decorator import lab_api import numpy as np import pydash as ps logger = logger.get_logger(__name__) def sample_next_states...
06_reproducibility/workflow_pipeline/my_pipeline/pipeline/configs.py
fanchi/ml-design-patterns
1,149
18389
# Copyright 2020 Google LLC. 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 applicable law or a...
lib/python3.6/site-packages/example/authorize_driver.py
venkyyPoojari/Smart-Mirror
187
18452
# Copyright (c) 2017 Uber Technologies, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publ...
topic-db/topicdb/core/models/language.py
anthcp-infocom/Contextualise
184
18523
<gh_stars>100-1000 """ Language enumeration. Part of the StoryTechnologies project. June 12, 2016 <NAME> (<EMAIL>) """ from enum import Enum class Language(Enum): # https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes # https://en.wikipedia.org/wiki/ISO_639-2 ENG = 1 # English SPA = 2 # Spanish...
Configuration/StandardSequences/python/L1Reco_cff.py
ckamtsikis/cmssw
852
18543
<filename>Configuration/StandardSequences/python/L1Reco_cff.py import FWCore.ParameterSet.Config as cms from L1Trigger.Configuration.L1TReco_cff import *
examples/create_mac_table_entry.py
open-switch/opx-docs
122
18552
#Python code block to configure MAC address table entry import cps_utils #Register the attribute type cps_utils.add_attr_type('base-mac/table/mac-address', 'mac') #Define the MAC address, interface index and VLAN attributes d = {'mac-address': '00:0a:0b:cc:0d:0e', 'ifindex': 18, 'vlan': '100'} #Create a CPS object ...
metadata-ingestion/examples/library/dataset_set_tag.py
cuong-pham/datahub
1,603
18557
# Imports for urn construction utility methods import logging from datahub.emitter.mce_builder import make_dataset_urn, make_tag_urn from datahub.emitter.mcp import MetadataChangeProposalWrapper from datahub.emitter.rest_emitter import DatahubRestEmitter # Imports for metadata model classes from datahub.metadata.sche...
examples/Old Format/matrix_latex.py
waldyrious/galgebra
151
18558
from __future__ import print_function from sympy import symbols, Matrix from galgebra.printer import xpdf, Format def main(): Format() a = Matrix ( 2, 2, ( 1, 2, 3, 4 ) ) b = Matrix ( 2, 1, ( 5, 6 ) ) c = a * b print(a,b,'=',c) x, y = symbols ( 'x, y' ) d = Matrix ( 1, 2, ( x ** 3, y ** 3...
modules/python3/tests/unittests/scripts/glm.py
ImagiaViz/inviwo
349
18572
import inviwopy from inviwopy.glm import * v1 = vec3(1,2,3) v2 = size2_t(4,5) m1 = mat4(1) m2 = mat3(0,1,0,-1,0,0,0,0,2) v3 = m2 * v1 v4 = vec4(1,2,3,4) w = v4.w a = v4.a q = v4.q z = v4.z b = v4.b p = v4.p y = v4.y g = v4.g t = v4.t x = v4.x r = v4.r s = v4.s
tests/advanced_tests/regressors.py
amlanbanerjee/auto_ml
1,671
18593
<reponame>amlanbanerjee/auto_ml<filename>tests/advanced_tests/regressors.py import datetime import os import random import sys sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path from auto_ml import Predictor from auto_ml.utils_models import load_ml_model import dill from nose.tools import assert_equal...
software/nuke/init.py
kei-iketani/plex
153
18640
<filename>software/nuke/init.py #********************************************************************* # content = init Nuke # version = 0.1.0 # date = 2019-12-01 # # license = MIT <https://github.com/alexanderrichtertd> # author = <NAME> <<EMAIL>> #********************************************************...
glasses/models/classification/base/__init__.py
rentainhe/glasses
271
18643
from torch import Tensor, nn from ...base import VisionModule class ClassificationModule(VisionModule): """Base Classification Module class""" def __init__( self, encoder: nn.Module, head: nn.Module, in_channels: int = 3, n_classes: int = 1000, **kwargs ):...
comrade/blueprints/rest.py
sp3c73r2038/elasticsearch-comrade
256
18647
from elasticsearch import TransportError from sanic import Blueprint from sanic.request import Request from sanic.response import HTTPResponse, json from ..connections import get_client rest_bp = Blueprint('rest') def format_es_exception(e: TransportError): return json({"status_code": e.status_code, ...
tests/test_utils.py
tedeler/pyexchange
128
18648
<gh_stars>100-1000 from datetime import datetime from pytz import timezone, utc from pytest import mark from pyexchange.utils import convert_datetime_to_utc def test_converting_none_returns_none(): assert convert_datetime_to_utc(None) is None def test_converting_non_tz_aware_date_returns_tz_aware(): utc_time = ...
section_11_(api)/dicts_and_lists.py
hlcooll/python_lessons
425
18716
<filename>section_11_(api)/dicts_and_lists.py # Dictionaries and lists, together # Loading from https://raw.githubusercontent.com/shannonturner/education-compliance-reports/master/investigations.json investigations = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "t...
veinmind-backdoor/register.py
Jqqzzz/veinmind-tools
364
18721
class register: plugin_dict = {} plugin_name = [] @classmethod def register(cls, plugin_name): def wrapper(plugin): cls.plugin_dict[plugin_name] = plugin return plugin return wrapper
tutorials/rhythm/plot_SlidingWindowMatching.py
bcmartinb/neurodsp
154
18740
""" Sliding Window Matching ======================= Find recurring patterns in neural signals using Sliding Window Matching. This tutorial primarily covers the :func:`~.sliding_window_matching` function. """ ################################################################################################### # Overvie...
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/tests/test_ir.py
BadDevCode/lumberyard
1,738
18778
<reponame>BadDevCode/lumberyard from __future__ import print_function import numba.unittest_support as unittest from numba import compiler, ir, objmode import numpy as np class TestIR(unittest.TestCase): def test_IRScope(self): filename = "<?>" top = ir.Scope(parent=None, loc=ir.Loc(filename=fil...
tests/test_json_util.py
okutane/yandex-taxi-testsuite
128
18785
import dateutil import pytest from testsuite.plugins import mockserver from testsuite.utils import json_util NOW = dateutil.parser.parse('2019-09-19-13:04:00.000000') MOCKSERVER_INFO = mockserver.MockserverInfo( 'localhost', 123, 'http://localhost:123/', None, ) MOCKSERVER_SSL_INFO = mockserver.MockserverInfo( ...
eventsourcing/examples/searchabletimestamps/postgres.py
ParikhKadam/eventsourcing
107
18789
<reponame>ParikhKadam/eventsourcing from datetime import datetime from typing import Any, List, Optional, Sequence, Tuple, cast from uuid import UUID from eventsourcing.domain import Aggregate from eventsourcing.examples.searchabletimestamps.persistence import ( SearchableTimestampsRecorder, ) from eventsourcing.p...
app/blogging/routes.py
Sjors/patron
114
18819
from app.blogging import bp from datetime import datetime from flask import flash, redirect, url_for from flask_login import current_user @bp.before_request def protect(): ''' Registers new function to Flask-Blogging Blueprint that protects updates to make them only viewable by paid subscribers. ''' ...
WebMirror/management/rss_parser_funcs/feed_parse_extractKaedesan721TumblrCom.py
fake-name/ReadableWebProxy
193
18837
<gh_stars>100-1000 def extractKaedesan721TumblrCom(item): ''' Parser for 'kaedesan721.tumblr.com' ''' bad_tags = [ 'FanArt', "htr asks", 'Spanish translations', 'htr anime','my thoughts', 'Cats', 'answered', 'ask meme', 'relay convos', 'translation related post', 'nig...
Scripts/sims4communitylib/classes/time/common_alarm_handle.py
ColonolNutty/Sims4CommunityLibrary
118
18893
""" The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0). https://creativecommons.org/licenses/by/4.0/ https://creativecommons.org/licenses/by/4.0/legalcode Copyright (c) COLONOLNUTTY """ import os from sims4.commands import Command, CommandType, ...
examples/make_sphere_graphic.py
itamar-dw/spherecluster
186
18907
import sys import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D # NOQA import seaborn # NOQA from spherecluster import sample_vMF plt.ion() n_clusters = 3 mus = np.random.randn(3, n_clusters) mus, r = np.linalg.qr(mus, mode='reduced') kappas = [15, 15, 15] num_points_per...
python2/examples/tutorial_threadednotifier.py
openEuler-BaseService/pyinotify
1,509
18922
# ThreadedNotifier example from tutorial # # See: http://github.com/seb-m/pyinotify/wiki/Tutorial # import pyinotify wm = pyinotify.WatchManager() # Watch Manager mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE # watched events class EventHandler(pyinotify.ProcessEvent): def process_IN_CREATE(self, event): ...
PyInstaller/hooks/hook-numpy.py
mathiascode/pyinstaller
9,267
18942
<reponame>mathiascode/pyinstaller #!/usr/bin/env python3 # --- Copyright Disclaimer --- # # In order to support PyInstaller with numpy<1.20.0 this file will be duplicated for a short period inside # PyInstaller's repository [1]. However this file is the intellectual property of the NumPy team and is # under the terms ...
test_proj/blog/admin.py
Ivan-Feofanov/django-inline-actions
204
18943
from django.contrib import admin, messages from django.shortcuts import render from django.utils.translation import gettext_lazy as _ from inline_actions.actions import DefaultActionsMixin, ViewAction from inline_actions.admin import InlineActionsMixin, InlineActionsModelAdminMixin from . import forms from .models im...
social/actions.py
raccoongang/python-social-auth
1,987
18956
from social_core.actions import do_auth, do_complete, do_disconnect
opennmt/tests/text_test.py
gcervantes8/OpenNMT-tf
1,363
18971
<reponame>gcervantes8/OpenNMT-tf<gh_stars>1000+ import tensorflow as tf from parameterized import parameterized from opennmt.data import text class TextTest(tf.test.TestCase): def _testTokensToChars(self, tokens, expected_chars): expected_chars = tf.nest.map_structure(tf.compat.as_bytes, expected_chars)...
examples/pytorch/tgn/tgn.py
ketyi/dgl
9,516
18978
<gh_stars>1000+ import copy import torch.nn as nn import dgl from modules import MemoryModule, MemoryOperation, MsgLinkPredictor, TemporalTransformerConv, TimeEncode class TGN(nn.Module): def __init__(self, edge_feat_dim, memory_dim, temporal_dim, ...
f5/bigip/tm/asm/policies/test/functional/test_signatures.py
nghia-tran/f5-common-python
272
19011
<reponame>nghia-tran/f5-common-python # Copyright 2017 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
third_party/virtualbox/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
Fimbure/icebox-1
521
19031
#!/usr/bin/env python # -*- coding: utf-8 -*- # $Id: InstructionTestGen.py $ """ Instruction Test Generator. """ from __future__ import print_function; __copyright__ = \ """ Copyright (C) 2012-2017 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox....
misc/validateInput.py
viju4you/Python
110
19090
# Validate input while True: print('Enter your age:') age = input() if age.isdecimal(): break print('Pleas enter a number for your age.')
tests/test_cli.py
jameswilkerson/elex
183
19094
<filename>tests/test_cli.py import csv import sys import json import tests try: from cStringIO import StringIO except ImportError: from io import StringIO from six import with_metaclass from elex.cli.app import ElexApp from collections import OrderedDict DATA_FILE = 'tests/data/20151103_national.json' DATA_ELE...
resrc/utils/templatetags/gravatar.py
theWhiteFox/resrc
274
19124
# -*- coding: utf-8 -*-: from django import template import urllib import hashlib register = template.Library() def gravatar(email, size=80, username=None): gravatar_url = "http://www.gravatar.com/avatar.php?" gravatar_url += urllib.urlencode({ 'gravatar_id': hashlib.md5(email).hexdigest(), ...
test/unit/object/test_collaboration_allowlist_entry.py
box/box-python-sdk
367
19142
<gh_stars>100-1000 # coding: utf-8 from __future__ import unicode_literals, absolute_import from boxsdk.config import API def test_get(mock_box_session, test_collaboration_allowlist_entry): entry_id = test_collaboration_allowlist_entry.object_id expected_url = '{0}/collaboration_whitelist_entries/{1}'.format...
jumpy/setup.py
bharadwaj1098/brax
1,162
19143
<filename>jumpy/setup.py # Copyright 2021 The Brax 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 applicabl...