max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/trac/test-trac-0132.py | eLBati/pyxb | 123 | 12776697 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import sys
import pyxb
import unittest
class TestTrac0132 (unittest.TestCase):
message = 'bad character \u2620'
def testDecode (self):
... |
server/plugins/gatekeeper/gatekeeper.py | nathandarnell/sal | 215 | 12776699 | <gh_stars>100-1000
from django.db.models import Q
import sal.plugin
TITLES = {
'ok': 'Machines with Gatekeeper enabled',
'alert': 'Machines without Gatekeeper enabled',
'unknown': 'Machines with unknown Gatekeeper status'}
PLUGIN_Q = Q(pluginscriptsubmission__plugin='Gatekeeper')
SCRIPT_Q = Q(pluginscrip... |
comicolorization/extensions/__init__.py | DwangoMediaVillage/Comicolorization | 122 | 12776700 | <gh_stars>100-1000
from .save_images import SaveGeneratedImageExtension, SaveRawImageExtension
|
bumblebee_status/util/algorithm.py | rosalogia/bumblebee-status | 1,089 | 12776702 | import copy
def merge(target, *args):
"""Merges arbitrary data - copied from http://blog.impressiver.com/post/31434674390/deep-merge-multiple-python-dicts
:param target: the data structure to fill
:param args: a list of data structures to merge into target
:return: target, with all data in args merg... |
alex/applications/PublicTransportInfoCS/slu/dailogregclassifier/download_models.py | oplatek/alex | 184 | 12776760 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
if __name__ == '__main__':
import autopath
from alex.utils.config import online_update
if __name__ == '__main__':
online_update("applications/PublicTransportInfoCS/slu/dailogregclassifier/dailogreg.nbl.model.all")
|
tests/test_table_input.py | abcnishant007/sklearn-evaluation | 351 | 12776817 | <filename>tests/test_table_input.py
from unittest import TestCase
from sklearn_evaluation import table
class TestMissingInput(TestCase):
def test_feature_importances(self):
with self.assertRaisesRegex(ValueError, "needed to tabulate"):
table.feature_importances(None)
|
text_analysis_tools/api/sentiment/sentiment.py | yu3peng/text_analysis_tools | 149 | 12776822 | # -*- coding: utf-8 -*-
import os
import json
import jieba.analyse
import jieba
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
sentiment_path = os.path.join(CURRENT_PATH, 'data', 'sentimentDict.json')
stopwords_path = os.path.join(CURRENT_PATH, 'data', 'stopwords.txt.json')
degree_path = os.path.join(CUR... |
cctbx/sgtbx/direct_space_asu/plane_group_reference_table.py | dperl-sol/cctbx_project | 155 | 12776844 | <filename>cctbx/sgtbx/direct_space_asu/plane_group_reference_table.py
from __future__ import absolute_import, division, print_function
from cctbx.sgtbx.direct_space_asu import direct_space_asu
from cctbx.sgtbx.direct_space_asu.short_cuts import *
from six.moves import range
def asu_01(): # p_1 (s.g. 1)
return (direc... |
search_insert_position/solution.py | mahimadubey/leetcode-python | 528 | 12776852 | # -*- coding: utf-8 -*-
"""
Given a sorted array and a target value, return the index if the target is
found. If not, return the index where it would be if it were inserted in
order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6], 2 → 1
[1,3,5,6], 7 → 4
[1,3,5,6], 0 → 0
... |
thespian/system/transport/test/test_resultcallback.py | dendron2000/Thespian | 210 | 12776871 | from thespian.system.transport import ResultCallback
from datetime import datetime, timedelta
from time import sleep
class TestUnitResultCallback(object):
def _good(self, result, value):
if not hasattr(self, 'goods'): self.goods = []
self.goods.append( (result, value) )
def _fail(self, resul... |
pykeyvi/src/converters/__init__.py | remusao/keyvi | 147 | 12776876 | from .pykeyvi_autowrap_conversion_providers import *
from autowrap.ConversionProvider import special_converters
def register_converters():
special_converters.append(MatchIteratorPairConverter())
|
evidently/telemetry/__init__.py | alex-zenml/evidently | 2,212 | 12776888 | <reponame>alex-zenml/evidently<filename>evidently/telemetry/__init__.py
from .sender import TelemetrySender
|
mindarmour/adv_robustness/defenses/__init__.py | hboshnak/mindarmour | 139 | 12776896 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
recipes/Python/496825_Game_theory_payoff_matrix_solver/recipe-496825.py | tdiprima/code | 2,023 | 12776901 | ''' Approximate the strategy oddments for 2 person zero-sum games of perfect information.
Applies the iterative solution method described by <NAME> in his classic
book, The Compleat Strategyst, ISBN 0-486-25101-2. See chapter 5, page 180 for details. '''
from operator import add, neg
def solve(payoff_matrix, itera... |
src/genie/libs/parser/iosxe/tests/ShowEthernetServiceInstance/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 12776912 | <filename>src/genie/libs/parser/iosxe/tests/ShowEthernetServiceInstance/cli/equal/golden_output_1_expected.py
expected_output = {
"service_instance": {
501: {
"interfaces": {
"TenGigabitEthernet0/3/0": {"state": "Up", "type": "Static"},
"TenGigabitEthernet0/1/0": ... |
setup.py | SeanNobel/d4rl-pybullet | 130 | 12776953 | <gh_stars>100-1000
from setuptools import setup, find_packages
setup(name="d4rl_pybullet",
version="0.1",
license="MIT",
description="Datasets for data-driven deep reinforcement learnig with Pybullet environments",
url="https://github.com/takuseno/d4rl-pybullet",
install_requires=["gym",... |
repokid/plugin.py | boost-entropy-repos-org/repokid | 999 | 12776958 | # Copyright 2021 Netflix, 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... |
gaphor/C4Model/c4model.py | mrmonkington/gaphor | 867 | 12776963 | <reponame>mrmonkington/gaphor
# This file is generated by profile_coder.py. DO NOT EDIT!
from __future__ import annotations
from gaphor.core.modeling.properties import (
association,
attribute,
relation_many,
relation_one,
)
from gaphor.UML import Actor, Package
class C4Container(Package):
descr... |
src/layoutparser/elements/utils.py | frankiert/layout-parser | 2,931 | 12776964 | <reponame>frankiert/layout-parser
# Copyright 2021 The Layout Parser team. 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-... |
tools/xdl/xdlrcviz.py | leonardt/magma | 167 | 12777011 | <filename>tools/xdl/xdlrcviz.py
import sexpr
import sys
import os
from pprint import pprint
from subprocess import Popen, PIPE
fname = sys.argv[1]
name = os.path.basename(fname).split('.')[0]
file = open(fname)
source = ""
for line in file.readlines():
if line[0] != "#":
source += line
sexpr.input(source)
s = s... |
microraiden/examples/ticker_client.py | andrevmatos/microraiden | 417 | 12777043 | <filename>microraiden/examples/ticker_client.py
from tkinter import ttk
import tkinter
import logging
import gevent
import click
import sys
from microraiden import Session
from microraiden import utils
log = logging.getLogger(__name__)
class ETHTickerClient(ttk.Frame):
def __init__(
self,
... |
openapi_core/contrib/flask/responses.py | Yarn-e/openapi-core | 160 | 12777048 | <reponame>Yarn-e/openapi-core
"""OpenAPI core contrib flask responses module"""
from werkzeug.datastructures import Headers
from openapi_core.validation.response.datatypes import OpenAPIResponse
class FlaskOpenAPIResponseFactory:
@classmethod
def create(cls, response):
header = Headers(response.heade... |
system/tasks.py | topicgit/seal | 132 | 12777085 | import logging
import requests
import json
from celery import shared_task
from system.models import Users
from seal import settings
logger = logging.getLogger('system_celery')
@shared_task
def system_demo(one):
##因为开启了时区,所以django在数据库里面保存的为 utc 时间, 调用的时候会帮你 转为 东八区, celery会自动识别时间
from django.utils import timezo... |
utils/decoder/model.py | gaoyiyeah/ZASR_tensorflow | 115 | 12777098 | """Contains DeepSpeech2 model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import time
import logging
import gzip
import copy
import numpy as np
import inspect
from utils.decoder.swig_wrapper import Scorer
from utils.decoder.swig_... |
tests/core/pyspec/eth2spec/utils/hash_function.py | MicahZoltu/eth2.0-specs | 2,161 | 12777113 | from hashlib import sha256
from remerkleable.byte_arrays import Bytes32
from typing import Union
ZERO_BYTES32 = b'\x00' * 32
def hash(x: Union[bytes, bytearray, memoryview]) -> Bytes32:
return Bytes32(sha256(x).digest())
|
tfjs_graph_converter/quirks.py | httpsgithu/tfjs-to-tf | 114 | 12777127 | # SPDX-License-Identifier: MIT
# Copyright © 2020 <NAME>
"""Functions to fix various known issues with exported TFJS models"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import base64
from typing import... |
spectre/trading/stopmodel.py | rajach/spectre | 302 | 12777154 | <filename>spectre/trading/stopmodel.py
"""
@author: Heerozh (<NAME>)
@copyright: Copyright 2019-2020, Heerozh. All rights reserved.
@license: Apache 2.0
@email: <EMAIL>
"""
import math
def sign(x):
return math.copysign(1, x)
class PriceTracker:
def __init__(self, current_price, recorder=max):
self.l... |
conan/recipes/android-sdk-tools/conanfile.py | alexa/aac-sdk | 139 | 12777170 | <reponame>alexa/aac-sdk
from conans import ConanFile, tools, RunEnvironment
import os, logging
class AndroidSdkToolsConanFile(ConanFile):
name = "android-sdk-tools"
version = "4.0"
user = "aac-sdk"
channel = "stable"
no_copy_source = True
exports_sources = ["cmake-wrapper.cmd", "cmake-wrapper"]... |
Skoarcery/factoary/Code_Parser_Py.py | sofakid/Skoarcery | 343 | 12777248 | <filename>Skoarcery/factoary/Code_Parser_Py.py
import unittest
from Skoarcery import langoids, terminals, nonterminals, dragonsets, parsetable, emissions
from Skoarcery.langoids import Terminal, Nonterminal
class Code_Parser_Py(unittest.TestCase):
def setUp(self):
terminals.init()
nonterminals.in... |
httpolice/syntax/rfc3986.py | vfaronov/httpolice | 1,027 | 12777281 | from httpolice.citation import RFC
from httpolice.parse import (auto, empty, fill_names, literal, maybe_str,
octet_range, pivot, string, string1, string_times,
subst)
from httpolice.syntax.common import ALPHA, DIGIT, HEXDIG
pct_encoded = '%' + HEXDIG + HEXDIG ... |
plot_sweep.py | yinghai/benchmark | 384 | 12777283 | <filename>plot_sweep.py
import argparse
import json
# import pandas as pd
import os
# import sys
# import re
import yaml
import itertools
# from bokeh.layouts import column, row, layout, gridplot
# from bokeh.plotting import figure, output_file, show
# from bokeh.sampledata.autompg import autompg
# from bokeh.transfor... |
package/awesome_streamlit/experiments/__init__.py | R-fred/awesome-streamlit | 1,194 | 12777301 | """Imports that should be exposed outside the package"""
from .hello_world import write as write_hello_world
|
algs4/symbol_graph.py | dumpmemory/algs4-py | 230 | 12777330 | <reponame>dumpmemory/algs4-py
"""
Execution: python symbol_graph.py filename.txt delimiter
Data files: https://algs4.cs.princeton.edu/41graph/routes.txt
https://algs4.cs.princeton.edu/41graph/movies.txt
https://algs4.cs.princeton.edu/41graph/moviestiny.txt
h... |
python/pmercury/protocols/dhcp.py | raj-apoorv/mercury | 299 | 12777333 | """
Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
License at https://github.com/cisco/mercury/blob/master/LICENSE
"""
import os
import sys
import functools
from socket import AF_INET, AF_INET6, inet_ntop
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.pat... |
astroNN/__init__.py | igomezv/astroNN | 156 | 12777350 | r"""
Deep Learning for Astronomers with Tensorflow
"""
from pkg_resources import get_distribution
version = __version__ = get_distribution('astroNN').version
|
renderer/render_utils.py | archonic/frankmocap | 1,612 | 12777443 | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
# vertices: frames x meshVerNum x 3
# trifaces: facePolygonNum x 3 = 22800 x 3
def ComputeNormal(vertices, trifaces):
if vertices.shape[0] > 5000:
print('ComputeNormal: Warning: too big to compute {0}'.format(vertices.shape) )
... |
rlgraph/agents/sac_agent.py | RLGraph/RLGraph | 290 | 12777480 | # 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... |
python/chartParsing.py | pramitmallick/spinn | 103 | 12777498 | """
Artifical test for chart parsing
"""
from random import shuffle
import numpy as np
import string
def generate_string(length):
letters = list(string.ascii_lowercase) + list(string.ascii_uppercase)
shuffle(letters)
output = []
for i in range(length):
output.append(letters[i])
return outp... |
deinkscape.py | Emoji-COLRv0/emojitwo | 313 | 12777543 | #!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# By HarJIT in 2020. MIT/Expat licence.
import os, xml.dom.minidom, shutil, re, glob
svgpresattrs = ("alignment-baseline", "baseline-shift", "clip", "clip-path", "clip-rule", "color",
"color-interpolation", "color-interpolation-filters", "color-profile", "... |
tests/test_portfolio_handler.py | ivanliu1989/qstrader | 113 | 12777565 | import datetime
from decimal import Decimal
import unittest
from qstrader.event import FillEvent, OrderEvent, SignalEvent
from qstrader.portfolio_handler import PortfolioHandler
from qstrader.price_handler.base import AbstractTickPriceHandler
from qstrader.compat import queue
class PriceHandlerMock(AbstractTickPrice... |
babble/__init__.py | billchenxi/babble | 130 | 12777587 | from .explanation import Explanation
from .parsing import Rule, Grammar, Parse, SemanticParser
from .filter_bank import FilterBank
from .utils import ExplanationIO, link_explanation_candidates
from .babbler import Babbler, BabbleStream |
src/bkl/interpreter/__init__.py | johnwbyrd/brakefile | 118 | 12777595 | #
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2008-2013 <NAME>
#
# 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 without restriction, including without limita... |
example/issues/449_django_lazy_path/pulpsettings.py | sephiartlist/dynaconf | 2,293 | 12777602 | REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (
"rest_framework.authentication.SessionAuthentication",
"pulpcore.app.authentication.PulpRemoteUserAuthentication",
"foo_bar1",
)
|
minpy/numpy/random.py | yuhonghong66/minpy | 1,271 | 12777621 | <reponame>yuhonghong66/minpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Mock numpy random module """
#pylint: disable= invalid-name
from __future__ import absolute_import
import sys
from minpy.numpy.mocking import Module
_old = {
'__name__' : __name__,
}
sys.modules[__name__] = Module(_old, 'random')
|
pyatlas/unit_tests/test_identifier_converters.py | yazad3/atlas | 188 | 12777627 | import unittest
from pyatlas import identifier_converters
class IdentifierConvertersTest(unittest.TestCase):
def setUp(self):
pass
def test_osm_conversion(self):
atlas_id = 222222000000
osm_id = 222222
self.assertEqual(osm_id, identifier_converters.get_osm_identifier(atlas_id... |
videos/HomeworkVol03/678-widcardw.py | AStarySky/manim_sandbox | 366 | 12777683 | <gh_stars>100-1000
# from widcardw
from manimlib.imports import *
class Test6(Scene):
CONFIG = {"camera_config": {"background_color": "#ffffff"}}
def construct(self):
circle0 = Circle(radius=1.5, stroke_color="#559944", plot_depth=-2)
doto = Dot(ORIGIN, color="#000000")
te... |
assertpy/__init__.py | santunioni/assertpy | 246 | 12777688 | from __future__ import absolute_import
from .assertpy import assert_that, assert_warn, soft_assertions, fail, soft_fail, add_extension, remove_extension, WarningLoggingAdapter, __version__
from .file import contents_of
|
rl_agents/trainer/logger.py | neskoc/rl-agents | 342 | 12777691 | <reponame>neskoc/rl-agents<gh_stars>100-1000
import json
import logging.config
from pathlib import Path
import gym
from rl_agents.configuration import Configurable
logging_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "[%(levelname)... |
gpflow/utilities/utilities.py | HarrySpearing/GPflow | 1,724 | 12777735 | # Copyright 2017-2021 The GPflow Contributors. 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... |
tests/java/org/python/indexer/data/mod2.py | jeff5/jython-whinchat | 577 | 12777762 | <reponame>jeff5/jython-whinchat<filename>tests/java/org/python/indexer/data/mod2.py
import distutils.command
def mod2test():
return dir(distutils)
|
eraserhead/request_storage.py | yozlet/django-eraserhead | 216 | 12777792 | # encoding: utf-8
from __future__ import print_function
import term
import humanfriendly
class RequestStorage(object):
""" Stores statistics about single request """
def __init__(self):
self.queryset_stats = []
def add_queryset_storage_instance(self, queryset_storage):
self.queryset_st... |
setup.py | rvega/isobar | 241 | 12777806 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='isobar',
version='0.1.1',
description='A Python library to express and manipulate musical patterns',
long_description = open("README.md", "r").read(),
long_description_content_type = "text/markdown",
author='<NAME>'... |
alphamind/tests/portfolio/test_optimizers.py | rongliang-tech/alpha-mind | 186 | 12777819 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on 2017-11-1
@author: cheng.li
"""
import unittest
import numpy as np
from alphamind.portfolio.optimizers import LPOptimizer
from alphamind.portfolio.optimizers import QuadraticOptimizer
from alphamind.portfolio.optimizers import TargetVolOptimizer
class TestO... |
scripts/estimate_median_freq.py | rocksat/jsis3d | 180 | 12777846 | import os
import sys
import h5py
import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--root', help='path to root directory')
args = parser.parse_args()
root = args.root
fname = os.path.join(root, 'metadata/train.txt')
flist = [os.path.join(root, 'h5', line.strip())
fo... |
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py | zipated/src | 2,151 | 12777848 | # Copyright 2017 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.
# pylint: disable=import-error,print-statement,relative-import,protected-access
"""Unit tests for name_style_converter.py."""
import unittest
from name_st... |
python/test/cuda/test_large_blocks.py | daniel-falk/nnabla-ext-cuda | 103 | 12777865 | <gh_stars>100-1000
# Copyright 2017,2018,2019,2020,2021 Sony 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 require... |
tests/test_0231-indexform.py | BioGeek/awkward-1.0 | 519 | 12777887 | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test():
for itype in ["i8", "u8", "i32", "u32", "i64"]:
form = ak.forms.ListO... |
src/gausskernel/dbmind/tools/ai_server/service/datafactory/collector/agent_collect.py | Yanci0/openGauss-server | 360 | 12777926 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#############################################################################
# Copyright (c): 2021, Huawei Tech. Co., Ltd.
# FileName : agent_collect.py
# Version :
# Date : 2021-4-7
# Description : Receives and stores agent data.
###########################... |
sgit/commit.py | russelldavis/SublimeGit | 310 | 12777946 | <gh_stars>100-1000
# coding: utf-8
from functools import partial
import sublime
from sublime_plugin import WindowCommand, TextCommand, EventListener
from .util import find_view_by_settings, noop, get_setting
from .cmd import GitCmd
from .helpers import GitStatusHelper
from .status import GIT_WORKING_DIR_CLEAN
GIT_C... |
src/seedwork/infrastructure/logging.py | Ermlab/python-ddd | 308 | 12777968 | from pythonjsonlogger import jsonlogger
from datetime import datetime
import logging
from logging import Logger
from logging.config import dictConfig
from seedwork.utils.functional import SimpleLazyObject
from seedwork.infrastructure.request_context import request_context
class RequestContextFilter(logging.Filter):
... |
homeassistant/components/wiffi/wiffi_strings.py | domwillcode/home-assistant | 30,023 | 12777989 | """Definition of string used in wiffi json telegrams."""
# units of measurement
WIFFI_UOM_TEMP_CELSIUS = "gradC"
WIFFI_UOM_DEGREE = "grad"
WIFFI_UOM_PERCENT = "%"
WIFFI_UOM_MILLI_BAR = "mb"
WIFFI_UOM_LUX = "lux"
|
uasyncio/test_readexactly.py | Carglglz/micropython-lib | 126 | 12778021 | <reponame>Carglglz/micropython-lib<filename>uasyncio/test_readexactly.py<gh_stars>100-1000
from uasyncio import StreamReader
class MockSock:
def __init__(self, data_list):
self.data = data_list
def read(self, sz):
try:
return self.data.pop(0)
except IndexError:
... |
examples/urlopen.py | mikelolasagasti/bandit | 4,016 | 12778084 | ''' Example dangerous usage of urllib[2] opener functions
The urllib and urllib2 opener functions and object can open http, ftp,
and file urls. Often, the ability to open file urls is overlooked leading
to code that can unexpectedly open files on the local server. This
could be used by an attacker to leak information ... |
python_web/config.py | LouisYZK/Frodo | 123 | 12778096 | import os
import configparser
import yaml
import ast
from pathlib import Path
HERE = Path(__file__).parent.absolute()
print(HERE)
config_dir = HERE / 'config/config.ini.model'
config = configparser.ConfigParser()
config.read(config_dir)
ACCESS_TOKEN_EXPIRE_MINUTES = config.get('security', 'access_token_expire_minute... |
vedastr/metrics/__init__.py | csmasters/vedastr | 475 | 12778112 | from .accuracy import Accuracy
from .builder import build_metric
|
alipay/aop/api/domain/ApInvoiceBillLinkOrderRequest.py | antopen/alipay-sdk-python-all | 213 | 12778115 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi
class ApInvoiceBillLinkOrderRequest(object):
def __init__(self):
self._amt = None
self._daily_bill_... |
packages/pyright-internal/src/tests/samples/paramSpec4.py | Jasha10/pyright | 3,934 | 12778116 | # This sample tests the type checker's handling of ParamSpec
# and Concatenate as described in PEP 612.
from typing import Callable, Concatenate, ParamSpec, TypeVar
P = ParamSpec("P")
R = TypeVar("R")
class Request:
...
def with_request(f: Callable[Concatenate[Request, P], R]) -> Callable[P, R]:
def inner... |
pyjobs/core/migrations/0015_job_ad_interested.py | Mdslino/PyJobs | 132 | 12778121 | <filename>pyjobs/core/migrations/0015_job_ad_interested.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-04 18:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("core", "0014_auto_20180... |
apps/panel/migrations/0004_log.py | ivall/IVmonitor | 190 | 12778152 | # Generated by Django 3.0.7 on 2021-02-05 09:15
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('panel', '0003_auto_20210205_0955'),
]
operations = [
migrations.CreateModel(
... |
hummingbot/strategy/dev_0_hello_world/start.py | cardosofede/hummingbot | 542 | 12778239 | <reponame>cardosofede/hummingbot
#!/usr/bin/env python
from hummingbot.strategy.dev_0_hello_world.dev_0_hello_world_config_map import dev_0_hello_world_config_map
from hummingbot.strategy.dev_0_hello_world import HelloWorldStrategy
def start(self):
try:
exchange = dev_0_hello_world_config_map.get("exchan... |
tests/unit/test_modulegraph/testpkg-packages/pkg/__init__.py | hawkhai/pyinstaller | 9,267 | 12778243 | <reponame>hawkhai/pyinstaller
""" pkg.init """
|
dataparser/queue/finder.py | idxn/sublime-robot-framework-assistant | 103 | 12778260 | import os
import fnmatch
def finder(path, ext):
"""Returns files from path by extension"""
l = []
if not ext.startswith('*.'):
ext = '*.{0}'.format(ext)
for path, dirs, files in os.walk(os.path.abspath(path)):
for f in fnmatch.filter(files, ext):
l.append(os.path... |
ote_sdk/ote_sdk/entities/coordinate.py | ntyukaev/training_extensions | 775 | 12778267 | <reponame>ntyukaev/training_extensions
"""This module implements the Coordinate entity"""
# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from typing import Tuple
class Coordinate:
"""
Represents a 2D-coordinate with an x-position and a y-position.
NB most coordinates ... |
kashgari/layers/__init__.py | SharpKoi/Kashgari | 2,422 | 12778272 | # encoding: utf-8
# author: BrikerMan
# contact: <EMAIL>
# blog: https://eliyar.biz
# file: __init__.py
# time: 7:39 下午
from typing import Dict, Any
from tensorflow import keras
from .conditional_random_field import KConditionalRandomField
from .behdanau_attention import BahdanauAttention # type: ignore
L = keras... |
leet/array/maxSubArrayLen.py | peterlamar/python-cp-cheatsheet | 140 | 12778287 | class Solution:
# Maximum Size Subarray Sum Equals k
def maxSubArrayLen(self, nums: List[int], k: int) -> int:
hm = {0:-1}
ps = 0
rtn = 0
for i in range(len(nums)):
ps += nums[i]
if ps not in hm:
hm[ps] = i
if ps - ... |
faker/providers/lorem/tl_PH/__init__.py | jacksmith15/faker | 12,077 | 12778301 | <reponame>jacksmith15/faker<gh_stars>1000+
from ..fil_PH import Provider as FilPhProvider
class Provider(FilPhProvider):
"""Implement lorem provider for ``tl_PH`` locale.
There is no difference from the |FilPhLoremProvider|.
.. |FilPhLoremProvider| replace::
:meth:`FilPhLoremProvider <faker.prov... |
sampling_free/modeling/generalized_rcnn/rpn/retinanet/__init__.py | ChenJoya/sampling-free | 266 | 12778302 | <reponame>ChenJoya/sampling-free
from .retinanet import build_retinanet |
trackml/score.py | victor-estrade/trackml-library | 166 | 12778315 | """TrackML scoring metric"""
__authors__ = ['<NAME>', '<NAME>', '<NAME>',
'<NAME>']
import numpy
import pandas
def _analyze_tracks(truth, submission):
"""Compute the majority particle, hit counts, and weight for each track.
Parameters
----------
truth : pandas.DataFrame
Truth ... |
exercises/zh/solution_03_09_01.py | Jette16/spacy-course | 2,085 | 12778375 | from spacy.lang.zh import Chinese
from spacy.tokens import Token
nlp = Chinese()
# 注册词符的扩展属性"is_country",其默认值是False
Token.set_extension("is_country", default=False)
# 处理文本,将词符"新加坡"的is_country属性设置为True
doc = nlp("我住在新加坡。")
doc[3]._.is_country = True
# 对所有词符打印词符文本及is_country属性
print([(token.text, token._.is_country) ... |
examples/worker/simplejob.py | pooya/disco | 786 | 12778443 | from disco.job import SimpleJob
class SimpleJob(SimpleJob):
def map(self, worker, task, **jobargs):
worker.output(task, partition=None).file.append('hello world!')
def reduce(self, worker, task, **jobargs):
worker.output(task, partition=None).file.append('goodbye world!')
|
tests/seahub/views/sysadmin/test_sysadmin.py | samuelduann/seahub | 420 | 12778455 | <filename>tests/seahub/views/sysadmin/test_sysadmin.py<gh_stars>100-1000
import os
import openpyxl
from io import BytesIO
from mock import patch
from django.urls import reverse
from seahub.base.accounts import User
from seahub.options.models import (UserOptions, KEY_FORCE_PASSWD_CHANGE)
from seahub.test_utils import B... |
saleor/plugins/webhook/const.py | victor-abz/saleor | 1,392 | 12778477 | CACHE_EXCLUDED_SHIPPING_KEY = "webhook_exclude_shipping_id_"
CACHE_EXCLUDED_SHIPPING_TIME = 60 * 3
EXCLUDED_SHIPPING_REQUEST_TIMEOUT = 2
|
workflow/__main__.py | trecvt-oss/workflow | 183 | 12778504 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
# License: 3-clause BSD License
# Author: <NAME> <<EMAIL>>
# Read-more: https://github.com/mdipierro/workflow
import sys, os, shelve, glob, time, shlex, subprocess, logging, re, optparse
re_line = re.compile('(?P<n>\w+):\s*(?P<p>.+?)\s*(\[(?P<dt>\w+)\]\s*)... |
mae_envs/modules/__init__.py | bglick13/multi-agent-emergence-environments | 1,317 | 12778514 | from .module import *
from .util import *
|
mopidy_mopify/mem.py | dirkgroenen/mopidy-mopify | 504 | 12778515 | <reponame>dirkgroenen/mopidy-mopify
queuemanager = None
localfiles = None |
house_robber_ii/solution.py | mahimadubey/leetcode-python | 528 | 12778542 | """
Note: This is an extension of House Robber.
After robbing those houses on that street, the thief has found himself a new
place for his thievery so that he will not get too much attention. This time,
all houses at this place are arranged in a circle. That means the first house
is the neighbor of the last one. Meanw... |
spyder_terminal/server/rest/__init__.py | mrclary/spyder-terminal | 169 | 12778546 | # -*- coding: utf-8 -*-
"""
rest module.
=========
Provides:
1. Asynchronous execution of JSON services
How to use the documentation
----------------------------
Documentation is available in one form: docstrings provided
with the code
Copyright (c) 2016, <NAME>.
MIT, see LICENSE for more details.
"""
from . ... |
experiments/launcher_exp2_collect.py | MenshovSergey/DetectChess | 144 | 12778568 | <filename>experiments/launcher_exp2_collect.py
import os
import pandas as pd
from os2d.utils.logger import extract_value_from_os2d_binary_log, mAP_percent_to_points
if __name__ == "__main__":
config_path = os.path.dirname(os.path.abspath(__file__))
config_job_name = "exp2"
log_path = os.path.abspath(os.p... |
orion/app.py | brian123zx/orion-server | 120 | 12778580 | from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS
from raven.contrib.flask import Sentry
from orion.context import Context
from orion.handlers import handler_classes
def init_app(app):
"""
Statefully initialize the Flask application. This involves creatin... |
saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.py | eanknd/saleor | 1,392 | 12778585 | from typing import Optional
import graphene
from django.core.exceptions import ValidationError
from ....giftcard.utils import order_has_gift_card_lines
from ....order import FulfillmentLineData
from ....order import models as order_models
from ....order.error_codes import OrderErrorCode
from ....order.fetch import Or... |
tuyaha/devices/switch.py | PaulAnnekov/tuya-ha | 153 | 12778604 |
from tuyaha.devices.base import TuyaDevice
class TuyaSwitch(TuyaDevice):
def turn_on(self):
if self._control_device("turnOnOff", {"value": "1"}):
self._update_data("state", True)
def turn_off(self):
if self._control_device("turnOnOff", {"value": "0"}):
self._update_d... |
tools/polly/bin/detail/osx_dev_root.py | Kondr11/LABA7 | 861 | 12778606 | # Copyright (c) 2015, <NAME>
# All rights reserved.
import os
import re
def get(osx_version):
dev_dir = re.sub(r'\.', '_', osx_version)
dev_dir = 'OSX_{}_DEVELOPER_DIR'.format(dev_dir)
return os.getenv(dev_dir)
|
libsaas/services/uservoice/comments.py | MidtownFellowship/libsaas | 155 | 12778628 | from libsaas import http, parsers
from libsaas.services import base
from . import resource, flags
class CommentsBase(resource.UserVoiceTextResource):
path = 'comments'
def wrap_object(self, name):
return {'comment': {'text': name}}
class Comments(CommentsBase):
def create(self, obj):
... |
backend/api/views/task.py | skaghzz/doccano | 3,989 | 12778629 | <filename>backend/api/views/task.py
from celery.result import AsyncResult
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
class TaskStatus(APIView):
permission_classes = (IsAuthenticated,)
def get(self, request, *arg... |
docs/examples/cpu_temperature_bar_graph.py | NotBobTheBuilder/gpiozero | 743 | 12778671 | <reponame>NotBobTheBuilder/gpiozero<filename>docs/examples/cpu_temperature_bar_graph.py
from gpiozero import LEDBarGraph, CPUTemperature
from signal import pause
cpu = CPUTemperature(min_temp=50, max_temp=90)
leds = LEDBarGraph(2, 3, 4, 5, 6, 7, 8, pwm=True)
leds.source = cpu
pause()
|
src/opendr/perception/activity_recognition/x3d/algorithm/x3d.py | makistsantekidis/opendr | 217 | 12778704 | <gh_stars>100-1000
""" Adapted from: https://github.com/facebookresearch/SlowFast
"""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from .head_helper import X3DHead
from .resnet_helper import ResStage
from .stem_helper import VideoModelStem
import pytorch_light... |
app/settings/arq.py | leosussan/fastapi-gino-arq-postgres | 289 | 12778706 | <filename>app/settings/arq.py
from arq.connections import RedisSettings
from .globals import REDIS_IP, REDIS_PORT
settings = RedisSettings(host=REDIS_IP, port=REDIS_PORT)
|
zinnia/migrations/__init__.py | Boondockers-Welcome/django-blog-zinnia | 1,522 | 12778732 | """Migrations for Zinnia"""
|
openbb_terminal/dashboards/widget_helpers.py | tehcoderer/GamestonkTerminal | 255 | 12778771 | """Widgets Helper Library.
A library of `ipywidgets` wrappers for notebook based reports and voila dashboards.
The library includes both python code and html/css/js elements that can be found in the
`./widgets` folder.
"""
import os
from jinja2 import Template
def stylesheet():
"""Load a default CSS stylesheet f... |
corehq/apps/sms/tests/opt_tests.py | akashkj/commcare-hq | 471 | 12778795 | from django.test import TestCase
from corehq.apps.accounting.models import SoftwarePlanEdition
from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
from corehq.apps.accounting.utils import clear_plan_version_cache
from corehq.apps.domain.models import Domain
from corehq.messaging.smsbackends.test.mod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.