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
PyObjCTest/test_nsimage.py
Khan/pyobjc-framework-Cocoa
132
49671
<reponame>Khan/pyobjc-framework-Cocoa<gh_stars>100-1000 from PyObjCTools.TestSupport import * import AppKit from AppKit import * try: unicode except NameError: unicode = str class TestNSImageHelper (NSObject): def image_didLoadRepresentation_withStatus_(self, i, r, s): pass def image_didLoadPartOfRepr...
19. Backtracking/subsets of an array.py
Ujjawalgupta42/Hacktoberfest2021-DSA
225
49678
#Input: nums = [1,2,3] #Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] def subsets(self, nums: List[int]) -> List[List[int]]: self.result = [] self.helper(nums, 0, []) return self.result def helper(self, nums, start, subset): self.result.append(subset[::]) ...
server/amberalertcn/api/v1/lib/__init__.py
fuzhouch/amberalertcn
151
49689
<filename>server/amberalertcn/api/v1/lib/__init__.py """ lib """
python/app/plugins/port/Mysql/Mysql_Weakpwd.py
taomujian/linbing
351
49704
#!/usr/bin/env python3 import pymysql from urllib.parse import urlparse class Mysql_Weakpwd_BaseVerify: def __init__(self, url): self.info = { 'name': 'Mysql 弱口令漏洞', 'description': 'Mysql 弱口令漏洞', 'date': '', 'exptype': 'check', 'type': 'Weakpwd' ...
mathematics_dataset/util/probability.py
PhysicsTeacher13/Mathematics_Dataset
1,577
49728
# Copyright 2018 DeepMind Technologies 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
pygears/lib/rounding.py
bogdanvuk/pygears
120
49732
from pygears import gear, datagear, alternative, module from pygears.typing.qround import get_out_type, get_cut_bits from pygears.typing import Uint, code, Bool, Int, Fixp, Ufixp @datagear def qround(din, *, fract=0, cut_bits=b'get_cut_bits(din, fract)', signed=b'din.signed...
mne/tests/test_ola.py
rylaw/mne-python
1,953
49761
import numpy as np from numpy.testing import assert_allclose import pytest from mne._ola import _COLA, _Interp2, _Storer def test_interp_2pt(): """Test our two-point interpolator.""" n_pts = 200 assert n_pts % 50 == 0 feeds = [ # test a bunch of feeds to make sure they don't break things [n_...
tests/test_04_dxf_high_level_structs/test_410_table.py
Gmadges/ezdxf
515
49865
<gh_stars>100-1000 # Copyright (c) 2011-2021, <NAME> # License: MIT License import pytest import ezdxf from ezdxf.tools.test import load_entities from ezdxf.sections.table import Table from ezdxf.lldxf.tagwriter import TagCollector @pytest.fixture(scope="module") def table(): doc = ezdxf.new() return doc.app...
applications/TrilinosApplication/tests/test_trilinos_matrix.py
lkusch/Kratos
778
49873
import KratosMultiphysics.KratosUnittest as KratosUnittest import KratosMultiphysics import KratosMultiphysics.TrilinosApplication as KratosTrilinos class TestTrilinosMatrix(KratosUnittest.TestCase): def test_resize(self): comm = KratosTrilinos.CreateEpetraCommunicator(KratosMultiphysics.DataCommunicator....
cupy_alias/indexing/__init__.py
fixstars/clpy
142
49890
<filename>cupy_alias/indexing/__init__.py<gh_stars>100-1000 from clpy.indexing import * # NOQA
src/ostorlab/agent/message/proto/v3/asset/ip/v4/geolocation/geolocation_pb2.py
bbhunter/ostorlab
113
49896
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: v3/asset/ip/v4/geolocation/geolocation.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.proto...
misc/main.py
vishalbelsare/interpolation.py
110
49925
if True: import numpy as np d = 3 K = 50 N = 10 ** 6 a = np.zeros(3) b = np.ones(3) orders = np.array([K for i in range(d)]) coeffs = np.random.random([k + 2 for k in orders]) points = np.random.random((N, d)) # each line is a vector points_c = points.T.copy() # each column i...
authentication/admin.py
nicbou/markdown-notes
121
49931
<filename>authentication/admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User UserAdmin.list_display = ('username', 'email', 'first_name', 'last_name', 'is_active', 'date_joined') admin.site.unregister(User) admin.site.register(User, Use...
coilutils/__init__.py
rehohoho/coiltraine
204
49942
<reponame>rehohoho/coiltraine<gh_stars>100-1000 from .attribute_dict import AttributeDict #from .experiment_schedule import mount_experiment_heap, get_free_gpus, pop_half_gpu, pop_one_gpu
CalibPPS/ESProducers/python/ctppsRPAlignmentCorrectionsDataESSourceXML_cfi.py
ckamtsikis/cmssw
852
49971
import FWCore.ParameterSet.Config as cms ctppsRPAlignmentCorrectionsDataESSourceXML = cms.ESSource("CTPPSRPAlignmentCorrectionsDataESSourceXML", verbosity = cms.untracked.uint32(0), MeasuredFiles = cms.vstring(), RealFiles = cms.vstring(), MisalignedFiles = cms.vstring() )
PG/5-TNPG/model.py
g6ling/Pytorch-Cartpole
116
49972
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from config import gamma, lr def flat_grad(grads): grad_flatten = [] for grad in grads: grad_flatten.append(grad.view(-1)) grad_flatten = torch.cat(grad_flatten) return grad_flatten def flat_hessian(hessians...
Competitive_Programming/Stepping_stones_3.py
varshakancham/Data_Structure_n_Algorithms
125
49974
""" Vasu is running up a stone staircase with N stones, and can hop(jump) either 1 step, 2 steps or 3 steps at a time. You have to count, how many possible ways Vasu can run up to the stone stairs. Input Format: Input contains integer N that is number of steps Constraints: 1<= N <=30 Output Format: Output f...
cupy_alias/padding/__init__.py
fixstars/clpy
142
49979
<gh_stars>100-1000 from clpy.padding import * # NOQA
lightly/active_learning/scorers/__init__.py
CodeGuy-007/lightly
1,515
49990
""" Collection of Active Learning Scorers """ # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved from lightly.active_learning.scorers.scorer import Scorer from lightly.active_learning.scorers.classification import ScorerClassification from lightly.active_learning.scorers.detection import Score...
graph_based_slam/launch/graphbasedslam.launch.py
edhml/lidarslam_ros2
130
50004
import os import launch import launch_ros.actions from ament_index_python.packages import get_package_share_directory def generate_launch_description(): graphbasedslam_param_dir = launch.substitutions.LaunchConfiguration( 'graphbasedslam_param_dir', default=os.path.join( get_package_...
tests/nonrealtime/test_nonrealtime_Session_duration.py
butayama/supriya
191
50029
import supriya.nonrealtime def test_01(): session = supriya.nonrealtime.Session() assert session.offsets == [float("-inf"), 0.0] assert session.duration == 0.0 def test_02(): session = supriya.nonrealtime.Session() with session.at(0): session.add_group() assert session.offsets == [fl...
tensorflow_toolkit/action_detection/tools/models/export.py
morkovka1337/openvino_training_extensions
256
50046
#!/usr/bin/env python2 # # 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...
ambari-common/src/main/python/ambari_commons/buffered_queue.py
likenamehaojie/Apache-Ambari-ZH
1,664
50084
<reponame>likenamehaojie/Apache-Ambari-ZH<gh_stars>1000+ """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache Li...
html_parsing/https_www_stoloto_ru_4x20_archive__parse_all_loto.py
DazEB2/SimplePyScripts
117
50100
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from urllib.parse import urljoin import requests from bs4 import BeautifulSoup import csv def get_number(text: str) -> int: return int(''.join(c for c in text.strip() if c.isdigit())) first = 1 last = 50 step = 50 result = [] while True...
examples/garbage.py
cyberbeast/pympler
862
50103
<filename>examples/garbage.py from pympler.garbagegraph import start_debug_garbage from pympler import web class Leaf(object): pass class Branch(object): def __init__(self, root): self.root = root self.leaf = Leaf() class Root(object): def __init__(self, num_branches): self.br...
ner/ner_silver_to_gold.py
svlandeg/prodigy-recipes
312
50117
<gh_stars>100-1000 import prodigy from prodigy.models.ner import EntityRecognizer from prodigy.components.preprocess import add_tokens from prodigy.components.db import connect from prodigy.util import split_string import spacy from typing import List, Optional # Recipe decorator with argument annotations: (descripti...
tests/test_ping.py
naujoh/TorMySQL
340
50121
<reponame>naujoh/TorMySQL<filename>tests/test_ping.py #!/usr/bin/env python # encoding: utf-8 import uuid from tornado.testing import gen_test from . import BaseTestCase class TestPing(BaseTestCase): @gen_test def test1(self): with (yield self.pool.Connection()) as connection: yield connec...
effdet/config/train_config.py
phager90/efficientdet-pytorch
1,386
50131
from omegaconf import OmegaConf def default_detection_train_config(): # FIXME currently using args for train config, will revisit, perhaps move to Hydra h = OmegaConf.create() # dataset h.skip_crowd_during_training = True # augmentation h.input_rand_hflip = True h.train_scale_min = 0.1 ...
scripts/BuildTimes.py
grassofsky/llfio
356
50153
#!/usr/bin/python3 # Calculate boost.afio build times under various configs # (C) 2015 <NAME> # Created: 12th March 2015 #[ [`--link-test --fast-build debug`][][[footnote ASIO has a link error without `link=static`]][fails]] #[ [`--link-test debug`][][][]] #[ [`--link-test --lto debug`][[]][][]] ...
psiPerGene.py
CDZBIOSTU/SUPPA
176
50183
<filename>psiPerGene.py # -*- coding: utf-8 -*- """ Created on Fri May 23 10:17:33 2014 @author: <NAME> @email: <EMAIL> """ import sys import logging from argparse import ArgumentParser, RawTextHelpFormatter from lib.tools import * from lib.gtf_store import * description = \ "Description:\n\n" + \ "This to...
tests/urls.py
nkantar/django-distill
138
50196
from django.conf import settings from django.http import HttpResponse from django.urls import include, path from django.contrib.flatpages.views import flatpage as flatpage_view from django.apps import apps as django_apps from django_distill import distill_url, distill_path, distill_re_path def test_no_param_view(requ...
step32_elastic_file_storage/efs-with-lambda/Python/lambda/msg.py
fullstackwebdev/full-stack-serverless-cdk
192
50231
<filename>step32_elastic_file_storage/efs-with-lambda/Python/lambda/msg.py from __future__ import print_function import logging import os import json msg_file_path = '/mnt/msg/content' def handler(event, context): # request = event['requestContext'] # http = request['http'] method = event['requestContext...
src/skiptracer/plugins/who_call_id/__init__.py
EdwardDantes/skiptracer
912
50278
"""Whocallid.com search module""" from __future__ import print_function from __future__ import absolute_import from ..base import PageGrabber from ...colors.default_colors import DefaultBodyColors as bc import re import logging try: import __builtin__ as bi except BaseException: import builtins as bi class Wh...
superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py
m-ajay/superset
18,621
50286
# 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...
core/ocr/spaceocr.py
huihui7987/MillionHeroAssistant
672
50292
<filename>core/ocr/spaceocr.py<gh_stars>100-1000 # -*- coding: utf-8 -*- import json import requests """ ocr.space """ def get_text_from_image(image_data, api_key='<KEY>', overlay=False, language='chs'): """ CR.space API request with local file. :param image_data: image's base64 encoding. :par...
testdata/stamp_info.bzl
mgred/rules_docker
912
50294
<gh_stars>100-1000 # Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
genalog/text/lcs.py
jingjie181/genalog
185
50300
<filename>genalog/text/lcs.py # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # --------------------------------------------------------- class LCS: """ Compute the Longest Common Subsequence (LCS) of two give...
release/scripts/presets/camera/Samsung_Galaxy_S4.py
rbabari/blender
365
50315
<reponame>rbabari/blender import bpy bpy.context.camera.sensor_width = 4.8 bpy.context.camera.sensor_height = 3.6 bpy.context.camera.lens = 4.20 bpy.context.camera.sensor_fit = 'HORIZONTAL'
examples/datacenters.py
doziya/hpeOneView
107
50337
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP # # 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 limi...
medium/images/data_for_fitting.py
yull1860outlook/Data-Analysis
4,358
50362
<reponame>yull1860outlook/Data-Analysis def data_for_fitting(*, building_id, date): """ Retrieves data for fitting from the previous business day taking into account holidays """ lease_start = None while lease_start is None: # Previous business day according to Pandas (might be a holida...
python/ql/test/query-tests/Security/CWE-079/jinja2_escaping.py
vadi2/codeql
4,036
50412
Environment(loader=templateLoader, autoescape=fake_func()) from flask import Flask, request, make_response, escape from jinja2 import Environment, select_autoescape, FileSystemLoader, Template app = Flask(__name__) loader = FileSystemLoader( searchpath="templates/" ) unsafe_env = Environment(loader=loader) safe1_env...
moe/tests/bandit/__init__.py
dstoeckel/MOE
966
50446
# -*- coding: utf-8 -*- r"""Testing code for the (Python) bandit library. Testing is done via the Testify package: https://github.com/Yelp/Testify This package includes: * Test cases/test setup files * Tests for bandit/epsilon: :mod:`moe.tests.bandit.epsilon` * Tests for bandit/ucb: :mod:`moe.tests.bandit.ucb` * Tes...
terrascript/resource/drarko/mssql.py
mjuenema/python-terrascript
507
50502
# terrascript/resource/drarko/mssql.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:21:59 UTC) import terrascript class mssql_login(terrascript.Resource): pass __all__ = [ "mssql_login", ]
ouroboros/cmath.py
mewbak/ouroboros
205
50515
<reponame>mewbak/ouroboros<filename>ouroboros/cmath.py """ A pure python implementation of the standard module library cmath. """ import math " These are constants from float.h" _FLT_RADIX = 2 _DBL_MIN = 2.2250738585072014e-308 _DBL_MAX = 1.7976931348623157e+308 _DBL_EPSILON = 2.2204460492503131e-16 _DBL_MANT_DIG = 5...
anchore/cli/common.py
berez23/anchore
401
50541
<reponame>berez23/anchore<gh_stars>100-1000 import os import click import json import yaml import logging import sys from anchore import anchore_utils from anchore.cli import logs from anchore.util import contexts plain_output = False def extended_help_option(extended_help=None, *param_decls, **attrs): """ B...
recipes/Python/577826_Yet_Another_Ordered_Dictionary/recipe-577826.py
tdiprima/code
2,023
50551
# ordereddict.py # A dictionary that remembers insertion order # Tested under Python 2.7 and 2.6.6 only # # Copyright (C) 2011 by <NAME> <lukius at gmail dot com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
web/sales_app/apps/home/models.py
iabok/sales-tracker
163
50562
"""Base models"""
metrics/webnlg_challenge_2017/evaluator.py
HKUNLP/UnifiedSKG
191
50593
<gh_stars>100-1000 # encoding=utf8 import os from third_party.dart import extract_score_webnlg def evaluate_webnlg_challenge_2017(references_s, preds): """ The evaluation of the webnlg_challenge_2017, we use the evaluate shell that DART dataset provided. :param references_s: ACTUALLY, refer...
indra/sources/isi/__init__.py
zebulon2/indra
136
50608
<reponame>zebulon2/indra<filename>indra/sources/isi/__init__.py """ This module provides an input interface and processor to the ISI reading system. The reader is set up to run within a Docker container. For the ISI reader to run, set the Docker memory and swap space to the maximum. """ from .api import process_text,...
openbook_auth/apps.py
TamaraAbells/okuna-api
164
50626
from django.apps import AppConfig class OpenbookAuthConfig(AppConfig): name = 'openbook_auth'
lightbus/api.py
gcollard/lightbus
178
50627
from typing import Dict from lightbus.exceptions import ( UnknownApi, InvalidApiRegistryEntry, EventNotFound, MisconfiguredApiOptions, InvalidApiEventConfiguration, ) __all__ = ["Api", "Event"] class ApiRegistry: def __init__(self): self._apis: Dict[str, Api] = dict() def add(s...
cryptol-remote-api/python/tests/cryptol/test_basics.py
GaloisInc/cryptol
773
50657
import unittest from argo_client.interaction import ArgoException from pathlib import Path import unittest import io import os import time import cryptol import cryptol.cryptoltypes from cryptol.single_connection import * from cryptol.bitvector import BV from BitVector import * #type: ignore # Tests of the core serve...
opps/articles/search_indexes.py
jeanmask/opps
159
50661
# -*- coding: utf-8 -*- from datetime import datetime from django.conf import settings from haystack.indexes import Indexable from opps.containers.search_indexes import ContainerIndex from .models import Post, Album, Link migration_date = getattr(settings, 'MIGRATION_DATE', None) if migration_date: m_date = ...
tests/test_cases/test_array_simple/test_array_simple.py
lavanyajagan/cocotb
350
50675
<filename>tests/test_cases/test_array_simple/test_array_simple.py # Copyright cocotb contributors # Licensed under the Revised BSD License, see LICENSE for details. # SPDX-License-Identifier: BSD-3-Clause """Test getting and setting values of arrays""" import contextlib import logging import cocotb from cocotb.clock i...
recipes/Python/577810_Named_Values/recipe-577810.py
tdiprima/code
2,023
50689
class NamedValue: # defining __slots__ in a mixin doesn't play nicely with builtin types # so a low overhead approach would have to use collections.namedtuple # style templated code generation def __new__(cls, *args, **kwds): name, *args = args self = super().__new__(cls, *args, **kwds) ...
etc/pending_ugens/PulseDivider.py
butayama/supriya
191
50716
import collections from supriya.enums import CalculationRate from supriya.synthdefs import UGen class PulseDivider(UGen): """ :: >>> pulse_divider = supriya.ugens.PulseDivider.ar( ... div=2, ... start=0, ... trigger=0, ... ) >>> pulse_divider ...
concepts/listChunking.py
sixtysecondrevit/dynamoPython
114
50736
""" LIST: CHUNKING """ __author__ = '<NAME> - <EMAIL>' __twitter__ = '@solamour' __version__ = '1.0.0' # Example of Chunking (Grouping an item with its next) def chunks(list, number): # Requires a list and a number for index in range(0, len(list), number): # For every # index inside of a number range st...
src/badgr/datasets/dataset.py
KaiW-53/badgr
110
50749
<filename>src/badgr/datasets/dataset.py class Dataset(object): def __init__(self, env_spec): self._env_spec = env_spec def get_batch(self, batch_size, horizon): raise NotImplementedError def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True): raise No...
gulp_version.py
FelixBoers/sublime-gulp
138
50757
<gh_stars>100-1000 import re # Workaround for Windows ST2 not having disutils try: from distutils.version import LooseVersion except: # From distutils/version.py class LooseVersion(): component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE) def __init__ (self, vstring=None): ...
pennylane/debugging.py
therooler/pennylane
539
50766
<filename>pennylane/debugging.py # Copyright 2018-2022 Xanadu Quantum Technologies 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 # Unl...
Covid India Stats App/app.py
avinashkranjan/PraticalPythonProjects
930
50807
import json from flask import Flask, request import requests # Token that has to be generated from webhook page portal ACCESS_TOKEN = "random <PASSWORD>" # Token that has to be added for verification with developer portal VERIFICATION_TOKEN = "abc" # Identifier payloads for initial button C19INDIA = "C19INDIA" app = Fl...
core_scripts/startup_config.py
Nijta/project-NN-Pytorch-scripts
150
50813
<gh_stars>100-1000 #!/usr/bin/env python """ startup_config Startup configuration utilities """ from __future__ import absolute_import import os import sys import torch import importlib import random import numpy as np __author__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2020, Xin Wang" def set_...
tests/test_auth.py
matrixorz/firefly
247
50818
<filename>tests/test_auth.py # coding=utf-8 from __future__ import absolute_import from flask import url_for from flask_login import current_user import pytest from firefly.models.user import User @pytest.mark.usefixtures('client_class') class TestAuth: def setup(self): self.username = 'foo' sel...
genomepy/plugins/__init__.py
tilschaef/genomepy
146
50846
<reponame>tilschaef/genomepy """Plugin class, modules & related functions""" import os import re from genomepy.config import config __all__ = ["Plugin", "manage_plugins", "get_active_plugins"] class Plugin: """Plugin base class.""" def __init__(self): self.name = convert(type(self).__name__).replac...
scripts/loss.py
headupinclouds/LightNet
737
50865
from torch.autograd import Variable import torch.nn.functional as F import scripts.utils as utils import torch.nn as nn import numpy as np import torch class CrossEntropy2d(nn.Module): def __init__(self, size_average=True, ignore_label=255): super(CrossEntropy2d, self).__init__() self.size_average...
examples/demo_DDPG_TD3_SAC.py
Yonv1943/DL_RL_Zoo
129
50869
<gh_stars>100-1000 <<<<<<< HEAD import sys import gym from elegantrl.train.run import train_and_evaluate, train_and_evaluate_mp from elegantrl.train.config import Arguments from elegantrl.agents.AgentDDPG import AgentDDPG from elegantrl.agents.AgentTD3 import AgentTD3 from elegantrl.agents.AgentSAC import Agent...
alipay/aop/api/domain/AlipayEcoTextDetectModel.py
antopen/alipay-sdk-python-all
213
50897
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.SpiDetectionTask import SpiDetectionTask class AlipayEcoTextDetectModel(object): def __init__(self): self._task = None @property def task(self): retu...
src/python/fsqio/pants/wiki/subsystems/confluence_subsystem.py
jglesner/fsqio
252
50907
<gh_stars>100-1000 # coding=utf-8 # Copyright 2019 Foursquare Labs Inc. All Rights Reserved. from __future__ import absolute_import, division, print_function, unicode_literals import urllib from pants.subsystem.subsystem import Subsystem from pants.util.memo import memoized_property class ConfluenceSubsystem(Subsy...
lightnion/http/ntor.py
pthevenet/lightnion
120
50915
import lightnion as lnn import nacl.public import base64 def hand(guard, encode=True): identity = base64.b64decode(guard['router']['identity'] + '====') onion_key = base64.b64decode(guard['ntor-onion-key'] + '====') ephemeral_key, payload = lnn.crypto.ntor.hand(identity, onion_key) if encode: ...
core/wsgi.py
vlafranca/stream_framework_example
102
50928
""" WSGI config for pinterest_example project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") from django...
train.py
thinkreed/ECBSR
162
50941
import torch import torch.nn as nn import torch.nn.functional as F from datas.benchmark import Benchmark from datas.div2k import DIV2K from models.ecbsr import ECBSR from torch.utils.data import DataLoader import math import argparse, yaml import utils import os from tqdm import tqdm import logging import sys import ti...
research/cgroups.py
chuongmep/rhino.inside-revit
166
50953
"""Group Revit built-in categories logically and output the data in json The built-in categories are provided in text files under DATA_DIR Usage: python3 ./cgroups.py group and output categories python3 ./cgroups.py <catname> group and output <catname> category only """ # pylint: disable=bad-c...
scripts/undistort_h36m.py
yihui-he2020/epipolar-transformers
360
50970
if __name__ == '__main__' and __package__ is None: import sys from os import path sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) )) import os import torch from utils.model_serialization import strip_prefix_if_present from utils import zipreader import argparse from tqdm import tqdm i...
bigquery_schema_generator/anonymize.py
ZiggerZZ/bigquery-schema-generator
170
50990
#!/usr/bin/env python3 # # 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...
src/utils.py
teddykoker/image-gpt
196
50993
<filename>src/utils.py import torch def squared_euclidean_distance(a, b): b = torch.transpose(b, 0, 1) a2 = torch.sum(torch.square(a), dim=1, keepdims=True) b2 = torch.sum(torch.square(b), dim=0, keepdims=True) ab = torch.matmul(a, b) d = a2 - 2 * ab + b2 return d def quantize(x, centroids):...
python-packages/middlewares/test/__init__.py
bryan-liu-nova/ZRXFork
1,075
51025
"""Tests of zero_x.middlewares."""
plans/migrations/0005_recurring_payments.py
feedgurus/django-plans
240
51054
<gh_stars>100-1000 # Generated by Django 3.0.5 on 2020-04-15 07:32 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('plans', '0004_create_user_plans'), ] operations = [ migrations.AddField( mod...
terrascript/resource/terraform_provider_graylog/graylog.py
mjuenema/python-terrascript
507
51077
# terrascript/resource/terraform-provider-graylog/graylog.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:17:31 UTC) import terrascript class graylog_alarm_callback(terrascript.Resource): pass class graylog_alert_condition(terrascript.Resource): pass class graylog_dashboard(terrascript.R...
projects/ABDNet/eval_acc.py
Danish-VSL/deep-person-reid
244
51142
from __future__ import print_function from __future__ import division import os import sys import time import datetime import os.path as osp import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn from torch.optim import lr_scheduler from args import...
traceback_with_variables/global_hooks.py
cclauss/traceback_with_variables
550
51147
import sys from typing import NoReturn, Optional, Type from traceback_with_variables.print import print_exc, Format def global_print_exc(fmt: Optional[Format] = None) -> NoReturn: sys.excepthook = lambda e_cls, e, tb: print_exc(e=e, fmt=fmt) def global_print_exc_in_ipython(fmt: Optional[Format] = Non...
v2/backend/admin/__init__.py
jonfairbanks/rtsp-nvr
558
51159
<gh_stars>100-1000 from backend.magic import Bundle from .macro import macro from .model_admin import ModelAdmin admin_bundle = Bundle(__name__)
umqtt.robust/example_sub_robust.py
Carglglz/micropython-lib
1,556
51197
import time from umqtt.robust import MQTTClient def sub_cb(topic, msg): print((topic, msg)) c = MQTTClient("umqtt_client", "localhost") # Print diagnostic messages when retries/reconnects happens c.DEBUG = True c.set_callback(sub_cb) # Connect to server, requesting not to clean session for this # client. If the...
utils/ProcessorsScheduler.py
Leo-xxx/NeuronBlocks
1,257
51213
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import multiprocessing from multiprocessing import cpu_count import math class ProcessorsScheduler(object): process_num = cpu_count() def __init__(self, cpu_num_workers=None): if cpu_num_workers != None and ...
stp_zmq/authenticator.py
andkononykhin/plenum
148
51224
import sys import asyncio import zmq import zmq.asyncio from zmq.auth import Authenticator from zmq.auth.thread import _inherit_docstrings, ThreadAuthenticator, \ AuthenticationThread # Copying code from zqm classes since no way to inject these dependencies class MultiZapAuthenticator(Authenticator): """ ...
pysph/tools/tests/test_mesh_tools.py
nauaneed/pysph
293
51227
import numpy as np import unittest import pytest from pysph.base.particle_array import ParticleArray import pysph.tools.mesh_tools as G from pysph.base.utils import get_particle_array # Data of a unit length cube def cube_data(): points = np.array([[0., 0., 0.], [0., 1., 0.], ...
mode/examples/Topics/AdvancedData/LoadSaveTable/Bubble.py
timgates42/processing.py
1,224
51277
<filename>mode/examples/Topics/AdvancedData/LoadSaveTable/Bubble.py<gh_stars>1000+ # A Bubble class class Bubble(object): # Create the Bubble def __init__(self, x, y, diameter, name): self.x = x self.y = y self.diameter = diameter self.name = name self.over...
etw/evntprov.py
tyh2333/pywintrace
247
51307
<filename>etw/evntprov.py ######################################################################## # Copyright 2017 FireEye 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:/...
bindings/python/py_src/tokenizers/tools/visualizer.py
AnubhabB/tokenizers
5,620
51357
import os import itertools import re from typing import List, Optional, Tuple, Dict, Callable, Any, NamedTuple from string import Template from typing import List from tokenizers import Tokenizer, Encoding dirname = os.path.dirname(__file__) css_filename = os.path.join(dirname, "visualizer-styles.css") with open(css_...
core/argo/core/network/s-vae/hyperspherical_vae/ops/ive.py
szokejokepu/natural-rws
164
51366
# Copyright 2016 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
py/mistql/cli.py
evinism/millieql
263
51373
<reponame>evinism/millieql #!/usr/bin/env python3 from typing import Union import argparse from mistql import __version__ from mistql import query import sys import json import logging log = logging.getLogger(__name__) parser = argparse.ArgumentParser( description="CLI for the python MistQL query language implem...
malib/algorithm/common/__init__.py
ReinholdM/play_football_with_human
258
51411
<filename>malib/algorithm/common/__init__.py """ __init__.py @Organization: @Author: <NAME> @Time: 4/22/21 5:28 PM @Function: """
python/pyspark_hbase/sql/context.py
CrazyZero1/astro
365
51413
# # 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 us...
art/estimators/poison_mitigation/strip/__init__.py
monshri/adversarial-robustness-toolbox
1,350
51414
""" STRIP estimators. """ from art.estimators.poison_mitigation.strip.strip import STRIPMixin
backend/db/friend.py
sleepingAnt/viewfinder
645
51428
# Copyright 2012 Viewfinder Inc. All Rights Reserved. """Friend relation. Viewfinder friends define a relationship between two users predicated on confirmation of photo sharing permission. Each friend has an associated 'status', which can be: - 'friend': user has been marked as a friend; however, that user may no...
samples/vsphere/contentlibrary/vmtemplate/create_vm_template.py
restapicoding/VMware-SDK
589
51445
<reponame>restapicoding/VMware-SDK #!/usr/bin/env python """ * ******************************************************* * Copyright VMware, Inc. 2017-2018. All Rights Reserved. * SPDX-License-Identifier: MIT * ******************************************************* * * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS...
test/jpypetest/test_sql_generic.py
pitmanst/jpype
531
51460
# This file is Public Domain and may be used without restrictions. import _jpype import jpype from jpype.types import * from jpype import java import jpype.dbapi2 as dbapi2 import common import time try: import zlib except ImportError: zlib = None class SQLModuleTestCase(common.JPypeTestCase): def setUp(...
demo/evaluation/SP_GoogLeNet.py
ntoussaint/SPN.pytorch
228
51497
<reponame>ntoussaint/SPN.pytorch<filename>demo/evaluation/SP_GoogLeNet.py<gh_stars>100-1000 import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function, Variable from torch.utils.serialization import load_lua from spn import SoftProposal, SpatialSumOverMap, hook_spn, unh...
test/core/derivatives/implementation/backpack.py
jabader97/backpack
395
51527
"""Contains derivative calculation with BackPACK.""" from test.core.derivatives.implementation.base import DerivativesImplementation from test.utils import chunk_sizes from typing import List from torch import Tensor, einsum, zeros from backpack.utils.subsampling import subsample class BackpackDerivatives(Derivativ...
src/genie/libs/parser/iosxe/tests/ShowIsisHostname/cli/equal/golden_output_expected.py
balmasea/genieparser
204
51601
expected_output = { "tag": { "VRF1": { "hostname_db": { "hostname": { "7777.77ff.eeee": {"hostname": "R7", "level": 2}, "2222.22ff.4444": {"hostname": "R2", "local_router": True}, } } }, "test": {...
Sources/Workflows/ONE「一个」/one.py
hzlzh/AlfredWorkflow.com
2,177
51618
<gh_stars>1000+ #!/usr/bin/python #coding=utf-8 # # # Copyright (c) 2016 fusijie <<EMAIL>> # # MIT Licence. See http://opensource.org/licenses/MIT # # Created on 2016-04-22 # import sys import os from workflow import Workflow, web reading_url = 'http://v3.wufazhuce.com:8000/api/reading/index' essay_url_prefix = 'http...