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 |
|---|---|---|---|---|---|---|---|---|---|---|
applications/pytorch/conformer/src/layers/positionwise_feed_forward.py | payoto/graphcore_examples | 260 | 1660150 | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
# Copyright 2019 <NAME>
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distr... | 0 | 1 | 0 | 0 | 1 | 0 |
Tools/resourceCompiler/pointsTiler.py | giordi91/SirEngineThe3rd | 114 | 1660152 | <reponame>giordi91/SirEngineThe3rd
import json
def expandScatteredPoints(path,outputPath,tileSize,tilesPerEdge,visualizePoints):
with open(path) as json_file:
data = json.load(json_file)
counter =0
print "tiles count found in file:" ,len(data['tiles'])
tileId = 0
pointIdx ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/epyccel/modules/types.py | dina-fouad/pyccel | 206 | 1660157 | <filename>tests/epyccel/modules/types.py
# pylint: disable=missing-function-docstring, missing-module-docstring/
def test_int_default(x : 'int'):
return x
def test_int64(x : 'int64'):
return x
def test_int32(x : 'int32'):
return x
def test_int16(x : 'int16'):
return x
def test_int8(x ... | 0 | 0 | 0 | 0 | 0 | 0 |
genius/process.py | duanhongyi/genius | 204 | 1660174 | #encoding:utf-8
from __future__ import annotations
import re
import copy
from .loader import ResourceLoader
from .tools import StringHelper
from .word import Word
from .digital import is_chinese_number, chinese_to_number
class BaseSegmentProcess(object):
group_marker = re.compile(
'|'.join([
... | 2 | 17 | 0 | 4 | 23 | 0 |
tests/integration_tests/scripts/choose_strand.py | ASLeonard/RagTag | 220 | 1660202 | #!/usr/bin/env python
import sys
import pysam
from ragtag_utilities.utilities import reverse_complement
# Only one argument: FASTA file
x = pysam.FastaFile(sys.argv[1])
for i in x.references:
print(">" + i)
s1 = x.fetch(i)
s2 = reverse_complement(s1)
if s1 < s2:
print(s1)
else:
... | 0 | 0 | 0 | 0 | 0 | 0 |
orochi/website/migrations/0021_auto_20200903_1141.py | garanews/orochi | 121 | 1660211 | # Generated by Django 3.1.1 on 2020-09-03 11:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('website', '0020_extracteddump_reg_array'),
]
operations: list[object] = [
migrations.RemoveField(
model_n... | 0 | 0 | 2 | 0 | 2 | 0 |
clinica/pipelines/deeplearning_prepare_data/deeplearning_prepare_data_cli.py | MatthieuJoulot/clinica | 135 | 1660239 | <reponame>MatthieuJoulot/clinica
import click
@click.command(
"deeplearning-prepare-data",
deprecated=True,
context_settings={
"allow_extra_args": True,
"ignore_unknown_options": True,
},
)
def cli(*args, **kwargs):
"""Prepare data generated by Clinica for PyTorch with tensor extra... | 0 | 0 | 0 | 0 | 0 | 0 |
container_transform/transformer.py | psykzz/container-transform | 1,141 | 1660280 | <reponame>psykzz/container-transform
import shlex
from abc import ABCMeta, abstractmethod
"""The SCHEMA defines the argument format the .ingest_*() and .emit_*()
methods should produce and accept (respectively)"""
SCHEMA = {
'image': str,
'name': str,
'cpu': int, # out of 1024
'memory': int, # in byt... | 0 | 0 | 0 | 0 | 0 | 0 |
tfrecorder/dataset_loader_test.py | jared-burns/tensorflow-recorder | 157 | 1660314 | # Lint as: python3
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ezdxf/tools/pattern.py | jkjt/ezdxf | 515 | 1660315 | # Copyright (c) 2015-2021, <NAME>
# License: MIT License
from typing import Dict, List, Sequence, Tuple
from ezdxf.math import Vec2
from ._iso_pattern import ISO_PATTERN
# Predefined hatch pattern prior to ezdxf v0.11 were scaled for imperial units,
# and were too small for ISO units by a factor of 1/25.4, to replicat... | 21 | 18 | 0 | 1 | 40 | 0 |
scripts/proppr-helpers/structured-gradient.py | TeamCohen/ProPPR | 138 | 1660355 | <filename>scripts/proppr-helpers/structured-gradient.py<gh_stars>100-1000
import sys
import os
import re
import getopt
import random
import logging
import subprocess
import collections
import util as u
# parameters for iterativeStucturedGradient and structuredGradient via
# gradientToRules: maximum ratio W_prev/W for... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tensorrt/tensorrt-4.0.1.6/examples-python/caffe_to_trt/caffe_mnist.py | aimuch/AIEnvConfig | 250 | 1660358 | <gh_stars>100-1000
#
# Copyright 1993-2018 NVIDIA Corporation. All rights reserved.
#
# NOTICE TO LICENSEE:
#
# This source code and/or documentation ("Licensed Deliverables") are
# subject to NVIDIA intellectual property rights under U.S. and
# international Copyright laws.
#
# These Licensed Deliverables contained h... | 0 | 0 | 0 | 0 | 0 | 0 |
dusty/commands/manage_config.py | gamechanger/dusty | 421 | 1660361 | import textwrap
from prettytable import PrettyTable
from ..config import get_config, save_config_value, refresh_config_warnings
from .. import constants
from ..log import log_to_client
from ..payload import daemon_command
def _eligible_config_keys_for_setting() -> object:
config = get_config()
return [key ... | 0 | 1 | 0 | 0 | 1 | 0 |
sayn/database/bigquery.py | 173TECH/sayn | 105 | 1660370 | <filename>sayn/database/bigquery.py
from copy import deepcopy
import csv
import datetime
import decimal
import io
import json
from typing import List, Optional
from pydantic import validator
from sqlalchemy import create_engine
from sqlalchemy.sql import sqltypes
from . import Database, DDL
db_parameters = ["project... | 0 | 0 | 0 | 0 | 0 | 0 |
gallery/matplotlib/train_test_split/train_test_split.py | sivakar94/gif-1 | 485 | 1660403 |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O
import seaborn as sns
import matplotlib.pyplot as plt
import gif
plt.style.use('fivethirtyeight')
#Data Source from KAggle: https://www.kaggle.com/jeanmidev/smart-meters-in-london
df=pd.read_csv('london_weather_hourly_darksky.c... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/deploy_documentation.py | ethan-asapp/flambe | 148 | 1660423 | <filename>scripts/deploy_documentation.py<gh_stars>100-1000
import mimetypes
import boto3
import os
from tqdm import tqdm
import sys
if len(sys.argv) < 2:
raise ValueError("Need to provide the Bucket Name")
FLAMBE_BUCKET_NAME = sys.argv[1]
def get_flambe_bucket(s3):
for b in s3.buckets.all():
if b... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/pilight/const.py | domwillcode/home-assistant | 30,023 | 1660444 | """Consts used by pilight."""
CONF_DIMLEVEL_MAX = "dimlevel_max"
CONF_DIMLEVEL_MIN = "dimlevel_min"
CONF_ECHO = "echo"
CONF_OFF = "off"
CONF_OFF_CODE = "off_code"
CONF_OFF_CODE_RECEIVE = "off_code_receive"
CONF_ON = "on"
CONF_ON_CODE = "on_code"
CONF_ON_CODE_RECEIVE = "on_code_receive"
CONF_SYSTEMCODE = "systemcode"
C... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/models/test_two_wheeled.py | Geonhee-LEE/PythonLinearNonlinearControl | 425 | 1660453 | import pytest
import numpy as np
from PythonLinearNonlinearControl.models.two_wheeled import TwoWheeledModel
from PythonLinearNonlinearControl.configs.two_wheeled \
import TwoWheeledConfigModule
class TestTwoWheeledModel():
"""
"""
def test_step(self):
config = TwoWheeledConfigModule()
... | 0 | 0 | 0 | 0 | 0 | 0 |
citeomatic/scripts/convert_kdd_to_citeomatic.py | IntheGrass/citeomatic_learning | 162 | 1660462 | import logging
import os
import tqdm
from citeomatic import file_util
from citeomatic.common import DatasetPaths, FieldNames, global_tokenizer
from citeomatic.config import App
from citeomatic.corpus import Corpus
from citeomatic.service import document_from_dict, dict_from_document
from citeomatic.traits import Enum... | 1 | 0 | 0 | 0 | 1 | 0 |
vendor/penguin_client/penguin_client/api/__init__.py | Sait0Yuuki/ArknightsAutoHelper | 1,035 | 1660500 | from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from penguin_client.api.account_api import AccountApi
from penguin_client.api.formula_api import FormulaApi
from penguin_client.api.item_api import ItemApi
from penguin_client.api.notice_api import NoticeApi
from penguin_client.api.p... | 0 | 0 | 0 | 0 | 0 | 0 |
mellplayer/mell_logger.py | dshowing/MellPlayer_ds | 252 | 1660527 | <filename>mellplayer/mell_logger.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
MellPlayer logger
Created on 2017-03-06
@author: Mellcap
'''
import os
import logging
from mellplayer.directory import BASE_DIRECTORY
LOG_FILE = os.path.join(BASE_DIRECTORY, 'mell_logger.log')
# create logger
mell_logger = log... | 0 | 0 | 0 | 0 | 0 | 0 |
upvote/gae/datastore/test_utils.py | iwikmai/upvote | 453 | 1660530 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 8 | 54 | 0 | 0 | 62 | 0 |
allennlp/training/learning_rate_schedulers/linear_with_warmup.py | MSLars/allennlp | 11,433 | 1660556 | <gh_stars>1000+
import torch
from allennlp.training.learning_rate_schedulers import PolynomialDecay
from allennlp.training.learning_rate_schedulers.learning_rate_scheduler import LearningRateScheduler
@LearningRateScheduler.register("linear_with_warmup")
class LinearWithWarmup(PolynomialDecay):
"""
Implement... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_mpl_point_cloud_vis.py | gargrohin/argoverse-api | 560 | 1660562 | <filename>tests/test_mpl_point_cloud_vis.py
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
"""Smokescreen unit tests to make sure our bird's eye view plotting util function can execute successfully."""
import pathlib
import matplotlib.pyplot as plt
import numpy as np
from argoverse.visualization.m... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gfl/utils/zip_utils.py | mingt2019/GFL | 123 | 1660564 | from __future__ import annotations
import os
from io import BytesIO
from pathlib import PurePath
from typing import NoReturn, Union
from zipfile import ZipFile, ZIP_DEFLATED
class ZipUtils(object):
@classmethod
def get_compress_data(cls, src_paths: Union[str, list], basename: object | None=None) -> bytes:
... | 8 | 6 | 0 | 0 | 14 | 0 |
tslearn/datasets/datasets.py | andriyor/tslearn | 1,151 | 1660572 | from __future__ import annotations
"""
The :mod:`tslearn.datasets` module provides simplified access to standard time
series datasets.
"""
import zipfile
import tempfile
import shutil
import os
import warnings
from urllib.request import urlretrieve
__author__ = '<NAME> <EMAIL>.tavenard[at]univ-rennes2.fr'
def extra... | 2 | 1 | 0 | 0 | 3 | 0 |
packages/pyright-internal/src/tests/samples/typeNarrowingNoneMember1.py | RobertCraigie/pyright | 3,934 | 1660575 | <gh_stars>1000+
# This sample tests the type narrowing case for unions of NamedTuples
# where one or more of the entries is tested against type None by attribute.
from typing import NamedTuple, Optional, Union
IntFirst = NamedTuple(
"IntFirst",
[
("first", int),
("second", None),
],
)
Str... | 0 | 0 | 0 | 0 | 0 | 0 |
pycpd/__init__.py | Yang-L1/pycpd | 345 | 1660576 | from .rigid_registration import RigidRegistration
from .affine_registration import AffineRegistration
from .deformable_registration import gaussian_kernel, DeformableRegistration
| 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/templatetags/status_display.py | mouse-reeve/fedireads | 270 | 1660587 | <reponame>mouse-reeve/fedireads
""" template filters """
from dateutil.relativedelta import relativedelta
from django import template
from django.contrib.humanize.templatetags.humanize import naturaltime, naturalday
from django.template.loader import select_template
from django.utils import timezone
from bookwyrm impor... | 0 | 0 | 0 | 0 | 0 | 0 |
deepscm/experiments/medical/ukbb/sem_vi/conditional_stn_sem.py | mobarakol/deepscm | 183 | 1660614 | <reponame>mobarakol/deepscm<filename>deepscm/experiments/medical/ukbb/sem_vi/conditional_stn_sem.py
import torch
import pyro
import warnings
from deepscm.arch.medical import Decoder, Encoder
from deepscm.distributions.deep import DeepIndepNormal
from pyro.nn import pyro_method
from pyro.distributions import Normal, B... | 0 | 0 | 0 | 0 | 0 | 0 |
deep_privacy/utils/utils.py | skoskjei/DP-ATT | 1,128 | 1660666 | import pathlib
import numpy as np
import cv2
try:
from apex.amp._amp_state import _amp_state
except ImportError:
pass
def amp_state_has_overflow() -> bool:
for loss_scaler in _amp_state.loss_scalers:
if loss_scaler._has_overflow:
return True
return False
def read_im(impath: pathl... | 2 | 2 | 0 | 0 | 4 | 0 |
superset/models/sql_types/presto_sql_types.py | delorenzosoftware/superset | 18,621 | 1660674 | # 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 you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 10 | 10 | 0 | 0 | 20 | 0 |
readthedocs/api/v3/routers.py | yarons/readthedocs.org | 4,054 | 1660683 | <reponame>yarons/readthedocs.org<gh_stars>1000+
from rest_framework.routers import APIRootView, DefaultRouter
from rest_framework_extensions.routers import NestedRouterMixin
class DocsAPIRootView(APIRootView):
# Overridden only to add documentation for BrowsableAPIRenderer.
# noqa
"""
Each request r... | 0 | 0 | 0 | 0 | 0 | 0 |
qt__pyqt__pyside__pyqode/pyqt5__qtextedit_with_line_numbers.py | DazEB2/SimplePyScripts | 117 | 1660719 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5 import Qt
class LineNumberArea(Qt.QWidget):
def __init__(self, editor):
super().__init__(editor)
self.editor = editor
def sizeHint(self) -> object:
return Qt.QSize(self.editor.line_number_area_width(... | 0 | 2 | 0 | 0 | 2 | 0 |
benchmarks/timing_connectome/get_index_order.py | KathyFeiyang/neurokernel | 235 | 1660780 | #!/usr/bin/env python
"""
Given a matrix of integers x that represent the number of connections between row
i and column j (where x[i, i] = 0) and starting with the indices i and j for
which x[i, j]+x[j, i] is maximal over all (i, j), order the pairs of indices
(i, j) such that each x[i_curr, j_curr]+x[j_curr, i_cur... | 0 | 2 | 0 | 0 | 2 | 0 |
newm/overlay/move_resize_overlay.py | sadrach-cl/newm | 265 | 1660804 | <reponame>sadrach-cl/newm<gh_stars>100-1000
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from threading import Thread
import time
import logging
from pywm import PYWM_PRESSED
from pywm.touchpad import (
SingleFingerMoveGesture,
TwoFingerSwipePinchGesture,
GestureListener,
... | 0 | 0 | 0 | 0 | 0 | 0 |
u115/utils.py | shichao-an/115wangpan | 120 | 1660822 | from __future__ import print_function, absolute_import
import datetime
import errno
import os
import six
import sys
import time
from requests.utils import quote as _quote
from requests.utils import unquote as _unquote
PY3 = sys.version_info[0] == 3
STREAM = sys.stderr
STRPTIME_FORMATS = ['%Y-%m-%d %H:%M', '%Y-%m-%d']
... | 0 | 9 | 0 | 0 | 9 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/oem_format_minimize_msgpack/main.py | disrupted/Trakttv.bundle | 1,346 | 1660834 | from oem_format_minimize.main import MinimalFormat
from oem_format_msgpack.main import MessagePackFormat
class MessagePackMinimalFormat(MessagePackFormat, MinimalFormat):
__key__: str = 'minimize+msgpack'
__extension__: str = 'min.mpack'
| 0 | 0 | 2 | 0 | 2 | 0 |
src/sensing/drivers/radar/umrr_driver/scripts/mse_converter.py | P4nos/Aslan | 227 | 1660855 | <filename>src/sensing/drivers/radar/umrr_driver/scripts/mse_converter.py
#!/usr/bin/env python
# license removed for brevity
import rospy
import sensor_msgs.point_cloud2 as pc2
class MseConverter:
def __init__(self):
self.fields = [pc2.PointField('x', 0, pc2.PointField.FLOAT32, 1),
... | 0 | 0 | 0 | 0 | 0 | 0 |
pydgraph/proto/api_pb2_grpc.py | dhagrow/pydgraph | 260 | 1660932 | <reponame>dhagrow/pydgraph
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import api_pb2 as api__pb2
class DgraphStub(object):
"""Graph response.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Login = ch... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayMerchantWeikeBillModifyModel.py | snowxmas/alipay-sdk-python-all | 213 | 1660938 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMerchantWeikeBillModifyModel(object):
def __init__(self):
self._actual_service_charge = None
self._alipay_trans_serial_no = None
self._bill_month ... | 0 | 0 | 0 | 0 | 0 | 0 |
barf/arch/helper.py | IMULMUL/barf-project | 1,395 | 1660983 | <filename>barf/arch/helper.py
# Copyright (c) 2014, Fundacion Dr. <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/utils_eval_diversity.py | jiyeonkim127/PSI | 138 | 1660992 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import pickle
import sys, os, glob
import pdb
import json
import argparse
import numpy as np
import open3d as o3d
sys.path.append('/home/yzhang/workspaces/smpl-env-gen-3d-internal')
sys.path.append('/home/yzha... | 0 | 1 | 0 | 0 | 1 | 0 |
src/tl_gan/script_old_discover_feature_axis.py | timgates42/transparent_latent_gan | 1,922 | 1661002 | <gh_stars>1000+
""" script to discover feature axis in the latent space """
"""
pre-requisite: this code needs pre-generated feature-image pairs, stored as pickle files located at:
project_root/asset_results/pggan_celeba_sample_pkl
"""
import os
import sys
import time
import pickle
import numpy as np
import tensorfl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ostorlab/runtimes/lite_local/runtime.py | bbhunter/ostorlab | 113 | 1661063 | from __future__ import annotations
"""Lite local runtime runs agents locally with limited setup, like no MQ service and no defaults agents.
The local runtime requires Docker Swarm to run robust long-running services with a set of configured services.
"""
import logging
from typing import List
from typing import Option... | 26 | 14 | 0 | 0 | 40 | 0 |
vmtkScripts/contrib/vmtkcenterlinestonumpy.py | michelebucelli/vmtk | 217 | 1661083 | <gh_stars>100-1000
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkcenterlinestonumpy.py,v $
## Language: Python
## Date: June 10, 2017
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/mer_csv.py | phasorhand/PyTorchText | 1,136 | 1661102 | <reponame>phasorhand/PyTorchText
#coding:utf8
def merge(file1,file2,res='result.csv',k = 1):
'''
file1 准确率高 第一个位置的准确个数多
file2 召回率高 所有位置的准确的个数多
'''
with open(file1) as f:
lines1 = f.readlines()
with open(file2) as f:
lines2 = f.readlines()
# import ipdb;
# ipdb.set_trace()... | 0 | 0 | 0 | 0 | 0 | 0 |
quarkc/javascript.py | datawire/quark | 112 | 1661141 | # Copyright 2015 datawire. 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 agr... | 3 | 62 | 0 | 0 | 65 | 0 |
lexos/views/rolling_window.py | WheatonCS/Lexos | 107 | 1661197 | from flask import session, Blueprint
from lexos.helpers import constants as constants
from lexos.managers import session_manager as session_manager
from lexos.models.rolling_window_model import RollingWindowsModel
from lexos.views.base import render
rolling_window_blueprint = Blueprint("rolling_window", __name__)
@r... | 0 | 2 | 0 | 0 | 2 | 0 |
src/FactorSelector/CriticalPathBuilder/SynchronizationObject.py | mozafari/vprofiler | 107 | 1661227 | <reponame>mozafari/vprofiler
from abc import ABCMeta, abstractmethod
from OperationEnum import Operation
# Abstract base class for synchronization objects
class SynchronizationObject:
__metaclass__ = ABCMeta
@abstractmethod
def GetDependenceRelation(self, obj):
pass
class OwnershipTimeInterval:
... | 0 | 0 | 0 | 0 | 0 | 0 |
pymake/depgraph.py | scharlton2/modflow6 | 102 | 1661244 | <reponame>scharlton2/modflow6
#! /usr/bin/env python
import os
try:
import pymake
except:
msg = 'Error. Pymake package is not available.\n'
msg += 'Try installing using the following command:\n'
msg += ' pip install https://github.com/modflowpy/pymake/zipball/master'
print(msg)
raise Exception(... | 0 | 0 | 0 | 0 | 0 | 0 |
python_toolbox/temp_value_setting/temp_working_directory_setter.py | hboshnak/python_toolbox | 119 | 1661253 | <gh_stars>100-1000
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''
Defines the `TempWorkingDirectorySetter` class.
See its documentation for more details.
'''
import os
from .temp_value_setter import TempValueSetter
class TempWorkingDirectorySetter(TempValueSetter):
'''
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/seahub/utils/test_get_conf_test_ext.py | weimens/seahub | 420 | 1661294 | import pytest
pytestmark = pytest.mark.django_db
from django.conf import settings
from seahub.utils import get_conf_text_ext
from seahub.test_utils import BaseTestCase
class GetConfTextExtTest(BaseTestCase):
def setUp(self):
self.clear_cache()
from constance import config
self.config = ... | 0 | 0 | 0 | 0 | 0 | 0 |
convlab2/nlg/sclstm/multiwoz/__init__.py | Malavikka/ConvLab-2 | 339 | 1661328 | from convlab2.nlg.sclstm.multiwoz.sc_lstm import SCLSTM | 0 | 0 | 0 | 0 | 0 | 0 |
heat/policies/cloudformation.py | stackriot/heat | 265 | 1661336 | <filename>heat/policies/cloudformation.py
# 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 la... | 0 | 0 | 0 | 0 | 0 | 0 |
src/devpy/temp.py | sametmax/devpy | 161 | 1661344 | <filename>src/devpy/temp.py<gh_stars>100-1000
import tempfile
from pathlib import Path
def temp_dir(name, root=None):
root = root or tempfile.gettempdir()
directory = Path(root) / name
directory.mkdir(exist_ok=True)
return directory
| 0 | 0 | 0 | 0 | 0 | 0 |
pyinfra/version.py | yggdr/pyinfra | 1,532 | 1661376 | <gh_stars>1000+
try:
from pkg_resources import get_distribution
__version__ = get_distribution('pyinfra').version
except Exception:
__version__ = 'unknown'
| 0 | 0 | 0 | 0 | 0 | 0 |
Chapter08/8A_OpenBankAPI/props/default.py | uyenphuong18406/Hands-On-Artificial-Intelligence-for-Banking | 115 | 1661409 |
OUR_BANK = 'gh.29.uk'
USERNAME = '<EMAIL>'
PASSWORD = '<PASSWORD>'
CONSUMER_KEY = '<KEY>'
# API server URL
BASE_URL = "https://apisandbox.openbankproject.com"
API_VERSION = "v2.0.0"
# API server will redirect your browser to this URL, should be non-functional
# You will paste the redirect location he... | 0 | 0 | 0 | 0 | 0 | 0 |
safedelete/apps.py | davidastephens/django-safedelete | 505 | 1661412 | from django.apps import AppConfig
class SafeDeleteConfig(AppConfig):
name: str = 'safedelete'
verbose_name: str = 'Safe Delete'
def ready(self):
pass
| 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_manifest.py | ericchiang/kpm | 121 | 1661423 | import pytest
from kpm.manifest_jsonnet import ManifestJsonnet
@pytest.fixture()
def manifest(kubeui_package, package_dir) -> object:
return ManifestJsonnet(kubeui_package)
@pytest.fixture()
def empty_manifest(empty_package_dir) -> object:
return ManifestJsonnet(package=None)
@pytest.fixture()
def bad_manif... | 0 | 3 | 0 | 0 | 3 | 0 |
audio/hparams.py | nevenkitasuno/FastSpeech | 745 | 1661444 | max_wav_value = 32768.0
sampling_rate = 22050
filter_length = 1024
hop_length = 256
win_length = 1024
n_mel_channels = 80
mel_fmin = 0.0
mel_fmax = 8000.0
| 0 | 0 | 0 | 0 | 0 | 0 |
Trade.py | yunzhongfei/bitfinex_echarts | 116 | 1661448 | from datetime import datetime, timedelta
import time
import pandas as pd
from email.mime.text import MIMEText
from smtplib import SMTP
import pytz
from utility import run_function_till_success
pd.set_option('expand_frame_repr', False) # 当列太多时不换行
pd.set_option('display.max_rows', 1000)
tz = pytz.timezone('Asia/Shanghai... | 3 | 5 | 0 | 0 | 8 | 0 |
toolchain/riscv/MSYS/python/Lib/test/dis_module.py | zhiqiang-hu/bl_iot_sdk | 207 | 1661499 |
# A simple module for testing the dis module.
def f(): pass
def g(): pass
| 0 | 0 | 0 | 0 | 0 | 0 |
PyObjCTest/test_nstextcontainer.py | Khan/pyobjc-framework-Cocoa | 132 | 1661504 |
from PyObjCTools.TestSupport import *
from AppKit import *
class TestNSTextContainer (TestCase):
def testConstants(self):
self.assertEqual(NSLineSweepLeft, 0)
self.assertEqual(NSLineSweepRight, 1)
self.assertEqual(NSLineSweepDown, 2)
self.assertEqual(NSLineSweepUp, 3)
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/BlazingSQLTest/Configuration/Settings.py | Ethyling/blazingsql | 1,059 | 1661569 | <gh_stars>1000+
import os
import sys
import yaml
from datetime import datetime
data = {}
memory_list = None
dateNow = None
execution_mode = "full"
compare_res = "false"
def initialize():
global data
global memory_list
global dateNow
global execution_mode
global compare_res
memory_list = []... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/tasks.py | iNoSec2/sheepl | 229 | 1661570 | <reponame>iNoSec2/sheepl
"""
Creates a Task object than go through, identify all the current tasks
available and then return this as an object with methods to list
them and create the
Has to be it's own class so that it can be used in the interactive console
or through the JSON profiles import
"""
__author__ = "... | 0 | 0 | 0 | 0 | 0 | 0 |
fuzz/manager/generator.py | jwilk-forks/rosenbridge | 2,185 | 1661581 | import random
MAX_INS = 0xffffffff
HALF_INS = 0xffff
def strategy_left_bits():
i = 0
while i <= MAX_INS:
yield int('{:032b}'.format(i)[::-1], 2)
i = i + 1
def strategy_right_bits():
i = 0
while i <= MAX_INS:
yield i
i = i + 1
def strategy_edge_bits():
# this is a ... | 0 | 0 | 0 | 0 | 0 | 0 |
djangae/contrib/googleauth/permissions.py | sleepyjames/djangae | 467 | 1661615 | <filename>djangae/contrib/googleauth/permissions.py
from django.apps import apps
from django.conf import settings
from django.db import models
CUSTOM_PERMISSIONS = getattr(settings, "GOOGLEAUTH_CUSTOM_PERMISSIONS", {})
def get_permission_choices():
"""
Returns a list of permissions that can be set
... | 0 | 0 | 0 | 0 | 0 | 0 |
pysparkling/sql/internal_utils/readers/__init__.py | ptallada/pysparkling | 260 | 1661617 | from .common import InternalReader
__all__ = [
'InternalReader'
]
| 0 | 0 | 0 | 0 | 0 | 0 |
mkdocs_with_pdf/utils/soup_util.py | GreyRook/mkdocs-with-pdf | 137 | 1661619 | from bs4 import PageElement, Tag, NavigableString
def clone_element(el: PageElement) -> PageElement:
if isinstance(el, NavigableString):
return type(el)(el)
copy = Tag(None, el.builder, el.name, el.namespace, el.nsprefix)
# work around bug where there is no builder set
# https://bugs.launchpa... | 1 | 1 | 0 | 0 | 2 | 0 |
f5/bigip/tm/ltm/test/functional/test_auth.py | nghia-tran/f5-common-python | 272 | 1661629 | <filename>f5/bigip/tm/ltm/test/functional/test_auth.py
# coding=utf-8
#
# Copyright 2014-2016 F5 Networks 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/li... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/498241_Scripting_iTunes_Windows/recipe-498241.py | tdiprima/code | 2,023 | 1661640 | import win32com.client
def removeDeletedTracks():
"""This function will remove every song that is not currently accessible from your iTunes library"""
#First, we create an instance of the iTunes Application
itunes= win32com.client.Dispatch("iTunes.Application")
#The ITTrackKindFile value will be use to chec... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/hagan_2002_normal_sabr/test_h2002n_alpha.py | v-tsepelev/pysabr | 103 | 1661656 | <filename>tests/hagan_2002_normal_sabr/test_h2002n_alpha.py<gh_stars>100-1000
from pysabr import hagan_2002_normal_sabr as sabr
import logging
import pytest
from pytest import approx
ERROR_TOLERANCE = 0.00001 # 0.01bps error is tolerated
# [f, t, v_atm_n, beta, rho, volvol]
test_data = {
'Beta=0.5, No... | 0 | 0 | 0 | 0 | 0 | 0 |
problems/even-occuring-element/even-occuring-element.py | vidyadeepa/the-coding-interview | 1,571 | 1661671 | <reponame>vidyadeepa/the-coding-interview
def increment(occurences, i):
if i in occurences.keys():
occurences[i] += 1
else:
occurences[i] = 1
def even_element(l):
"""
Runtime: O(n)
"""
occurences = {}
[increment(occurences, i) for i in l]
for k in occurences:
if occurences[k] % 2 == 0:
... | 0 | 0 | 0 | 0 | 0 | 0 |
hls4ml/converters/onnx/convolution.py | jaemyungkim/hls4ml | 380 | 1661692 | <filename>hls4ml/converters/onnx/convolution.py
import math
from hls4ml.converters.onnx_to_hls import onnx_handler, get_onnx_attribute, get_onnx_input_name, compute_pads_1d, compute_pads_2d
from hls4ml.converters.utils import compute_padding_1d, compute_padding_2d
@onnx_handler('Conv')
def parse_conv_layer(reader, nod... | 0 | 0 | 0 | 0 | 0 | 0 |
src/streaming/event.py | ZackPashkin/toloka-kit | 153 | 1661698 | <reponame>ZackPashkin/toloka-kit
__all__ = [
'AssignmentEvent',
'BaseEvent',
'MessageThreadEvent',
'TaskEvent',
'UserBonusEvent',
'UserRestrictionEvent',
'UserSkillEvent',
]
from enum import Enum, unique
from datetime import datetime
from ..client import Assignment, MessageThread, Task, Use... | 0 | 0 | 0 | 0 | 0 | 0 |
master-node-docker/sentinel/helpers/nonce.py | ramesh-kr/sentinel | 342 | 1661735 | <reponame>ramesh-kr/sentinel<gh_stars>100-1000
# coding=utf-8
from threading import Lock
from ..helpers import eth_helper
class NonceManager(object):
def __init__(self):
self.nonces = {}
self.locks = {}
def set_nonce(self, account_addr, net, nonce=None):
key = account_addr + '@' + n... | 0 | 0 | 0 | 0 | 0 | 0 |
siuba/sql/__init__.py | tmastny/siuba | 831 | 1661756 | from .verbs import *
# preceed w/ underscore so it isn't exported by default
# we just want to register the singledispatch funcs
from .dply import vector as _vector
from .dply import string as _string
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/mocklogin_duo.py | l-avila/duo_unix | 223 | 1661765 | #!/usr/bin/env python
import os
import pexpect
import sys
import paths
PROMPT = '.* or option \(1-4\): $'
def _login_duo(confs):
p = pexpect.spawn(paths.login_duo + ' -d -c' + confs + \
' -f foobar echo SUCCESS')
p.expect(PROMPT, timeout=10)
print '===> %r' % p.match.group(0)
r... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/W3D1_UnsupervisedAndSelfSupervisedLearning/solutions/W3D1_Tutorial1_Solution_dc090f74.py | justynaekert/course-content-dl | 473 | 1661806 | <reponame>justynaekert/course-content-dl
def custom_torch_RSM_fct(features):
"""
custom_torch_RSM_fct(features)
Custom function to calculate representational similarity matrix (RSM) of a feature
matrix using pairwise cosine similarity.
Required args:
- features (2D torch Tensor): feature matrix (nbr items... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/setimes/setimes.py | WojciechKusa/datasets | 10,608 | 1661849 | <gh_stars>1000+
# coding=utf-8
# Copyright 2020 HuggingFace Datasets 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 |
tests/model/is_object_test.py | nickgaya/bravado-core | 122 | 1661927 | # -*- coding: utf-8 -*-
import pytest
from bravado_core.model import is_object
from bravado_core.spec import Spec
# deref = swagger_spec.deref
# default_type = 'object' if not no_default_type and swagger_spec.config['default_type_to_object'] else None
# object_type = deref(object_spec.get('type', default_type))
# re... | 0 | 0 | 0 | 0 | 0 | 0 |
pyscript/wake_up_light.py | rubicon/home-assistant-config-1 | 1,173 | 1661933 | """Emulates a Philips Wake-up Light / sunrise.
This cycles through a sequence of RGB tuples and then
linearily interpolates them in HSV color space as time
proceeds.
The routine can be triggered a service `pyscript.wake_up_light`.
The sequence is canceled by turning the light on and off.
"""
import sys
sys.path.appe... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/preprocess_text/app.py | bhardwajRahul/opyrator | 2,642 | 1661944 | <filename>examples/preprocess_text/app.py
import re
from enum import Enum
from typing import Set
import nltk
from pydantic import BaseModel, Field
try:
EN_STOP_WORDS = set(nltk.corpus.stopwords.words("english"))
except LookupError:
nltk.download("stopwords")
EN_STOP_WORDS = set(nltk.corpus.stopwords.words... | 0 | 0 | 0 | 0 | 0 | 0 |
macropy/core/gen_sym.py | CyberFlameGO/macropy | 2,061 | 1661967 | # -*- coding: utf-8 -*-
"""Logic related to generated a stream of unique symbols for macros to
use.
Exposes this functionality as the `gen_sym` function.
"""
import ast
from . import compat, macros, util, walkers
@util.register(macros.injected_vars)
def gen_sym(tree, **kw) -> object:
"""Create a generator that... | 1 | 2 | 0 | 0 | 3 | 0 |
base_agent/post_process_logical_form.py | kandluis/droidlet | 669 | 1661973 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import copy
# move location inside reference_object for Fill and Destroy actions
def fix_fill_and_destroy_location(action_dict) -> object:
action_name = action_dict["action_type"]
if action_name in ["FILL", "DESTROY"]:
if "location" in action_dic... | 0 | 3 | 0 | 0 | 3 | 0 |
observations/r/union_density.py | hajime9652/observations | 199 | 1661980 | <reponame>hajime9652/observations
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def union_density(path):
"""cross natio... | 0 | 0 | 0 | 0 | 0 | 0 |
boltstream/migrations/0003_streamsession.py | geekpii/boltstream | 1,735 | 1661983 | <reponame>geekpii/boltstream
# Generated by Django 2.2 on 2019-05-01 13:16
import uuid
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("boltstream", "0002_auto_20190429_2043")]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
main_alexnet.py | kingzhengguang/tensorflow_alexnet_classify-cat-dog- | 129 | 1661989 | <reponame>kingzhengguang/tensorflow_alexnet_classify-cat-dog-
"""
writen by stephen
"""
"""
modified by chaye
"""
import os
import numpy as np
import tensorflow as tf
from alexnet import alexnet
from datagenerator import ImageDataGenerator
from datetime import datetime
import glob
from tensorflow.data import Iterator
... | 0 | 0 | 0 | 0 | 0 | 0 |
eth/consensus/noproof.py | ggs134/py-evm | 1,641 | 1662009 | <reponame>ggs134/py-evm
from typing import (
Iterable,
)
from eth.abc import (
AtomicDatabaseAPI,
BlockHeaderAPI,
ConsensusAPI,
)
from eth.typing import (
Address,
)
class NoProofConsensus(ConsensusAPI):
"""
Modify a set of VMs to accept blocks without any validation.
"""
def __in... | 0 | 0 | 0 | 0 | 0 | 0 |
filer/migrations/0015_alter_file_owner_alter_file_polymorphic_ctype_and_more.py | divio/django-filer | 889 | 1662012 | <gh_stars>100-1000
# Generated by Django 4.0.3 on 2022-04-12 12:20
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('conte... | 0 | 0 | 0 | 0 | 0 | 0 |
kafka_influxdb/reader/kafka_python.py | gldnspud/kafka-influxdb | 224 | 1662013 | <filename>kafka_influxdb/reader/kafka_python.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import logging
from kafka import KafkaConsumer
from kafka.common import ConsumerTimeout, KafkaUnavailableError
from kafka_influxdb.encoder.errors import EncoderError
from kafka_influxdb.reader.reader import ReaderAbstract
class... | 0 | 0 | 0 | 0 | 0 | 0 |
kolla/tests/test_hacking.py | bbezak/kolla | 957 | 1662014 | <filename>kolla/tests/test_hacking.py
# Copyright 2016 GohighSec
#
# 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
#
# Unle... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/changes/utils/test_phab.py | vault-the/changes | 443 | 1662044 | from changes.testutils import TestCase
from changes.utils import phabricator_utils
class PhabUtilsTest(TestCase):
def test_is_iden(self):
candidates = {
"rREPOabcd": True,
"r": False,
"rREP": False,
"rrREPOabcd": False,
"rRePabcd": False,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_carseats.py | hajime9652/observations | 199 | 1662045 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.carseats import carseats
def test_carseats():
"""Test module carseats.py by downloading
carseats.csv and testing shape of
... | 0 | 0 | 0 | 0 | 0 | 0 |
site/source/_themes/emscripten_sphinx_rtd_theme/__init__.py | albertobarri/idk | 9,724 | 1662057 | # Copyright 2014 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Sphinx ReadTheDocs theme.
From https://github.com/ryan-roemer/sph... | 0 | 1 | 0 | 0 | 1 | 0 |
tasks/scf/train_distfc_vmf_conv.py | sarvex/TFace | 764 | 1662069 | import logging
import torch
import torch.cuda.amp as amp
import torch.distributed as dist
from torchkit.util.utils import AverageMeter, Timer
from torchkit.util.utils import adjust_learning_rate, warm_up_lr
from torchkit.util.utils import accuracy_dist
from torchkit.util.distributed_functions import AllGather
from tor... | 0 | 0 | 0 | 0 | 0 | 0 |
vkwave/streaming/model.py | Stunnerr/vkwave | 222 | 1662118 | <gh_stars>100-1000
from enum import Enum
from typing import Optional, Any, List
import pydantic
from vkwave.api.methods import APIOptionsRequestContext
from vkwave.types.user_events import PlatformEnum
class Rule(pydantic.BaseModel):
value: str
tag: str
class StreamingClientData:
def __init__(self, en... | 0 | 0 | 0 | 0 | 0 | 0 |
ecosystem_tools/mindconverter/mindconverter/graph_based_converter/mapper/aten/prim/where_mapper.py | mindspore-ai/mindinsight | 216 | 1662155 | <gh_stars>100-1000
# Copyright 2021 Huawei Technologies Co., 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
#
# Un... | 0 | 0 | 0 | 0 | 0 | 0 |
Hackerrank/Codesprints 2017/Codesprint 10/D/A.py | VastoLorde95/Competitive-Programming | 170 | 1662166 | from math import *
f = factorial
def C(n,k):
return f(n)/(f(k)*f(n-k))
for i in xrange(1,20):
s = 0
for j in xrange(0,i+1):
s += C(i,j)
print s,
print
| 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.