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 |
|---|---|---|---|---|---|---|---|---|---|---|
src/backend/api/handlers/tests/update_event_alliances_test.py | bovlb/the-blue-alliance | 266 | 3244638 | import json
from typing import Dict, List, Optional
from google.appengine.ext import ndb
from werkzeug.test import Client
from backend.api.trusted_api_auth_helper import TrustedApiAuthHelper
from backend.common.consts.auth_type import AuthType
from backend.common.consts.event_type import EventType
from backend.common... | 11 | 11 | 3 | 0 | 25 | 0 |
securityheaders/models/cors/exposeheaders/accesscontrolexposeheadersdirective.py | th3cyb3rc0p/securityheaders | 151 | 3244663 | from securityheaders.models.cors import CORSDirective
from securityheaders.models.annotations import *
@anydirective
class AccessControlExposeHeadersDirective(CORSDirective):
@classmethod
def isDirective(cls, directive) -> object:
""" Checks whether a given string is a directive
Args:
... | 0 | 1 | 0 | 0 | 1 | 0 |
insights/parsers/qemu_xml.py | lhuett/insights-core | 121 | 3244714 | from __future__ import annotations
"""
QemuXML - file ``/etc/libvirt/qemu/*.xml`` and ``/var/run/libvirt/qemu/*.xml``
==============================================================================
Parsers provided by this module are:
QemuXML - file ``/etc/libvirt/qemu/*.xml``
-----------------------------------------... | 0 | 1 | 0 | 0 | 1 | 0 |
tests_app/tests/functional/mixins/detail_serializer_mixin/views.py | sanjaymsh/drf-extensions | 1,172 | 3244719 | from rest_framework import viewsets
from rest_framework_extensions.mixins import DetailSerializerMixin
from .models import Comment
from .serializers import CommentSerializer, CommentDetailSerializer
class CommentViewSet(DetailSerializerMixin, viewsets.ReadOnlyModelViewSet):
serializer_class = CommentSerializer
... | 0 | 1 | 0 | 0 | 1 | 0 |
sbin/db_cpe_browser.py | AlexFaraino/cve-search | 377 | 3244723 | <filename>sbin/db_cpe_browser.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Importing CPE entries in a Redis database to improve lookup
#
# Until now, this part is only used by the web interface to improve response time
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 20... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/test_replica_can_become_leader/test.py | pdv-ru/ClickHouse | 15,577 | 3244730 | <reponame>pdv-ru/ClickHouse
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', main_configs=['configs/notleader.xml'], with_zookeeper=True)
node2 = cluster.add_instance('node2', main_co... | 0 | 0 | 0 | 0 | 0 | 0 |
sources/scraper/firmware/spiders/ubiquiti.py | Canti17/FirmAE | 226 | 3244761 | from scrapy import Spider
from scrapy.http import Request
from firmware.items import FirmwareImage
from firmware.loader import FirmwareLoader
import json
import urlparse
class UbiquitiSpider(Spider):
name: str = "ubiquiti"
allowed_domains: list[str] = ["ubnt.com"]
start_urls: list[str] = ["http://www.ub... | 0 | 0 | 3 | 0 | 3 | 0 |
instagram/json_import.py | mendonberry/ingstagrams | 1,982 | 3244792 | <filename>instagram/json_import.py
try:
import simplejson
except ImportError:
try:
import json as simplejson
except ImportError:
try:
from django.utils import simplejson
except ImportError:
raise ImportError('A json library is required to use this python libra... | 0 | 0 | 0 | 0 | 0 | 0 |
python/craftassist/ttad/generation_dialogues/generate_utils.py | satyamedh/craftassist | 626 | 3244805 | from __future__ import annotations
"""
Copyright (c) Facebook, Inc. and its affiliates.
This file contains utility functions used for the generation pipeline.
"""
import random
import re
ABERRANT_PLURAL_MAP = {
"appendix": "appendices",
"barracks": "barracks",
"cactus": "cacti",
"child": "children",
... | 4 | 11 | 1 | 0 | 16 | 0 |
rpython/jit/backend/aarch64/arch.py | nanjekyejoannah/pypy | 333 | 3244897 | <filename>rpython/jit/backend/aarch64/arch.py
WORD = 8
# The stack contains the force_index and the, callee saved registers and
# ABI required information
# All the rest of the data is in a GC-managed variable-size "frame".
# This jitframe object's address is always stored in the register FP
# A jitframe is a jit.bac... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/subscribe_indicate_thermometer_sample.py | guillempages/pygatt | 504 | 3244898 | """
samples.subscribe_indicate_thermometer_sample
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an example of subscribing to an indicate property of a
characteristic. This example was tested with the Health Thermometer Profile,
but can be easily modified to work with any other profile.
"""
... | 0 | 1 | 0 | 0 | 1 | 0 |
generate_data/get_resize_aligned_allBP4D.py | affromero/AUNets | 132 | 3244900 | <gh_stars>100-1000
import os
import numpy as np
import matlab.engine
import matlab
import datetime
import tqdm
import glob
# from joblib import Parallel, delayed
# import multiprocessing
# num_cores = multiprocessing.cpu_count()
class Get_Faces():
def __init__(self):
pwd = os.getcwd()
os.chdir('t... | 0 | 0 | 0 | 0 | 0 | 0 |
unicorefuzz/angr_harness.py | ssdemajia/unicorefuzz | 274 | 3244902 | <filename>unicorefuzz/angr_harness.py
#!/usr/bin/env python3
"""
Harness to do Symbolic Execution.
"""
import argparse
from typing import Tuple, Callable, List
import angr
import claripy
from angr.concretization_strategies import SimConcretizationStrategy
from angr.engines.vex.ccall import amd64g_check_ldmxcsr
from a... | 0 | 0 | 0 | 0 | 0 | 0 |
work_groups/apps.py | Manny27nyc/pythondotorg | 911 | 3244904 | from django.apps import AppConfig
class WorkGroupsAppConfig(AppConfig):
name: str = 'work_groups'
| 0 | 0 | 1 | 0 | 1 | 0 |
contrib/pyln-client/tests/test_units.py | Bladez1753/lightning | 2,288 | 3244921 | <reponame>Bladez1753/lightning
from pyln.client import Millisatoshi
import pytest # type: ignore
def test_to_approx_str():
amount = Millisatoshi('10000000sat')
assert amount.to_approx_str() == "0.1btc"
amount = Millisatoshi('1000000sat')
assert amount.to_approx_str() == "0.01btc"
amount = Millisa... | 0 | 0 | 0 | 0 | 0 | 0 |
src/chapter-2/invoke_via_main.py | luizyao/pytest-chinese-doc | 283 | 3244922 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
Author: <NAME> (<EMAIL>)
Created Date: 2019-09-27 16:33:39
-----
Last Modified: 2019-09-27 17:18:26
Modified By: <NAME> (<EMAIL>)
-----
THIS PROGRAM IS FREE SOFTWARE, IS LICENSED UNDER MIT.
A short and simple permissive license with conditions
only requiring preservati... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/appveyor.py | mahmuuud/pip-accel | 163 | 3244926 | <reponame>mahmuuud/pip-accel
# Simple Python script that helps to understand the AppVeyor environment.
#
# Author: <NAME> <<EMAIL>>
# Last Change: November 11, 2015
# URL: https://github.com/paylogic/pip-accel
"""Introspection of the AppVeyor CI environment ..."""
# Standard library modules.
import os
# External dep... | 0 | 0 | 0 | 0 | 0 | 0 |
rlschool/liftsim/environment/mansion/mansion_manager.py | ANCL/QuadPPO | 169 | 3244993 | <gh_stars>100-1000
# Copyright (c) 2018 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
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxr/tests/ShowIsisSpfLog/cli/equal/golden_output_2_expected.py | balmasea/genieparser | 204 | 3245000 |
expected_output = {
"instance": {
"1": {
"address_family": {
"IPv4 Unicast": {
"spf_log": {
1: {
"start_timestamp": "Thurs Aug 19 2004 12:00:50.787",
"level": 1,
... | 0 | 0 | 0 | 0 | 0 | 0 |
care/facility/migrations/0002_auto_20200319_1244.py | tucosaurus/care | 189 | 3245035 | <gh_stars>100-1000
# Generated by Django 2.2.11 on 2020-03-19 12:44
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AU... | 0 | 0 | 0 | 0 | 0 | 0 |
eagle-external/hadoop_jmx_collector/lib/kafka-python/example.py | phenixmzy/apache-eagle-0.5 | 322 | 3245037 | #!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/data/expected/parser/openapi/openapi_parser_parse_alias/__init__.py | stevesimmons/datamodel-code-generator | 891 | 3245062 | from __future__ import annotations
from datetime import date, datetime
from enum import Enum
from typing import List, Optional
from pydantic import BaseModel, Field, conint
from . import model_s
class Pet(Enum):
ca_t: str = 'ca-t'
dog_: str = 'dog*'
class Error(BaseModel):
code: int
message: str
... | 0 | 0 | 22 | 0 | 22 | 0 |
packages/syft/src/syft/proto/core/tensor/tensor_pb2.py | vishalbelsare/PySyft | 8,428 | 3245089 | <filename>packages/syft/src/syft/proto/core/tensor/tensor_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/core/tensor/tensor.proto
"""Generated protocol buffer code."""
# third party
from google.protobuf import descriptor as _descriptor
from google.protobuf impo... | 0 | 0 | 0 | 0 | 0 | 0 |
fireworks/features/tests/test_introspect.py | jmmshn/fireworks | 251 | 3245098 | <reponame>jmmshn/fireworks<gh_stars>100-1000
import unittest
from fireworks.features.introspect import flatten_to_keys, separator_str
__author__ = "<NAME> <<EMAIL>>"
class IntrospectTest(unittest.TestCase):
def test_flatten_dict(self):
self.assertEqual(
set(flatten_to_keys({"d": {"e": {"f": ... | 0 | 0 | 0 | 0 | 0 | 0 |
yotta/lib/folders.py | headlessme/yotta | 176 | 3245105 | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# !!! FIXME: there are now multiple .py files that contain platform dependent
# code and conditions such as 'if os.name == "nt"' Ideally, all these platform
# dependent function would live in an OS abstracti... | 0 | 5 | 0 | 0 | 5 | 0 |
general/using-google-translate-api/translate_doc.py | caesarcc/python-code-tutorials | 1,059 | 3245112 | <filename>general/using-google-translate-api/translate_doc.py<gh_stars>1000+
from googletrans import Translator
import argparse
import os
# init the translator
translator = Translator()
def translate(text, src="auto", dest="en"):
"""Translate `text` from `src` language to `dest`"""
return translator.translate... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576926_Test_byt2str_Module/recipe-576926.py | tdiprima/code | 2,023 | 3245123 | import byt2str
import unittest
from test import support
class ConvertTest(unittest.TestCase):
def test_min(self):
# Check that the "convert" min range is correct.
self.assertEqual(byt2str.convert(1), '1 Byte')
with self.assertRaises(AssertionError):
byt2str.convert(0)
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/chromite/lib/build_time_stats_unittest.py | zipated/src | 2,151 | 3245127 | <reponame>zipated/src
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for boolparse_lib methods."""
from __future__ import print_function
import datetime
import S... | 0 | 0 | 0 | 0 | 0 | 0 |
testcontainers/oracle.py | singerjess/testcontainers-python | 465 | 3245138 | from testcontainers.core.generic import DbContainer
class OracleDbContainer(DbContainer):
"""
Oracle database container.
Example
-------
::
with OracleDbContainer():
e = sqlalchemy.create_engine(oracle.get_connection_url())
result = e.execute("select 1 from dual")... | 1 | 1 | 0 | 1 | 3 | 0 |
grr/client/grr_response_client/unprivileged/test_lib.py | khanhgithead/grr | 4,238 | 3245143 | #!/usr/bin/env python
# pylint: mode=test
from absl.testing import flagsaver
from grr_response_core.lib import config_lib
from grr_response_core.lib.util import temp
def SetUpDummyConfig():
with temp.AutoTempFilePath(suffix="yaml") as dummy_config_path:
with flagsaver.flagsaver(config=dummy_config_path):
... | 0 | 0 | 0 | 0 | 0 | 0 |
dynamo/plot/space.py | aristoteleo/dynamo-release | 236 | 3245150 | from __future__ import annotations
import numpy as np
from typing import Union
import anndata
from .scatters import (
scatters,
docstrings,
)
from ..tl import compute_smallest_distance
from ..dynamo_logger import main_critical, main_info, main_finish_progress, main_log_time, main_warning
docstrings.delete_par... | 15 | 1 | 0 | 0 | 16 | 0 |
Language Skills/Python/Unit 02 Strings and Console Output/02 Date and Time/1-The datetime Library.py | rhyep/Python_tutorials | 346 | 3245177 | from datetime import datetime
print datetime.datetime
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/test_vcs_bazaar.py | rogerhil/pip | 7,089 | 3245215 | """
Contains functional tests of the Bazaar class.
"""
import os
import sys
import pytest
from pip._internal.vcs.bazaar import Bazaar
from pip._internal.vcs.versioncontrol import RemoteNotFoundError
from tests.lib import is_bzr_installed, need_bzr
@pytest.mark.skipif(
sys.platform == "win32" or "CI" not in os.... | 0 | 0 | 0 | 0 | 0 | 0 |
causalml/optimize/__init__.py | rainfireliang/causalml | 2,919 | 3245222 | from .policylearner import PolicyLearner
from .unit_selection import CounterfactualUnitSelector
from .utils import get_treatment_costs, get_actual_value, get_uplift_best
from .value_optimization import CounterfactualValueEstimator
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/bencodepy/encode.py | 0x20Man/Watcher3 | 320 | 3245241 | <reponame>0x20Man/Watcher3
from . import EncodingError
from collections import OrderedDict
def encode(obj, encoding='utf-8', strict=True):
coded_byte_list = []
def __encode_str(s: str) -> None:
"""Converts the input string to bytes and passes it the __encode_byte_str function for encoding."""
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter04/accept_by_input_file.py | add54/ADMIN_SYS_PYTHON | 116 | 3245246 | i = open('sample.txt','r')
o = open('sample_output.txt','w')
a = i.read()
o.write(a)
| 0 | 0 | 0 | 0 | 0 | 0 |
icssploit/modules/creds/__init__.py | reanimat0r/isf | 845 | 3245273 | <reponame>reanimat0r/isf<gh_stars>100-1000
__author__ = 'fwkz'
| 0 | 0 | 0 | 0 | 0 | 0 |
IOMC/EventVertexGenerators/python/VtxSmearedFlat_cfi.py | ckamtsikis/cmssw | 852 | 3245284 | import FWCore.ParameterSet.Config as cms
from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import FlatVtxSmearingParameters,VtxSmearedCommon
VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator",
FlatVtxSmearingParameters,
VtxSmearedCommon
)
| 0 | 0 | 0 | 0 | 0 | 0 |
pisloader/wekby_dns.py | dgh2466/public_tools | 647 | 3245317 | <gh_stars>100-1000
#!/usr/bin/env python
# Fake DNS Server to be used against a pisloader sample. The server will
# respond with a randomly selected command from the list of supported
# responses. Please note that the IP and TARGETED_DOMAIN variables must be set
# below.
import socket, base64, random
from dnslib i... | 0 | 0 | 0 | 0 | 0 | 0 |
python/997_Find_The_Town_Judge.py | dvlpsh/leetcode-1 | 4,416 | 3245370 | class Solution:
def findJudge(self, N: int, trust: List[List[int]]) -> int:
if N==1:
return 1
d1={}
d2={}
for i, j in trust:
if j in d1:
d1[j]+=1
else:
d1[j]=1
if i in d2:
d2[i]+=1
... | 2 | 1 | 0 | 0 | 3 | 0 |
recipes/Python/572160_HTMLCSS_to_PDF_converter/recipe-572160.py | tdiprima/code | 2,023 | 3245376 | <gh_stars>1000+
import cStringIO
import ho.pisa as pisa
import os
# Shortcut for dumping all logs on screen
pisa.showLogging()
def HTML2PDF(data, filename, open=False):
"""
Simple test showing how to create a PDF file from
PML Source String. Also shows errors and tries to start
the resulting PDF
... | 0 | 0 | 0 | 0 | 0 | 0 |
code_examples/popart/block_sparse/examples/sparse_softmax/sparse_grouped_softmax_subblock_demo.py | payoto/graphcore_examples | 260 | 3245378 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import numpy as np
import scipy as sp
from scipy import sparse
import os
import ctypes
import popart
so_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"../../custom_ops.so")
ctypes.cdll.LoadLibrary(so_p... | 0 | 0 | 0 | 0 | 0 | 0 |
scrubadub/detectors/catalogue.py | datascopeanalytics/scrubadub | 190 | 3245417 | <gh_stars>100-1000
import inspect
import catalogue
from typing import Type, Optional, Union, TYPE_CHECKING
if TYPE_CHECKING:
from scrubadub.detectors import Detector
detector_catalogue = catalogue.create('scrubadub', 'detectors', entry_points=True)
def register_detector(detector: Type['Detector'], *, autoload:... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/expandTemplate.py | digitalsatori/sketch-n-sketch | 565 | 3245435 | #!/usr/bin/env python
#
# Needs to be Python 3
import sys
import io
from littleReader import *
from leoReader import *
if len(sys.argv) < 2 or len(sys.argv) > 3:
print("Usage: expandTemplate.py BASENAME [SOURCEFOLDER]")
sys.exit()
base = sys.argv[1]
baseTemplate = base + 'Template.elm'
baseGenerated = base + 'Ge... | 0 | 0 | 0 | 0 | 0 | 0 |
rpglib/__init__.py | hawson/rpg-text | 162 | 3245455 | from rpglib.game import Game
| 0 | 0 | 0 | 0 | 0 | 0 |
gamestonk_terminal/economy/cnn_model.py | Aerex/GamestonkTerminal | 1,835 | 3245512 | """ CNN Model """
__docformat__ = "numpy"
from typing import Tuple
import matplotlib.pyplot as plt
from fear_greed_index.CNNFearAndGreedIndex import CNNFearAndGreedIndex
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
def get_feargreed_report(indicator: str, fig: plt.fig... | 2 | 1 | 0 | 0 | 3 | 0 |
deployment/Triton/models/mednist_class/1/model.py | tommydino93/tutorials | 535 | 3245520 | <reponame>tommydino93/tutorials
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# n... | 0 | 0 | 0 | 0 | 0 | 0 |
h8mail/__main__.py | 4jinetes/h8mail | 2,463 | 3245526 | import sys
from .utils.run import main
if __name__ == "__main__":
# Check major and minor python version
if sys.version_info[0] < 3:
sys.stdout.write(
"\n/!\\ h8mail requires Python 3.6+ /!\\\nTry running h8mail with python3 if on older systems\n\neg: python --version\neg: python3 h8mail v ... | 0 | 0 | 0 | 0 | 0 | 0 |
deepmoji/filter_input.py | ccivit/DeepMoji | 1,401 | 3245546 | <gh_stars>1000+
from __future__ import print_function, division
import codecs
import csv
import numpy as np
from emoji import UNICODE_EMOJI
def read_english(path="english_words.txt", add_emojis=True):
# read english words for filtering (includes emojis as part of set)
english = set()
with codecs.open(path... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/test_lookahead.py | zmxdream/Paddle | 17,085 | 3245569 | <gh_stars>1000+
# 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
#
# Unles... | 0 | 0 | 0 | 0 | 0 | 0 |
common/src/stack/command/stack/commands/disable/repo/__init__.py | sammeidinger/stack | 123 | 3245575 | <reponame>sammeidinger/stack
# @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
from stack.argument_processors.box import BoxArgProcessor
from stack.argument_processors.repo import RepoArgProcess... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/documents/utils.py | bonitobonita24/Mayan-EDMS | 343 | 3245591 | <gh_stars>100-1000
import logging
import pycountry
from django.utils.translation import ugettext_lazy as _
from .settings import setting_language_codes
logger = logging.getLogger(name=__name__)
def get_language(language_code):
language = getattr(
pycountry.languages.get(alpha_3=language_code), 'name',... | 0 | 0 | 0 | 0 | 0 | 0 |
FWCore/Integration/test/testProcessBlockMergeOfMergedFiles2_cfg.py | Purva-Chaudhari/cmssw | 852 | 3245601 | import FWCore.ParameterSet.Config as cms
# Intentionally reversing the order of process names in this series
process = cms.Process("PROD1")
process.options = cms.untracked.PSet(
numberOfStreams = cms.untracked.uint32(1),
numberOfConcurrentRuns = cms.untracked.uint32(1),
numberOfConcurrentLuminosityBlocks ... | 0 | 0 | 0 | 0 | 0 | 0 |
tekore/_model/episode.py | evanofslack/tekore | 135 | 3245607 | <gh_stars>100-1000
from typing import List, Optional
from dataclasses import dataclass
from .base import Item
from .show import SimpleShow
from .paging import OffsetPaging
from .member import Image, ReleaseDatePrecision
from .serialise import Model, ModelList, Timestamp
@dataclass(repr=False)
class ResumePoint(Model... | 0 | 0 | 0 | 0 | 0 | 0 |
cx_Freeze/samples/pydantic/setup.py | TechnicalPirate/cx_Freeze | 358 | 3245609 | """
A setup script to create a single executable.
"""
# https://github.com/samuelcolvin/pydantic#a-simple-example
#
# Run the build process by running the command 'python setup.py build'
#
# If everything works well you should find a subdirectory in the build
# subdirectory that contains the files needed to run the sc... | 0 | 0 | 0 | 0 | 0 | 0 |
languages/python/django-oso/tests/test_partial.py | connec/oso | 2,167 | 3245625 | <gh_stars>1000+
import pytest
from polar import Variable
from django_oso.oso import Oso, reset_oso
from django_oso.partial import partial_to_query_filter
from test_app.models import User
@pytest.fixture(autouse=True)
def reset():
reset_oso()
@pytest.mark.django_db
def test_partial_to_query_filter(load_addition... | 0 | 0 | 0 | 0 | 0 | 0 |
curlylint/ast.py | takkaria/curlylint | 155 | 3245626 | <reponame>takkaria/curlylint<filename>curlylint/ast.py
import attr
@attr.s(frozen=True)
class Location:
"""A location in a source file."""
line = attr.ib() # 0-based
column = attr.ib()
index = attr.ib()
def __str__(self):
return "{}:{}".format(self.line + 1, self.column)
@attr.s(froze... | 0 | 0 | 0 | 0 | 0 | 0 |
jet_django/serializers/reorder.py | lukejamison/jet-dasboard | 193 | 3245627 | from django.db import transaction
from django.db.models import F
from jet_django.deps.rest_framework import serializers, relations
def reorder_serializer_factory(build_queryset) -> object:
class ReorderSerializer(serializers.Serializer):
ordering_field = serializers.CharField()
forward = serialize... | 0 | 1 | 0 | 0 | 1 | 0 |
adapters/tuya/TS0012.py | russdan/domoticz-zigbee2mqtt-plugin | 146 | 3245630 | import json
from adapters.base_adapter import Adapter
from devices.switch.on_off_switch import OnOffSwitch
class TS0012(Adapter):
def __init__(self):
super().__init__()
self.devices.append(OnOffSwitch('left', 'state_left'))
self.devices.append(OnOffSwitch('right', 'state_right'))
def... | 0 | 1 | 0 | 0 | 1 | 0 |
常用分类模型/DenseNet.py | 1044197988/TF.Keras-Commonly-used-models | 160 | 3245647 | from __future__ import annotations
from tensorflow.keras.layers import Input, Dense, Dropout, Activation, Concatenate, BatchNormalization
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, GlobalAveragePooling2D, AveragePooling2D
from tensorflow.keras.regularizers import l2
... | 18 | 4 | 0 | 0 | 22 | 0 |
python/ccf/tx_status.py | Jerryxia32/CCF | 530 | 3245665 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
from enum import Enum
class TxStatus(Enum):
Unknown = "Unknown"
Pending = "Pending"
Committed = "Committed"
Invalid = "Invalid"
| 0 | 0 | 0 | 0 | 0 | 0 |
Python/ServerScript.py | PushpneetSingh/Hello-world | 1,428 | 3245680 | <filename>Python/ServerScript.py
import socket
import select
import sys
from thread import *
import hashlib
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(("127.0.0.1", 7000))
server.listen(3)
clientMap = {}
groupMap = {}
userIP = ""
userName = ""
userTarget = ""
def clientthread(conn... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/stdlib/test_sys.py | jacebrowning/voc | 850 | 3245683 | import sys
from unittest import expectedFailure
from ..utils import TranspileTestCase
class SysModuleTests(TranspileTestCase):
############################################################
# __displayhook__
@expectedFailure
def test___displayhook__(self):
self.assertCodeExecution("""
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/save_stats.py | nicoddemus/yappi | 877 | 3245685 | <gh_stars>100-1000
import time
import yappi
import _yappi
timings = {"a_1":4, "b_1":1}
_yappi._set_test_timings(timings)
def profile(func):
def wrapped(*args, **kwargs):
yappi.start()
result = func(*args, **kwargs)
yappi.stop()
prof_file = "%s.%s" % (func.__name__, time.time())
... | 0 | 0 | 0 | 0 | 0 | 0 |
iPERCore/tools/trainers/baseline_trainer.py | JSssssss/iPERCore | 2,223 | 3245691 | # Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import torch
from collections import OrderedDict
from iPERCore.tools.utils.filesio.cv_utils import tensor2im
from .lwg_trainer import LWGTrainer
__all__ = ["BaselineTrainer"]
class BaselineTrainer(LWGTrainer):
"""Thi... | 4 | 3 | 0 | 0 | 7 | 0 |
src/protocols/CoAP/attacks/coap_fuzzing_attack_suite.py | QWERTSKIHACK/peniot | 143 | 3245698 | from Entity.attack_suite import AttackSuite
from coap_payload_size_fuzzer import *
from coap_random_payload_fuzzing import *
import multiprocessing
import unittest
class CoAPFuzzingAttackSuite(AttackSuite):
def __init__(self):
attacks = [CoAPRandomPayloadFuzzingAttack(), CoAPPayloadSizeFuzzerAttack()]
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/visions/backends/pandas/types/date.py | bhumikapahariapuresoftware/visions | 142 | 3245702 | from datetime import date, time
import pandas as pd
from visions.backends.pandas.series_utils import (
class_name_attrs,
series_handle_nulls,
series_not_empty,
)
from visions.types.date import Date
from visions.types.date_time import DateTime
@Date.register_relationship(DateTime, pd.Series)
@series_hand... | 6 | 3 | 0 | 0 | 9 | 0 |
Tools/ssl/make_ssl_data.py | barkow/linux-can-python | 652 | 3245730 | #! /usr/bin/env python3
"""
This script should be called *manually* when we want to upgrade SSLError
`library` and `reason` mnemnonics to a more recent OpenSSL version.
It takes two arguments:
- the path to the OpenSSL include files' directory
(e.g. openssl-1.0.1-beta3/include/openssl/)
- the path to the C file to ... | 0 | 1 | 0 | 0 | 1 | 0 |
cells/model.py | AlesTsurko/cells | 120 | 3245771 | <filename>cells/model.py<gh_stars>100-1000
import glob
import os
from dataclasses import dataclass, field
from time import time
from typing import List
from uuid import uuid4
from appdirs import user_data_dir
from cells import events
from cells.cli import CLI
from cells.observation import Observation
from cells.settin... | 0 | 0 | 0 | 0 | 0 | 0 |
AppTaskQueue/appscale/taskqueue/queue.py | loftwah/appscale | 790 | 3245774 | <reponame>loftwah/appscale<gh_stars>100-1000
import datetime
import base64
import json
import sys
import psycopg2
from appscale.common import retrying
from appscale.common.unpackaged import APPSCALE_PYTHON_APPSERVER
from .pg_connection_wrapper import pg_wrapper
from .constants import AGE_LIMIT_REGEX
from .constants... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/test_cases/all_import_aux.py | mrshannon/pydocstyle | 776 | 3245802 | __all__ = ('this', 'is', 'a', 'helper', 'file')
| 0 | 0 | 0 | 0 | 0 | 0 |
test/arch/test_x86_sse.py | rakati/ppci-mirror | 161 | 3245821 | <reponame>rakati/ppci-mirror
import unittest
from test_asm import AsmTestCaseBase
class Sse1TestCase(AsmTestCaseBase):
""" Checks sse1 instructions """
march = 'x86_64'
def test_movss(self):
""" Test move scalar single-fp values """
self.feed('movss xmm4, xmm6')
self.feed('movss ... | 0 | 0 | 0 | 0 | 0 | 0 |
swiggy_analytics/exceptions.py | laggingreflex/swiggy-analytics | 204 | 3245833 | class SwiggyCliQuitError(Exception):
pass
class SwiggyCliAuthError(Exception):
pass
class SwiggyCliConfigError(Exception):
pass
class SwiggyAPIError(Exception):
pass
class SwiggyDBError(Exception):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
service/api/sampling/online_eval_sampling_test.py | lcrh/falken | 213 | 3245841 | <reponame>lcrh/falken
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
Maths_And_Stats/Algebra/Factorial/factorial.py | arslantalib3/algo_ds_101 | 182 | 3245890 | <gh_stars>100-1000
# recursive function to calculate factorial of a number
def fact(num):
# if the number is greater than 0
# make a recursive call to the function
if num > 0:
factorial = num * fact(num-1)
else:
factorial = 1
# return the factorial
return factorial
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
sensor/STTS751/STTS751_irq_demo.py | garymeg/mpy-lib | 116 | 3245901 | <gh_stars>100-1000
from machine import I2C
from pyb import Timer
import STTS751
i2c = I2C(1)
stt = STTS751.STTS751(i2c)
def tim_irq(t):
print(stt.temperature_irq())
tim = Timer(1, freq = 1)
tim.callback(tim_irq)
| 0 | 0 | 0 | 0 | 0 | 0 |
reenact.py | chaiyujin/AudioDVP | 200 | 3245915 | import os
from tqdm import tqdm
from torchvision import utils
from renderer.face_model import FaceModel
from options.options import Options
from utils.util import create_dir, load_coef
if __name__ == '__main__':
opt = Options().parse_args()
create_dir(os.path.join(opt.src_dir, 'reenact'))
alpha_list = ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/custreamz/custreamz/__init__.py | Ahsantw/cudf | 4,012 | 3245922 | <reponame>Ahsantw/cudf<gh_stars>1000+
# Copyright (c) 2020, NVIDIA CORPORATION.
from .kafka import Consumer
| 0 | 0 | 0 | 0 | 0 | 0 |
GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py | Purva-Chaudhari/cmssw | 852 | 3245938 | <reponame>Purva-Chaudhari/cmssw<filename>GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line option... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/cpu/__init__.py | Hacky-DH/pytorch | 60,067 | 3245939 | <gh_stars>1000+
from . import amp
| 0 | 0 | 0 | 0 | 0 | 0 |
test/run/t516.py | timmartin/skulpt | 2,671 | 3245940 | lst = [3, 6, 2, 1, 0]
lst2 = [1, 2]
print map(bool, lst)
def outer():
def inner(item):
return 2 * item
print map(inner, lst)
outer()
print map(None, lst, lst2)
#filter with builtin functions
print filter(bool, [0,1,"",False,42,[1]])
#reduce with global variables
adder = 100
def add(x, y):
ret... | 0 | 0 | 0 | 0 | 0 | 0 |
plato/datasources/yolo.py | cuiboyuan/plato | 135 | 3245994 | from __future__ import annotations
"""
The COCO dataset or other datasets for the YOLOv5 model.
For more information about COCO 128, which contains the first 128 images of the
COCO 2017 dataset, refer to https://www.kaggle.com/ultralytics/coco128.
For more information about the COCO 2017 dataset, refer to http://coco... | 2 | 10 | 0 | 2 | 14 | 0 |
trove/tests/scenario/groups/root_actions_group.py | a4913994/openstack_trove | 244 | 3246005 | <reponame>a4913994/openstack_trove<gh_stars>100-1000
# Copyright 2015 Tesora Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... | 0 | 0 | 0 | 0 | 0 | 0 |
fatiando/gravmag/harvester.py | XuesongDing/fatiando | 179 | 3246029 | from __future__ import annotations
"""
3D potential field inversion by planting anomalous densities.
Implements the method of Uieda and Barbosa (2012a) with improvements by
Uieda and Barbosa (2012b).
A "heuristic" inversion for compact 3D geologic bodies. Performs the inversion
by iteratively growing the estimate aro... | 21 | 20 | 0 | 2 | 43 | 0 |
azure-iot-hub/tests/test_digital_twin_client.py | anthonyvercolano/azure-iot-sdk-python | 366 | 3246031 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import p... | 0 | 2 | 0 | 0 | 2 | 0 |
gradslam/datasets/datautils.py | glebshevchukk/gradslam | 1,048 | 3246041 | import copy
import warnings
from collections import OrderedDict
from typing import List, Union
import numpy as np
import torch
__all__ = [
"normalize_image",
"channels_first",
"scale_intrinsics",
"pointquaternion_to_homogeneous",
"poses_to_transforms",
"create_label_image",
]
def normalize_i... | 10 | 6 | 0 | 0 | 16 | 0 |
flask__webservers/run_with_random_port/main.py | DazEB2/SimplePyScripts | 117 | 3246042 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SOURCE: https://stackoverflow.com/a/5089963/5909792
from flask import Flask, request
import socket
app = Flask(__name__)
@app.route('/')
def hello() -> object:
return 'Hello, world! running on %s' % request.host
if __name__ == '__main__':
sock = socket.s... | 0 | 1 | 0 | 0 | 1 | 0 |
fpix/plugins/template/start_plugin.py | noahsherrill/force-riscv | 111 | 3246051 | <reponame>noahsherrill/force-riscv
#!/usr/bin/env python3
#
# 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://w... | 0 | 0 | 0 | 0 | 0 | 0 |
Configuration/Generator/python/PythiaMinBias_cfi.py | ckamtsikis/cmssw | 852 | 3246071 | # The following comments couldn't be translated into the new config version:
#
# this is example use of CTEQ 5L lhapdf grid input
# for details, see pythia manual section 9.3
#
# "MSTP(51)=19070 ! CTEQ 5L chosen, via LHAPDF LHgrid file",
# "MSTP(52)=2 ! tell pythia to use LHgrid file",
#
import FWCore.Parameter... | 0 | 0 | 0 | 0 | 0 | 0 |
snooze/callbacks.py | DragonHans86/github-snooze-button | 233 | 3246079 | from __future__ import annotations
from __future__ import absolute_import
import logging
import requests
import snooze.constants as constants
def clear_snooze_label_if_set(github_auth, issue, snooze_label) -> bool:
issue_labels = {label["name"] for label in issue.get("labels", [])}
if snooze_label not in i... | 0 | 4 | 0 | 0 | 4 | 0 |
pyfzf/__init__.py | jgarte/pyfzf | 122 | 3246091 | <reponame>jgarte/pyfzf<filename>pyfzf/__init__.py
__author__ = '<NAME> (<EMAIL>)'
__license__ = 'MIT'
__version__ = '0.2.2'
from .pyfzf import *
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/detection/models/yolo_x.py | sergunya17/catalyst | 2,693 | 3246106 | # flake8: noqa
import logging
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
logger = logging.getLogger("yolo-x")
def get_activation(name="silu", inplace=True):
if name == "silu":
module = nn.SiLU(inplace=inplace)
elif name == "relu":
module = nn.ReLU(inplace... | 0 | 0 | 0 | 0 | 0 | 0 |
highcharts/__init__.py | Jbrunn/python-highcharts | 370 | 3246112 | # -*- coding: utf-8 -*-
from .version import version_info, __version__
from .highcharts.highcharts import Highchart
from .highmaps.highmaps import Highmap
from .highstock.highstock import Highstock
from . import ipynb
| 0 | 0 | 0 | 0 | 0 | 0 |
src/viewprobe.py | firstmover/NetDissect | 475 | 3246125 | '''
viewprobe creates visualizations for a certain eval.
'''
import glob
import os
import numpy
import re
import upsample
import time
import loadseg
from scipy.misc import imread, imresize, imsave
from loadseg import normalize_label
import expdir
class NetworkProbe:
def __init__(self, directory, blobs=None):
... | 0 | 0 | 0 | 0 | 0 | 0 |
rotkehlchen/tests/utils/history.py | rotkehlchenio/rotkehlchen | 137 | 3246126 | <reponame>rotkehlchenio/rotkehlchen<gh_stars>100-1000
import json
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Tuple, cast
from unittest.mock import _patch, patch
from rotkehlchen.accounting.mixins.event import AccountingEventMixin
from rotkehlchen.accounting.structures.base import (
Hi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/spn/structure/leaves/parametric/Sampling.py | tkrons/SPFlow_topdownrules | 199 | 3246147 | <gh_stars>100-1000
"""
Created on April 15, 2018
@author: <NAME>
@author: <NAME>
"""
from spn.algorithms.Sampling import add_leaf_sampling
from spn.structure.leaves.parametric.Parametric import (
Parametric,
Gaussian,
Gamma,
Poisson,
Categorical,
LogNormal,
Geometric,
Exponential,
B... | 0 | 0 | 0 | 0 | 0 | 0 |
UGformerV1_PyTorch/UGformerV1_Sup.py | daiquocnguyen/Graph-Transformer | 269 | 3246227 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import TransformerEncoder, TransformerEncoderLayer
class UGformerV1(nn.Module):
def __init__(self, feature_dim_size, ff_hidden_size, num_classes,
num_self_att_layers, dropout, num_GNN_layers):
sup... | 3 | 2 | 0 | 0 | 5 | 0 |
tensorflow/contrib/bayesflow/python/ops/metropolis_hastings_impl.py | M155K4R4/Tensorflow | 522 | 3246232 | # 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 13 | 8 | 0 | 0 | 21 | 0 |
run/keystore2john.py | zaza568/yo | 2,109 | 3246240 | #!/usr/bin/env python
# This software is Copyright (c) 2014, <NAME> <sanju.kholia at gmail.<EMAIL>>
# and it is hereby released to the general public under the following terms:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
#
# Currently, only Sun "JKS" keystore f... | 0 | 1 | 0 | 0 | 1 | 0 |
application/python/example-gripper.py | afifswaidan/open-dobot | 148 | 3246253 | #! /usr/bin/env python
'''
An example how to use gripper.
'''
from dobot import Dobot
import time
# The top Z to go to.
up = 180
# The bottom Z to go to.
down = 120
# Maximum speed in mm/s
speed = 700
# Acceleration in mm/s^2
acceleration = 400
# dobot = Dobot('/dev/tty.usbmodem1421', debug=True, fake=True)
# dobot... | 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.