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 |
|---|---|---|---|---|
scripts/load_linux.py | checkra1n/PongoKit | 114 | 11086045 | <filename>scripts/load_linux.py<gh_stars>100-1000
#!/usr/bin/env python3
import usb.core
import struct
import sys
import argparse
import time
parser = argparse.ArgumentParser(description='A little Linux kernel/initrd uploader for pongoOS.')
parser.add_argument('-k', '--kernel', dest='kernel', help='path to kernel ima... |
securityheaders/checkers/cors/allowcredentials/__init__.py | th3cyb3rc0p/securityheaders | 151 | 11086055 | <reponame>th3cyb3rc0p/securityheaders
from .checker import AccessControlAllowCredentialsChecker
__all__ = ['AccessControlAllowCredentialsChecker']
|
proplot/internals/context.py | lukelbd/panplot | 633 | 11086056 | <reponame>lukelbd/panplot<gh_stars>100-1000
#!/usr/bin/env python3
"""
Utilities for manging context.
"""
from . import ic # noqa: F401
class _empty_context(object):
"""
A dummy context manager.
"""
def __init__(self):
pass
def __enter__(self):
pass
def __exit__(self, *args)... |
captcha/tests/__init__.py | shaoyh/django-simple-captcha | 108 | 11086065 | # -*- coding: utf-8 -*-
from captcha.conf import settings
from captcha.models import CaptchaStore
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers im... |
hand_eye_calibration/bin/bag_to_csv_with_config.py | Chatoyant19/handeye_calibration | 333 | 11086129 | <filename>hand_eye_calibration/bin/bag_to_csv_with_config.py
#!/usr/bin/env python
from subprocess import call
import argparse
import copy
import rospy
import yaml
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--yaml_config_file', required=True,
... |
L1Trigger/Configuration/python/L1DummyConfig_cff.py | ckamtsikis/cmssw | 852 | 11086166 | <filename>L1Trigger/Configuration/python/L1DummyConfig_cff.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# for backwards compatibility
from L1Trigger.Configuration.L1Trigger_FakeConditions_cff import *
|
gwd/eda/submission.py | kazakh-shai/kaggle-global-wheat-detection | 136 | 11086177 | <reponame>kazakh-shai/kaggle-global-wheat-detection
import argparse
import os
import os.path as osp
import cv2
import numpy as np
import pandas as pd
from tqdm import tqdm
from gwd.eda.visualization import draw_bounding_boxes_on_image
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(... |
tests/bytecode/mp-tests/fun4.py | LabAixBidouille/micropython | 303 | 11086195 | def f(a, b=1, *c, d):
pass
#print(a,b,c,d) # bug in uPy!
f = lambda a, b, *c, d: None # default arg
#f = lambda a, b=1, *c, d: None # default arg for lambda not implemented
|
PyEngine3D/Render/Light.py | ubuntunux/PyEngine3D | 121 | 11086216 | <reponame>ubuntunux/PyEngine3D
import numpy as np
from PyEngine3D.Utilities import *
from PyEngine3D.Common import logger
from PyEngine3D.Common.Constants import *
from PyEngine3D.App import CoreManager
from .Actor import StaticActor
class MainLight(StaticActor):
def __init__(self, name, **object_data):
... |
packages/Python/lldbsuite/test/lang/swift/playgrounds-repl/two_valid_inputs/TestTwoValidInputs.py | xiaobai/swift-lldb | 765 | 11086228 | # TestTwoValidBlocks.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTR... |
mmdet/utils/collect_env.py | Karybdis/mmdetection-mini | 834 | 11086232 | <filename>mmdet/utils/collect_env.py
from mmdet.cv_core.utils.env import collect_env as collect_base_env
def collect_env():
"""Collect the information of the running environments."""
env_info = collect_base_env()
return env_info
if __name__ == '__main__':
for name, val in collect_env().items():
... |
nuplan/planning/metrics/evaluation_metrics/common/ego_jerk.py | motional/nuplan-devkit | 128 | 11086251 | from typing import List
from nuplan.planning.metrics.evaluation_metrics.base.within_bound_metric_base import WithinBoundMetricBase
from nuplan.planning.metrics.metric_result import MetricStatistics
from nuplan.planning.metrics.utils.state_extractors import extract_ego_jerk
from nuplan.planning.scenario_builder.abstrac... |
comcrawl/core/__init__.py | akozlo/comcrawl | 118 | 11086254 | <reponame>akozlo/comcrawl
"""This module exports the core class of the package."""
from .index_client import IndexClient
|
tools/gen_label_video_source.py | Xlsean/X-Temporal | 492 | 11086282 | <reponame>Xlsean/X-Temporal
import os
from decord import VideoReader
from decord import cpu
if __name__ == '__main__':
root_dir = '' # video data root path
dataset_name = 'hmdb51'
with open(os.path.join('../datasets', dataset_name, 'category.txt')) as f:
lines = f.readlines()
categories = []
... |
rdkit/Chem/MolKey/UnitTestMolKey.py | kazuyaujihara/rdkit | 1,609 | 11086287 | <reponame>kazuyaujihara/rdkit
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
import doctest
import unittest
from rdkit.Chem import inchi
from rd... |
upvote/gae/taskqueue/utils_test.py | iwikmai/upvote | 453 | 11086292 | <reponame>iwikmai/upvote<filename>upvote/gae/taskqueue/utils_test.py<gh_stars>100-1000
# Copyright 2017 Google 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 a copy of the License at
#
# ... |
aliyun/log/logresponse.py | topdown618/aliyun-log-python-sdk | 130 | 11086293 | #!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
from .util import Util
class LogResponse(object):
""" The base response class of all log response.
:type headers: dict
:param headers: HTTP response header
"""
def __init... |
demo/hermite_poisson2D.py | spectralDNS/shenfun | 138 | 11086362 | r"""
Solve Poisson equation in 2D with homogeneous Dirichlet bcs in one direction and
periodic in the other. The domain is (-inf, inf) x [0, 2pi]
.. math::
\nabla^2 u = f,
The equation to solve for a Hermite x Fourier basis is
.. math::
(\nabla u, \nabla v) = -(f, v)
"""
import os
import sys
from sympy i... |
python/akg/ops/math/__init__.py | tianjiashuo/akg | 286 | 11086374 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
apps/autotest/run.py | rainydaygit/testtcloudserver | 349 | 11086393 | from apps.autotest.settings import config
from apps.autotest.views.performance import performance
if config.SERVER_ENV != 'dev':
from gevent import monkey
monkey.patch_all()
else:
pass
from apps.autotest.views.datashow import datashow
from apps.autotest.views.monkey import monkey
from library.api.tFlask ... |
diffy_api/tasks/views.py | TheGableMethod/diffy | 577 | 11086420 | """
.. module: diffy.tasks.views
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from flask import Blueprint
from flask_restful import Api, Resource
from diffy_api.extensions import rq
from dif... |
cross3d/abstract/abstractuserprops.py | vedantirb/cross3d | 129 | 11086434 | # #
# \namespace cross3d.UserProps
#
# \remarks The cross3d.UserProps package creates an abstract wrapper from a 3d system
# to use storing and retreiving custom user props
#
# \author mike
# \author Blur Studio
# \date 05/26/11
#
import re
import json
import cross3d
from collections import O... |
Chapter09/mandelbrot/mandelbrot/simple/__init__.py | yoyboy/Software-Architecture-with-Python | 103 | 11086444 | <gh_stars>100-1000
from . import mandelbrot
|
test/test_application/test_jsonrpc/test_getblock.py | darosior/spruned | 152 | 11086467 | <reponame>darosior/spruned
import asyncio
import random
from unittest import TestCase
from unittest.mock import Mock, call
from spruned.application.jsonrpc_server import JSONRPCServer
from spruned.application.utils.jsonrpc_client import JSONClient
from test.utils import async_coro
class TestJSONRPCServerGetblock(Test... |
tests/config/__init__.py | dadaloop82/viseron | 399 | 11086485 | <filename>tests/config/__init__.py
"""Tests for config module."""
|
tests/test_init.py | linshoK/pysen | 423 | 11086494 | <reponame>linshoK/pysen
import argparse
import pathlib
import tempfile
import unittest.mock
from typing import Optional, Sequence
import pytest
import pysen
from pysen import ConfigureLintOptions, configure_lint
from pysen.exceptions import CommandNotFoundError
from pysen.manifest import Manifest, TargetType
from pys... |
classifiers/dimensionality_reduction/graph_spectral_analysis&spectral_clustering_default.py | gionanide/Speech-Signal-Processing-and-Classification | 203 | 11086496 | <filename>classifiers/dimensionality_reduction/graph_spectral_analysis&spectral_clustering_default.py
#!usr/bin/python
from __future__ import division
import pandas as pd
from sklearn import model_selection
from sklearn.svm import SVC # supportctors for classification
from sklearn.metrics import accuracy_score, confusi... |
fairseq/models/wav2vec.py | theorm/fairseq | 239 | 11086497 | # 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 sys
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import (
BaseFairseqModel, register_mo... |
steam/client/builtins/friends.py | tjensen/steam | 727 | 11086502 | <reponame>tjensen/steam<gh_stars>100-1000
import logging
from six import itervalues
from eventemitter import EventEmitter
from steam.steamid import SteamID, intBase
from steam.enums import EResult, EFriendRelationship
from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto
from steam.client.user import St... |
src/smart_compose/run_smart_compose.py | StarWang/detext | 1,229 | 11086512 | <gh_stars>1000+
import sys
import tempfile
from dataclasses import asdict
import tensorflow as tf
from absl import logging
from official.utils.misc import distribution_utils
from smart_compose.args import SmartComposeArg
from smart_compose.train import train
from smart_compose.utils import distributed_utils, parsing_... |
wargames/overthewire-vortex/level6/win.py | spchal/pwntools-write-ups | 456 | 11086514 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pwn import *
level = 6
host = 'vortex.labs.overthewire.org'
user = 'vortex%i' % level
chal = 'vortex%i' % level
password = args['PASSWORD']
passfile = '/etc/vortex_pass/<PASSWORD>' % (level+1)
binary = '/vortex/%s' % chal
shell = ssh(host=host, u... |
service/generated_flatbuffers/tflite/LSTMOptions.py | lcrh/falken | 213 | 11086521 | <gh_stars>100-1000
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
tests/conftest.py | cclauss/aiofile | 311 | 11086554 | <filename>tests/conftest.py
from functools import partial
import pytest
from caio import python_aio_asyncio
from aiofile import AIOFile, async_open
try:
from caio import thread_aio_asyncio
except ImportError:
thread_aio_asyncio = None
try:
from caio import linux_aio_asyncio
except ImportError:
linu... |
src/lib/utils/stress_test/.s/python/lib/python3.6/site-packages/zmq/backend/cffi/message.py | devsapp/fc-stress-desktop | 603 | 11086556 | <gh_stars>100-1000
"""Dummy Frame object"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import errno
from threading import Event
from ._cffi import ffi, lib as C
from .constants import ETERM
import zmq
from zmq.utils.strtypes import unicode
import zmq.error
zmq_gc =... |
nbs/live_streams/Exploring the fastai Callback System/utils.py | sakibsadmanshajib/walkwithfastai.github.io | 104 | 11086604 | # This source code is directly from goralpl's Seq2Seq example, which we worked on debugging together https://github.com/goralpl/learning_fastai/blob/master/seq2seq_fastai_datablocks_custom_model.ipynb
from fastai.text.all import *
__all__ = ['build_dls', 'Seq2Seq']
def build_dls():
valid_jsons = [
{"... |
tests/mxnet/mnist_gluon_model.py | sophiayue1116/sagemaker-debugger | 133 | 11086686 | # Using batch size 4 instead of 1024 decreases runtime from 35 secs to 4 secs.
# Standard Library
import time
# Third Party
import mxnet as mx
import numpy as np
from mxnet import autograd, gluon, init
from mxnet.gluon import nn
from mxnet.gluon.data.vision import datasets, transforms
# First Party
from smdebug impo... |
splitwise/user.py | aayaffe/splitwise | 105 | 11086702 | from splitwise.picture import Picture
from splitwise.balance import Balance
import splitwise.group as Group
class User(object):
""" Contains basic user data.
Attributes:
id(long, optional): ID of the user
first_name(str, optional): First name of the user
last_name(str, optional): Last... |
tests/test_config_management.py | jakuta-tech/trackerjacker | 2,245 | 11086708 | # pylint: disable=C0111, C0413, C0103, E0401
import unittest
import trackerjacker.config_management as cm
class TestParseWatchList(unittest.TestCase):
def test_list_basic(self):
# Test basic MAC-only string
test1 = 'aa:bb:cc:dd:ee:ff'
parsed = cm.parse_command_line_watch_list(test1)
... |
pyshtools/constants/__init__.py | mjc87/SHTOOLS | 251 | 11086742 | """
pyshtools constants.
This subpackage defines several constants used in analyzing gravity,
topography, and magnetic field data of the terrestrial planets. The constants
are organized by planet, and each object is an astropy Constant that possesses
the attributes name, value, unit, uncertainty, and reference. These ... |
recipes/Python/580733_Reverse_sequence_annotations_PDF/recipe-580733.py | tdiprima/code | 2,023 | 11086754 | <reponame>tdiprima/code
import fitz
doc = fitz.open("some.pdf") # open pdf
page = doc[n] # open the page (0-based number)
rtab = [] # store all rectangles here
annot = page.firstAnnot # read first annotation
while annot:
rtab.append(annot.rect) # store rectangle... |
corehq/apps/users/migrations/0020_user_staging_pk_to_bigint.py | dimagilg/commcare-hq | 471 | 11086771 | # Generated by Django 2.2.13 on 2020-07-27 11:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0019_editreportspermissions'),
]
operations = [
migrations.AlterField(
model_name='userreportingmetadatastaging',
... |
build/scripts/extract_jacoco_report.py | HeyLey/catboost | 6,989 | 11086784 | <filename>build/scripts/extract_jacoco_report.py
import argparse
import os
import re
import tarfile
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--archive', action='store')
parser.add_argument('--source-re', action='store')
parser.add_argument('--destination', ac... |
postprocessing/CalculateFrequency.py | mathreader/DeepKoopman | 199 | 11086795 | <gh_stars>100-1000
import numpy as np
from scipy.special import factorial2
from scipy.special import factorial
def kfn(theta0):
return np.sin(np.float64(theta0) / 2)
def periodTerm(n, k):
numerator = np.float64((factorial2(2 * n - 1)) ** 2)
denominator = np.float64((2 ** n) * factorial(n) * factorial2(2... |
pygmt/clib/loading.py | jbusecke/pygmt | 326 | 11086798 | """
Utility functions to load libgmt as ctypes.CDLL.
The path to the shared library can be found automatically by ctypes or set
through the GMT_LIBRARY_PATH environment variable.
"""
import ctypes
import os
import subprocess as sp
import sys
from ctypes.util import find_library
from pathlib import Path
from pygmt.exc... |
utils/timeout.py | Mattlk13/dd-agent | 1,172 | 11086822 | <gh_stars>1000+
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from datadog_checks.utils.timeout import ( # noqa F401
TimeoutException,
ThreadMethod,
timeout
)
|
rpython/jit/backend/ppc/callbuilder.py | m4sterchain/mesapy | 381 | 11086830 | <gh_stars>100-1000
from rpython.jit.backend.ppc.arch import IS_PPC_64, WORD, PARAM_SAVE_AREA_OFFSET
from rpython.jit.backend.ppc.arch import THREADLOCAL_ADDR_OFFSET
import rpython.jit.backend.ppc.register as r
from rpython.jit.metainterp.history import INT, FLOAT
from rpython.jit.backend.llsupport.callbuilder import Ab... |
corehq/apps/data_interfaces/dispatcher.py | akashkj/commcare-hq | 471 | 11086839 | from django.utils.decorators import method_decorator
from django_prbac.utils import has_privilege
from corehq import privileges
from corehq.apps.accounting.decorators import requires_privilege_with_fallback
from corehq.apps.reports.dispatcher import ReportDispatcher, datespan_default
from corehq.apps.users.decorators... |
cooler/api.py | mimakaev/cooler | 106 | 11086873 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import simplejson as json
import six
import os
from pandas.api.types import is_integer_dtype
from scipy.sparse import coo_matrix
import numpy as np
import pandas as pd
import h5py
from .core import (
get,
region_to_offset... |
micropsi_core/tests/test_runtime_monitors.py | joschabach/micropsi2 | 119 | 11086884 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Basic tests for monitor api
"""
import pytest
from micropsi_core import runtime as micropsi
def test_add_gate_monitor(fixed_nodenet):
uid = micropsi.add_gate_monitor(fixed_nodenet, 'n0001', 'gen', sheaf='default')
monitor = micropsi.nodenets[fixed_nodenet].... |
pgoapi/protos/POGOProtos/Data/Gym_pb2.py | neoz/pgoapi | 1,457 | 11086895 | <gh_stars>1000+
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos.Data.Gym.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.protobuf... |
scripts/GenerateFeedback.py | AustinHartman/shasta | 267 | 11086909 | #!/usr/bin/python3
import configparser
import sys
import getopt
import json
import csv
helpMessage = """
Usage:
GenerateFeedback.py --assemblyDirectory /path/to/assemblyDirectory
Note: The goal of this script is to provide feedback on a de novo assembly done using the
Shasta long read assembler.
Each genome is ... |
2021/day_19.py | salt-die/Advent-of-Code | 105 | 11086923 | from itertools import product
import cv2
import numpy as np
import aoc_helper
from aoc_helper.utils import extract_ints
class Scanner:
def __init__(self, coords):
self.coords = coords
self.distances = np.array(
list(map(set, np.linalg.norm(coords[:, None] - coords[None], axis=-1)))
... |
frameworks/cassandra/tests/test_sanity.py | iss-lab/dcos-commons | 201 | 11086937 | import pytest
import logging
from typing import Any, Dict, Iterator, List
import sdk_cmd
import sdk_hosts
import sdk_install
import sdk_jobs
import sdk_metrics
import sdk_networks
import sdk_plan
import sdk_service
import sdk_tasks
import sdk_upgrade
from tests import config
log = logging.getLogger(__name__)
@pyt... |
src/models/convolutional_encoder.py | roberthoenig/VQ-VAE-Speech | 241 | 11086950 | <gh_stars>100-1000
#####################################################################################
# MIT License #
# #
# Copyright (C) 2019 <NAME> ... |
tests/errors/semantic/blocking/CONST_ASSIGNED_ARGUMENT2.py | dina-fouad/pyccel | 206 | 11086955 | # pylint: disable=missing-function-docstring, missing-module-docstring/
#$ header function array_int32_1d_add_const(const int32[:], int32[:])
def array_int32_1d_add_const( x, y ):
x[:] += y
|
Bit Manipulation/next power of 2/python/nextpowOf2.py | iabhimanyu/Algorithms | 715 | 11086960 | def nextPowOf2(n):
p = 1
if (n and not(n & (n - 1))):
return n
while (p < n) :
p <<= 1
return p;
t = int(input())
for i in range(t):
n= int(input())
print("Next Power of 2 " + nextPowOf2(n))
|
core/downloaders/deluge.py | rikbarker/watcher | 194 | 11086996 | import logging
import json
import urllib2
import zlib
from lib.deluge_client import DelugeRPCClient
import core
from core.helpers import Torrent, Url
logging = logging.getLogger(__name__)
class DelugeRPC(object):
@staticmethod
def test_connection(data):
''' Tests connectivity to deluge daemon rpc
... |
fatiando/gridder/__init__.py | XuesongDing/fatiando | 179 | 11087031 | """
Create and operate on data grids, scatters, and profiles.
"""
from __future__ import absolute_import
from .slicing import inside, cut
from .interpolation import interp, interp_at, profile
from .padding import pad_array, unpad_array, pad_coords
from .point_generation import regular, scatter, circular_scatter
from .u... |
loss/IQA/gmsd.py | milesgray/CALAE | 203 | 11087034 | import torch
from torch import nn
from torch.nn import functional as F
import numpy as np
from torchvision import transforms
class GMSD(nn.Module):
# Refer to http://www4.comp.polyu.edu.hk/~cslzhang/IQA/GMSD/GMSD.htm
def __init__(self, channels=3):
super(GMSD, self).__init__()
self.channels = ... |
components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/agent.py | TanJay/stratos | 127 | 11087040 | #!/usr/bin/env python
# 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
# "Li... |
semanticpy/transform/transform.py | thecapacity/semanticpy | 116 | 11087048 | <reponame>thecapacity/semanticpy<filename>semanticpy/transform/transform.py
from semanticpy.matrix_formatter import MatrixFormatter
from scipy import array
class Transform:
def __init__(self, matrix):
self.matrix = array(matrix, dtype=float)
def __repr__(self):
MatrixFormatter(self.matrix).pre... |
challenges/iccv21-mfr/dataset_mask.py | qaz734913414/insightface | 12,377 | 11087053 | import numbers
import os
import queue as Queue
import threading
import mxnet as mx
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
from insightface.app import MaskAugm... |
3rd_party/occa/scripts/docs/api_docgen/file_parser.py | RonRahaman/nekRS | 312 | 11087072 | <filename>3rd_party/occa/scripts/docs/api_docgen/file_parser.py
'''
Parse doxygen output files
'''
from typing import Any, Dict, List, Tuple
from .types import *
from .system_commands import *
def alias_path(path: str,
node_id: str,
ordered_path_aliases: List[Tuple[str, str]]) -> Tuple[... |
haproxyadmin/frontend.py | jrassier/haproxyadmin | 104 | 11087094 | # -*- coding: utf-8 -*-
#
# pylint: disable=superfluous-parens
#
"""
haproxyadmin.frontend
~~~~~~~~~~~~~~~~~~~~~
This module provides the :class:`Frontend <.Frontend>` class. This class can
be used to run operations on a frontend and retrieve statistics.
"""
from haproxyadmin.utils import (calculate, cmd_across_all_p... |
cinder/api/v3/views/attachments.py | lightsey/cinder | 571 | 11087095 | # 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, software
# d... |
server.py | ivaylo-iliev/play-with-mpv | 254 | 11087138 | #!/usr/bin/env python
# Plays MPV when instructed to by a chrome extension =]
import sys
from subprocess import Popen
from shutil import which
PORT = 7531
# Use --public if you want the server and extension on different computers
hostname = 'localhost'
if '--public' in sys.argv:
hostname = '0.0.0.0'
if sys.versi... |
platform/coredb/coredb/models/artifacts.py | admariner/polyaxon | 3,200 | 11087139 | <reponame>admariner/polyaxon<gh_stars>1000+
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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/LI... |
mlcomp/db/providers/dag_storage.py | sUeharaE4/mlcomp | 166 | 11087149 | <reponame>sUeharaE4/mlcomp<filename>mlcomp/db/providers/dag_storage.py<gh_stars>100-1000
from mlcomp.db.models import DagStorage, File, DagLibrary
from mlcomp.db.providers.base import BaseDataProvider
class DagStorageProvider(BaseDataProvider):
model = DagStorage
def by_dag(self, dag: int):
query = s... |
transformer_courses/BERT_distillation/PaddleSlim-develop/paddleslim/common/rl_controller/__init__.py | wwhio/awesome-DeepLearning | 1,150 | 11087189 | # Copyright (c) 2020 PaddlePaddle 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 applic... |
mmdet/models/dense_heads/obb/odm_head.py | voinSR/OBBDetection | 274 | 11087205 | import torch
from mmcv.cnn import ConvModule, normal_init, bias_init_with_prob
from mmdet.ops.orn import ORConv2d, RotationInvariantPooling
from torch import nn
from mmdet.core import get_bbox_dim, build_bbox_coder, build_assigner, build_sampler, build_anchor_generator, \
multi_apply, images_to_levels, force_fp32
... |
examples/building_meter/generate.py | BrickSchema/brick | 146 | 11087244 | <reponame>BrickSchema/brick
import brickschema
from brickschema.namespaces import A, OWL, BRICK, UNIT
from rdflib import Namespace, Literal
# our entities will live in this namespace
BLDG = Namespace("urn:example#")
# create a graph for our model
g = brickschema.Graph()
g.bind("bldg", BLDG)
# define a building in a ... |
analysis/extract_pattern/extract_topk_cluster.py | taokong/ibot | 327 | 11087252 | <gh_stars>100-1000
# Copyright (c) ByteDance, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import math
import argparse
import torch.backends.cudnn as cudnn
import torch
import torch.di... |
src/lightkurve/seismology/utils.py | jorgemarpa/lightkurve | 235 | 11087255 | """Generic classes and functions which aid the asteroseismology features."""
import numpy as np
import copy
from astropy import units as u
from astropy.units import Quantity
__all__ = ["SeismologyQuantity"]
class SeismologyQuantity(Quantity):
"""Holds an asteroseismic value including its unit, error, and estimat... |
tests/presets/test_datapackage.py | JoeStaines/goodtables-py | 243 | 11087268 | <filename>tests/presets/test_datapackage.py
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from copy import deepcopy
from goodtables import validate
from goodtables.presets.datapa... |
robosat/osm/core.py | iboates/robosat | 1,844 | 11087288 | <reponame>iboates/robosat<filename>robosat/osm/core.py
import os
import uuid
import geojson
class FeatureStorage:
"""Stores features on disk and handles batching.
Note: you have to call flush at the end to flush the last partial batch.
"""
def __init__(self, out, batch):
assert batch > 0... |
apprise/plugins/NotifyXMPP/SleekXmppAdapter.py | linkmauve/apprise | 4,764 | 11087319 | # -*- coding: utf-8 -*-
import ssl
from os.path import isfile
import logging
# Default our global support flag
SLEEKXMPP_SUPPORT_AVAILABLE = False
try:
# Import sleekxmpp if available
import sleekxmpp
SLEEKXMPP_SUPPORT_AVAILABLE = True
except ImportError:
# No problem; we just simply can't support... |
tests/gen_test.py | beatrizuezu/pycpfcnpj | 127 | 11087324 | <reponame>beatrizuezu/pycpfcnpj
import unittest
from pycpfcnpj import gen, cpf, cnpj
class GenerateCPFTest(unittest.TestCase):
"""docstring for GenerateCPFTest"""
def setUp(self):
self.masked_valid_cpf = gen.cpf_with_punctuation()
def test_validate_masked_cnpj_true(self):
self.assertTrue(cpf.validate(self.mask... |
基础教程/A2-神经网络基本原理/第5步 - 非线性分类/src/ch12-MultipleLayerNetwork/HelperClass2/ActivatorFunction_2_0.py | microsoft/ai-edu | 11,094 | 11087336 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
"""
Version 2.0
"""
import numpy as np
class CActivator(object):
# z = 本层的wx+b计算值矩阵
def forward(self, z):
pass
# z = 本层的wx+b计算值矩阵
# a = 本层的激活函数... |
empire/server/modules/powershell/situational_awareness/network/powerview/get_gpo_computer.py | chenxiangfang/Empire | 2,541 | 11087366 | <gh_stars>1000+
from __future__ import print_function
from builtins import object
from builtins import str
from typing import Dict
from empire.server.common import helpers
from empire.server.common.module_models import PydanticModule
from empire.server.utils import data_util
from empire.server.utils.module_util impor... |
bin/tower.py | theosech/ec | 290 | 11087373 | <reponame>theosech/ec
try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from dreamcoder.domains.tower.main import main, TowerCNN, tower_options
from dreamcoder.dreamcoder import commandlineArguments
from dreamcoder... |
test/effective_user_test.py | blekinge/snakebite | 691 | 11087383 | from minicluster_testbase import MiniClusterTestBase
from snakebite.client import Client
import os
class EffectiveUserTest(MiniClusterTestBase):
ERR_MSG_TOUCH = "org.apache.hadoop.security.AccessControlException\nPermission denied: user=__foobar"
ERR_MSG_STAT = "`/foobar2': No such file or directory"
VALI... |
recipes/train_rasa/examples_to_rasa.py | CvH/voice2json | 913 | 11087388 | #!/usr/bin/env python3
import sys
import json
from collections import defaultdict
examples_by_intent = defaultdict(list)
# Gather all examples by intent name
for line in sys.stdin:
example = json.loads(line)
intent_name = example["intent"]["name"]
examples_by_intent[intent_name].append(example)
# Write d... |
panoptic_mapping_utils/src/flat_dataset/flat_data_player.py | ethz-asl/panoptic_mapping | 101 | 11087402 | <reponame>ethz-asl/panoptic_mapping<gh_stars>100-1000
#!/usr/bin/env python3
import os
import json
import csv
import rospy
from sensor_msgs.msg import Image
from geometry_msgs.msg import PoseStamped
from cv_bridge import CvBridge
import cv2
from PIL import Image as PilImage
import numpy as np
import tf
from std_srvs... |
lib/python/plash/macros/shortcuts.py | parampavar/plash | 346 | 11087406 | <gh_stars>100-1000
from plash.eval import eval, register_macro
ALIASES = dict(
x=[["run"]],
l=[["layer"]],
f=[["from"]],
# Update on an best effort basis. If possible keep versions that point to a
# latest release.
A=[["from", "alpine:edge"], ["apk"]],
U=[["from", "ubuntu:focal"], ["apt"]]... |
docs/render_templates.py | ticlazau/deon | 223 | 11087438 | <reponame>ticlazau/deon
from pathlib import Path
import click
from click.testing import CliRunner
from jinja2 import Environment, FileSystemLoader
import yaml
from deon.cli import main as deon_command
from deon.formats import Markdown, EXTENSIONS
from deon.parser import Checklist
env = Environment(
loader=FileS... |
k2/python/tests/dense_fsa_vec_test.py | EmreOzkose/k2 | 491 | 11087456 | #!/usr/bin/env python3
#
# Copyright 2020 Mobvoi Inc. (authors: <NAME>)
#
# See ../../../LICENSE for clarification regarding multiple 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... |
exampleSite/algolia-index-upload.py | timatlee/bilberry-hugo-theme | 274 | 11087487 | <reponame>timatlee/bilberry-hugo-theme
import argparse
import json
from algoliasearch.search_client import SearchClient
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--index-file', help="Index file to upload to Algolia")
parser.add_argument('-a', '--app-id', help="Algolia application ID")
parser.add_ar... |
src/test/tests/queries/revolved_surface_area.py | visit-dav/vis | 226 | 11087510 | <filename>src/test/tests/queries/revolved_surface_area.py
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: revolved_surface_area.py
# Tests: queries - Revolved surface area of 2D plot.
#
# Defect ID: VisIt00004666, '3260, '3261
#
# Programm... |
databuilder/databuilder/task/search/search_metadata_to_elasticsearch_task.py | kokizzu/amundsen | 1,169 | 11087535 | <gh_stars>1000+
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
from datetime import date
from typing import (
Any, Generator, List,
)
from uuid import uuid4
from elasticsearch.exceptions import NotFoundError
from elasticsearch.helpers import parallel_bulk
fr... |
test/test_detect_secrets.py | trae-horton/secret-bridge | 152 | 11087537 | import unittest
from detectors.detectsecrets import DetectSecrets
class AttrDict(dict):
"""A hacky dictionary that exposes its members as attributes.
Ex: attr_dict['foo'] == attr_dict.foo
This is to mimic the way that decoded JSON objects look (i.e. JSON
object fields are exposed attributes attribute... |
thrift_tools/tests/test_file_reader.py | cbweixin/thrift-tools | 222 | 11087549 | <gh_stars>100-1000
from collections import namedtuple
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unittest
from thrift_tools.file_reader import run
from .util import get_log_path
PARAMS = [
'file',
'padding',
'protocol',
'structs',
'finagle_thr... |
datadog_checks_base/tests/test_utils.py | vbarbaresi/integrations-core | 663 | 11087552 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from decimal import ROUND_HALF_DOWN
import mock
import pytest
from six import PY2, PY3
from datadog_checks.base.utils.common import ensure_bytes, ensure_unico... |
aiida/storage/psql_dos/migrations/versions/django_0032_remove_legacy_workflows.py | mkrack/aiida-core | 153 | 11087573 | <reponame>mkrack/aiida-core
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
utils/fasm/test/make_blif.py | brycejh/vtr-verilog-to-routing | 682 | 11087576 | #!/usr/bin/env python3
"""
This is an utility script that generates a BLIF file with arbitrary number of
5 and 6 input LUTs. Along with LUTs their initialization content is placed
in a comment just before the '.names' directive.
"""
import random
def main():
lut_count = 35
print('.model top')
print('.inp... |
Raspberry-Pi-Sonoff/Main.py | Aishwary912/Raspberry-Pi-Sonoff | 269 | 11087619 | <gh_stars>100-1000
from flask import Flask, render_template, request, redirect
from gpiozero import LED
from time import sleep
led = LED(2)
app = Flask(__name__)
@app.route("/")
def home():
if led.value == 1:
status = 'ON'
else:
status = 'OFF'
return render_template('home.ht... |
tests/garage/tf/algos/test_reps.py | blacksph3re/garage | 1,500 | 11087634 | <filename>tests/garage/tf/algos/test_reps.py
"""
This script creates a test that fails when garage.tf.algos.REPS performance is
too low.
"""
import pytest
from garage.envs import GymEnv
from garage.np.baselines import LinearFeatureBaseline
from garage.sampler import LocalSampler
from garage.tf.algos import REPS
from g... |
test_proj/blog/forms.py | Ivan-Feofanov/django-inline-actions | 204 | 11087645 | <reponame>Ivan-Feofanov/django-inline-actions
from django import forms
from . import models
class ChangeTitleForm(forms.ModelForm):
class Meta:
model = models.Article
fields = ('title',)
|
vnpy/api/femas/__init__.py | funrunskypalace/vnpy | 19,529 | 11087653 | <filename>vnpy/api/femas/__init__.py<gh_stars>1000+
from .vnfemasmd import MdApi
from .vnfemastd import TdApi
from .femas_constant import * |
docs/demos/multi_page_meta_tags/app.py | ruxi/dash-labs | 110 | 11087655 | <filename>docs/demos/multi_page_meta_tags/app.py
from dash import Dash, html, dcc
import dash
import dash_labs as dl
app = Dash(__name__, plugins=[dl.plugins.pages])
app.layout = html.Div(
[
html.H1("App Frame"),
html.Div(
[
html.Div(
[
... |
pythainlp/transliterate/royin.py | wannaphongcom/pythai-nlp | 125 | 11087669 | <reponame>wannaphongcom/pythai-nlp
# -*- coding: utf-8 -*-
"""
The Royal Thai General System of Transcription (RTGS)
is the official system for rendering Thai words in the Latin alphabet.
It was published by the Royal Institute of Thailand.
:See Also:
* `Wikipedia <https://en.wikipedia.org/wiki/Royal_Thai_General_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.