max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
docs/components_page/components/navbar/navbar.py | glsdown/dash-bootstrap-components | 776 | 1613013 | <gh_stars>100-1000
import dash_bootstrap_components as dbc
from dash import Input, Output, State, html
from dash_bootstrap_components._components.Container import Container
PLOTLY_LOGO = "https://images.plot.ly/logo/new-branding/plotly-logomark.png"
search_bar = dbc.Row(
[
dbc.Col(dbc.Input(type="search",... | 0 | 0 | 0 | 0 | 0 | 0 |
python/swap-case.py | gajubadge11/HackerRank-1 | 340 | 1613041 | def swap_case(s) -> object:
out = ''
for ind, let in enumerate(s):
if let.isalpha():
if let.islower():
out += s[ind].capitalize()
else:
out += s[ind].lower()
else:
out += let
return out | 0 | 1 | 0 | 0 | 1 | 0 |
tools/mo/openvino/tools/mo/ops/shufflechannel.py | ryanloney/openvino-1 | 1,127 | 1613058 | <filename>tools/mo/openvino/tools/mo/ops/shufflechannel.py
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.graph.graph import Graph, Node
from openvino.tools.mo.ops.op import Op
class ShuffleChannels(Op):
op = 'ShuffleChannels'
enabled = False
def... | 0 | 0 | 0 | 0 | 0 | 0 |
treenode/forms.py | cperrin88/django-treenode | 259 | 1613067 | # -*- coding: utf-8 -*-
from django import forms
from .utils import split_pks
class TreeNodeForm(forms.ModelForm):
def __init__(self, *args, **kwargs) -> None:
super(TreeNodeForm, self).__init__(*args, **kwargs)
if 'tn_parent' not in self.fields:
return
exclude_pks = []
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/build/skia_gold_common/unittest_utils.py | Mr-Sheep/naiveproxy | 575 | 1613068 | <gh_stars>100-1000
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility methods for Skia Gold functionality unittests."""
import collections
_SkiaGoldArgs = collections.namedtuple('_SkiaGoldArgs', [... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/module/cpyext/eval.py | m4sterchain/mesapy | 381 | 1613076 | from __future__ import annotations
from pypy.interpreter.error import oefmt
from pypy.interpreter.astcompiler import consts
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.rarithmetic import widen
from pypy.module.cpyext.api import (
cpyt... | 1 | 18 | 0 | 0 | 19 | 0 |
modal/node_modules/accessibility-developer-tools/lib/closure-library/closure/bin/labs/code/generate_jsdoc.py | maze-runnar/modal-component | 575 | 1613089 | <reponame>maze-runnar/modal-component
#!/usr/bin/env python
#
# Copyright 2013 The Closure Library 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:... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/src/programy/config/file/xml_file.py | cotobadesign/cotoba-agent-oss | 104 | 1613146 | from __future__ import annotations
"""
Copyright (c) 2020 COTOBA DESIGN, 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, c... | 11 | 12 | 0 | 1 | 24 | 0 |
sdk/python/pulumi_gcp/diagflow/entity_type.py | sisisin/pulumi-gcp | 121 | 1613188 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 51 | 18 | 0 | 0 | 69 | 0 |
test_settings.py | sleepyjames/djangae | 467 | 1613198 | import os
from django.urls import (
include,
path,
)
BASE_DIR = os.path.dirname(__file__)
STATIC_URL = "/static/"
TEST_RUNNER = "djangae.test.AppEngineDiscoverRunner"
# Set the cache during tests to local memory, which is threadsafe
# then our TestCase clears the cache in setUp()
CACHES = {
'default': {... | 0 | 0 | 0 | 0 | 0 | 0 |
gengine/app/jsscripts/__init__.py | greck2908/gamification-engine | 347 | 1613215 | <reponame>greck2908/gamification-engine<gh_stars>100-1000
import sys
import os
import json
from gengine.base.settings import get_settings
from gengine.base.util import lstrip_word
from pyramid.settings import asbool
def includeme(config):
config.add_static_view(name='admin/jsstatic', path='gengine:app/jsscripts/b... | 0 | 0 | 0 | 0 | 0 | 0 |
monodepth/monodepth2_model.py | iamreallyi9/cd | 1,205 | 1613216 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
from os.path import join as pjoin
import torch
from utils.url_helpers import get_model_from_url
from .depth_model import DepthModel
from .monodepth2.networks.resnet_encoder import ResnetEncoder
from .monodepth2.networks.depth_decoder import D... | 0 | 2 | 3 | 0 | 5 | 0 |
symposion/speakers/migrations/0001_initial.py | azkarmoulana/pycon | 154 | 1613217 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies: list[object] = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations... | 0 | 0 | 2 | 0 | 2 | 0 |
applications/nauta-docs/app/tools/generate_index.py | nparkstar/nauta | 390 | 1613228 | #!/usr/bin/python
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 0 | 4 | 1 | 1 | 6 | 0 |
tests/m_test_matrixnet_api.py | HolyBayes/rep | 726 | 1613233 | from __future__ import division, print_function, absolute_import
import os
from time import time, sleep
from tempfile import mkstemp
from nose.tools import raises
import unittest
import json
from rep.estimators._mnkit import MatrixNetClient
from rep.estimators import MatrixNetClassifier, MatrixNetRegressor
from rep.te... | 0 | 0 | 1 | 0 | 1 | 0 |
plugins/quetz_mamba_solve/quetz_mamba_solve/rest_models.py | maresb/quetz | 108 | 1613253 | <gh_stars>100-1000
from typing import List
from pydantic import BaseModel
class SolveTask(BaseModel):
channels: List[str]
subdir: str
spec: List[str]
| 0 | 0 | 0 | 0 | 0 | 0 |
endpoints/test/test_building.py | giuseppe/quay | 2,027 | 1613255 | import pytest
from data import model
from buildtrigger.triggerutil import raise_if_skipped_build, SkipRequestException
from endpoints.building import (
start_build,
PreparedBuild,
MaximumBuildsQueuedException,
BuildTriggerDisabledException,
)
from test.fixtures import *
def test_maximum_builds(app):... | 0 | 0 | 0 | 0 | 0 | 0 |
100-200q/145.py | rampup01/Leetcode | 990 | 1613269 | from __future__ import annotations
'''
Given a binary tree, return the postorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [3,2,1]
Follow up: Recursive solution is trivial, could you do it iteratively?
'''
# Definition for a binary tree node.
# class... | 0 | 3 | 0 | 0 | 3 | 0 |
python/ray/util/collective/tests/distributed_multigpu_tests/test_distributed_multigpu_broadcast.py | 77loopin/ray | 21,382 | 1613371 | """Test the broadcast API."""
import pytest
import cupy as cp
import ray
from ray.util.collective.tests.util import create_collective_multigpu_workers
@pytest.mark.parametrize("group_name", ["default", "test", "123?34!"])
@pytest.mark.parametrize("src_rank", [0, 1])
@pytest.mark.parametrize("src_gpu_index", [0, 1])
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/guess-the-name-of-track/spotify/apps.py | Harshalszz/-HACKTOBERFEST2K20 | 256 | 1613385 | <reponame>Harshalszz/-HACKTOBERFEST2K20
from django.apps import AppConfig
class SpotifyConfig(AppConfig):
name = 'spotify'
| 0 | 0 | 0 | 0 | 0 | 0 |
etl/parsers/etw/Microsoft_Windows_WHEA_Logger.py | IMULMUL/etl-parser | 104 | 1613398 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-WHEA-Logger
GUID : c26c4f3c-3f66-4e99-8f8a-39405cfed220
"""
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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/maze_escape_sat.py | AlohaChina/or-tools | 8,273 | 1613406 | <filename>examples/python/maze_escape_sat.py
#!/usr/bin/env python3
# Copyright 2010-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
#
# http://www.apache.org/licenses/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/catapult/dashboard/dashboard/pinpoint/handlers/stats_test.py | zipated/src | 2,151 | 1613407 | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import unittest
import webapp2
import webtest
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from dashboard.pin... | 0 | 0 | 0 | 0 | 0 | 0 |
webrecorder/test/test_cdxj_cache.py | ssteo/webrecorder | 1,217 | 1613411 | <filename>webrecorder/test/test_cdxj_cache.py<gh_stars>1000+
from .testutils import FullStackTests
import time
import os
from pywb.utils.loaders import load as load_test
from webrecorder.models import User, Collection, Recording
from webrecorder.models.base import BaseAccess
from mock import patch
from itertools imp... | 0 | 0 | 0 | 0 | 0 | 0 |
i2c/oled_i2c/img_to_array.py | winston-choe/test | 1,160 | 1613415 | #!/usr/bin/env python3
# Converts a grayscale image into a format able to be
# displayed by the SSD1306 driver in horizontal addressing mode
# usage: python3 img_to_array.py <logo.bmp>
# depends on the Pillow library
# `python3 -m pip install --upgrade Pillow`
from PIL import Image
import sys
from pathlib import Pa... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/MultilevelMonteCarloApplication/external_libraries/PyCOMPSs/exaqute/local/consts.py | lkusch/Kratos | 778 | 1613423 | <gh_stars>100-1000
IN = "in"
INOUT = "inout"
FILE_IN = "filein"
FILE_OUT = "fileout"
FILE_INOUT = "fileinout"
COLLECTION_IN = "collection_in"
COLLECTION_INOUT = "collection_inout"
COLLECTION_OUT = "collection_out"
# Aliases for parameter definition as dictionary
Type = "type" # parameter type
# available at PyCOMPS... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/regression/classes/module_run.py | noahsherrill/force-riscv | 111 | 1613424 | <gh_stars>100-1000
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
pytoshop/tagged_block.py | andrewvaliente/pytoshop | 106 | 1613449 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
`TaggedBlock` objects.
"""
from __future__ import unicode_literals, absolute_import
import six
from . import docs
from . import enums
from . import path
from . import util
from typing import Any, BinaryIO, Dict, Optional, Set, TYPE_CHECKING, Union... | 17 | 37 | 11 | 0 | 65 | 0 |
problems/tests/test_two_characters.py | vinta/fuck-coding-interviews | 590 | 1613480 | # coding: utf-8
import unittest
from problems.two_characters import alternate
class TestCase(unittest.TestCase):
def test(self):
test_data = [
{'s': 'beabeefeab', 'expected': 5},
{'s': 'asdcbsdcagfsdbgdfanfghbsfdab', 'expected': 8},
{'s': 'asvkugfiugsalddlasguifgukvsa'... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/benchmark.py | tangle-org/qcgpu | 249 | 1613483 | <reponame>tangle-org/qcgpu<filename>benchmark/benchmark.py
import click
import time
import random
import statistics
import csv
import os.path
import math
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit.wrapper import load_qasm_file
from qiskit import QISKitError, execute, Aer
from pr... | 0 | 0 | 0 | 0 | 0 | 0 |
FC_Functions/fc_functions.py | sagarsaliya/code_snippets | 9,588 | 1613484 | <filename>FC_Functions/fc_functions.py<gh_stars>1000+
def html_tag(tag):
def wrap_text(msg):
print('<{0}>{1}</{0}>'.format(tag, msg))
return wrap_text
print_h1 = html_tag('h1')
print_h1('Test Headline!')
print_h1('Another Headline!')
print_p = html_tag('p')
print_p('Test Paragraph!')
| 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_decision_forests/tensorflow/utils.bzl | Saduf2019/decision-forests | 412 | 1613509 | <gh_stars>100-1000
"""Utilities for the compilation of tensorflow code."""
load("@org_tensorflow//tensorflow:tensorflow.bzl", "check_deps", "tf_binary_additional_srcs", "tf_cc_shared_object", "tf_copts", "tf_custom_op_library_additional_deps")
def _make_search_paths(prefix, search_level):
return "-rpath,%s/%s/ext... | 0 | 0 | 0 | 0 | 0 | 0 |
pymatgen/ext/tests/test_optimade.py | jsyony37/pymatgen | 921 | 1613520 | <filename>pymatgen/ext/tests/test_optimade.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from pymatgen.util.testing import PymatgenTest
from pymatgen.ext.optimade import OptimadeRester
class OptimadeTest(PymatgenTest):
def test_get_structures_mp(s... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_packages/test_skills/test_tac_participation/test_game.py | bryanchriswhite/agents-aea | 126 | 1613530 | # -*- 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 may obtain a copy of the ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/piped-work/get_gui_structure.py | joshrose/audacity | 7,892 | 1613549 | # get-gui-structure.py
# Obtains all menus and all box locations from the currently running Audacity.
# This is useful for wit.audacityteam.org, where we need these lists when we
# draw the menus and create the image maps.
# Make sure Audacity is running first and that mod-script-pipe is enabled
# before running this ... | 0 | 2 | 0 | 0 | 2 | 0 |
ltr/clickmodels/coec.py | tanjie123/hello-ltr | 109 | 1613561 | <gh_stars>100-1000
from collections import Counter
class Model():
def __init__(self):
# COEC statistic
self.coecs = Counter()
# CTR for each query-doc pair in this session
self.ctrs = {}
def coec(ctr_by_rank, sessions):
""" Clicks over expected clicks is a metric
used ... | 0 | 0 | 0 | 0 | 0 | 0 |
sciwx/demo/canvas5_frame_demo.py | dada1437903138/imagepy | 1,178 | 1613564 | import sys
sys.path.append('../../')
from skimage.data import astronaut, camera
from sciwx.canvas import CanvasFrame, CanvasNoteFrame
import wx
def canvas_frame_test():
cf = CanvasFrame(None, autofit=True)
cf.set_imgs([camera(), 255-camera()])
cf.Show()
def canvas_note_test():
cnf = CanvasNoteFrame(N... | 0 | 0 | 0 | 0 | 0 | 0 |
util/timedeltastring.py | giuseppe/quay | 2,027 | 1613582 | from datetime import timedelta
def convert_to_timedelta(time_val) -> object:
"""
From: code.activestate.com/recipes/577894-convert-strings-like-5d-and-60s-to-timedelta-objec
Given a *time_val* (string) such as '5d', returns a timedelta object
representing the given value (e.g. timedelta(days=5)). Ac... | 0 | 1 | 0 | 0 | 1 | 0 |
sym_visitor.py | solacol/seninja | 109 | 1613588 | from binaryninja import (
BinaryReader, BinaryWriter,
RegisterValueType, enums
)
from .sym_state import State
from .arch.arch_x86 import x86Arch
from .arch.arch_x86_64 import x8664Arch
from .arch.arch_armv7 import ArmV7Arch
from .models.function_models import library_functions
from .utility.expr_wrap_util impor... | 0 | 60 | 0 | 0 | 60 | 0 |
keystone/common/sql/expand_repo/versions/036_expand_rename_application_credential_restriction_column.py | ferag/keystone | 615 | 1613593 | <reponame>ferag/keystone
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 0 | 0 | 0 | 0 | 0 | 0 |
tinkertest/test_cmdline.py | Thomas1601/tinkerer | 189 | 1613613 | '''
Command Line Test
~~~~~~~~~~~~~~~~~
Tests Tinkerer command line (setup, post, page and build)
:copyright: Copyright 2011-2018 by <NAME> and contributors (see
CONTRIBUTORS file)
:license: FreeBSD, see LICENSE file
'''
import datetime
import logging
import os
from io import StringIO
import t... | 0 | 0 | 0 | 0 | 0 | 0 |
python_packages/jupyter_lsp/jupyter_lsp/trait_types.py | icankeep/jupyterlab-lsp | 1,117 | 1613617 | import six
import traitlets
class Schema(traitlets.Any):
"""any... but validated by a jsonschema.Validator"""
_validator: None = None
def __init__(self, validator, *args, **kwargs):
super().__init__(*args, **kwargs)
self._validator = validator
def validate(self, obj, value) -> objec... | 0 | 2 | 2 | 0 | 4 | 0 |
carball/analysis/utils/split_location.py | unitedroguegg/carball | 119 | 1613643 | <reponame>unitedroguegg/carball
import numpy as np
STANDARD_SIZE = np.array([4096 * 2, 5120 * 2, 2044])
STANDARD_MIN_VALUES = np.array([-4096, -5120, 0])
STANDARD_MAX_VALUES = np.array([4096, 5120, 2000])
class LocationSplitManager:
def __init__(self, num_layers, layer_grid_sizes, min_values, max_values):
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ray/train/examples/tensorflow_linear_dataset_example.py | goswamig/amazon-ray | 21,382 | 1613669 | from __future__ import annotations
import argparse
import tensorflow as tf
from tensorflow.keras.callbacks import Callback
import ray
import ray.train as train
from ray.data import Dataset
from ray.data.dataset_pipeline import DatasetPipeline
from ray.train import Trainer
class TrainReportCallback(Callback):
de... | 7 | 6 | 0 | 0 | 13 | 0 |
third_party/google-endpoints/apitools/base/py/transfer_test.py | tingshao/catapult | 2,151 | 1613671 | <reponame>tingshao/catapult<gh_stars>1000+
#
# Copyright 2015 Google 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
models/neck/fpn_neck.py | ZHANGHeng19931123/MutualGuide | 124 | 1613677 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.base_blocks import BasicConv
class CEM(nn.Module):
"""Context Enhancement Module"""
def __init__(self, channels, fea_channel):
super(CEM, self).__init_... | 0 | 0 | 0 | 0 | 0 | 0 |
315 Count of Smaller Numbers After Self.py | ChiFire/legend_LeetCode | 872 | 1613695 | <gh_stars>100-1000
"""
You are given an integer array nums and you have to return a new counts array. The counts array has the property where
counts[i] is the number of smaller elements to the right of nums[i].
Example:
Given nums = [5, 2, 6, 1]
To the right of 5 there are 2 smaller elements (2 and 1).
To the right ... | 0 | 0 | 0 | 0 | 0 | 0 |
calamari_ocr/test/test_resume_training.py | jacektl/calamari | 922 | 1613715 | import os
import tempfile
import unittest
from tensorflow import keras
import calamari_ocr.scripts.resume_training as resume_training
import calamari_ocr.scripts.train as train
from calamari_ocr.test.test_train_file import uw3_trainer_params
this_dir = os.path.dirname(os.path.realpath(__file__))
class TestTrainFil... | 0 | 1 | 0 | 0 | 1 | 0 |
aat/core/order_book/cpp.py | mthomascarcamo/aat | 305 | 1613718 | <reponame>mthomascarcamo/aat
from typing import Callable
from aat.common import _in_cpp
from aat.core import ExchangeType, Instrument
try:
from aat.binding import OrderBookCpp # type: ignore
from aat.binding import _CollectorCpp # type: ignore
from aat.binding import _PriceLevelCpp # type: ignore
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/tvm/relay/backend/contrib/ethosu/tir/binary_elementwise.py | cli99/tvm | 2,084 | 1613728 | # 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"); you may not u... | 4 | 2 | 0 | 0 | 6 | 0 |
src/tests/catwalk_tests/test_storage.py | josephbajor/triage_NN | 160 | 1613737 | import datetime
import os
import tempfile
from collections import OrderedDict
import boto3
import pandas as pd
import pytest
import yaml
from moto import mock_s3
from numpy.testing import assert_almost_equal
from pandas.testing import assert_frame_equal
from unittest import mock
from triage.component.catwalk.storage ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowL2vpnEvpnMacSummary/cli/equal/golden_test_1_bridge-domain_all_expected.py | balmasea/genieparser | 204 | 1613746 | # Copyright (c) 2021 by Cisco Systems, Inc.
# All rights reserved.
expected_output = {
'evi': {
1: {
'bd_id': {
11: {
'eth_tag': {
0: {
'remote_count': 4,
'local_count': 6,
... | 0 | 0 | 0 | 0 | 0 | 0 |
poium/common/exceptions.py | yaoJeffer/poium | 174 | 1613752 | <reponame>yaoJeffer/poium
"""
Exceptions that may happen in all the poium code.
"""
class PoiumException(Exception):
"""
Base poium exception.
"""
def __init__(self, msg=None, screen=None, stacktrace=None):
self.msg = msg
self.screen = screen
self.stacktrace = stacktrace
... | 0 | 0 | 0 | 0 | 0 | 0 |
build_fmucontainer.py | CSchulzeTLK/FMPy | 225 | 1613758 | import shutil
from fmpy import platform, sharedLibraryExtension
import os
from subprocess import check_call
if os.name == 'nt':
generators = [
('win32', 'Visual Studio 15 2017'),
('win64', 'Visual Studio 15 2017 Win64')
]
else:
generators = [(platform, 'Unix Makefiles')]
for p, generator... | 0 | 0 | 0 | 0 | 0 | 0 |
packs/email/actions/send_email.py | userlocalhost2000/st2contrib | 164 | 1613759 | <filename>packs/email/actions/send_email.py
from st2actions.runners.pythonrunner import Action
from smtplib import SMTP
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class SendEmail(Action):
def run(self, email_from, email_to, subject, message, account):
accounts = se... | 0 | 0 | 0 | 0 | 0 | 0 |
nautobot/extras/datasources/registry.py | psmware-ltd/nautobot | 384 | 1613781 | """Registry-related APIs for datasources."""
from nautobot.extras.choices import JobResultStatusChoices, LogLevelChoices
from nautobot.extras.context_managers import change_logging
from nautobot.extras.registry import registry
def get_datasource_contents(model_name) -> object:
"""Get the list of DatasourceConten... | 2 | 2 | 0 | 0 | 4 | 0 |
pathy/s3.py | odidev/pathy | 107 | 1613783 | from dataclasses import dataclass
from typing import Any, Dict, Generator, List, Optional
try:
import boto3 # type:ignore
from botocore.client import ClientError
from botocore.exceptions import ParamValidationError
S3NativeClient = Any
S3NativeBucket = Any
except (ImportError, ModuleNotFoundError... | 26 | 21 | 18 | 0 | 65 | 0 |
alipay/aop/api/domain/AlipayDataDataserviceAdPromotepageDownloadModel.py | antopen/alipay-sdk-python-all | 213 | 1613784 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayDataDataserviceAdPromotepageDownloadModel(object):
def __init__(self):
self._biz_token = None
self._end_date = None
self._page_no = None
s... | 0 | 0 | 0 | 0 | 0 | 0 |
openmc/model/funcs.py | ameliajo/openmc | 262 | 1613786 | from __future__ import annotations
from collections.abc import Iterable
from functools import partial
from math import sqrt
from numbers import Real
from operator import attrgetter
from warnings import warn
from openmc import (
XPlane, YPlane, Plane, ZCylinder, Cylinder, XCylinder,
YCylinder, Universe, Cell)
f... | 16 | 8 | 0 | 0 | 24 | 0 |
examples/general-spider/general/settings.py | buildfail/frontera | 1,267 | 1613825 | <reponame>buildfail/frontera<filename>examples/general-spider/general/settings.py<gh_stars>1000+
# -*- coding: utf-8 -*-
BOT_NAME = 'general'
SPIDER_MODULES = ['general.spiders']
NEWSPIDER_MODULE = 'general.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
USER_AGENT = 'Fronter... | 0 | 0 | 0 | 0 | 0 | 0 |
grin-py/utils/get_rigdata.py | f6380154/grin-pool | 130 | 1613864 | #!/usr/bin/python3
import json
import sys
import os
import redis
import pickle
block = sys.argv[1]
user = sys.argv[2]
r = redis.Redis(
host='172.16.17.32',
# host='redis-master',
# No username
# No password
)
redis_key = "rigdata.{}.{}".format(block, user)
if r.exists(redis_key)... | 0 | 0 | 0 | 0 | 0 | 0 |
WebCrawler/dlsite.py | yoshiko2/Movie_Data_Capture | 562 | 1613867 | <gh_stars>100-1000
import re
from lxml import etree
import json
import sys
sys.path.append('../')
from ADC_function import *
def getTitle(html):
result = str(html.xpath('/html/head/title/text()')[0])
result = result[:result.rfind(' | DLsite')]
result = result[:result.rfind(' [')]
result = result.replac... | 0 | 0 | 0 | 0 | 0 | 0 |
challenges/CML/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 1613881 | <reponame>pingjuiliao/cb-multios<gh_stars>100-1000
#!/usr/bin/env python
from generator.actions import Actions
import random
import struct
class Node(object):
def __init__(self, tag, parent):
self.tag = tag
self.ns = None
self.attr = {}
self.children = []
self.cml = False
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/settings.py | yihuang/django-import-export | 132 | 1613916 | import os
import sys
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'import_export',
'core',
]
SITE_ID = 1
ROOT_URLCONF = "urls"
DEBUG = True
STATIC_URL ... | 0 | 0 | 0 | 0 | 0 | 0 |
objectModel/Python/tests/storage/test_syms.py | rt112000/CDM | 884 | 1613960 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import datetime
from datetime import timezone
import time
import json
import unittest
import os
from tests.common import async_test, TestHelper
from tests.syms_tes... | 18 | 1 | 5 | 0 | 24 | 0 |
aliyun-python-sdk-ecs/aliyunsdkecs/request/v20140526/ModifySecurityGroupRuleRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 1613981 | # 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"); you may not u... | 0 | 21 | 0 | 0 | 21 | 0 |
visda_classification/taskcv_loader.py | LittleWat/MCD_DA | 464 | 1614013 | import random
import torch.utils.data
import torchvision.transforms as transforms
#import torchnet as tnt
# pip install future --upgrade
from builtins import object
from pdb import set_trace as st
import torch.utils.data as data_utils
class PairedData(object):
def __init__(self, data_loader_A, data_loader_B, max_da... | 1 | 5 | 0 | 2 | 8 | 0 |
datasets/swda/swda.py | WojciechKusa/datasets | 10,608 | 1614047 | <reponame>WojciechKusa/datasets
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
content_management.py | gitdaniel228/program.net | 114 | 1614048 | ##
##//
##
##
##// CURRENT:
##// list of topics by {TOPIC:[["TITLE", "URL"]]}
##
##// FUTURE:
##////list of topics by {TOPIC:[["TITLE", "URL", "TAGS"],
##//// ["TITLE", "URL", "TAGS"]]}
def Content() -> object:
## // Suggest Branches for next steps
## // If l... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/jit/test_instance_vars.py | ruby-compiler-survey/topaz | 241 | 1614050 | from .base import BaseJITTest
class TestInstanceVars(BaseJITTest):
def test_initialize(self, topaz, tmpdir):
traces = self.run(topaz, tmpdir, """
class A
def initialize
@a = 1
@b = 2
@c = 3
end
end
i = 0
while i < 1000... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/genericTypes7.py | Microsoft/pyright | 3,934 | 1614094 | # This sample tests the specialization of property return types.
from typing import TypeVar, Generic
T = TypeVar("T")
class Foo(Generic[T]):
def __init__(self, bar: T):
self._bar = bar
@property
def bar(self) -> T:
return self._bar
def bar_method(self) -> T:
reveal_type(sel... | 1 | 2 | 0 | 0 | 3 | 0 |
pysec/lang/en_US.py | benhunter/owasp-pysec | 416 | 1614103 | # Python Security Project (PySec) and its related class files.
#
# PySec is a set of tools for secure application development under Linux
#
# Copyright 2014 PySec development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/datatypes/test_datatypes.py | ambv/edgedb-python | 214 | 1614136 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... | 0 | 0 | 0 | 0 | 0 | 0 |
Assignments/assignment5/MakiNaruto/vocab.py | stxxllbu/CS224n-winter-together | 468 | 1614145 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations
"""
CS224N 2019-20: Homework 5
vocab.py: Vocabulary Generation
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
Usage:
vocab.py --train-src=<file> --train-tgt=<file> [options] VOCAB_FILE
Options:
-h --help Show this screen.
... | 8 | 15 | 0 | 3 | 26 | 0 |
pubnub/models/consumer/v3/space.py | natekspencer/pubnub-python | 146 | 1614180 | <filename>pubnub/models/consumer/v3/space.py
from pubnub.models.consumer.v3.pn_resource import PNResource
class Space(PNResource):
def __init__(self, resource_name=None, resource_pattern=None):
super(Space, self).__init__(resource_name, resource_pattern)
@staticmethod
def id(space_id):
s... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/mpi-ref-v1/ex-2.08.py | gmdzy2010/mpi4py | 533 | 1614201 | <filename>demo/mpi-ref-v1/ex-2.08.py
## mpiexec -n 2 python ex-2.08.py
# An exchange of messages
# --------------------------------------------------------------------
from mpi4py import MPI
import array
if MPI.COMM_WORLD.Get_size() < 2:
raise SystemExit
# ------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_srt.py | xl8-ai/srt | 285 | 1614219 | <gh_stars>100-1000
#!/usr/bin/env python
# coding=utf8
from __future__ import unicode_literals
from datetime import timedelta
import collections
import functools
import os
import re
import string
from io import StringIO
import pytest
from hypothesis import given, settings, HealthCheck, assume
import hypothesis.strate... | 0 | 0 | 0 | 0 | 0 | 0 |
Linux/python/tests/Fusion10.py | citbrains/RTIMULib | 172 | 1614227 | import sys, getopt
sys.path.append('.')
import RTIMU
import os.path
import time
import math
SETTINGS_FILE = "RTIMULib"
# computeHeight() - the conversion uses the formula:
#
# h = (T0 / L0) * ((p / P0)**(-(R* * L0) / (g0 * M)) - 1)
#
# where:
# h = height above sea level
# T0 = standard temperature at sea leve... | 0 | 1 | 0 | 0 | 1 | 0 |
MapOnline/js/proj4js/tools/closure.py | songtianlun/Web-Demo | 405 | 1614234 | <gh_stars>100-1000
import sys
import os
import tempfile
path = "../tools/closure-compiler.jar"
if not os.path.exists(path):
raise Exception("No closure-compiler.jar at %s; read README.txt!" % path)
def minimize(code):
ntf = tempfile.NamedTemporaryFile(delete=False)
ntf.write(code)
ntf.flush()
ntf... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/pydeck/data_utils/binary_transfer.py | ajayiagbebaku/NFL-Model | 7,702 | 1614241 | from __future__ import annotations
from collections import defaultdict
import numpy as np
# Grafted from
# https://github.com/maartenbreddels/ipyvolume/blob/d13828dfd8b57739004d5daf7a1d93ad0839ed0f/ipyvolume/serialize.py#L219
def array_to_binary(ar, obj: object | None=None, force_contiguous: bool=True) -> dict[str,o... | 3 | 2 | 0 | 0 | 5 | 0 |
PROCESSOR/MachineLearning.py | leelim81/Pair-Trading-Reinforcement-Learning | 186 | 1614246 | import random
import numpy as np
from MAIN.Basics import Processor, Space
from operator import itemgetter
class StateSpace(Processor, Space):
def __init__(self, agent):
self.agent = agent
super().__init__(agent.config['StateSpaceState'])
def process(self):
self.agent.dat... | 0 | 11 | 0 | 1 | 12 | 0 |
examples/load_from_neurochem.py | yueyericardo/torchani | 305 | 1614257 | <reponame>yueyericardo/torchani<filename>examples/load_from_neurochem.py
# -*- coding: utf-8 -*-
"""
Construct Model From NeuroChem Files
====================================
This tutorial illustrates how to manually load model from `NeuroChem files`_.
.. _NeuroChem files:
https://github.com/isayev/ASE_ANI/tree/m... | 0 | 0 | 0 | 0 | 0 | 0 |
sasila-example/car_processor.py | iiiusky/Sasila | 327 | 1614284 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sasila.system_normal.spider.spider_core import SpiderCore
from sasila.system_normal.pipeline.console_pipeline import ConsolePipeline
from sasila.system_normal.pipeline.text_pipeline import TextPipelineCar
from sasila.system_normal.processor.base_processor import BasePr... | 0 | 0 | 4 | 0 | 4 | 0 |
sumologic-app-utils/src/sumologic.py | niv-griiip/sumologic-aws-lambda | 152 | 1614295 | from __future__ import annotations
import json
import requests
import time
from random import uniform
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
try:
import cookielib
except ImportError:
import http.cookiejar as cookielib
DEFAULT_VERSION = 'v1'
class Sum... | 32 | 63 | 0 | 0 | 95 | 0 |
fkie_master_sync/src/fkie_master_sync/__init__.py | JOiiNT-LAB/multimaster_fkie | 194 | 1614321 | <reponame>JOiiNT-LAB/multimaster_fkie
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>/US, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/highlight_test.py | ycechungAI/babi | 223 | 1614333 | <filename>tests/highlight_test.py
from __future__ import annotations
import pytest
from babi.highlight import highlight_line
from babi.highlight import Region
def test_grammar_matches_extension_only_name(make_grammars):
data = {'scopeName': 'shell', 'patterns': [], 'fileTypes': ['bashrc']}
grammars = make_g... | 0 | 0 | 0 | 0 | 0 | 0 |
scispacy/hyponym_detector.py | rajeshkppt/scispacy | 1,139 | 1614351 | from spacy.matcher import Matcher
from spacy.tokens import Token, Doc
from spacy.language import Language
from scispacy.hearst_patterns import BASE_PATTERNS, EXTENDED_PATTERNS
@Language.factory("hyponym_detector")
class HyponymDetector:
"""
A spaCy pipe for detecting hyponyms using Hearst patterns.
This ... | 7 | 3 | 0 | 2 | 12 | 0 |
Sublime Text 3/Backup/20210122193107/backrefs/st3/backrefs/uniprops/unidata/__init__.py | anekeallen/Sublime-Text-3 | 182 | 1614377 | <reponame>anekeallen/Sublime-Text-3
"""Unicode Properties from Unicode version 6.1.0 (autogen)."""
from __future__ import unicode_literals
from .age import * # noqa
from .alias import * # noqa
from .bidiclass import * # noqa
from .binary import * # noqa
from .block import * # noqa
from .canonicalcombiningclass im... | 0 | 0 | 0 | 0 | 0 | 0 |
jiant/utils/python/checks.py | yzpang/jiant | 1,108 | 1614389 | from typing import Dict
def dict_equal(dict1: Dict, dict2: Dict) -> bool:
if not len(dict1) == len(dict2):
return False
for (k1, v1), (k2, v2) in zip(dict1.items(), dict2.items()):
if k1 != k2:
return False
if v1 != v2:
return False
return True
| 2 | 1 | 0 | 0 | 3 | 0 |
tests/flow/test_ooo.py | elena-kolevska/RedisTimeSeries | 643 | 1614392 | import random
import pytest
import redis
from RLTest import Env
from test_helper_classes import _get_ts_info
def test_ooo(self):
with Env().getClusterConnectionIfNeeded() as r:
quantity = 50001
type_list = ['', 'UNCOMPRESSED']
for chunk_type in type_list:
r.execute_command('ts... | 0 | 0 | 0 | 0 | 0 | 0 |
specification/scripts/pdf_chapter_diff.py | bjornbytes/OpenXR-SDK-Source | 226 | 1614412 | <reponame>bjornbytes/OpenXR-SDK-Source
#!/usr/bin/env python3
# Copyright (c) 2019 Collabora, Ltd.
#
# SPDX-License-Identifier: Apache-2.0
#
# Author(s): <NAME> <<EMAIL>>
#
# Purpose: This script helps drive a per-section PDF diff.
import re
from itertools import chain, zip_longest
from pathlib import Path
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/batools/pythonenumsmodule.py | nitingupta910/ballistica | 317 | 1614425 | # Released under the MIT License. See LICENSE for details.
#
"""Procedurally regenerates our python enums module.
This scans core/types.h for tagged C++ enum types and generates corresponding
python enums for them.
"""
from __future__ import annotations
import re
import os
from typing import TYPE_CHECKING
from efro.... | 15 | 7 | 2 | 0 | 24 | 0 |
tests/test_cli.py | NickMitin/pyhttptest | 142 | 1614429 | <filename>tests/test_cli.py<gh_stars>100-1000
from click.testing import CliRunner
from pyhttptest import cli
def test_execute():
runner = CliRunner()
result = runner.invoke(cli.execute, ['data/HTTP_GET.json'])
assert result.exit_code == 0
def test_execute_with_not_supported_file_extension_as_arg():
... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/tqdm/_utils.py | mirosa25/ITI-202-Final-Project | 353 | 1614441 | <reponame>mirosa25/ITI-202-Final-Project
from .utils import CUR_OS, IS_WIN, IS_NIX, RE_ANSI, _range, _unich, _unicode, colorama, _basestring, FormatReplace, Comparable, SimpleTextIOWrapper, _is_utf, _supports_unicode, _is_ascii, _screen_shape_wrapper, _screen_shape_windows, _screen_shape_tput, _screen_shape_linux, _env... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/mesa/MesaLib/src/gallium/auxiliary/util/u_half.py | Scopetta197/chromium | 212 | 1614443 | <reponame>Scopetta197/chromium
# Copyright 2010 <NAME>
#
# 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, m... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter07/c7_01_3factor_model.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 1614460 | # -*- coding: utf-8 -*-
"""
Name : c7_01_3factor_model.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
from scipy import stats
from pandas.stats.api import ols
import pandas as pd
y = [0.06... | 0 | 0 | 0 | 0 | 0 | 0 |
framework/data_generator/replay/replay_generator.py | JayTheYggdrasil/Saltie | 138 | 1614470 | <gh_stars>100-1000
import random
import requests
from framework.data_generator.base_generator import BaseDataGenerator
from framework.replay.replay_format import GeneratedReplay
class ReplayListGenerator(BaseDataGenerator):
BASE_URL = "https://calculated.gg"
def __init__(self, api_key=1, min_m... | 0 | 0 | 0 | 0 | 0 | 0 |
src/datasets/packaged_modules/__init__.py | WojciechKusa/datasets | 10,608 | 1614557 | import inspect
import re
from hashlib import sha256
from typing import List
from .csv import csv
from .json import json
from .pandas import pandas
from .parquet import parquet
from .text import text
def hash_python_lines(lines: List[str]) -> str:
filtered_lines = []
for line in lines:
line = re.sub(r... | 1 | 1 | 0 | 0 | 2 | 0 |
idk/cachebuilder/location.py | Samsung/ADBI | 312 | 1614559 | from __future__ import annotations
from itertools import count
import logging
import os
def iter_files(compilation_unit) -> object:
'''Yield all file paths in the given compilation unit.
Yield absolute paths if possible. Paths are not guaranteed to be unique.'''
topdie = compilation_unit.get_top_DI... | 0 | 8 | 0 | 1 | 9 | 0 |
longclaw/configuration/migrations/0001_initial.py | al-bezd/longclaw | 351 | 1614564 | # Generated by Django 2.1.4 on 2018-12-22 14:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial: bool = True
dependencies: list[tuple[str, str]] = [
('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'),
... | 0 | 0 | 3 | 0 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.