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 |
|---|---|---|---|---|---|---|---|---|---|---|
artemis/remote/test_child_processes.py | peteroconnor-bc/artemis | 235 | 3208654 | import signal
import sys
import time
import os
from artemis.config import get_artemis_config_value
from artemis.remote.child_processes import PythonChildProcess, RemotePythonProcess
from artemis.remote.remote_execution import ParamikoPrintThread, execute_command
from artemis.remote.utils import get_local_ips, get_rem... | 0 | 3 | 0 | 0 | 3 | 0 |
tests/lore_test.py | timgates42/lore | 1,549 | 3208655 | # coding=utf-8
import unittest
import lore
class TestTruth(unittest.TestCase):
def test_truth(self):
self.assertTrue(True)
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/ThirdErrorContext.py | antopen/alipay-sdk-python-all | 213 | 3208669 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class ThirdErrorContext(object):
def __init__(self):
self._third_error_code: None = None
self._third_error_msg: None = None
@property
def thi... | 0 | 4 | 0 | 2 | 6 | 0 |
discovery-provider/src/challenges/mobile_install_challenge.py | Tenderize/audius-protocol | 429 | 3208670 | from typing import List, Optional
from sqlalchemy.orm.session import Session
from src.challenges.challenge import (
ChallengeManager,
ChallengeUpdater,
FullEventMetadata,
UserChallenge,
)
class MobileInstallChallengeUpdater(ChallengeUpdater):
def update_user_challenges(
self,
sess... | 6 | 0 | 0 | 0 | 6 | 0 |
tests/py_kmc_api/init_sys_path.py | EQt/KMC | 174 | 3208677 | #!/usr/bin/env python3
import sys
import os
import platform
import os
def is_windows() -> object:
return not is_mac() and 'win' in platform.system().lower()
def is_linux() -> object:
return 'linux' in platform.system().lower()
def is_mac() -> object:
return 'darwin' in platform.system().lower()
if is_windo... | 0 | 3 | 0 | 0 | 3 | 0 |
ufora/scripts/jitteryThreadUsage.py | ufora/ufora | 571 | 3208711 | # Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 0 | 0 | 0 | 0 | 0 | 0 |
bridge/npbackend/bohrium/concatenate.py | bh107/bohrium | 236 | 3208724 | <filename>bridge/npbackend/bohrium/concatenate.py
"""
Array concatenate functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from . import array_create
def atleast_1d(*arys):
"""
Convert inputs to arrays with at least one dimension.
Scalar inputs are converted to 1-dimensional arrays, whilst
higher-dimensional ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/get_uobjects_in_loaded_levels.py | avivazran/UnrealEnginePython | 2,350 | 3208735 | import unreal_engine as ue
from unreal_engine.classes import Object, Blueprint
levels = []
level_packages = []
# get all loaded worlds
for world in ue.all_worlds():
# retrieve the world levels (first persistent then streaming)
levels.append(world.PersistentLevel)
level_packages.append(world.PersistentLeve... | 0 | 0 | 0 | 0 | 0 | 0 |
chap02/game_of_life_patterns.py | maru-n/alife_book_src | 183 | 3208739 | <reponame>maru-n/alife_book_src
import numpy as np
STATIC = np.array(
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,1,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,0],
[1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1],
[0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,1,0],
[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
])
OSCILLATOR = np.array(
[[1,0,0,0,0,... | 0 | 0 | 0 | 0 | 0 | 0 |
flexx/ui/widgets/_plotly.py | tbnorth/flexx | 1,662 | 3208754 | <gh_stars>1000+
"""
Simple example:
.. UIExample:: 200
# Define data. This can also be generated with the plotly Python library
data = [{'type': 'bar',
'x': ['giraffes', 'orangutans', 'monkeys'],
'y': [20, 14, 23]}]
# Show
p = ui.PlotlyWidget(data=data)
Also see examples: ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/obfuscapk/obfuscators/lib_encryption/lib_encryption.py | Elyorbe/Obfuscapk | 688 | 3208765 | #!/usr/bin/env python3
import logging
import os
import re
from typing import List, Dict
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from obfuscapk import obfuscator_category
from obfuscapk import util
from obfuscapk.obfuscation import Obfuscation
class LibEncryption(obfuscator_category.IEncry... | 1 | 0 | 2 | 1 | 4 | 0 |
stix2/test/v21/test_fixtures.py | zv/cti-python-stix2 | 277 | 3208784 | import uuid
from stix2 import utils
from .constants import FAKE_TIME
def test_clock(clock):
assert utils.STIXdatetime.now() == FAKE_TIME
def test_my_uuid4_fixture(uuid4):
assert uuid.uuid4() == "00000000-0000-4000-8000-000000000001"
assert uuid.uuid4() == "00000000-0000-4000-8000-000000000002"
ass... | 0 | 0 | 0 | 0 | 0 | 0 |
AutoDL_sample_code_submission/at_speech/policy_space/model_executor.py | dianjixz/AutoDL | 1,044 | 3208803 | import os, sys
import numpy as np
here = os.path.abspath(os.path.dirname(__file__))
CODE_SUB_DIR = os.path.abspath(os.path.join(here, "..", ".."))
print(CODE_SUB_DIR)
sys.path.append(CODE_SUB_DIR)
from at_speech import SLLRLiblinear, SLLRSag, ThinResnet34Classifier
from at_speech.data_space.raw_data_space import Raw... | 1 | 2 | 1 | 19 | 23 | 0 |
anuga/utilities/tests/test_csv_tools.py | samcom12/anuga_core | 136 | 3208809 | <reponame>samcom12/anuga_core<gh_stars>100-1000
#!/usr/bin/env python
import os
import unittest
import tempfile
import csv
import anuga.utilities.csv_tools as csv_tools
# this dictionary sets the column header string for
# column number modulo 4.
col_text_string = {0: 'col_%d',
1: ' col_%d',
... | 0 | 0 | 0 | 0 | 0 | 0 |
mindsdb/api/http/namespaces/configs/predictors.py | yarenty/mindsdb | 261 | 3208815 | from flask_restx import Namespace
ns_conf = Namespace('predictors', description='Predictor is the main object exposed by the API')
| 0 | 0 | 0 | 0 | 0 | 0 |
python/760_Find_Anagram_Mappings.py | dvlpsh/leetcode-1 | 4,416 | 3208822 | class Solution(object):
def anagramMappings(self, A, B) -> object:
"""
:type A: List[int]
:type B: List[int]
:rtype: List[int]
"""
val_index = {}
ans = []
for i, n in enumerate(B):
val_index[n] = i
for n in A:
ans.append... | 0 | 1 | 0 | 0 | 1 | 0 |
topik/fileio/tests/test_in_json.py | ContinuumIO/topik | 104 | 3208903 | import nose.tools as nt
from topik.fileio.in_json import read_json_stream, read_large_json, __is_iterable
from topik.fileio.tests import test_data_path
from ._solutions import solution_json_stream, solution_large_json
def test_read_document_json_stream():
documents = read_json_stream('{}/test_data_json_stream.jso... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/W1D5_DimensionalityReduction/solutions/W1D5_Tutorial1_Solution_993c2f00.py | eduardojdiniz/CompNeuro | 2,294 | 3209014 |
"""
1) As you rotate the basis vectors, the look of the cloud of projected data changes.
Specifically, the correlations and variances of the projected data change.
2) As the angle increases, the correlation coefficient decreases, goes to 0, then starts
to become negative. It changes from 0.8 to -.8 when the angle is... | 0 | 0 | 0 | 0 | 0 | 0 |
10 Days of Statistics/06 - Day 2 - Basic Probability.py | srgeyK87/Hacker-Rank-30-days-challlenge | 275 | 3209024 | <reponame>srgeyK87/Hacker-Rank-30-days-challlenge
# ========================
# Information
# ========================
# Direct Link: https://www.hackerrank.com/challenges/s10-mcq-1/problem
# Difficulty: Easy
# Max Score: 10
# Language: Python
# Multiple Choice Question - No code required but checked with code
#... | 0 | 0 | 0 | 0 | 0 | 0 |
x2paddle/project_convertor/pytorch/ast_update.py | usertianqin/X2Paddle | 559 | 3209080 | <reponame>usertianqin/X2Paddle
# Copyright (c) 2021 PaddlePaddle 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_provider_llomgui_openshift.py | mjuenema/python-terrascript | 507 | 3209141 | # tests/test_provider_llomgui_openshift.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:23:47 UTC)
def test_provider_import():
import terrascript.provider.llomgui.openshift
def test_resource_import():
from terrascript.resource.llomgui.openshift import openshift_build_config
from terra... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/277600_one_liner_frequency_count/recipe-277600.py | tdiprima/code | 2,023 | 3209145 | >>> from itertools import groupby
>>> [(k, len(list(g))) for k, g in groupby(sorted(myList))]
[('1', 4), ('2', 1), ('3', 2), ('4', 1)]
| 0 | 0 | 0 | 0 | 0 | 0 |
py/mazebase/games/goal_based_games.py | fakeNetflix/facebook-repo-MazeBase | 263 | 3209147 | <filename>py/mazebase/games/goal_based_games.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from random import shuffle, randint
from six.moves import range
from itertools import product
from . import (
BaseMaze... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/openbb_terminal/stocks/options/test_fdscanner_model.py | tehcoderer/GamestonkTerminal | 255 | 3209161 | # IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
import requests
# IMPORTATION INTERNAL
from openbb_terminal.stocks.options import fdscanner_model
@pytest.fixture(scope="module")
def vcr_config() -> dict[str,list[tuple[str, None]]]:
return {
"filter_headers": [("User-Agent", None)],
}
... | 0 | 1 | 0 | 0 | 1 | 0 |
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_display_compressiondistributionsummary.py | ahmedengu/h2o-3 | 6,098 | 3209215 | <filename>h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_display_compressiondistributionsummary.py<gh_stars>1000+
df.describe()
# Rows: 100 Cols: 4
#
# Chunk compression summary:
# chunk_type chunkname count count_% size size_%
# ------------ --------- ----- ------- ----... | 0 | 0 | 0 | 0 | 0 | 0 |
spydra/init-actions/autoscaler.py | torkjel/spydra | 138 | 3209245 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2017 Spotify AB.
# 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 |
2021/01/29/Python Files - How to Read & Write Files With 5 Examples/python_file_examples/remove_empty_lines/script.py | kenjitagawa/youtube_video_code | 492 | 3209293 | with open('essay.txt', 'r') as fi, open('essay_formatted.txt', 'w') as fo:
lines = fi.readlines()
for line in lines:
if line.strip() != '':
fo.write(line.strip())
fo.write('\n') | 0 | 0 | 0 | 0 | 0 | 0 |
lucid/scratch/rl_util/attribution.py | SamuelMarks/lucid | 4,537 | 3209306 | <gh_stars>1000+
import numpy as np
import tensorflow as tf
import lucid.optvis.render as render
import itertools
from lucid.misc.gradient_override import gradient_override_map
def maxpool_override():
def MaxPoolGrad(op, grad):
inp = op.inputs[0]
op_args = [
op.get_attr("ksize"),
... | 0 | 0 | 0 | 0 | 0 | 0 |
mms/metrics/metric_encoder.py | dhanainme/multi-model-server | 527 | 3209311 | <gh_stars>100-1000
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/masu/external/downloader/azure/azure_service.py | rubik-ai/koku | 157 | 3209369 | <gh_stars>100-1000
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Azure Service helpers."""
import logging
from tempfile import NamedTemporaryFile
from adal.adal_error import AdalError
from azure.common import AzureException
from azure.core.exceptions import HttpResponseError
from msrest.ex... | 0 | 0 | 0 | 0 | 0 | 0 |
soft_intro_vae_3d/utils/data.py | BossunWang/soft-intro-vae-pytorch | 144 | 3209426 | import math
import numpy as np
import os
import pandas as pd
import pickle
from decimal import Decimal
from itertools import accumulate, tee, chain
from typing import List, Tuple, Dict, Optional, Any, Set
from utils.plyfile import load_ply
READERS = {
'.ply': load_ply,
'.np': lambda file_path: pickle.load(op... | 0 | 0 | 0 | 0 | 0 | 1 |
githubstats/lib/debug_timer.py | tigefa4u/viz | 7,986 | 3209431 | # -*- coding: utf-8 -*-
# Copyright 2015 <NAME>. 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" f... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/r/test_goldenrod.py | hajime9652/observations | 199 | 3209480 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.goldenrod import goldenrod
def test_goldenrod():
"""Test module goldenrod.py by downloading
goldenrod.csv a... | 0 | 0 | 0 | 0 | 0 | 0 |
unit_tests/reports/test_import_config_rule_status.py | adrianmkng/watchmen | 190 | 3209490 | <filename>unit_tests/reports/test_import_config_rule_status.py
# Copyright 2017 Insurance Australia Group Limited
#
# 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/l... | 0 | 0 | 0 | 0 | 0 | 0 |
ee/clickhouse/queries/person_distinct_id_query.py | leirons/posthog | 7,409 | 3209543 | <reponame>leirons/posthog<filename>ee/clickhouse/queries/person_distinct_id_query.py
from django.conf import settings
from ee.clickhouse.sql.person import GET_TEAM_PERSON_DISTINCT_IDS, GET_TEAM_PERSON_DISTINCT_IDS_NEW_TABLE
def get_team_distinct_ids_query(team_id: int) -> str:
from ee.clickhouse.client import su... | 0 | 0 | 0 | 0 | 0 | 0 |
forte/datasets/wikipedia/dbpedia/dbpedia_datasets.py | J007X/forte | 163 | 3209548 | <reponame>J007X/forte<filename>forte/datasets/wikipedia/dbpedia/dbpedia_datasets.py
# Copyright 2019 The Forte 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
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/pacsign/tests/test_common_util.py | peturingi/opae-sdk | 220 | 3209565 | <filename>python/pacsign/tests/test_common_util.py
import unittest
from unittest import mock
from pacsign.common_util import (print_new_line,
print_info,
print_warning,
print_error,
print_... | 0 | 0 | 0 | 0 | 0 | 0 |
build-support/embed_runner_in_executor.py | jeremyvdw/aurora | 479 | 3209616 | #!/usr/bin/env python
#
# 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, softwar... | 0 | 0 | 0 | 0 | 0 | 0 |
app/locking.py | swipswaps/rapidbay | 351 | 3209623 | import threading
import time
from contextlib import contextmanager
class LockManager:
locks: dict[object,object] = {}
def get(self, key):
thread_id = threading.get_ident()
while self.locks.get(key) not in [None, thread_id, None]:
time.sleep(1)
self.locks[key] = thread_id
... | 0 | 1 | 1 | 0 | 2 | 0 |
bbio/libraries/HTU21D/HTU21D.py | timgates42/PyBBIO | 102 | 3209630 | <gh_stars>100-1000
"""
HTU21D
Copyright 2015 - <NAME> <<EMAIL>>
A PyBBIO library for controlling HTU21D I2C humidity sensor.
HTU21D is released as part of PyBBIO under its MIT license.
See PyBBIO/LICENSE.txt
"""
import bbio, math
class HTU21D(object):
I2C_ADDRESS = 0x40
CMD_TEMP = 0x... | 0 | 0 | 0 | 0 | 0 | 0 |
django_zappa/tests.py | Miserlou/django-zappa | 563 | 3209667 | <gh_stars>100-1000
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from .handler import lambda_handler
from .management.commands import (
deploy, invoke, rollback, tail, update, zappa_command
)
class DjangoZappaTests(TestCase):
##
# Sanity
##
def test_bas... | 0 | 0 | 0 | 0 | 0 | 0 |
lightweight_gan/__init__.py | destefani/lightweight-gan | 1,187 | 3209681 | from lightweight_gan.lightweight_gan import LightweightGAN, Generator, Discriminator, Trainer, NanException
| 0 | 0 | 0 | 0 | 0 | 0 |
openconfig/ydk/models/openconfig/openconfig_bfd.py | CiscoDevNet/ydk-py | 177 | 3209686 | """ openconfig_bfd
An OpenConfig model of Bi\-Directional Forwarding Detection (BFD)
configuration and operational state.
"""
import sys
from collections import OrderedDict
from ydk.types import Entity as _Entity_
from ydk.types import EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, ... | 0 | 1 | 36 | 179 | 216 | 0 |
src/exabgp/logger/__init__.py | pierky/exabgp | 1,560 | 3209696 | import sys
import time
import logging
from exabgp.logger.option import option
from exabgp.logger.handler import getLogger
from exabgp.logger.format import formater
from exabgp.logger.format import lazyformat
from exabgp.logger.format import lazyattribute
from exabgp.logger.format import lazynlri
from exabgp.logger.h... | 12 | 1 | 1 | 0 | 14 | 0 |
recipes/Python/577843_Sound_in_the_STL/recipe-577843.py | tdiprima/code | 2,023 | 3209745 | <reponame>tdiprima/code
"""without installing add ins the following should work
or at least something like it"""
import PyGame
| 0 | 0 | 0 | 0 | 0 | 0 |
compare_stft.py | taeminlee/torch-stft | 188 | 3209746 | import torch
from torch_stft import STFT
import numpy as np
import librosa
import matplotlib.pyplot as plt
audio = librosa.load(librosa.util.example_audio_file())[0]
device = 'cpu'
filter_length = 1024
hop_length = 256
win_length = 1024 # doesn't need to be specified. if not specified, it's the same as filter_length
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/clojure/script/clean.py | magneticflux-/skija | 2,466 | 3209777 | <reponame>magneticflux-/skija
#! /usr/bin/env python3
import os, shutil, sys
def main():
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
shutil.rmtree('.cpcache', ignore_errors = True)
return 0
if __name__ == '__main__':
sys.exit(main()) | 0 | 0 | 0 | 0 | 0 | 0 |
src/DataJoin/data_join/example_id_producer.py | huangwei19/9nfl | 103 | 3209783 | # Copyright 2020 The 9nFL 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 applicable la... | 1 | 5 | 0 | 2 | 8 | 0 |
tests/test_sample_quests.py | JohnnySun8/TextWorld | 307 | 3209793 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import os
from os.path import join as pjoin
from subprocess import check_output
from textworld.utils import make_temp_directory
SCRIPTS_PATH = os.path.abspath(pjoin(__file__, "..", "..", "scripts"))
def... | 0 | 0 | 0 | 0 | 0 | 0 |
test/tablebody_test.py | screamingskulls/sofi | 402 | 3209888 | from sofi.ui import TableBody
def test_basic():
assert(str(TableBody()) == "<tbody></tbody>")
def test_custom_class_ident_style_and_attrs():
assert(str(TableBody(cl='abclass', ident='123', style="font-size:0.9em;", attrs={"data-test": 'abc'}))
== "<tbody id=\"123\" class=\"abclass\" style=\"font-si... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576512_Generating_correlated_random/recipe-576512.py | tdiprima/code | 2,023 | 3209921 | X = m.matrix(numpy.random.standard_normal((3,1000)))
C = m.matrix(m.array([[1,.3,.3],[.3,1.,.3],[.3,.3,1.]]))
U = m.cholesky(C)
Y = U*X
#And to test that this works:
m.corrcoef(Y[0,:],Y[1,:])
m.corrcoef(Y[0,:],Y[2,:])
m.corrcoef(Y[1,:],Y[2,:])
| 0 | 0 | 0 | 0 | 0 | 0 |
test_idblib.py | shrddr/pyidbutil | 110 | 3209961 | <filename>test_idblib.py<gh_stars>100-1000
import unittest
from idblib import FileSection, binary_search, makeStringIO
class TestFileSection(unittest.TestCase):
""" unittest for FileSection object """
def test_file(self):
s = makeStringIO(b"0123456789abcdef")
fh = FileSection(s, 3, 11)
... | 0 | 0 | 0 | 0 | 0 | 0 |
exploitable/lib/analyzers/arm.py | murx-/exploitable | 593 | 3209973 | ### BEGIN LICENSE ###
### Use of the triage tools and related source code is subject to the terms
### of the license below.
###
### ------------------------------------------------------------------------
### Copyright (C) 2011 Carnegie Mellon University. All Rights Reserved.
### Portions Copyright 2013 BlackBerry Ltd.... | 0 | 10 | 0 | 0 | 10 | 0 |
test/completion/named_param.py | asmeurer/jedi | 239 | 3210003 | """
Named Params:
>>> def a(abc): pass
...
>>> a(abc=3) # <- this stuff (abc)
"""
def a(abc):
pass
#? 5 ['abc']
a(abc)
def a(*some_args, **some_kwargs):
pass
#? 11 []
a(some_args)
#? 13 []
a(some_kwargs)
| 0 | 0 | 0 | 0 | 0 | 0 |
heat/db/sqlalchemy/migrate_repo/versions/079_resource_properties_data.py | noironetworks/heat | 265 | 3210029 | #
# 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, software
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
dataset/Superheroes NLP Dataset/create_download_file.py | avinashbhat/texthero | 2,559 | 3210030 | """
Create a "download.sh" file containing a list of all http url that needs to be downloaded.
"""
import helper as h
# NUM_PAGE = 1
# data_char = h.get_data("https://www.superherodb.com/characters/?page_nr={}".format(NUM_PAGE))
# superhero_links = h.get_superheroes_links(data_char)
# Get all superheroes link
TOTA... | 0 | 0 | 0 | 0 | 0 | 0 |
skyline/functions/thunder/check_thunder_failover_key.py | datastreaming/skyline-1 | 396 | 3210041 | import logging
from os import uname
from os.path import isfile
from time import time
from ast import literal_eval
import settings
from functions.filesystem.remove_file import remove_file
skyline_app = 'thunder'
skyline_app_logger = '%sLog' % skyline_app
logger = logging.getLogger(skyline_app_logger)
# The failover ... | 0 | 1 | 0 | 0 | 1 | 0 |
PyImageSearchProblems/TemplateMatching.py | vygasuresh/img | 263 | 3210063 | <reponame>vygasuresh/img<gh_stars>100-1000
__author__ = 'Charlie'
import os, sys, inspect
import cv2
import numpy as np
import argparse
# Info:
# cmd_folder = os.path.dirname(os.path.abspath(__file__))
# __file__ fails if script is called in different ways on Windows
# __file__ fails if someone does os.chdir() before
... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/objspace/std/jsondict.py | nanjekyejoannah/pypy | 333 | 3210130 | from __future__ import annotations
"""dict implementation specialized for object loaded by the _pypyjson module.
Somewhat similar to MapDictStrategy, also uses a map.
"""
from rpython.rlib import jit, rerased, objectmodel, debug
from pypy.objspace.std.dictmultiobject import (
UnicodeDictStrategy, DictStrategy,
... | 0 | 21 | 1 | 1 | 23 | 0 |
homeassistant/components/opengarage/const.py | MrDelik/core | 30,023 | 3210134 | <filename>homeassistant/components/opengarage/const.py
"""Constants for the OpenGarage integration."""
CONF_DEVICE_KEY = "device_key"
DEFAULT_NAME = "OpenGarage"
DEFAULT_PORT = 80
DOMAIN = "opengarage"
| 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/notion/diagnostics.py | MrDelik/core | 30,023 | 3210169 | """Diagnostics support for Notion."""
from __future__ import annotations
from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core impor... | 2 | 1 | 1 | 0 | 4 | 0 |
mtgjson5/providers/abstract.py | 0az/mtgjson | 512 | 3210176 | """
API for how providers need to interact with other classes
"""
import abc
import configparser
import datetime
import logging
from typing import Any, Dict, Union
import requests_cache
from ..consts import CACHE_PATH, CONFIG, USE_CACHE
LOGGER = logging.getLogger(__name__)
class AbstractProvider(abc.ABC):
"""
... | 4 | 7 | 3 | 1 | 15 | 0 |
boop/__main__.py | Seabreg/BoopSuite | 514 | 3210204 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import click
import pyric.pyw as pyw
from colorama import Fore, Style
from boop.__version__ import __version__
from boop.tools.interfaces import interface_command
from boop.tools.modes import mode_command
from boop.tools.sniffer import sniffer_command
@click.group()
... | 0 | 0 | 0 | 0 | 0 | 0 |
cvnets/layers/normalization/layer_norm.py | apple/ml-cvnets | 209 | 3210212 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor, Size
from typing import Optional, Union, List
import torch
from . import register_norm_fn
@register_norm_fn(name="layer_norm")
class LayerNorm(nn.LayerNorm):
"""
Applies `Lay... | 8 | 4 | 0 | 0 | 12 | 0 |
composer/utils/libcloud_object_store_hparams.py | mosaicml/composer | 945 | 3210246 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Hyperparameters for the :class:`~.LibcloudObjectStore`."""
import dataclasses
import os
from typing import Any, Dict, Optional
import yahp as hp
from composer.utils.libcloud_object_store import LibcloudObjectStore
@dataclasses.dat... | 0 | 2 | 8 | 0 | 10 | 0 |
rls/algorithms/single/ppo.py | StepNeverStop/RLs | 371 | 3210267 | #!/usr/bin/env python3
# encoding: utf-8
from __future__ import annotations
from typing import Dict, List
import numpy as np
import torch as th
import torch.distributions as td
from rls.algorithms.base.sarl_on_policy import SarlOnPolicy
from rls.common.data import Data
from rls.common.decorator import it... | 26 | 7 | 1 | 0 | 34 | 0 |
html_parsing/get_game_genres/export_import/import.py | DazEB2/SimplePyScripts | 117 | 3210271 | <filename>html_parsing/get_game_genres/export_import/import.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import json
import sys
sys.path.append('..')
from db import Dump
import peewee
from playhouse.shortcuts import dict_to_model
from export import FILE_NAME_EXPORT_JSON
items = jso... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/nnet/activations/test_softmax.py | kw-0/MyGrad | 147 | 3210274 | <reponame>kw-0/MyGrad
import hypothesis.extra.numpy as hnp
import hypothesis.strategies as st
import numpy as np
from hypothesis import given
from numpy.testing import assert_allclose
from mygrad import Tensor
from mygrad.nnet.activations import logsoftmax, softmax
from tests.utils.checkers import is_float_arr
from te... | 0 | 0 | 0 | 0 | 0 | 0 |
challenge_1/python/returnlove/src/reverse_a_string.py | rchicoli/2017-challenges | 271 | 3210286 | <gh_stars>100-1000
# read input string from user
input_string = raw_input("enter any string")
# solution 1
# create a variable to store the reversed string
reversed_string = ""
# loop through the input in reverse order and append each letter
for l in xrange(len(input_string)-1, -1, -1):
reversed_string += str(input_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/test_click.py | JosephWardDotTech/helium | 1,656 | 3210299 | from helium import click, Config
from helium._impl.util.lang import TemporaryAttrValue
from tests.api import BrowserAT
class ClickTest(BrowserAT):
def get_page(self) -> str:
return 'test_click.html'
def test_click(self):
click("Click me!")
self.assertEqual('Success!', self.read_result_from_browser())
def test... | 0 | 1 | 0 | 0 | 1 | 0 |
zeeb_src/recon_src.py | th3cyb3rc0p/Zeebsploit | 186 | 3210316 | <gh_stars>100-1000
#-*- coding: utf-8 -*-
from .lib import (
waf_detect,
infoga
)
from .utils import (
infoga_modules,
show,
log,
description,
proto,
no_proto,
waf_debug,
json_respon
)
import requests,readline,marshal,whois
from bs4 import BeautifulSoup as bs
log = log(__name__... | 0 | 0 | 0 | 0 | 0 | 0 |
flow-python/examples/misc/visualize_client/push_video.py | chentyjpm/MegFlow | 303 | 3210334 | <gh_stars>100-1000
import sys
import os
import requests
def main(ip, filename):
url_template = "http://{}:8090/control/get?room=megflow-test"
url = url_template.format(ip)
print(url)
result = requests.get(url)
if not result.ok:
raise Exception('req channel failed')
channel = result.json... | 0 | 0 | 0 | 0 | 0 | 0 |
Templates/JXADylib_Runner/simple-package/scripts/files/helper.py | mattreduce/Mystikal | 178 | 3210335 | import ctypes, time, sys
from ctypes import *
while True:
libc = "/usr/lib/libSystem.B.dylib"
lib = ctypes.CDLL(libc)
load = "/Library/Application Support/helper.dylib"
handle = ctypes.CDLL(load)
time.sleep(callback_time) | 0 | 0 | 0 | 0 | 0 | 0 |
project/boh/templatetags/markdown_render.py | j2yemi/dso-demo1 | 109 | 3210364 | <gh_stars>100-1000
import markdown
from markdown.extensions import Extension
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
# http://pythonhosted.org//Markdown/release-2.6.html#safe_mode-deprecated
class EscapeHtml(Extension):
def extendMarkdown(self, m... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle_fl/mpc/examples/model_encryption/update/train_and_encrypt_model.py | barrierye/PaddleFL | 379 | 3210420 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
rpython/jit/backend/ppc/helper/regalloc.py | nanjekyejoannah/pypy | 381 | 3210430 | <reponame>nanjekyejoannah/pypy
from rpython.jit.metainterp.history import ConstInt, FLOAT
from rpython.jit.backend.ppc.locations import imm
def check_imm_box(arg, lower_bound=-2**15, upper_bound=2**15-1):
if isinstance(arg, ConstInt):
i = arg.getint()
return lower_bound <= i <= upper_bound
retu... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/dummy_plugin/dummy_plugin/homepage.py | psmware-ltd/nautobot | 384 | 3210465 | from nautobot.core.apps import HomePageItem, HomePagePanel
from .models import DummyModel
def get_dummy_data(request) -> object:
examples = DummyModel.objects.all()
if not examples:
examples = (
DummyModel.objects.create(name="Example 1", number=100),
DummyModel.objects.create... | 0 | 1 | 0 | 0 | 1 | 0 |
source/vsm/vsm/api/v1/licenses.py | ramkrsna/virtual-storage-manager | 172 | 3210487 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Intel 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
#... | 3 | 6 | 0 | 0 | 9 | 0 |
server/backend/app/db/cruds/crud_video_file.py | chemetc/maskcam | 179 | 3210528 | <reponame>chemetc/maskcam<gh_stars>100-1000
################################################################################
# Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | chuanconggao/extratools | 150 | 3210588 | <filename>setup.py
#! /usr/bin/env python3
from setuptools import setup
from glob import glob
url = "https://github.com/chuanconggao/extratools"
version = "0.8.2.1"
setup(
name="extratools",
packages=["extratools"],
scripts=glob("bin/extratools-*"),
include_package_data=True,
url=url,
vers... | 0 | 0 | 0 | 0 | 0 | 0 |
data_migration/management/commands/task_model_migrate.py | wkma/bk-sops | 881 | 3210605 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file ... | 0 | 0 | 0 | 0 | 0 | 0 |
pybamm/input/parameters/lead_acid/electrolytes/sulfuric_acid_Sulzer2019/darken_thermodynamic_factor_Chapman1968.py | manjunathnilugal/PyBaMM | 330 | 3210640 | <filename>pybamm/input/parameters/lead_acid/electrolytes/sulfuric_acid_Sulzer2019/darken_thermodynamic_factor_Chapman1968.py
#
# Darken thermodynamic factor of sulfuric acid
#
def darken_thermodynamic_factor_Chapman1968(c_e):
"""
Dimensional Darken thermodynamic factor of sulfuric acid, from data in
[1, 2... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/agent_dvr/test_init.py | MrDelik/core | 30,023 | 3210643 | """Test Agent DVR integration."""
from unittest.mock import AsyncMock, patch
from agent import AgentError
from homeassistant.components.agent_dvr.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from . import CONF_DATA, create_entry
from test... | 4 | 2 | 0 | 0 | 6 | 0 |
process_a11y/tests/test_process_a11y.py | duckduckmuse/domain-scan | 367 | 3210646 | import unittest
from .context import a11y # noqa
from a11y.process_a11y import A11yProcessor
class ProcessA11yTestCase(unittest.TestCase):
a11y_filename: str = 'tests/data/a11y.csv'
domain_filename: str = 'tests/data/domains.csv'
def setUp(self):
self.a11y = A11yProcessor(self.a11y_filename, s... | 0 | 0 | 2 | 0 | 2 | 0 |
examples/pytorch/sagpool/layer.py | ketyi/dgl | 9,516 | 3210700 | import torch
import torch.nn.functional as F
import dgl
from dgl.nn import GraphConv, AvgPooling, MaxPooling
from utils import topk, get_batch_id
class SAGPool(torch.nn.Module):
"""The Self-Attention Pooling layer in paper
`Self Attention Graph Pooling <https://arxiv.org/pdf/1904.08082.pdf>`
Args:
... | 7 | 2 | 0 | 0 | 9 | 0 |
utils/time.py | Sengolda/EpicBot | 571 | 3210706 | <gh_stars>100-1000
"""
Copyright 2021 Nirlep_5252_
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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
openfermioncirq/optimization/result_test.py | unpilbaek/OpenFermion-Cirq | 278 | 3210721 | <filename>openfermioncirq/optimization/result_test.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 applica... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/utils/test_files.py | waynegemmell/salt | 9,425 | 3210736 | """
Unit Tests for functions located in salt/utils/files.py
"""
import copy
import os
import pytest
import salt.utils.files
from tests.support.mock import patch
def test_safe_rm():
with patch("os.remove") as os_remove_mock:
salt.utils.files.safe_rm("dummy_tgt")
assert os_remove_mock.called is T... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_codecs.py | andrewvaliente/pytoshop | 106 | 3210740 | # -*- coding: utf-8 -*-
import io
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pytoshop import codecs
from pytoshop import enums
@pytest.mark.parametrize("depth", (8, 16))
def test_zip_with_prediction(depth):
np.random.seed(0)
dtype = codecs.color_depth_dtype_map[d... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/commands/test_index_cmd.py | Clinical-Genomics/scout | 111 | 3210750 | <reponame>Clinical-Genomics/scout<filename>tests/commands/test_index_cmd.py
# -*- coding: utf-8 -*-
from scout.commands import cli
from scout.server.extensions import store
def test_index(mock_app):
"""Test the CLI that creates indexes in the database"""
runner = mock_app.test_cli_runner()
assert runner... | 0 | 0 | 0 | 0 | 0 | 0 |
hierarchical_transformer_memory/hierarchical_attention/htm_attention_test.py | feifzhou/deepmind-research | 10,110 | 3210760 | # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 2 | 1 | 0 | 0 | 3 | 0 |
qcodes/tests/dataset/measurement/test_shapes.py | riju-pal/QCoDeS_riju | 223 | 3210764 | import logging
import numpy as np
import hypothesis.strategies as hst
from hypothesis import HealthCheck, given, example, settings
from qcodes.dataset.measurements import Measurement
@given(n_points=hst.integers(min_value=1, max_value=100))
@example(n_points=5)
@settings(deadline=None, suppress_health_check=(Health... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Unit/Evolution/Systems/NewtonianEuler/BoundaryConditions/DirichletAnalytic.py | macedo22/spectre | 117 | 3210828 | <filename>tests/Unit/Evolution/Systems/NewtonianEuler/BoundaryConditions/DirichletAnalytic.py
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
import PointwiseFunctions.AnalyticSolutions.Hydro.SmoothFlow as hydro
import Evolution.Systems.NewtonianEuler.TimeDerivative as flux
de... | 0 | 0 | 0 | 0 | 0 | 0 |
gaiadet/__init__.py | zengming16/GAIA-det | 149 | 3210871 | <reponame>zengming16/GAIA-det
from .apis import *
from .core import *
from .datasets import *
from .models import *
| 0 | 0 | 0 | 0 | 0 | 0 |
jactorch/optim/optimizer_group.py | dapatil211/Jacinle | 114 | 3210877 | <reponame>dapatil211/Jacinle<gh_stars>100-1000
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : optimizer_group.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 02/16/2020
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
from .custom_optimizer import CustomizedOptimizer
__al... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main.py | CindyChen1995/MKR | 273 | 3210882 | import argparse
import numpy as np
from data_loader import load_data
from train import train
np.random.seed(555)
parser = argparse.ArgumentParser()
# movie
parser.add_argument('--dataset', type=str, default='movie', help='which dataset to use')
parser.add_argument('--n_epochs', type=int, default=20, help='the numbe... | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/COUNT_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_2.py | mxl1n/CodeGen | 241 | 3210897 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( p , q ) -> object :
dp = [ 1 for i in range ( q ) ]
for i in range ( p - 1 ) :
for j in range ( 1 ,... | 0 | 1 | 0 | 0 | 1 | 0 |
lib_pypy/_pypy_util_build.py | nanjekyejoannah/pypy | 333 | 3210901 |
from cffi import FFI as _FFI
_ffi = _FFI()
_ffi.cdef("""
void* malloc(size_t size);
void free(void *ptr);
""")
_ffi.set_source("_pypy_util_cffi_inner", "")
if __name__ == '__main__':
_ffi.compile()
| 0 | 0 | 0 | 0 | 0 | 0 |
system/functions/maths.py | u-n-i-c-o-rn/jimi | 111 | 3210902 | <filename>system/functions/maths.py
import math
def sum(*args):
sumResult=0
for arg in args:
sumResult+=arg
return sumResult
def length(var):
return len(var)
def roundNum(var):
return round(var)
def ceil(var):
return math.ceil(var)
def floor(var):
return math.floor(var)
def inc... | 0 | 0 | 0 | 0 | 0 | 0 |
onegram/settings.py | pauloromeira/onegram | 150 | 3210980 | import logging
from pathlib import Path
from decouple import config
from tenacity import retry_if_exception_type
from tenacity import wait_chain, wait_fixed, wait_random
from tenacity import stop_after_delay
from .utils import head_tail, choices, repeat
from .exceptions import RateLimitedError
from .utils import cas... | 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.