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 |
|---|---|---|---|---|---|---|---|---|---|---|
modules/data.atmosphere/inst/python/download_Global_MsTMIP_CRUNCEP.py | ankurdesai/pecan | 151 | 1770502 | #This script reads CRU NCEP MsTMIP variables using Opendap
#By: <NAME> (<EMAIL>)
############################## BEGIN CODE #############################################
import sys
print(sys.argv)
lat_desired = sys.argv[1]
lon_desired = sys.argv[2]
year_desired = sys.argv[3]
outfolder = sys.argv[4]
##################... | 1 | 2 | 0 | 0 | 3 | 0 |
rls/nn/networks.py | StepNeverStop/RLs | 371 | 1770558 | #!/usr/bin/env python3
# encoding: utf-8
from typing import Dict, Optional
import torch as th
import torch.nn as nn
from rls.nn.activations import Act_REGISTER, default_act
from rls.nn.represents.encoders import End_REGISTER
from rls.nn.represents.memories import Rnn_REGISTER
from rls.nn.represents.vector... | 14 | 4 | 0 | 0 | 18 | 0 |
test_kitti_depth.py | prabhash007/DF-Net | 199 | 1770587 | <gh_stars>100-1000
from __future__ import division
import tensorflow as tf
import numpy as np
import os
import PIL.Image as pil
from core import DFLearner
flags = tf.app.flags
flags.DEFINE_integer("batch_size", 4, "The size of of a sample batch")
flags.DEFINE_integer("img_height", 160, "Image height")
flags.DEFINE_int... | 0 | 0 | 0 | 0 | 0 | 0 |
web_lecture/scripts/mongo_pose_write.py | yasutomo57jp/ros_lecture | 110 | 1770604 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from mongodb_store.message_store import MessageStoreProxy
from geometry_msgs.msg import Pose, Point, Quaternion
if __name__ == '__main__':
rospy.init_node("mongo_pose_write")
msg_store = MessageStoreProxy(database="srs", collection="pose1")
p = P... | 0 | 0 | 0 | 0 | 0 | 0 |
mesogen_scripts/ghidra.py | richinseattle/mesos | 375 | 1770620 | #Generates a Mesos file from the current program.
#@author marpie (<NAME> - <EMAIL>)
#@category Mesos
#@keybinding
#@menupath
#@toolbar
import struct
import ghidra.program.model.block.SimpleBlockModel as SimpleBlockModel
def get_simple_blocks_by_function(image_base, listing) -> object:
model = SimpleBlockModel(cu... | 0 | 1 | 0 | 0 | 1 | 0 |
cactus/tests/test_listener.py | danielchasehooper/Cactus | 1,048 | 1770656 | import os
import tempfile
import threading
import unittest2 as unittest
from cactus.listener import PollingListener
from cactus.tests.compat import has_symlink
try:
from cactus.listener import FSEventsListener
except ImportError:
FSEventsListener = None
def sleep(s):
# time.sleep(s)
event = threadin... | 0 | 4 | 0 | 0 | 4 | 0 |
apex/contrib/sparsity/test/toy_problem.py | ultrons/apex | 6,523 | 1770664 | from collections import OrderedDict
import torch
from apex.optimizers import FusedAdam
from apex.contrib.sparsity import ASP
def build_model(args) -> object:
od = OrderedDict()
for i in range(args.num_layers):
if i == 0:
od['linear_layer_%d' % (i+1)] = torch.nn.Linear(args.input_features, ... | 0 | 3 | 9 | 0 | 12 | 0 |
tools/accuracy_checker/accuracy_checker/annotation_converters/vimeo90k_sr.py | APrigarina/open_model_zoo | 1,031 | 1770698 | from __future__ import annotations
"""
Copyright (c) 2018-2021 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... | 3 | 2 | 1 | 0 | 6 | 0 |
true_coders/migrations/0030_coder_n_accounts.py | horacexd/clist | 166 | 1770703 | # Generated by Django 2.2.13 on 2020-08-01 22:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('true_coders', '0029_auto_20200429_1924'),
]
operations: list[object] = [
migrations.AddField(
model_name... | 0 | 0 | 2 | 0 | 2 | 0 |
twitter_problems/problem_3.py | loftwah/Daily-Coding-Problem | 129 | 1770758 | <reponame>loftwah/Daily-Coding-Problem
"""This problem was asked by Twitter.
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
Assume that each node in the tree also has a pointer to its parent.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is
... | 0 | 0 | 0 | 0 | 0 | 0 |
artemis/general/numpy_helpers.py | peteroconnor-bc/artemis | 235 | 1770778 | <reponame>peteroconnor-bc/artemis
from numpy.random.mtrand import RandomState
import numpy as np
__author__ = 'peter'
def get_rng(initializer):
"""
Creates a random number generator from either a seed, the time, or another random number generator.
This is useful when you need to initialize random states o... | 0 | 0 | 0 | 0 | 0 | 0 |
model/arcface/arcface.py | Fatemejamalii/ID-disentanglement | 127 | 1770800 | import tensorflow as tf
import math
num_classes = 85742 # 10572
initializer = 'glorot_normal'
# initializer = tf.keras.initializers.TruncatedNormal(
# mean=0.0, stddev=0.05, seed=None)
# initializer = tf.keras.initializers.VarianceScaling(
# scale=0.05, mode='fan_avg', distribution='normal', seed=None)
clas... | 2 | 2 | 0 | 0 | 4 | 0 |
utils/model_utils.py | dubtor/EditGAN-Robert | 110 | 1770836 | <filename>utils/model_utils.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distri... | 0 | 0 | 0 | 0 | 0 | 0 |
callbacks.py | ruihan0495/EfficientDet | 1,403 | 1770843 | from tensorflow.keras.callbacks import Callback
import tensorflow.keras.backend as K
import numpy as np
class CosineAnnealingScheduler(Callback):
def __init__(self, cycle_iterations, min_lr, t_mu: int=2, start_iteration: int=0):
self.iteration_id: int = 0
self.start_iteration = start_iteration
... | 5 | 0 | 0 | 7 | 12 | 0 |
homeassistant/components/trafikverket_weatherstation/const.py | MrDelik/core | 30,023 | 1770845 | """Adds constants for Trafikverket Weather integration."""
from homeassistant.const import Platform
DOMAIN = "trafikverket_weatherstation"
CONF_STATION = "station"
PLATFORMS = [Platform.SENSOR]
ATTRIBUTION = "Data provided by Trafikverket"
NONE_IS_ZERO_SENSORS = {
"air_temp",
"road_temp",
"wind_direction"... | 0 | 0 | 0 | 0 | 0 | 0 |
python/federatedml/components/homo_secure_boost.py | rubenlozanoaht3m/DataDogm | 715 | 1770864 | <filename>python/federatedml/components/homo_secure_boost.py
#
# Copyright 2019 The FATE 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/doxygen_utils.py | fengjixuchui/src | 1,160 | 1770869 | from __future__ import annotations
from __future__ import print_function
import os
import textwrap
import xml.etree.ElementTree as ET
def join_all_element_text(el, sep: str="") -> object:
bits = []
for txt in el.itertext():
bits.append(txt)
return sep.join(bits)
def remove_empty_header_or_footer_... | 4 | 12 | 0 | 2 | 18 | 0 |
src/thenewboston/__init__.py | mrbusysky/thenewboston-python | 122 | 1770888 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# TODO(dmu) MEDIUM: Make it DRY with pyproject.toml
__version__ = '0.2.3'
| 0 | 0 | 0 | 0 | 0 | 0 |
applications/cli/platform_resources/resource_filters.py | nparkstar/nauta | 390 | 1770930 | <reponame>nparkstar/nauta
#
# 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 a... | 0 | 0 | 0 | 0 | 0 | 0 |
quarkchain/cluster/shard_state.py | QuarkChain/pyquarkchain | 237 | 1770937 | <filename>quarkchain/cluster/shard_state.py
import asyncio
import json
import time
from fractions import Fraction
from typing import Dict, List, Optional, Tuple, Union
from rlp import DecodingError
from quarkchain import utils
from quarkchain.cluster.log_filter import LogFilter
from quarkchain.cluster.miner import va... | 0 | 0 | 0 | 0 | 0 | 0 |
Imagr/Resources/LoginLog.app/Contents/Resources/LLLogWindowController.py | rogerhu/imagr | 355 | 1770972 | #-*- coding: utf-8 -*-
#
# LLLogWindowController.py
# LoginLog
#
# Created by Pelle on 2013-03-05.
# Copyright (c) 2013 Göteborgs universitet. All rights reserved.
#
from __future__ import annotations
from objc import YES, NO, IBAction, IBOutlet
from Foundation import *
from AppKit import *
class LLLogViewDataSo... | 0 | 6 | 3 | 0 | 9 | 0 |
examples/pytorch/gxn/layers.py | ketyi/dgl | 9,516 | 1770973 | <gh_stars>1000+
from typing import Optional
import dgl
import torch
import torch.nn
from dgl import DGLGraph
from dgl.nn import GraphConv
from torch import Tensor
class GraphConvWithDropout(GraphConv):
"""
A GraphConv followed by a Dropout.
"""
def __init__(self, in_feats, out_feats, dropout=0.3, nor... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_pfn_extras/logging.py | belltailjp/pytorch-pfn-extras | 243 | 1770992 | import logging
import os
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL # NOQA
from typing import Optional
_logger_name = 'ppe'
_logger_format = '[%(name)s] %(asctime)s: (%(levelname)s) %(message)s'
_logger = None
def _configure_logging(
*,
filename: Optional[str] = None,
level: ... | 4 | 3 | 0 | 0 | 7 | 0 |
flextensor/test/test_tvm/legacy/variant_scale.py | imxian/FlexTensor | 135 | 1771032 | # import tvm
import os
import numpy as np
import matplotlib.pyplot as plt
# from flextensor.examples import FUNC_TABLE
class Point(object):
def __init__(self, factor_lst, performance):
self.xs: tuple[object, ...] = tuple(factor_lst)
self.y = performance
self.dim = len(factor_lst)
def ... | 0 | 6 | 0 | 2 | 8 | 0 |
utils/character_cnn.py | mshukor/character-bert | 485 | 1771043 | <reponame>mshukor/character-bert
# Functions are imported/adapted from AllenAI's AllenNLP library:
# https://github.com/allenai/allennlp/
""" Indexer functions for ELMo-style character embeddings. """
from typing import Dict, List, Callable, Any
import torch
PADDING_VALUE = 0
def _make_bos_eos(
character: i... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/200638_Generate_PythSymbol_Lists_Programmers_Editor/recipe-200638.py | tdiprima/code | 2,023 | 1771073 | <reponame>tdiprima/code<filename>recipes/Python/200638_Generate_PythSymbol_Lists_Programmers_Editor/recipe-200638.py<gh_stars>1000+
# GenEditorSymbolLists.py
"""Make lists of Python symbols for a programmer's editor syntax coloring file
Redirect this program's stdout to a text file. Cut and paste some or all of
the l... | 0 | 0 | 0 | 0 | 0 | 0 |
test/pandas_performance_2.py | LeeRuns/DataFrame | 1,494 | 1771084 | <filename>test/pandas_performance_2.py
import numpy as np
import pandas as pd
import time
# ------------------------------------------------------------------------------
print(f"Starting ... {int(time.time())}");
length: int = 1100000000
df = pd.DataFrame({"INDEX": np.arange(0, length),
"normal"... | 0 | 0 | 0 | 0 | 0 | 0 |
talib/abstract.py | aberja/ta-lib | 6,581 | 1771093 | <reponame>aberja/ta-lib<gh_stars>1000+
import talib._ta_lib as _ta_lib
from ._ta_lib import Function as _Function, __TA_FUNCTION_NAMES__, _get_defaults_and_docs
# add some backwards compat for backtrader
from ._ta_lib import TA_FUNC_FLAGS, TA_INPUT_FLAGS, TA_OUTPUT_FLAGS
_func_obj_mapping = {
func_name: getattr(_... | 0 | 0 | 0 | 0 | 0 | 0 |
languages/python/asyncio_examples/threads_example.py | RohitAthithya/learntosolveit | 136 | 1771096 | import asyncio
def compute_pi(digits) -> float:
# implementation
return 3.14
async def main(loop):
digits = await loop.run_in_executor(None, compute_pi, 20000)
print(("pi: %s" % digits))
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
| 0 | 1 | 0 | 0 | 1 | 0 |
tests/util/py/decorators_test.py | drakesvoboda/ProGraML | 169 | 1771175 | <filename>tests/util/py/decorators_test.py
# Copyright 2014-2020 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 0 | 0 | 0 | 0 | 0 | 0 |
roxe.cdt/roxe_llvm/tools/clang/bindings/python/tests/cindex/test_cursor.py | APFDev/actc | 171 | 1771179 | <gh_stars>100-1000
import ctypes
import gc
import unittest
from clang.cindex import AvailabilityKind
from clang.cindex import CursorKind
from clang.cindex import TemplateArgumentKind
from clang.cindex import TranslationUnit
from clang.cindex import TypeKind
from .util import get_cursor
from .util import get_cursors
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
eth1_simple_custody/simple_custody.py | kevaundray/research | 1,351 | 1771215 | import blst
import hashlib
from poly_utils import PrimeField
from time import time
import sys
import gmpy2
#
# Proof of concept implementation for Eth1 simple custody
#
# https://notes.ethereum.org/1Rn2MwsoSWuEUHTnaRgLcw
#
# BLS12_381 curve modulus
MODULUS = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff... | 0 | 10 | 0 | 0 | 10 | 0 |
modelci/types/proto/service_pb2.py | FerdinandZhong/ML-Model-CI | 170 | 1771217 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modelci/types/proto/service.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf ... | 0 | 0 | 0 | 0 | 0 | 0 |
server/tests/test_settings_views.py | nathandarnell/sal | 215 | 1771234 | <filename>server/tests/test_settings_views.py
"""Beginning of the test setup for non_ui_views"""
from unittest.mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase, Client
import server.utils
from sal.plugin import Widget, ReportPlugin, Deta... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/test/test_support.py | timmartin/skulpt | 2,671 | 1771253 | <gh_stars>1000+
"""Supporting definitions for the Python regression tests."""
if __name__ != 'test.test_support':
raise ImportError('test_support must be imported from the test package')
import unittest
# def run_unittest(*classes):
# """Run tests from unittest.TestCase-derived classes."""
# valid_types... | 0 | 0 | 0 | 0 | 0 | 0 |
pims/tests/test_display.py | tsmbland/pims | 208 | 1771261 | <gh_stars>100-1000
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import unittest
import os
import functools
import numpy as np
import pims
from numpy.testing import assert_array_equal
from pims import plot_to_frame, plots_to_frame
from pims.disp... | 0 | 0 | 0 | 0 | 0 | 0 |
webdriver/tests/navigate_to/navigate.py | meyerweb/wpt | 14,668 | 1771267 | <reponame>meyerweb/wpt
import time
import pytest
from webdriver import error
from webdriver.transport import Response
from tests.support import platform_name
from tests.support.asserts import assert_error, assert_success
def navigate_to(session, url):
return session.transport.send(
"POST", "session/{ses... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/gorse.py | zhenghaoz/discovery | 250 | 1771324 | <filename>backend/gorse.py
from collections import namedtuple
from datetime import datetime
from typing import List
import requests
Success = namedtuple("Success", ["RowAffected"])
class GorseException(BaseException):
def __init__(self, status_code: int, message: str):
self.status_code = status_code
... | 0 | 0 | 0 | 0 | 0 | 0 |
pytables/run_test.py | nikicc/anaconda-recipes | 130 | 1771367 | <gh_stars>100-1000
import sys
import tables
import tables._comp_bzip2
# We don't build this one on Windows.
if not sys.platform == "win32":
import tables._comp_lzo
import tables.hdf5extension
import tables.indexesextension
import tables.linkextension
import tables.lrucacheextension
import tables.tableextension
impo... | 0 | 0 | 0 | 0 | 0 | 0 |
visgraph/renderers/__init__.py | rnui2k/vivisect | 716 | 1771384 | '''
Home of the code which knows how to actually *draw* a graph which
has been layed out.
'''
class GraphRenderer:
'''
Only a "renderer" knows how big each node will end up based on metadata
in the graph which is specific to the renderer.
All renderers should be able to set the (x,y) "size" tuple
... | 0 | 0 | 0 | 4 | 4 | 0 |
demos/common/python/pipelines/__init__.py | APrigarina/open_model_zoo | 1,031 | 1771415 | <reponame>APrigarina/open_model_zoo
from .async_pipeline import get_user_config, AsyncPipeline
__all__ = [
'get_user_config',
'AsyncPipeline',
]
| 0 | 0 | 0 | 0 | 0 | 0 |
cpmpy/polydivisible_numbers.py | tias/hakank | 279 | 1771446 | <gh_stars>100-1000
"""
Polydivisible numbers in cpmpy.
What is the largest polydivisible number such that all subsequences of the number (1..n)
is divisible by n?
See the Picat forum for a discussion:
https://groups.google.com/forum/#!topic/picat-lang/Cb3RWZ6h-LE
Note: cpmpy (OR-tools CP-SAT) cannot handle integer l... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/helpers/normalizeValues.py | aaronbell/Roboto | 120 | 1771454 | <reponame>aaronbell/Roboto<filename>scripts/helpers/normalizeValues.py
userValue = 600
axisDefault = 400
axisMin = 100
axisMax = 900
if (userValue < axisDefault):
normalizedValue = (userValue - axisDefault) / (axisDefault - axisMin)
else:
normalizedValue = (userValue - axisDefault) / (axisMax - axisDefault)
pri... | 0 | 0 | 0 | 0 | 0 | 0 |
src/richie/apps/core/tests/utils.py | leduong/richie | 174 | 1771461 | <reponame>leduong/richie<gh_stars>100-1000
"""
Useful stuff for testing
"""
from cms.test_utils.testcases import CMSTestCase
class CMSPluginTestCase(CMSTestCase):
"""
Enriched CMS test case object to include useful stuff about plugin
rendering.
Note:
The CMSTestCase mixin from DjangoCMS is ma... | 0 | 0 | 0 | 0 | 0 | 0 |
ytmusicapi/__init__.py | jazzabeanie/ytmusicapi | 689 | 1771531 | from ytmusicapi._version import __version__
from ytmusicapi.ytmusic import YTMusic
__copyright__ = 'Copyright 2020 sigma67'
__license__ = 'MIT'
__title__ = 'ytmusicapi'
| 0 | 0 | 0 | 0 | 0 | 0 |
api/models/classifier.py | mrn-mln/smart-social-distancing | 113 | 1771533 | from pydantic import Field
from typing import Optional
from .base import SnakeModel
class ClassifierDTO(SnakeModel):
device: str = Field(example="EdgeTPU")
name: str = Field(example="OFMClassifier")
imageSize: str = Field(example="45,45,3")
modelPath: Optional[str] = Field(example="/repo/data/custom-... | 0 | 0 | 5 | 0 | 5 | 0 |
mmselfsup/models/algorithms/mmcls_classifier_wrapper.py | mitming/mmselfsup | 355 | 1771560 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcls.models import ImageClassifier
from mmcv.runner import auto_fp16
from ..builder import ALGORITHMS
@ALGORITHMS.register_module()
class MMClsImageClassifierWrapper(ImageClassifier):
"""Workaround to use models from mmclassifi... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/GuardiCore/Integrations/GuardiCoreV2/GuardiCoreV2.py | diCagri/content | 799 | 1771599 | <reponame>diCagri/content<gh_stars>100-1000
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import requests
import traceback
from typing import Dict, Any, Tuple
import base64
import json
from dateparser import parse
from pytz import utc
# Disable insecure warnings
r... | 0 | 0 | 0 | 0 | 0 | 0 |
test/programytest/services/rest/google/distance/test_service.py | RonKhondji/program-y | 345 | 1771627 | <reponame>RonKhondji/program-y
import unittest
from unittest.mock import patch
from unittest.mock import Mock
import os
from programy.services.rest.google.distance.service import GoogleDistanceService
from programy.services.config import ServiceConfiguration
from programy.services.config import ServiceRESTConfiguration... | 0 | 0 | 0 | 0 | 0 | 0 |
test/hummingbot/connector/exchange/bitmart/test_bitmart_user_stream_tracker.py | BGTCapital/hummingbot | 542 | 1771636 | <gh_stars>100-1000
import asyncio
import json
from unittest import TestCase
from unittest.mock import AsyncMock, patch
from typing import Any, Dict
from hummingbot.connector.exchange.bitmart.bitmart_auth import BitmartAuth
import hummingbot.connector.exchange.bitmart.bitmart_constants as CONSTANTS
from hummingbot.conn... | 0 | 0 | 0 | 0 | 0 | 0 |
gubernator/view_base.py | Noahhoetger2001/test-infra | 3,390 | 1771642 | <reponame>Noahhoetger2001/test-infra
# Copyright 2016 The Kubernetes 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 req... | 0 | 0 | 0 | 0 | 0 | 0 |
c3_introduction-git-github/1_introduction-to-version-control/src/cpu_usage_fixed.py | chaiyeow/google-it-automation | 220 | 1771645 | <reponame>chaiyeow/google-it-automation<gh_stars>100-1000
#!/usr/bin/env python3
import psutil
def check_cpu_usage(percent):
usage = psutil.cpu_percent(1)
print("DEBUG: usage: {}".format(usage))
return usage < percent
if not check_cpu_usage(75):
print("ERROR! CPU is overloaded")
else:
print("Every... | 0 | 0 | 0 | 0 | 0 | 0 |
app/bps/cont_image.py | bopopescu/redis-ctl | 109 | 1771650 | <filename>app/bps/cont_image.py<gh_stars>100-1000
from sqlalchemy.exc import IntegrityError
from flask import request, render_template, g, abort
from app.bpbase import Blueprint
from app.utils import json_response, timestamp_to_datetime
import models.base
import models.cont_image
bp = Blueprint('cont_image', __name__... | 0 | 0 | 0 | 0 | 0 | 0 |
src/api/dcps/python/test/test_ospl_11503.py | brezillon/opensplice | 133 | 1771677 | #
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | 0 | 0 | 1 | 0 | 1 | 0 |
Chapter11/listing11_7.py | hohsieh/osgeopy-code | 160 | 1771685 | <gh_stars>100-1000
# Script to calculate slope using SciPy.
import os
import numpy as np
import scipy.ndimage
from osgeo import gdal
import ospybook as pb
in_fn = r"D:\osgeopy-data\Nepal\everest_utm.tif"
out_fn = r'D:\Temp\everest_slope_scipy2.tif'
# Write a function that calculates slope using a 3x3 window.
# This ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/validate/links.py | AjmalShajahan/public-apis | 59,333 | 1771692 | # -*- coding: utf-8 -*-
import re
import sys
import random
from typing import List, Tuple
import requests
from requests.models import Response
def find_links_in_text(text: str) -> List[str]:
"""Find links in a text and return a list of URLs."""
link_pattern = re.compile(r'((?:https?://|www\d{0,3}[.]|[a-z0-... | 11 | 11 | 0 | 0 | 22 | 0 |
djangoerp/core/tests/test_backends.py | xarala221/django-erp | 345 | 1771716 | <gh_stars>100-1000
#!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR... | 0 | 0 | 0 | 0 | 0 | 0 |
flocker/node/test/test_diagnostics.py | stackriot/flocker | 2,690 | 1771731 | import json
from unittest import skipUnless
from twisted.python.procutils import which
from flocker.node.diagnostics import list_hardware
from flocker.testtools import TestCase
class ListHardwareTests(TestCase):
@skipUnless(which('lshw'), 'Tests require the ``lshw`` command.')
def test_list_hardware(self):... | 0 | 0 | 0 | 0 | 0 | 0 |
seccon2021/average/exploit.py | nhtri2003gmail/ctf-write-ups | 101 | 1771733 | <filename>seccon2021/average/exploit.py
#!/usr/bin/env python3
from pwn import *
from binascii import hexlify
binary = context.binary = ELF('./average', checksec=False)
if args.REMOTE:
p = remote('average.quals.seccon.jp', 1234)
libc = ELF('./libc.so.6', checksec=False)
else:
p = process(binary.path)
libc = ELF(... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter04/c4_09_get_return_only.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 1771736 | <filename>Chapter04/c4_09_get_return_only.py
# -*- coding: utf-8 -*-
"""
Name : c4_09_get_return_only.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
from matplotlib.finance import quotes_hist... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/two1/channels/paymentchannelclient.py | RafaelHMachado/Cioffis_Automation | 415 | 1771763 | from __future__ import annotations
"""A high-level client that can open, close, and pay across many channels."""
import os.path
import collections
import logging
from . import walletwrapper
from . import database
from . import blockchain
from . import paymentchannel
from two1 import TWO1_CHANNELS_FEE
logger = loggin... | 7 | 4 | 0 | 0 | 11 | 0 |
sublime_jedi/completion.py | tannewt/SublimeJEDI | 641 | 1771785 | # -*- coding: utf-8 -*-
from __future__ import annotations
import re
from threading import Timer
import sublime
import sublime_plugin
from .console_logging import getLogger
from .daemon import ask_daemon
from .utils import get_settings, is_python_scope, is_repl
logger = getLogger(__name__)
FOLLOWING_CHARS = {"\r", ... | 1 | 8 | 3 | 0 | 12 | 0 |
rastervision_core/rastervision/core/data/label_source/semantic_segmentation_label_source_config.py | jonathanpascoe/raster-vision | 1,577 | 1771833 | <filename>rastervision_core/rastervision/core/data/label_source/semantic_segmentation_label_source_config.py
from typing import Optional, Union
from rastervision.core.data.raster_source import (RasterSourceConfig,
RasterizedSourceConfig)
from rastervision.core.data.lab... | 0 | 0 | 0 | 0 | 0 | 0 |
tableauserverclient/server/endpoint/jobs_endpoint.py | zuarbase/server-client-python | 470 | 1771840 | from __future__ import annotations
from .endpoint import Endpoint, api
from .exceptions import JobCancelledException, JobFailedException
from .. import JobItem, BackgroundJobItem, PaginationItem
from ..request_options import RequestOptionsBase
from ...exponential_backoff import ExponentialBackoffTimer
import logging
... | 3 | 5 | 0 | 0 | 8 | 0 |
src/admin/godmode/groups/base.py | aimanow/sft | 280 | 1771842 | <filename>src/admin/godmode/groups/base.py<gh_stars>100-1000
from godmode.acl import ACL
class BaseGroup:
acl = ACL.ADMIN
name = None
policy = None
index = None
| 0 | 0 | 0 | 0 | 0 | 0 |
amen/exceptions.py | ruohoruotsi/amen | 324 | 1771845 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''AMEN Exception classes'''
class AmenError(Exception):
"""
The root amen exception class
"""
pass
class SynthesizeError(AmenError):
"""
Exception class for errors in synthesize.py
"""
pass
class FeatureError(AmenError):
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
source/vdb/__init__.py | molyswu/Variational_Discriminator_Bottleneck | 150 | 1771878 | """ package contains the network modules (Torch) """
from vdb import Gan_networks
| 0 | 0 | 0 | 0 | 0 | 0 |
pykinect_azure/k4a/configuration.py | necoxt/pyKinectAzure | 170 | 1771887 | <reponame>necoxt/pyKinectAzure<filename>pykinect_azure/k4a/configuration.py
from pykinect_azure.k4a import _k4a
class Configuration:
def __init__(self, configuration_handle=None):
if configuration_handle:
self._handle = configuration_handle
else:
self.create()
def handle(self):
return self._handle
... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/100_Same_Tree.py | XSoyOscar/Algorithms | 713 | 1771894 | <reponame>XSoyOscar/Algorithms
from collections import deque
class Solution:
def isSameTree(self, p, q):
"""
:type p: TreeNode
:type q: TreeNode
:rtype: bool
"""
def check(p, q):
# if both are None
if not p and not q:
return ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/non_trainable/candidates_generation.py | TheMortalCoil92/neuspell_access | 422 | 1771907 | <filename>scripts/non_trainable/candidates_generation.py
import numpy as np
from tqdm import tqdm
from .candidate import Candidate
from .double_metaphone import dm
from .edit_distance import edits_n, damerau_levenshtein_distance
from .vocab import Vocab
class CandidatesGenerator(Vocab):
"""
Vocab provides di... | 0 | 0 | 0 | 0 | 0 | 0 |
01_mysteries_of_neural_networks/06_numpy_convolutional_neural_net/src/utils/metrics.py | angliu-bu/ILearnDeepLearning.py | 1,093 | 1771917 | import numpy as np
from src.utils.core import convert_prob2one_hot
def softmax_accuracy(y_hat: np.array, y: np.array) -> float:
"""
:param y_hat - 2D one-hot prediction tensor with shape (n, k)
:param y - 2D one-hot ground truth labels tensor with shape (n, k)
----------------------------------------... | 3 | 2 | 0 | 0 | 5 | 0 |
scale/scheduler/configuration.py | kaydoh/scale | 121 | 1771926 | from __future__ import annotations
"""Defines the class represents the scheduler configuration"""
from __future__ import unicode_literals
from queue.models import DEFAULT_QUEUE_ORDER
DEFAULT_NUM_MESSAGE_HANDLERS = 0
DEFAULT_LOGGING_LEVEL = 'INFO'
class SchedulerConfiguration(object):
"""This class represents th... | 1 | 0 | 0 | 1 | 2 | 0 |
tests/test_engine_execute.py | DmitryRibalka/monitorrent | 465 | 1771934 | <gh_stars>100-1000
# coding=utf-8
import datetime
from ddt import ddt
from mock import Mock, MagicMock, call, ANY
from tests import TestCase, ReadContentMixin
from sqlalchemy import Column, Integer, ForeignKey, String
from monitorrent.utils.bittorrent_ex import Torrent
from monitorrent.engine import Engine, EngineExe... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/c9500/tests/ShowVersion/cli/equal/golden_output_c9500_2_expected.py | balmasea/genieparser | 204 | 1771939 | <reponame>balmasea/genieparser
expected_output = {
'version': { 'bootldr_version': 'System Bootstrap, Version 17.1.1r, '
'RELEASE SOFTWARE (P)',
'chassis': 'C9500-12Q',
'code_name': 'Amsterdam',
'compiled_by': 'mcpre',
... | 0 | 0 | 0 | 0 | 0 | 0 |
core/src/main/resources/scripts/kestra.py | Madara9744/kestra | 687 | 1771948 | from __future__ import annotations
import json
from datetime import datetime
class Kestra:
def __init__(self):
pass
@staticmethod
def _send(map):
print("::" + json.dumps(map) + "::")
@staticmethod
def _metrics(name, type, value, tags: object | None=None):
Kestra._send({
... | 3 | 0 | 0 | 0 | 3 | 0 |
examples/TransX/transE.py | HuangLED/euler | 2,829 | 1771968 | <gh_stars>1000+
# Copyright 2020 Alibaba Group Holding Limited. 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
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/setup.py | maxknivets/gohttplib | 227 | 1772026 | #!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
os.chdir(os.path.dirname(sys.argv[0]) or ".")
setup(
name="gohttp",
version="0.3.3",
description="Bindings for gohttplib, exposing Go's http.Server",
long_description=open("README.rst", "rt").read(),
url="http... | 0 | 0 | 0 | 0 | 0 | 0 |
corpus_generator.py | tommccoy1/hans | 109 | 1772035 |
from templates import *
template_list = [
("lexical_overlap", "ln_subject/object_swap", "non-entailment", lex_simple_templates),
("lexical_overlap", "ln_preposition", "non-entailment", lex_prep_templates),
("lexical_overlap", "ln_relative_clause", "non-entailment", lex_rc_templates),
... | 0 | 2 | 0 | 0 | 2 | 0 |
ckanext/datastore/tests/conftest.py | ziveo/ckan | 2,805 | 1772050 | <filename>ckanext/datastore/tests/conftest.py
# -*- coding: utf-8 -*-
import pytest
import ckanext.datastore.tests.helpers as test_helpers
@pytest.fixture
def clean_datastore(clean_db, clean_index):
engine = test_helpers.db.get_write_engine()
test_helpers.rebuild_all_dbs(
test_helpers.orm.scoped_sess... | 0 | 0 | 0 | 0 | 0 | 0 |
master-node-docker/sentinel/swaps/btc.py | ramesh-kr/sentinel | 342 | 1772077 | <reponame>ramesh-kr/sentinel
# coding=utf-8
import json
import time
import falcon
from ..db import db
from ..helpers import btc_helper
from ..helpers import tokens
class GetNewAddress(object):
def on_post(self, req, resp):
to_address = str(req.body['account_addr'])
from_token = tokens.get_token(... | 0 | 0 | 0 | 0 | 0 | 0 |
weekly-work/week1/MNIST_for_beginners.py | nirupam1sharma/Self-Study | 284 | 1772079 | <reponame>nirupam1sharma/Self-Study
# coding: utf-8
# ### MNIST for Beginners
# ### from https://www.tensorflow.org/versions/r0.9/tutorials/mnist/beginners/index.html
# ### The MNIST Data
# In[1]:
# The MNIST Data are hosted on Yann LeCun's website, but made available directly by the TensorFlow team.
from tensorfl... | 0 | 0 | 0 | 0 | 0 | 0 |
Build Glyphs/Build Parenthesized Glyphs.py | justanotherfoundry/Glyphs-Scripts | 283 | 1772110 | <reponame>justanotherfoundry/Glyphs-Scripts<gh_stars>100-1000
#MenuTitle: Build Parenthesized Glyphs
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Creates parenthesized letters and numbers: one.paren, two.paren, three.paren, four.paren, five.paren, six.paren, seve... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | gravityrail/phply | 202 | 1772131 | <gh_stars>100-1000
# coding: utf-8
from __future__ import unicode_literals
from setuptools import setup, find_packages, Command
from distutils.command.build import build as distutils_build
distutils_build.sub_commands.insert(0, ('gen_parsetab', lambda _: True))
class GenerateParsetab(Command):
user_options = []... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | zanachka/scrapy-splash | 2,556 | 1772145 | <gh_stars>1000+
import os
import pytest
from .mockserver import MockServer
from .resources import SplashProtected
@pytest.fixture()
def settings():
""" Default scrapy-splash settings """
s = dict(
# collect scraped items to .collected_items attribute
ITEM_PIPELINES={
'tests.utils.... | 0 | 0 | 0 | 0 | 0 | 0 |
molotov/stats.py | jldiaz-uniovi/molotov | 401 | 1772157 | from urllib.parse import urlparse
from aiodogstatsd import Client
def get_statsd_client(address: str="udp://127.0.0.1:8125", **kw) -> object:
res = urlparse(address)
return Client(host=res.hostname, port=res.port, **kw)
| 1 | 1 | 0 | 0 | 2 | 0 |
dynamic_preferences/migrations/0001_initial.py | EliotBerriot/django-dynamic-preferences | 244 | 1772160 | <filename>dynamic_preferences/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MO... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter_13/ch13_e1_ex4.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 1772169 | <reponame>pauldevos/Mastering-Object-Oriented-Python-Second-Edition
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 13. Example 4.
"""
# REST basics
# ========================================
# Stateless. Roulette. Base class ... | 0 | 0 | 0 | 0 | 0 | 0 |
mock_data_generators/ga360_gen.py | tzooming/bigquery-ml-templates | 154 | 1772171 | '''
Copyright 2019 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 applicable law or agreed to in writing, software
di... | 0 | 0 | 0 | 0 | 0 | 0 |
pysec/binary.py | benhunter/owasp-pysec | 416 | 1772173 | #!/usr/bin/python -OOBRStt
from __future__ import annotations
""""""
from pysec.core import is_int, is_str, is_dict
SPECIAL_CHARS = '\\', '*', '?', '!', '[', ']', '{', '}', '-', ',', '#', '@'
ALPHA = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
DIGITS = '0123456789'
LOWER = 'abcdefghijklmnopqrstuvwxyz'
UPP... | 7 | 6 | 0 | 1 | 14 | 0 |
ITEM 20-29/ITEM22 reconstructFace/reconstructFace.py | luohenyueji/OpenCV-Practical-Exercise | 293 | 1772198 | <filename>ITEM 20-29/ITEM22 reconstructFace/reconstructFace.py
# Import necessary packages
import os
import sys
import cv2
import numpy as np
'''
Display result
Left = Original Image
Right = Reconstructed Face
'''
def displayResult(left, right) :
output = np.hstack((left,right))
output = cv2.resize(output, (0,0)... | 0 | 0 | 0 | 0 | 0 | 0 |
script.mrknow.urlresolver/lib/urlresolver9/plugins/mailru.py | mrknow/filmkodi | 105 | 1772215 | <filename>script.mrknow.urlresolver/lib/urlresolver9/plugins/mailru.py
"""
OVERALL CREDIT TO:
t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the ... | 0 | 0 | 0 | 0 | 0 | 0 |
aries_cloudagent/messaging/decorators/tests/test_transport_decorator.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 1772227 | <gh_stars>100-1000
from unittest import TestCase
from ...valid import UUIDFour
from ..transport_decorator import TransportDecorator, TransportDecoratorSchema
class TestTransportDecorator(TestCase):
def test_serialize_load(self):
deco = TransportDecorator(
return_route="all",
retur... | 0 | 0 | 0 | 0 | 0 | 0 |
prod/stock_em02_rpc02/run_service.py | liuying3013/vnpy | 323 | 1772259 | # flake8: noqa
import os
import sys
import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import DEBUG
# 将repostory的目录i,作为根目录,添加到系统环境中。
ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
if ROOT_PATH not in sys.path:
sys.path.append(ROOT_PATH)... | 3 | 3 | 0 | 3 | 9 | 0 |
libs/WebhookHelpers.py | JanSkalny/RootTheBox | 635 | 1772267 | <reponame>JanSkalny/RootTheBox
# -*- coding: utf-8 -*-
"""
Created on Apr 2, 2021
@author: anthturner
Copyright 2021 Root the Box
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 |
modules/image/semantic_segmentation/ace2p/data_feed.py | chunzhang-hub/PaddleHub | 8,360 | 1772287 | <reponame>chunzhang-hub/PaddleHub
# coding=utf-8
import os
import time
from collections import OrderedDict
import cv2
import numpy as np
from ace2p.processor import get_direction, get_3rd_point, get_affine_transform
__all__ = ['reader']
def _box2cs(box, aspect_ratio):
x, y, w, h = box[:4]
return _xywh2cs(x... | 0 | 0 | 0 | 0 | 0 | 0 |
labgraph/graphs/method.py | Yunusbcr/labgraph | 124 | 1772299 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import (
Any,
AsyncIterator,
Awaitable,
Callable,
Coroutine,
List,
Optional,
Sequence,
Tuple,
)
from typing_extens... | 17 | 16 | 9 | 1 | 43 | 0 |
codigo/Live24/download_samurai_x.py | cassiasamp/live-de-python | 572 | 1772310 | <gh_stars>100-1000
from collections import namedtuple
from requests import get
from bs4 import BeautifulSoup as bs
ep_structure = namedtuple('EP', 'temporada episodio nome')
URL = 'https://pt.wikipedia.org/wiki/Lista_de_epis%C3%B3dios_de_Samurai_X'
request = get(URL)
page = bs(request.content, 'lxml')
tables = page.... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/hubert/utils/__init__.py | popcornell/audio | 1,718 | 1772334 | from .common_utils import create_tsv
from .feature_utils import dump_features
from .kmeans import learn_kmeans, get_km_label
__all__ = [
"create_tsv",
"dump_features",
"learn_kmeans",
"get_km_label",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
open_seq2seq/parts/rnns/glstm.py | gioannides/OpenSeq2Seq | 1,459 | 1772340 | <filename>open_seq2seq/parts/rnns/glstm.py
"""Module for constructing RNN Cells."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from six.moves import range
from tensorflow.contrib.rnn.python.ops import core_rnn_cel... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_reslope.py | bgalbraith/macarico | 121 | 1772368 | <filename>tests/test_reslope.py
from __future__ import division, generators, print_function
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable as Var
import sys
import macarico.util
macarico.util.reseed()
from macarico.annealing import ExponentialAnnea... | 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.