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
alipay/aop/api/domain/SpecialVoucher.py
antopen/alipay-sdk-python-all
213
11160521
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class SpecialVoucher(object): def __init__(self): self._floor_amount = None self._goods_name = None self._origin_amount = None self._special_amount = None @property...
Engine/Includes/Lua/Modules/python/test.py
GCourtney27/Retina-Engine
141
11160527
<reponame>GCourtney27/Retina-Engine<filename>Engine/Includes/Lua/Modules/python/test.py print "----- import lua -----" import lua print "----- lg = lua.globals() -----" lg = lua.globals() print "lg:", lg print "lg._G:", lg._G print "lg['_G']:", lg['_G'] print "----- lg.foo = \"bar\" -----" lg.foo = 'bar' print "----- l...
tests/r/test_natural_park.py
hajime9652/observations
199
11160557
<filename>tests/r/test_natural_park.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.natural_park import natural_park def test_natural_park(): """Test module natural_park.py by downloading ...
apps/pay/views.py
aeasringnar/-django-RESTfulAPI
242
11160563
<reponame>aeasringnar/-django-RESTfulAPI import uuid import os import requests import json import re import time import datetime import random import hashlib from xml.etree import ElementTree as et from django.conf import settings import hmac import xml from django.db.models import F, Q from rest_framework import seria...
downstream/mosei/dataset.py
OlegJakushkin/s3prl
856
11160596
import random import torch import torch.nn as nn from torch.utils.data.dataset import Dataset import os import torchaudio ''' SAMPLE_RATE = 16000 EXAMPLE_WAV_MIN_SEC = 5 EXAMPLE_WAV_MAX_SEC = 15 EXAMPLE_DATASET_SIZE = 10000 ''' class MOSEIDataset(Dataset): def __init__(self, split, data, path): self.spl...
survae/transforms/__init__.py
alisiahkoohi/survae_flows
262
11160674
from .base import Transform, SequentialTransform from .cond_base import ConditionalTransform from .bijections import * from .surjections import * from .stochastic import *
setup.py
wagtail/telepath
114
11160675
<gh_stars>100-1000 #!/usr/bin/env python from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name='telepath', version='0.2', description="A library for exchanging data between Python and JavaScript", author='<NAME>'...
moe/optimal_learning/python/interfaces/covariance_interface.py
dstoeckel/MOE
966
11160678
<filename>moe/optimal_learning/python/interfaces/covariance_interface.py<gh_stars>100-1000 # -*- coding: utf-8 -*- r"""Interface for covariance function: covariance of two points and spatial/hyperparameter derivatives. .. Note:: comments are copied from the file comments of gpp_covariance.hpp Covariance functions hav...
sen/tui/commands/widget.py
lachmanfrantisek/sen
956
11160681
""" widget specific commands """ import logging from sen.tui.commands.base import register_command, SameThreadCommand import urwidtrees logger = logging.getLogger(__name__) @register_command class NavigateTopCommand(SameThreadCommand): name = "navigate-top" description = "go to first line" def run(...
tensorflow_lite_support/metadata/python/tests/metadata_writers/test_utils.py
khanhlvg/tflite-support
242
11160691
<filename>tensorflow_lite_support/metadata/python/tests/metadata_writers/test_utils.py<gh_stars>100-1000 # Copyright 2020 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...
L1Trigger/L1CaloTrigger/test/Phase1L1TJetHwEmuComp.py
ckamtsikis/cmssw
852
11160709
<reponame>ckamtsikis/cmssw #!/usr/bin/env python from __future__ import print_function import os import sys import math import numpy import matplotlib.pyplot as plt import numpy as np from matplotlib import colors ptLSB = 0.25; etaLSB = 0.0043633231; phiLSB = 0.0043633231; hwJets = [] emJets = [] hwData = [] emData =...
dash-display-error-messages.py
oriolmirosa/dash-recipes
932
11160718
import dash from dash.dependencies import Input, Output import dash_core_components as dcc import dash_html_components as html import flask import os app = dash.Dash() app.layout = html.Div([ dcc.Input(id='input', value=''), html.Div(id='output') ]) @app.callback( Output('output', 'children'), [Input...
usaspending_api/agency/tests/integration/test_agency_budget_function.py
ststuck/usaspending-api
217
11160737
<gh_stars>100-1000 import pytest from rest_framework import status from usaspending_api.common.helpers.fiscal_year_helpers import current_fiscal_year url = "/api/v2/agency/{code}/budget_function/{query_params}" @pytest.mark.django_db def test_budget_function_list_success(client, monkeypatch, agency_account_data, ...
educative/linkedlists/reverseSubList.py
monishshah18/python-cp-cheatsheet
140
11160746
<gh_stars>100-1000 from __future__ import print_function class Node: def __init__(self, value, next=None): self.value = value self.next = next def print_list(self): temp = self while temp is not None: print(temp.value, end=" ") temp = temp.next print() """ # time: 14 M Error: omm...
vumi/tests/test_testutils.py
seidu626/vumi
199
11160750
<reponame>seidu626/vumi<filename>vumi/tests/test_testutils.py<gh_stars>100-1000 from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from twisted.web.client import Agent, readBody from vumi.tests.utils import LogCatcher, MockHttpServer from vumi import log from vumi.tests.helpers imp...
bindings/python/examples/composite_example.py
lucas-tortora/iota.rs
256
11160754
import os from urllib.request import urlopen as uReq from urllib.error import HTTPError import iota_client import sqlite3 def consolidation(): node_url = "https://api.thin-hornet-0.h.chrysalis-devnet.iota.cafe" client = iota_client.Client(nodes_name_password=[[node_url]]) seed = os.getenv('MY_IOTA_SEED')...
tests/basics/set_pop.py
learnforpractice/micropython-cpp
692
11160797
<gh_stars>100-1000 s = {1} print(s.pop()) try: print(s.pop(), "!!!") except KeyError: pass else: print("Failed to raise KeyError") # this tests an optimisation in mp_set_remove_first # N must not be equal to one of the values in hash_allocation_sizes N = 11 s = set(range(N)) while s: print(s.pop()) # l...
tensorflow_model_analysis/metrics/tf_metric_accumulators.py
jaymessina3/model-analysis
1,118
11160810
# Lint as: python3 # 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 agr...
ais/compatibility/__init__.py
andyvan-trabus/libais
161
11160815
<reponame>andyvan-trabus/libais import warnings warnings.warn( "The compatibility module is deprecated and will be removed in 1.0", FutureWarning, stacklevel=2 )
bmtk/analyzer/io_tools.py
aaberbach/bmtk
216
11160818
from six import string_types from bmtk.utils.sonata.config import SonataConfig as ConfigDict def load_config(config): if isinstance(config, string_types): return ConfigDict.from_json(config) elif isinstance(config, dict): return ConfigDict.from_dict(config) else: raise Exception('C...
perma_web/perma/tasks.py
fakegit/perma
317
11160823
import tempfile import traceback from collections import OrderedDict from contextlib import contextmanager from pyquery import PyQuery from http.client import CannotSendRequest from urllib.error import URLError import os import os.path import threading import time from datetime import timedelta import urllib.parse im...
tests/end_to_end_tests/trainer_test.py
Deci-AI/super-gradients
308
11160880
<reponame>Deci-AI/super-gradients<filename>tests/end_to_end_tests/trainer_test.py<gh_stars>100-1000 import shutil import unittest import super_gradients import torch import os from super_gradients import SgModel, ClassificationTestDatasetInterface from super_gradients.training.metrics import Accuracy, Top5 class Tes...
deepmath/deephol/prune_lib.py
LaudateCorpus1/deepmath
830
11160884
<gh_stars>100-1000 """Proof pruning library. The purpose of this library is to optimize proofs. Currently we minimize the number of tactic application parameters in oder to generate better training data (with minimum number of tactic parameters). """ from __future__ import absolute_import from __future__ import divis...
examples/model_compress/pruning/mobilenetv2_end2end/pretrain.py
dutxubo/nni
9,680
11160894
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import argparse from time import gmtime, strftime import torch import torch.nn as nn from torch.utils.data import DataLoader from tqdm import tqdm import numpy as np from utils import * device = torch.device("cuda" if torch.cuda.is_a...
tests/commands/test_account.py
ftupas/nile
121
11160929
<filename>tests/commands/test_account.py<gh_stars>100-1000 """Tests for account commands.""" from unittest.mock import MagicMock, patch import pytest from nile.core.account import Account KEY = "TEST_KEY" NETWORK = "goerli" MOCK_ADDRESS = "0x123" MOCK_INDEX = 0 @pytest.fixture(autouse=True) def tmp_working_dir(mon...
exercises/IPython Kernel/soln/mycircle.py
kaishuocheng/jupyter
748
11160939
<filename>exercises/IPython Kernel/soln/mycircle.py class MyCircle(object): def __init__(self, center=(0.0,0.0), radius=1.0, color='blue'): self.center = center self.radius = radius self.color = color def _repr_html_(self): return "&#x25CB; (<b>html</b>)" def _repr_svg_(se...
recipe_scrapers/settings/v12_settings.py
mathiazom/recipe-scrapers
811
11160966
<filename>recipe_scrapers/settings/v12_settings.py # Settings that will make recipe-scrapers>=13.0.0 act almost identical as recipe-scrapers<13.0.0 SUPPRESS_EXCEPTIONS = True META_HTTP_EQUIV = True ON_EXCEPTION_RETURN_VALUES = { "title": "", "total_time": 0, "yields": "", "image": "", "ingredients":...
torchio/datasets/itk_snap/__init__.py
siahuat0727/torchio
1,340
11160989
<reponame>siahuat0727/torchio from .itk_snap import BrainTumor, T1T2, AorticValve __all__ = [ 'BrainTumor', 'T1T2', 'AorticValve', ]
src/lib/dataset/datasets/youtube_vis.py
jie311/TraDeS
475
11161081
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pycocotools.coco as coco from pycocotools.cocoeval import COCOeval import numpy as np import json import os from collections import defaultdict from ..generic_dataset import GenericDataset class youtube...
api.py
soywod/iris
149
11161099
<gh_stars>100-1000 #!/usr/bin/env python3 import json import logging import os import quopri import re import smtplib import subprocess import sys import threading from base64 import b64decode from email import policy from email.header import Header, decode_header from email.mime.text import MIMEText from email.parse...
util/clevr_test/CLEVR_eval.py
YuJiang01/n2nnmn
299
11161116
from __future__ import print_function import argparse import json from collections import defaultdict import numpy as np parser = argparse.ArgumentParser() parser.add_argument('--questions_file', required=True) parser.add_argument('--answers_file', required=True) def main(args): # Load true answers from questions...
pyscf/pbc/dft/test/test_gamma_vs_ks.py
robert-anderson/pyscf
501
11161130
<gh_stars>100-1000 #!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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/license...
pyxb/bundles/opengis/gml_3_3/ce.py
eLBati/pyxb
123
11161151
<filename>pyxb/bundles/opengis/gml_3_3/ce.py from pyxb.bundles.opengis.gml_3_3.raw.ce import *
dictionary/urls/edit.py
ankitgc1/django-sozluk-master
248
11161161
from django.urls import path from dictionary.views.edit import CommentCreate, CommentUpdate, EntryCreate, EntryUpdate from dictionary.views.reporting import GeneralReportView urlpatterns_edit = [ path("entry/update/<int:pk>/", EntryUpdate.as_view(), name="entry_update"), path("entry/create/", EntryCreate.as_v...
fum/urls.py
jsavikko/futurice-ldap-user-manager
111
11161176
<gh_stars>100-1000 from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.template import add_to_builtins from django.contrib import admin admin.autodiscover() from views import IndexView urlpatterns = patterns('', url(r'^$', Ind...
library/oci_instance.py
slmjy/oci-ansible-modules
106
11161210
#!/usr/bin/python # Copyright (c) 2017, 2020, 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 ...
tests/test_tensor_api.py
tao-harald/geoopt
438
11161234
import geoopt import torch import pytest def test_allow_empty_parameter_compat(): p = geoopt.ManifoldParameter() assert p.shape == (0,) def test_compare_manifolds(): m1 = geoopt.Euclidean() m2 = geoopt.Euclidean(ndim=1) tensor = geoopt.ManifoldTensor(10, manifold=m1) with pytest.raises(Value...
kansha/card_addons/gallery/view.py
AnomalistDesignLLC/kansha
161
11161244
# -- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. # -- from nagare.i18n import _ from nagare import presentation, ajax, security, component from .comp...
jsonrpcserver/result.py
bcb/jsonrpcserver
144
11161265
"""Result data types - the results of calling a method. Results are the JSON-RPC response objects (https://www.jsonrpc.org/specification#response_object), minus the "jsonrpc" and "id" parts - the library takes care of these parts for you. The public functions are Success, Error and InvalidParams. """ from typing impo...
tkinter/entry-bind-key-release-to-select-text/example-1.py
whitmans-max/python-examples
140
11161287
#!/usr/bin/env python3 ''' Because after releasing keys `<Control-a>` selection is removed so I use `after()` to execute selection after 50ms. It selects all text (but it moves cursor to the beginning) and moves cursor to the end. ''' import tkinter as tk def callback(event): print('e.get():', e.get()) # or ...
aries_cloudagent/config/tests/test_default_context.py
kuraakhilesh8230/aries-cloudagent-python
247
11161293
<gh_stars>100-1000 from tempfile import NamedTemporaryFile from asynctest import TestCase as AsyncTestCase from ...cache.base import BaseCache from ...core.profile import ProfileManager from ...core.protocol_registry import ProtocolRegistry from ...transport.wire_format import BaseWireFormat from ..default_context i...
jython/travelingsalesman.py
theturpinator/randomized-optimization-ABAGAIL
235
11161323
<filename>jython/travelingsalesman.py # traveling salesman algorithm implementation in jython # This also prints the index of the points of the shortest route. # To make a plot of the route, write the points at these indexes # to a file and plot them in your favorite tool. import sys import os import time import java...
src/controller/python/chip/logging/__init__.py
summercms/connectedhomeip
3,495
11161332
# # Copyright (c) 2021 Project CHIP 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 applica...
fds/run.py
CyberFlameGO/fds
322
11161342
<filename>fds/run.py import enum from shutil import which import requests from pathlib import Path import sys from fds.domain.commands import Commands from fds.logger import Logger from fds.services.dvc_service import DVCService from fds.services.fds_service import FdsService from fds.services.types import InnerServic...
src/GridCal/Gui/GIS/gis_dialogue.py
mzy2240/GridCal
284
11161373
import sys import os from PySide2.QtWidgets import * from PySide2.QtWebEngineWidgets import QWebEngineView as QWebView, QWebEnginePage as QWebPage import folium from shutil import copyfile from GridCal.Gui.GIS.gui import * from GridCal.Engine.IO.file_system import get_create_gridcal_folder class GISWindow(QMainWindo...
code/load_strength_data.py
Apsu/engram
103
11161391
# Normalize by the highest peak force (middle finger): middle_force = 2.36 index_force = 2.26 ring_force = 2.02 little_force = 1.84 middle_norm = 1.0 index_norm = index_force / middle_force ring_norm = ring_force / middle_force little_norm = little_force / middle_force print('index/middle: {0}'.format(index_norm)) prin...
wsltools/utils/compat.py
Symbo1/wsltools
412
11161399
# -*- coding: utf-8 -*- import sys PY2 = sys.version_info.major == 2 if PY2: xrange = xrange text_type = unicode string_types = (str, unicode) from urllib import unquote, urlencode from urllib2 import urlopen, Request from urlparse import urlparse, parse_qsl, urlunparse else: xrange = range text_type = str ...
metrics/log_collectors/simple_log_collector/src/tail_to_tds.py
adrian555/FfDL
680
11161403
<filename>metrics/log_collectors/simple_log_collector/src/tail_to_tds.py #!/usr/bin/env python # # Copyright 2017-2018 IBM Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
sarenka/backend/api_searcher/migrations/0005_auto_20210105_0315.py
adolabsnet/sarenka
380
11161427
# Generated by Django 3.1.4 on 2021-01-05 02:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api_searcher', '0004_auto_20201220_1200'), ] operations = [ migrations.RemoveField( model_name='cvemodel', name='cwe', ...
plugins/measurer/util_algo.py
Kitware/VAIME
127
11161432
<reponame>Kitware/VAIME """ Functional implementations of common algorithms """ import numpy as np import scipy.optimize def minimum_weight_assignment(cost): """ Finds optimal assignment between two disjoint sets of items Args: cost (ndarray): cost[i, j] is the cost between items i and j Com...
sendgrid/helpers/mail/spam_url.py
modernwarfareuplink/sendgrid-python
1,268
11161438
class SpamUrl(object): """An Inbound Parse URL that you would like a copy of your email along with the spam report to be sent to.""" def __init__(self, spam_url=None): """Create a SpamUrl object :param spam_url: An Inbound Parse URL that you would like a copy of ...
Visualizations/model_fooling.py
arafin-lab/model_inversion_experiments
101
11161472
<gh_stars>100-1000 from graphviz import Digraph # MODEL FOOLING def fooling_attack(): fool_attack = Digraph('Fooling Attacks',graph_attr={'size':'8.5,11.5'},comment='Taxonomy of Secure Deep Learning', ) fool_attack #doctest: +ELLIPSIS # NODES: fool_attack.node('Fooling Attacks', r'{<f0> Fo...
zeus/migrations/f7c8c10f5aea_rethink_authors.py
conrad-kronos/zeus
221
11161477
"""rethink_authors Revision ID: <KEY> Revises: <PASSWORD> Create Date: 2017-07-14 13:20:01.610676 """ import zeus from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "<KEY>" down_revision = "<PASSWORD>" branch_labels = () depen...
tensorflow_probability/python/internal/test_util_scipy.py
m5l14i11/probability
3,670
11161481
<reponame>m5l14i11/probability<gh_stars>1000+ # Copyright 2021 The TensorFlow Probability 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/LICEN...
social/backends/flickr.py
raccoongang/python-social-auth
1,987
11161485
<reponame>raccoongang/python-social-auth<filename>social/backends/flickr.py from social_core.backends.flickr import FlickrOAuth
indy_node/test/request_handlers/rich_schema/test_rich_schema_handler.py
Rob-S/indy-node
627
11161486
import pytest from indy_common.constants import ENDORSER from indy_node.server.request_handlers.domain_req_handlers.rich_schema.rich_schema_handler import RichSchemaHandler from indy_node.test.request_handlers.helper import add_to_idr from indy_node.test.request_handlers.rich_schema.helper import rich_schema_request f...
gcloud/tests/apigw/views/test_get_user_project_detail.py
wkma/bk-sops
881
11161493
<filename>gcloud/tests/apigw/views/test_get_user_project_detail.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. L...
py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter_pytorch_full_runner.py
zhyon404/kubeflow
9,272
11161518
# This file is only intended for development purposes from kubeflow.kubeflow.cd import base_runner base_runner.main(component_name="notebook_servers.notebook_server_jupyter_pytorch_full", workflow_name="nb-j-pt-f-build")
bookwyrm/tests/models/test_group.py
mouse-reeve/fedireads
270
11161533
<filename>bookwyrm/tests/models/test_group.py """ testing models """ from unittest.mock import patch from django.test import TestCase from bookwyrm import models @patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async") class Group(TestCase): """some activitypub oddness ahead""" def setUp(self)...
homeassistant/components/fortios/__init__.py
domwillcode/home-assistant
30,023
11161536
"""Fortinet FortiOS components."""
starfish/core/morphology/Filter/reduce.py
haoxusci/starfish
164
11161575
<gh_stars>100-1000 from typing import Callable, Optional, Tuple, Union import numpy as np from starfish.core.morphology.binary_mask import BinaryMaskCollection from starfish.core.types import FunctionSource, FunctionSourceBundle from ._base import FilterAlgorithm class Reduce(FilterAlgorithm): """ Reduce ta...
tests/testapp3/apps.py
thebjorn/django_dramatiq
229
11161584
<reponame>thebjorn/django_dramatiq<gh_stars>100-1000 from django.apps import AppConfig class Testapp3Config(AppConfig): name = "tests.testapp3"
tools/mo/openvino/tools/mo/front/kaldi/extractors/mul_ext.py
ryanloney/openvino-1
1,127
11161594
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.mo.ops.elementwise import Mul from openvino.tools.mo.front.extractor import FrontExtractorOp class MulFrontExtractor(FrontExtractorOp): op = 'Mul' enabled = True @classmethod def extract(cls, node):...
tests/test_helpers/test_search/base.py
ejfitzgerald/agents-aea
126
11161622
<reponame>ejfitzgerald/agents-aea # -*- 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....
L1Trigger/CSCTrackFinder/test/csctfAnaData_cfg.py
ckamtsikis/cmssw
852
11161639
import FWCore.ParameterSet.Config as cms import sys print("Starting CSCTF Data Analyzer") process = cms.Process("CSCTFEFF") process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 1000 #********************************************************************************...
autolens/point/point_dataset.py
Jammy2211/AutoLens
114
11161652
import json import numpy as np import os from os import path from typing import List, Tuple, Dict, Optional, Union import autoarray as aa class PointDataset: def __init__( self, name: str, positions: Union[aa.Grid2DIrregular, List[List], List[Tuple]], positions_noise...
Packs/ReversingLabs_Titanium_Cloud/Integrations/ReversingLabsTitaniumCloudv2/ReversingLabsTitaniumCloudv2.py
diCagri/content
799
11161654
<reponame>diCagri/content<filename>Packs/ReversingLabs_Titanium_Cloud/Integrations/ReversingLabsTitaniumCloudv2/ReversingLabsTitaniumCloudv2.py from typing import Union import demistomock as demisto from CommonServerPython import * from ReversingLabs.SDK.ticloud import FileReputation, AVScanners, FileAnalysis, RHA1Func...
src/genie/libs/parser/iosxe/tests/ShowIpVrfDetail/cli/equal/golden_output3_expected.py
balmasea/genieparser
204
11161677
<filename>src/genie/libs/parser/iosxe/tests/ShowIpVrfDetail/cli/equal/golden_output3_expected.py expected_output = { "Mgmt-intf": { "vrf_id": 1, "cli_format": "New", "support_af": "multiple address-families", "flags": "0x1808", "interfaces": ["GigabitEthernet0"], "int...
tests/test_utils/test_make_divisible.py
wzpscott/SegformerDistillation
903
11161683
<gh_stars>100-1000 from mmseg.models.utils import make_divisible def test_make_divisible(): # test with min_value = None assert make_divisible(10, 4) == 12 assert make_divisible(9, 4) == 12 assert make_divisible(1, 4) == 4 # test with min_value = 8 assert make_divisible(10, 4, 8) == 12 as...
src/sage/libs/pynac/pynac.py
UCD4IDS/sage
1,742
11161696
from sage.misc.lazy_import import lazy_import lazy_import('sage.symbolic.expression', ['unpack_operands', 'paramset_from_Expression', 'get_ginac_serial', 'get_fn_serial', 'py_latex_variable_for_doctests', 'py_print_function_pystring', 'py_latex_function_pystring', 'tolerant_is_sym...
packages/scikit-learn/examples/plot_tsne.py
zmoon/scipy-lecture-notes
2,538
11161708
<filename>packages/scikit-learn/examples/plot_tsne.py """ ========================== tSNE to visualize digits ========================== Here we use :class:`sklearn.manifold.TSNE` to visualize the digits datasets. Indeed, the digits are vectors in a 8*8 = 64 dimensional space. We want to project them in 2D for visuali...
platform_tools/android/tests/ordered_set_tests.py
AsdMonio/rr-external_skia
5,964
11161724
<filename>platform_tools/android/tests/ordered_set_tests.py<gh_stars>1000+ #!/usr/bin/python # Copyright 2014 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Test OrderedSet. """ import sys import test_variables import unittest sys.path.append(...
src/naarad/metrics/innotop_metric.py
richardhsu/naarad
180
11161786
<reponame>richardhsu/naarad # coding=utf-8 """ Copyright 2013 LinkedIn Corp. 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 Unl...
src/oncall/api/v0/ical_key.py
lukdz/oncall
857
11161788
<filename>src/oncall/api/v0/ical_key.py # Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license. # See LICENSE in the project root for license information. import uuid from ... import db def generate_ical_key(): return str(uuid.uuid4()) def check_ical_team(team, requ...
ckan/migration/versions/032_d89e0731422d_add_extra_info_field_to_resources.py
ziveo/ckan
2,805
11161827
<filename>ckan/migration/versions/032_d89e0731422d_add_extra_info_field_to_resources.py # encoding: utf-8 """032 Add extra info field_to_resources Revision ID: d89e0731422d Revises: <KEY>6 Create Date: 2018-09-04 18:49:00.003141 """ from alembic import op import sqlalchemy as sa from ckan.migration import skip_based_...
reviewboard/reviews/models/general_comment.py
amalik2/reviewboard
921
11161837
from __future__ import unicode_literals from reviewboard.reviews.models.base_comment import BaseComment from django.utils.translation import ugettext_lazy as _ class GeneralComment(BaseComment): """A comment on a review request that is not tied to any code or file. A general comment on a review request is ...
agents/simple-trpo/simple_trpo/vectorized_env.py
yangalexandery/rl-teacher
463
11161840
<filename>agents/simple-trpo/simple_trpo/vectorized_env.py<gh_stars>100-1000 import numpy as np from multiprocessing import Process, Pipe import cloudpickle def env_worker(remote, env_fn_wrapper): env = env_fn_wrapper.x() while True: cmd, data = remote.recv() if cmd == 'step': ob, r...
CodeGenX64/regs.py
robertmuth/Cwerg
171
11161867
from Base import ir from Base import opcode_tab as o from Base import reg_alloc from Base import liveness from Base import serialize import enum import dataclasses from typing import List, Optional, Tuple # This must mimic the DK enum (0: invalid, no more than 255 entries) @enum.unique class CpuRegKind(enum.Enum): ...
migrations/versions/3bef10ab5088_add_various_testgrou.py
vault-the/changes
443
11161879
<filename>migrations/versions/3bef10ab5088_add_various_testgrou.py """Add various TestGroup indexes Revision ID: 3bef10ab5088 Revises: fd1a<PASSWORD> Create Date: 2013-11-04 17:10:52.057285 """ # revision identifiers, used by Alembic. revision = '3bef10ab5088' down_revision = '<PASSWORD>' from alembic import op d...
tools/freq_gen/freq_gen.py
wizard97/iSkipper
150
11161904
#! /usr/bin/env python3 import subprocess import os import argparse tool_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) decoder_tool = os.path.join(tool_dir, 'spi_decoder', 'spidecode.py') fifo_marker = 'FIFO ================== FIFO' def target_prefix(addr): return 'W\t' + addr + '\t0x' targ...
osp/citations/models/citation_index.py
davidmcclure/open-syllabus-project
220
11161907
<gh_stars>100-1000 import random import numpy as np import us import iso3166 from osp.common import config from osp.common.utils import query_bar from osp.common.mixins.elasticsearch import Elasticsearch from osp.citations.models import Text, Citation from scipy.stats import rankdata from clint.textui import progre...
afctl/tests/deployment_tests/test_local_deployment.py
hafixo/afctl
131
11161921
<reponame>hafixo/afctl from afctl.plugins.deployments.docker.deployment_config import DockerDeploymentConfig from afctl.tests.utils import clean_up, PROJECT_NAME, PROJECT_CONFIG_DIR import pytest import os, subprocess class TestLocalDeployment: @pytest.fixture(scope='function') def create_project(self): ...
dirty_equals/_strings.py
mattkram/dirty-equals
386
11161979
import re from typing import Any, Optional, Pattern, Tuple, Type, TypeVar, Union from ._base import DirtyEquals from ._utils import Omit, plain_repr try: from typing import Literal except ImportError: from typing_extensions import Literal # type: ignore[misc] T = TypeVar('T', str, bytes) __all__ = 'IsStr',...
zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py
dimisjim/python-zulip-api
351
11162018
from typing import Any, List, Tuple from zulip_bots.game_handler import GameInstance from zulip_bots.test_lib import BotTestCase, DefaultTests class TestTicTacToeBot(BotTestCase, DefaultTests): bot_name = "tictactoe" # FIXME: Add tests for computer moves # FIXME: Add test lib for game_handler # Tes...
src/genie/libs/parser/iosxe/tests/ShowIpv6RaGuardPolicy/cli/equal/golden_output_expected.py
balmasea/genieparser
204
11162074
<reponame>balmasea/genieparser<filename>src/genie/libs/parser/iosxe/tests/ShowIpv6RaGuardPolicy/cli/equal/golden_output_expected.py expected_output = { "configuration": { "trusted_port": "yes", "device_role": "router", "min_hop_limit": 1, "max_hop_limit": 3, "managed_config_f...
skills_ml/algorithms/job_normalizers/__init__.py
bhagyaramgpo/skills-ml
147
11162082
"""Algorithms to normalize a job title to a smaller space"""
objectModel/Python/cdm/persistence/syms/types/constant_entity.py
rt112000/CDM
884
11162083
# 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 Union, List from cdm.utilities import JObject from .entity_reference import EntityReference class ConstantEntity(JObject): def __init__(...
55.二叉树的深度/55.二叉树的深度.py
shenweichen/coding_interviews
483
11162147
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def TreeDepth(self, pRoot): # write code here if pRoot is None: return 0 self.depth = 1 def preOrder(root,de...
piGAN_lib/inverse_render.py
zihangJiang/CIPS-3D
308
11162173
import argparse import math import os from torchvision.utils import save_image import torch import numpy as np from PIL import Image from tqdm import tqdm import numpy as np import skvideo.io import curriculums from torchvision import transforms def tensor_to_PIL(img): img = img.squeeze() * 0.5 + 0.5 return ...
data/tracking/methods/SiamFC/builders/source.py
zhangzhengde0225/SwinTrack
143
11162198
<filename>data/tracking/methods/SiamFC/builders/source.py from core.run.event_dispatcher.register import EventRegister from data.tracking.methods._common.builders.build_dataloader import build_dataloader from .components.dataset import build_siamfc_dataset from .components.data_processor import build_siamfc_tracker_dat...
etna/transforms/timestamp/__init__.py
Pacman1984/etna
326
11162210
<reponame>Pacman1984/etna<gh_stars>100-1000 from etna.transforms.timestamp.date_flags import DateFlagsTransform from etna.transforms.timestamp.fourier import FourierTransform from etna.transforms.timestamp.holiday import HolidayTransform from etna.transforms.timestamp.special_days import SpecialDaysTransform from etna....
google_or_tools/nonogram_pbn_light.py
Wikunia/hakank
279
11162230
# webpbn.com Puzzle #803: You light up my life # Copyright 2007 by <NAME> # rows = 45 row_rule_len = 4 row_rules = [ [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 3], [0, 0, 2, 2], [0, 0, 1, 1], [0, 0, 0, 7], [0, 0, 1, 1], [0, 1, 3, 1], [0, 1, 3, 1], [0, 0, 1, 1], [...
dataflows/helpers/datapackage_processor.py
cschloer/dataflows
160
11162239
from .. import DataStreamProcessor, PackageWrapper class datapackage_processor(DataStreamProcessor): def __init__(self, dp_processor_func): super(datapackage_processor, self).__init__() self.func = dp_processor_func self.dp = None self.dp_processor = None def process_datapack...
kolibri/core/content/test/sqlalchemytesting.py
MBKayro/kolibri
545
11162242
from sqlalchemy import create_engine from kolibri.core.content.utils.sqlalchemybridge import get_default_db_string from kolibri.core.content.utils.sqlalchemybridge import SharingPool def django_connection_engine(): if get_default_db_string().startswith("sqlite"): return create_engine( get_def...
docs/qa_formats.py
skiran252/FARM
1,551
11162256
#################################### ###### JSON (REST API) FORMAT ###### #################################### # INPUT input = [{"questions": ["What is X?"], "text": "Some context containing the answer"}] # OUTPUT output= { "task": "qa", "predictions": [ { "question": question, ...
pydis_site/apps/resources/urls.py
doublevcodes/pysite
700
11162266
import typing from pathlib import Path from django_distill import distill_path from pydis_site.apps.resources import views app_name = "resources" def get_all_resources() -> typing.Iterator[dict[str, str]]: """Yield a dict of all resource categories.""" for category in Path("pydis_site", "apps", "resources"...
newsplease/pipeline/extractor/comparer/comparer_author.py
FrontFin/news-please
1,311
11162317
<reponame>FrontFin/news-please class ComparerAuthor(): """This class compares the titles of the list of ArticleCandidates and sends the result back to the Comparer.""" def extract(self, item, list_article_candidate): """Compares the extracted authors. :param item: The corresponding Newscrawler...
pysaliency/generics.py
Adrian398/pysaliency
118
11162321
from __future__ import absolute_import, print_function, division, unicode_literals import time import math import sys import os, errno def makedirs(dirname): """Creates the directories for dirname via os.makedirs, but does not raise an exception if the directory already exists and passes if dirname="".""" ...
tests/core/test_tiling.py
CNES/cars
134
11162382
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2020 Centre National d'Etudes Spatiales (CNES). # # This file is part of CARS # (see https://github.com/CNES/cars). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obta...
chainermn/extensions/_multi_node_snapshot.py
zjzh/chainer
3,705
11162402
<reponame>zjzh/chainer import io from chainer.serializers import load_npz from chainer.serializers import save_npz from chainer.training.extension import Extension from chainer.training.extensions._snapshot import _find_latest_snapshot def multi_node_snapshot(comm, snapshot, replica_sets): '''Create trainer exte...