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/mock/tests/settings.py
magicjoey/django-knowledge
199
19146
<gh_stars>100-1000 from mock.tests.base import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.template.defaultfilters import slugify from knowledge import settings from knowledge.models import Question, Response from ...
library/oci_dhcp_options.py
slmjy/oci-ansible-modules
106
19168
<reponame>slmjy/oci-ansible-modules #!/usr/bin/python # Copyright (c) 2017, 2018, 2019, 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) # ...
homeassistant/components/hardware/const.py
liangleslie/core
30,023
19170
<filename>homeassistant/components/hardware/const.py """Constants for the Hardware integration.""" DOMAIN = "hardware"
cmsplugin_cascade/migrations/0009_cascadepage.py
teklager/djangocms-cascade
139
19172
<gh_stars>100-1000 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('cms', '0013_urlconfrevision'), ('cmsplugin_cascade', '0008_sortableinlinecascadeelement'), ] operations = [ migrations.CreateMode...
Week11/765.py
bobsingh149/LeetCode
101
19175
class Solution: def minSwapsCouples(self, row: List[int]) -> int: parent=[i for i in range(len(row))] for i in range(1,len(row),2): parent[i]-=1 def findpath(u,parent): if parent[u]!=u: parent[u]=findpath(parent[u],parent) ...
apps/hosts/views.py
kaustubh-s1/EvalAI
1,470
19215
<gh_stars>1000+ from django.contrib.auth.models import User from rest_framework import permissions, status from rest_framework.decorators import ( api_view, authentication_classes, permission_classes, throttle_classes, ) from rest_framework.response import Response from rest_framework_expiring_authtoke...
airbyte-integrations/connectors/source-square/source_square/utils.py
OTRI-Unipd/OTRI-airbyte
6,215
19246
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # from typing import Union def separate_by_count(total_length: int, part_count: int) -> (int, int): """ Calculates parts needed to separate count by part_count value For example: separate_by_count(total_length=196582, part_count=10000) returns (1...
examples/model_zoo/test_binaries.py
Embracing/unrealcv
1,617
19313
<filename>examples/model_zoo/test_binaries.py import subprocess, os win_binary_path = 'UE4Binaries/{project_name}/WindowsNoEditor/{project_name}.exe' linux_binary_path = './UE4Binaries/{project_name}/LinuxNoEditor/{project_name}/Binaries/Linux/{project_name}' mac_binary_path = './UE4Binaries/{project_name}/MacNoEditor...
bindings/python/examples/05b_get_output.py
GoldenPedro/iota.rs
256
19315
import iota_client client = iota_client.Client() print( client.get_output("a22cba0667c922cbb1f8bdcaf970b2a881ccd6e88e2fcce50374de2aac7c37720000") )
aiida/storage/psql_dos/migrations/versions/django_0040_data_migration_legacy_process_attributes.py
mkrack/aiida-core
153
19327
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
src/scenic/simulators/gta/map.py
cahartsell/Scenic
141
19333
# stub to allow changing the map without having to alter gta_model.sc import os mapPath = 'map.npz' def setLocalMap(module, relpath): global mapPath base = os.path.dirname(module) mapPath = os.path.join(base, relpath)
bigflow_python/python/bigflow/pipeline/test/testdata/columns/columns/column_sum.py
advancedxy/bigflow_python
1,236
19347
#!/usr/bin/env python # encoding: utf-8 ######################################################################## # # Copyright (c) 2016 Baidu, Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
build-a-django-content-aggregator/source_code_step_2/podcasts/tests.py
syberflea/materials
3,682
19376
<filename>build-a-django-content-aggregator/source_code_step_2/podcasts/tests.py from django.test import TestCase from django.utils import timezone from .models import Episode class PodCastsTests(TestCase): def setUp(self): self.episode = Episode.objects.create( title="My Awesome Podcast Episo...
superset/migrations/versions/070c043f2fdb_add_granularity_to_charts_where_missing.py
razzius/superset
18,621
19377
<reponame>razzius/superset # 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 ...
habitat_baselines/motion_planning/robot_target.py
srama2512/habitat-api
355
19416
<filename>habitat_baselines/motion_planning/robot_target.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import attr import magnum as mn import numpy as np @attr.s...
demo_scripts/charts/bar_chart_index_translator_demo.py
webclinic017/qf-lib
198
19424
<filename>demo_scripts/charts/bar_chart_index_translator_demo.py # 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 th...
src/oic/oauth2/util.py
alanbuxey/pyoidc
290
19444
import logging from http import cookiejar as http_cookiejar from http.cookiejar import http2time # type: ignore from typing import Any # noqa from typing import Dict # noqa from urllib.parse import parse_qs from urllib.parse import urlsplit from urllib.parse import urlunsplit from oic.exception import UnSupported f...
src/tfi/publish.py
ajbouh/tfi
160
19456
import decimal import hashlib import json import requests import tempfile import uuid import os from tqdm import tqdm from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor def sha256_for_file(f, buf_size=65536): pos = f.tell() dgst = hashlib.sha256() while True: data = f.read(bu...
examples/images/autoencoder.py
jjpalacio/tflearn
10,882
19461
# -*- coding: utf-8 -*- """ Auto Encoder Example. Using an auto encoder on MNIST handwritten digits. References: <NAME>, <NAME>, <NAME>, and <NAME>. "Gradient-based learning applied to document recognition." Proceedings of the IEEE, 86(11):2278-2324, November 1998. Links: [MNIST Dataset] http://yann...
src/asphalt/core/concurrent.py
agronholm/asphalt
226
19485
from __future__ import annotations __all__ = ("executor",) import inspect import sys from asyncio import get_running_loop from concurrent.futures import Executor from functools import partial, wraps from typing import Awaitable, Callable, TypeVar, overload from asphalt.core import Context if sys.version_info >= (3,...
pyexcel_xlsx/__init__.py
pyexcel/pyexcel-xlsx
101
19506
<gh_stars>100-1000 """ pyexcel_xlsx ~~~~~~~~~~~~~~~~~~~ The lower level xlsx file format handler using openpyxl :copyright: (c) 2015-2019 by Onni Software Ltd & its contributors :license: New BSD License """ from pyexcel_io.io import get_data as read_data from pyexcel_io.io import isstream from py...
torch_geometric_temporal/signal/__init__.py
tforgaard/pytorch_geometric_temporal
1,410
19522
<filename>torch_geometric_temporal/signal/__init__.py from .dynamic_graph_temporal_signal import * from .dynamic_graph_temporal_signal_batch import * from .static_graph_temporal_signal import * from .static_graph_temporal_signal_batch import * from .dynamic_graph_static_signal import * from .dynamic_graph_static_sign...
packages/grid/apps/worker/src/main/core/database/groups/groups.py
exityan/PySyft
425
19570
# grid relative from .. import BaseModel from .. import db class Group(BaseModel): __tablename__ = "group" id = db.Column(db.Integer(), primary_key=True, autoincrement=True) name = db.Column(db.String(255)) def __str__(self): return f"<Group id: {self.id}, name: {self.name}>"
solution/data_structure2/1302/main.py
jungyoonoh/baekjoon-1
2,236
19572
<reponame>jungyoonoh/baekjoon-1 # Authored by : gusdn3477 # Co-authored by : - # Link : http://boj.kr/8adc986ae26b461eadd65abdff3cfba9 import sys def input(): return sys.stdin.readline().rstrip() N = int(input()) book = {} for i in range(N): name = input() if name not in book: book[name] = 1 e...
helper/evaluator.py
manipopopo/TC-ResNet
185
19584
import csv import sys from pathlib import Path from abc import abstractmethod import numpy as np import tensorflow as tf from tqdm import tqdm import common.tf_utils as tf_utils import metrics.manager as metric_manager from common.model_loader import Ckpt from common.utils import format_text from common.utils import ...
components/PyTorch/pytorch-kfp-components/setup.py
nostro-im/pipelines
2,860
19617
<reponame>nostro-im/pipelines #!/usr/bin/env/python3 # # Copyright (c) Facebook, Inc. and its affiliates. # 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/L...
Kernels/Research/FFT/config/fft.py
WoodData/EndpointAI
190
19648
# # # Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # 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 # # www.apache.org/lice...
tests/tensorflow/pruning/test_tensor_processor.py
MaximProshin/nncf
136
19666
<reponame>MaximProshin/nncf<gh_stars>100-1000 import pytest import tensorflow as tf from nncf.tensorflow.tensor import TFNNCFTensor from nncf.tensorflow.pruning.tensor_processor import TFNNCFPruningTensorProcessor @pytest.mark.parametrize('device', ("CPU", 'GPU')) def test_create_tensor(device): if not tf.config...
languages/python/software_engineering_logging4.py
Andilyn/learntosolveit
136
19672
<filename>languages/python/software_engineering_logging4.py import logging logger1 = logging.getLogger('package1.module1') logger2 = logging.getLogger('package1.module2') logging.basicConfig(level=logging.WARNING) logger1.warning('This is a warning message') logger2.warning('This is a another warning message')
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/markup.py
zhi-xianwei/learn_python3_spider
9,953
19675
<filename>stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/markup.py """ Transitional module for moving to the w3lib library. For new code, always import from w3lib.html instead of this module """ import warnings from scrapy.exceptions import ScrapyDeprecationWarning from w3lib.html import * warnings.war...
applications/FemToDemApplication/python_scripts/MainFEM_for_coupling.py
lkusch/Kratos
778
19702
<reponame>lkusch/Kratos<gh_stars>100-1000 import KratosMultiphysics import KratosMultiphysics.FemToDemApplication.MainFemDem as MainFemDem import KratosMultiphysics.FemToDemApplication as KratosFemDem import KratosMultiphysics.DEMApplication as DEM import KratosMultiphysics.DemStructuresCouplingApplication as DEM...
aries_cloudagent/wallet/tests/test_key_pair.py
kuraakhilesh8230/aries-cloudagent-python
247
19813
<reponame>kuraakhilesh8230/aries-cloudagent-python from asynctest import TestCase as AsyncTestCase import json from ...storage.error import StorageNotFoundError from ..util import bytes_to_b58 from ..key_type import KeyType from ...core.in_memory import InMemoryProfile from ...storage.in_memory import InMemoryStorage...
LeetCode/0005_Longest_Palindromic_Substring.py
Achyut-sudo/PythonAlgorithms
144
19837
<filename>LeetCode/0005_Longest_Palindromic_Substring.py ''' Problem:- Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. ''' class Solution: def longestPalin...
cortex/export/__init__.py
mvdoc/pycortex
423
19853
<filename>cortex/export/__init__.py from .save_views import save_3d_views from .panels import plot_panels from ._default_params import ( params_inflatedless_lateral_medial_ventral, params_flatmap_lateral_medial, params_occipital_triple_view, params_inflated_dorsal_lateral_medial_ventral, ) __all__ = [ ...
setup.py
may-ank/hocr-tools
200
19869
<filename>setup.py #!/usr/bin/env python __version__ = '1.3.0' import glob from setuptools import setup setup( name="hocr-tools", version=__version__, description='Advanced tools for hOCR integration', author='<NAME>', maintainer='<NAME>', maintainer_email='<EMAIL>', url='https://github.c...
pair-ranking-cnn/utils.py
shinoyuki222/torch-light
310
19918
import const def corpora2idx(sents, ind2idx): return [[ind2idx[w] if w in ind2idx else const.UNK for w in s] for s in sents]
2020/02/07/An Introduction to Sessions in Flask/flask_session_example/app.py
kenjitagawa/youtube_video_code
492
19927
from flask import Flask, render_template, session, redirect, url_for app = Flask(__name__) app.config['SECRET_KEY'] = '<PASSWORD>' @app.route('/') def index(): return render_template('index.html') @app.route('/set-background/<mode>') def set_background(mode): session['mode'] = mode return red...
typed_python/compiler/type_wrappers/ref_to_wrapper.py
APrioriInvestments/typed_python
105
19940
<reponame>APrioriInvestments/typed_python # Copyright 2017-2019 typed_python 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...
tests/unit/utils/test_win_system.py
markgras/salt
9,425
19947
import os import salt.utils.platform from tests.support.mock import patch from tests.support.unit import TestCase, skipIf try: import salt.utils.win_system as win_system except Exception as exc: # pylint: disable=broad-except win_system = exc class WinSystemImportTestCase(TestCase): """ Simply impo...
src/genie/libs/parser/junos/tests/ShowOspfStatistics/cli/equal/golden_output_expected.py
balmasea/genieparser
204
19965
expected_output = { "ospf-statistics-information": { "ospf-statistics": { "dbds-retransmit": "203656", "dbds-retransmit-5seconds": "0", "flood-queue-depth": "0", "lsas-acknowledged": "225554974", "lsas-acknowledged-5seconds"...
norbert/__init__.py
AppleHolic/norbert
142
19982
import numpy as np import itertools from .contrib import compress_filter, smooth, residual_model from .contrib import reduce_interferences def expectation_maximization(y, x, iterations=2, verbose=0, eps=None): r"""Expectation maximization algorithm, for refining source separation estimates. This algorith...
lightnn/base/__init__.py
tongluocq/lightnn
131
19997
<gh_stars>100-1000 #!/usr/bin/env python # coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from .activations import * from .losses import * from .initializers import * from .optimizers import *
2009/plotting_data_monitor/_distrib.py
mikiec84/code-for-blog
1,199
20000
from eblib import libcollect # Create a LibCollect object lc = libcollect.LibCollect() # Prepare arguments for do_collect # # Path to the script (can be absolute or relative) scriptname = 'plotting_data_monitor.pyw' # Ask the resulting distribution to be placed in # directory distrib targetdir = 'distr...
qf_lib/backtesting/events/time_event/regular_date_time_rule.py
webclinic017/qf-lib
198
20016
# 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...
commands/limit.py
nstra111/autovc
177
20024
<filename>commands/limit.py import utils import functions as func from commands.base import Cmd help_text = [ [ ("Usage:", "<PREFIX><COMMAND>\n" "<PREFIX><COMMAND> `N`"), ("Description:", "Use when already in a channel - Limit the number of users allowed in your channel ...
notes/migrations/0005_auto_20160130_0015.py
nicbou/markdown-notes
121
20053
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('notes', ...
flask_youku/__init__.py
xiaoyh121/program
176
20069
<filename>flask_youku/__init__.py from flask import Blueprint, Markup from flask import render_template class Youku(object): """Flask-Youku extents.""" def __init__(self, app=None, **kwargs): """Init Flask-Youku's instance via app object""" if app: self.init_app(app) def init...
Common_3/Tools/ForgeShadingLanguage/generators/d3d.py
divecoder/The-Forge
3,058
20078
""" GLSL shader generation """ from utils import Stages, getHeader, getShader, getMacro, genFnCall, fsl_assert, get_whitespace from utils import isArray, getArrayLen, getArrayBaseName, getMacroName, DescriptorSets, is_groupshared_decl import os, sys, importlib, re from shutil import copyfile def pssl(fsl, dst, rootSi...
tests/integration/test_between_tags.py
liorbass/pydriller
583
20081
# Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwa...
examples/dialogs.py
tgolsson/appJar
666
20094
from appJar import gui def press(btn): if btn == "info": app.infoBox("Title Here", "Message here...") if btn == "error": app.errorBox("Title Here", "Message here...") if btn == "warning": app.warningBox("Title Here", "Message here...") if btn == "yesno": app.yesNoBox("Title Here", "Message here...") ...
tests/polynomials.py
mernst/cozy
188
20098
<filename>tests/polynomials.py import unittest from cozy.polynomials import Polynomial class TestPolynomials(unittest.TestCase): def test_sorting(self): self.assertLess(Polynomial([2019, 944, 95]), Polynomial([2012, 945, 95])) self.assertGreater(Polynomial([2012, 945, 95]), Polynomial([2019, 944,...
examples/twisted/websocket/auth_persona/server.py
rapyuta-robotics/autobahn-python
1,670
20109
############################################################################### # # The MIT License (MIT) # # Copyright (c) Crossbar.io Technologies GmbH # # 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 ...
booknlp/common/calc_coref_metrics.py
ishine/booknlp
539
20111
import subprocess, re, sys def get_coref_score(metric, path_to_scorer, gold=None, preds=None): output=subprocess.check_output(["perl", path_to_scorer, metric, preds, gold]).decode("utf-8") output=output.split("\n")[-3] matcher=re.search("Coreference: Recall: \(.*?\) (.*?)% Precision: \(.*?\) (.*?)% F1: (.*?)%", ou...
src/python/compressao_huffman.py
willisnou/Algoritmos-e-Estruturas-de-Dados
653
20114
<reponame>willisnou/Algoritmos-e-Estruturas-de-Dados # Árvore Huffman class node: def __init__(self, freq, symbol, left=None, right=None): # Frequência do Símbolo self.freq = freq # Símbolo (caracter) self.symbol = symbol # nó à esquerda do nó atual self.left = left...
Tests/subset/svg_test.py
ThomasRettig/fonttools
2,705
20120
from string import ascii_letters import textwrap from fontTools.misc.testTools import getXML from fontTools import subset from fontTools.fontBuilder import FontBuilder from fontTools.pens.ttGlyphPen import TTGlyphPen from fontTools.ttLib import TTFont, newTable from fontTools.subset.svg import NAMESPACES, ranges impo...
tests/components/tectonics/test_listric_kinematic_extender.py
amanaster2/landlab
257
20129
<reponame>amanaster2/landlab<filename>tests/components/tectonics/test_listric_kinematic_extender.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 5 08:42:24 2021 @author: gtucker """ from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_raises from landlab import He...
tests/test_polygon.py
tilezen/mapbox-vector-tile
121
20137
# -*- coding: utf-8 -*- """ Tests for vector_tile/polygon.py """ import unittest from mapbox_vector_tile.polygon import make_it_valid from shapely import wkt import os class TestPolygonMakeValid(unittest.TestCase): def test_dev_errors(self): test_dir = os.path.dirname(os.path.realpath(__file__)) ...
xp/build/scripts/gg_post_process_xcode_project.py
vladcorneci/golden-gate
262
20170
<gh_stars>100-1000 #! /urs/bin/env python # Copyright 2017-2020 Fitbit, Inc # SPDX-License-Identifier: Apache-2.0 ##################################################################### # This script post-processes the XCode project generated # by CMake, so that it no longer contains absolute paths. # It also remaps UU...
uq_benchmark_2019/imagenet/end_to_end_test.py
deepneuralmachine/google-research
23,901
20175
<gh_stars>1000+ # coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
src/robot/parsing/parser/parser.py
bhirsz/robotframework
7,073
20182
<gh_stars>1000+ # Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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/licen...
qf_lib/backtesting/order/order_factory.py
webclinic017/qf-lib
198
20219
# 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...
test/test_auth.py
tjones-commits/server-client-python
470
20233
import unittest import os.path import requests_mock import tableauserverclient as TSC TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets') SIGN_IN_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in.xml') SIGN_IN_IMPERSONATE_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in_impersonate.xml') SIGN_IN_ERROR_X...
awx/main/migrations/0082_v360_webhook_http_method.py
Avinesh/awx
11,396
20247
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def add_webhook_notification_template_fields(apps, schema_editor): # loop over all existing webhook notification templates and make # sure they have the new "http_method" field filled in with "POST" Notificat...
runtests.py
resurrexi/django-restql
545
20249
#!/usr/bin/env python import os import sys import subprocess from django.core.management import execute_from_command_line FLAKE8_ARGS = ['django_restql', 'tests', 'setup.py', 'runtests.py'] WARNING_COLOR = '\033[93m' END_COLOR = '\033[0m' def flake8_main(args): print('Running flake8 code linting') ret = su...
src/oci/log_analytics/models/query_details.py
Manny27nyc/oci-python-sdk
249
20289
<gh_stars>100-1000 # coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC...
ledfx/color.py
broccoliboy/LedFx
524
20310
from collections import namedtuple RGB = namedtuple("RGB", "red, green, blue") COLORS = { "red": RGB(255, 0, 0), "orange-deep": RGB(255, 40, 0), "orange": RGB(255, 120, 0), "yellow": RGB(255, 200, 0), "yellow-acid": RGB(160, 255, 0), "green": RGB(0, 255, 0), "green-forest": RGB(34, 139, 34...
DeepAlignmentNetwork/menpofit/lk/result.py
chiawei-liu/DeepAlignmentNetwork
220
20325
from menpofit.result import (ParametricIterativeResult, MultiScaleParametricIterativeResult) class LucasKanadeAlgorithmResult(ParametricIterativeResult): r""" Class for storing the iterative result of a Lucas-Kanade Image Alignment optimization algorithm. Parameters -...
bob-ross/cluster-paintings.py
h4ckfu/data
16,124
20348
<reponame>h4ckfu/data<filename>bob-ross/cluster-paintings.py """ Clusters Bob Ross paintings by features. By <NAME> <<EMAIL>> See http://fivethirtyeight.com/features/a-statistical-analysis-of-the-work-of-bob-ross/ """ import numpy as np from scipy.cluster.vq import vq, kmeans, whiten import math import csv def main...
alipay/aop/api/domain/MybankCreditSceneprodCommonQueryModel.py
antopen/alipay-sdk-python-all
213
20355
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class MybankCreditSceneprodCommonQueryModel(object): def __init__(self): self._app_seq_no = None self._ext_param = None self._operation_type = None self._org_code = None...
examples/plugin_example/setup.py
linshoK/pysen
423
20367
from setuptools import setup setup( name="example-advanced-package", version="0.0.0", packages=[], )
venv/lib/python3.9/site-packages/py2app/recipes/PIL/prescript.py
dequeb/asmbattle
193
20376
def _recipes_pil_prescript(plugins): try: import Image have_PIL = False except ImportError: from PIL import Image have_PIL = True import sys def init(): if Image._initialized >= 2: return if have_PIL: try: impor...
turkish_morphology/validate_test.py
nogeeky/turkish-morphology
157
20384
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
news-category-classifcation/build_vocab.py
lyeoni/pytorch-nlp-tutorial
1,433
20392
<filename>news-category-classifcation/build_vocab.py import argparse import pickle from tokenization import Vocab, Tokenizer TOKENIZER = ('treebank', 'mecab') def argparser(): p = argparse.ArgumentParser() # Required parameters p.add_argument('--corpus', default=None, type=str, required=True) p.add_a...
tests/encryption/aes_decrypter.py
dfjxs/dfvfs
176
20394
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for the AES decrypter object.""" import unittest from dfvfs.encryption import aes_decrypter from dfvfs.lib import definitions from tests.encryption import test_lib class AESDecrypterTestCase(test_lib.DecrypterTestCase): """Tests for the AES decrypter object....
Modo/Kits/OD_ModoCopyPasteExternal/lxserv/cmd_copyToExternal.py
heimlich1024/OD_CopyPasteExternal
278
20399
<filename>Modo/Kits/OD_ModoCopyPasteExternal/lxserv/cmd_copyToExternal.py ################################################################################ # # cmd_copyToExternal.py # # Author: <NAME> | <NAME> # # Description: Copies Geo/Weights/Morphs/UV's to External File # # Last Update: # #################...
mayan/apps/mimetype/apps.py
eshbeata/open-paperless
2,743
20441
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from common import MayanAppConfig from .licenses import * # NOQA class MIMETypesApp(MayanAppConfig): name = 'mimetype' verbose_name = _('MIME types') def ready(self, *args, **kwargs): super(MIMETyp...
trove/tests/unittests/taskmanager/test_galera_clusters.py
a4913994/openstack_trove
244
20457
<reponame>a4913994/openstack_trove # Copyright [2015] Hewlett-Packard Development Company, L.P. # 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 # ...
dataloaders/voc.py
psui3905/CCT
308
20474
from base import BaseDataSet, BaseDataLoader from utils import pallete import numpy as np import os import scipy import torch from PIL import Image import cv2 from torch.utils.data import Dataset from torchvision import transforms import json class VOCDataset(BaseDataSet): def __init__(self, **kwargs): sel...
scripts/pretty-printers/gdb/install.py
tobireinhard/cbmc
412
20484
<gh_stars>100-1000 #!/usr/bin/env python3 import os from shutil import copyfile def create_gdbinit_file(): """ Create and insert into a .gdbinit file the python code to set-up cbmc pretty-printers. """ print("Attempting to enable cbmc-specific pretty-printers.") home_folder = os.path.expanduser...
losses/dice_loss.py
CharlesAuthier/geo-deep-learning
121
20493
import torch import torch.nn as nn import torch.nn.functional as F def soft_dice_score( output: torch.Tensor, target: torch.Tensor, smooth: float = 0.0, eps: float = 1e-7, dims=None) -> torch.Tensor: assert output.size() == target.size() if dims is not None: intersection = torch.sum(output * t...
modules/cudaobjdetect/misc/python/test/test_cudaobjdetect.py
ptelang/opencv_contrib
7,158
20497
#!/usr/bin/env python import os import cv2 as cv import numpy as np from tests_common import NewOpenCVTests, unittest class cudaobjdetect_test(NewOpenCVTests): def setUp(self): super(cudaobjdetect_test, self).setUp() if not cv.cuda.getCudaEnabledDeviceCount(): self.skipTest("No CUDA-ca...
test/ryu/vsw-602_mp_port_desc.py
iMasaruOki/lagopus
281
20505
<gh_stars>100-1000 from ryu.base.app_manager import RyuApp from ryu.controller.ofp_event import EventOFPSwitchFeatures from ryu.controller.ofp_event import EventOFPPortDescStatsReply from ryu.controller.handler import set_ev_cls from ryu.controller.handler import CONFIG_DISPATCHER from ryu.controller.handler import MAI...
conda/update_versions.py
PicoJr/StereoPipeline
323
20519
#!/usr/bin/env python # -*- coding: utf-8 -*- # __BEGIN_LICENSE__ # Copyright (c) 2009-2013, United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. All # rights reserved. # # The NGT platform is licensed under the Apache License, Version 2.0 (the # "Lic...
test.py
uuidd/SimilarCharacter
199
20520
import cv2 import ProcessWithCV2 img1 = cv2.imread("D:/py/chinese/7.png") img2 = cv2.imread("D:/py/chinese/8.png") a = ProcessWithCV2.dHash(img1, img2, 1) print(a)
Medium/valid-ip-addresses.py
SaumyaRai2010/algoexpert-data-structures-algorithms
152
20558
# VALID IP ADDRESSES # O(1) time and space def validIPAddresses(string): # Write your code here. validIPAddresses = [] if len(string) < 4: return [] for i in range(3): if not isValidPart(string[:i+1]): continue for j in range(i+1, i+4): if not isValidPart(string[i+1:j+1]): continue for k ...
src/packagedcode/windows.py
Siddhant-K-code/scancode-toolkit
1,511
20560
<reponame>Siddhant-K-code/scancode-toolkit # # Copyright (c) nexB Inc. and others. All rights reserved. # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/scancode-toolkit for support or downlo...
platform-tools/systrace/catapult/devil/devil/utils/run_tests_helper.py
NBPS-Robotics/FTC-Code-Team-9987---2022
1,894
20566
<gh_stars>1000+ # Copyright (c) 2012 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. """Helper functions common to native, java and host-driven test runners.""" import collections import logging from devil.utils import lo...
main/models/sign.py
fakegit/gxgk-wechat-server
1,564
20572
<reponame>fakegit/gxgk-wechat-server #!/usr/bin/env python # -*- coding: utf-8 -*- from . import db class Sign(db.Model): __table_args__ = { 'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8mb4' } openid = db.Column(db.String(32), primary_key=True, unique=True, null...
src/oscar/apps/customer/__init__.py
QueoLda/django-oscar
4,639
20591
default_app_config = 'oscar.apps.customer.apps.CustomerConfig'
Game22/modules/online/__init__.py
ttkaixin1998/pikachupythongames
4,013
20631
'''初始化''' from .server import gobangSever from .client import gobangClient from .playOnline import playOnlineUI
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/utils/op/fusedbatchnorm.py
quic-ykota/aimet
945
20663
# /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2019-2020, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modifica...
release/alert.py
77loopin/ray
21,382
20675
<filename>release/alert.py<gh_stars>1000+ import argparse from collections import defaultdict, Counter from typing import Any, List, Tuple, Mapping, Optional import datetime import hashlib import json import logging import os import requests import sys import boto3 from e2e import GLOBAL_CONFIG from alerts.default i...
d3rlpy/algos/torch/td3_impl.py
ningyixue/AIPI530_Final_Project
565
20717
from typing import Optional, Sequence import torch from ...gpu import Device from ...models.encoders import EncoderFactory from ...models.optimizers import OptimizerFactory from ...models.q_functions import QFunctionFactory from ...preprocessing import ActionScaler, RewardScaler, Scaler from ...torch_utility import T...
docs/modelserving/detect/aif/germancredit/simulate_predicts.py
chinhuang007/website
1,146
20768
<reponame>chinhuang007/website import sys import json import time import requests if len(sys.argv) < 3: raise Exception("No endpoint specified. ") endpoint = sys.argv[1] headers = { 'Host': sys.argv[2] } with open('input.json') as file: sample_file = json.load(file) inputs = sample_file["instances"] # Sp...
sdc/ysdc_dataset_api/utils/serialization.py
sty61010/shifts
156
20769
import io import zlib import numpy as np def maybe_compress(str, compress): return zlib.compress(str) if compress else str def maybe_decompress(str, decompress): return zlib.decompress(str) if decompress else str def serialize_numpy(arr: np.ndarray, compress: bool = False) -> str: """Serializes numpy...
hubspot/discovery/crm/extensions/videoconferencing/discovery.py
fakepop/hubspot-api-python
117
20770
<filename>hubspot/discovery/crm/extensions/videoconferencing/discovery.py import hubspot.crm.extensions.videoconferencing as api_client from ....discovery_base import DiscoveryBase class Discovery(DiscoveryBase): @property def settings_api(self) -> api_client.SettingsApi: return self._configure_api_cl...
tests/inputs/config.py
hsh-nids/python-betterproto
708
20808
# Test cases that are expected to fail, e.g. unimplemented features or bug-fixes. # Remove from list when fixed. xfail = { "namespace_keywords", # 70 "googletypes_struct", # 9 "googletypes_value", # 9 "import_capitalized_package", "example", # This is the example in the readme. Not a test. } se...
dp/kadane.py
williamsmj/prakhar1989-algorithms
2,797
20835
""" Problem: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers (containing at least one positive number) which has the largest sum. Solution: The recurrence relation that we solve at each step is the following - Let S[i] = be the max value contigous ...
venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
EkremBayar/bayar
603
20851
import numpy as np from matplotlib import _api from .axes_divider import make_axes_locatable, Size from .mpl_axes import Axes @_api.delete_parameter("3.3", "add_all") def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True, **kwargs): """ Parameters ---------- pad : float Fraction of th...
weasyl/test/test_http.py
hyena/weasyl
111
20883
<reponame>hyena/weasyl import pytest from weasyl import http @pytest.mark.parametrize(('wsgi_env', 'expected'), [ ({}, {}), ({'PATH_INFO': '/search', 'QUERY_STRING': 'q=example'}, {}), ({'HTTP_ACCEPT': '*/*'}, {'Accept': '*/*'}), ( {'CONTENT_LENGTH': '', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_...