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 |
|---|---|---|---|---|---|---|---|---|---|---|
web_programming/reddit.py | mudaseranwer/Python | 145,614 | 1624780 | <reponame>mudaseranwer/Python
from __future__ import annotations
import requests
valid_terms = set(
"""approved_at_utc approved_by author_flair_background_color
author_flair_css_class author_flair_richtext author_flair_template_id author_fullname
author_premium can_mod_post category clicked content_categories cre... | 0 | 0 | 0 | 0 | 0 | 0 |
matminer/featurizers/structure/tests/base.py | ncfrey/matminer | 326 | 1624792 | <gh_stars>100-1000
import copy
from pymatgen.core import Structure, Lattice, Species
from pymatgen.util.testing import PymatgenTest
class StructureFeaturesTest(PymatgenTest):
def setUp(self):
self.diamond = Structure(
Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]),
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/core/minos-microservice-aggregate/minos/aggregate/collections.py | sorasful/minos-python | 247 | 1624794 | from __future__ import (
annotations,
)
from collections.abc import (
MutableSet,
)
from typing import (
Any,
Callable,
Generic,
Iterable,
Iterator,
Optional,
TypeVar,
get_args,
)
from minos.common import (
DataDecoder,
DataEncoder,
DeclarativeModel,
ModelType,
... | 20 | 14 | 2 | 0 | 36 | 0 |
auctioning_platform/web_app/web_app/app.py | nhdinh/smp-modulith | 299 | 1624796 | <filename>auctioning_platform/web_app/web_app/app.py
from typing import Optional
from flask import Flask, Response, request
from flask_injector import FlaskInjector
from sqlalchemy.engine import Connection
from sqlalchemy.orm import Session
from main import bootstrap_app
from main.modules import RequestScope
from web... | 0 | 0 | 0 | 0 | 0 | 0 |
crabageprediction/venv/Lib/site-packages/fontTools/tfmLib.py | 13rianlucero/CrabAgePrediction | 2,705 | 1624806 | <reponame>13rianlucero/CrabAgePrediction<gh_stars>1000+
"""Module for reading TFM (TeX Font Metrics) files.
The TFM format is described in the TFtoPL WEB source code, whose typeset form
can be found on `CTAN <http://mirrors.ctan.org/info/knuth-pdf/texware/tftopl.pdf>`_.
>>> from fontTools.tfmLib import TFM
>>> tfm ... | 0 | 0 | 0 | 0 | 0 | 0 |
DEEPLEARNING/DL_SQUEEZESEG/src/squeezeseg_cpp_preprocessing/script/segment_node.py | Hqss/DINK | 189 | 1624814 | #!/usr/bin/python2
# -*- coding: utf-8 -*-
'''
#+DESCRITION: online segmentation
#+FROM: github.com/durant35/SqueezeSeg
#+DATE: 2018-08-08-Wed
#+AUTHOR: <NAME> (<EMAIL>)
'''
import sys
import os.path
import numpy as np
from PIL import Image
import tensorflow as tf
import rospy
from sen... | 0 | 1 | 0 | 0 | 1 | 0 |
demos/demo_fit_hand.py | YuliangXiu/PIXIE | 196 | 1624832 | import os, sys
import numpy as np
import torch.backends.cudnn as cudnn
import torch
from tqdm import tqdm
import argparse
import cv2
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from pixielib.pixie import PIXIE
from pixielib.visualizer import Visualizer
from pixielib.datasets.hand... | 0 | 0 | 0 | 0 | 0 | 0 |
c/meterpreter/source/extensions/python/Lib/meterpreter/core.py | fergonaut/metasploit-payloads | 1,331 | 1624835 | from __future__ import annotations
import sys, struct, random, string, meterpreter_bindings
# A stack of this stuff was stolen from the Python Meterpreter. We should look
# to find a nice way of sharing this across the two without the duplication.
#
# START OF COPY PASTE
#
# Constants
#
# these values will be patche... | 2 | 6 | 0 | 0 | 8 | 0 |
hpOneView/resources/settings/scopes.py | doziya/hpeOneView | 107 | 1624855 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inc... | 0 | 0 | 0 | 0 | 0 | 0 |
lib-src/lv2/suil/waflib/extras/pep8.py | joshrose/audacity | 7,892 | 1624872 | <filename>lib-src/lv2/suil/waflib/extras/pep8.py<gh_stars>1000+
#! /usr/bin/env python
# encoding: utf-8
#
# written by <NAME>, 2011
'''
Install pep8 module:
$ easy_install pep8
or
$ pip install pep8
To add the pep8 tool to the waf file:
$ ./waf-light --tools=compat15,pep8
or, if you have waf >= 1.6.2
$ ./waf updat... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorboard/compat/__init__.py | Digitaltransform/tensorboard | 6,139 | 1624892 | <reponame>Digitaltransform/tensorboard<filename>tensorboard/compat/__init__.py<gh_stars>1000+
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_federated/python/simulation/checkpoint_manager_test.py | zhihansh/federated-oss | 1,918 | 1624895 | # Copyright 2019, The TensorFlow Federated 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 required by applicable law o... | 1 | 1 | 0 | 0 | 2 | 0 |
foursquare/tests/test_events.py | timgates42/foursquare | 235 | 1624927 | <filename>foursquare/tests/test_events.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# (c) 2020 <NAME>
import logging
log = logging.getLogger(__name__)
from . import BaseAuthenticatedEndpointTestCase, BaseUserlessEndpointTestCase
class EventsEndpointTestCase(BaseAuthenticatedEndpointTestCase):
"""
Genera... | 0 | 0 | 0 | 0 | 0 | 0 |
gmusicapi_scripts/gmdelete.py | dvirtz/gmusicapi-scripts | 225 | 1624951 | #!/usr/bin/env python3
# coding=utf-8
"""
A script to delete songs from your Google Music library using https://github.com/simon-weber/gmusicapi.
More information at https://github.com/thebigmunch/gmusicapi-scripts.
Usage:
gmdelete (-h | --help)
gmdelete [options] [-f FILTER]... [-F FILTER]...
Options:
-h, --h... | 0 | 0 | 0 | 0 | 0 | 0 |
pyinfra/api/connect.py | blarghmatey/pyinfra | 1,532 | 1624954 | <gh_stars>1000+
import gevent
import six
from pyinfra.progress import progress_spinner
def connect_all(state):
'''
Connect to all the configured servers in parallel. Reads/writes state.inventory.
Args:
state (``pyinfra.api.State`` obj): the state containing an inventory to connect to
'''
... | 0 | 0 | 0 | 0 | 0 | 0 |
deeppavlov/core/models/torch_model.py | techthiyanes/DeepPavlov | 5,893 | 1624956 | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... | 16 | 4 | 0 | 5 | 25 | 0 |
tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py | spawn08/sqlmodel | 5,490 | 1624961 | <filename>tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py
import importlib
import pytest
from fastapi.testclient import TestClient
from sqlmodel import Session
from docs_src.tutorial.fastapi.app_testing.tutorial001 import main as app_mod
from docs_src.tutorial.fastapi.app_testing.tutori... | 0 | 0 | 0 | 0 | 0 | 0 |
saleor/graphql/attribute/tests/queries/test_attributes_sort.py | fairhopeweb/saleor | 15,337 | 1624973 | <reponame>fairhopeweb/saleor
from typing import TYPE_CHECKING, Union
import graphene
import pytest
from .....attribute import AttributeType
from .....attribute.models import Attribute
from .....attribute.utils import associate_attribute_values_to_instance
from ....tests.utils import get_graphql_content
if TYPE_CHECK... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/st/func/optimizer/test_hyper_config.py | fapbatista/mindinsight | 216 | 1624975 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2 | 2 | 0 | 0 | 4 | 0 |
tutorials/use-cloud-pubsub-cloud-storage-app-engine/shared-photo-album-app/main.py | tjwebb/community | 1,723 | 1625033 | <filename>tutorials/use-cloud-pubsub-cloud-storage-app-engine/shared-photo-album-app/main.py
# Copyright 2017 Google, 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.ap... | 0 | 0 | 0 | 0 | 0 | 0 |
src/plotman/_tests/plotters/test_init.py | pieterhelsen/plotman | 1,016 | 1625042 | import importlib.resources
import pathlib
import typing
import attr
import click
import pytest
import _pytest
import plotman.errors
import plotman.job
import plotman.plotters
import plotman.plotters.bladebit
import plotman.plotters.chianetwork
import plotman.plotters.madmax
import plotman._tests.resources
@pytest.f... | 13 | 14 | 9 | 0 | 36 | 0 |
cosrlib/signals/dmoz_url.py | commonsearch/cosr-back | 141 | 1625078 | from __future__ import absolute_import, division, print_function, unicode_literals
from . import BaseSignal
class Signal(BaseSignal):
""" Ranking signal based on the URL presence in DMOZ
"""
def get_value(self, document, url_metadata) -> object:
return (
float(bool(url_metadata["url... | 0 | 1 | 0 | 0 | 1 | 0 |
platforms/picoevb.py | auscompgeek/litex-buildenv | 198 | 1625080 | from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform, VivadoProgrammer
_io = [
# SYS clock 100 MHz (input) signal. The sys_clk_p and sys_clk_n
# signals are the PCI Express reference clock.
#set_property PACKAGE_PIN B6 [get_ports sys_clk_p]
("clk100", 0, Pins("B6"), ... | 2 | 1 | 9 | 0 | 12 | 0 |
modules/dbnd/src/dbnd/_core/task_ctrl/task_output_builder.py | ipattarapong/dbnd | 224 | 1625081 | <filename>modules/dbnd/src/dbnd/_core/task_ctrl/task_output_builder.py
import logging
import os
import re
from targets.utils.path import no_trailing_slash
logger = logging.getLogger(__name__)
windows_drive_re = re.compile(r"^[A-Z]\:\\")
def calculate_path(task, name, path_pattern, output_ext="", is_dir=False):
... | 0 | 0 | 0 | 0 | 0 | 0 |
allennlp_semparse/state_machines/transition_functions/__init__.py | nitishgupta/allennlp-semparse | 105 | 1625098 | """
This module contains ``TransitionFunctions`` for state-machine-based decoders. The
``TransitionFunction`` parameterizes transitions between ``States``. These ``TransitionFunctions``
are all pytorch `Modules`` that have trainable parameters. The :class:`BasicTransitionFunction` is
simply an LSTM decoder with atte... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/catrank_pycapnp.py | BartWeyder/pycapnp | 188 | 1625100 | #!/usr/bin/env python
import capnp
import catrank_capnp
from common import rand_int, rand_double, rand_bool, WORDS
from random import choice
from string import ascii_letters
try:
# Python 2
from itertools import izip
except ImportError:
izip = zip
class Benchmark:
def __init__(self, compression):
... | 0 | 2 | 0 | 0 | 2 | 0 |
torchbenchmark/models/tts_angular/model.py | xuzhao9/benchmark | 384 | 1625102 | <filename>torchbenchmark/models/tts_angular/model.py<gh_stars>100-1000
import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
class LSTMWithProjection(nn.Module):
def __init__(self, input_size, hidden_size, proj_size):
super().__init__()
self.input_size = input_size
... | 0 | 0 | 0 | 0 | 0 | 0 |
custom_components/amcrest/sensor.py | sam-ward/homeassistant-config | 165 | 1625107 | """Suppoort for Amcrest IP camera binary sensors."""
from homeassistant.components.amcrest.sensor import *
| 0 | 0 | 0 | 0 | 0 | 0 |
server/perfkit/common/big_query_result_util_test.py | SMU-ATT-Center-for-Virtualization/PerfKitExplorer | 285 | 1625142 | """Copyright 2014 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 agreed to in ... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/accounts/migrations/0002_auto_20180404_0539.py | Twofyw/database-project-forum | 250 | 1625150 | # Generated by Django 2.0.3 on 2018-04-04 05:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('accounts', '0001_initial'),
]
operations: list[object] = [
migrations.AlterField(
model_name='userprofile... | 0 | 0 | 2 | 0 | 2 | 0 |
underworld/function/rheology.py | longgangfan/underworld2 | 116 | 1625172 | <gh_stars>100-1000
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the Underworld geophysics modelling application. ##
## ... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/balboa/config_flow.py | liangleslie/core | 30,023 | 1625173 | <filename>homeassistant/components/balboa/config_flow.py<gh_stars>1000+
"""Config flow for Balboa Spa Client integration."""
from __future__ import annotations
import asyncio
from typing import Any
from pybalboa import BalboaSpaWifi
import voluptuous as vol
from homeassistant import config_entries, exceptions
from h... | 0 | 0 | 0 | 0 | 0 | 0 |
pajbot/modules/chat_alerts/livealert.py | JoachimFlottorp/pajbot | 128 | 1625184 | import logging
from pajbot.managers.handler import HandlerManager
from pajbot.modules import BaseModule, ModuleSetting
from pajbot.modules.chat_alerts import ChatAlertModule
log = logging.getLogger(__name__)
class LiveAlertModule(BaseModule):
ID = __name__.split(".")[-1]
NAME: str = "Live Alert"
DESCRIP... | 0 | 0 | 5 | 0 | 5 | 0 |
CpuA64/assembler_tool.py | robertmuth/Cwerg | 171 | 1625198 | #!/usr/bin/python3
"""
Assembler produces A64 ELF executables
"""
import argparse
import os
import stat
import sys
from typing import Dict, Any
from CpuA64 import assembler as asm
def lint(input):
src = sys.stdin if input == "-" else open(input)
print("UNIT", asm.UnitParse(src, False))
def assemble_common... | 0 | 0 | 1 | 0 | 1 | 0 |
src/datapane/resources/__init__.py | philopon/datapane | 481 | 1625212 | # Copyright 2020 StackHut Limited (trading as Datapane)
# SPDX-License-Identifier: Apache-2.0
| 0 | 0 | 0 | 0 | 0 | 0 |
insta_video_downloader/instavideo.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 1625225 | <reponame>elishahyousaf/Awesome-Python-Scripts<filename>insta_video_downloader/instavideo.py<gh_stars>1000+
import urllib.request
import requests
import json
import re
import sys
def download(post_id):
multiple_posts = False
videos = []
data = requests.get("https://instagram.com/p/{}".format(post_... | 0 | 0 | 0 | 0 | 0 | 0 |
envs/env_summary_logger.py | amitport/A2C | 181 | 1625236 | from __future__ import annotations
import tensorflow as tf
class EnvSummaryLogger:
"""
Helper class to summarize all environments at the same time on the same plots.
"""
def __init__(self, sess, summary_dirs):
self.sess = sess
self.summary_writer = [tf.summary.FileWriter(summary_dirs[... | 4 | 0 | 0 | 3 | 7 | 0 |
qframer/ftablewidget.py | dragondjf/QMarkdowner | 115 | 1625240 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
from .qt.QtCore import *
from .qt.QtGui import *
class FDragRowsTableWidget(QTableWidget):
def __init__(self, rows=0, cloumns=2, parent=None):
super(FDragRowsTableWidget, self).__init__(rows, cloumns, parent)
self.parent = parent
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/express-route-cross-connection/azext_expressroutecrossconnection/profiles.py | Mannan2812/azure-cli-extensions | 207 | 1625241 | <reponame>Mannan2812/azure-cli-extensions
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils.py | scality/metalk8s | 255 | 1625259 | from __future__ import annotations
import functools
import ipaddress
import json
import logging
import re
import operator
import testinfra
import time
from typing import Optional, Dict
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import pytest
LOGG... | 16 | 18 | 0 | 0 | 34 | 0 |
Projects/Healthcare/breast-cancer/src/modeling/layers.py | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 3,266 | 1625297 | <reponame>DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
# Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
#... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/mock_app_debug.py | SatoshiIwasada/BlueDot | 112 | 1625365 | from bluedot import MockBlueDot
from time import sleep, time
mbd = MockBlueDot(auto_start_server = False)
def pressed(pos):
print("Pressed: x={} y={} angle={} distance={} middle={} top={} bottom={} left={} right={} time={}".format(pos.x, pos.y, pos.angle, pos.distance, pos.middle, pos.top, pos.bottom, pos.left, p... | 0 | 0 | 0 | 0 | 0 | 0 |
moto/ecs/__init__.py | gtourkas/moto | 5,460 | 1625375 | <filename>moto/ecs/__init__.py
from .models import ecs_backends
from ..core.models import base_decorator, deprecated_base_decorator
ecs_backend = ecs_backends["us-east-1"]
mock_ecs = base_decorator(ecs_backends)
mock_ecs_deprecated = deprecated_base_decorator(ecs_backends)
| 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_123.py | ksvr444/daily-coding-problem | 1,921 | 1625381 | <reponame>ksvr444/daily-coding-problem
def strip_neg(num):
if num[0] != '-':
return num
elif len(num) > 1:
return num[1:]
def is_valid_number_helper(string, dec):
if not string:
return True
char = string[0]
if (dec and char == '.') or (not char.isdigit() and char != '.'):
... | 0 | 0 | 0 | 0 | 0 | 0 |
pos_orderline_absolute_discount/models/pos_config_model.py | nahualventure/pos-addons | 183 | 1625395 | from odoo import fields, models
class PosConfig(models.Model):
_inherit: str = "pos.config"
include_discount_in_prices = fields.Boolean(
string="Include Discount in Prices",
help="If box is unchecked the displayed prices will not include discounts",
)
| 0 | 0 | 1 | 0 | 1 | 0 |
rdkit/Chem/Pharm3D/ExcludedVolume.py | kazuyaujihara/rdkit | 1,609 | 1625418 | #
# Copyright (C) 2004-2006 Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
class ExcludedVolume(object):
def __init__... | 1 | 0 | 0 | 1 | 2 | 0 |
prototype/aggregate_example.py | say-yam/PipelineDP | 198 | 1625425 | import datetime as dt
import os
import time
from absl import app
from absl import flags
import apache_beam as beam
from apache_beam.runners.portability import fn_api_runner
from budget_accounting import BudgetAccountant
from dataclasses import dataclass
from private_beam import DPEngine, BeamOperations, LocalOperatio... | 0 | 7 | 4 | 0 | 11 | 0 |
backdoors/shell/__pupy/pupy/modules/msgbox.py | mehrdad-shokri/backdoorme | 796 | 1625431 | <reponame>mehrdad-shokri/backdoorme<gh_stars>100-1000
# -*- coding: UTF8 -*-
from pupylib.PupyModule import *
__class_name__="MsgBoxPopup"
class MsgBoxPopup(PupyModule):
""" Pop up a custom message box """
def init_argparse(self):
self.arg_parser = PupyArgumentParser(prog="msgbox", description=self.__doc__)
se... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/mxnet/test_hook_custom_collection.py | NRauschmayr/sagemaker-debugger | 133 | 1625444 | # Standard Library
import shutil
from datetime import datetime
# First Party
from smdebug.mxnet import SaveConfig
from smdebug.mxnet.hook import Hook as t_hook
# Local
from .mnist_gluon_model import run_mnist_gluon_model
def test_hook_custom_collection():
save_config = SaveConfig(save_steps=[0, 1, 2, 3])
ru... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/animations/drumsolo.py | goodhertz/coldtype | 142 | 1625458 | from coldtype import *
from coldtype.fx.skia import phototype
audio = __sibling__("media/68.wav")
midi = Programs.Midi(__sibling__("media/68.mid"), text=0, bpm=151)
midi.hide()
@animation(timeline=midi.t, bg=hsl(0.4, 0.8, l=0.2), render_bg=1, audio=audio)
def drumsolo(f) -> object:
d = midi.t[0].fifve(f.i)
l... | 0 | 1 | 0 | 0 | 1 | 0 |
qiskit/providers/ibmq/backendreservation.py | yoshida-ryuhei/qiskit-ibmq-provider | 199 | 1625472 | <filename>qiskit/providers/ibmq/backendreservation.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licens... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mygrad/nnet/losses/margin_ranking_loss.py | kw-0/MyGrad | 147 | 1625475 | from numbers import Real
from typing import Optional
import numpy as np
import mygrad._utils.graph_tracking as _tracking
from mygrad.operation_base import Operation
from mygrad.tensor_base import Tensor, asarray
from mygrad.typing import ArrayLike
class MarginRanking(Operation):
def __call__(self, x1, x2, y, ma... | 5 | 3 | 0 | 0 | 8 | 0 |
utils/update_data.py | HanselD/aws-allowlister | 180 | 1625489 | <gh_stars>100-1000
#! /usr/bin/env python3
import os
import csv
import pandas as pd
import sys
from pathlib import Path
sys.path.append(str(Path(os.path.dirname(__file__)).parent))
from aws_allowlister.database.build import build_database
from aws_allowlister.database.database import connect_db
from aws_allowlister.dat... | 0 | 0 | 0 | 0 | 0 | 0 |
frille-lang/lib/python3.6/site-packages/immutables/_testutils.py | frillecode/CDS-spring-2021-language | 934 | 1625494 | <reponame>frillecode/CDS-spring-2021-language
class HashKey:
_crasher = None
def __init__(self, hash, name, *, error_on_eq_to=None):
assert hash != -1
self.name = name
self.hash = hash
self.error_on_eq_to = error_on_eq_to
def __repr__(self):
if self._crasher is not ... | 0 | 0 | 0 | 0 | 0 | 0 |
thespian/test/test_bigmessages.py | dendron2000/Thespian | 210 | 1625501 | import logging
import time, datetime
from thespian.test import *
from thespian.actors import *
askTimeout = datetime.timedelta(seconds=5)
class Whale(Actor):
def receiveMessage(self, msg, sender):
if isinstance(msg, tuple):
self.send(sender, msg[1] * msg[0])
class Shrimp(Actor):
def rece... | 0 | 0 | 0 | 0 | 0 | 0 |
python-reference-implementation/test/testshamirsecret.py | PolyPasswordHasher/PolyPasswordHasher | 286 | 1625502 | import shamirsecret
from unittest import TestCase
# Basic tests for this module. Should output nothing on success.
class TestShamirSecret(TestCase):
def test_math(self):
# first check some of the math...
self.assertTrue(shamirsecret._multiply_polynomials([1,3,4],[4,5]) == [4,9,31,20])
self.assertTrue... | 0 | 0 | 0 | 0 | 0 | 0 |
mp_sort/virtenv/lib/python3.6/site-packages/transcrypt/demos/pysteroids_demo/utils.py | ang-jason/fip_powerx_mini_projects-foxtrot | 2,200 | 1625550 | from __future__ import annotations
from org.transcrypt.stubs.browser import __pragma__
from org import threejs as three
def pad_wrap(min, max, val) -> object:
if val < min:
return max
if val > max:
return min
return val
XWRAP = 0
XNWRAP = 0
YWRAP = 0
YNWRAP = 0
def... | 3 | 7 | 0 | 4 | 14 | 0 |
SimG4CMS/Calo/python/hgcalHitIdCheck_cff.py | ckamtsikis/cmssw | 852 | 1625555 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from SimG4CMS.Calo.hgcalHitIdCheckEE_cfi import *
hgcalHitIdCheckHEF = hgcalHitIdCheckEE.clone(
nameDevice = cms.string("HGCal HE Silicon"),
nameSense = cms.string("HGCalHESiliconSensitive"),
caloHitSource = cms.string("HGCHitsHEfront"))... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/models/models.py | JackieZhai/TracKit | 567 | 1625564 | from __future__ import annotations
import math
import torch
import torch.nn as nn
from .ocean import Ocean_
from .oceanplus import OceanPlus_
from .oceanTRT import OceanTRT_
from .siamfc import SiamFC_
from .connect import box_tower, AdjustLayer, AlignHead, Corr_Up, MultiDiCorr, OceanCorr
from .backbones import ResNet5... | 34 | 14 | 1 | 2 | 51 | 0 |
onnx2pytorch/__init__.py | Creation-Labs-AI/onnx2pytorch | 546 | 1625575 | from .convert import ConvertModel
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/commands/new/test_validate_url.py | pybee/briefcase | 522 | 1625579 | import pytest
@pytest.mark.parametrize(
"url",
[
"https://example.com",
],
)
def test_valid_url(new_command, url):
"""Test that valid URLs are accepted."""
assert new_command.validate_url(url)
@pytest.mark.parametrize(
"url",
[
"not a URL!", # Free text.
],
)
def tes... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/backports/__init__.py | MrDelik/core | 30,023 | 1625580 | <filename>tests/backports/__init__.py
"""The tests for the backports."""
| 0 | 0 | 0 | 0 | 0 | 0 |
docker/oso-zabbix-server/src/zbx2slack.py | fahlmant/openshift-tools | 164 | 1625582 | <reponame>fahlmant/openshift-tools<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#pylint: disable=no-name-in-module
#pylint: disable=too-few-public-methods
#pylint: disable=too-many-instance-attributes
'''rst
zbx2slack-alert-notify.py
================================
Zabbix Alert Notification Script... | 0 | 0 | 0 | 0 | 0 | 0 |
Generative/train_VAE.py | ajbrock/Generative-and-Discriminative-Voxel-Modelling | 204 | 1625585 | ###
# Introspective Autoencoder Main training Function
# <NAME>, 2016
from __future__ import annotations
import argparse
import imp
import time
import logging
# import sys
# sys.path.insert(0, 'C:\Users\Andy\Generative-and-Discriminative-Voxel-Modeling')
import numpy as np
from path import Path
import theano
import ... | 0 | 3 | 0 | 0 | 3 | 0 |
src/UQpy/Surrogates/PCE/ErrorEstimation.py | marrov/UQpy | 132 | 1625591 | <filename>src/UQpy/Surrogates/PCE/ErrorEstimation.py
import numpy as np
class ErrorEstimation:
"""
Class for estimating the error of a PCE surrogate, based on a validation
dataset.
**Inputs:**
* **surr_object** ('class'):
Object that defines the surrogate model.
**Methods:**
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
mpylib/example_write_mpy.py | AEMICS/pycopy-lib | 126 | 1625604 | import mpylib
import opcode
import ulogging
ulogging.basicConfig(level=ulogging.DEBUG)
opcode.config.MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE = 1
op = mpylib.get_opcode_ns()
with open("testout.mpy", "wb") as f:
mpy = mpylib.MPYWriter(f)
mpy.write_header(
mpylib.MPY_VERSION,
mpylib.MICROPY_P... | 0 | 0 | 0 | 0 | 0 | 1 |
tools/frames_to_video.py | voldemortX/pytorch-auto-drive | 292 | 1625609 | # Modified from open-mmlab/mmcv
import os
import cv2
from cv2 import VideoWriter_fourcc
from mmcv.utils import check_file_exist, mkdir_or_exist, scandir, track_progress
def frames2video(frame_dir,
video_file,
file_names,
fps: int=20,
fourcc: str='XVI... | 3 | 0 | 0 | 0 | 3 | 0 |
atomic_reactor/utils/imageutil.py | qixiang/atomic-reactor | 113 | 1625629 | <gh_stars>100-1000
"""
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import functools
import subprocess
import logging
import tarfile
import json
from typing import Optional, Union, Dict, Li... | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/CONSTRUCT_LEXICOGRAPHICALLY_SMALLEST_PALINDROME.py | mxl1n/CodeGen | 241 | 1625630 | <reponame>mxl1n/CodeGen
# 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 ( string , l ) :
string = list ( string )
i = - 1
j = l
while i < j :
... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter05/face_detection_video.py | ankona/Learning-OpenCV-4-Computer-Vision-with-Python-Third-Edition | 286 | 1625635 | <filename>chapter05/face_detection_video.py
import cv2
face_cascade = cv2.CascadeClassifier(
'./cascades/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier(
'./cascades/haarcascade_eye.xml')
camera = cv2.VideoCapture(0)
while (cv2.waitKey(1) == -1):
success, frame = camera.read()
... | 0 | 0 | 0 | 0 | 0 | 0 |
p2m/models.py | SeanLi-OI/Pixel2Mesh | 1,273 | 1625638 | # Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, Fudan University
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in... | 0 | 0 | 0 | 0 | 0 | 0 |
pcn/__init__.py | quickgrid/pytorch-PCN | 109 | 1625656 | from .api import nets
from .api import detect
from .api import draw
from .api import crop
from .api import show | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/_compat_pickle.py | masamitsu-murase/stackless | 854 | 1625657 | # This module is used to map the old Python 2 names to the new names used in
# Python 3 for the pickle module. This needed to make pickle streams
# generated with Python 2 loadable by Python 3.
# This is a copy of lib2to3.fixes.fix_imports.MAPPING. We cannot import
# lib2to3 and use the mapping defined there, becaus... | 0 | 0 | 0 | 0 | 0 | 0 |
src/win/RT10yy_efuseWin_Lock.py | ufo2011/NXP-MCUBootUtility | 174 | 1625679 | # -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Aug 8 2018)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
py/DV/riscv/trees/csr_trees.py | Wlgen/force-riscv | 111 | 1625751 | <filename>py/DV/riscv/trees/csr_trees.py
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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/licen... | 0 | 0 | 0 | 0 | 0 | 0 |
core/plugins.py | rikbarker/watcher | 194 | 1625753 | <reponame>rikbarker/watcher
import core
import json
import os
import sys
import operator
import subprocess
import threading
import logging
logging = logging.getLogger(__name__)
class Plugins(object):
def added(self, *args):
# title, year, imdbid, quality
plugin_dir = os.path.join(core.PROG_PATH... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/python/win_unicode_console/win_unicode_console/buffer.py | jochenater/catboost | 6,989 | 1625774 |
import ctypes
from ctypes import (byref, POINTER, pythonapi,
c_int, c_char, c_char_p, c_void_p, py_object, c_ssize_t)
from .info import PY2
c_ssize_p = POINTER(c_ssize_t)
PyObject_GetBuffer = pythonapi.PyObject_GetBuffer
PyBuffer_Release = pythonapi.PyBuffer_Release
PyBUF_SIMPLE = 0
PyBUF_WRITAB... | 1 | 2 | 1 | 0 | 4 | 0 |
examples/twitter/run_example.py | Walicen/peewee | 8,289 | 1625790 | #!/usr/bin/env python
import sys
sys.path.insert(0, '../..')
from app import app, create_tables
create_tables()
app.run()
| 0 | 0 | 0 | 0 | 0 | 0 |
config.py | aliyun/alibabacloud-quantization-networks | 102 | 1625792 | <filename>config.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
# gets home dir cross platform
HOME = os.path.expanduser("~")
QW_values = {
'alexnet-w-1': [-1, 0, 1], 'alexnet-w-2': [-1, 0, 1], 'alexnet-w-3-pm2': [-2, -1, 0, 1, 2], 'alexnet-w-3-pm4': [-4, -2, -1, 0, 1, 2, 4],
'resnet18-w-1': [-1, 0... | 0 | 0 | 0 | 0 | 0 | 0 |
src/blade/cu_targets.py | chen3feng/typhoon-blade | 817 | 1625839 | # Copyright (c) 2013 Tencent Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
# Created: September 27, 2013
from __future__ import annotations
"""
This module defines cu_library, cu_binary and cu_test rules
for cuda development.
"""
from __future__ import absolute_import
from __future__ import print_functi... | 35 | 5 | 0 | 1 | 41 | 0 |
Code/knn.py | harismuneer/Handwritten-Digits-Classification | 133 | 1625857 | from mnist import MNIST
import numpy as np
import math
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.metrics import accuracy_score
from collections import Counter
import matplotlib.pyplot as plt
import time
# --------------------------------------------------------
# Global Variables
training... | 0 | 3 | 0 | 0 | 3 | 0 |
test.py | om-nayak/pypdftk | 116 | 1625860 | <reponame>om-nayak/pypdftk
# -*- encoding: UTF-8 -*-
import os
import unittest
import json
from tempfile import mkdtemp
# Needed for comparison of XFDF XML
import xml.etree.ElementTree as ET
import pypdftk
TEST_PDF_PATH = 'test_files/python-guide.pdf'
TEST_XPDF_PATH = 'test_files/form.pdf'
TEST_XPDF_DATA_DUMP = 'test... | 0 | 0 | 0 | 0 | 0 | 0 |
src/beanmachine/ppl/compiler/performance_report.py | horizon-blue/beanmachine-1 | 177 | 1625925 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json as json_
from typing import Any, Optional
from beanmachine.ppl.compiler.profiler import event_list_to_report
class Performanc... | 3 | 4 | 1 | 0 | 8 | 0 |
tools/c7n_azure/tests_azure/test_provider.py | al3pht/cloud-custodian | 2,415 | 1625965 | <gh_stars>1000+
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .azure_common import BaseTest, DEFAULT_SUBSCRIPTION_ID
from mock import patch
from c7n_azure.provider import Azure
from c7n.config import Config
from msrestazure.azure_cloud import (AZURE_CHINA_CLOUD, AZURE_GERMAN_CLOUD,... | 0 | 0 | 0 | 0 | 0 | 0 |
build/packages/prebuilt_package.py | wwjiang007/fuchsia-1 | 210 | 1626037 | #!/usr/bin/env python3.8
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import os
import shutil
import subprocess
import sys
def extract(pm, far_path, workdir):
if not os.... | 0 | 1 | 0 | 0 | 1 | 0 |
aleph/views/profiles_api.py | Rosencrantz/aleph | 1,213 | 1626046 | import logging
from flask import Blueprint, request
from followthemoney import model
from followthemoney.compare import compare
from aleph.settings import MAX_EXPAND_ENTITIES
from aleph.model import Judgement
from aleph.logic.profiles import get_profile, decide_pairwise
from aleph.logic.expand import entity_tags, expa... | 0 | 5 | 0 | 0 | 5 | 0 |
Stock_Data/basic_stock_data.py | vhn0912/Finance | 441 | 1626049 | from pandas_datareader import DataReader
import numpy as np
import pandas as pd
import datetime
# Grab time series data for 5-year history for the stock (here AAPL)
# and for S&P-500 Index
start_date = datetime.datetime.now() - datetime.timedelta(days=1826)
end_date = datetime.date.today()
stock = 'MSFT'
i... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/filters.py | stackriot/flocker | 2,690 | 1626054 | # Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Filters for Sphinx.
A separate module than conf.py so that Sphinx can pickle instances of classes
defined here.
"""
from characteristic import attributes
from enchant.tokenize import Filter
# See http://doughellmann.com/2011/05/26/creating-a-spelling-ch... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/issues/issue324.py | tgolsson/appJar | 666 | 1626069 | <filename>examples/issues/issue324.py
import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
if btn == "UP": app.increaseFont()
elif btn == "DOWN": app.decreaseFont()
elif btn == "MEUP": app.setTabFont("tabs", **style)
elif btn == "MEDOWN": app.decreaseFont()
with gui("TabTest") a... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extract閒人ONLINE.py | fake-name/ReadableWebProxy | 193 | 1626110 | <reponame>fake-name/ReadableWebProxy<gh_stars>100-1000
def extract閒人ONLINE(item):
"""
閒人 • O N L I N E
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'Great Tang Idyll' in item['tags']:
return buil... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/rlbot/agents/base_scratch_agent.py | VirxEC/RLBot | 408 | 1626111 | <filename>src/main/python/rlbot/agents/base_scratch_agent.py
import os
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.base_independent_agent import BaseIndependentAgent
from rlbot.botmanager import scratch_manager
from rlbot.botmanager.helper_process_request import HelperProcessRequest
f... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/fewshot_exp/datasets/voc_create_base.py | JunhoPark0314/DCNet | 120 | 1626126 | <gh_stars>100-1000
from maskrcnn_benchmark.data.datasets.voc import PascalVOCDataset
from collections import OrderedDict
import sys
#split = int(sys.argv[1])
for split in range(1, 4):
for year in ["07", "12"]:
dataset = PascalVOCDataset('datasets/voc/VOC20%s'%year, 'trainval')
keeps = []
all... | 0 | 0 | 0 | 0 | 0 | 0 |
uva/10114.py | Ashindustry007/competitive-programming | 506 | 1626131 | #!/usr/bin/env python3
# https://uva.onlinejudge.org/external/101/10114.pdf
while True:
[m, d, l, n] = input().split()
[m, n] = map(int, [m, n])
if m < 0: break
dep = dict()
for i in range(n):
[a, b] = input().split()
dep[int(a)] = float(b)
[d, l] = map(float, [d, l])
value =... | 0 | 0 | 0 | 0 | 0 | 0 |
podman/client.py | kevinwylder/podman-py | 106 | 1626148 | <filename>podman/client.py
"""Client for connecting to Podman service."""
import logging
import os
from contextlib import AbstractContextManager
from pathlib import Path
from typing import Any, Dict, Optional
import xdg.BaseDirectory
from podman.api import cached_property
from podman.api.client import APIClient
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/core/results_processor/__init__.py | zealoussnow/chromium | 14,668 | 1626159 | <reponame>zealoussnow/chromium
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core.results_processor.command_line import ArgumentParser
from core.results_processor.command_line import ProcessOptions
... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py | dupontz/libcloud | 1,435 | 1626167 | from pprint import pprint
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
# Import the deployment specific modules
from libcloud.compute.deployment import ScriptDeployment
from libcloud.compute.deployment import MultiStepDeployment
cls = get_driver(Provider.EXOSCALE)
dri... | 0 | 0 | 0 | 0 | 0 | 0 |
facepy/exceptions.py | loftwah/facepy | 623 | 1626211 | from __future__ import annotations
class FacepyError(Exception):
"""Base class for exceptions raised by Facepy."""
class FacebookError(FacepyError):
"""Exception for Facebook errors."""
def __init__(self, message: object | None=None, code: object | None=None, error_data: object | None=None, error_subcode:... | 8 | 0 | 0 | 0 | 8 | 0 |
doc/python_api/examples/gpu.1.py | rbabari/blender | 116 | 1626213 | """
Geometry Batches
++++++++++++++++
Geometry is drawn in batches.
A batch contains the necessary data to perform the drawing.
That includes an obligatory *Vertex Buffer* and an optional *Index Buffer*,
each of which is described in more detail in the following sections.
A batch also defines a draw type.
Typical draw... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_steps.py | goneri/ansible-builder | 171 | 1626278 | import pytest
import textwrap
from ansible_builder.steps import AdditionalBuildSteps
@pytest.mark.parametrize('verb', ['prepend', 'append'])
def test_additional_build_steps(verb):
additional_build_steps = {
'prepend': ["RUN echo This is the prepend test", "RUN whoami"],
'append': textwrap.dedent(... | 0 | 0 | 0 | 0 | 0 | 0 |
mods/Verification.py | waffle620/fagyhal | 494 | 1626284 | from __future__ import annotations
import discord
import asyncio
import random
import steam
from steam.steamid import SteamId
from steam.steamprofile import SteamProfile
from steam.steamaccountuniverse import SteamAccountUniverse
from steam.steamaccounttype import SteamAccountType
from discord.ext import commands
from ... | 6 | 9 | 0 | 0 | 15 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.