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 |
|---|---|---|---|---|
tools/CreateTFRecords/generic_tf_tools/resize.py | ladt/SeeingThroughFog | 143 | 11050924 | import cv2
import numpy as np
def get_iou(bb1, bb2):
"""
Taken from: https://stackoverflow.com/questions/25349178/calculating-percentage-of-bounding-box-overlap-for-image-detector-evaluation
Calculate the Intersection over Union (IoU) of two bounding boxes.
Parameters
----------
bb1 : dict
... |
tests/backends/test_tf.py | Spartee/SmartSim | 117 | 11050927 | import os
from pathlib import Path
import pytest
from smartsim import Experiment
from smartsim.constants import STATUS_FAILED
from smartsim.error import SmartSimError
should_run = True
try:
from tensorflow import keras
from smartsim.tf import freeze_model
except (ImportError, SmartSimError):
should_run ... |
bin/Lib/idlelib/__main__.py | yousafsyed/casperjs | 652 | 11051032 | """
IDLE main entry point
Run IDLE as python -m idlelib
"""
import idlelib.PyShell
idlelib.PyShell.main()
|
search.py | vovanphuc/hum2song | 108 | 11051045 | import argparse
import os, json, faiss
from models.resnet import *
from utils.utils import *
from tqdm import tqdm
from config.config import Config
import time
import argparse
config = Config()
start_time_load_model = time.time()
model = wrap_resnet_face18(False)
model.load_state_dict(torch.load(os.path.join(config.ch... |
bin/whisper-diff.py | timgates42/whisper | 833 | 11051052 | <gh_stars>100-1000
#!/usr/bin/python -tt
import sys
import optparse
import json
try:
import whisper
except ImportError:
raise SystemExit('[ERROR] Please make sure whisper is installed properly')
option_parser = optparse.OptionParser(usage='''%prog [options] path_a path_b''')
option_parser.add_option('--summary',... |
helpers/markdown.py | signalfx/integrations | 165 | 11051066 | import re
from pathlib import Path
import yaml
from jinja2 import Environment, FileSystemLoader, Template
from helpers.patterns import check_sfx_link, image_inline_pattern
def link_sub(m):
prefix = m.group("check_is_image")
# Don't process images
if prefix == "!":
return m.group(0)
# Don't... |
chainercv/transforms/image/center_crop.py | souravsingh/chainercv | 1,600 | 11051117 | def center_crop(img, size, return_param=False, copy=False):
"""Center crop an image by `size`.
An image is cropped to :obj:`size`. The center of the output image
and the center of the input image are same.
Args:
img (~numpy.ndarray): An image array to be cropped. This is in
CHW for... |
tensorflow/20.kafka-storm-text-classification/streamparse/tasks/processing/topologies/processing.py | huseinzol05/Gather-Tensorflow-Serving | 267 | 11051143 | <gh_stars>100-1000
"""
processing topology
"""
from streamparse import Grouping, Topology
from bolts.processing import ProcessingBolt
from spouts.consumer import ConsumerSpout
class Processing(Topology):
consumer_spout = ConsumerSpout.spec(par = 5)
processing_bolt = ProcessingBolt.spec(
inputs = {co... |
setup.py | bet4it/lxdui | 589 | 11051163 | # -*- coding: UTF-8 -*-
from setuptools import setup, find_packages
from app import __metadata__ as meta
setup(
name=meta.APP_NAME,
version = meta.VERSION,
description='{} v{}'.format(meta.APP_NAME, meta.VERSION),
long_description='{} v{}'.format(meta.APP_NAME, meta.VERSION),
classifiers=[
'Devel... |
test/com/facebook/buck/core/starlark/rule/testdata/args/defs.bzl | Unknoob/buck | 8,027 | 11051166 | <filename>test/com/facebook/buck/core/starlark/rule/testdata/args/defs.bzl<gh_stars>1000+
""" Module docstring """
RI1 = RunInfo(env = {}, args = [1, 2, 3])
RI2 = RunInfo(env = {}, args = [4, 5, 6])
RI3 = RunInfo(env = {}, args = [7, 8, 9])
def _add_impl(ctx):
a = ctx.actions.args().add(1).add("--foo", "bar").add... |
Chapter 4/Ex4.7-A.py | burmecia/Reinforcement-Learning-2nd-Edition-by-Sutton-Exercise-Solutions | 1,234 | 11051178 | import numpy as np
import pickle
import matplotlib.pyplot as plt
"""
This implementation is a pure replication of Example 4.2 in the book
The modified version as the answer to Exercise 4.7 will be posted as Ex4.7-B.py later.
"""
def poisson_calculator(Lambda=3):
"""
input:
lambda: th... |
valentyusb/usbcore/utils/asserts.py | rjeschmi/valentyusb | 105 | 11051207 | <filename>valentyusb/usbcore/utils/asserts.py
#!/usr/bin/python3
import tempfile
import subprocess
from .sdiff import Differ, getTerminalSize, original_diff
import sys
def assertMultiLineEqualSideBySide(expected, actual, msg):
# print("data1: {}".format(data1.splitlines(1)))
if expected == actual:
ret... |
scripts/bert_detokenize.py | Aniloid2/Distil_bert | 111 | 11051253 | <filename>scripts/bert_detokenize.py
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
detokenize output due to BERT preprocessing
"""
import argparse
import os
from os.path import basename, exists, join
import ipdb
from tqdm import tqdm
IN_WORD = '@@'
BERT_IN_WORD = '##'
# special chars in m... |
third_party/infra_libs/event_mon/protos/log_request_lite_pb2.py | webrtc-lizp/infra-luci-client-py | 2,151 | 11051268 | <reponame>webrtc-lizp/infra-luci-client-py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: log_request_lite.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import ... |
mmtbx/programs/ss_idealization.py | dperl-sol/cctbx_project | 155 | 11051312 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from libtbx.program_template import ProgramTemplate
from mmtbx.secondary_structure.build import ss_idealization
from libtbx import Auto
import os
# =============================================================================
... |
terrascript/resource/opc.py | mjuenema/python-terrascript | 507 | 11051321 | <filename>terrascript/resource/opc.py<gh_stars>100-1000
# terrascript/resource/opc.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:23:41 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.resource.opc
#
# instead of
#
# >>> import terrascript.resource.hashicorp.opc
#
# This is... |
setup.py | Weilor/swagger-py-codegen | 591 | 11051365 | from __future__ import absolute_import
import re
import ast
from setuptools import setup
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('swagger_py_codegen/_version.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
with open('requireme... |
R/tests/autoGen/genJson.py | gigliovale/h2o | 882 | 11051394 | ##
# Depends on smalldata.csv
# Creates a json, that is a list of datasets
# Datasets have PATHS, NAMES, NUMCOLS, NUMROWS, TYPES, RANGE, IGNORED, TARGET
##
import os, sys, time, csv, string
sys.path.extend(['.','..'])
import h2o_cmd, h2o, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_rf, h2o_jobs
from pprint imp... |
dev/Tools/build/waf-1.7.13/waflib/extras/run_r_script.py | jeikabu/lumberyard | 1,738 | 11051412 | <gh_stars>1000+
#!/usr/bin/env python
# encoding: utf-8
# <NAME>, 2012
"""
Run a R script in the directory specified by **ctx.bldnode**.
For error-catching purposes, keep an own log-file that is destroyed if the
task finished without error. If not, it will show up as rscript_[index].log
in the bldnode directory.
Us... |
teether/evm/__init__.py | s-mallow/teether-erc20 | 102 | 11051437 | from . import evm
from . import exceptions
from . import results
from . import state
|
custom_components/unifiprotect/views.py | markleary/unifiprotect | 546 | 11051448 | <filename>custom_components/unifiprotect/views.py<gh_stars>100-1000
"""UniFi Protect Integration views."""
from __future__ import annotations
import collections
from http import HTTPStatus
import logging
from typing import Any
from aiohttp import web
from homeassistant.components.http import KEY_AUTHENTICATED, HomeAs... |
datasets/danbooru_utils.py | kiralpoon/TwinGAN | 736 | 11051467 | <filename>datasets/danbooru_utils.py
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
tests/solidity/test_ast_attributes_bulk.py | AlexandreH/securify2 | 258 | 11051484 | <gh_stars>100-1000
import importlib
import inspect
import os
import pkgutil
import unittest
from types import ModuleType
from securify.solidity.solidity_cfg_compiler import compile_attributed_ast
def make_test_case(test_module: ModuleType):
def test_case(self):
sol_code = test_module.__doc__
sol_... |
Python/GoogleSearchResults/GoogleSearch.py | itayz1230/AlgoCode | 151 | 11051497 | from googlesearch import search
print('Welcome! I am here to help you :)')
print('Please Enter your query here: ')
query=input()
for i in search(query, tld="co.in", num=10, stop=20, pause=2):
print(i) |
modules/nltk_contrib/hadoop/hadooplib/reducer.py | h4ck3rm1k3/NLP-project | 123 | 11051499 | <reponame>h4ck3rm1k3/NLP-project
from itertools import groupby
from operator import itemgetter
from inputformat import KeyValueInput
from outputcollector import LineOutput
class ReducerBase:
"""
Base class for every reduce tasks
Your reduce class should extend this base class
and override... |
readthedocs/audit/migrations/0006_add_download_action.py | yarons/readthedocs.org | 4,054 | 11051506 | # Generated by Django 2.2.24 on 2021-10-27 15:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('audit', '0005_migrate_ip_field_values'),
]
operations = [
migrations.AlterField(
model_name='auditlog',
name='actio... |
models/__init__.py | williamsashbee/partialconv-gsu | 1,106 | 11051526 | <gh_stars>1000+
from .pd_resnet import *
from .pd_vgg import * |
pygam/penalties.py | pjk645/pyGAM | 714 | 11051540 | """
Penalty matrix generators
"""
import scipy as sp
import numpy as np
def derivative(n, coef, derivative=2, periodic=False):
"""
Builds a penalty matrix for P-Splines with continuous features.
Penalizes the squared differences between basis coefficients.
Parameters
----------
n : int
... |
setup.py | borzunov/cpmoptimize | 121 | 11051569 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from setuptools import setup
project_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(project_dir, 'cpmoptimize', '__init__.py')) as f:
version = re.search(r"__version__ = '(.+)'", f.read()).groups()[0]
with open(os.path.j... |
starfish/core/imagestack/test/test_index.py | haoxusci/starfish | 164 | 11051619 | <gh_stars>100-1000
import os
import tempfile
from collections import OrderedDict
import numpy as np
from starfish.core.imagestack import indexing_utils as iu
from starfish.core.types import Axes, Coordinates, PhysicalCoordinateTypes
from .factories import imagestack_with_coords_factory, synthetic_stack
from ..imagest... |
notebooks/ch6/utils.py | wangyonghong/RabbitMQ-in-Depth | 111 | 11051621 | <filename>notebooks/ch6/utils.py
from IPython import display
import hashlib
import imghdr
import os
IMG_PATH = 'ch6/images'
def get_images():
"""Return a list of all images to publish
:rtype: str
"""
files = []
for _dirpath, _dirnames, filenames in os.walk(IMG_PATH):
for filename in fil... |
autox/autox_server/ensemble/ensemble.py | fanghy06/AutoX | 499 | 11051628 | <reponame>fanghy06/AutoX
import time
import warnings
from autox.autox_server.model import simple_lgb
from autox.autox_server.util import log
warnings.filterwarnings('ignore')
def ensemble(G_df_dict, G_data_info, G_hist, is_train, remain_time, top_k=3):
start = time.time()
# 训练过程确定要使用的结果,预测过程将选中的结果进行ensemble
... |
tests/test_utils/test_overlaps.py | Justice-Eternal/mmrotate | 449 | 11051636 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmrotate.core.bbox import rbbox_overlaps
predict = [[903.34, 1034.4, 1.81e-7, 1e-7, -0.312],
[903.34, 1034.4, 1e-7, 1e-3, -0.312],
[903.34, 1034.4, 1.81e7, 1e7, -0.312]]
gt = [[2.1525e+02, 7.5750e+01, 3.3204e+01, 1.2... |
test/benchmarking/benchmark.py | upj977155/TileDB | 1,478 | 11051718 | <filename>test/benchmarking/benchmark.py
#!/usr/bin/env python
import argparse
import glob
import json
import os
import subprocess
import sys
import threading
import time
benchmark_src_dir = os.path.abspath('src')
benchmark_build_dir = os.path.abspath('build')
NUM_TRIALS = 3
if os.name == 'posix':
if sys.platfo... |
plenum/server/request_handlers/get_txn_author_agreement_aml_handler.py | andkononykhin/plenum | 148 | 11051732 | from common.serializers.serialization import config_state_serializer
from plenum.common.constants import CONFIG_LEDGER_ID, \
GET_TXN_AUTHOR_AGREEMENT_AML, GET_TXN_AUTHOR_AGREEMENT_AML_VERSION, \
GET_TXN_AUTHOR_AGREEMENT_AML_TIMESTAMP
from plenum.common.exceptions import InvalidClientRequest
from plenum.common.r... |
scripts/celery_shell.py | quacksawbones/galaxy-1 | 1,085 | 11051741 | <filename>scripts/celery_shell.py
"""
Run this script from galaxy's root with
```
ipython -i scripts/celery_shell.py -- -c config/galaxy.yml
```
"""
import logging
import os
WARNING_MODULES = ['parso', 'asyncio', 'galaxy.datatypes']
for mod in WARNING_MODULES:
logger = logging.getLogger(mod)
logger.setLevel('W... |
taskwiki/errors.py | PtitCaius/taskwiki | 465 | 11051748 | <reponame>PtitCaius/taskwiki
"""
Contains TaskWiki-specific exceptions.
"""
from __future__ import print_function
import six
import sys
class VimPrettyException(Exception):
pass
class TaskWikiException(VimPrettyException):
"""Used to interrupt a TaskWiki command/event and notify the user."""
pass
def... |
examples/nlp/duplex_text_normalization/data/data_split.py | hamjam/NeMo | 4,145 | 11051753 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requ... |
terrascript/data/kradalby/opnsense.py | mjuenema/python-terrascript | 507 | 11051773 | # terrascript/data/kradalby/opnsense.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:23:52 UTC)
import terrascript
class opnsense_firewall_alias(terrascript.Data):
pass
__all__ = [
"opnsense_firewall_alias",
]
|
pyGPs/Demo/JHUI/demo_Validation.py | Corentin-LF/pyGPs | 196 | 11051817 | <reponame>Corentin-LF/pyGPs
from __future__ import print_function
from builtins import str
from builtins import range
#================================================================================
# <NAME> [marion dot neumann at uni-bonn dot de]
# <NAME> [dan dot marthaler at gmail dot com]
# <NAME> [shan d... |
countdown.py | Gautam-J/NFS_v1 | 139 | 11051847 | <reponame>Gautam-J/NFS_v1
import time
def CountDown(sec):
digits = len(str(sec))
delete = "\b" * (digits)
for i in range(1, sec + 1)[::-1]:
print("{0}{1:{2}}".format(delete, i, digits), end="", flush=True)
time.sleep(1)
print('')
if __name__ == '__main__':
CountDown(5)
|
docs/components_page/components/layout/width.py | glsdown/dash-bootstrap-components | 776 | 11051902 | <filename>docs/components_page/components/layout/width.py<gh_stars>100-1000
import dash_bootstrap_components as dbc
from dash import html
row = html.Div(
[
dbc.Row(dbc.Col(html.Div("A single, half-width column"), width=6)),
dbc.Row(
dbc.Col(html.Div("An automatically sized column"), wid... |
src/visions/visualisation/plot_typesets.py | bhumikapahariapuresoftware/visions | 142 | 11051985 | <filename>src/visions/visualisation/plot_typesets.py
from pathlib import Path
from visions.typesets import CompleteSet, GeometrySet, StandardSet
# Windows Note
# Tip for Python3/64-bit compatible version of pygraphviz
# https://github.com/CristiFati/Prebuilt-Binaries/raw/master/Windows/PyGraphviz/pygraphviz-1.5-cp37-... |
atp-auto-core-open/atp/views/api_run.py | rebecca1202/testAuto | 130 | 11052004 | # -*- coding:utf-8 -*-
import json
import time
from flask import Blueprint
from flask_restful import Resource
# import concurrent.futures
# from multiprocessing import Process
# from atp.api.comm_log import logger
# from atp.api.log_push_queue import LogPushQueue
from atp.api.mysql_manager import ApiTestReportManage... |
kubestriker/pvl_containers.py | Kubenew/kubestriker | 779 | 11052014 | <reponame>Kubenew/kubestriker
# Read data from files
import json
from kubestriker.bars import prefix
dangerous_caps = [
"*", "DAC_READ_SEARCH", "LINUX_IMMUTABLE", "NET_BROADCAST", "NET_ADMIN", "IPC_LOCK", "IPC_OWNER",
"SYS_MODULE", "SYS_RAWIO", "SYS_PTRACE", "SYS_BOOT", "SYS_PACCT", "SYS_ADMIN", "SYS_NICE", "S... |
corehq/apps/registry/views.py | akashkj/commcare-hq | 471 | 11052018 | import json
from collections import Counter
from datetime import datetime
from django.contrib import messages
from django.db.models import Q
from django.http import JsonResponse, Http404, HttpResponseForbidden
from django.shortcuts import render, redirect
from django.urls import reverse
from django.utils.translation i... |
base/urls.py | edisonlz/fastor | 285 | 11052043 | <filename>base/urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'base.views.hello', name=u'home'),
)
|
organize/constants.py | crydotsnake/djangogirls | 446 | 11052045 | from django.utils.translation import gettext_lazy as _
INVOLVEMENT_CHOICES = (
("newcomer", _("I've never been to a Django Girls event")),
("attendee", _("I'm a former attendee")),
("coach", _("I'm a former coach")),
("organizer", _("I'm a former organizer")),
("contributor", _("I contributed to t... |
lib/utils/time_utils.py | AlbertoRemus/GDR_Net | 132 | 11052067 | <gh_stars>100-1000
from __future__ import division
import timeit
import time
from datetime import datetime, timedelta
from . import logger
def average_time_of_func(func, num_iter=10000, ms=False):
"""
ms: if True, xxx ms/iter
"""
duration = timeit.timeit(func, number=num_iter)
avg_time = duration ... |
tools/examplecode/__init__.py | VisLab/bids-specification | 178 | 11052074 | """A Python package to render BIDS example with tree like output."""
from examplecode.example import DirectoryTree
__all__ = [
"DirectoryTree",
]
|
ptgnn/neuralmodels/gnn/messagepassing/pna_aggregation.py | mir-am/ptgnn | 319 | 11052076 | import torch
from torch import nn
from torch_scatter import scatter
from typing import Dict, List, Optional, Tuple, Union
from ptgnn.neuralmodels.gnn.messagepassing.abstractmessagepassing import (
AbstractMessageAggregation,
AbstractMessagePassingLayer,
)
from ptgnn.neuralmodels.mlp import MLP
class PnaMessa... |
Image_Synthesis_From_Text/char-CNN-RNN/pascal1k/featurescnn.py | alexkrojas13/Deep-Learning-Challenges | 298 | 11052083 | <filename>Image_Synthesis_From_Text/char-CNN-RNN/pascal1k/featurescnn.py
import keras
import random
import numpy as np
from PIL import Image
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.callbacks import ModelCheckpoint
from... |
semantic-segmentation/deeplabv3plus/xception_65.py | AaratiAkkapeddi/nnabla-examples | 228 | 11052087 | <gh_stars>100-1000
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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... |
Python3/833.py | rakhi2001/ecom7 | 854 | 11052092 | __________________________________________________________________________________________________
sample 32 ms submission
class Solution:
def findReplaceString(self, S, indexes, sources, targets):
S = list(S)
for i, src, tgt in sorted(zip(indexes, sources, targets), reverse=True):
if S[i:i+len(src)] ==... |
ptgnn/neuralmodels/gnn/messagepassing/globalgraphexchange.py | mir-am/ptgnn | 319 | 11052147 | import torch
from abc import abstractmethod
from torch import nn
from typing import Dict, List, Tuple
from ptgnn.neuralmodels.gnn.messagepassing.abstractmessagepassing import AbstractMessagePassingLayer
from ptgnn.neuralmodels.reduceops.varsizedsummary import (
AbstractVarSizedElementReduce,
ElementsToSummaryR... |
src/resources/clients/python_client/example.py | visit-dav/vis | 226 | 11052175 | import sys
__system_bytecode_setting = sys.dont_write_bytecode
sys.dont_write_bytecode = True
import visitproxy
host = "localhost"
port = 9002
password = "<PASSWORD>"
BUFSIZE = 4096
visType = "none"
#create a VisIt Proxy
vp = visitproxy.ViewerProxy()
gmap = sys.modules["__main__"].__dict__
gmap["vp"] = vp
#connect ... |
criterions/perceptual.py | lichnost/latent-pose-reenactment | 103 | 11052191 | from torch import nn
from criterions.common.perceptual_loss import PerceptualLoss
class Wrapper:
@staticmethod
def get_args(parser):
parser.add('--perc_weight', type=float, default=1e-2)
@staticmethod
def get_net(args):
criterion = Criterion(args.perc_weight, args.vgg_weights_dir)
... |
opensanctions/exporters/ftm.py | quantumchips/opensanctions | 102 | 11052224 | from opensanctions.exporters.common import Exporter, write_object
class FtMExporter(Exporter):
TITLE = "FollowTheMoney entities"
NAME = "entities.ftm"
EXTENSION = "json"
MIME_TYPE = "application/json+ftm"
def feed(self, entity):
write_object(self.fh, entity)
|
unittests/usertest.py | low456high/Skype4Py | 199 | 11052245 | <gh_stars>100-1000
import unittest
import skype4pytest
from Skype4Py.user import *
class UserTest(skype4pytest.TestCase):
def setUpObject(self):
self.obj = User(self.skype, 'spam')
# Methods
# =======
def testSaveAvatarToFile(self):
self.api.enqueue('GET USER spam AVATAR 1 c:\\eggs.... |
examples/pytorch/fx/object_detection/maskrcnn/pytorch/maskrcnn_benchmark/layers/smooth_l1_loss.py | intelkevinputnam/lpot-docs | 567 | 11052261 | <reponame>intelkevinputnam/lpot-docs<filename>examples/pytorch/fx/object_detection/maskrcnn/pytorch/maskrcnn_benchmark/layers/smooth_l1_loss.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... |
kitsune/wiki/facets.py | 10allday-Software/kitsune | 929 | 11052283 | <filename>kitsune/wiki/facets.py
import hashlib
from datetime import datetime, timedelta
from django.conf import settings
from django.core.cache import cache
from django.db.models import Count, Q
from kitsune.products.models import Topic
from kitsune.wiki.models import Document, HelpfulVote
def topics_for(product, ... |
todo/commands/__init__.py | tomasdanjonsson/td-cli | 154 | 11052299 | from todo.commands import config, group, todo
from todo.constants import COMMANDS
from todo.services import Service
class Commands:
commands_dict = {
COMMANDS.ADD_TODO: todo.Add,
COMMANDS.COMPLETE_TODO: todo.Complete,
COMMANDS.COUNT_TODOS: todo.Count,
COMMANDS.DELETE_TODO: todo.Del... |
examples/functions/Python/func.py | jimbrig/fx | 1,835 | 11052300 | <filename>examples/functions/Python/func.py
def fx(request):
return "hello world"
|
zepid/causal/ipw/IPCW.py | darrenreger/zEpid | 101 | 11052342 | <reponame>darrenreger/zEpid
import warnings
import numpy as np
import pandas as pd
from zepid.causal.utils import propensity_score
class IPCW:
r"""Calculates inverse probability of censoring weights. Note that this function will accept either a flat
file (one row per individual) or a long format (multiple ro... |
pywick/callbacks/LambdaCallback.py | achaiah/pywick | 408 | 11052366 | <reponame>achaiah/pywick<gh_stars>100-1000
from . import Callback
class LambdaCallback(Callback):
"""
Callback for creating simple, custom callbacks on-the-fly.
"""
def __init__(self,
on_epoch_begin=None,
on_epoch_end=None,
on_batch_begin=None,
... |
examples/toolbar2.py | tgolsson/appJar | 666 | 11052379 | import sys
sys.path.append("../")
from appJar import gui
pin = True
def tbFunc(btn):
print(btn)
def pin(btn): app.setToolbarPinned(True)
def unpin(btn): app.setToolbarPinned(False)
def tbOut(btn): app.hideToolbar()
def tbIn(btn): app.showToolbar()
app = gui()
app.addToolbar(["Save", "Open", "Close"], tbFunc, ... |
tests/ut/python/parallel/test_onehot_2dim.py | PowerOlive/mindspore | 3,200 | 11052394 | # 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... |
roboticstoolbox/backends/PyPlot/RobotPlot2.py | tassos/robotics-toolbox-python | 749 | 11052412 | #!/usr/bin/env python
"""
@author <NAME>
"""
# import numpy as np
from roboticstoolbox.backends.PyPlot.RobotPlot import RobotPlot
import numpy as np
from spatialmath import SE2
class RobotPlot2(RobotPlot):
def __init__(
self, robot, env, readonly, display=True,
eeframe=True, name=True, opt... |
examples/onnxrt/object_detection/onnx_model_zoo/mask_rcnn/quantization/ptq/main.py | intel/neural-compressor | 172 | 11052447 | # 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... |
static/slim/nas/search_space/__init__.py | leakyH/PaddleDetection | 7,782 | 11052457 | from .blazefacespace_nas import BlazeFaceNasSpace
__all__ = ['BlazeFaceNasSpace']
|
tests/micropython/icast.py | Euromance/pycopy | 663 | 11052483 | <reponame>Euromance/pycopy
from pycopy import icast
print(repr(icast(b"foo", str)))
print(repr(icast(b"", str)))
b1 = b"foobar"
id1 = id(b1)
b2 = icast(b1, str)
id2 = id(b2)
print(id1 == id2)
print(b1)
|
alipay/aop/api/domain/NetFlowOfferInfo.py | antopen/alipay-sdk-python-all | 213 | 11052491 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class NetFlowOfferInfo(object):
def __init__(self):
self._effective_time = None
self._expire_time = None
self._offer_name = None
self._order_time = None
@property
... |
contrib/p4/docker_files/switch_bmv2/table_handler.py | SvenUmbricht/benchexec | 137 | 11052504 | # SPDX-FileCopyrightText: 2020-2021 CASTOR Software Research Centre
# <https://www.castor.kth.se/>
# SPDX-FileCopyrightText: 2020-2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
import json
import subprocess
import argparse
PATH_TO_TABLE_JSON = "/app/ip_table.json"
PATH_TO_CLI = "/usr/local/behavioral-model/tools/... |
metadrive/manager/waymo_data_manager.py | liuzuxin/metadrive | 125 | 11052533 | <reponame>liuzuxin/metadrive
import os
from metadrive.manager.base_manager import BaseManager
from metadrive.utils.waymo_utils.waymo_utils import read_waymo_data
from tqdm import tqdm
class WaymoDataManager(BaseManager):
def __init__(self):
super(WaymoDataManager, self).__init__()
self.directory ... |
challenges/OUTLAW/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 11052546 | <reponame>pingjuiliao/cb-multios
#!/usr/bin/env python
#
# Copyright (C) 2014, 2015
# <NAME> <<EMAIL>>
# Narf Industries <<EMAIL>>
#
# 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 withou... |
litepcie/tlp/controller.py | trabucayre/litepcie | 289 | 11052556 | <reponame>trabucayre/litepcie
#
# This file is part of LitePCIe.
#
# Copyright (c) 2015-2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from litepcie.common import *
from litepcie.core.common import *
from litepcie.tlp.common import *
class LitePCIeTLPController(Module):
"""Lit... |
tests/providers/google/cloud/hooks/vertex_ai/test_dataset.py | npodewitz/airflow | 8,092 | 11052563 | <filename>tests/providers/google/cloud/hooks/vertex_ai/test_dataset.py
#
# 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 y... |
staintools/tissue_masks/abc_tissue_locator.py | BostonMeditechGroup/StainTools | 197 | 11052586 | from abc import ABC, abstractmethod
class ABCTissueLocator(ABC):
@staticmethod
@abstractmethod
def get_tissue_mask(I):
"""
Get a boolean tissue mask.
:param I:
:return:
""" |
tests/refactor/test_typing.py | CAM-Gerlach/unimport | 147 | 11052591 | <filename>tests/refactor/test_typing.py
import unittest
from tests.refactor.utils import RefactorTestCase
from unimport.constants import PY38_PLUS
class TypingTestCase(RefactorTestCase):
include_star_import = True
@unittest.skipIf(
not PY38_PLUS, "This feature is only available for python 3.8."
... |
sotabencheval/utils.py | lucasb-eyer/sotabench-eval | 172 | 11052600 | <gh_stars>100-1000
import hashlib
import gzip
import errno
import tarfile
import zipfile
import os
from tqdm import tqdm
from pathlib import Path
SOTABENCH_CACHE = Path.home() / ".cache"
class AverageMeter(object):
"""Computes and stores the average and current value."""
def __init__(self):
self.va... |
test/data/ivs3.py | davemarr621/interval_tree_1 | 488 | 11052642 | <gh_stars>100-1000
"""
Random integer ranges, with gaps.
"""
data = \
[(-50, -42, None),
(-36, -27, None),
(-27, -21, None),
(-21, -17, None),
(-17, -16, None),
(-14, -4, None),
(-4, 0, None),
(4, 12, None),
(13, 23, None),
(23, 32, None),
(41, 46, None),
(46, 55, None),
(55, 58, None),
(68, 69, None),
(6... |
dependencies.py | mehrdad-shokri/backdoorme | 796 | 11052663 | import os
if __name__ == "__main__":
if os.getuid() != 0:
print("Please run this installation script as root!")
else:
print("Installing Pip for Python.")
os.system('apt-get install -y python3-pip >> /dev/null')
os.system('apt-get install -y python-pip >> /dev/null')
... |
nuplan/database/nuplan_db/tests/test_track.py | motional/nuplan-devkit | 128 | 11052675 | <reponame>motional/nuplan-devkit<filename>nuplan/database/nuplan_db/tests/test_track.py
import unittest
from unittest.mock import Mock, PropertyMock, patch
from nuplan.database.tests.nuplan_db_test_utils import get_test_nuplan_track
class TestTrack(unittest.TestCase):
"""Test class Track"""
def setUp(self) ... |
dump2dot.py | timgates42/pyahocorasick | 707 | 11052683 | """
Aho-Corasick string search algorithm.
Author : <NAME>, <EMAIL>
WWW : http://0x80.pl
License : public domain
"""
import ahocorasick
import os
from ahocorasick import EMPTY, TRIE, AHOCORASICK;
def dump2dot(automaton, file):
def writeln(text=""):
file.write(text + "\n")
def nodename(nodeid):
... |
spirit/user/admin/apps.py | Ke-xueting/Spirit | 974 | 11052704 | # -*- coding: utf-8 -*-
from django.apps import AppConfig
class SpiritUserAdminConfig(AppConfig):
name = 'spirit.user.admin'
verbose_name = "Spirit User Admin"
label = 'spirit_user_admin'
|
data/scripts/camerarotation.py | ImagiaViz/inviwo | 349 | 11052753 | # Inviwo Python script
import inviwopy
from inviwopy.glm import vec3
import ivw.utils as inviwo_utils
import math
import time
#Use for example the boron example network
app = inviwopy.app
network = app.network
cam = network.EntryExitPoints.camera
start = time.clock()
scale = 1;
d = 15
steps = 1... |
test/functions/decl5.py | kylebarron/MagicPython | 1,482 | 11052776 | def f()->123:pass
def : meta.function.python, source.python, storage.type.function.python
: meta.function.python, source.python
f : entity.name.function.python, meta.function.python, source.python
( : meta.function.parameters.python, meta.function.python, punctuation.d... |
web/x123/apps.py | mrscorpion/MSEasyReader | 519 | 11052816 | from django.apps import AppConfig
class X123Config(AppConfig):
name = 'x123'
|
jug/tests/jugfiles/builtin_function.py | dombrno/jug | 309 | 11052862 | from jug import TaskGenerator
import numpy as np
array = TaskGenerator(np.array)
a8 = array(list(range(8)))
|
unittests/calltest.py | low456high/Skype4Py | 199 | 11052887 | import unittest
import skype4pytest
from Skype4Py.call import *
class CallTest(skype4pytest.TestCase):
def setUpObject(self):
self.obj = Call(self.skype, '1234')
# Methods
# =======
def testAnswer(self):
self.api.enqueue('ALTER CALL 1234 ANSWER')
self.obj.Answer()
se... |
airtest/utils/apkparser/typeconstants.py | koyoki/Airtest | 6,140 | 11052900 | # This file is part of Androguard.
#
# Copyright (C) 2010, <NAME> <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
atomic_reactor/plugins/rpmqa.py | qixiang/atomic-reactor | 113 | 11052919 | """
Copyright (c) 2015-2022 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import subprocess
import tempfile
from typing import List
from atomic_reactor.dirs import BuildDir
from atomic_reactor.plugin ... |
terrascript/data/terraform_provider_graylog/graylog.py | mjuenema/python-terrascript | 507 | 11052976 | # terrascript/data/terraform-provider-graylog/graylog.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:17:31 UTC)
import terrascript
class graylog_dashboard(terrascript.Data):
pass
class graylog_index_set(terrascript.Data):
pass
class graylog_sidecar(terrascript.Data):
pass
class gr... |
python_modules/dagster/dagster_tests/execution_tests/test_async.py | dbatten5/dagster | 4,606 | 11053082 | import asyncio
from dagster import Output, execute_solid, solid
def test_aio_solid():
@solid
async def aio_solid(_):
await asyncio.sleep(0.01)
return "done"
result = execute_solid(aio_solid)
assert result.output_value() == "done"
def test_aio_gen_solid():
@solid
async def a... |
pymde/constraints.py | frederikschubert/pymde | 379 | 11053097 | import abc
import torch
from pymde import util
class Constraint(abc.ABC):
"""A generic constraint.
To create a custom constraint, create a subclass of this class,
and implement its abstract methods.
"""
@abc.abstractmethod
def name(self) -> str:
"""The name of the constraint."""
... |
PyFlow/Packages/__init__.py | luzpaz/PyFlow | 1,463 | 11053101 | """Packages
"""
# this line adds extension-packages not installed inside the PyFlow directory
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
tests/meta/test_revision.py | cdknorow/modelstore | 151 | 11053121 | # Copyright 2020 <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... |
Python/add.py | kennethsequeira/Hello-world | 1,428 | 11053183 | a=int(input("enter a number"))
b=int(input("enter a number"))
sum=a+b
print("sum is=",sum) |
recipes/base64/all/conanfile.py | rockandsalt/conan-center-index | 562 | 11053186 | <reponame>rockandsalt/conan-center-index<filename>recipes/base64/all/conanfile.py<gh_stars>100-1000
import os
from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools
class Base64Conan(ConanFile):
name = "base64"
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
... |
references/link_to_the_api_documentation/example_python_project/python/example_file.py | jingtaoh/USD-Cookbook | 332 | 11053201 | <filename>references/link_to_the_api_documentation/example_python_project/python/example_file.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This is a module docstring.
Let's try linking to the USD API documentation's stage class.
:usd:`UsdStage`.
^^^ That link should be clickable
Also you c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.