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/test_year_2013.py
l0pht511/jpholiday
179
11158381
# coding: utf-8 import datetime import unittest import jpholiday class TestYear2013(unittest.TestCase): def test_holiday(self): """ 2013年祝日 """ self.assertEqual(jpholiday.is_holiday_name(datetime.date(2013, 1, 1)), '元日') self.assertEqual(jpholiday.is_holiday_name(datetime....
cacreader/swig-4.0.2/Examples/test-suite/python/nested_in_template_runme.py
kyletanyag/LL-Smartcard
1,031
11158384
<gh_stars>1000+ from nested_in_template import * cd = ConcreteDerived(88) if cd.m_value != 88: raise RuntimeError("ConcreteDerived not created correctly")
aliyun-python-sdk-hbr/aliyunsdkhbr/request/v20170908/CreateBackupPlanRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
11158410
<filename>aliyun-python-sdk-hbr/aliyunsdkhbr/request/v20170908/CreateBackupPlanRequest.py # 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...
algorithms/permutation-equation.py
gajubadge11/HackerRank-1
340
11158419
#!/usr/bin/env python3 import sys def permutationEquation(p): output = [] for num in range(1, max(p)+1): output.append(p.index(p.index(num)+1)+1) return output if __name__ == "__main__": n = int(input().strip()) p = list(map(int, input().strip().split(' '))) result ...
tests/benchmarking/benchmarking_example.py
YevheniiSemendiak/pytorch-tools
155
11158431
<gh_stars>100-1000 """Example of measuring memory consumption and speed in PyTorch""" import torch import time from torch.autograd import Variable # #### MEMORY #### def consume_gpu_ram(n): return torch.ones((n, n)).cuda(0) def consume_gpu_ram_256mb(): return consume_gpu_ram(2 ** 13) # should be 1024 peak,...
aruco_detect/scripts/create_markers.py
teosnare/fiducials
232
11158443
#!/usr/bin/python3 """ Generate a PDF file containaing one or more fiducial markers for printing """ import os, sys, argparse import subprocess from marker_generation import genMarker def checkCmd(cmd, package): rc = os.system("which %s > /dev/null" % cmd) if rc != 0: print("""This utility requires %...
theonionbox/tob/system/__init__.py
ralphwetzel/theonionbox
120
11158453
from typing import Optional import os import platform from collections import deque import itertools from psutil import virtual_memory, cpu_percent # to readout the cpu load from threading import RLock from ..deviation import getTimer class BaseSystem(object): def __init__(self): self.__user = None ...
sort/insertion_sort/python/akshitgrover_Insertion_Sort.py
CarbonDDR/al-go-rithms
1,253
11158458
<gh_stars>1000+ n=int(input()) a=[] for i in range(0,n): c=0 for j in range(0,3): c=c+int(input()) a=a+[c] for i in range(0,len(a)): j=i-1 h=i while j>=0 and a[j]<a[h]: c=a[h] del a[h] a.insert(j,c) j-=1 h-=1 print(a)
unit_testing_course/lesson1/task2/tests.py
behzod/pycharm-courses
213
11158485
import unittest.mock as mock from custom_test_helpers import check_tests_pass, check_tests_fail, \ reload_module, abort_tests from test_helper import run_common_tests, test_answer_placeholders_text_deleted, \ passed, failed, import_task_file if __name__ == '__main__': from hello_someone import hello_some...
djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/openid/urls.py
DemarcusL/django_wiki_lab
6,342
11158519
from django.urls import path from . import views urlpatterns = [ path("openid/login/", views.login, name="openid_login"), path("openid/callback/", views.callback, name="openid_callback"), ]
Python3/522.py
rakhi2001/ecom7
854
11158565
<filename>Python3/522.py __________________________________________________________________________________________________ sample 28 ms submission class Solution: def findLUSlength(self, strs): def subseq(src, sub): i = 0 n = len(sub) for ch in src: ...
conan/tools/env/virtualbuildenv.py
gmeeker/conan
6,205
11158569
<gh_stars>1000+ from conan.tools.env import Environment from conan.tools.env.virtualrunenv import runenv_from_cpp_info class VirtualBuildEnv: """ captures the conanfile environment that is defined from its dependencies, and also from profiles """ def __init__(self, conanfile): self._conanfile...
selim_sef-solution/lucid/scratch/pretty_graphs/graph.py
Hulihrach/RoadDetector
4,537
11158605
<reponame>Hulihrach/RoadDetector<filename>selim_sef-solution/lucid/scratch/pretty_graphs/graph.py<gh_stars>1000+ import numpy as np import tensorflow as tf import lucid.modelzoo.vision_models as models import lucid.optvis.objectives as objectives import lucid.optvis.param as param import lucid.optvis.render as render ...
minetorch/plugins/noise_detector.py
louis-she/torchpack
127
11158631
<reponame>louis-she/torchpack import torch from minetorch.plugin import Plugin from minetorch.statable import Statable class NoiseSampleDetector(Plugin, Statable): """This plugin helps to find out the suspicious noise samples. provid a metric which compute a scalar for every sample, in most cases the metr...
test/win/large-pdb/large-pdb.gyp
chlorm-forks/gyp
2,151
11158695
<reponame>chlorm-forks/gyp # Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'large_pdb_exe', 'type': 'executable', 'msvs_large_pdb': 1, 'sources': [ ...
python-toolbox/marvin_python_toolbox/common/data_source_provider.py
mechamoedson/incubator-marvin
149
11158708
<filename>python-toolbox/marvin_python_toolbox/common/data_source_provider.py #!/usr/bin/env python # coding=utf-8 # Copyright [2017] [B2W Digital] # # 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 Licen...
image_segmentation/utils/deeplab_model.py
wisespa/fritz-models
277
11158714
<filename>image_segmentation/utils/deeplab_model.py import os import tarfile import numpy as np from PIL import Image from six.moves import urllib import tempfile import tensorflow as tf MODEL_NAME = 'mobilenetv2_coco_voctrainaug' _DOWNLOAD_URL_PREFIX = 'http://download.tensorflow.org/models/' _MODEL_URLS = { '...
tests/torchfunc_test.py
itsjoshthedeveloper/torchfunc
210
11158730
import sys import time import torch import torchfunc def test_timer_context_manager(): with torchfunc.Timer() as timer: time.sleep(1) last_in_block = timer.checkpoint() # register checkpoint last_time = timer.checkpoint() time.sleep(1) assert last_time == timer.checkpoint() == timer...
thumb_daemon.py
twnming/arxiv-sanity-lite
501
11158767
""" Iterates over the current database and makes best effort to download the papers, convert them to thumbnail images and save them to disk, for display in the UI. Atm only runs the most recent 5K papers. Intended to be run as a cron job daily or something like that. """ import os import time import random import requ...
boto3_type_annotations/boto3_type_annotations/lex_models/paginator.py
cowboygneox/boto3_type_annotations
119
11158788
from typing import Dict from botocore.paginate import Paginator class GetBotAliases(Paginator): def paginate(self, botName: str, nameContains: str = None, PaginationConfig: Dict = None) -> Dict: pass class GetBotChannelAssociations(Paginator): def paginate(self, botName: str, botAlias: str, nameCont...
iamport/__init__.py
hrxorxm/iamport-rest-client-python
126
11158796
from .client import Iamport __all__ = ['Iamport']
qf_lib_tests/unit_tests/portfolio_construction/test_max_diversification_portfolio.py
webclinic017/qf-lib
198
11158823
# Copyright 2016-present CERN – European Organization for Nuclear Research # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
modules/pairwise.py
roysubhankar/L2C
311
11158842
<gh_stars>100-1000 import torch def PairEnum(x,mask=None): # Enumerate all pairs of feature in x assert x.ndimension() == 2, 'Input dimension must be 2' x1 = x.repeat(x.size(0),1) x2 = x.repeat(1,x.size(0)).view(-1,x.size(1)) if mask is not None: xmask = mask.view(-1,1).repeat(1,x.size(1))...
testsuite/utils/http.py
okutane/yandex-taxi-testsuite
128
11158862
<filename>testsuite/utils/http.py import json import typing import urllib.parse import aiohttp.web class BaseError(Exception): pass class MockedError(BaseError): """Base class for mockserver mocked errors.""" error_code = 'unknown' class TimeoutError(MockedError): # pylint: disable=redefined-builti...
2021/quals/pwn-memsafety/attachments/chal.py
BearerPipelineTest/google-ctf
2,757
11158866
<filename>2021/quals/pwn-memsafety/attachments/chal.py # 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 # # Unle...
Dashboards/migrate_screenboard.py
nadaj/Miscellany
155
11158917
<filename>Dashboards/migrate_screenboard.py from datadog import initialize, api old_api = "*****" old_app = "*****" screenboard_id = **** options = { 'api_key': old_api, 'app_key': old_app } initialize(**options) screenboard = api.Screenboard.get(screenboard_id) print(screenboard) new_api = '*****' new_ap...
archai/datasets/limit_dataset.py
shatadru99/archai
344
11158921
<reponame>shatadru99/archai # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import List, Tuple, Union, Optional import torch from torch.utils.data import \ SubsetRandomSampler, Sampler, Subset, ConcatDataset, Dataset, random_split class LimitDataset(Dataset): de...
app/models/menu.py
Allen7D/mini-shop-server
533
11158923
# _*_ coding: utf-8 _*_ """ Created by Mohan on 2020/4. """ from sqlalchemy import Column, Integer, ForeignKey from app.core.db import BaseModel as Model __author__ = 'Mohan' class Menu(Model): __tablename__ = 'menu' group_id = Column(Integer, ForeignKey('group.id'), primary_key=True, comment='外键 权限组ID') ...
setup.py
ai-med/squeeze_and_excitation
227
11158938
<filename>setup.py<gh_stars>100-1000 import setuptools setuptools.setup(name="squeeze-and-excitation", version="1.0", url="https://github.com/abhi4ssj/squeeze_and_excitation", author="<NAME> and <NAME>", author_email="<EMAIL>", descri...
tests/test-scripts/fil-interpreter.py
pythonspeed/filprofiler
521
11158955
"""Tests that need to be run under `fil-profile python`. To run: $ fil-profile python -m pytest tests/test-scripts/fil-interpreter.py """ import sys import os from ctypes import c_void_p import re from pathlib import Path from subprocess import check_output, check_call import multiprocessing import pytest import nu...
saas/pagination.py
kaiserho/djaodjin-saas
383
11158980
<filename>saas/pagination.py # Copyright (c) 2021, DjaoDjin inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # ...
logging_course/lesson7/task3/db_handler.py
behzod/pycharm-courses
213
11159012
from __future__ import print_function import logging import logging.config import datetime import sqlite3 as sqlite class DatabaseHandler(logging.Handler): """ Store log records in a sqlite database. """ def __init__(self, filename): super(DatabaseHandler, self).__init__() self.db = sqlite...
theseus/geometry/tests/test_se2.py
jeffin07/theseus
236
11159049
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import pytest # noqa: F401 import torch import theseus as th from theseus.constants import EPS from theseus.core.tests....
recipyCmd/recipycmd.py
robintw/recipy
451
11159112
#!/usr/bin/env python """recipy - a frictionless provenance tool for Python Usage: recipy search [options] <outputfile> recipy latest [options] recipy gui [options] recipy annotate [<idvalue>] recipy pm [--format=<rst|plain>] recipy (-h | --help) recipy --version Options: -h --help Show this sc...
PhysicsTools/PatUtils/python/bJetOperatingPointsParameters_cfi.py
ckamtsikis/cmssw
852
11159129
<filename>PhysicsTools/PatUtils/python/bJetOperatingPointsParameters_cfi.py<gh_stars>100-1000 # preliminary b-tagging Operating Points # obtained with cmssw_2_1_0_pre6 # qcd validation /store/relval/2008/6/22/RelVal-RelValQCD_Pt_80_120-1213987236-IDEAL_V2-2nd/0003/ # corrected pt 30 |eta| <2.4 taggability >2 # import ...
google_play_scraper/utils/__init__.py
shikher-chhawchharia/google-play-scraper
325
11159132
<reponame>shikher-chhawchharia/google-play-scraper def nested_lookup(source, indexes): if len(indexes) == 1: return source[indexes[0]] return nested_lookup(source[indexes[0]], indexes[1::])
apc/model.py
voidism/Mockingjay-Speech-Representation
105
11159133
<gh_stars>100-1000 # -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ apc/model.py ] # Synopsis [ implementation of the apc model ] # Author [ <NAME> ] # Copyright [ https://github.com/iamyuanchung/Autoregre...
src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models_py3.py
Mannan2812/azure-cli-extensions
207
11159166
<gh_stars>100-1000 # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Genera...
pclpy/__init__.py
sweptlaser/pclpy
293
11159204
<filename>pclpy/__init__.py import platform import pclpy.pcl as pcl from pclpy.io.functions import read from pclpy.io.las import read as read_las from pclpy.io.las import write as write_las from pclpy.api import ( extract_clusters, compute_normals, region_growing, moving_least_squares, mls, r...
td4a/controllers/schema.py
mihai-satmarean/td4a
171
11159231
""" /retrieve """ import json from flask import current_app as app from flask import request, jsonify, Blueprint from td4a.models.exception_handler import ExceptionHandler, HandledException from td4a.models.sort_commented_map import sort_commented_map from td4a.models.td4ayaml import Td4aYaml import genson api_schema ...
hybrik/version.py
Jeff-sjtu/HybrIK
287
11159269
<filename>hybrik/version.py<gh_stars>100-1000 # GENERATED VERSION FILE # TIME: Mon Apr 5 16:07:46 2021 __version__ = '0.1.0+c9f82ae' short_version = '0.1.0'
solutions/problem_046.py
ksvr444/daily-coding-problem
1,921
11159272
def is_palindrome(s1): return s1 == s1[::-1] def get_longest_palindrome_substring(s): if not s or is_palindrome(s): return s s1 = get_longest_palindrome_substring(s[1:]) s2 = get_longest_palindrome_substring(s[:-1]) return s1 if len(s1) >= len(s2) else s2 assert get_longest_palindrome_...
flowtorch/nn/made.py
sankethvedula/flowtorch
207
11159276
<reponame>sankethvedula/flowtorch # Copyright (c) Meta Platforms, Inc from typing import Sequence, Tuple import torch import torch.nn as nn from torch.nn import functional as F def sample_mask_indices( input_dim: int, hidden_dim: int, simple: bool = True ) -> torch.Tensor: """ Samples the indices assign...
viewer_states/qLib_camera_zoom_vertigo_ql_dop.py
JosephSilvermanArt/qLib
572
11159316
import hou import qLibCameraZoomVertigo def createViewerStateTemplate(): state_name = "qLib::camera_zoom_vertigo_ql_dop" state_label = "Camera Zoom/Vertigo (dop) [qL]" template = hou.ViewerStateTemplate( state_name, state_label, hou.dopNodeTypeCategory(), ...
venv/lib/python3.8/site-packages/kivy/tests/test_uix_bubble.py
felipesch92/projeto_kivy
13,889
11159317
<filename>venv/lib/python3.8/site-packages/kivy/tests/test_uix_bubble.py import pytest @pytest.mark.parametrize('prop_name', ( '_fills_row_first', '_fills_from_left_to_right', '_fills_from_top_to_bottom', )) def test_a_certain_properties_from_the_super_class_are_overwritten(prop_name): from kivy.uix.b...
keyring/credentials.py
davegaeddert/keyring
834
11159362
import os import abc class Credential(metaclass=abc.ABCMeta): """Abstract class to manage credentials""" @abc.abstractproperty def username(self): return None @abc.abstractproperty def password(self): return None class SimpleCredential(Credential): """Simple credentials imp...
evosax/experimental/subpops/meta.py
RobertTLange/evosax
102
11159363
<reponame>RobertTLange/evosax import jax import jax.numpy as jnp from typing import Optional, Tuple, List import chex from functools import partial from .batch import BatchStrategy from ... import Strategies class MetaStrategy(BatchStrategy): def __init__( self, meta_strategy_name: str, in...
opendatasets/utils/archive.py
LippDas/opendatasets
167
11159381
import os import tarfile import zipfile import gzip def _is_tarxz(filename): return filename.endswith(".tar.xz") def _is_tar(filename): return filename.endswith(".tar") def _is_targz(filename): return filename.endswith(".tar.gz") def _is_tgz(filename): return filename.endswith(".tgz") def _is_...
examples/vm_scheduling/rule_based_algorithm/rule_based_algorithm.py
yangboz/maro
598
11159407
<filename>examples/vm_scheduling/rule_based_algorithm/rule_based_algorithm.py<gh_stars>100-1000 import abc from maro.simulator import Env from maro.simulator.scenarios.vm_scheduling import AllocateAction, DecisionPayload class RuleBasedAlgorithm(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod d...
tests/test_utilities/test_csvjoin.py
Bonifacio2/csvkit
3,239
11159424
#!/usr/bin/env python import sys try: from mock import patch except ImportError: from unittest.mock import patch from csvkit.utilities.csvjoin import CSVJoin, launch_new_instance from tests.utils import CSVKitTestCase, EmptyFileTests class TestCSVJoin(CSVKitTestCase, EmptyFileTests): Utility = CSVJoin ...
Python/Syntax/Concatenation.py
piovezan/SOpt
148
11159439
<gh_stars>100-1000 variavel = input('informe um valor') print('{' + variavel + '}') #https://pt.stackoverflow.com/q/444281/101
examples/pytorch/compGCN/data_loader.py
ketyi/dgl
9,516
11159464
import torch from torch.utils.data import Dataset, DataLoader import numpy as np import dgl from collections import defaultdict as ddict from ordered_set import OrderedSet class TrainDataset(Dataset): """ Training Dataset class. Parameters ---------- triples: The triples used for training the model...
onmt/translate/__init__.py
qurrata111/OpenNMT-py
5,864
11159469
""" Modules for translation """ from onmt.translate.translator import Translator, GeneratorLM from onmt.translate.translation import Translation, TranslationBuilder from onmt.translate.beam_search import BeamSearch, GNMTGlobalScorer from onmt.translate.beam_search import BeamSearchLM from onmt.translate.decode_strategy...
Filters/General/Testing/Python/TestFEDiscreteClipper2D.py
satya-arjunan/vtk8
1,755
11159471
#!/usr/bin/env python import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Create the RenderWindow, Renderer and both Actors # ren1 = vtk.vtkRenderer() ren1.SetBackground(1,1,1) renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren1) iren = vtk.vtkRenderWindowInteractor() iren.SetRend...
examples/service/handlers/secondService.py
BSlience/fastweb
123
11159511
# coding:utf8 """generate by fasthrift""" from fastweb.service import ABLogic class secondServiceHandler(ABLogic): def sayHello(self): pass def getData(self): pass # coding:utf8 """generate by fasthrift""" from fastweb.service import ABLogic class secondServiceHandler(ABLogic): ...
tests/h/views/groups_test.py
pombredanne/h
2,103
11159515
<reponame>pombredanne/h from unittest import mock import pytest from h_matchers import Any from pyramid.httpexceptions import HTTPMovedPermanently from h.traversal.group import GroupContext from h.views import groups as views @pytest.mark.usefixtures("group_create_service", "handle_form_submission", "routes") class...
1100-1200q/1184.py
rampup01/Leetcode
990
11159563
''' A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n. The bus goes along both directions i.e. clockwise and counterclockwise. Return the shortest distance between the ...
utils/util.py
shlomi-amitai/monorec
388
11159589
import json from functools import partial from pathlib import Path from datetime import datetime from itertools import repeat from collections import OrderedDict import torch from PIL import Image import numpy as np import torch.nn.functional as F def map_fn(batch, fn): if isinstance(batch, dict): for k ...
Config.py
securitylist/GitLeak
132
11159629
# Relative path of pattern file to GitPrey FILE_DB = "pattern/file.db" INFO_DB = "pattern/info.db" # GitHub account config for searching USER_NAME = "" PASSWORD = "" # Blacklist EXT_BLACKLIST = [".ico", ".flv", ".css", ".jpg", ".png", ".jpeg", ".gif", ".pdf", ".ss3", ".rar", ".zip", ".avi", ".mp4", ".swf", ".wmi", "....
furniture/env/xml_adjusting/xml_edit.py
KejiaChen/assembly
364
11159633
<filename>furniture/env/xml_adjusting/xml_edit.py<gh_stars>100-1000 import numpy as np import seaborn as sns import matplotlib.pyplot as plt import xml.etree.ElementTree as ET import sys import argparse import colorsys import re # def _get_colors(num_colors): # colors=[] # for i in np.arange(0., 360., 360. / ...
samples/features/high availability/Linux/Ansible Playbook/library/mssql_ag.py
manikanth/sql-server-samples
4,474
11159637
<reponame>manikanth/sql-server-samples<gh_stars>1000+ #!/usr/bin/python # Copyright (c) 2017 Microsoft Corporation ANSIBLE_METADATA = { 'metadata_version': '1.1', 'supported_by': 'community', 'status': ['preview'] } DOCUMENTATION = ''' --- module: mssql_ag short_description: Add or join availability groups on a ...
tests/test_model_definition/test_model_construct.py
ivangirko/ormar
905
11159640
<reponame>ivangirko/ormar<filename>tests/test_model_definition/test_model_construct.py<gh_stars>100-1000 from typing import List import databases import pytest import sqlalchemy import ormar from tests.settings import DATABASE_URL database = databases.Database(DATABASE_URL, force_rollback=True) metadata = sqlalchemy...
modules/drizzle.py
beornf/salt-contrib
111
11159644
# -*- coding: utf-8 -*- ''' Drizzle is a MySQL fork optimized for Net and Cloud performance. This module provides Drizzle compatibility to Salt execution :Depends: MySQLdb python module :Configuration: The following changes are to be made in /etc/salt/minion on respective minions Example:: drizzle...
codigo/Live115/observer_concreto.py
cassiasamp/live-de-python
572
11159688
from observer_abc import Observador, Observavel class BolaDeCristal: def atualizar(self, mensagem): print(f"Fausto está na escola, mas recebeu a mensagem: {mensagem}") class Centauro: def __init__(self): self._observers = [] def adicionar_observer(self, observador): self._observer...
aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py
kuraakhilesh8230/aries-cloudagent-python
247
11159722
<filename>aries_cloudagent/protocols/present_proof/v1_0/handlers/presentation_problem_report_handler.py """Presentation problem report message handler.""" from .....messaging.base_handler import BaseHandler from .....messaging.request_context import RequestContext from .....messaging.responder import BaseResponder fro...
src/python/tests/test_estimator_checks.py
montehoover/NimbusML
134
11159729
<gh_stars>100-1000 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------------------------- """ run check_est...
tests/framework/PostProcessors/FastFourierTransform/Basic/dataGenerator.py
rinelson456/raven
159
11159738
<filename>tests/framework/PostProcessors/FastFourierTransform/Basic/dataGenerator.py<gh_stars>100-1000 import numpy as np N = 100 t = np.linspace(0,N,N) periods = [[4,8,20], [3.333,13,50]] amplitudes = [[5,3,10], [6,1,100]] def makeSignal(periods,amplitudes,N): signal = np.zeros(N) for i ...
scripts/CreateAssemblyGraphVertices.py
tijyojwad/shasta
267
11159779
#!/usr/bin/python3 import shasta a = shasta.Assembler() a.accessMarkerGraphVertices() a.accessMarkerGraphEdges() a.accessMarkerGraphReverseComplementVertex() a.accessAssemblyGraphEdgeLists() a.createAssemblyGraphVertices()
validators/i18n/fi.py
shouhei/validators
674
11159783
<reponame>shouhei/validators<gh_stars>100-1000 import re from validators.utils import validator business_id_pattern = re.compile(r'^[0-9]{7}-[0-9]$') ssn_checkmarks = '0123456789ABCDEFHJKLMNPRSTUVWXY' ssn_pattern = re.compile( r"""^ (?P<date>([0-2]\d|3[01]) (0\d|1[012]) (\d{{2}})) [A+-] (?P<se...
2018-google-quals/sftp/find_password.py
integeruser/on-pwning
104
11159803
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import z3 for PASSWORD_LENGTH in range(1, 16): solver = z3.Solver() password = [z3.BitVec('c{}'.format(i), 64) for i in range(PASSWORD_LENGTH)] for i in range(PASSWORD_LENGTH): # costraints not really needed, just for finding a password composed of le...
train.py
jack-willturner/DeepCompression-PyTorch
149
11159835
<filename>train.py """Train base models to later be pruned""" from __future__ import print_function import torch import torch.nn as nn import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import argparse import random import numpy as np from models import get_model from utils import * from tq...
mne/io/snirf/__init__.py
stevemats/mne-python
1,953
11159941
"""SNIRF module for conversion to FIF.""" # Author: <NAME> <<EMAIL>> # # License: BSD-3-Clause from ._snirf import read_raw_snirf
datasets/DET/seed/impl/OpenImages.py
zhangzhengde0225/SwinTrack
143
11159972
from datasets.DET.constructor.base_interface import DetectionDatasetConstructor from datasets.types.data_split import DataSplit import os import csv from collections import namedtuple from data.types.bounding_box_format import BoundingBoxFormat def construct_OpenImages(constructor: DetectionDatasetConstructor, seed):...
gobbli/test/experiment/test_base_experiment.py
awesome-archive/gobbli
276
11159993
<reponame>awesome-archive/gobbli<filename>gobbli/test/experiment/test_base_experiment.py from pathlib import Path import pytest import ray from gobbli.test.util import MockDataset, MockExperiment, MockModel, skip_if_no_gpu def test_base_experiment_init(tmpdir): tmpdir_path = Path(tmpdir) ds = MockDataset.lo...
bookwyrm/migrations/0095_merge_20210911_2143.py
mouse-reeve/fedireads
270
11159998
<reponame>mouse-reeve/fedireads # Generated by Django 3.2.4 on 2021-09-11 21:43 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("bookwyrm", "0094_auto_20210911_1550"), ("bookwyrm", "0094_importitem_book_guess"), ] operations = []
zentral/core/queues/backends/google_pubsub.py
arubdesu/zentral
634
11160000
<filename>zentral/core/queues/backends/google_pubsub.py from importlib import import_module import logging import time from django.utils.text import slugify from kombu.utils import json from google.api_core.exceptions import AlreadyExists from google.cloud import pubsub_v1 from google.oauth2 import service_account from...
test/lib/test_util.py
Jinnrry/reversi-alpha-zero
699
11160040
<gh_stars>100-1000 from nose.tools.trivial import eq_ from reversi_zero.lib import util from reversi_zero.lib.bitboard import board_to_string def test_parse_to_bitboards_init(): ex = ''' ########## # # # # # # # OX # # XO # # # # # # ...
finplot/examples/line.py
shujaatak/finplot
501
11160077
#!/usr/bin/env python3 import finplot as fplt import numpy as np import pandas as pd dates = pd.date_range('01:00', '01:00:01.200', freq='1ms') prices = pd.Series(np.random.random(len(dates))).rolling(30).mean() + 4 fplt.plot(dates, prices, width=3) line = fplt.add_line((dates[100], 4.4), (dates[1100], 4.6), color='...
veles/tests/test_mutable.py
AkshayJainG/veles
1,007
11160081
<filename>veles/tests/test_mutable.py # -*- coding: utf-8 -*- """ .. invisible: _ _ _____ _ _____ _____ | | | | ___| | | ___/ ___| | | | | |__ | | | |__ \ `--. | | | | __|| | | __| `--. \ \ \_/ / |___| |___| |___/\__/ / \___/\____/\_____|____/\____/ Created on Apr 23, 2014 █...
ext.py
semirook/flask-kit
133
11160110
<reponame>semirook/flask-kit # coding: utf-8 """ ext ~~~ Good place for pluggable extensions. :copyright: (c) 2015 by <NAME>. :license: BSD, see LICENSE for more details. """ from flask_debugtoolbar import DebugToolbarExtension from flask_gravatar import Gravatar from flask_login import LoginMan...
tests/exceptions/source/ownership/_init.py
ponponon/loguru
11,391
11160152
<filename>tests/exceptions/source/ownership/_init.py import os import sys import sysconfig usersite = os.path.abspath(os.path.join(os.path.dirname(__file__), "usersite")) sys.path.append(usersite) sysconfig._INSTALL_SCHEMES["posix_user"]["purelib"] = usersite
tests/misc/test_flop_count.py
wenliangzhao2018/d2go
687
11160158
<reponame>wenliangzhao2018/d2go<filename>tests/misc/test_flop_count.py<gh_stars>100-1000 import os import tempfile from d2go.utils.flop_calculator import dump_flops_info from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader from d2go.utils.testing.rcnn_helper import RCNNBaseTestCases cl...
nuplan/common/maps/nuplan_map/test/test_generic_polygon_map.py
motional/nuplan-devkit
128
11160162
<filename>nuplan/common/maps/nuplan_map/test/test_generic_polygon_map.py from typing import Any, Dict import pytest from nuplan.common.actor_state.state_representation import Point2D from nuplan.common.maps.abstract_map import SemanticMapLayer from nuplan.common.maps.abstract_map_objects import PolygonMapObject from ...
etl/parsers/etw/Microsoft_Windows_Sensors.py
IMULMUL/etl-parser
104
11160167
<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Microsoft-Windows-Sensors GUID : d8900e18-36cb-4548-966f-13f068d1f78e """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp impo...
psutil_example/print_process_memory/print_process_by_memory.py
DazEB2/SimplePyScripts
117
11160176
<reponame>DazEB2/SimplePyScripts<filename>psutil_example/print_process_memory/print_process_by_memory.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import sys from pathlib import Path from collections import defaultdict # pip install psutil import psutil sys.path.append(str(Path(__file...
whynot/simulators/civil_violence/simulator.py
yoshavit/whynot
376
11160189
<filename>whynot/simulators/civil_violence/simulator.py """Simulate and analyze runs from the civil violence model.""" import dataclasses from mesa.datacollection import DataCollector import numpy as np from whynot.simulators.civil_violence.model import CivilViolenceModel @dataclasses.dataclass class Agent: # p...
vaas-app/src/vaas/router/tests/test_views.py
allegro/vaas
251
11160226
<filename>vaas-app/src/vaas/router/tests/test_views.py<gh_stars>100-1000 from django.test import TestCase from vaas.router.models import Route from vaas.router.forms import RouteModelForm from vaas.manager.models import Director, Probe, TimeProfile from vaas.cluster.models import LogicalCluster from django.urls import ...
leetcode/132.palindrome-partitioning-ii.py
geemaple/algorithm
177
11160258
# f(i) = min(f[j] + 1 where 0 <= j <= i - 1 and s[j: i - 1] is palindrome) class Solution(object): def minCut(self, s): """ :type s: str :rtype: int """ if s is None or len(s) == 0: return 0 m = len(s) store = [[False for _ in range(m)] for _ in r...
pwncat/commands/__init__.py
Mitul16/pwncat
1,454
11160309
<filename>pwncat/commands/__init__.py """ This module implements the command parser, lexer, highlighter, etc for pwncat. Each command is defined as an individual module under ``pwncat/commands`` which defines a ``Command`` class that inherits from :class:`pwncat.commands.CommandDefinition`. Each command is capable of ...
exercises/practice/rna-transcription/rna_transcription_test.py
gsilvapt/python
1,177
11160318
<reponame>gsilvapt/python<filename>exercises/practice/rna-transcription/rna_transcription_test.py import unittest from rna_transcription import ( to_rna, ) # Tests adapted from `problem-specifications//canonical-data.json` class RnaTranscriptionTest(unittest.TestCase): def test_empty_rna_sequence(self): ...
plynx/constants/web.py
khaxis/plynx
137
11160333
"""Web constants""" class ResponseStatus: """Returned response status""" SUCCESS: str = 'SUCCESS' FAILED: str = 'FAILED'
examples/python/geometry/voxel_grid_carving.py
amoran-symbio/Open3D
1,455
11160362
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2018-2021 www.open3d.org # # Permission i...
tests/basics/int_divzero.py
learnforpractice/micropython-cpp
13,648
11160363
try: 1 // 0 except ZeroDivisionError: print("ZeroDivisionError") try: 1 % 0 except ZeroDivisionError: print("ZeroDivisionError")
tests/pytests/unit/states/apache/test_conf.py
babs/salt
9,425
11160368
<filename>tests/pytests/unit/states/apache/test_conf.py import pytest import salt.states.apache_conf as apache_conf from tests.support.mock import MagicMock, patch @pytest.fixture def configure_loader_modules(): return {apache_conf: {}} def test_enabled(): """ Test to ensure an Apache conf is enabled. ...
examples/asr_librispeech/local/prepare_librispeech.py
slikos/espresso
920
11160390
<reponame>slikos/espresso #!/usr/bin/env python3 # Copyright (c) <NAME> # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import os import sys from tqdm import tqdm try: from torcha...
tests/search_test.py
mtcolman/django-DefectDojo
249
11160451
<gh_stars>100-1000 import unittest import sys from base_test_class import BaseTestCase from selenium.webdriver.common.by import By class SearchTests(BaseTestCase): def test_login(self): driver = self.driver def test_search(self): # very basic search test to see if it doesn't 500 driv...
python/tvm/relay/backend/contrib/ethosu/op/unary_elementwise.py
XiaoSong9905/tvm
4,640
11160469
<gh_stars>1000+ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"...
release/stubs.min/RevitServices/Transactions.py
htlcnn/ironpython-stubs
182
11160480
# encoding: utf-8 # module RevitServices.Transactions calls itself Transactions # from RevitServices,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes class AutomaticTransactionStrategy(object,ITransactionStrategy): """ AutomaticTran...
metrics/frugalscore/frugalscore.py
MitchellTesla/datasets
3,395
11160484
<reponame>MitchellTesla/datasets # Copyright 2022 The HuggingFace Datasets Authors and the current metric 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://ww...
base/site-packages/jpush/device/__init__.py
edisonlz/fastor
285
11160511
from .core import Device from .entity import ( add, remove, device_tag, device_alias, device_regid, device_mobile, ) __all__ = [ Device, add, remove, device_tag, device_alias, device_regid, device_mobile, ]