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 |
|---|---|---|---|---|---|---|---|---|---|---|
bplustree/entry.py | EdwardWooCN/bplustree | 760 | 1739896 | from __future__ import annotations
import abc
from typing import Optional
from .const import (ENDIAN, PAGE_REFERENCE_BYTES,
USED_KEY_LENGTH_BYTES, USED_VALUE_LENGTH_BYTES, TreeConf)
# Sentinel value indicating that a lazy loaded attribute is not yet loaded
NOT_LOADED = object()
class Entry(meta... | 16 | 18 | 5 | 0 | 39 | 0 |
tests/test_101_pipeline.py | kipoi/kipoi | 213 | 1739900 | <gh_stars>100-1000
import numpy as np
import pandas as pd
from kipoi_utils.utils import cd
import kipoi
import pytest
def test_gradient_pipeline():
model = kipoi.get_model("Basset", source="kipoi")
dl_kwargs = model.default_dataloader.example_kwargs
with cd(model.source_dir):
ret = model.pipeline.... | 0 | 0 | 0 | 0 | 0 | 0 |
monitoring/prometheus/main_test.py | glasnt/python-docs-samples | 5,938 | 1739905 | <filename>monitoring/prometheus/main_test.py
# 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
convlab2/nlg/__init__.py | Malavikka/ConvLab-2 | 414 | 1739908 | from convlab2.nlg.nlg import NLG
| 0 | 0 | 0 | 0 | 0 | 0 |
src/pretalx/schedule/models/room.py | AthinaDavari/pretalx | 418 | 1739913 | <reponame>AthinaDavari/pretalx<filename>src/pretalx/schedule/models/room.py
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_scopes import ScopedManager
from i18nfield.fields import I18nCharField
from pretalx.common.mixins.models import LogMixin
from pretalx.common.urls i... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/module/_cppyy/capi/__init__.py | nanjekyejoannah/pypy | 333 | 1739915 | <filename>pypy/module/_cppyy/capi/__init__.py
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.module._cppyy.capi.loadable_capi import *
from pypy.module._cppyy.capi.capi_types import C_OBJECT,\
C_NULL_TYPE, C_NULL_OBJECT
def direct_ptradd(ptr, offset):
offset = rffi.cast(rffi.SIZE_T, offset)
... | 0 | 0 | 0 | 0 | 0 | 0 |
factory-ai-vision/EdgeSolution/modules/CVCaptureModule/utility.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 1739917 | <filename>factory-ai-vision/EdgeSolution/modules/CVCaptureModule/utility.py<gh_stars>100-1000
from azure.iot.device import IoTHubModuleClient
import socket
import os
def is_edge():
"""is_edge.
"""
try:
IoTHubModuleClient.create_from_edge_environment()
return True
except Exception:
... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/find-nearest-point-that-has-the-same-x-or-y-coordinate.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1739929 | # Time: O(n)
# Space: O(1)
class Solution(object):
def nearestValidPoint(self, x, y, points) -> object:
"""
:type x: int
:type y: int
:type points: List[List[int]]
:rtype: int
"""
smallest, idx = float("inf"), -1
for i, (r, c) in enumerate(points):
... | 0 | 1 | 0 | 0 | 1 | 0 |
rx/core/operators/bufferwithtime.py | mmpio/RxPY | 4,342 | 1739940 | from typing import Callable, Optional
from rx import operators as ops
from rx.core import Observable, pipe, typing
def _buffer_with_time(timespan: typing.RelativeTime, timeshift: Optional[typing.RelativeTime] = None,
scheduler: Optional[typing.Scheduler] = None) -> Callable[[Observable], Observ... | 3 | 1 | 0 | 0 | 4 | 0 |
nlu/jieba_ckeck.py | SunYanCN/homo | 261 | 1739946 | <gh_stars>100-1000
import jieba
print(" ".join(jieba.cut("给我办一个三十的新流量业务"))) | 0 | 0 | 0 | 0 | 0 | 0 |
sql_metadata/token.py | glentakahashi/sql-metadata | 313 | 1739960 | """
Module contains internal SQLToken that creates linked list
"""
from typing import Dict, List, Union
import sqlparse.sql
from sqlparse.tokens import Comment, Name, Number, Punctuation, Wildcard
from sql_metadata.keywords_lists import (
KEYWORDS_BEFORE_COLUMNS,
RELEVANT_KEYWORDS,
QueryType,
TABLE_AD... | 23 | 36 | 0 | 1 | 60 | 0 |
tests/test_utils.py | simjason/ffn | 1,150 | 1739970 | import ffn.utils as utils
def test_parse_args():
actual = utils.parse_arg('a,b,c')
assert actual == ['a', 'b', 'c']
# should ignore spaces
actual = utils.parse_arg(' a ,b ,c ')
assert actual == ['a', 'b', 'c']
actual = utils.parse_arg('a')
assert actual == ['a']
# should stay same f... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/smallest-integer-divisible-by-k.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1739985 | # Time: O(k)
# Space: O(1)
class Solution(object):
def smallestRepunitDivByK(self, K) -> object:
"""
:type K: int
:rtype: int
"""
# by observation, K % 2 = 0 or K % 5 = 0, it is impossible
if K % 2 == 0 or K % 5 == 0:
return -1
# let f(N) is a N... | 0 | 1 | 0 | 0 | 1 | 0 |
setup.py | hakancelik96/unimport | 147 | 1739986 | <gh_stars>100-1000
import sys
from pathlib import Path
from setuptools import setup
assert sys.version_info >= (3, 6), "unimport requires Python 3.6+"
CURRENT_DIR = Path(__file__).parent
def get_long_description():
readme_md = CURRENT_DIR / "README.md"
with open(readme_md, encoding="utf8") as ld_file:
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/oneflow/nn/optimizer/optimizer.py | zzk0/oneflow | 3,285 | 1740019 | from __future__ import annotations
"""
Copyright 2020 The OneFlow 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
Unles... | 4 | 12 | 0 | 5 | 21 | 0 |
tests/test_trades.py | guypayeur/python-trading-robot | 389 | 1740025 | """Unit test module for the Trade Object.
Will perform an instance test to make sure it creates it. Additionally,
it will test different properties and methods of the object.
"""
import unittest
from unittest import TestCase
from configparser import ConfigParser
from pyrobot.robot import PyRobot
from pyrobot.trades ... | 0 | 2 | 0 | 0 | 2 | 0 |
utils_nlp/dataset/xnli.py | TheCabbageBaggage/nlp-recipes | 4,407 | 1740082 | <reponame>TheCabbageBaggage/nlp-recipes
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Utility functions for downloading, extracting, and reading the
Cross-Lingual NLI Corpus (XNLI).
https://www.nyu.edu/projects/bowman/xnli/
"""
import os
import pandas a... | 0 | 0 | 0 | 0 | 0 | 0 |
cleanfid/leaderboard.py | nupurkmr9/clean-fid | 427 | 1740085 | from __future__ import annotations
import os
import csv
import shutil
import urllib.request
def get_score(model_name: object | None=None, dataset_name: object | None=None,
dataset_res: object | None=None, dataset_split: object | None=None, task_name: object | None=None) -> object:
# download the csv file ... | 5 | 1 | 0 | 0 | 6 | 0 |
kymatio/scattering1d/__init__.py | GReguig/kymatio | 516 | 1740104 | from .frontend.entry import ScatteringEntry1D
__all__ = ['ScatteringEntry1D']
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/organization/test_plan.py | IuryAlves/cloud-foundation-fabric | 203 | 1740134 | # 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 applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 0 |
EC2/templates/Using-Polly-To-Help-Lab/pollyassets/newposts.py | alexkoh93/AWS-CSA-Notes-2019 | 178 | 1740135 | import boto3
import os
import uuid
def lambda_handler(event, context) -> object:
recordId = str(uuid.uuid4())
voice = event["voice"]
text = event["text"]
print('Generating new DynamoDB record, with ID: ' + recordId)
print('Input Text: ' + text)
print('Selected voice: ' + voice)
#... | 0 | 1 | 0 | 0 | 1 | 0 |
run.py | Kadantte/python-girlfriend-mood | 639 | 1740165 | <filename>run.py
#encoding=utf-8
from __future__ import unicode_literals
import jieba
import matplotlib.pyplot as plt
# 基础值
mood = 8
# 估值字典
dic = dict()
# 定值序列
nice = list()
bad = list()
def initMoonValue():
# MoodValue key - value
f = open('data/MoodValue.txt','r')
word = f.readlines()
print('init M... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/ShellTest.py | midhunexeter/sklearn-porter | 1,197 | 1740166 | <filename>tests/utils/ShellTest.py
# -*- coding: utf-8 -*-
from unittest import TestCase
from sklearn_porter.utils.Shell import Shell
class ShellTest(TestCase):
def test_check_output_echo_num_0(self):
self.assertEqual(Shell.check_output('echo 0'), '0')
def test_check_output_echo_num_1(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/vis/test_vis_utils.py | UCLCheminformatics/ScaffoldGraph | 121 | 1740190 | <reponame>UCLCheminformatics/ScaffoldGraph
"""
scaffoldgraph tests.vis.test_vis_utils
"""
import scaffoldgraph.vis.utils as vis_utils
import matplotlib.pyplot as plt
import random
import pytest
import re
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit import Chem
from scaffoldgraph.utils import suppress_rdlogger
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/52310_conditionals_in_expressions/recipe-52310.py | tdiprima/code | 2,023 | 1740209 | <reponame>tdiprima/code
# with an if-else:
def foobar(whop):
if whop>"pohrw": return "foox"
else: return "barbar"
# the equivalent in expression-form:
foobar = lambda whop: ("foox", "barbar")[whop<="pohrw"]
# in general, we MUST ensure the 'conditional' turns
# into a 0 or 1 -- the 'not' operator is handy for... | 0 | 0 | 0 | 0 | 0 | 0 |
notifications/default_settings.py | danidee10/django-notifs | 145 | 1740212 | <filename>notifications/default_settings.py
"""Default settings for django-notifs project."""
from django.conf import settings
NOTIFICATIONS_DELIVERY_BACKEND = getattr(
settings,
'NOTIFICATIONS_DELIVERY_BACKEND',
'notifications.backends.Synchronous',
)
NOTIFICATIONS_QUEUE_NAME = getattr(
settings, 'N... | 0 | 0 | 0 | 0 | 0 | 0 |
src/exabgp/bgp/message/update/attribute/bgpls/node/srcap.py | pierky/exabgp | 1,560 | 1740220 | <gh_stars>1000+
# encoding: utf-8
"""
srcap.py
Created by <NAME>
Copyright (c) 2014-2017 Exa Networks. All rights reserved.
"""
from struct import unpack
from exabgp.util import split
from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState
from exabgp.bgp.message.update.attribute.bgpls.linkstate i... | 0 | 0 | 0 | 0 | 0 | 0 |
L1Trigger/L1TGlobal/test/Raw2Digi_uGTEmulation.py | ckamtsikis/cmssw | 852 | 1740234 | from __future__ import print_function
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: SingleElectronPt10_cfi.py -s GEN,SIM,DIGI,L1 --pileup=NoPileUp --geometry DB --conditions=auto:startu... | 0 | 0 | 0 | 0 | 0 | 0 |
core/dbt/context/docs.py | f1fe/dbt | 3,156 | 1740245 | from typing import (
Any, Dict, Union
)
from dbt.exceptions import (
doc_invalid_args,
doc_target_not_found,
)
from dbt.config.runtime import RuntimeConfig
from dbt.contracts.graph.compiled import CompileResultNode
from dbt.contracts.graph.manifest import Manifest
from dbt.contracts.graph.parsed import Par... | 9 | 3 | 0 | 0 | 12 | 0 |
plato/servers/fedavg_cs.py | TL-System/plato | 135 | 1740248 | from __future__ import annotations
"""
A cross-silo federated learning server using federated averaging, as either edge or central servers.
"""
import asyncio
import logging
import os
import time
import numpy as np
from plato.config import Config
from plato.processors import registry as processor_registry
from plato.... | 3 | 1 | 0 | 1 | 5 | 0 |
release/stubs/Revit/AnalysisDisplay.py | htlcnn/ironpython-stubs | 182 | 1740250 | # encoding: utf-8
# module Revit.AnalysisDisplay calls itself AnalysisDisplay
# from RevitNodes, Version=1.2.1.3083, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
from __future__ import annotations
class AbstractAnalysisDisplay(object, IDisposable)... | 4 | 0 | 0 | 0 | 4 | 0 |
740 Delete and Earn.py | krishna13052001/LeetCode | 872 | 1740281 | #!/usr/bin/python3
"""
Given an array nums of integers, you can perform operations on the array.
In each operation, you pick any nums[i] and delete it to earn nums[i] points.
After, you must delete every element equal to nums[i] - 1 or nums[i] + 1.
You start with 0 points. Return the maximum number of points you can ... | 3 | 3 | 0 | 0 | 6 | 0 |
zarr/meta_v1.py | parthxtripathi/zarr-python | 572 | 1740284 | import json
import numpy as np
from zarr.errors import MetadataError
def decode_metadata(b) -> object:
s = str(b, 'ascii')
meta = json.loads(s)
zarr_format = meta.get('zarr_format', None)
if zarr_format != 1:
raise MetadataError('unsupported zarr format: %s' % zarr_format)
try:
m... | 0 | 5 | 0 | 0 | 5 | 0 |
premium/backend/tests/baserow_premium/test_premium_installed.py | cjh0613/baserow | 839 | 1740285 | import pytest
@pytest.mark.django_db
def test_premium_app_installed(settings):
assert "baserow_premium" in settings.INSTALLED_APPS
| 0 | 0 | 0 | 0 | 0 | 0 |
CodeGenA32/isel_tester.py | robertmuth/Cwerg | 171 | 1740296 | <reponame>robertmuth/Cwerg
#!/usr/bin/python3
"""Testing helper for table driven code selection"""
from typing import Any
import sys
from Base import serialize
from Base import ir
from CpuA32 import opcode_tab as a32
from CpuA32 import symbolic
from CodeGenA32 import isel_tab
from CodeGenA32 import regs
def OpToS... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | Laurentww/smt | 354 | 1740301 | """
Author: Dr. <NAME> <<EMAIL>>
Dr. <NAME> <<EMAIL>>
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
This package is distributed under New BSD license.
"""
from setuptools import setup, Extension
import sys
import numpy as np
from Cython.Build import cythonize
from smt import __version__
CLASSIFIERS = """... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/chart_tests/helm_template_generator.py | astronomer/airflow-chart | 235 | 1740306 | # 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... | 8 | 5 | 0 | 0 | 13 | 0 |
LCM/lcm-tester/send_rc_trajectory.py | titanomachy/flight | 1,040 | 1740308 | <reponame>titanomachy/flight<filename>LCM/lcm-tester/send_rc_trajectory.py
import lcm
import sys
lc = lcm.LCM()
#sys.path.insert(0, '../')
sys.path.insert(0, '/home/abarry/realtime/LCM/')
from lcmt import tvlqr_controller_action
msg = tvlqr_controller_action();
msg.timestamp = 0;
msg.trajectory_number = 0;
lc.pub... | 0 | 0 | 0 | 0 | 0 | 0 |
pycoin/networks/ParseAPI.py | gruve-p/pycoin | 1,210 | 1740328 | from __future__ import annotations
from .parseable_str import parse_b58_double_sha256, parse_bech32, parse_colon_prefix, parseable_str
from pycoin.contrib import segwit_addr
from pycoin.encoding.bytes32 import from_bytes_32
from pycoin.intbytes import int2byte
from pycoin.encoding.hexbytes import b2h, h2b
from .Contr... | 11 | 39 | 0 | 0 | 50 | 0 |
package_control/deps/oscrypto/_win/_crypt32.py | evandrocoan/package_control | 3,373 | 1740331 | <gh_stars>1000+
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from .. import ffi
from ._decode import _try_decode
from .._ffi import buffer_from_bytes
from .._types import str_cls
if ffi() == 'cffi':
from ._crypt32_cffi import crypt32, get_error
else:
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/tensorflow2/bert/keras_extensions/callbacks/batch_statistics_callback.py | payoto/graphcore_examples | 260 | 1740342 | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from __future__ import annotations
import time
import tensorflow as tf
from data_utils.batch_config import BatchConfig
class BatchStatisticsCallback(tf.keras.callbacks.Callback):
def __init__(self, batch_config: BatchConfig):
self.batch_config = ... | 4 | 0 | 0 | 1 | 5 | 0 |
moses/latentgan/__init__.py | jiahuei/moses | 585 | 1740346 | from .config import get_parser as latentGAN_parser
from .model import LatentGAN
from .trainer import LatentGANTrainer
__all__ = ['latentGAN_parser', 'LatentGAN', 'LatentGANTrainer']
| 0 | 0 | 0 | 0 | 0 | 0 |
UTIL/FileIO.py | leelim81/Pair-Trading-Reinforcement-Learning | 186 | 1740357 | import pandas as pd
import os
import io
import yaml
def save_csv(df: pd.DataFrame, ticker: str, path: str):
file_path = os.path.join(path, ticker + '.csv').replace('\\', '/')
df.to_csv(file_path, index=False)
def write_yaml(data, file_path, encoding: str='uft8'):
with io.open(file_path, 'w',... | 4 | 1 | 0 | 0 | 5 | 0 |
integration_tests/samples/oauth/oauth_v2_legacy.py | priya1puresoftware/python-slack-sdk | 2,486 | 1740363 | # ---------------------
# Flask App for Slack OAuth flow
# ---------------------
# pip3 install flask
from __future__ import annotations
from flask import Flask, request, make_response
app = Flask(__name__)
app.debug = True
import logging
import os
from uuid import uuid4
from slack_sdk import WebClient
client_id = ... | 5 | 7 | 0 | 2 | 14 | 0 |
ros/ros_comm/rosgraph/src/rosgraph/roslogging.py | numberen/apollo-platform | 742 | 1740402 | <gh_stars>100-1000
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must reta... | 0 | 0 | 0 | 0 | 0 | 0 |
python_modules/libraries/dagster-gcp/dagster_gcp_tests/gcs_tests/test_resources.py | rpatil524/dagster | 4,606 | 1740405 | <filename>python_modules/libraries/dagster-gcp/dagster_gcp_tests/gcs_tests/test_resources.py
from dagster import build_op_context, op
from dagster_gcp.gcs.resources import gcs_resource
PROJECT_ID = "test-project1231"
def test_gcs_resource():
@op(required_resource_keys={"gcs"})
def gcs_op(context):
as... | 0 | 0 | 0 | 0 | 0 | 0 |
app/slave/subjob_executor.py | rsennewald/ClusterRunner | 164 | 1740406 | <filename>app/slave/subjob_executor.py<gh_stars>100-1000
import os
import shutil
import time
from app.master.build import BuildArtifact
from app.util.conf.configuration import Configuration
import app.util.fs as fs_util # todo(joey): Rename util.py so we don't have package names conflicting with module names
from app... | 0 | 0 | 0 | 0 | 0 | 0 |
querybook/migrations/versions/0463ffd9a113_tracking_url_to_meta_info.py | shivammmmm/querybook | 1,144 | 1740420 | <filename>querybook/migrations/versions/0463ffd9a113_tracking_url_to_meta_info.py
"""tracking url to meta info
Revision ID: 0463ffd9a113
Revises: <KEY>
Create Date: 2019-10-03 00:23:41.896440
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "0463ffd9a113"
down_re... | 0 | 0 | 0 | 0 | 0 | 0 |
src/java/regeneratejava.py | visit-dav/vis | 226 | 1740454 | <filename>src/java/regeneratejava.py<gh_stars>100-1000
#!/usr/local/apps/bin/python
import sys, os
#
# Get the output of a command as a tuple of strings.
#
def GetFilenames(command):
p = os.popen(command)
files = p.readlines()
p.close()
return files
#
# Execute a command. It's wrapped for debugging.
... | 0 | 0 | 0 | 0 | 0 | 0 |
athena/transform/feats/ops/kernels/delta_delta_op_test.py | godjealous/athena | 119 | 1740457 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development 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/LI... | 0 | 0 | 0 | 0 | 0 | 0 |
zfit/models/tobinned.py | zfit/zf | 129 | 1740483 | # Copyright (c) 2021 zfit
from __future__ import annotations
import tensorflow as tf
import zfit
import zfit.z.numpy as znp
from zfit import z
from .binned_functor import BaseBinnedFunctorPDF
from ..core.interfaces import ZfitParameter, ZfitPDF, ZfitSpace
from ..util import ztyping
from ..util.warnings import warn_a... | 4 | 6 | 0 | 0 | 10 | 0 |
examples/timit/visualization/decode_multitask_ctc.py | sundogrd/tensorflow_end2end_speech_recognition | 351 | 1740493 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
"""Decode the trained multi-task CTC outputs (TIMIT corpus)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join, abspath
import sys
import tensorflow... | 2 | 0 | 0 | 0 | 2 | 0 |
19_wod/manual2_list_comprehension.py | sidsid14/tiny_python_projects | 742 | 1740501 | #!/usr/bin/env python3
from pprint import pprint
with open('inputs/exercises.csv') as fh:
headers = fh.readline().rstrip().split(',')
records = [dict(zip(headers, line.rstrip().split(','))) for line in fh]
pprint(records)
| 0 | 0 | 0 | 0 | 0 | 0 |
system_swap/tests/test_e2e.py | mchelen-gov/integrations-core | 663 | 1740550 | <filename>system_swap/tests/test_e2e.py
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from . import common
@pytest.mark.e2e
def test_e2e(dd_agent_check, instance):
aggregator = dd_agent_check(instance, rate=True)
common._test_... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | laike9m/ezcf | 186 | 1740569 | <gh_stars>100-1000
# coding: utf-8
import os
import codecs
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
def read():
"""Build a file path from *paths* and return the contents."""
with codecs.open(os.path.join("README.rst"), "r", "utf-8") as f:
retu... | 0 | 0 | 0 | 0 | 0 | 0 |
python/GafferUITest/AuxiliaryNodeGadgetTest.py | ddesmond/gaffer | 561 | 1740590 | <gh_stars>100-1000
##########################################################################
#
# Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2012, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/libs/gap/gap_globals.py | fchapoton/sage | 1,742 | 1740594 | <filename>src/sage/libs/gap/gap_globals.py
"""Common globals defined by GAP."""
###############################################################################
# Copyright (C) 2009, <NAME> <<EMAIL>>
# Copyright (C) 2012, <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudbaseinit/utils/debiface.py | andia10240/cloudbase-init | 160 | 1740605 | # Copyright 2014 Cloudbase Solutions Srl
#
# 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 l... | 0 | 2 | 0 | 0 | 2 | 0 |
barbican/tasks/common.py | mail2nsrajesh/barbican | 177 | 1740629 | <gh_stars>100-1000
# Copyright (c) 2015 Rackspace, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/test_helpers.py | AmitMY/joeynmt | 563 | 1740646 | import unittest
import torch
class TensorTestCase(unittest.TestCase):
def assertTensorNotEqual(self, expected, actual):
equal = torch.equal(expected, actual)
if equal:
self.fail("Tensors did match but weren't supposed to: expected {},"
" actual {}.".format(expect... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py | Purva-Chaudhari/cmssw | 852 | 1740651 | from __future__ import print_function
# L1 Trigger DQM sequence (L1T)
#
# authors previous versions - see CVS
#
# <NAME> 2011-05-25 revised version of L1 Trigger DQM
import FWCore.ParameterSet.Config as cms
process = cms.Process("DQM")
#----------------------------
# Event Source
#
# for live online DQM in P5
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/layers/loss.py | bestfitting/instance_level_recognition | 103 | 1740653 | <gh_stars>100-1000
import sys
sys.path.insert(0, '../..')
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from config.config import *
class LabelSmoothingLoss(nn.Module):
def __init__(self, smoothing=0.1):
super(LabelSmoothingLoss, self).__init__()
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
surreal/utils/filesys.py | PeihongYu/surreal | 471 | 1740657 | <filename>surreal/utils/filesys.py<gh_stars>100-1000
"""
File system utils.
"""
import os
import sys
import errno
import shutil
import glob
import pwd
import codecs
import hashlib
import tarfile
from socket import gethostname
f_ext = os.path.splitext
f_expand = os.path.expanduser
f_size = os.path.getsize
is_file = ... | 0 | 0 | 0 | 0 | 0 | 0 |
isobar/io/cv/output.py | rvega/isobar | 241 | 1740664 | <filename>isobar/io/cv/output.py<gh_stars>100-1000
from ..output import OutputDevice
try:
import sounddevice
except ModuleNotFoundError:
pass
def get_cv_output_devices():
return list(sounddevice.query_devices())
class CVOutputDevice(OutputDevice):
"""
CVOutputDevice: Sends output to CV over an au... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark.py | exmee/HSSD | 331 | 1740670 | from __future__ import annotations
import tensorflow as tf
import numpy as np
import logging
import logging.config
import time
from config import get_logging_config, args, evaluation_logfile, train_dir
from config import config as net_config
from paths import CKPT_ROOT
from utils import decode_bboxes, batch_iou
from ... | 1 | 0 | 0 | 0 | 1 | 0 |
meraki_v0/aio/api/switch_stacks.py | GameMaster47/dashboard-api-python | 236 | 1740680 | class AsyncSwitchStacks:
def __init__(self, session):
super().__init__()
self._session = session
async def getNetworkSwitchStacks(self, networkId: str) -> object:
"""
**List the switch stacks in a network**
https://developer.cisco.com/meraki/api/#!get-network-switch-... | 14 | 6 | 0 | 0 | 20 | 0 |
autoregressive/model_lib/truncated_bptt_lm_task.py | NVIDIA/transformer-ls | 177 | 1740683 | # 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.
from __future__ import annotations
"""Forked from https://github.com/pytorch/fairseq/blob/master/examples/truncated_bptt/truncated_bptt_lm_task... | 20 | 14 | 6 | 0 | 40 | 0 |
cobra/tools/runtests.py | rnui2k/vivisect | 716 | 1740684 | <filename>cobra/tools/runtests.py
import sys
import cobra.unittests
# Import order here is by test run order!
import cobra.unittests.basictest as c_basictest
import cobra.unittests.msgpacktest as c_msgpacktest
import cobra.unittests.reftest as c_reftest
import cobra.unittests.authtest as c_authtest
import cobra.unitt... | 0 | 0 | 0 | 0 | 0 | 0 |
src/virtual-wan/azext_vwan/vendored_sdks/v2018_08_01/v2018_08_01/models/available_providers_list_parameters_py3.py | Mannan2812/azure-cli-extensions | 207 | 1740687 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 4 | 1 | 1 | 0 | 6 | 0 |
tests/test_basic.py | lgessler/pampy | 3,383 | 1740705 | <reponame>lgessler/pampy
import unittest
from enum import Enum
import re
from pampy import match_value, match, HEAD, TAIL, _, MatchError
class PampyBasicTests(unittest.TestCase):
def test_match_value(self):
def match_value_bool(pat, var):
return match_value(pat, var)[0]
self.assertT... | 0 | 0 | 0 | 0 | 0 | 0 |
python/lib/ucscGb/externalData/geo/submission.py | andypohl/kent | 171 | 1740710 | <reponame>andypohl/kent
import urllib2, re, datetime
# if the molecule is RNA, we need to map our data into !Sample_molecule, which only takes certain fields
# first we check rnaExtractMapping. If its not there, we use the localization. This is because (at current)
# polyA is the most important trait, otherwise its go... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/site-packages/prompt_toolkit/output/windows10.py | edupyter/EDUPYTER38 | 4,028 | 1740719 | <reponame>edupyter/EDUPYTER38
import sys
assert sys.platform == "win32"
from ctypes import byref, windll
from ctypes.wintypes import DWORD, HANDLE
from typing import Any, Optional, TextIO
from prompt_toolkit.data_structures import Size
from prompt_toolkit.win32_types import STD_OUTPUT_HANDLE
from .base import Outpu... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/spiders/t2w_domain_spider.py | keyboardcowboy42/ahmia | 176 | 1740726 | <reponame>keyboardcowboy42/ahmia<filename>tools/spiders/t2w_domain_spider.py
import codecs
import json
from re import match
from datetime import datetime
from scrapy import Spider, log
from items import ToolsItem
class T2WDomainSpider(Spider):
name = "t2w_domain_spider"
nodes = ["tor2web.fi", "tor2web.org", "o... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/polys/domains/domainelement.py | utkarshdeorah/sympy | 8,323 | 1740740 | <reponame>utkarshdeorah/sympy
"""Trait for implementing domain elements. """
from sympy.utilities import public
@public
class DomainElement:
"""
Represents an element of a domain.
Mix in this trait into a class whose instances should be recognized as
elements of a domain. Method ``parent()`` gives t... | 0 | 0 | 0 | 0 | 0 | 0 |
oss2/headers.py | xkdcc/aliyun-oss-python-sdk | 840 | 1740747 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
oss2.headers
~~~~~~~~
这个模块包含http请求里header的key定义
同时包含了发送http请求的header, 类型为dict
"""
OSS_USER_METADATA_PREFIX = "x-oss-meta-"
OSS_CANNED_ACL = "x-oss-acl"
IF_UNMODIFIED_SINCE = "If-Unmodified-Since"
IF_MATCH = "If-Match"
OSS_COPY_OBJECT_SOURCE = "x-oss-copy... | 2 | 0 | 0 | 0 | 2 | 0 |
saas/urls/provider/billing.py | gikoluo/djaodjin-saas | 383 | 1740786 | <reponame>gikoluo/djaodjin-saas<filename>saas/urls/provider/billing.py
# Copyright (c) 2019, DjaoDjin 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:
#
# 1. Redistributions of source code mus... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/popart/transformer_transducer/training/common/metrics.py | payoto/graphcore_examples | 260 | 1740804 | <reponame>payoto/graphcore_examples<filename>applications/popart/transformer_transducer/training/common/metrics.py
# Copyright (c) 2019, NVIDIA CORPORATION. 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 m... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/visual_search_client_enums.py | rsdoherty/azure-sdk-for-python | 2,728 | 1740817 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 0 | 0 | 189 | 0 | 189 | 0 |
synapse/exc.py | vertexproject/synapse | 216 | 1740821 | <reponame>vertexproject/synapse<filename>synapse/exc.py
'''
Exceptions used by synapse, all inheriting from SynErr
'''
class SynErr(Exception):
def __init__(self, *args, **info):
self.errinfo = info
Exception.__init__(self, self._getExcMsg())
def _getExcMsg(self):
props = sorted(self.... | 0 | 0 | 0 | 0 | 0 | 0 |
dojo/tools/blackduck/model.py | mtcolman/django-DefectDojo | 1,772 | 1740824 | <reponame>mtcolman/django-DefectDojo<filename>dojo/tools/blackduck/model.py
from collections import namedtuple
# this class can be updated to use @dataclass in Python 3.7
# note that all types are strings except for 'locations' which is a set of strings
BlackduckFinding = namedtuple('BlackduckFinding', [
'vuln_id'... | 0 | 0 | 0 | 0 | 0 | 0 |
paasta_tools/check_cassandracluster_services_replication.py | sobolevn/paasta | 1,711 | 1740827 | <reponame>sobolevn/paasta<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2015-2019 Yelp 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 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/celery-4.2.1/t/unit/utils/test_debug.py | maulikjs/hue | 5,079 | 1740838 | <reponame>maulikjs/hue
from __future__ import absolute_import, unicode_literals
import pytest
from case import Mock
from celery.utils import debug
def test_on_blocking(patching):
getframeinfo = patching('inspect.getframeinfo')
frame = Mock(name='frame')
with pytest.raises(RuntimeError):
debug._o... | 0 | 0 | 0 | 0 | 0 | 0 |
library/oneview_version_facts.py | nabhajit-ray/oneview-ansible | 108 | 1740850 | <reponame>nabhajit-ray/oneview-ansible<filename>library/oneview_version_facts.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the L... | 0 | 0 | 0 | 0 | 0 | 0 |
Demo/tkinter/guido/sortvisu.py | cemeyer/tauthon | 2,293 | 1740863 | <reponame>cemeyer/tauthon
#! /usr/bin/env python
"""Sorting algorithms visualizer using Tkinter.
This module is comprised of three ``components'':
- an array visualizer with methods that implement basic sorting
operations (compare, swap) as well as methods for ``annotating'' the
sorting algorithm (e.g. to show the p... | 0 | 0 | 0 | 0 | 0 | 0 |
angrmanagement/plugins/binsync/ui/sync_menu.py | DennyDai/angr-management | 474 | 1740869 | from __future__ import annotations
from PySide2.QtWidgets import QDialog, QLabel, QComboBox, QTableWidget, QTableWidgetItem, \
QDialogButtonBox, QGridLayout, QHeaderView, QAbstractItemView
from ..controller import BinsyncController
#
# MenuDialog Box for Binsync Actions
#
class MenuDialog(QDialog):
"""
... | 1 | 4 | 0 | 1 | 6 | 0 |
blogs/factories.py | ewjoachim/pythondotorg | 911 | 1740881 | <gh_stars>100-1000
from django.conf import settings
from .models import Feed
def initial_data():
feed, _ = Feed.objects.get_or_create(
id=1,
defaults={
'name': 'Python Insider',
'website_url': settings.PYTHON_BLOG_URL,
'feed_url': settings.PYTHON_BLOG_FEED_URL,... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_rpc.py | GabrielWen/spartan | 156 | 1740893 | ''' Test whether rpc works in a multithreads environemnt '''
from spartan import rpc
from spartan import util
import threading
from multiprocessing.pool import ThreadPool
port = 7278
host = "localhost"
#number of threads we launch to send request on one client
NUM_THREADS = 4
class EchoServer(object):
def __init__... | 0 | 0 | 0 | 0 | 0 | 0 |
g-code-testing/g_code_parsing/utils.py | anuwrag/opentrons | 235 | 1740916 | <filename>g-code-testing/g_code_parsing/utils.py
import os
import re
from typing import Dict, Type, Union
from opentrons.drivers.smoothie_drivers.driver_3_0 import GCODE as SMOOTHIE_G_CODE
from opentrons.drivers.mag_deck.driver import GCODE as MAGDECK_G_CODE
from opentrons.drivers.temp_deck.driver import GCODE as TEMPD... | 0 | 0 | 0 | 0 | 0 | 0 |
frontend/modelarchive/src/test/resources/models/noop-no-manifest/service.py | dhanainme/multi-model-server | 527 | 1740917 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... | 0 | 5 | 0 | 2 | 7 | 0 |
src/sage/matrix/matrix_misc.py | UCD4IDS/sage | 1,742 | 1740924 | from __future__ import annotations
"""
Miscellaneous matrix functions
"""
# ****************************************************************************
# Copyright (C) 2008 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that... | 3 | 2 | 0 | 0 | 5 | 0 |
paip/examples/logic/find_list.py | skynetshrugged/paip-python | 304 | 1740926 | import logging
from paip import logic
def main():
x = logic.Var('x')
y = logic.Var('y')
a = logic.Var('a')
more = logic.Var('more')
member_first = logic.Clause(
logic.Relation('member', (x, logic.Relation('pair', (x, more)))))
member_last = logic.Clause(
logic.Relation('member... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/newsqa_predictor_test_unsup_large.py | davidgolub/QuestionGeneration | 117 | 1740942 | from data_loaders.language_model_loader import LanguageModelLoader
from models.language_model import LanguageModel
from models.language_trainer import LanguageTrainer
from models.language_wrapper import LanguageWrapper
from helpers import constants
import torch
from helpers import torch_utils, utils
from torch.auto... | 0 | 0 | 0 | 0 | 0 | 0 |
pwndbg/constants/alpha.py | jmc1283/pwndbg | 287 | 1740967 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .constant import Constant
__NR_osf_syscall = Constant('__NR_osf_syscall',0)
__NR_exit = Constant('__NR_exit',1)
__NR_f... | 0 | 0 | 0 | 0 | 0 | 0 |
django_th/views.py | Leopere/django-th | 1,069 | 1740980 | <filename>django_th/views.py
# coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.cache import caches
from... | 0 | 0 | 0 | 0 | 0 | 0 |
util/py/pyutils.py | MTKat/FloorplanTransformation | 323 | 1740993 | import sys
import os
def compute_line_limits(w, rect) -> object:
'''For a line defined as ax + by + c = 0, find its two endpoints within the bounding box [x1, y1, x2, y2]'''
# First check the sign of the four points.
a, b, c = w
x1, y1, x2, y2 = rect
ax1 = a * x1
ax2 = a * x2
by1 = b * y1
... | 0 | 1 | 0 | 0 | 1 | 0 |
vue/decorators/computed.py | adamlwgriffiths/vue.py | 274 | 1740996 | <filename>vue/decorators/computed.py
from .base import pyjs_bridge, VueDecorator
class Computed(VueDecorator):
__key__ = "computed"
def __init__(self, fn):
self.__id__ = fn.__name__
self._getter = pyjs_bridge(fn)
self._setter = None
def setter(self, fn):
self._setter = py... | 0 | 0 | 0 | 0 | 0 | 0 |
hal_fuzz/hal_fuzz/handlers/generic/malloc.py | diagprov/hal-fuzz | 117 | 1741007 | from unicorn.arm_const import *
from unicorn.unicorn_const import *
from ...util import crash
"""
Quick and unoptimized implementation of dynamic memory management allowing to
detect UAF, double free, heap overflow and some heap underflow issues.
"""
wilderness = 0xff000000
free_chunks = {}
allocated_chunks = {}
PAGE... | 0 | 5 | 0 | 0 | 5 | 0 |
pts/model/lstnet/lstnet_estimator.py | nitinthedreamer/pytorch-ts | 647 | 1741020 | <gh_stars>100-1000
from typing import List, Optional
import numpy as np
import torch
import torch.nn as nn
from gluonts.core.component import validated
from gluonts.dataset.field_names import FieldName
from gluonts.torch.util import copy_parameters
from gluonts.torch.model.predictor import PyTorchPredictor
from gluon... | 0 | 0 | 0 | 0 | 0 | 0 |
Algorithms/04. Sorting/002. Big Sorting.py | Snehakri022/HackerrankPractice | 831 | 1741021 | # Problem: https://www.hackerrank.com/challenges/big-sorting/problem
# Score: 20
n = int(input())
arr = []
for i in range(n):
arr.append(input())
arr.sort(key=int)
for _ in arr:
print(_)
| 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/win32comext/mapi/mapitags.py | ajayiagbebaku/NFL-Model | 150 | 1741044 | MV_FLAG = 4096 # Multi-value flag
PT_UNSPECIFIED = 0
PT_NULL = 1
PT_I2 = 2
PT_LONG = 3
PT_R4 = 4
PT_DOUBLE = 5
PT_CURRENCY = 6
PT_APPTIME = 7
PT_ERROR = 10
PT_BOOLEAN = 11
PT_OBJECT = 13
PT_I8 = 20
PT_STRING8 = 30
PT_UNICODE = 31
PT_SYSTIME = 64
PT_CLSID = 72
PT_BINARY = 258
PT_SHORT = PT_I2
PT_I4 = PT_LONG
PT_FLOAT... | 0 | 3 | 0 | 0 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.