max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
taskwiki/store.py | wolass/taskwiki | 465 | 173730 | <gh_stars>100-1000
from tasklib import TaskWarrior
from taskwiki import errors
class WarriorStore(object):
"""
Stores all instances of TaskWarrior objects.
"""
def __init__(self, default_rc, default_data, extra_warrior_defs):
default_kwargs = dict(
data_location=default_data,
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/helloworldsplash/Hello2.py | takipsizad/pyjs | 739 | 173741 | <gh_stars>100-1000
import pyjd # this is dummy in pyjs.
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Button import Button
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Label import Label
from pyjamas import Window
import pygwt
def greet(fred):
fred.setText("No, really click me!")
Window.alert... | 0 | 0 | 0 | 0 | 0 | 0 |
test/run/t236.py | timmartin/skulpt | 2,671 | 173758 | import pkga.pkgb.modc as c_me
print c_me.stuff
print c_me.things
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/examples/test_blinky.py | psumesh/siliconcompiler | 424 | 173796 | import os
import subprocess
import siliconcompiler
import pytest
@pytest.mark.eda
@pytest.mark.quick
def test_py(setup_example_test):
setup_example_test('blinky')
import blinky
blinky.main()
assert os.path.isfile('build/blinky/job0/bitstream/0/outputs/blinky.bit')
@pytest.mark.eda
@pytest.mark.qui... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/functional_tests/test_issue120/support/some_test.py | kokosing/hue | 5,079 | 173809 | <reponame>kokosing/hue<filename>desktop/core/ext-py/nose-1.3.7/functional_tests/test_issue120/support/some_test.py
def some_test():
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | 0zAND1z/zamia-ai | 129 | 173822 | from setuptools import setup
import os
# df = []
# for m in os.listdir('modules'):
# for f in os.listdir('modules/%s' % m):
# if f.endswith('.py') or f.endswith('.pl'):
# df.append(('share/zamia-ai/modules/%s' % m, ['modules/%s/%s' % (m, f)]))
# print repr(df)
setup(
name ... | 0 | 0 | 0 | 0 | 0 | 0 |
backpack/extensions/firstorder/gradient/conv1d.py | jabader97/backpack | 395 | 173850 | from backpack.core.derivatives.conv1d import Conv1DDerivatives
from .base import GradBaseModule
class GradConv1d(GradBaseModule):
def __init__(self):
super().__init__(derivatives=Conv1DDerivatives(), params=["bias", "weight"])
| 0 | 0 | 0 | 0 | 0 | 0 |
psy/utils/__init__.py | Alias-Alan/pypsy | 169 | 173869 | from psy.utils.probs import inverse_logistic, get_log_beta_pd, get_log_lognormal_pd, get_log_normal_pd, get_nodes_weights, \
r4beta
from psy.utils.tools import cached_property
from psy.utils.randoms import gen_item_bank
| 0 | 0 | 0 | 0 | 0 | 0 |
PyEngine3D/Render/RenderTarget.py | ubuntunux/PyEngine3D | 121 | 173875 | from __future__ import annotations
import math
import random
import numpy as np
from OpenGL.GL import *
from OpenGL.GL.ARB.framebuffer_object import *
from OpenGL.GL.EXT.framebuffer_object import *
from PyEngine3D.Utilities import *
from PyEngine3D.Common import logger, COLOR_BLACK
from PyEngine3D.OpenGLContext impo... | 4 | 4 | 41 | 8 | 57 | 0 |
src/btlesniffer/main.py | scipag/btle-sniffer | 107 | 173901 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Scan for Bluetooth Low Energy packets and attempt to identify them.
"""
import os
import sys
import argparse
import logging
import pathlib
from .sniffer import Sniffer
from ._version import get_versions
REQUIRE_PLATFORM = "linux"
def main() -> None:
parser =... | 0 | 1 | 0 | 0 | 1 | 0 |
adb/systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/log_io_test.py | mohanedmoh/TBS | 2,151 | 173909 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import sys
import tempfile
import unittest
from log import *
from parsed_trace_events import *... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/KoubeiRetailWmsOutboundorderCreateModel.py | snowxmas/alipay-sdk-python-all | 213 | 173924 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.OperateContext import OperateContext
from alipay.aop.api.domain.OutboundOrderLine import OutboundOrderLine
from alipay.aop.api.domain.OutboundOrde... | 0 | 5 | 0 | 3 | 8 | 0 |
orttraining/orttraining/python/training/ortmodule/_torch_module_factory.py | lchang20/onnxruntime | 6,036 | 173927 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# _torch_module_factory.py
from ._torch_module_ort import TorchModuleORT
from .debug_options import DebugOptions
from ._fallback import _FallbackManager
class TorchModuleFactory:
def __call__(self, module, debug_options... | 2 | 1 | 0 | 0 | 3 | 0 |
saleor/account/thumbnails.py | elwoodxblues/saleor | 15,337 | 173929 | <gh_stars>1000+
from ..celeryconf import app
from ..core.utils import create_thumbnails
from .models import User
@app.task
def create_user_avatar_thumbnails(user_id):
"""Create thumbnails for user avatar."""
create_thumbnails(
pk=user_id, model=User, size_set="user_avatars", image_attr="avatar"
)
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/imdb_precompute_test.py | jovialio/visualDet3D | 250 | 173932 | from copy import deepcopy
import torch
import cv2
import time
import pickle
import os
import numpy as np
import ctypes
from _path_init import *
from visualDet3D.utils.timer import Timer
from visualDet3D.utils.utils import cfg_from_file
from visualDet3D.data.kitti.kittidata import KittiData
def read_one_split(cfg, i... | 3 | 0 | 0 | 0 | 3 | 0 |
configs/spade_configs.py | NguyenHoangAn0511/gan-compression | 1,005 | 173938 | from configs.channel_configs import ChannelConfigs
def get_configs(config_name) -> object:
if config_name == 'channels-48':
return ChannelConfigs(n_channels=[[48, 40, 32],
[48, 40, 32], [48, 40, 32], [48, 40, 32], [48, 40, 32],
... | 0 | 1 | 0 | 0 | 1 | 0 |
code/aesmc/random_variable.py | jatucker4/DVRL | 115 | 173942 | <reponame>jatucker4/DVRL
import collections
import numpy as np
import torch
from . import state as st
from torch.autograd import Variable
import logging
import warnings
class RandomVariable():
"""Base class for random variables. Supported methods:
- sample(batch_size, num_particles)
- sample_repar... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/samples/violations/except_pass.py | swellander/tryceratops | 269 | 173949 | <filename>src/tests/samples/violations/except_pass.py
"""
Violation:
Except with pass
"""
class MyException(Exception):
pass
def somefunc():
try:
a = 1
except MyException:
pass # This is specific, so it should be fine
except Exception:
pass # This is broad, that's weird
... | 0 | 0 | 0 | 0 | 0 | 0 |
fhir/resources/DSTU2/visionprescription.py | cstoltze/fhir.resources | 144 | 173954 | # -*- coding: utf-8 -*-
"""
Profile: https://www.hl7.org/fhir/DSTU2/visionprescription.html
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import Any, Dict
from typing import List as ListType
from pydantic import Field, root_validator
from . import domainresource, fhirtypes
from .backboneelement import ... | 1 | 1 | 23 | 0 | 25 | 0 |
tests/unit/test_rule_model.py | radish-bdd/radish2 | 182 | 173990 | """
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import pytest
from radish.models import Rule, State
def test_rule_should_forward_set_feature_to_its_scenarios(mocker):
"""A Rule should forward a set ... | 0 | 0 | 0 | 0 | 0 | 0 |
CH10/CH10c_Faster_Transformer_model_serving_using_Tensorflow_Extended/main.py | sharif618/Mastering-Transformers | 155 | 173997 | <filename>CH10/CH10c_Faster_Transformer_model_serving_using_Tensorflow_Extended/main.py
import uvicorn
from fastapi import FastAPI
from pydantic import BaseModel
from transformers import BertTokenizerFast, BertConfig
import requests
import json
import numpy as np
tokenizer = BertTokenizerFast.from_pretrained("nateraw/... | 0 | 0 | 0 | 0 | 0 | 0 |
experiments/exp_utils.py | bfortuner/VOCdetect | 336 | 174001 | <gh_stars>100-1000
import os
import math
import shutil
from glob import glob
import config as cfg
import constants as c
import numpy as np
import utils.general as gen_utils
import utils.files
import models.utils
from clients import s3_client, es_client
def cleanup_experiments(exp_dir):
exp_paths = glob(exp_dir+... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/chem/test_tensorise_molecules.py | iamchetry/DataChallenge-Fall2021 | 108 | 174005 | import pytest
from chemml.chem import tensorise_molecules
from chemml.chem import Molecule
@pytest.fixture()
def mols() -> object:
m1 = Molecule('c1ccc1', 'smiles')
m2 = Molecule('CNC', 'smiles')
molecules = [m1, m2]
return molecules
def test_exception():
# not a molecule
with pytest.rais... | 0 | 1 | 0 | 0 | 1 | 0 |
model_compiler/tests/model_compiler/models/test_data_format.py | yuanliya/Adlik | 548 | 174034 | <gh_stars>100-1000
# Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from unittest import TestCase
from model_compiler.models import data_format
from model_compiler.models.data_format import DataFormat
from model_compiler.protos.generated.model_config_pb2 import ModelInput
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_version.py | cormacrelf/Coqtail | 160 | 174063 | # -*- coding: utf8 -*-
# Author: <NAME>
"""Version parsing unit tests."""
from typing import Tuple
import pytest
from xmlInterface import parse_version
# Version string, version tuple
tests = (
("1.2.3", (1, 2, 3)),
("1.2pl3", (1, 2, 3)),
("1.2", (1, 2, 0)),
("1.2+alpha3", (1, 2, 0)),
("1.2+alph... | 2 | 1 | 0 | 0 | 3 | 0 |
foolbox/models/numpy.py | SamplingAndEnsemblingSolvers/foolbox | 2,292 | 174089 | <reponame>SamplingAndEnsemblingSolvers/foolbox
from typing import TypeVar, Callable, Optional
import eagerpy as ep
from ..types import Bounds
from ..types import BoundsInput
from .base import Model
T = TypeVar("T")
class NumPyModel(Model):
def __init__(
self, model: Callable, bounds: BoundsInput, data... | 0 | 0 | 0 | 0 | 0 | 0 |
capstone/capdb/migrations/0040_auto_20180525_1905.py | rachelaus/capstone | 134 | 174095 | # Generated by Django 2.0.2 on 2018-05-25 19:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('capdb', '0039_auto_20180521_1511'),
]
operations: list[object] = [
migrations.AddField(
model_name='casex... | 0 | 0 | 2 | 0 | 2 | 0 |
external-import/kaspersky/src/kaspersky/__init__.py | tiiibs/connectors | 132 | 174111 | """Kaspersky module."""
| 0 | 0 | 0 | 0 | 0 | 0 |
openbook_posts/migrations/0028_auto_20190414_1953.py | TamaraAbells/okuna-api | 164 | 174204 | <filename>openbook_posts/migrations/0028_auto_20190414_1953.py
# Generated by Django 2.2 on 2019-04-14 17:53
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('openbook_communities', '0018_auto_20190309_1527'),
migrations.s... | 0 | 0 | 0 | 0 | 0 | 0 |
OpenCV models/BackgroundSubtractorMOG.py | youngster-all/Finger-Detection-and-Tracking | 308 | 174211 | <gh_stars>100-1000
import cv2
capture = cv2.VideoCapture(0)
fgbg = cv2.createBackgroundSubtractorMOG2()
while True:
_, frame = capture.read()
fmask = fgbg.apply(frame)
cv2.imshow("Orignal Frame", frame)
cv2.imshow("F Mask", fmask)
if cv2.waitKey(30) & 0xff == 27:
break
capture.release()... | 0 | 0 | 0 | 0 | 0 | 0 |
model/tfhhub.py | UKPLab/arxiv2018-xling-sentence-embeddings | 196 | 174276 | import logging
import os
import shutil
import sys
import tempfile
import click
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from word_embeddings import embeddings
def non_zero_tokens(tokens) -> object:
"""Receives a batch of vectors of tokens (float) which are zero-padded. Returns a v... | 0 | 6 | 0 | 0 | 6 | 0 |
examples/bloom_embeddings/plot.py | BBiering/spotlight | 2,873 | 174317 | from __future__ import annotations
import argparse
import pandas as pd
import matplotlib
matplotlib.use('Agg') # NOQA
import matplotlib.pyplot as plt
import seaborn as sns
from example import Results
def process_results(results, verbose: bool=False) -> bool | tuple[object, object, object]:
baseline = result... | 1 | 2 | 0 | 0 | 3 | 0 |
mmdet-v2/tools/third_party/useless/tricks/kmeans_anchor_boxes/tests/test_voc2007.py | li-phone/DetectionCompetition | 560 | 174325 | import glob
import xml.etree.ElementTree as ET
from unittest import TestCase
import numpy as np
from kmeans import kmeans, avg_iou
ANNOTATIONS_PATH = "Annotations"
class TestVoc2007(TestCase):
def __load_dataset(self) -> object:
dataset = []
for xml_file in glob.glob("{}/*xml".format(ANNOTATION... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/dmr_plot.py | jonaschn/tomotopy | 393 | 174327 | '''
This example show how to perform a DMR topic model using tomotopy
and visualize the topic distribution for each metadata
Required Packages:
matplotlib
'''
import tomotopy as tp
import numpy as np
import matplotlib.pyplot as plt
'''
You can get the sample data file from https://drive.google.com/file/d/1AUHdwa... | 0 | 0 | 0 | 0 | 0 | 0 |
stream/clients/python/bookkeeper/proto/kv_pb2.py | pkumar-singh/bookkeeper | 1,545 | 174339 | <reponame>pkumar-singh/bookkeeper
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: kv.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.protobu... | 0 | 0 | 0 | 0 | 0 | 0 |
python_circular_import/demo1/b.py | NightmareQAQ/python-notes | 106 | 174390 | <reponame>NightmareQAQ/python-notes
def hello():
print('hello in b.py') | 0 | 0 | 0 | 0 | 0 | 0 |
inselect/gui/plugins/plugin.py | NaturalHistoryMuseum/inselect | 128 | 174410 | <gh_stars>100-1000
class Plugin(object):
"""Base class for plugins.
The __init__ method of derived classes should accept two arguments:
document - an instance of InselectDocument
parent - a QMainWindow
Derived classes should contain
NAME - a string
DESCRIPTION - a string
... | 0 | 0 | 0 | 0 | 0 | 0 |
nuplan/planning/scenario_builder/nuplan_db/nuplan_scenario_builder.py | motional/nuplan-devkit | 128 | 174427 | from __future__ import annotations
import logging
from functools import partial
from typing import Any, List, Optional, Tuple, Type, Union, cast
from nuplan.common.actor_state.vehicle_parameters import VehicleParameters, get_pacifica_parameters
from nuplan.common.maps.nuplan_map.map_factory import NuPlanMapFactory
fr... | 15 | 6 | 0 | 0 | 21 | 0 |
tests/helpers.py | joowani/dtags | 405 | 174435 | import re
from typing import List
from dtags.files import COMP_FILE, DEST_FILE, get_file_path
ANSI_ESCAPE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
def clean_str(value: str) -> str:
return ANSI_ESCAPE.sub("", value)
def load_completion() -> List[str]:
with open(get_file_path(COMP_FILE)) as fp... | 1 | 3 | 0 | 0 | 4 | 0 |
downstream/tinypersons/tests/test_onnx/__init__.py | bwconrad/solo-learn | 326 | 174461 | <filename>downstream/tinypersons/tests/test_onnx/__init__.py
from .utils import ort_validate
__all__ = ['ort_validate']
| 0 | 0 | 0 | 0 | 0 | 0 |
imperative/python/megengine/module/pixel_shuffle.py | Olalaye/MegEngine | 5,168 | 174477 | # MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ... | 1 | 1 | 0 | 0 | 2 | 0 |
terminal_dungeon/renderer.py | hellogoose/terminal_dungeon | 207 | 174491 | from __future__ import annotations
import os
import curses
import numpy as np
from pathlib import Path
ROOT = Path("terminal_dungeon")
WALL_DIR = ROOT / "wall_textures"
SPRITE_DIR = ROOT / "sprite_textures"
def clamp(mi, val, ma) -> object:
return max(min(ma, val), mi)
class Renderer:
"""
Graphic engine... | 2 | 3 | 6 | 0 | 11 | 0 |
siem/10_GetOffenseTypes.py | IBM/api-samples | 172 | 174496 | #!/usr/bin/env python3
# This sample demonstrates how to use the siem endpoint in the
# REST API.
# For this scenario to work, there must already be custom offense
# types on the system where the sample is being run.
# The scenario demonstrates the following
# actions:
# - How to get all offense types
# - How to get... | 0 | 0 | 0 | 0 | 0 | 0 |
Intro_to_Recommendation_Systems/api.py | NunoEdgarGFlowHub/sciblog_support | 668 | 174503 | import cherrypy
from paste.translogger import TransLogger
from flask import Flask, request, abort, jsonify, make_response
import json
import os
from utils import decode_string
from DeepRecommender.reco_encoder.data import input_layer_api, input_layer
from DeepRecommender.reco_encoder.model import model
import torch
fro... | 0 | 9 | 0 | 0 | 9 | 0 |
src/openfermion/ops/representations/doci_hamiltonian_test.py | bene1337/OpenFermion | 1,291 | 174534 | # 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
# distribu... | 0 | 0 | 0 | 0 | 0 | 0 |
common/test/test_json_serializer.py | andkononykhin/plenum | 148 | 174537 | <reponame>andkononykhin/plenum<gh_stars>100-1000
from common.serializers.json_serializer import JsonSerializer
def testJsonSerializer():
sz = JsonSerializer()
m1 = {'integer': 36, 'name': 'Foo', 'surname': 'Bar', 'float': 14.8639,
'index': 1, 'index_start_at': 56, 'email': '<EMAIL>',
'full... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/xmaslights-tetrahedron.py | mmoegele/xmastree2020 | 545 | 174588 | <reponame>mmoegele/xmastree2020<filename>examples/xmaslights-tetrahedron.py
def xmaslight():
# This is the code from my
#NOTE THE LEDS ARE GRB COLOUR (NOT RGB)
# Here are the libraries I am currently using:
import time
import board
import neopixel
import re
import math
... | 0 | 0 | 0 | 0 | 0 | 0 |
planning&perception/number_distinguish/src/MAIN.py | Hinson-A/guyueclass | 227 | 174601 | import torch
import torch.nn as nn
from torch.autograd import Variable
from include import IMG_h
from include import CNN_h
from include import UI_h
import torch.utils.data as Data
train_path = 'D:/PycharmProjects/Num_distinguish/train_data/labels.txt'
test_path = 'D:/PycharmProjects/Num_distinguish/test_data'... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/alexa/utils.py | goztrk/django-htk | 206 | 174691 | # Python Standard Library Imports
from __future__ import annotations
import copy
# Third Party (PyPI) Imports
#import json
#import requests
import rollbar
# HTK Imports
from htk.utils import htk_setting
def is_valid_alexa_skill_webhook_event(event, request) -> object:
"""Determines whether the Alexa skill webho... | 1 | 6 | 0 | 0 | 7 | 0 |
pyNTM/exceptions.py | fooelisa/network_traffic_modeler_py3 | 102 | 174693 | """Exceptions"""
class ModelException(Exception):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
src/function_context.py | CrackerCat/Karta | 716 | 174732 | from __future__ import annotations
from core.function_context import *
from config.utils import *
from collections import defaultdict
import config.libc_config as libc
class ExternalFunction(CodeContext):
"""A context that describes a source-code point of view of an external function, using... | 2 | 26 | 0 | 28 | 56 | 0 |
applications/cli/commands/predict/batch.py | nparkstar/nauta | 390 | 174734 | #
# 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 applicable law or agreed to... | 11 | 0 | 0 | 0 | 11 | 0 |
photogrammetry_importer/operators/import_op.py | clayne/Blender-Addon-Photogrammetry-Importer | 452 | 174754 | <filename>photogrammetry_importer/operators/import_op.py
import os
import numpy as np
import bpy
import math
from bpy.props import (
CollectionProperty,
StringProperty,
BoolProperty,
EnumProperty,
FloatProperty,
IntProperty,
)
from bpy_extras.io_utils import ImportHelper, axis_conversion
cla... | 0 | 0 | 0 | 0 | 0 | 0 |
exp.voc/voc8.res50v3+.GCT/gct_util.py | Yongjin-colin-choi/TorchSemiSeg | 268 | 174765 | from __future__ import annotations
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
import scipy.ndimage
from config import config
class FlawDetector(nn.Module):
""" The FC Discriminator proposed in paper:
'Guided Collaborative Training for Pixel-wise Semi-... | 5 | 9 | 1 | 1 | 16 | 0 |
script.py | 78778443/permeate | 260 | 174771 | #引入需要的模块
import os
import time
import sys
import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
# 更新代码
os.system("php /root/start.php")
#定义grep关键词,和需要执行的命令
keyList = {
# 'rad.php':'cd /root/qingscan/edge && php rad.php >> ./tmp/edge_rad.txt & ',
# 'xray.php':'cd /root/qingscan/edge && ... | 0 | 0 | 0 | 0 | 0 | 0 |
swig/python/gdal-utils/scripts/gdal_merge.py | FeU-aKlos/gdal | 3,100 | 174783 | #!/usr/bin/env python3
import sys
# import osgeo_utils.gdal_merge as a convenience to use as a script
from osgeo_utils.gdal_merge import * # noqa
from osgeo_utils.gdal_merge import main
from osgeo.gdal import deprecation_warn
deprecation_warn('gdal_merge')
sys.exit(main(sys.argv))
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_losses.py | anibali/dsntnn | 258 | 174786 | import hypothesis
import numpy as np
import pytest
import torch
from hypothesis.extra.numpy import arrays, array_shapes
from hypothesis.strategies import floats
from torch.testing import assert_allclose
from dsntnn import average_loss, euclidean_losses, l1_losses, mse_losses
_LOSSES_FNS = {
'euclidean': euclidean... | 0 | 1 | 0 | 0 | 1 | 0 |
sciluigi/interface.py | mikelynch/sciluigi | 285 | 174817 | <gh_stars>100-1000
'''
This module contains mappings of methods that are part of the sciluigi API
'''
import luigi
import logging
import sciluigi.util
LOGFMT_STREAM = '%(asctime)s | %(levelname)8s | %(message)s'
LOGFMT_LUIGI = '%(asctime)s %(levelname)8s LUIGI %(message)s'
LOGFMT_SCILUIGI = '%(asctime)s %(levelnam... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/cpuspeed/const.py | MrDelik/core | 30,023 | 174849 | """Constants for the CPU Speed integration."""
import logging
from typing import Final
from homeassistant.const import Platform
DOMAIN: Final = "cpuspeed"
PLATFORMS = [Platform.SENSOR]
LOGGER = logging.getLogger(__package__)
| 0 | 0 | 1 | 0 | 1 | 0 |
osm/GeoFabrikSpider.py | larsrinn/openpoiservice | 131 | 174888 | # USAGE: sudo scrapy runspider GeoFabrikSpider.py
import scrapy
import os
import subprocess
from time import sleep
from urllib import parse
from scrapy.selector import Selector
class GeoFabrikSpider(scrapy.Spider):
name: str = "geofabrik_spider"
start_urls: list[str] = ['https://download.geofabrik.de/']
... | 0 | 0 | 3 | 0 | 3 | 0 |
plenum/common/prepare_batch.py | andkononykhin/plenum | 148 | 174899 | <gh_stars>100-1000
from stp_core.common.log import getlogger
SPLIT_STEPS_LIMIT = 8
logger = getlogger()
def split_messages_on_batches(msgs, make_batch_func, is_batch_len_under_limit):
batches = []
while msgs:
batch = ''
msgs_for_batch = []
while msgs and is_batch_len_under_limit(len... | 0 | 0 | 0 | 0 | 0 | 0 |
src/backend/common/sitevars/tests/google_analytics_id_test.py | ofekashery/the-blue-alliance | 266 | 174919 | from backend.common.sitevars.google_analytics_id import ContentType, GoogleAnalyticsID
def test_key():
assert GoogleAnalyticsID.key() == "google_analytics.id"
def test_description():
assert (
GoogleAnalyticsID.description()
== "Google Analytics ID for logging API requests"
)
def test_d... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/xmaslights-contagion.py | mmoegele/xmastree2020 | 545 | 174929 | from __future__ import annotations
def xmaslight() -> object | str | None:
# This is the code from my
#NOTE THE LEDS ARE GRB COLOUR (NOT RGB)
# Here are the libraries I am currently using:
import time
import board
import neopixel
import re
import math
# You are welcom... | 0 | 8 | 0 | 0 | 8 | 0 |
osrc/rate_limit.py | dmessing/osrc | 279 | 174944 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
__all__ = ["limiter"]
limiter = Limiter(
key_func=get_remote_address,
global_limits=["10/minute"],
)
| 0 | 0 | 0 | 0 | 0 | 0 |
integration_test/helpers.py | robintw/recipy | 451 | 175010 | from __future__ import annotations
"""
Helper functions for recipy tests.
"""
# Copyright (c) 2016 University of Edinburgh.
import os
import os.path
import re
import shutil
try:
from ConfigParser import SafeConfigParser
except:
from configparser import SafeConfigParser
from integration_test import database
... | 3 | 5 | 0 | 0 | 8 | 0 |
revolver/data/conditional.py | Qinka/revolver | 151 | 175107 | <gh_stars>100-1000
import numpy as np
from torch.utils.data import Dataset
from .seg import MaskSemSeg
from .filter import TargetFilter
from .sparse import SparseSeg
from .util import Wrapper
class ConditionalInstSeg(Wrapper, Dataset):
"""
Construct inputs (support image sparse annotations, query image)
... | 0 | 0 | 0 | 0 | 0 | 0 |
testware/integration-tests/src/test/resources/snippets/gremlin-python.py | vigorouscoding/cypher-for-gremlin | 301 | 175123 | #!/usr/bin/python3
# freshReadmeSnippet: example
from gremlin_python.driver.client import Client
from gremlin_python.driver.request import RequestMessage
from gremlin_python.driver.serializer import GraphSONMessageSerializer
serializer = GraphSONMessageSerializer()
# workaround to avoid exception on any opProcessor ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/config.py | jytime/Deep-SfM-Revisited | 126 | 175130 | from __future__ import annotations
from easydict import EasyDict as edict
import numpy as np
import torch.nn as nn
__C = edict()
cfg = __C
### Define config flags here
### Some flags are dummy, would be removed later
### Name of the config
__C.TAG = 'default'
### Training and validation
__C.GT_DEPTH_DIR = No... | 2 | 1 | 0 | 0 | 3 | 0 |
pydis_site/apps/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py | Transfusion/site | 700 | 175151 | <filename>pydis_site/apps/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py<gh_stars>100-1000
# Generated by Django 2.1.5 on 2019-01-09 19:50
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0025_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ev3dev/experimental/thread_tools.py | ZPhilo/pybricks-micropython | 115 | 175155 | import uos
from pybricks.experimental import run_parallel
from pybricks.tools import wait
if uos.getenv("PYBRICKS_BUILD_ENV") == "docker-armel":
# qemu-user-static has issues with threads
print("SKIP")
raise SystemExit
def task1() -> str:
wait(1000)
return "OK1"
def task2() -> str:
wait(50... | 0 | 2 | 0 | 0 | 2 | 0 |
src/test/resources/python-code-examples/deducetype_nonparam.py | florayym/depends | 146 | 175162 | <reponame>florayym/depends<gh_stars>100-1000
class Type1:
def f1_1():
pass
def test(t1):
t1.f1_1()
t2 = t1
| 0 | 0 | 0 | 0 | 0 | 0 |
nilearn/_utils/segmentation.py | lemiceterieux/nilearn | 827 | 175165 | from __future__ import annotations
"""
Random walker segmentation algorithm
from *Random walks for image segmentation*, <NAME>, IEEE Trans
Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83.
This code is mostly adapted from scikit-image 0.11.3 release.
Location of file in scikit image: random_walker function and its s... | 8 | 10 | 0 | 0 | 18 | 0 |
src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/c/__init__.py | puraner/RED | 375 | 175168 | i = 1
while i > 0:
print("true")
| 0 | 0 | 0 | 0 | 0 | 0 |
spidermon/contrib/monitors/mixins/stats.py | zanachka/spidermon | 405 | 175190 | <filename>spidermon/contrib/monitors/mixins/stats.py<gh_stars>100-1000
from spidermon.exceptions import NotConfigured
class StatsMonitorMixin:
@property
def stats(self):
if not self.data.stats:
raise NotConfigured("Stats not available!")
return self.data.stats
| 0 | 0 | 0 | 0 | 0 | 0 |
contrib/profiler/profiler.py | luxius-luminus/pai | 1,417 | 175195 | <reponame>luxius-luminus/pai<filename>contrib/profiler/profiler.py
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
api/tests/integration/tests/layout/cis_trans.py | tsingdao-Tp/Indigo | 204 | 175198 | <reponame>tsingdao-Tp/Indigo
import os
import sys
import errno
sys.path.append('../../common')
from env_indigo import *
if not os.path.exists(joinPathPy("out", __file__)):
try:
os.makedirs(joinPathPy("out", __file__))
except OSError as e:
if e.errno != errno.EEXIST:
raise
indigo =... | 0 | 0 | 0 | 0 | 0 | 0 |
tfrecord.py | patirck620/tensor_holography | 149 | 175225 | from __future__ import annotations
import os
import abc
import cv2
import numpy as np
import tensorflow as tf
class TFRecordGenerator(abc.ABC):
def __init__(self, tfrecord_path, labels, dir_paths: object | None=None, file_paths: object | None=None):
# tfrecord_path : record tfrecord_path
# dir_path... | 6 | 4 | 0 | 8 | 18 | 0 |
introduction_to_classic_ciphers/lesson6/task1/question_01.py | behzod/pycharm-courses | 213 | 175249 | <reponame>behzod/pycharm-courses
ENCRYPTED_MESSAGE = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM'
DECRYPTED_MESSAGE = 'MEETATNOON'
CIPHER_OPTIONS = ['null','caesar','atbash']
cipher_used_in_this_example = CIPHER_OPTIONS[0] # replace with the index of the cipher used in this encryption
| 0 | 0 | 0 | 0 | 0 | 0 |
indy_node/test/node_control_utils/test_debian_version.py | Rob-S/indy-node | 627 | 175308 | import pytest
from common.version import InvalidVersionError, GenericVersion
from indy_common.version import NodeVersion
from indy_node.utils.node_control_utils import DebianVersion, NodeControlUtil, ShellError
# TODO
# - conditionally skip all tests for non-debian systems
generated_command = None
class UpstreamT... | 0 | 8 | 0 | 0 | 8 | 0 |
startup/GafferSceneUI/gafferSceneExamples.py | ddesmond/gaffer | 561 | 175317 | <reponame>ddesmond/gaffer<gh_stars>100-1000
import Gaffer
import GafferUI
import GafferScene
GafferUI.Examples.registerExample(
"Scene Processing/Per-location Transform Spreadsheet",
"$GAFFER_ROOT/resources/examples/sceneProcessing/perLocationTransformSpreadsheet.gfr",
description = """
Demonstrates how to use the... | 0 | 0 | 0 | 0 | 0 | 0 |
lucent/misc/io/showing.py | fuzhanrahmanian/lucent | 449 | 175325 | # Slightly modified from original Lucid library
# Copyright 2018 The Lucid 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/license... | 17 | 4 | 0 | 0 | 21 | 0 |
third_party/blink/tools/blinkpy/w3c/wpt_uploader.py | chromium/chromium | 14,668 | 175393 | # Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Uploads Wpt test results from Chromium to wpt.fyi."""
import argparse
import gzip
import json
import logging
import os
import requests
import tempfile
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
blockchain/v2/__init__.py | intel9911/api-v1-client-python | 1,001 | 175413 | <filename>blockchain/v2/__init__.py
from . import (
receive
)
| 0 | 0 | 0 | 0 | 0 | 0 |
losses.py | AndreaVargasAndia/Pytorch-Human-Pose-Estimation | 423 | 175418 | from __future__ import annotations
import torch
import torch.nn as nn
import torch.nn.functional as F
class Loss(object):
"""docstring for Loss"""
def __init__(self, opts):
super(Loss, self).__init__()
self.opts = opts
def StackedHourGlass(self, output, target, ... | 5 | 5 | 0 | 0 | 10 | 0 |
yubico/yubikey_base.py | Tiboris/python-yubico | 161 | 175423 | <reponame>Tiboris/python-yubico
"""
module for Yubikey base classes
"""
# Copyright (c) 2010, 2011, 2012 Yubico AB
# See the file COPYING for licence statement.
from .yubico_version import __version__
from . import yubico_exception
class YubiKeyError(yubico_exception.YubicoError):
"""
Exception raised concer... | 0 | 0 | 0 | 0 | 0 | 0 |
ktrain/vision/__init__.py | RobWillison/ktrain | 1,013 | 175464 | from .models import print_image_classifiers, image_classifier
from .models import print_image_regression_models, image_regression_model
from .data import show_image, show_random_images, preview_data_aug, get_data_aug
from .data import images_from_folder, images_from_csv, images_from_array, images_from_fname, preprocess... | 0 | 0 | 0 | 0 | 0 | 0 |
pyramda/logic/all_pass_test.py | sergiors/pyramda | 124 | 175481 | from .all_pass import all_pass
def positive(x) -> object:
return x > 0
def less_than_ten(x) -> object:
return x < 10
def all_pass_nocurry_test():
assert all_pass([], "foo")
assert all_pass([positive, less_than_ten], 5)
assert not all_pass([positive, less_than_ten], 10)
assert not all_pass(... | 0 | 2 | 0 | 0 | 2 | 0 |
pycaret/internal/validation.py | hanaseleb/pycaret | 5,541 | 175501 | from __future__ import annotations
from copy import deepcopy
from typing import Any, Optional, Union
import pandas as pd
from pycaret.internal.logging import get_logger
from pycaret.internal.Display import Display
from sklearn.base import clone
from sklearn.utils.validation import check_is_fitted
from sklearn.pipeline... | 4 | 6 | 0 | 0 | 10 | 0 |
gdc_client/log/parser.py | jrouly/gdc-client | 139 | 175507 | <reponame>jrouly/gdc-client
import argparse
import logging
import sys
from gdc_client import version
from gdc_client.log.log import LogFormatter
def setup_logging(args):
""" Set up logging given parsed logging arguments.
"""
log_level = min(args.log_levels) if hasattr(args, "log_levels") else logging.IN... | 0 | 0 | 0 | 0 | 0 | 0 |
challenges/3.5.Less_Than_Equal_To_Operator/main.py | pradeepsaiu/python-coding-challenges | 141 | 175513 | def less_or_equal(value) -> str:
if value : # Change this line
return "25 or less"
elif value : # Change this line
return "75 or less"
else:
return "More than 75"
# Change the value 1 below to experiment with different values
print(less_or_equal(1))
| 0 | 1 | 0 | 0 | 1 | 0 |
loop.py | ryan293/MikrotikExploit | 111 | 175574 | #!/usr/bin/env python3
import socket
import sys
from extract_user import dump
import ipcalc
import hashlib
import requests
import optparse
parser = optparse.OptionParser()
parser.add_option('-f', '--fileName',action="store", dest="fileName",help="enter text file", default="empty")
parser.add_option('-p', '--port',acti... | 0 | 0 | 0 | 0 | 0 | 0 |
mode/examples/Topics/Interaction/Tickle/Tickle.pyde | timgates42/processing.py | 1,224 | 175589 | """
Tickle.
The word "tickle" jitters when the cursor hovers over.
Sometimes, it can be tickled off the screen.
"""
message = "tickle"
# X and Y coordinates of text
x = 0
y = 0
# horizontal and vertical radius of the text
hr = 0
vr = 0
def setup():
global x, y, hr, vr
size(640, 360)
# Create the font
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/python/PostingTest.py | sanel/ledger | 3,509 | 175618 | # -*- coding: utf-8 -*-
import unittest
import exceptions
import operator
from ledger import *
from StringIO import *
from datetime import *
class PostingTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_(self):
pass
def suite() -> object:
... | 0 | 1 | 0 | 0 | 1 | 0 |
anime_dl/__init__.py | tiagotda/anime-dl | 246 | 175621 | import common
import external
import sites
| 0 | 0 | 0 | 0 | 0 | 0 |
tessagon/core/value_blend.py | virtualritz/tessagon | 199 | 175632 | <gh_stars>100-1000
class ValueBlend:
def _init_corners(self, **kwargs):
# Corners is list of tuples:
# [bottomleft, bottomright, topleft, topright]
if 'corners' in kwargs:
self.corners = kwargs['corners']
if len(self.corners) != 4 or \
any(len(v) != ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/api_test.py | dave-miles/jenkins-bootstrap-jervis | 290 | 175650 | #!/usr/bin/env python
#Created by <NAME>
#Meant to read from stdin a JSON blob from Jenkins master root
import json
import sys
response = json.load(sys.stdin)
jobs = map(lambda x: x['name'], response['jobs'])
views = map(lambda x: x['name'], response['views'])
assert '_jervis_generator' in jobs
assert 'GitHub Organizat... | 0 | 0 | 0 | 0 | 0 | 0 |
lightbus/client/commands.py | gcollard/lightbus | 178 | 175713 | <reponame>gcollard/lightbus<filename>lightbus/client/commands.py
import logging
from typing import NamedTuple, Optional, List, Tuple
from lightbus.api import Api
from lightbus.message import EventMessage, RpcMessage, ResultMessage
from lightbus.utilities.internal_queue import InternalQueue
logger = logging.getLogger... | 0 | 0 | 0 | 0 | 0 | 0 |
mindsdb/integrations/postgres/postgres.py | mindsdb/main | 261 | 175717 | from contextlib import closing
import psycopg
class PostgreSQLConnectionChecker:
def __init__(self, **kwargs):
self.host = kwargs.get('host')
self.port = kwargs.get('port')
self.user = kwargs.get('user')
self.password = kwargs.get('password')
self.database = kwargs.get('dat... | 0 | 2 | 0 | 0 | 2 | 0 |
fexm/evalscripts/evalscript.py | fgsect/fexm | 105 | 175723 | <filename>fexm/evalscripts/evalscript.py
import argparse
import json
import sys
import os
import sh
from sh import docker
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)
import time
# import multiprocessing
def reset(package: str):
container_name = pack... | 0 | 0 | 0 | 0 | 0 | 0 |
src/hcrystalball/compose/__init__.py | betatim/hcrystalball | 139 | 175736 | from ._ts_column_transformer import TSColumnTransformer
__all__ = [
"TSColumnTransformer",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.