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 |
|---|---|---|---|---|---|---|---|---|---|---|
recipes/Python/273844_Minimal_http_upload_cgi/recipe-273844.py | tdiprima/code | 2,023 | 3315376 | <gh_stars>1000+
#!/usr/local/bin/python
"""This demonstrates a minimal http upload cgi.
This allows a user to upload up to three files at once.
It is trivial to change the number of files uploaded.
This script has security risks. A user could attempt to fill
a disk partition with endless uploads.
If you have a system... | 0 | 0 | 0 | 0 | 0 | 0 |
src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_hit_count.py | r3m0t/debugpy | 695 | 3315387 | if __name__ == '__main__':
x = 0 # before loop line
for i in range(10): # for line
print(i) # print line
print('TEST SUCEEDED!')
| 0 | 0 | 0 | 0 | 0 | 0 |
build/android/pylib/perf/perf_control.py | nagineni/chromium-crosswalk | 231 | 3315459 | <filename>build/android/pylib/perf/perf_control.py<gh_stars>100-1000
# Copyright 2013 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
class PerfControl(object):
"""Provides methods for setting the perfo... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudpathlib/azure/__init__.py | kabirkhan/cloudpathlib | 128 | 3315468 | from .azblobclient import AzureBlobClient
from .azblobpath import AzureBlobPath
__all__ = [
"AzureBlobClient",
"AzureBlobPath",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
alphatools/ics/ics_scheme.py | marketneutral/alphatools | 302 | 3315634 | <gh_stars>100-1000
import numpy as np
import pandas as pd
from numpy import where, zeros
from zipline.data import bundles
from zipline.pipeline.classifiers import Classifier
from zipline.utils.numpy_utils import int64_dtype, object_dtype
from os import path
class SICMajorIndustry(Classifier):
dtype = int64... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/CreateTFRecords/create_generic_db2.py | ladt/SeeingThroughFog | 143 | 3315646 | <reponame>ladt/SeeingThroughFog
#!/usr/bin/env python2
# Copyright (c) 2016-2017, Daimler AG. All rights reserved.
import argparse
# Find the best implementation available
import logging
import os
from generic_tf_tools.tf_records import TFCreator
from generic_tf_tools.data2example import SwedenImagesv2
logging.basi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dartlint.py | my-personal-forks/dart-sublime-bundle | 145 | 3315714 | # Copyright (c) 2014, <NAME>. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
import sublime
import unittest
from Dart.lib.path import is_dart_script
from Dart.lib.path import is_view_dart_script
cl... | 0 | 0 | 0 | 0 | 0 | 0 |
hyper_click/path_resolver.py | niksy/HyperClick | 225 | 3315721 | from os import path
from .jstl_path_resolver import JstlPathResolver
from .generic_path_resolver import GenericPathResolver
class HyperClickPathResolver:
def __init__(self, view, str_path, roots, settings):
current_file = view.file_name()
current_dir = path.dirname(path.realpath(current_file))
... | 0 | 1 | 0 | 0 | 1 | 0 |
calc-hash.py | saurabhacellere/sakura | 953 | 3315732 | <filename>calc-hash.py
import hashlib
import os
import sys
def getSha256(fileName):
hash = hashlib.sha256()
with open(fileName, 'rb') as f:
while True:
chunk = f.read(hash.block_size)
if chunk:
hash.update(chunk)
else:
break
checksum = hash.hexdigest()
return checksum
def writeHash(hashFile, t... | 0 | 0 | 0 | 0 | 0 | 0 |
regtests/typed/int.py | ahakingdom/Rusthon | 622 | 3315745 | <reponame>ahakingdom/Rusthon<gh_stars>100-1000
"""int static type"""
def main():
int x = 1
y = x + x
TestError( y==2 )
int z = 2
w = z * 2
TestError( w==4 )
w = z * 3
TestError( w==6 )
w = z * 64
TestError( w==128 )
w = z // 2
TestError( w==1 )
z = 640
w = z // 64
TestError( w==10 ) | 0 | 0 | 0 | 0 | 0 | 0 |
runners/challenge_runner.py | cgeller/WorldOnRails | 108 | 3315793 | import ray
from copy import deepcopy
from leaderboard.leaderboard_evaluator import LeaderboardEvaluator
from leaderboard.utils.statistics_manager import StatisticsManager
class ChallengeRunner():
def __init__(self, args, scenario, route, port: int=1000, tm_port: int=1002, debug: bool=False):
args = deepcop... | 3 | 1 | 0 | 0 | 4 | 0 |
python/demo/sts_policy_test.py | shouwenbo/qcloud-cos-sts-sdk | 137 | 3315804 | #!/usr/bin/env python
# coding=utf-8
import json
import os
from sts.sts import Sts, Scope
def test_policy():
scope = Scope('name/cos:PutObject', 'test-1250000000', 'ap-guangzhou', 'exampleobject')
scopes = list()
scopes.append(scope)
print(json.dumps(Sts.get_policy(scopes), indent=4))
def test_poli... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/NCSCCyberAsssessmentFramework/Scripts/EntryWidgetNCSCResultsA/EntryWidgetNCSCResultsA.py | diCagri/content | 799 | 3315865 | <reponame>diCagri/content<gh_stars>100-1000
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
incident = demisto.incidents()
cafaresult = incident[0].get("CustomFields", {}).get("cafaresultraw", {})
if type(cafaresult) != dict:
cafaresult = json.loads(cafaresult)
total = le... | 0 | 0 | 0 | 0 | 0 | 0 |
usb3_pipe/__init__.py | Xiretza/usb3_pipe | 114 | 3315870 | <filename>usb3_pipe/__init__.py
from usb3_pipe.serdes import K7USB3SerDes
from usb3_pipe.serdes import A7USB3SerDes
from usb3_pipe.serdes import ECP5USB3SerDes
from usb3_pipe.core import USB3PIPE
| 0 | 0 | 0 | 0 | 0 | 0 |
src/tfi/parse/docstring.py | ajbouh/tfi | 160 | 3315871 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
sphinx.ext.napoleon.docstring
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Classes for docstring parsing and formatting.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import collections
import inspect... | 0 | 0 | 0 | 0 | 0 | 0 |
Cream/lib/core/retrain.py | wkcn/AutoML | 307 | 3315900 | <gh_stars>100-1000
import os
import time
import torch
import torchvision
from collections import OrderedDict
from lib.utils.util import AverageMeter, accuracy, reduce_tensor
# retrain function
def train_epoch(
epoch, model, loader, optimizer, loss_fn, cfg,
lr_scheduler=None, saver=None, output_dir=''... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_tool_scroll.py | gaphor/gaphas | 108 | 3315910 | from gi.repository import Gtk
from gaphas.tool.scroll import on_scroll, scroll_tool
def test_scroll_tool_returns_a_controller(view):
tool = scroll_tool(view)
assert isinstance(tool, Gtk.EventController)
def test_offset_changes(view, scrolled_window):
tool = scroll_tool(view)
view.add_controller(to... | 0 | 0 | 0 | 0 | 0 | 0 |
RL/src/normalized_env.py | carpeanon/input_convex | 258 | 3315921 | # Code from Repo SimonRamstedt/ddpg
# Heavily modified
from __future__ import annotations
import gym
import numpy as np
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_float('reward_k', 1, 'reward factor')
def make_normalized_env(env) -> object | tuple[object, object, object, object]:
... | 0 | 5 | 0 | 1 | 6 | 0 |
rest_typed_views/validators/__init__.py | filwaline/drf-typed-views | 193 | 3315934 | <gh_stars>100-1000
from .pydantic_validator import PydanticValidator
from .type_system_validator import TypeSystemValidator
from .default_validator import DefaultValidator
from .current_user_validator import CurrentUserValidator
from .marshmallow_validator import MarshMallowValidator
from .validator_factory import Vali... | 0 | 0 | 0 | 0 | 0 | 0 |
src/reflection/parser/ast/enums.py | roscopecoltran/siplasplas | 182 | 3315947 | from clang.cindex import Cursor, CursorKind
from ast.node import Node
from utility.code_generation import string_to_char_pack
class Enum(Node):
def __init__(self, **kwargs):
Node.__init__(self, **kwargs)
self.constants = [cursor.spelling for cursor in self.cursor.get_children() if cursor.kind == ... | 0 | 1 | 0 | 0 | 1 | 0 |
corehq/blobs/tests/test_init.py | dimagilg/commcare-hq | 471 | 3315966 | from __future__ import annotations
import re
from os.path import join
from django.test import override_settings
from mock import patch
from testil import assert_raises, tempdir
import corehq.blobs as mod
from corehq.util.test_utils import generate_cases
from settingshelper import SharedDriveConfiguration
@generate_... | 2 | 0 | 0 | 0 | 2 | 0 |
scripts/mongo_cleanup.py | fictivekin/openrecipes | 300 | 3315968 | <gh_stars>100-1000
#!/usr/bin/env python
import pymongo
import os
import sys
import logging
import argparse
script_path = os.path.abspath(os.path.dirname(__file__))
new_path = os.path.abspath((os.path.join(script_path, '..', 'scrapy_proj')))
# add this path so we can import openrecipes.*
sys.path.append(new_path)
# c... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_pipelines/test_datetime.py | mikeywaites/kim | 356 | 3315973 | <gh_stars>100-1000
from datetime import datetime, date
from iso8601.iso8601 import Utc
import pytest
from kim.field import FieldInvalid, DateTime, Date
from kim.pipelines.base import Session
from kim.pipelines.datetime import is_valid_datetime
from ..conftest import get_mapper_session
def test_is_valid_datetime_pi... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578048_IFS_fractal/recipe-578048.py | tdiprima/code | 2,023 | 3315992 | <gh_stars>1000+
# IFS fractal dimension calculation
# http://en.wikipedia.org/wiki/Iterated_function_system
# http://en.wikipedia.org/wiki/Fractal_dimension
# http://en.wikipedia.org/wiki/List_of_fractals_by_Hausdorff_dimension
# FB - 20120218
import math
import random
from PIL import Image
imgx = 512
imgy = 512 # will... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/setup_scheduler/workflow_lib/utils.py | cclauss/redun | 303 | 3316007 | <reponame>cclauss/redun<gh_stars>100-1000
from redun import task
redun_namespace = "redun.examples.startup.workflow_lib.utils"
ANALYSIS_IMAGE = "YOUR_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/redun_aws_batch_example"
POSTPROCESS_IMAGE = "YOUR_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/redun_aws_batch_example"
@ta... | 0 | 0 | 0 | 0 | 0 | 0 |
docker_custodian/args.py | AnjanaSuraj/docker-custodian | 377 | 3316029 | <gh_stars>100-1000
import datetime
from dateutil import tz
from pytimeparse import timeparse
def timedelta_type(value):
"""Return the :class:`datetime.datetime.DateTime` for a time in the past.
:param value: a string containing a time format supported by
mod:`pytimeparse`
"""
if value is None:
... | 0 | 0 | 0 | 0 | 0 | 0 |
rlgraph/components/common/slice.py | RLGraph/RLGraph | 290 | 3316030 | # Copyright 2018/2019 The RLgraph 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 appli... | 4 | 1 | 0 | 0 | 5 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractPandaTranslations.py | fake-name/ReadableWebProxy | 193 | 3316049 | <reponame>fake-name/ReadableWebProxy
def extractPandaTranslations(item):
"""
Parser for 'Panda Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [
('Divine Genius Healer, Abandoned Woma... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/lib/test_group.py | bogdanvuk/pygears | 120 | 3316056 | import pytest
from pygears import Intf, gear
from pygears.lib import decouple
from pygears.lib import group
from pygears.lib.delay import delay_rng
from pygears.lib.verif import directed, drv
from pygears.sim import sim
from pygears.typing import Queue, Uint
from pygears.util.test_utils import formal_check, synth_chec... | 0 | 2 | 0 | 0 | 2 | 0 |
third_party/chromite/cbuildbot/stages/tast_test_stages.py | zipated/src | 2,151 | 3316115 | <reponame>zipated/src
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing stages for running Tast integration tests.
This module contains cbuildbot test stages ... | 0 | 0 | 0 | 0 | 0 | 0 |
singleton.py | DazEB2/SimplePyScripts | 117 | 3316147 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://www.python.org/dev/peps/pep-0318/#examples
def singleton(cls) -> object:
instances = dict()
def get_instance() -> object:
if cls not in instances:
instances[cls] = cls()
return instances[cl... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/validation/tests/v1_api/test_monitoring_v2.py | ursinnDev/rancher_rancher | 18,697 | 3316148 | from .common import * # NOQA
import pytest
import requests
import semver
namespace = {'client': None,
'cluster': None,
'rancher_catalog': None,
'project': None}
m_chart_name = 'rancher-monitoring'
m_version = os.environ.get('RANCHER_MONITORING_V2_VERSION', None)
m_app = 'cattle-... | 0 | 2 | 0 | 0 | 2 | 0 |
openbook_notifications/models/connection_request_notification.py | TamaraAbells/okuna-api | 164 | 3316157 | <reponame>TamaraAbells/okuna-api
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from openbook_auth.models import User
from openbook_notifications.models.notif... | 0 | 0 | 0 | 0 | 0 | 0 |
maskrcnn_benchmark/data/datasets/tsv.py | microsoft/GLIP | 295 | 3316178 | import os
import os.path as op
import json
# import logging
import base64
import yaml
import errno
import io
import math
from PIL import Image, ImageDraw
from maskrcnn_benchmark.structures.bounding_box import BoxList
from .box_label_loader import LabelLoader
def load_linelist_file(linelist_file):
... | 0 | 0 | 0 | 0 | 0 | 1 |
pylibs/numpy_db/formater.py | leoshine/Spherical_Regression | 133 | 3316181 | <reponame>leoshine/Spherical_Regression<filename>pylibs/numpy_db/formater.py
"""
@Author : <NAME>
"""
#@@@CODE_SNIPPET@@@ _SNP_obj_struct
# MAX_PATH_LEN = 128
def fmt_listdef(lines_str, indent=8):
str2type = dict(
str = '(str,MAX_STRING_LEN)',
int = 'np.int32',
float = '... | 0 | 0 | 0 | 0 | 0 | 0 |
Dynamic Programming/1824. Minimum Sideway Jumps.py | beckswu/Leetcode | 138 | 3316188 | class Solution:
def minSideJumps(self, obs: List[int]) -> int:
dp = [10000000, 1, 0, 1]
for i in obs:
dp[i] = 10000000
for j in range(1, 4):
if i != j:
dp[j] = min(dp[1] + (1 if j != 1 else 0),
dp[2] + (1 if j... | 4 | 5 | 0 | 0 | 9 | 0 |
JetMETCorrections/Type1MET/python/correctedMet_cff.py | ckamtsikis/cmssw | 852 | 3316228 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
##____________________________________________________________________________||
#labels used for the phi correction
##____________________________________________________________________________||
caloMetT1 = cms.EDProducer(
"CorrectedCaloMETProducer"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/param/marshal_param_test.py | nickgaya/bravado-core | 122 | 3316230 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import copy
import datetime
from json import loads
import pytest
from jsonschema import ValidationError
from mock import Mock
from mock import patch
from bravado_core.content_type import APP_JSON
from bravado_core.operation import Operation
from bravado_core.param import enc... | 0 | 0 | 0 | 0 | 0 | 0 |
ros/ros_comm/roscpp/rosbuild/scripts/msg_gen.py | numberen/apollo-platform | 742 | 3316269 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must r... | 4 | 8 | 0 | 0 | 12 | 0 |
src/_dependencies/state.py | dry-python/dependencies | 175 | 3316318 | <filename>src/_dependencies/state.py
from collections import deque
class _State:
def __init__(self, cache, attrname):
self.cache = cache
self.tried = set()
self.stack = deque()
self.current = attrname
self.have_default = False
def add(self, current, have_default):
... | 0 | 0 | 0 | 0 | 0 | 0 |
Model_Free_L2O/L2O-Swarm/src/get_12basis.py | JohnZ03/Open-L2O | 112 | 3316327 | import numpy as np
import os
path_protein_benchmark = "/home/cyppsp/project_bayesian/zdock/2c/"
protein_list = np.loadtxt("temp", dtype='str')
def c_normal_mode_analysis(protein, rpath, lpath, output):
os.system("cp "+rpath+" /home/cyppsp/cNMA/Example/Example1/Input/"+protein+'_r_u.pdb')
os.system("cp "+lpath+" /... | 0 | 0 | 0 | 0 | 0 | 0 |
zeus/model_zoo/torch_vision_model.py | shaido987/vega | 240 | 3316340 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | 0 | 0 | 0 | 0 | 0 | 0 |
skew_detection/drift_monitor/job_scheduler/handlers.py | Ibrahimboudagga/mlops-on-gcp | 407 | 3316363 | <filename>skew_detection/drift_monitor/job_scheduler/handlers.py
# Copyright 2020 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... | 0 | 0 | 0 | 0 | 0 | 0 |
virl/cli/rm/commands.py | tombry/virlutils | 133 | 3316366 | <gh_stars>100-1000
import click
import os
from virl.api import VIRLServer
from virl.helpers import get_cml_client, safe_join_existing_lab, get_current_lab, check_lab_cache, clear_current_lab
@click.command()
@click.option(
"--force/--no-force",
"-f",
default=False,
required=False,
help="Stop and/o... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/blebox/switch.py | learn-home-automation/core | 22,481 | 3316389 | <filename>homeassistant/components/blebox/switch.py
"""BleBox switch implementation."""
from homeassistant.components.switch import SwitchEntity
from . import BleBoxEntity, create_blebox_entities
from .const import BLEBOX_TO_HASS_DEVICE_CLASSES
async def async_setup_entry(hass, config_entry, async_add_entities):
... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/physics/continuum_mechanics/__init__.py | FabianBall/sympy | 445 | 3316406 | from .beam import Beam
| 0 | 0 | 0 | 0 | 0 | 0 |
avionics/network/network_config.py | leozz37/makani | 1,178 | 3316409 | <gh_stars>1000+
# Copyright 2020 Makani Technologies 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/datetime_basic.py | vhn0912/python-snippets | 174 | 3316426 | <reponame>vhn0912/python-snippets<gh_stars>100-1000
import datetime
dt_now = datetime.datetime.now()
print(dt_now)
# 2018-02-02 18:31:13.271231
print(type(dt_now))
# <class 'datetime.datetime'>
print(dt_now.year)
# 2018
print(dt_now.hour)
# 18
dt = datetime.datetime(2018, 2, 1, 12, 15, 30, 2000)
print(dt)
# 2018-0... | 0 | 0 | 0 | 0 | 0 | 0 |
onnxruntime/python/tools/quantization/E2E_example_model/object_detection/trt/yolov3/coco_filter.py | kimjungwow/onnxruntime-riscv | 159 | 3316441 | import json
import os
from pathlib import Path
class CocoFilter():
""" Filters the COCO dataset
"""
def _process_info(self):
self.info = self.coco['info']
def _process_licenses(self):
self.licenses = self.coco['licenses']
def _process_categories(self):
self... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/_dashboard/utils.py | DonaldMcC/py4web | 133 | 3316444 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
| This file is part of the py4web Web Framework
| Copyrighted by <NAME> <<EMAIL>>
| License: "BSDv3" (https://opensource.org/licenses/BSD-3-Clause)
File operations
---------------
"""
import os
import re
import tarfile
import glob
import shutil
import logging
import gzi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/esrijson_tests.py | latot/pyesridump | 201 | 3316532 | import unittest
from esridump import esri2geojson
class TestEsriJsonToGeoJson(unittest.TestCase):
def setUp(self):
self.maxDiff = None
def assertEsriJsonBecomesGeoJson(self, esrijson, geojson):
out_json = esri2geojson(esrijson)
self.assertDictEqual(out_json, geojson)
class TestGeoJs... | 0 | 0 | 0 | 0 | 0 | 0 |
SMPyBandits/PoliciesMultiPlayers/ALOHA.py | balbok0/SMPyBandits | 309 | 3316534 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
""" ALOHA: generalized implementation of the single-player policy from [Concurrent bandits and cognitive radio network, O.Avner & S.Mannor, 2014](https://arxiv.org/abs/1404.5421), for a generic single-player policy.
This policy uses the collision avoidance mechanism that is i... | 0 | 0 | 0 | 0 | 0 | 0 |
clients/bbg/blpapi-python/examples/unittests/market-data-notifier/tests/test_application.py | vegabook/dstreams | 228 | 3316538 | """ Test suite for Application. """
import unittest
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
import os
import sys
#pylint: disable=line-too-long,wrong-import-position
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src')))
from application i... | 0 | 0 | 0 | 0 | 0 | 0 |
Kmeans Cluster/Kmeans_Sklearn.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 3316543 | <reponame>Jojoxiao/Machine-Learning-for-Beginner-by-Python3
#-*- coding:utf-8 -*-
# &Author AnFany
#获得数据
from Wine_Data import DATA
import numpy as np
from sklearn.cluster import KMeans
# 需要将算法输出的类别转换为真实的类别
# 首先得出原始数据中的类别对应的编号
def get_start(ydata):
in_class = {}
classtype = sorted(list(set(l... | 0 | 0 | 0 | 0 | 0 | 0 |
upvote/gae/datastore/models/mixin_test.py | iwikmai/upvote | 453 | 3316565 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 | 1 | 0 | 0 | 1 | 0 |
localstack/services/cloudformation/models/cloudformation.py | suryatmodulus/localstack | 31,928 | 3316581 | from __future__ import annotations
from localstack.services.cloudformation.deployment_utils import generate_default_name
from localstack.services.cloudformation.service_models import GenericBaseModel
from localstack.utils.aws import aws_stack
class CloudFormationStack(GenericBaseModel):
@staticmethod
def clou... | 2 | 5 | 0 | 0 | 7 | 0 |
src/masonite/stubs/controllers/auth/RegisterController.py | cercos/masonite | 1,816 | 3316608 | <gh_stars>1000+
from masonite.controllers import Controller
from masonite.views import View
from masonite.request import Request
from masonite.response import Response
from masonite.authentication import Auth
class RegisterController(Controller):
def show(self, view: View): # Show register page
return vi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/docs/test_autoscaling.py | doc-E-brown/botocore | 1,063 | 3316672 | # Copyright 2015 Amazon.com, Inc. or its 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | 0 | 0 | 0 | 0 | 0 | 0 |
lisrd/datasets/utils/homographies.py | liuyuzhenn/LISRD | 225 | 3316683 | from __future__ import annotations
import numpy as np
import cv2
from ...models.keypoint_detectors import SIFT_detect
def sample_homography(
shape, perspective: bool=True, scaling: bool=True, rotation: bool=True, translation: bool=True,
n_scales: int=5, n_angles: int=25, scaling_amplitude: float=0.1,... | 17 | 8 | 0 | 0 | 25 | 0 |
crosshair/fnutil_test.py | pschanely/CrossHair | 785 | 3316695 | import builtins
import sys
import inspect
import unittest
from crosshair.fnutil import (
fn_globals,
load_function_at_line,
resolve_signature,
set_first_arg_type,
)
from crosshair.util import set_debug
def with_invalid_type_annotation(x: "TypeThatIsNotDefined"): # type: ignore # noqa: F821
pass... | 1 | 4 | 0 | 0 | 5 | 0 |
scripts/convert_location.py | chikeabuah/reach-lang | 525 | 3316715 | import requests
import csv
import json
import sys
def getInfo(ip) -> object:
url = "http://api.ipstack.com/" + ip + "?access_key=5abb1d1c4e614029ec30c94dee269d19"
response = requests.request("GET", url, params={"format":"json"})
return json.loads(response.text)
filename = sys.argv[1]
inputFile = open(filename,... | 0 | 1 | 0 | 0 | 1 | 0 |
exception.py | Wu-Yanjiang/jd-assistant | 5,161 | 3316756 | <reponame>Wu-Yanjiang/jd-assistant
#!/usr/bin/env python
# -*- encoding=utf8 -*-
from log import logger
class AsstException(Exception):
def __init__(self, message):
super().__init__(message)
logger.error(message)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/datasets/data_utils.py | SeitaroShinagawa/ClipBERT | 522 | 3316779 | <reponame>SeitaroShinagawa/ClipBERT
import torch
import random
import torchvision.transforms as transforms
from torchvision.transforms.functional import pad as img_pad
from torchvision.transforms.functional import resize as img_resize
from torch.nn.functional import interpolate as img_tensor_resize
from torch.nn.functi... | 0 | 0 | 0 | 0 | 0 | 0 |
airshare/utils.py | AK5123/Airshare | 574 | 3316794 | """Utility functions for Airshare."""
import mimetypes
import os
import pyperclip
import re
import socket
import tempfile
from time import strftime
from zipfile import ZipFile
from zeroconf import IPVersion, ServiceInfo, Zeroconf
from .qrcode import ErrorCorrectLevel, QRCode
__all__ = ["get_local_ip_address", "qr... | 0 | 7 | 0 | 0 | 7 | 0 |
bridge/py_api/bohrium_api/__init__.py | bh107/bohrium | 236 | 3316815 | # -*- coding: utf-8 -*-
"""
===============================
Bohrium API: a Python and C API
===============================
"""
import os
from ._bh_api import _C_API # Exposing the C_API of `_bh_api.c`
from .version import __version__, __version_info__
from . import stack_info
def _pip_specific_config() -> None:
... | 0 | 2 | 0 | 0 | 2 | 0 |
runtime/r_container.py | tobegit3hub/lambda-docker | 343 | 3316824 | <gh_stars>100-1000
import basic_container
class RContainer(basic_container.BasicContainer):
def __init__(self):
super(self.__class__, self).__init__()
self.image = "r-base"
self.command = "Rscript main.R"
self.file_extension = ".R"
| 0 | 0 | 0 | 0 | 0 | 0 |
habitat_baselines/common/logging.py | jturner65/habitat-api | 489 | 3316832 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from habitat.core.logging import HabitatLogger
baselines_logger = HabitatLogger(
name="ha... | 0 | 0 | 0 | 0 | 0 | 0 |
featuretools/primitives/__init__.py | ridicolos/featuretools | 942 | 3316873 | <reponame>ridicolos/featuretools<gh_stars>100-1000
import inspect
import logging
import pkg_resources
from .api import * # noqa: F403
# Load in a list of primitives registered by other libraries into Featuretools.
#
# Example entry_points definition for a library using this entry point:
#
# entry_points={
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/gfs2_file_system_block_size.py | haithcockce/insights-core | 121 | 3316877 | """
GFS2FileSystemBlockSize - command ``stat -fc %s <mount_point_path>``
====================================================================
The parser parse the output of ``stat -fc %s <mount_point_path>``
"""
from insights import parser, CommandParser
from insights.specs import Specs
from insights.parsers import S... | 0 | 0 | 0 | 0 | 0 | 0 |
Contents/Libraries/Shared/asio/interfaces/windows/__init__.py | jippo015/Sub-Zero.bundle | 1,553 | 3316884 | <reponame>jippo015/Sub-Zero.bundle<filename>Contents/Libraries/Shared/asio/interfaces/windows/__init__.py
# Copyright 2013 <NAME> <<EMAIL>>
#
# 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
#
#... | 0 | 0 | 0 | 0 | 0 | 0 |
src/test/pythonFiles/shebang/shebang.py | ChaseKnowlden/vscode-jupyter | 2,461 | 3316888 | <reponame>ChaseKnowlden/vscode-jupyter
#!python
print("dummy")
| 0 | 0 | 0 | 0 | 0 | 0 |
mvpa2/measures/fx.py | nno/PyMVPA | 227 | 3316895 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... | 6 | 6 | 1 | 0 | 13 | 0 |
tracardi/process_engine/action/v1/mapping_action.py | bytepl/tracardi | 153 | 3316898 | <filename>tracardi/process_engine/action/v1/mapping_action.py<gh_stars>100-1000
from tracardi.service.plugin.domain.register import Plugin, Spec, MetaData, Documentation, PortDoc, Form, FormGroup, \
FormField, FormComponent
from tracardi.service.plugin.runner import ActionRunner
from pydantic import BaseModel, vali... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/samples/wiringsamples/module_invalid_attr_injection.py | whysage/python-dependency-injector | 1,997 | 3316914 | <filename>tests/unit/samples/wiringsamples/module_invalid_attr_injection.py
"""Test module for wiring with invalid type of marker for attribute injection."""
from dependency_injector.wiring import Closing
from .container import Container
service = Closing[Container.service]
| 0 | 0 | 0 | 0 | 0 | 0 |
samples/ship/generate_predictions_2_per_gpu.py | beeunstable6/Mask_RCNN | 103 | 3316922 | <reponame>beeunstable6/Mask_RCNN<gh_stars>100-1000
import pandas
import math
import re
import datetime
import time
import numpy as np
import os
import sys
import skimage.io
import pandas as pd
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find l... | 0 | 0 | 0 | 0 | 0 | 0 |
extra/splitdex/base_config.py | FrenchYeti/dexSplitter | 191 | 3316926 | <filename>extra/splitdex/base_config.py
import os,ConfigParser
root_dir = os.path.dirname(os.path.realpath(__file__))
android_sys = 'android_sys'
apk_spliter_result = root_dir + '/outfiles/apk_splitter_result.txt'
def init():
conf = ConfigParser.ConfigParser()
conf.read('config.ini')
global aapt_file_pat... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/chromite/cbuildbot/stages/report_stages.py | zipated/src | 2,151 | 3316928 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the report stages."""
from __future__ import print_function
import datetime
import os
import sys
from... | 0 | 0 | 0 | 0 | 0 | 0 |
rotkehlchen/errors/api.py | rotkehlchenio/rotkehlchen | 137 | 3316966 | <filename>rotkehlchen/errors/api.py
from typing import Any, Dict, Optional
class RotkehlchenPermissionError(Exception):
"""Raised at login if we need additional data from the user
The payload contains information to be shown to the user by the frontend so
they can decide what to do
"""
def __init... | 0 | 0 | 0 | 0 | 0 | 0 |
d3rlpy/wrappers/__init__.py | ningyixue/AIPI530_Final_Project | 565 | 3316971 | <reponame>ningyixue/AIPI530_Final_Project<filename>d3rlpy/wrappers/__init__.py
from . import sb3
| 0 | 0 | 0 | 0 | 0 | 0 |
dm_control/composer/variation/noises_test.py | h8907283/dm_control | 2,863 | 3316992 | # Copyright 2018 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 0 | 0 | 0 | 0 | 0 | 0 |
usbrply/vidpid_filter.py | humdogm/usbrply | 133 | 3317002 | <gh_stars>100-1000
from .usb import req2s
import binascii
import struct
from .util import hexdump
def default_arg(argsj, k, default):
val = argsj.get(k)
if val is None:
return default
else:
return val
class VidpidFilter(object):
def __init__(self, argsj, verbose=False):
# sel... | 0 | 0 | 0 | 0 | 0 | 0 |
deepctr/models/multitask/sharedbottom.py | dzzxjl/DeepCTR | 6,192 | 3317022 | """
Author:
<NAME>, <EMAIL>
<NAME>, <EMAIL>
Reference:
[1] Ruder S. An overview of multi-task learning in deep neural networks[J]. arXiv preprint arXiv:1706.05098, 2017.(https://arxiv.org/pdf/1706.05098.pdf)
"""
import tensorflow as tf
from ...feature_column import build_input_features, input_from_featu... | 10 | 1 | 0 | 0 | 11 | 0 |
recipes/Python/577275_Scramble_string_words_preserving/recipe-577275.py | tdiprima/code | 2,023 | 3317044 | <reponame>tdiprima/code<gh_stars>1000+
import random
def scramble(string):
"""Scramble and return a string, preserving spaces."""
return ' '.join([''.join(random.sample(word, len(word))) for word in string.split()])
| 0 | 0 | 0 | 0 | 0 | 0 |
src/preprocess/__init__.py | jamesjaeyu/UCPhrase-exp | 103 | 3317048 | <filename>src/preprocess/__init__.py
from preprocess.preprocess import Preprocessor
from preprocess.annotator_base import BaseAnnotator
from preprocess.annotator_wiki import WikiAnnotator
from preprocess.annotator_core import CoreAnnotator
| 0 | 0 | 0 | 0 | 0 | 0 |
test/test_mixrank.py | MidtownFellowship/libsaas | 155 | 3317077 | from __future__ import annotations
import unittest
from libsaas import http
from libsaas.executors import test_executor
from libsaas.services import mixrank
class MixRankTestCase(unittest.TestCase):
def setUp(self):
self.executor = test_executor.use()
self.executor.set_response(b'{}', 200, {})
... | 4 | 0 | 0 | 0 | 4 | 0 |
lastversion/GitLabRepoSession.py | IlanBeloglovsky/lastversion | 199 | 3317123 | from __future__ import annotations
import logging
import os
from dateutil import parser
from .ProjectHolder import ProjectHolder
log = logging.getLogger(__name__)
class GitLabRepoSession(ProjectHolder):
DEFAULT_HOSTNAME: str = 'gitlab.com'
def __init__(self, repo, hostname):
super(GitLabRepoSessio... | 3 | 3 | 1 | 0 | 7 | 0 |
hubblestack/version.py | grogsaxle/hubble | 363 | 3317138 | # coding: utf-8
__version__ = "4.5.4"
| 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/tags/tests/test_tag_api.py | atitaya1412/Mayan-EDMS | 343 | 3317141 | from rest_framework import status
from mayan.apps.rest_api.tests.base import BaseAPITestCase
from ..events import event_tag_created, event_tag_edited
from ..models import Tag
from ..permissions import (
permission_tag_create, permission_tag_delete, permission_tag_edit,
permission_tag_view
)
from .mixins impo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/instancemode/client.py | brubbel/Pyro4 | 638 | 3317176 | from __future__ import print_function
import Pyro4
print("Showing the different instancing modes.")
print("The number printed, is the id of the instance that handled the call.")
print("\n-----PERCALL (different number every time) -----")
with Pyro4.Proxy("PYRONAME:instance.percall") as p:
print(p.msg("hello1"))
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/perf/test_long_cycles_nbrows_cycle_length_11000_140.py | shaido987/pyaf | 377 | 3317227 | <filename>tests/perf/test_long_cycles_nbrows_cycle_length_11000_140.py
import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(11000 , 140)
| 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/zwave_js/triggers/helpers.py | liangleslie/core | 30,023 | 3317238 | <gh_stars>1000+
"""Helpers for Z-Wave JS custom triggers."""
from homeassistant.components.zwave_js.const import ATTR_CONFIG_ENTRY_ID, DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_DEVICE_ID, ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant, callback
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/describe/test_schema.py | augusto-herrmann/frictionless-py | 247 | 3317239 | from frictionless import describe_schema
# General
def test_describe_schema():
schema = describe_schema("data/leading-zeros.csv")
assert schema == {"fields": [{"name": "value", "type": "integer"}]}
| 0 | 0 | 0 | 0 | 0 | 0 |
python/cuspatial/demos/traj_test_soa_locust.py | codereport/cuspatial | 347 | 3317265 | <filename>python/cuspatial/demos/traj_test_soa_locust.py
"""
GPU-based coordinate transformation demo: (log/lat)==>(x/y), relative to a
camera origin
Note: camera configuration is read from a CSV file using Panda
"""
import numpy as np
import pandas as pd
import cuspatial
def get_ts_struct(ts):
y = ts & 0x3F
... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/ParticleMechanicsApplication/python_scripts/apply_mpm_3d_rotating_dirichlet_condition_process.py | lkusch/Kratos | 778 | 3317268 | <reponame>lkusch/Kratos<filename>applications/ParticleMechanicsApplication/python_scripts/apply_mpm_3d_rotating_dirichlet_condition_process.py
import KratosMultiphysics
import KratosMultiphysics.ParticleMechanicsApplication as KratosParticle
from KratosMultiphysics.ParticleMechanicsApplication.apply_mpm_particle_dirich... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/gg_decode_annot.py | vladcorneci/golden-gate | 262 | 3317275 | #!/usr/bin/env python
# Copyright 2017-2020 Fitbit, Inc
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import os.path
# Generate absolute paths for needed dirs and scripts
scripts_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.join(scripts_dir, "..")
nanopb_dir = os.path.join(r... | 0 | 1 | 0 | 0 | 1 | 0 |
tkinter/listbox/listbox-update-by-other-listbox/main.py | whitmans-max/python-examples | 140 | 3317299 | #!/usr/bin/env python3
# date: 2019.12.07
import tkinter as tk
def update(event):
widget = event.widget
idx = widget.curselection()[0]
val = widget.get(idx)
print(idx, val)
lb2.delete(0, "end")
lb2.insert("end", *options2[val])
options1 = ["A", "B", "C"]
options2 = {
"A": ["A1", "A2", "... | 0 | 0 | 0 | 0 | 0 | 0 |
polaris_health/state/pool.py | gribnut/polaris-gslb | 225 | 3317326 | # -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import ipaddress
import random
from polaris_health import Error, config, monitors
from polaris_common import topology
__all__ = [ 'PoolMember', 'Pool' ]
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
MAX_POOL_MEMBER... | 4 | 4 | 2 | 4 | 14 | 0 |
openbook_communities/validators.py | TamaraAbells/okuna-api | 164 | 3317380 | import re
from django.utils.translation import gettext_lazy as _
from rest_framework.exceptions import ValidationError, NotFound
from openbook_common.utils.model_loaders import get_community_model
def community_name_characters_validator(community_name):
if not re.match('^[a-zA-Z0-9_]*$', community_name):
... | 0 | 0 | 0 | 0 | 0 | 0 |
models/AI-Model-Zoo/downloader.py | bluetiger9/Vitis-AI | 848 | 3317383 | # Copyright 2021 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 0 | 4 | 0 | 0 | 4 | 0 |
airbyte-integrations/bases/base-python/base_python/cdk/streams/auth/jwt.py | OTRI-Unipd/OTRI-airbyte | 6,215 | 3317405 | <reponame>OTRI-Unipd/OTRI-airbyte<filename>airbyte-integrations/bases/base-python/base_python/cdk/streams/auth/jwt.py
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from typing import Any, Mapping
from base_python.cdk.streams.auth.core import HttpAuthenticator
class JWTAuthenticator(HttpAuthenticator... | 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.