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 |
|---|---|---|---|---|---|---|---|---|---|---|
infoxlm/src-infoxlm/infoxlm/__init__.py | Maria-philna/unilm | 5,129 | 3319204 | <reponame>Maria-philna/unilm<filename>infoxlm/src-infoxlm/infoxlm/__init__.py
import infoxlm.tasks
import infoxlm.models
import infoxlm.criterions | 0 | 0 | 0 | 0 | 0 | 0 |
pandas/read_csv/zip-file/main.py | whitmans-max/python-examples | 140 | 3319235 | <reponame>whitmans-max/python-examples
import pandas as pd
df = pd.read_csv('test.zip')
print(df)
| 0 | 0 | 0 | 0 | 0 | 0 |
hummingbot/connector/exchange/k2/k2_user_stream_tracker.py | pecuniafinance/hummingbot | 542 | 3319252 | import logging
from typing import List, Optional
from hummingbot.connector.exchange.k2.k2_api_user_stream_data_source import \
K2APIUserStreamDataSource
from hummingbot.connector.exchange.k2.k2_auth import K2Auth
from hummingbot.connector.exchange.k2.k2_constants import EXCHANGE_NAME
from hummingbot.core.data_type... | 2 | 3 | 1 | 2 | 8 | 0 |
blaze/compute/__init__.py | quantopian-enterprise/blaze | 2,106 | 3319259 | <filename>blaze/compute/__init__.py<gh_stars>1000+
from __future__ import absolute_import, division, print_function
from .core import compute, compute_up
# Import literal module to register contained dispatches.
from . import literal # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
cloud_foundry_api/tests/conftest.py | mchelen-gov/integrations-core | 663 | 3319281 | <gh_stars>100-1000
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
import pytest
from .constants import HERE
@pytest.fixture(scope='session')
def dd_environment():
yield
@pytest.fixture
def instance():
return {
... | 0 | 0 | 0 | 0 | 0 | 0 |
functions/load_metric.py | amizzo87/bernstein-stack | 358 | 3319300 | import datetime
import logging
import os
import boto3
CW = boto3.client("cloudwatch")
logging.getLogger().setLevel(os.environ.get("LOGLEVEL", logging.INFO))
def handler(_event, _context) -> None:
logging.debug("environment variables:\n %s", os.environ)
timestamp = datetime.datetime.now(datetime.timezone.ut... | 0 | 2 | 0 | 0 | 2 | 0 |
pysymoro/transform.py | songhongxiang/symoro | 109 | 3319305 | <filename>pysymoro/transform.py
# -*- coding: utf-8 -*-
"""
This module contains the TransformationMatrix data structure.
"""
import sympy
from pysymoro.screw6 import Screw6
from symoroutils import tools
def get_transformation_matrix(gamma, b, alpha, d, theta, r):
"""
Compute and get transformation matri... | 0 | 0 | 0 | 0 | 0 | 0 |
metrics/precision_recall.py | gperdrizet/gansformer | 1,172 | 3319308 | # Precision/Recall (PR)
from __future__ import annotations
import os
import numpy as np
import tensorflow as tf
import dnnlib
import dnnlib.tflib as tflib
import glob
import PIL.Image
from metrics import metric_base
from training import misc
def batch_pairwise_distances(U, V) -> object:
# Compute pairwise distanc... | 4 | 4 | 0 | 0 | 8 | 0 |
river/utils/data_conversion.py | fox-ds/river | 2,184 | 3319337 | <filename>river/utils/data_conversion.py<gh_stars>1000+
import numpy as np
def dict2numpy(data) -> np.ndarray:
"""Convert a dictionary containing data to a numpy array.
There is not restriction to the type of keys in `data`, but values must
be strictly numeric. To make sure random permutations of the fea... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/reinforce_cartpole.py | acse-yl27218/cherry | 160 | 3319376 | <gh_stars>100-1000
#!/usr/bin/env python3
"""
Simple example of using cherry to solve cartpole.
The code is an adaptation of the PyTorch reinforcement learning example.
TODO: This is not reinforce, this is policy gradient.
"""
import random
import gym
import numpy as np
from itertools import count
import torch as... | 0 | 0 | 0 | 0 | 0 | 0 |
image_resizer/image_resizer.py | anshul2807/Automation-scripts | 496 | 3319403 | <gh_stars>100-1000
import cv2
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-f',
type=str,
help='The file path of target image. '
+ 'ex. /home/user/example.jpeg.\nDefault value is "demo.jpeg"',
default=os.path.dirname(__file__) + '/demo.jpeg'
)
parser.add_argume... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit_detective/network.py | oleitao/reddit-detective | 173 | 3319405 | import praw
from neo4j import BoltDriver
from typing import List, Union
from itertools import chain
from reddit_detective.relationships import Submissions, Comments, CommentsReplies
from reddit_detective.karma import (_remove_karma, _set_karma_subreddits, _set_karma_submissions,
_se... | 3 | 3 | 0 | 0 | 6 | 0 |
2016/readline-samples/python/readline-complete-subcommand.py | mikiec84/code-for-blog | 1,199 | 3319423 | # Subcommand completion with the readline module.
#
# Tested with Python 3.4
#
# <NAME> [http://eli.thegreenplace.net]
# This code is in the public domain.
import glob
import readline
def make_subcommand_completer(commands) -> object:
def custom_complete(text, state) -> object:
# Simplistic parsing of the ... | 0 | 2 | 0 | 0 | 2 | 0 |
gryphon/data_service/pollers/poller.py | qiquanzhijia/gryphon | 1,109 | 3319435 | <filename>gryphon/data_service/pollers/poller.py
class Poller(object):
def parse_response(self, resp_obj):
pass
def start(self):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
src/primify/prime_finder.py | borea17/primify | 455 | 3319440 | from itertools import islice
import math
import time
from typing import Iterator, List, Optional, Set
import multiprocessing as mp
from sympy import isprime
import logging
from primify import console
logger = logging.getLogger(__file__)
class NextPrimeFinder:
def __init__(self, value: int, n_workers: int = 1):
... | 3 | 3 | 1 | 0 | 7 | 0 |
frida/frida-build/releng/winenv.py | bzxy/cydia | 678 | 3319448 | import glob
import json
import os
import subprocess
import winreg
RELENG_DIR = os.path.abspath(os.path.dirname(__file__))
ROOT_DIR = os.path.dirname(RELENG_DIR)
DEFAULT_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "toolchain-windows")
BOOTSTRAP_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "fts-toolcha... | 0 | 5 | 0 | 0 | 5 | 0 |
src/gtk/toga_gtk/widgets/detailedlist.py | freespace/toga | 1,261 | 3319449 | <gh_stars>1000+
from ..libs import Gtk, GLib, Gdk, Gio
from .base import Widget
from .internal.rows.texticon import TextIconRow
from .internal.buttons.refresh import RefreshButton
from .internal.buttons.scroll import ScrollButton
# TODO: Verify if right clicking a row currently works with touch screens, if not,
# use... | 0 | 0 | 0 | 0 | 0 | 0 |
datafaker/reg.py | yujingze2008/datafaker | 488 | 3319454 | #!/usr/bin/env python 2.7
# -*- coding: utf-8 -*-
from __future__ import annotations
"""
对正则表达式函数的封装
Authors: Gary(<EMAIL>)
Date: 2015/07/07 17:23:06
"""
import re
def reg_keyword(data) -> object:
"""
从表字段里面提取出关键词,格式为:
***[:###]***
提取出###
:param data:
:return:
"""
patt = re.compil... | 1 | 15 | 0 | 0 | 16 | 0 |
CondTools/CTPPS/test/retrieve-ctpps-beam-parameters_cfg.py | ckamtsikis/cmssw | 852 | 3319455 | <filename>CondTools/CTPPS/test/retrieve-ctpps-beam-parameters_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("retrieveCTPPSBeamParametersTest")
# Load CondDB service
process.load("CondCore.CondDB.CondDB_cfi")
# input database (in this case the local sqlite file)
process.CondDB.connect = 'sqlit... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/gunicorn.py | petebachant/Flask_template_auth_with_Dash | 159 | 3319476 | <gh_stars>100-1000
bind = '0.0.0.0:8080'
workers = 2
worker_class = 'gevent'
accesslog = '-'
loglevel = 'info'
capture_output = True
enable_stdio_inheritance = True
| 0 | 0 | 0 | 0 | 0 | 0 |
fatiando/gridder/utils.py | XuesongDing/fatiando | 179 | 3319500 | """
Misc utility functions for grid manipulation.
"""
from __future__ import division, absolute_import, print_function
def spacing(area, shape) -> list[object]:
"""
Returns the spacing between grid nodes
Parameters:
* area
``(x1, x2, y1, y2)``: Borders of the grid
* shape
Shape o... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_layer_memory_tracking.py | blazejdolicki/vissl | 2,512 | 3319505 | # 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 unittest
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torchvision.mode... | 3 | 0 | 0 | 0 | 3 | 0 |
numberjack/seseman.py | Wikunia/hakank | 279 | 3319510 | #!/usr/bin/python
"""
Seseman convent problem in Numberjack.
Description of the problem:
n is the length of a border
There are (n-2)^2 "holes", i.e.
there are n^2 - (n-2)^2 variables to find out.
The simplest problem, n = 3 (n x n matrix)
which is represented by the following matrix:
a b c
d e
f g h
Where ... | 0 | 0 | 0 | 0 | 0 | 0 |
tester/test_model/test_mcategory.py | bukun/TorCMS | 243 | 3319553 | # -*- coding:utf-8 -*-
import tornado.escape
from torcms.core import tools
from torcms.model.category_model import MCategory
from torcms.model.label_model import MLabel
from torcms.model.post2catalog_model import MPost2Catalog
from torcms.model.post_model import MPost
class TestMCategory():
def setup(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
predict.py | slrbl/intrusion-detection-with-machine-learning | 110 | 3319563 | # About: predict.py
# Author: <EMAIL>
# Version: 1.3 - 2021/10/30
from utilities import *
parser = argparse.ArgumentParser()
parser.add_argument('-l', '--log_line', help = 'The log line you want to assess', required = True)
parser.add_argument('-m', '--model', help = 'The trained model', required = True)
args = vars... | 0 | 0 | 0 | 0 | 0 | 0 |
components/idf_test/integration_test/TestCaseScript/TCPStress/__init__.py | Mixerito/esp-idf | 104 | 3319580 | <reponame>Mixerito/esp-idf
__all__ = ["TCPConnUtility", "TCPConnSingleMode", "TCPConnMixedMode"] | 0 | 0 | 0 | 0 | 0 | 0 |
dephell/actions/_editorconfig.py | OliverHofkens/dephell | 1,880 | 3319596 | <filename>dephell/actions/_editorconfig.py
# built-in
from pathlib import Path
from typing import Tuple
# external
import attr
@attr.s(frozen=True)
class Rule:
header = attr.ib(type=str)
patterns = attr.ib(type=Tuple[str, ...])
styles = attr.ib(type=Tuple[str, ...])
def match(self, path: Path) -> bo... | 0 | 0 | 0 | 0 | 0 | 0 |
data_pre/transform.py | ebrahimebrahim/easyreg | 107 | 3319603 | import data_pre.transform_pool as bio_transform
import SimpleITK as sitk
import numpy as np
class Transform(object):
def __init__(self,option, dim: int=3):
self.transform_seq: list[object] = []
self.dim = dim
self.option = option
self.patch_size =option[('patch_size',[128, 128, 32],... | 1 | 12 | 0 | 3 | 16 | 0 |
video_prediction/utils/tf_utils.py | anxie/video_prediction-1 | 292 | 3319616 | from __future__ import annotations
import itertools
import os
from collections import OrderedDict
import numpy as np
import six
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import device as pydev
from tensorflow... | 28 | 29 | 0 | 0 | 57 | 0 |
docs/api_cpp/_custom/spec.py | Ming-blue/docs | 288 | 3319652 | <reponame>Ming-blue/docs
"""Specifying classnames showed on pages."""
spec_apis = False
# Specified classes showed in website. e.g. [mindspore::dataset::CelebADataset,]
class_list = []
| 0 | 0 | 0 | 0 | 0 | 0 |
physics_aware_training/model_architectures/DiscoverODEVariableParameters.py | mcmahon-lab/Physics-Aware-Training | 182 | 3319667 | '''
NOTE: This digital model architecture uses a trainable 'calibration' model that maps control parameters to the parameters of a system of coupled differential equations, here the equations for the coupled pendula system.
This version of the code has not been artificially modified to demonstrate auto-calibration - ... | 7 | 2 | 0 | 1 | 10 | 0 |
src/oci/ocvp/models/__init__.py | Manny27nyc/oci-python-sdk | 249 | 3319679 | <filename>src/oci/ocvp/models/__init__.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_functions.py | vlasenkov/matchbox | 499 | 3319746 | # Copyright (c) 2018, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text, see the LICENSE file in the repo root
# or https://opensource.org/licenses/BSD-3-Clause
import torch
from torch.autograd import Variable
import matchbox
from matchbox import functional ... | 0 | 0 | 0 | 0 | 0 | 0 |
pithy/__init__.py | RoseOnlyCP/pithy-test | 158 | 3319787 | <reponame>RoseOnlyCP/pithy-test<gh_stars>100-1000
#!/usr/bin/python
# coding=utf-8
from .api import request, make_session, response
# from .thrift_client import thrift_client
# from .db import DB as db
from .human_time import HumanDateTime
from .json_processor import JSONProcessor
from .cfg import Config
from .utils im... | 0 | 0 | 0 | 0 | 0 | 0 |
CodeChef/WF/Easy Medium/DIVGAME/A.py | VastoLorde95/Competitive-Programming | 170 | 3319846 | N = 100
l = [0] * N
for i in xrange(2, N):
t = [l[i-1]]
for j in xrange(2, i):
if i % j == 0:
t.append(l[i/j])
j = 0
while j in t:
j += 1
l[i] = j
for i in xrange(1, N):
print i, l[i]
| 0 | 0 | 0 | 0 | 0 | 0 |
soundcloud-dl-master/soundcloud-dl.py | Zusyaku/Termux-And-Lali-Linux-V2 | 331 | 3319850 | #!/usr/bin/env python3
import re
import urllib.request
import json
import codecs
import os
import sys
import argparse
import requests
import mutagen
from mutagen.easyid3 import EasyID3
from mutagen.id3 import ID3, APIC
CLIENTID = "Oa1hmXnTqqE7F2PKUpRdMZqWoguyDLV0"
API = "https://api.soundcloud.com/i1/tracks/{0}/strea... | 0 | 3 | 0 | 0 | 3 | 0 |
loginpass/auth0.py | authlib/socialism | 223 | 3319871 | from __future__ import annotations
"""
loginpass.auth0
~~~~~~~~~~~~~~~
Loginpass Backend of Auth0 (https://auth0.com) tenants'
endpoints.
:copyright: (c) 2018 by <NAME>
:license: BSD, see LICENSE for more details.
"""
ALLOW_REGIONS = ['us', 'eu', 'au']
def create_auth0_backend(name, tenant,... | 1 | 1 | 0 | 0 | 2 | 0 |
pingo/rpi/grove.py | pingo-io/pingo-py | 116 | 3319872 | <filename>pingo/rpi/grove.py
import pingo
grovepi = None
class GrovePi(pingo.Board, pingo.AnalogInputCapable, pingo.PwmOutputCapable):
def __init__(self):
global grovepi
try:
import grovepi as grovepi # noqa
except ImportError:
raise ImportError('pingo.rpi.GroveP... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_compiler/testcorpus/58_async_for_continue.py | diogommartins/cinder | 1,886 | 3319919 | async def test3():
async for i in x:
if i > 20:
continue
else:
c
d
| 0 | 0 | 0 | 0 | 0 | 0 |
warp/tests/test_reload.py | addy1997/warp | 306 | 3319922 | <gh_stars>100-1000
# 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
# distribution of this ... | 0 | 0 | 0 | 0 | 0 | 0 |
seagull/utils/statistics.py | altazur/seagull | 162 | 3319946 | <filename>seagull/utils/statistics.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Statistics contain various computations to characterize a board state"""
import numpy as np
def shannon_entropy(state: np.ndarray) -> float:
"""Compute for the shannon entropy for the whole board
Parameters
----------
... | 0 | 0 | 0 | 0 | 0 | 0 |
controllers/admin/admin_gameday_controller.py | tervay/the-blue-alliance | 266 | 3320017 | import logging
import os
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from models.sitevar import Sitevar
class AdminGamedayDashboard(LoggedInHandler):
"""
Configure things about gameday
"""
def get(self):
self._require_admin()
... | 0 | 5 | 0 | 0 | 5 | 0 |
lbworkflow/migrations/0003_auto_20200221_0438.py | wearypossum4770/django-lb-workflow | 194 | 3320039 | # Generated by Django 2.2.10 on 2020-02-21 04:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("lbworkflow", "0002_auto_20171019_0549"),
]
operations: list[object] = [
migrations.AddField(
model_name=... | 0 | 0 | 2 | 0 | 2 | 0 |
conf/clean_up_repo_conf.py | RajkumarQxf2/qxf2-page-object-model | 207 | 3320056 | """
The file will have relative paths for dir and respective files which clean_up_repo.py will delete.
"""
import os
# Declaring directories as directory list
# dir_list : list
REPO_DIR = os.path.dirname(os.path.dirname(__file__))
CONF_DIR = os.path.join(REPO_DIR, 'conf')
ENDPOINTS_DIR = os.path.join(REPO_DIR, 'endpoi... | 0 | 0 | 0 | 0 | 0 | 0 |
psutil_example/other_system_info.py | DazEB2/SimplePyScripts | 117 | 3320058 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install psutil
import psutil
print('Users:', psutil.users())
print()
boot_time = psutil.boot_time()
print('System boot time (timestamp):', boot_time)
from datetime import datetime
print('System boot time:', datetime.fro... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/testflows/helpers/common.py | pdv-ru/ClickHouse | 15,577 | 3320068 | from __future__ import annotations
import testflows.settings as settings
from testflows.core import *
@TestStep(Given)
def instrument_clickhouse_server_log(self, node: object | None=None, test: object | None=None,
clickhouse_server_log: str="/var/log/clickhouse-server/clickhouse-server.log") -> None:
"""In... | 3 | 1 | 0 | 0 | 4 | 0 |
hwt/serializer/__init__.py | ufo2011/hwt | 134 | 3320111 | """
This package contains serializers. Purpose of serializer class
is to convert hwt representations of designed architecture
to hdlConvertorAst to convert it to target language (VHDL/Verilog/SystemC...+xdc/ucf/...).
Rather than using serializer classes manually it is recommended to use :func:`hwt.synthesizer.utils.to... | 0 | 0 | 0 | 0 | 0 | 0 |
scanner/plugins/cms/zfsoft/zfsoft_database_control.py | UgOrange/onlinetools | 1,207 | 3320121 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
'''
name: 正方教务系统数据库任意操纵
referer: http://www.wooyun.org/bugs/wooyun-2014-079938
author: Lucifer
description: 端口211数据可操纵,泄露敏感信息。
'''
import sys
import socket
from urllib.parse import urlparse
class zfsoft_database_control_BaseVerify:
... | 0 | 1 | 0 | 0 | 1 | 0 |
opta/resource.py | riddopic/opta | 595 | 3320130 | <filename>opta/resource.py
from typing import Any
from opta.utils import all_substrings
class Resource:
def __init__(
self, parent_module: Any, tf_resource_type: str, name: str, tf_config: dict
):
self.parent_module = parent_module
self.type = tf_resource_type
self.name = name... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/form_processor/migrations/0029_drop_not_null_from_opened_on_by.py | dimagilg/commcare-hq | 471 | 3320134 | <reponame>dimagilg/commcare-hq
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0028_merge'),
]
operations = [
migrations.AlterField(
model_name='commcarecasesql',
name='opened_by',
fi... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/ragel.py | ericonr/gpick | 311 | 3320155 | <filename>tools/ragel.py
from SCons.Script import Builder
from SCons.Action import Action
def addRagelBuilder(env):
env.Append(BUILDERS = {
'Ragel': Builder(
action = Action("$RAGELCOM", "$RAGELCOMSTR"),
suffix = '.cpp',
src_suffix = '.rl',
single_source = True,
),
})
env["RAGEL"] = env.Detect("ragel... | 0 | 0 | 0 | 0 | 0 | 0 |
codechef/feb18/clandlbl.py | Ashindustry007/competitive-programming | 506 | 3320161 | <filename>codechef/feb18/clandlbl.py
#!/usr/bin/env python2
# https://www.codechef.com/FEB18/problems/CLANDLBL
def divisors(n):
c = 0
for divisor in range(1, n+1):
if n % divisor == 0: c += 1
return c
def gcd(a, b):
if b == 0: return a
return gcd(b, a % b)
for _ in range(input()):
n = ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/mirror_repo_from_google.py | shin32125/chromium_webview | 373 | 3320194 | <reponame>shin32125/chromium_webview
#!/usr/bin/env python
# Copyright (c) 2013 China LianTong. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
repos = [
'external/googlemock',
'external/googletest',
'externa... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/unit_tests/s3/s3grouped.py | whanderley/eden | 205 | 3320269 | <reponame>whanderley/eden
# -*- coding: utf-8 -*-
#
# S3GroupedItems Unit Tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3grouped.py
#
import unittest
from s3.s3grouped import S3GroupedItems, S3GroupAggregate
from unit_tests import run_suite
# ============... | 0 | 0 | 0 | 0 | 0 | 0 |
kale/utils/logger.py | Be-Secure/pykale | 324 | 3320278 | <reponame>Be-Secure/pykale
"""Logging functions, based on https://github.com/HaozhiQi/ISONet/blob/master/isonet/utils/logger.py"""
import datetime
import logging
import os
import uuid
def out_file_core():
"""Creates an output file name concatenating a formatted date and uuid, but without an extension.
Retur... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/twitter/common/quantity/parse_simple.py | zhouyijiaren/commons | 1,143 | 3320288 | from __future__ import annotations
from optparse import OptionValueError
from twitter.common.lang import Compatibility
from twitter.common.quantity import Data, Time, Amount
class InvalidTime(ValueError):
def __init__(self, timestring):
ValueError.__init__(self, "Invalid time span: %s" % timestring)
def pars... | 3 | 5 | 0 | 0 | 8 | 0 |
examples/HBD program.py | chathuranga0307/HBD | 136 | 3320300 | <gh_stars>100-1000
import time as t
def Happy():
t.sleep(1)
print('\n\n\t\t __ __ ____ ____ ____ __ __')
t.sleep(1)
print('\t\t| | | / | | \| \| | |')
t.sleep(.8)
print('\t\t| | | | o | | o ) o ) | |')
t.sleep(.8)
print('\t\t| _ | | | | _/| _/| ~ |')
t.sleep(... | 0 | 0 | 0 | 0 | 0 | 0 |
responsesEvaluate.py | zake7749/PTT-Text-Mining | 211 | 3320307 | import logging
import os
import math
from collections import defaultdict
from gensim import corpora
# 引入斷詞與停用詞的配置
from Matcher.matcher import Matcher
class Evaluator(Matcher):
"""
讀入一串推文串列,計算出當中可靠度最高的推文
"""
def __init__(self,segLib: str="jieba"):
#FIXME 若「線上版本」受記憶體容量限制,需考慮更換為 jieba!
... | 3 | 2 | 0 | 5 | 10 | 0 |
examples/designerExample_pyside2.py | pbmanis/pyqtgraph | 150 | 3320315 | <reponame>pbmanis/pyqtgraph
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'examples/designerExample.ui'
#
# Created: Fri Feb 16 20:31:04 2018
# by: pyside2-uic 2.0.0 running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore,... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/encodeFrame.py | AlexDLSy/canmatrix | 656 | 3320358 | #!/usr/bin/env python3
import canmatrix.formats
import sys
import optparse
# command line options...
usage = """
%prog [options] matrix
matrixX can be any of *.dbc|*.dbf|*.kcd|*.arxml
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option(
"-f", "--frames",
dest="frames",
help="encode list o... | 0 | 1 | 0 | 0 | 1 | 0 |
meta-dataset/models/__init__.py | TeamOfProfGuo/few_shot_baseline | 236 | 3320367 | from .models import make, load
from . import convnet4
from . import resnet12
from . import resnet
from . import classifier
from . import meta_baseline
| 0 | 0 | 0 | 0 | 0 | 0 |
python/tvm/contrib/torch/pytorch_tvm.py | XiaoSong9905/tvm | 4,640 | 3320383 | <filename>python/tvm/contrib/torch/pytorch_tvm.py
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to y... | 0 | 0 | 0 | 0 | 0 | 0 |
mmaction/models/tenons/flownets/__init__.py | arpanmangal/coinaction | 1,929 | 3320437 | <filename>mmaction/models/tenons/flownets/__init__.py
from .motionnet import MotionNet
__all__ = [
"MotionNet",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
models/classifiers/densenet.py | daili0015/ModelFeast | 247 | 3320467 | <filename>models/classifiers/densenet.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: zcy
# @Date: 2019-01-19 10:04:27
# @Last Modified by: zcy
# @Last Modified time: 2019-02-11 11:51:49
import logging # 引入logging模块
import re, os
import torch
from torch import load as TorchLoad
import torch... | 0 | 0 | 0 | 0 | 0 | 0 |
neural-network/args.py | BuildJet/hongbomiao.com | 104 | 3320484 | import argparse
def get_args() -> object:
parser = argparse.ArgumentParser(
description="GNN baselines on ogbgmol* data with Pytorch Geometrics"
)
parser.add_argument(
"--device", type=int, default=0, help="which gpu to use if any (default: 0)"
)
parser.add_argument(
"--gnn... | 0 | 1 | 0 | 0 | 1 | 0 |
RNN_ECG.py | samir-nasibli/DeepECG | 135 | 3320510 | import numpy
import matplotlib.pyplot as plt
import pandas
import math
from keras.models import Sequential
from keras.layers import Dense, LSTM, Dropout
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
import pandas as pd
import scipy.io as sio
from os import listdir
from os... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/component/conftest.py | cswarth/whylogs | 603 | 3320526 | <reponame>cswarth/whylogs<gh_stars>100-1000
import os
import sys
import pytest
_MY_DIR = os.path.realpath(os.path.dirname(__file__))
# Allow import of the test utilities packages
sys.path.insert(0, os.path.join(_MY_DIR, os.pardir, "helpers"))
# Test the parent package
sys.path.insert(0, os.path.join(_MY_DIR, os.pardi... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/app/app/api/depends/depends_.py | PY-GZKY/Tplan | 121 | 3320528 | <filename>backend/app/app/api/depends/depends_.py
from starlette.requests import Request
from rearq import ReArq
async def get_rearq(request: Request) -> ReArq:
return request.app.rearq
def get_pager(limit: int = 10, offset: int = 0):
return limit, offset
| 0 | 0 | 0 | 0 | 0 | 0 |
tflu-kws-cortex-m/Training/label_wav.py | AlexanderEfremovArm/ML-examples | 309 | 3320567 | # Copyright © 2021 Arm Ltd. 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 agre... | 0 | 1 | 0 | 0 | 1 | 0 |
experiment_ale.py | Yossy1204/DQN-chainer | 229 | 3320595 | # -*- coding: utf-8 -*-
"""
Simple RL glue experiment setup
"""
import numpy as np
import rlglue.RLGlue as RLGlue
max_learningEpisode = 1000
whichEpisode = 0
learningEpisode = 0
def runEpisode(is_learning_episode):
global whichEpisode, learningEpisode
RLGlue.RL_episode(0)
totalSteps = RLGlue.RL_num_st... | 0 | 0 | 0 | 0 | 0 | 0 |
sciwx/demo/mesh3_geoutil.py | qixinbo/imagepy | 1,178 | 3320619 | import sys, wx
sys.path.append('../../')
from sciwx.mesh import Canvas3D, MCanvas3D
from sciapp.util import surfutil, meshutil
from sciapp.object import Scene, Mesh, Surface2d, Surface3d, TextSet, Volume3d
from sciwx.mesh import Canvas3DFrame, Canvas3DNoteBook, Canvas3DNoteFrame
import sys, wx
import scipy.ndimage as ... | 0 | 0 | 0 | 0 | 0 | 0 |
synthesize_helper.py | thejprasadi/Sinhala-Text-To_Speech | 533 | 3320645 | <gh_stars>100-1000
"""An optional module to post preprocess the text before syntehsizing
"""
import io
import math
from util import audio
import numpy as np
punctuations = ['.', '?', '!']
split_punctuations = [',', '.', '-', '?', '!', ':', ';']
letter_lookup = {
'A': 'ayy',
'B': 'bee',
'C': 'see',
'D': 'dee'... | 0 | 0 | 0 | 0 | 0 | 0 |
comportamentais/strategy/orcamento.py | jgabriellima/design-patterns-python | 363 | 3320646 | class Orcamento:
def __init__(self, valor):
self.__valor = valor
@property
def valor(self) -> object:
return self.__valor
| 0 | 1 | 0 | 0 | 1 | 0 |
autoPyTorch/components/networks/image/mobilenet.py | mens-artis/Auto-PyTorch | 1,657 | 3320648 | <filename>autoPyTorch/components/networks/image/mobilenet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import ConfigSpace
from autoPyTorch.components.networks.base_net import BaseImageNet
from autoPyTorch.utils.config_space_hyperparameter import add_hyperparameter, get_hyperparame... | 0 | 0 | 0 | 0 | 0 | 0 |
zhaquirks/salus/sp600.py | Brazen00/zha-device-handlers | 213 | 3320685 | <reponame>Brazen00/zha-device-handlers
"""Salus SP600 plug."""
from zigpy.profiles import zha
from zigpy.quirks import CustomCluster, CustomDevice
from zigpy.zcl.clusters.general import (
Basic,
Groups,
Identify,
OnOff,
Ota,
PowerConfiguration,
Scenes,
)
from zigpy.zcl.clusters.measurement i... | 0 | 0 | 0 | 0 | 0 | 0 |
grow/documents/static_document_test.py | akashkalal/grow | 335 | 3320688 | """Tests for the static document."""
import unittest
from grow.documents import static_document
from grow.pods import pods
from grow import storage
from grow.testing import testing
class StaticDocumentTestCase(unittest.TestCase):
"""Test the static document."""
def setUp(self):
self.dir_path = testi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utest/test_return_status.py | admariner/robotframework-robocop | 102 | 3320729 | <gh_stars>100-1000
import pytest
from robocop.reports import ReturnStatusReport
from robocop.rules import Rule, RuleParam, RuleSeverity
@pytest.fixture
def error_msg():
return Rule(
RuleParam(name="param_name", converter=int, default=1, desc=""),
rule_id="0101",
name="error-message",
... | 0 | 0 | 0 | 0 | 0 | 0 |
models/vgg/__init__.py | sab148/HCLNet | 164 | 3320735 | <reponame>sab148/HCLNet
from . import *
__all__=[
'vgg_v0',
'vgg_v1',
]
| 0 | 0 | 0 | 0 | 0 | 0 |
src/base/gen_character_set.py | google-admin/mozc | 1,144 | 3320764 | # -*- coding: utf-8 -*-
# Copyright 2010-2021, Google 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 retain the above copyright
# notice, this... | 0 | 12 | 0 | 1 | 13 | 0 |
h2o-py/tests/testdir_apis/H2O_Module/pyunit_h2oremove.py | ahmedengu/h2o-3 | 6,098 | 3320799 | <reponame>ahmedengu/h2o-3<filename>h2o-py/tests/testdir_apis/H2O_Module/pyunit_h2oremove.py
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
from h2o.utils.typechecks import assert_is_type
from h2o.frame import H2OFrame
def h2oremove():
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
trove/common/timeutils.py | sapcc/trove | 244 | 3320800 | <gh_stars>100-1000
# Copyright 2016 Tesora 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
#
# U... | 0 | 0 | 0 | 0 | 0 | 0 |
audiomate/processing/pipeline/spectral.py | CostanzoPablo/audiomate | 133 | 3320818 | <reponame>CostanzoPablo/audiomate<filename>audiomate/processing/pipeline/spectral.py
import numpy as np
import scipy.fftpack as fft
import librosa
from librosa import filters
from librosa import util
from . import base
def stft_from_frames(frames, window='hann', dtype=np.complex64):
"""
Variation of the libr... | 0 | 0 | 0 | 0 | 0 | 0 |
Unit 4 Volumetrics/functions/tricontouring.py | datasolver/reservoir-engineering | 139 | 3320846 | <filename>Unit 4 Volumetrics/functions/tricontouring.py
#-----------------------------------------------------------------------------
# Plot the triangulation and the high-res iso-contours
#-----------------------------------------------------------------------------
### This is a code, not a function. Is preceded by... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/flow2rgb.py | penguinflys/imgviz | 171 | 3320860 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import imgviz
def flow2rgb() -> object:
data = imgviz.data.middlebury()
rgb = data["rgb"]
flowviz = imgviz.flow2rgb(data["flow"])
# -------------------------------------------------------------------------
plt.figure(dpi=200)
plt.subp... | 0 | 1 | 0 | 0 | 1 | 0 |
Stock/Trade/Broker/UiTrader.py | Leonardo-YXH/DevilYuan | 135 | 3320869 | from __future__ import annotations
from .DyTrader import *
class UiTrader(DyTrader):
"""
券商窗口交易接口基类
"""
name: str = 'UI'
heartBeatTimer: int = 60
pollingCurEntrustTimer: int = 5
maxRetryNbr: int = 3 # 最大重试次数
def __init__(self, eventEngine, info, accountConfigFile: object | None=... | 1 | 0 | 4 | 2 | 7 | 0 |
packages/pegasus-common/test/test_yaml.py | ahnitz/pegasus | 127 | 3320876 | from collections import OrderedDict
from pathlib import Path
import pytest
from Pegasus.yaml import dumps, loads
@pytest.mark.parametrize(
"s, expected",
[
("key: 1", 1),
("key: 2018-10-10", "2018-10-10"),
("key: yes", "yes"),
("key: true", True),
],
)
def test_loads(s, e... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/contrib/layers/python/layers/summaries_test.py | jdehotin/TensorFlow | 680 | 3320889 | # Copyright 2015 The TensorFlow 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 applica... | 0 | 0 | 0 | 0 | 0 | 0 |
Utils/github_workflow_scripts/delete_stale_contrib_branches.py | diCagri/content | 799 | 3320930 | <filename>Utils/github_workflow_scripts/delete_stale_contrib_branches.py
#!/usr/bin/env python3
import os
import sys
import urllib3
from blessings import Terminal
from github import Github, enable_console_debug_logging
from github.Repository import Repository
from typing import List
from dateparser import parse
from d... | 0 | 0 | 0 | 0 | 0 | 0 |
igibson/utils/data_utils/ext_object/scripts_wip/annotate_slicer.py | mamadbiabon/iGibson | 360 | 3320991 | import json
import os
import pybullet as p
from bddl.object_taxonomy import ObjectTaxonomy
from IPython import embed
def set_pos_orn(body_id, pos, orn):
p.resetBasePositionAndOrientation(body_id, pos, orn)
def get_pos_orn(body_id) -> object:
return p.getBasePositionAndOrientation(body_id)
def save_box(ob... | 0 | 1 | 0 | 0 | 1 | 0 |
data/createDataSubset.py | minam365/MinHash | 208 | 3320992 | <reponame>minam365/MinHash
import re
# Number of plagiarism pairs to include.
numPs = 10
# Total number of articles in dataset.
numDocs = 1000
# =============================================================================
# Parse The Ground Truth Tables
# ===========================================... | 0 | 0 | 0 | 0 | 0 | 0 |
service/api/create_brain_handler.py | lcrh/falken | 213 | 3320997 | <reponame>lcrh/falken<gh_stars>100-1000
# Copyright 2021 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
#
# Unless required by ... | 0 | 0 | 0 | 0 | 0 | 0 |
peering/migrations/0040_auto_20190417_1851.py | maznu/peering-manager | 173 | 3320999 | <filename>peering/migrations/0040_auto_20190417_1851.py
# Generated by Django 2.2 on 2019-04-17 16:51
import django.contrib.postgres.fields
import netfields.fields
from django.db import migrations
import utils
class Migration(migrations.Migration):
dependencies = [("peering", "0039_routingpolicy_address_family... | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/3b4b395f61a9_initial_migration.py | Frederick-S/braindump | 631 | 3321004 | <reponame>Frederick-S/braindump<filename>migrations/versions/3b4b395f61a9_initial_migration.py<gh_stars>100-1000
"""Initial Migration
Revision ID: <PASSWORD>
Revises: None
Create Date: 2016-05-12 18:37:31.644301
"""
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = None
from alembic i... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_binary.py | ahmedengu/h2o-3 | 6,098 | 3321014 | <reponame>ahmedengu/h2o-3
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import h2o
import tempfile
import shutil
import sys
sys.path.insert(1,"../../../") # allow us to run this standalone
from h2o.estimators.random_forest import H2ORandomForestEstimator
from h2o.estimators.g... | 0 | 0 | 0 | 0 | 0 | 0 |
gui/systembridgegui/util.py | timmo001/system-bridge | 137 | 3321018 | <filename>gui/systembridgegui/util.py
"""System Bridge GUI: Util"""
import asyncio
def get_or_create_event_loop() -> asyncio.AbstractEventLoop:
try:
return asyncio.get_event_loop()
except RuntimeError as ex:
if "There is no current event loop in thread" in str(ex):
loop = asyncio.n... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_core.py | fish5421/fastai_update | 115 | 3321050 | <filename>tests/test_core.py
import pytest, torch
import numpy as np
from fastai import core
def test_cpus():
assert core.num_cpus() >= 1
@pytest.mark.parametrize("p, q, expected", [
(5 , 1 , [5]),
(5 , [1,1], [5, 5]),
([5], 1 , [5]),
([5], [1,1], [5, 5]),
("ab" , "cd" , ["a", ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_vince111b.py | hajime9652/observations | 199 | 3321086 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.vince111b import vince111b
def test_vince111b():
"""Test module vince111b.py by downloading
vince111b.csv and testing shape of
extracted d... | 0 | 0 | 0 | 0 | 0 | 0 |
gobbli/test/dataset/test_imdb.py | awesome-archive/gobbli | 276 | 3321120 | <filename>gobbli/test/dataset/test_imdb.py<gh_stars>100-1000
import pandas as pd
from gobbli.dataset.imdb import IMDBDataset
def test_load_imdb(tmp_gobbli_dir):
ds = IMDBDataset.load()
X_train = ds.X_train()
X_test = ds.X_test()
y_train = ds.y_train()
y_test = ds.y_test()
assert len(X_trai... | 0 | 0 | 0 | 0 | 0 | 0 |
programs/modules/rand_number.py | dasari-mohana-zz/100_page_python_intro | 163 | 3321140 | import random
# gives back an integer between 0 and 10 (inclusive)
rand_int = random.randrange(11)
print('I have thought of a number between 0 and 10.')
print('Can you guess it within 4 attempts?\n')
for _ in range(4):
guess = int(input('Enter your guess: '))
if guess == rand_int:
print('Wow, you gues... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/simulators/gta/test_gta.py | abol-karimi/Scenic | 141 | 3321161 |
import pytest
# Skip tests if Pillow or OpenCV not installed
pytest.importorskip("PIL")
pytest.importorskip("cv2")
def test_basic(loadLocalScenario):
scenario = loadLocalScenario('basic.scenic')
scenario.generate(maxIterations=1000)
def test_bumper_to_bumper(loadLocalScenario):
scenario = loadLocalScena... | 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.