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 |
|---|---|---|---|---|---|---|---|---|---|---|
atlas/foundations_authentication/src/foundations_authentication/utils.py | DeepLearnI/atlas | 296 | 1647787 |
import base64
from flask import request, _request_ctx_stack
from jose import jwt
from typing import Dict
from foundations_core_rest_api_components.exceptions import AuthError
def get_token_from_header() -> str:
"""Obtains the Access Token from the Authorization Header
"""
auth = request.headers.get("Au... | 3 | 4 | 1 | 0 | 8 | 0 |
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/pdh.py | tdimnet/integrations-core | 663 | 1647800 | <filename>datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/pdh.py
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import textwrap
from collections import defaultdict
import click
from ...console import CONTEXT_SETTINGS, echo_info
#... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cli/vyper_json/test_get_settings.py | abdullathedruid/vyper | 1,471 | 1647801 | #!/usr/bin/env python3
import pytest
from vyper.cli.vyper_json import get_evm_version
from vyper.evm.opcodes import DEFAULT_EVM_VERSION
from vyper.exceptions import JSONError
def test_unknown_evm():
with pytest.raises(JSONError):
get_evm_version({"settings": {"evmVersion": "foo"}})
@pytest.mark.parame... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/utils/email/test_config.py | cotobadesign/cotoba-agent-oss | 104 | 1647836 | <gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, including without limitation
the rights to use, copy, modify, mer... | 0 | 0 | 0 | 0 | 0 | 0 |
simpleamt.py | leimao/simple-amt | 306 | 1647866 | from __future__ import annotations
import argparse, json
import boto3
from jinja2 import Environment, FileSystemLoader
"""
A bunch of free functions that we use in all scripts.
"""
def get_jinja_env(config) -> object:
"""
Get a jinja2 Environment object that we can use to find templates.
"""
return Environ... | 4 | 5 | 0 | 0 | 9 | 0 |
lib/termineter/modules/diff_tables.py | jayaram24/Termineter-Modified | 185 | 1647902 | <reponame>jayaram24/Termineter-Modified
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# termineter/modules/diff_tables.py
#
# 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 mus... | 0 | 0 | 0 | 0 | 0 | 0 |
frameworks/Python/webware/app/Launch.py | xsoheilalizadeh/FrameworkBenchmarks | 5,300 | 1647923 | <reponame>xsoheilalizadeh/FrameworkBenchmarks<gh_stars>1000+
#!/usr/bin/python
# You can pass several parameters on the command line
# (more info by running this with option --help)
# or you can modify the default values here
# (more info in WebKit.Launch):
import os
workDir = None
webwareDir = os.path.dirname(os.pat... | 0 | 0 | 0 | 0 | 0 | 0 |
project_euler/problem_057/sol1.py | jenia90/Python | 145,614 | 1647939 | """
Project Euler Problem 57: https://projecteuler.net/problem=57
It is possible to show that the square root of two can be expressed as an infinite
continued fraction.
sqrt(2) = 1 + 1 / (2 + 1 / (2 + 1 / (2 + ...)))
By expanding this for the first four iterations, we get:
1 + 1 / 2 = 3 / 2 = 1.5
1 + 1 / (2 + 1 / 2} ... | 1 | 1 | 0 | 0 | 2 | 0 |
examples/tests/test_mnist.py | zjzh/chainer | 3,705 | 1647945 | import os
import test_utils
EXAMPLES_ROOT = test_utils.EXAMPLES_ROOT
def test_1():
root_dir = os.path.join(EXAMPLES_ROOT, 'mnist')
output_evaluator = test_utils.TemplateOutputEvaluator(
b'''\
Device: @numpy
# unit: 10
# Minibatch-size: 100
# epoch: 1
epoch main/loss validation/main/loss ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/interpreter/test_scorecam.py | Christophe-Jia/InterpretDL | 107 | 1647948 | <filename>tests/interpreter/test_scorecam.py
import unittest
from paddle.vision.models import mobilenet_v2, resnet50
import numpy as np
import interpretdl as it
from tests.utils import assert_arrays_almost_equal
class TestScoreCAM(unittest.TestCase):
def test_cv(self):
paddle_model = mobilenet_v2(pr... | 0 | 0 | 0 | 0 | 0 | 0 |
python/federatedml/statistic/scorecard/score_transformer.py | QuantumA/FATE | 715 | 1647994 | <reponame>QuantumA/FATE<filename>python/federatedml/statistic/scorecard/score_transformer.py<gh_stars>100-1000
#
# Copyright 2019 The FATE 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 ob... | 0 | 0 | 0 | 0 | 0 | 0 |
openbook_connections/migrations/0006_connection_target_user.py | TamaraAbells/okuna-api | 164 | 1648021 | # Generated by Django 2.1.3 on 2018-12-13 12:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[object | tuple[str, str]] = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 0 | 0 | 2 | 0 | 2 | 0 |
esphome/components/safe_mode/switch/__init__.py | OttoWinter/esphomeyaml | 249 | 1648026 | <reponame>OttoWinter/esphomeyaml<gh_stars>100-1000
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import switch
from esphome.components.ota import OTAComponent
from esphome.const import (
CONF_ENTITY_CATEGORY,
CONF_ID,
CONF_INVERTED,
CONF_ICON,
CONF_OTA,
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/jvm/io/fsq/twofishes/scripts/geocoder.py | jglesner/fsqio | 252 | 1648050 | <gh_stars>100-1000
#!/usr/bin/python
#
# Copyright 2012 Foursquare Labs Inc.
#
# Wrapper for the geocoder for use from python.
import re, json, sys, urllib, urllib2
class Geocode:
# Initialize from a raw interpretation from the geocoder service.
def __init__(self, interpretation):
self.interp = interpretation... | 0 | 0 | 0 | 0 | 0 | 0 |
test/conf.py | pencc/bfs | 3,106 | 1648064 | """
Copyright (c) 2016, Baidu.com, Inc. All Rights Reserved
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
class Const:
def __init__(self):
self.deploy_script: str = './deploy.sh'
self.clear_script: str = './clear.sh'
self.start_script... | 0 | 0 | 0 | 10 | 10 | 0 |
build/win/message_compiler.py | google-ar/chromium | 777 | 1648075 | <reponame>google-ar/chromium
# Copyright 2015 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.
# Runs the Microsoft Message Compiler (mc.exe). This Python adapter is for the
# GN build, which can only run Python and not nat... | 0 | 0 | 0 | 0 | 0 | 0 |
netaddr/tests/ip/test_ip_rfc1924.py | Rockly/netaddr | 416 | 1648110 | <reponame>Rockly/netaddr
import pytest
from netaddr import AddrFormatError
from netaddr.ip.rfc1924 import ipv6_to_base85, base85_to_ipv6
def test_RFC_1924():
ip_addr = 'fc00:e968:6179::de52:7100:800:200c:417a'
base85 = ipv6_to_base85(ip_addr)
assert base85 == '4)+k&C#VzJ4br>0wv%Yp'
assert base85_to_i... | 0 | 0 | 0 | 0 | 0 | 0 |
src/nitpick/exceptions.py | camresp/nitpick | 251 | 1648145 | """Nitpick exceptions."""
import warnings
from typing import Any, Dict, List, Union
from more_itertools import always_iterable
from nitpick.constants import PROJECT_NAME
from nitpick.violations import Fuss
class QuitComplainingError(Exception):
"""Quit complaining and exit the application."""
def __init__(... | 5 | 4 | 0 | 1 | 10 | 0 |
Chapter01/generators_example.py | andriitugai/Learning-Python-data-structures | 202 | 1648153 | <gh_stars>100-1000
#compares the running time of a list compared to a generator
import time
#generator function creates an iterator of odd numbers between n and m
def oddGen(n,m):
while n<m:
yield n
n += 2
#builds a list of odd numbers between n and m
def oddLst(n,m):
lst=[]
while n<m:
lst.append(n)... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/dp/count_derangements.py | zhcet19/NeoAlgo-1 | 897 | 1648170 | <filename>Python/dp/count_derangements.py
'''
A Derangement is a permutation of n elements, such that no element appears in its original position.
Problem statement: Given a number n, find total number of Derangements of a set of n elements.
Input format
Line1: Number of test cases
Line2: Give the value of n
Output ... | 0 | 0 | 0 | 0 | 0 | 0 |
sockpuppet/management/commands/generate_reflex.py | JMS-Software-Development/django-sockpuppet | 371 | 1648171 | import keyword
from pathlib import Path
from django.core.management import CommandError
from django.template.loader import get_template
from ._base import BaseGenerateCommand
from ...utils import pascalcase
TEMPLATES = {
"_reflex.py": "sockpuppet/scaffolds/reflex.py",
"_controller.js": "sockpuppet/scaffolds/... | 0 | 0 | 1 | 0 | 1 | 0 |
venv/Lib/site-packages/rivescript/utils.py | Hazemcodes/GimmyBot | 154 | 1648173 | # RiveScript-Python
#
# This code is released under the MIT License.
# See the "LICENSE" file for more information.
#
# https://www.rivescript.com/
from __future__ import annotations
from __future__ import unicode_literals
from .regexp import RE
import random
import re
import string
def word_count(trigger, all: bool=... | 1 | 5 | 0 | 0 | 6 | 0 |
rlpy/Domains/PacmanPackage/__init__.py | okkhoy/rlpy | 265 | 1648183 | <filename>rlpy/Domains/PacmanPackage/__init__.py<gh_stars>100-1000
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# When reinforcement module is imported, the following submodules will be
# imported.
from future import... | 0 | 0 | 0 | 0 | 0 | 0 |
llvm/utils/lit/lit/__init__.py | clairechingching/ScaffCC | 2,151 | 1648186 | """'lit' Testing Tool"""
from main import main
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__versioninfo__ = (0, 2, 0)
__version__ = '.'.join(map(str, __versioninfo__)) + 'dev'
__all__ = []
| 0 | 0 | 0 | 0 | 0 | 0 |
appkernel/configuration.py | gaganchhabra/appkernel | 156 | 1648190 | <filename>appkernel/configuration.py
class Config(object):
pass
config = Config()
| 0 | 0 | 0 | 0 | 0 | 0 |
Scripts/API/Random_Joke/joke.py | ShivangiPatel102/Python_and_the_Web | 437 | 1648209 | <filename>Scripts/API/Random_Joke/joke.py
#!/bin/env python3
import sys
import requests
import typer
from colored import fg, attr
app = typer.Typer()
rst = attr("reset") # reset colors
JOKE_TWO_PARTS = f"""{fg(40) + attr("bold") + attr("dim")}Setup: {rst + fg(202)}{{setup}}
{fg(40) + attr("bold") + attr("dim")}Deli... | 0 | 0 | 0 | 0 | 0 | 0 |
fum/management/commands/checksync.py | jsavikko/futurice-ldap-user-manager | 111 | 1648214 | from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.template.loader import get_template
from django.template import Context
from django.forms import EmailField
from django.core.exceptions import ValidationError
from django.util... | 0 | 0 | 0 | 0 | 0 | 0 |
backup/server.py | bit0fun/plugins | 173 | 1648223 | <reponame>bit0fun/plugins
import logging, socket, struct
import json
import sys
from typing import Tuple
from backend import Backend
from protocol import PacketType, recvall, PKT_CHANGE_TYPES, change_from_packet, packet_from_change, send_packet, recv_packet
class SystemdHandler(logging.Handler):
PREFIX = {
... | 0 | 0 | 0 | 0 | 0 | 0 |
hypergcn.py | youjibiying/HyperGCN-1 | 118 | 1648243 | # parse arguments ([ConfigArgParse](https://github.com/bw2/ConfigArgParse))
from config import config
args = config.parse()
# seed
import os, torch, numpy as np
torch.manual_seed(args.seed)
np.random.seed(args.seed)
# gpu, seed
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICE... | 0 | 0 | 0 | 0 | 0 | 0 |
common/src/stack/command/stack/commands/list/firmware/make/plugin_basic.py | kmcm0/stacki | 123 | 1648247 | <reponame>kmcm0/stacki
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 w... | 0 | 0 | 0 | 0 | 0 | 0 |
artemis/__init__.py | StanfordGeometryLab/artemis | 254 | 1648250 | <filename>artemis/__init__.py
"""
The MIT License (MIT)
Copyright (c) 2021 <NAME> (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab
"""
from .in_out.basics import files_in_subdirs
from .in_out.basics import pickle_data, unpickle_data | 0 | 0 | 0 | 0 | 0 | 0 |
PWGJE/EMCALJetTasks/Tracks/analysis/base/struct/JetContainer.py | maroozm/AliPhysics | 114 | 1648264 | #**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | 4 | 9 | 0 | 5 | 18 | 0 |
lucida/commandcenter/controllers/AccessManagement.py | extremenelson/sirius | 1,808 | 1648282 | from flask import *
from functools import wraps
def login_required(f) -> object:
@wraps(f)
def wrap(*args, **kwargs) -> object:
if 'logged_in' in session:
return f(*args, **kwargs)
else:
return redirect(url_for('user.login_route'))
return wrap
| 0 | 2 | 0 | 0 | 2 | 0 |
earth_enterprise/src/server/wsgi/wms/ogc/__init__.py | ezeeyahoo/earthenterprise | 2,661 | 1648319 | """The package indicator for wsgi.wms.ogc.
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
Validation/RecoParticleFlow/python/PFValidationClient_cff.py | Purva-Chaudhari/cmssw | 852 | 1648352 | import FWCore.ParameterSet.Config as cms
from DQMOffline.PFTau.PFClient_cfi import pfClient, pfClientJetRes
#from DQMOffline.PFTau.PFClient_cfi import *
pfJetClient = pfClient.clone(
FolderNames = ['PFJetValidation/CompWithGenJet'],
HistogramNames = ['delta_et_Over_et_VS_et_'],
CreateProfilePlots = True,
... | 0 | 0 | 0 | 0 | 0 | 0 |
part23/mylib/general/__init__.py | ThomasAlbin/SpaceScienceTutorial | 167 | 1648357 | from . import vec
| 0 | 0 | 0 | 0 | 0 | 0 |
yotta/publish.py | microbit-foundation/yotta | 176 | 1648364 | <gh_stars>100-1000
# Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import logging
# validate, , validate things, internal
from yotta.lib import validate
# options, , shared options, internal
import yotta.options as op... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/kvpy/ptomb_cursor.py | efeslab/hse | 558 | 1648373 | <gh_stars>100-1000
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
from contextlib import ExitStack
from hse2 import hse
from utility import lifecycle, cli
def verify(kvs: hse.Kvs, pfx: str, cnt: int):
# [HSE_REVISIT] Getting all ... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/blink/tools/blinkpy/web_tests/models/testharness_results.py | zipated/src | 2,151 | 1648377 | <gh_stars>1000+
# Copyright 2014 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.
"""Utility module for checking testharness test output."""
_TESTHARNESSREPORT_HEADER = 'This is a testharness.js-based test.'
_TESTHARNESSRE... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/rotate_image.py | saurabhcommand/Hello-world | 1,428 | 1648380 | <gh_stars>1000+
import numpy as np
class Solution:
def rotate(self, A):
print("Starting Matrix")
print(np.matrix(a))
n = len(A)
print("Starting Transpose")
for i in range(n):
for j in range(i):
A[i][j], A[j][i] = A[j][i], A[i][j]
p... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_download.py | chrononyan/ok | 148 | 1648382 | from tests import OkTestCase
from server.models import db, Assignment, Backup, Message, User
from server import utils
class TestDownload(OkTestCase):
def _add_file(self, filename, contents):
self.setup_course()
email = '<EMAIL>'
self.login(email)
self.user = User.lookup(email)
... | 0 | 0 | 0 | 0 | 0 | 0 |
ATMega328 2017-02-12 crystal turnover inspector/record_both.py | swharden/AVR-projects | 121 | 1648393 | """this script continuously polls for temperature and saves it as data.csv"""
import serial
import time
import serial.tools.list_ports
import os
def listPorts():
for item in serial.tools.list_ports.comports():
print(item)
def getFreq(ser) -> object:
while True:
try:
freq=s... | 2 | 2 | 0 | 0 | 4 | 0 |
pubnub/models/consumer/objects_v2/uuid.py | natekspencer/pubnub-python | 146 | 1648419 | <reponame>natekspencer/pubnub-python
from pubnub.models.consumer.objects_v2.page import PNPageable
class PNSetUUIDMetadataResult(object):
def __init__(self, result):
self.data = result["data"]
self.status = result["status"]
def __str__(self):
return "Set UUID metatdata: %s" % self.dat... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/parsers/detection/metadata.py | AtlasGooo2/WoodScape | 348 | 1648429 | <reponame>AtlasGooo2/WoodScape<filename>scripts/parsers/detection/metadata.py
"""
Class for detection objects meta data
# author: <NAME>
# credits: DL team valeo vision systems
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; Authors provide no warranty with the software
and a... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/truncate-sentence.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1648453 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(n)
# Space: O(1)
class Solution(object):
def truncateSentence(self, s, k):
"""
:type s: str
:type k: int
:rtype: str
"""
for i in xrange(len(s)):
if s[i] == ' ':
k -= 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/migrations/0071_merge_0063_auto_20210407_0045_0070_auto_20210423_0121.py | mouse-reeve/fedireads | 270 | 1648468 | <reponame>mouse-reeve/fedireads
# Generated by Django 3.2 on 2021-04-26 21:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0063_auto_20210407_0045"),
("bookwyrm", "0070_auto_20210423_0121"),
]
operations = []
| 0 | 0 | 0 | 0 | 0 | 0 |
app/resources.py | siarheipuhach/tutorialdb | 109 | 1648471 | <gh_stars>100-1000
from import_export import fields, resources
from import_export.widgets import ManyToManyWidget
from . models import Tutorial, Tag
class TutorialResource(resources.ModelResource):
tags = fields.Field(
column_name='tags',
attribute='tags',
widget=ManyToManyWidget(Tag, ',',... | 0 | 0 | 0 | 0 | 0 | 0 |
see/context/context.py | security-geeks/see | 851 | 1648494 | # Copyright 2015-2017 F-Secure
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 1 |
pilco/models/__init__.py | emsal1863/PILCO | 277 | 1648523 | <filename>pilco/models/__init__.py
from .mgpr import MGPR
from .smgpr import SMGPR
from .pilco import PILCO
| 0 | 0 | 0 | 0 | 0 | 0 |
binding.gyp | Elainehxx/python.js | 214 | 1648550 | <filename>binding.gyp
{
"targets": [
{
"target_name": "binding",
"sources": [
"src/binding.cc",
"src/utils.cc",
"src/py_object_wrapper.cc"
],
"conditions": [
['OS=="mac"', {
"xcode_settings": {
"OTHER_CFLAGS": [
"-Wn... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/generate_readme.py | voiski/pytago | 206 | 1648558 | import glob
from os.path import split
import os
rel = "" if os.getcwd().endswith("scripts") else "./scripts/"
HEADER_PATH = rel + 'README_HEADER.md'
EXAMPLES_PATH = rel + "../examples"
README_DESTINATION = rel + "../README.md"
TEST_FILE_PATH = rel + "../pytago/tests/test_core.py"
DISABLED_EXAMPLES = {
"iterunpac... | 0 | 3 | 0 | 0 | 3 | 0 |
examples/users_and_groups/filters.py | opsi-org/graphene-sqlalchemy-filter | 111 | 1648562 | <filename>examples/users_and_groups/filters.py
# GraphQL
import graphene
# Database
from sqlalchemy import Integer, and_
# Project
from graphene_sqlalchemy_filter import FilterableConnectionField, FilterSet
from models import Group, Membership, User
class BaseFilter(FilterSet):
EXTRA_EXPRESSIONS = {
'ze... | 0 | 0 | 0 | 0 | 0 | 0 |
import-maps/static-import.py | meyerweb/wpt | 14,668 | 1648646 | <reponame>meyerweb/wpt<gh_stars>1000+
# This file needs to be a sibling of the test files (and not under resources/)
# so that base URL resolution is the same between those test files and <script>s
# pointing to this file.
from wptserve.utils import isomorphic_decode
def main(request, response):
return (
... | 0 | 0 | 0 | 0 | 0 | 0 |
ciphey/__main__.py | AlexandruValeanu/Ciphey | 9,908 | 1648662 | #! /usr/bin/env python3
"""
Ciphey: https://github.com/Ciphey/Ciphey
"""
import platform
import sys
if __name__ == "__main__":
major = sys.version_info[0]
minor = sys.version_info[1]
python_version = (
str(sys.version_info[0])
+ "."
+ str(sys.version_info[1])
+ "."
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/textacy/io/spacy.py | austinjp/textacy | 1,929 | 1648663 | """
:mod:`textacy.io.spacy`: Functions for reading from and writing to disk spacy documents
in either pickle or binary format. Be warned: Both formats have pros and cons.
"""
from __future__ import annotations
import pickle
from typing import Iterable, Optional
from spacy.tokens import Doc, DocBin
from .. import err... | 10 | 3 | 0 | 0 | 13 | 0 |
Python/maths.py | saurabhcommand/Hello-world | 1,428 | 1648682 | <gh_stars>1000+
def sum(num1, num2):
return num1 + num2
def diff(num1, num2):
return num1 - num2
def prod(num1, num2):
return num1 * num2
def quot(num1, num2):
return num1 / num2
| 0 | 0 | 0 | 0 | 0 | 0 |
hyperparameter_hunter/data/data_chunks/prediction_chunks.py | shaoeric/hyperparameter_hunter | 688 | 1648692 | <reponame>shaoeric/hyperparameter_hunter
##################################################
# Import Own Assets
##################################################
from hyperparameter_hunter.data.data_core import BaseDataChunk
from hyperparameter_hunter.feature_engineering import FeatureEngineer
#######################... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration-test/python-sdk-test/check/fedb_assert.py | jasleon/OpenMLDB | 2,659 | 1648695 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
mmocr/datasets/builder.py | yuexy/mmocr | 2,261 | 1648720 | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import Registry, build_from_cfg
LOADERS = Registry('loader')
PARSERS = Registry('parser')
def build_loader(cfg) -> object:
"""Build anno file loader."""
return build_from_cfg(cfg, LOADERS)
def build_parser(cfg) -> object:
"""Build anno fil... | 0 | 2 | 0 | 0 | 2 | 0 |
Chapter 08/pyHookKeyLogger.py | Prakshal2607/Effective-Python-Penetration-Testing | 346 | 1648743 | <reponame>Prakshal2607/Effective-Python-Penetration-Testing<filename>Chapter 08/pyHookKeyLogger.py
import pyHook, pythoncom, sys, logging
file_log='C:\\log.txt'
def OnKeyboardEvent(event):
logging.basicConfig(filename*file_log, level=logging.DEBUG, format='%(message)s')
chr(event.Ascii)
logging.log(10,chr(event.A... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 11/code/timeseries.py | shivampotdar/Artificial-Intelligence-with-Python | 387 | 1648749 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def read_data(input_file, index) -> object:
# Read the data from the input file
input_data = np.loadtxt(input_file, delimiter=',')
# Lambda function to convert strings to Pandas date format
to_date = lambda x, y: str(int(x)) + '-' ... | 0 | 1 | 0 | 0 | 1 | 0 |
qutip/cy/openmp/utilities.py | camponogaraviera/qutip | 1,205 | 1648824 | <gh_stars>1000+
import os
import numpy as np
import qutip.settings as qset
def check_use_openmp(options):
"""
Check to see if OPENMP should be used in dynamic solvers.
"""
force_omp = False
if qset.has_openmp and options.use_openmp is None:
options.use_openmp = True
force_omp = Fal... | 0 | 0 | 0 | 0 | 0 | 0 |
kafka/protocol/offset.py | informatique-cdc/kafka-python | 4,389 | 1648839 | from __future__ import absolute_import
from kafka.protocol.api import Request, Response
from kafka.protocol.types import Array, Int8, Int16, Int32, Int64, Schema, String
UNKNOWN_OFFSET = -1
class OffsetResetStrategy(object):
LATEST = -1
EARLIEST = -2
NONE: int = 0
class OffsetResponse_v0(Response):
... | 0 | 0 | 31 | 0 | 31 | 0 |
rapid_response_kit/tools/noticeboard.py | smendes/rapid-response-kit | 172 | 1648849 | from __future__ import annotations
from rapid_response_kit.utils.clients import twilio, pusher_connect
from rapid_response_kit.utils.helpers import (
parse_numbers,
echo_twimlet,
twilio_numbers,
check_is_valid_url
)
from clint.textui import colored
from twilio.twiml import Response
from pusher import P... | 1 | 5 | 0 | 0 | 6 | 0 |
applications/FluidDynamicsApplication/tests/adjoint_vms_element_2d.py | lkusch/Kratos | 778 | 1648867 | from KratosMultiphysics import *
from KratosMultiphysics.FluidDynamicsApplication import *
import KratosMultiphysics.KratosUnittest as KratosUnittest
import random
class AdjointVMSElement2D(KratosUnittest.TestCase):
def setUp(self):
self.delta_time = 1.0
# create test model part
self.mode... | 3 | 2 | 0 | 0 | 5 | 0 |
tests/test_utils/decorators.py | npodewitz/airflow | 8,092 | 1648871 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2 | 3 | 0 | 0 | 5 | 0 |
tests/config/utils.py | mlakkadshaw/synapse | 9,945 | 1648898 | <filename>tests/config/utils.py
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
art/__init__.py | Anilkutsa/milvik_art | 1,431 | 1648923 | <reponame>Anilkutsa/milvik_art
# -*- coding: utf-8 -*-
"""Art modules."""
from .art import artError
from .art import aprint, art, randart
from .art import tprint, tsave, text2art
from .art import decor
from .art import get_font_dic, set_default, help_func, art_list, font_list, decor_list
from .art_param import ART_VERS... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578601_Dice/recipe-578601.py | tdiprima/code | 2,023 | 1648931 | <reponame>tdiprima/code
while again:
print" Pick a dice: "
print"4, 6, 12"
userinput = input("Pick a dice: ")
if userinput == 4:
randomnumber = random.randint(1,4)
print randomnumber
if userinput == 6:
randomnumber = random.randint(1,6)
print randomnumber
if us... | 0 | 0 | 0 | 0 | 0 | 0 |
src/beanmachine/ppl/inference/tests/single_site_random_walk_conjugate_test_nightly.py | horizon-blue/beanmachine-1 | 177 | 1648950 | <gh_stars>100-1000
# 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 unittest
import beanmachine.ppl as bm
from beanmachine.ppl.testlib.abstract_conjugate import AbstractConjugateTes... | 0 | 0 | 0 | 0 | 0 | 0 |
ryu/services/protocols/bgp/utils/other.py | umkcdcrg01/ryu_openflow | 269 | 1648954 | <reponame>umkcdcrg01/ryu_openflow
def bytes2hex(given_bytes):
return ''.join(["%02X " % ord(x) for x in given_bytes]).strip()
def hex2byte(given_hex):
given_hex = ''.join(given_hex.split())
result = []
for offset in range(0, len(given_hex), 2):
result.append(chr(int(given_hex[offset:offset + 2... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | qiaone/itwmm | 192 | 1648983 | <reponame>qiaone/itwmm<filename>setup.py
from setuptools import setup, find_packages
install_requires = ['menpo3d>=0.6.0']
setup(name='itwmm',
version='1.0.0',
description='ITW Morphable Model fitting',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(),
install_requ... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/tutorials/action_recognition/decord_loader.py | Kh4L/gluon-cv | 5,447 | 1649013 | """10. Introducing Decord: an efficient video reader
====================================================
Training deep neural networks on videos is very time consuming. For example, training a state-of-the-art SlowFast network
on Kinetics400 dataset using a server with 8 V100 GPUs takes more than 10 days. Slow traini... | 0 | 0 | 0 | 0 | 0 | 0 |
fireant/database/postgresql.py | mikeengland/fireant | 122 | 1649014 | from __future__ import annotations
from pypika import (
Parameter,
PostgreSQLQuery,
Table,
terms,
Dialects,
)
from pypika.terms import Node
from pypika.utils import format_quotes
from .base import Database
class DateTrunc(terms.Function):
"""
Wrapper for the PostgreSQL date_trunc function... | 8 | 6 | 0 | 0 | 14 | 0 |
vec4ir/core.py | bees4ever/vec4ir | 211 | 1649017 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations
from sklearn.base import BaseEstimator, MetaEstimatorMixin
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.exceptions import NotFittedError
import numpy as np
import scipy.sparse as sp
try:
from .base import R... | 10 | 5 | 0 | 0 | 15 | 0 |
mindsdb/integrations/mysql_handler/mysql_handler.py | mindsdb/main | 261 | 1649056 | <gh_stars>100-1000
from typing import List, Optional
from contextlib import closing
import pandas as pd
import mysql.connector
from sqlalchemy import create_engine
from mindsdb_sql import parse_sql
from mindsdb.integrations.libs.base_handler import DatabaseHandler
from mindsdb_sql.render.sqlalchemy_render import Sqla... | 0 | 0 | 0 | 0 | 0 | 0 |
bts/dataset.py | g-freire/Brain-Tumor-Segmentation | 156 | 1649082 | from torch.utils.data import Dataset
import torchvision.transforms as transforms
import torchvision.transforms.functional as TF
from PIL import Image
import os
import random
class TumorDataset(Dataset):
""" Returns a TumorDataset class object which represents our tumor dataset.
TumorDataset inherits from t... | 2 | 3 | 0 | 2 | 7 | 0 |
tests/test_ipify.py | adrian-soto/python-ipify | 121 | 1649093 | """
tests.ipify.ipify
~~~~~~~~~~~~~~~~~
All tests for our ipify.ipify module.
"""
from socket import AF_INET, AF_INET6, inet_pton
from unittest import TestCase
from requests.models import Response
from ipify.exceptions import ConnectionError, IpifyException, ServiceError
from ipify.ipify import _get_ip_resp, get_i... | 0 | 2 | 0 | 0 | 2 | 0 |
cellrank/external/_error_mixin.py | WeilerP/cellrank | 172 | 1649098 | from typing import Any, Optional
class ImportErrorMixin:
"""
Mixin class which always raises :class:`ImportError`.
Subclasses can modify the message by overriding `__import_error_message__`.
Parameters
----------
args
Ignored.
kwargs
Ignored.
Raises
------
Im... | 4 | 0 | 1 | 0 | 5 | 0 |
vkwave/streaming/errors.py | Stunnerr/vkwave | 222 | 1649105 | class StreamingAPIError(Exception):
def __init__(self, code: int, message: str):
self.code = code
self.text = message
self.message: str = f"[{code}] {message}"
super().__init__(self.message)
| 2 | 0 | 0 | 1 | 3 | 0 |
exercises/ja/solution_03_03.py | Jette16/spacy-course | 2,085 | 1649119 | import spacy
# ja_core_news_sm モデルを読み込む
nlp = spacy.load("ja_core_news_sm")
# パイプラインの名前を出力
print(nlp.pipe_names)
# (name, component) のタプルからなるパイプライン情報を表示
print(nlp.pipeline)
| 0 | 0 | 0 | 0 | 0 | 0 |
rman_translators/rman_runprogram_translator.py | N500/RenderManForBlender | 432 | 1649140 | from .rman_translator import RmanTranslator
from ..rman_sg_nodes.rman_sg_runprogram import RmanSgRunProgram
class RmanRunProgramTranslator(RmanTranslator):
def __init__(self, rman_scene):
super().__init__(rman_scene)
self.bl_type: str = 'PROCEDURAL_RUN_PROGRAM'
def export(self, ob, db_name) ... | 0 | 1 | 0 | 1 | 2 | 0 |
examples/issues/issue478.py | tgolsson/appJar | 666 | 1649194 | import sys
sys.path.append("../../")
from appJar import gui
with gui() as app:
with app.labelFrame("framer"):
app.label('hello world')
with app.labelFrame("framer"):
app.label('hhello world')
| 0 | 0 | 0 | 0 | 0 | 0 |
client/python/ff_client/udp_packet.py | TimeToogo/fire-and-forget-http | 747 | 1649196 | class UdpPacket:
def __init__(self, length: int, payload: bytearray):
self.length = length
self.payload = payload
| 2 | 0 | 0 | 0 | 2 | 0 |
TapasFlashTool/TapasFlashTool/__init__.py | StefanS0894/TAPAS | 104 | 1649207 | <gh_stars>100-1000
"""
Tapas Flash Tool -- Tool for flashing a Tapas Board via UART
Author: <NAME>
BSD 3-Clause License
Copyright (c) 2017, SDI-SoftwareDefinedInverter
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following cond... | 0 | 0 | 0 | 0 | 0 | 0 |
src/encoded/tests/test_searches_queries.py | procha2/encoded | 102 | 1649227 | import pytest
@pytest.fixture
def params_parser(dummy_request) -> object:
from snosearch.parsers import ParamsParser
from snovault.elasticsearch import ELASTIC_SEARCH
from elasticsearch import Elasticsearch
dummy_request.environ['QUERY_STRING'] = (
'type=Experiment&assay_title=Histone+ChIP-seq... | 0 | 1 | 0 | 0 | 1 | 0 |
etl/parsers/etw/Microsoft_Windows_NdisImPlatformEventProvider.py | IMULMUL/etl-parser | 104 | 1649246 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-NdisImPlatformEventProvider
GUID : 11c5d8ad-756a-42c2-8087-eb1b4a72a846
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, Syste... | 0 | 0 | 0 | 0 | 0 | 0 |
django_downloadview/shortcuts.py | kishorkunal-raj/django-downloadview | 164 | 1649257 | from __future__ import annotations
"""Port of django-sendfile in django-downloadview."""
from django_downloadview.views.path import PathDownloadView
def sendfile(
request,
filename,
attachment: bool=False,
attachment_filename: object | None=None,
mimetype: object | None=None,
encoding: object ... | 4 | 1 | 0 | 0 | 5 | 0 |
urizen/core/metatile.py | vurmux/urizen | 107 | 1649281 | <filename>urizen/core/metatile.py
#!/usr/bin/python3
DEFAULT = 'default'
class Metatile(object):
"""
Metatile class
Attributes:
name -- Metatile name
geometry -- Metatile geometry type. Can be 'default', 'linear' or 'square'
animated -- Flag: Can the metatile be animated
tiles -- Struct... | 0 | 0 | 0 | 0 | 0 | 0 |
cbl/struct_type.py | Commodoreprime/Command-Block-Assembly | 223 | 1649285 | from .cbl_type import CBLType, CBLTypeInstance, CBLTypeMeta
from .containers import Temporary
from .function_type import InstanceFunctionType
import cmd_ir.instructions as i
class StructTypeInstance(CBLTypeInstance):
def __init__(self, compiler, this, var_members, func_members, func_properties):
super().... | 0 | 0 | 0 | 0 | 0 | 1 |
qf_lib/backtesting/alpha_model/futures_model.py | webclinic017/qf-lib | 198 | 1649290 | <reponame>webclinic017/qf-lib
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/361333_isMoney/recipe-361333.py | tdiprima/code | 2,023 | 1649299 | <gh_stars>1000+
# isMoney.py
'''A simple program to check a data is in money datatype'''
def isMoney():
# format = "123.45"
money = 123
flag = 0
# check - all is digits ?
if str(money).isdigit() == 1:
flag = 1
else:
# loop into the data
for i in range (0, len(str(mon... | 0 | 0 | 0 | 0 | 0 | 0 |
commands/deviot_clean_console.py | Rod-O/Deviot | 327 | 1649309 | from sublime_plugin import WindowCommand
from ..libraries import serial
from ..libraries.tools import get_setting
class DeviotCleanConsoleCommand(WindowCommand):
monitor: None = None
def run(self):
self.monitor.clean_console()
def is_enabled(self) -> bool:
port_id = get_setting('port_id'... | 0 | 1 | 1 | 0 | 2 | 0 |
tests/components/ign_sismologia/__init__.py | domwillcode/home-assistant | 30,023 | 1649323 | """Tests for the ign_sismologia component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
pywick/datasets/__init__.py | achaiah/pywick | 408 | 1649334 | """
Datasets are the primary mechanism by which Pytorch assembles training and testing data
to be used while training neural networks. While `pytorch` already provides a number of
handy `datasets <https://pytorch.org/docs/stable/data.html#module-torch.utils.data>`_ and
`torchvision` further extends them to common
`acad... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_response_timeout.py | Varriount/sanic | 4,959 | 1649340 | import asyncio
import logging
from time import sleep
from sanic import Sanic
from sanic.exceptions import ServiceUnavailable
from sanic.log import LOGGING_CONFIG_DEFAULTS
from sanic.response import text
response_timeout_app = Sanic("test_response_timeout")
response_timeout_default_app = Sanic("test_response_timeout... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_property_package.py | RoryKurek/thermo | 380 | 1649346 | <filename>tests/test_property_package.py
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "So... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/isolated/ssl_context_version_setters.py | dtantsur/eventlet | 1,044 | 1649355 | __test__ = False
if __name__ == "__main__":
import eventlet
eventlet.monkey_patch()
import ssl
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.maximum_version = ssl.TLSVersion.TLSv1_2
print("pass")
| 0 | 0 | 0 | 0 | 0 | 0 |
workalendar/usa/district_columbia.py | taiyeoguns/workalendar | 405 | 1649402 | <filename>workalendar/usa/district_columbia.py
from .core import UnitedStates
from ..registry_tools import iso_register
@iso_register('US-DC')
class DistrictOfColumbia(UnitedStates):
"District of Columbia"
include_inauguration_day = True
FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
(4, 16, "Em... | 0 | 0 | 0 | 0 | 0 | 0 |
DeBERTa/apps/models/__init__.py | vilhub/DeBERTa | 916 | 1649431 | from .ner import *
from .multi_choice import *
from .sequence_classification import *
from .record_qa import *
from .masked_language_model import *
| 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.