content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | 34.739726 | 86 | 0.610804 | [
"Apache-2.0"
] | 001101/warehouse | tests/unit/admin/views/test_journals.py | 5,072 | Python |
# Copyright (c) 2020 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | 40.143791 | 79 | 0.712146 | [
"BSD-3-Clause"
] | AlbertoParravicini/gem5 | src/dev/arm/css/Scmi.py | 6,142 | Python |
#
# Copyright 2015 Hewlett Packard Development Company, LP
# Copyright 2015 Universidade Federal de Campina Grande
#
# 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://... | 37.630058 | 80 | 0.662366 | [
"Apache-2.0"
] | ISCAS-VDI/ironic-base | ironic/drivers/modules/oneview/management.py | 6,510 | Python |
#################################################
# Retrieve robust classifier from:
# https://github.com/MadryLab/robustness
#################################################
from robustness.datasets import CIFAR, RestrictedImageNet, ImageNet
from robustness.model_utils import make_and_restore_model
def get_robust_c... | 43.72 | 104 | 0.603385 | [
"MIT"
] | csmiler/ProbeGAN | classifiers/robust_classifier.py | 2,186 | Python |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... | 34.192308 | 99 | 0.767154 | [
"Apache-2.0"
] | Amourspirit/ooo_uno_tmpl | ooobuild/dyn/configuration/backend/multi_layer_stratum.py | 889 | Python |
#!/usr/bin/python3
import sys
import json
import getopt
import os
import jsonschema
import subprocess
if os.geteuid() != 0:
print('You must be a root user')
sys.exit(72)
json_file = ''
nginx_conf = '/etc/nginx/nginx.conf'
schema_file = ''
test = False
#------Parse command-line options------
def usage():
prin... | 32.51087 | 121 | 0.57322 | [
"BSD-2-Clause"
] | alex-v-yakimov/nginx-conf | nginx_conf_gen.py | 5,982 | Python |
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen
... | 36.921875 | 105 | 0.660601 | [
"MIT"
] | labd/commercetools-python-sdk | src/commercetools/platform/client/login/by_project_key_login_request_builder.py | 2,363 | Python |
# Copyright The OpenTelemetry 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 or agreed to in ... | 32.82397 | 124 | 0.641545 | [
"Apache-2.0",
"BSD-3-Clause"
] | open-telemetry/opentelemetry-auto-instr-python | instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py | 17,528 | Python |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | 42.041667 | 185 | 0.715064 | [
"Apache-2.0"
] | Tanc009/jdcloud-sdk-python | jdcloud_sdk/services/es/models/InstanceSpec.py | 2,298 | Python |
# coding=utf-8
"""Tokenization classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import unicodedata
import six
import tensorflow as tf
import re
import warnings
warnings.filterwarnings('ignore')
def validate_case_matches_checkp... | 33.427835 | 84 | 0.590902 | [
"Apache-2.0"
] | YihaoChan/2021-Tianchi-GAIIC-Track1-Rank-3 | preliminary_contest/nezha_pretrain/tokenization.py | 12,970 | Python |
import io
from electrum.lnmsg import (read_bigsize_int, write_bigsize_int, FieldEncodingNotMinimal,
UnexpectedEndOfStream, LNSerializer, UnknownMandatoryTLVRecordType,
MalformedMsg, MsgTrailingGarbage, MsgInvalidFieldOrder, encode_msg,
... | 83.855362 | 885 | 0.67195 | [
"MIT"
] | 53nsk/electrum | electrum/tests/test_lnmsg.py | 33,626 | Python |
#fake database to get the pygame running
import random
questions = ["Question 1?", "Question 2?", "Question 3?", "Question 4?"]
answers = ["Answer 1", "Answer 2", "Answer 3", "Answer 4"]
def get_question():
return(random.choice(questions))
def get_answer():
return(random.choice(answers)) | 27.181818 | 72 | 0.685619 | [
"MIT"
] | KelstonClub/quiz | quiz/fake_db.py | 299 | Python |
#!/usr/bin/env python
"""
An example of image registration via the DTCWT.
This script demonstrates some methods for image registration using the DTCWT.
"""
from __future__ import division, print_function
import itertools
import logging
import os
from matplotlib.pyplot import *
import numpy as np
import dtcwt
from... | 26.987654 | 84 | 0.677036 | [
"BSD-2-Clause"
] | OneOneFour/dtcwt | docs/image-registration.py | 2,186 | Python |
"""Azure Devops Server metric collector."""
from typing import List
import requests
from ..collector import Collector
from ..type import Entities, URL, Value
class AzureDevopsBase(Collector):
"""Base class for Azure DevOps collectors."""
def api_url(self) -> URL:
url = super().api_url()
re... | 45.403226 | 117 | 0.662522 | [
"Apache-2.0"
] | Hedde/quality-time | components/collector/src/collectors/azure_devops.py | 2,815 | Python |
import json
import pytest
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
def url_string(string="/graphql", **url_params):
if url_params:
string += "?" + urlencode(url_params)
return string
def batch_url_string(**url_params):
return url_string("... | 32.788828 | 95 | 0.640711 | [
"MIT"
] | joerhodes3/graphene-django | graphene_django/tests/test_views.py | 24,067 | Python |
import RPi.GPIO as GPIO
from time import sleep
import sys
#Set warnings off (optional)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
#Set Button and LED pins
JOYSTICK_BUTTON = 12
MAIN_SWITCH = 22
LED = 6
class button():
'''
A simple Push-Button class
'''
def __init__(self, pin, pud_up_down):
... | 27.763636 | 104 | 0.618206 | [
"MIT"
] | Pet-Series/Pet-Mk-VII | pet_mk_viii/UnitTest/push_button.py | 1,535 | Python |
import pickle
import sys
import platform
import gc
import copy
import warnings
import tempfile
from StringIO import StringIO
from os import path
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_equal,
assert_almost_equal, assert_array_equal, assert_array_almost_... | 34.860752 | 92 | 0.541992 | [
"BSD-3-Clause"
] | dlax/numpy | numpy/core/tests/test_regression.py | 59,333 | Python |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""
Class describing simulation configuration object
"""
import os
import shutil
import subprocess
import sys
from collections import OrderedDict
import logging as log
fr... | 39.314417 | 91 | 0.576132 | [
"Apache-2.0"
] | courageheart/opentitan | util/dvsim/SimCfg.py | 25,633 | Python |
import platform
from conans.client.graph.graph import CONTEXT_BUILD
from conans.errors import ConanException
class _SystemPackageManagerTool(object):
mode_check = "check"
mode_install = "install"
tool_name = None
install_command = ""
update_command = ""
check_command = ""
def __init__(se... | 43.557078 | 130 | 0.547437 | [
"MIT"
] | sthagen/conan-io-conan | conan/tools/system/package_manager.py | 9,539 | Python |
#
# Copyright 2014 OpenStack Foundation
# 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 req... | 42.060367 | 97 | 0.582652 | [
"Apache-2.0"
] | overcastcloud/ironic | ironic/dhcp/neutron.py | 16,025 | Python |
# Copyright 2013 OpenStack Foundation
#
# 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... | 42.445402 | 79 | 0.627243 | [
"Apache-2.0"
] | hashnfv/hashnfv-moon | keystone-moon/keystone/tests/unit/test_associate_project_endpoint_extension.py | 59,084 | Python |
"""
Unittests of asm2cfg's regexes
"""
import unittest
from src.asm2cfg import asm2cfg
class FunctionHeaderTestCase(unittest.TestCase):
"""
Tests of function header regex
"""
def test_gdb_unstripped(self):
line = 'Dump of assembler code for function test_function:'
fmt, fun = asm2cf... | 32.425641 | 78 | 0.652697 | [
"MIT"
] | clayne/asm2cfg | test/test_regex.py | 6,323 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Franck Cuny <franck@lumberjaph.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the L... | 30.651584 | 143 | 0.669767 | [
"MIT"
] | archmangler/jumpcloud | ansible/grab001/lib/python2.7/site-packages/ansible/modules/extras/packaging/language/cpanm.py | 6,774 | Python |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QDialog, QApplication, QWidget, QVBoxLayout, QHBoxLayout, QGroupBox
from PyQt5 import uic
from os.path import join, dirname, abspath
from qtpy.QtCore import Slot, QTimer, QThread, Signal, QObject, Qt
#from PyQt5 import Qt
_ST_DLG = join(... | 31.227273 | 106 | 0.642649 | [
"CC0-1.0"
] | jibonaronno/Rhythm | startdialog.py | 1,374 | Python |
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
class _MutatioEnvironmentMeta(type):
"""Collects the mutatio tags into Mongo for the admin page."""
def __init__(cls, name, bases, dct):
super(_MutatioEnvironmentMeta, cls).__init__(name, bases, dct)
class Mutatio... | 32.84 | 73 | 0.705238 | [
"MIT"
] | Kazanz/mutatio-python | demo/flask_mutatio/environment.py | 821 | Python |
"""
An opportunity to explore how to make an EV3 Robot make sounds.
Authors: Dave Fisher, David Mutchler, Vibha Alangar,
their colleagues, and Leo Schoch-Spana.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import simple_rosebotics as rb
# ----------------------------------------------------------------... | 46.711538 | 86 | 0.46727 | [
"MIT"
] | schochla/06-IntroductionToRobots-201930 | src/m2_sounds.py | 2,429 | Python |
"""
This file offers the methods to automatically retrieve the graph Lysinimicrobium luteum.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... | 33.2 | 223 | 0.679002 | [
"MIT"
] | AnacletoLAB/ensmallen | bindings/python/ensmallen/datasets/string/lysinimicrobiumluteum.py | 3,486 | Python |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def length(head) -> int:
"""
The method length, which accepts a linked list
(head), and returns the length of the list.
:param head:
:return:
"""
i = 0
if head is Non... | 18.782609 | 53 | 0.581019 | [
"Unlicense"
] | iKostanOrg/codewars | kyu_7/fun_with_lists_length/length.py | 432 | Python |
import sys
sys.path.append('../scripts')
import pyprobml_utils as pml
pml.test()
print(42) | 18 | 29 | 0.755556 | [
"MIT"
] | XGX-CURRY/pyprobml | vae/kpmtest.py | 90 | Python |
from os.path import dirname, abspath
from datetime import timedelta
from fastapi import FastAPI, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from slowapi import _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from routers.tasks import router_tasks
fro... | 36.098592 | 84 | 0.730784 | [
"Apache-2.0"
] | imgVOID/autograde-api | main.py | 2,563 | Python |
# Copyright Materialize, Inc. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
... | 31.130268 | 98 | 0.610092 | [
"MIT"
] | antifuchs/materialize | misc/python/materialize/cli/mzbench.py | 8,125 | Python |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Machine/LamSlotWind.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Machine/LamSlotWind
"""
from os import linesep
from sys import getsizeof
f... | 33.201331 | 110 | 0.606545 | [
"Apache-2.0"
] | IrakozeFD/pyleecan | pyleecan/Classes/LamSlotWind.py | 19,954 | Python |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 36.914286 | 79 | 0.440402 | [
"BSD-3-Clause"
] | teresafds/bokeh | tests/unit/bokeh/application/handlers/test_notebook__handlers.py | 3,876 | Python |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Generate rules for snapshoting"""
from ggrc.snapshotter.datastructures import Attr
class Types(object):
"""Get default types for snapshotting"""
# pylint: disable=too-few-public-methods
all = {... | 20.093168 | 78 | 0.590108 | [
"ECL-2.0",
"Apache-2.0"
] | MikalaiMikalalai/ggrc-core | src/ggrc/snapshotter/rules.py | 3,235 | Python |
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 Stephen Blum
## http://www.pubnub.com/
## -----------------------------------
## PubNub 3.0 Real-time Push Cloud API
## -----------------------------------
tr... | 26.488439 | 114 | 0.481069 | [
"MIT"
] | goodybag/pubnub-api | python/3.2/Pubnub.py | 9,165 | Python |
#!/usr/bin/python2.7
print "run here: pack/big/b1.py"
def b1_fun(): print "function: pack/big/b1.py"
| 17.166667 | 46 | 0.679612 | [
"MIT"
] | qrsforever/workspace | python/learn/base/module/l1/pack/big/b1.py | 103 | Python |
# -*- coding: utf-8 -*-
"""
=======================
Cmap and Custom Bins
=======================
Invoke the cmap colour scheme and choose how many bins to use with your data.
By default, the cmap colour scheme is used if you have many, many chains. You can
enable it before that point if you wish and pass in the cmap ... | 39.933333 | 94 | 0.70729 | [
"MIT"
] | Jiaming1999/ChainConsumer | examples/customisations/plot_rainbow_serif_bins.py | 1,797 | Python |
from typing import List
from mdrsl.data_structures.rules.generalized_rule_part import GeneralizedAntecedent
from mdrsl.data_structures.item import Literal, NEQLiteral, EQLiteral
from mdrsl.rule_generation.decision_tree_conversion.attribute_id_to_name_conversion import DecisionTreeFeatureIDConverter
class TreeEdge:
... | 35.565789 | 121 | 0.669996 | [
"Apache-2.0"
] | joschout/Multi-Directional-Rule-Set-Learning | mdrsl/rule_generation/decision_tree_conversion/tree_edge.py | 2,703 | Python |
import boto3
import logging
import argparse
import requests
import xmltodict
import asyncio
import datetime
import time
import re
import json
import math
from sqlalchemy import func
from dateutil.relativedelta import relativedelta
from requests.exceptions import ConnectionError, ReadTimeout
from urllib3.exceptions ... | 46.57232 | 120 | 0.652259 | [
"CC0-1.0"
] | RonSherfey/data-act-broker-backend | dataactcore/scripts/pull_fpds_data.py | 89,512 | Python |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | 37.911765 | 102 | 0.728472 | [
"Apache-2.0"
] | cvarjao/gwells | app/gwells/models/ScreenIntakeMethodCode.py | 1,289 | Python |
from __future__ import with_statement
from distutils.version import StrictVersion
from itertools import chain
from select import select
import os
import socket
import sys
import threading
import warnings
try:
import ssl
ssl_available = True
except ImportError:
ssl_available = False
from redis._compat impo... | 35.776062 | 79 | 0.594566 | [
"MIT"
] | theatlantic/redis-py | redis/connection.py | 37,064 | Python |
#!/usr/bin/python
# Copyright (c) 2013 The Bitcoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
from urllib import urlopen
import requests
import getpass
from string import Template
im... | 47.097938 | 261 | 0.652731 | [
"MIT"
] | SoyPay/soypay | qa/pull-tester/pull-tester.py | 9,137 | Python |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 36.642857 | 78 | 0.445094 | [
"BSD-3-Clause"
] | ArchaeotheriumSapienter/bokeh | bokeh/models/__init__.py | 3,078 | Python |
"""
Django settings for Django_app project.
Generated by 'django-admin startproject' using Django 1.11.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import... | 25.587571 | 91 | 0.666372 | [
"MIT"
] | MartinBruveris/FinalYearProject | Django_app/Django_app/settings.py | 4,529 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Milan Ondrasovic <milan.ondrasovic@gmail.com>
import random
from typing import Sequence, Tuple, Dict, cast
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
from tracking import TrackedDetection
ColorT = Tuple[int, int, int]
PointT = Tuple[... | 34.235955 | 80 | 0.644568 | [
"MIT"
] | mondrasovic/multi_object_tracking_demo | vehicle_tracker/visual.py | 3,047 | Python |
""" Parses the `run.dat` input file for MechDriver that specifices all
of calculations to run for a given session of the code.
Specifcally, looks for and parses several subsections:
(1) `input` block: various input
(2) `pes' block: idxs denoting what PESs in mech file to run
(3) `spc` b... | 35.137387 | 79 | 0.581629 | [
"Apache-2.0"
] | Auto-Mech/moldriver | mechlib/amech_io/parser/run.py | 15,601 | Python |
import logging
import pytest
import pydantic
import requests
from pymarc import Record, Field
from airflow.models import Variable
from pytest_mock import MockerFixture
from plugins.folio.helpers import (
archive_artifacts,
move_marc_files_check_tsv,
post_to_okapi,
process_marc,
_move_001_to_035,
... | 26.678679 | 92 | 0.687753 | [
"Apache-2.0"
] | sul-dlss/folio-airflow | plugins/tests/test_helpers.py | 8,884 | Python |
from pathlib import Path
import yaml
from loguru import logger
CONFIG_FILENAME = ".prpr.yaml"
def get_config():
config_path = Path.home() / CONFIG_FILENAME
if not config_path.exists():
logger.error(f"{CONFIG_FILENAME} not found in your home directory 😿")
exit(1)
logger.debug(f"Reading c... | 25.529412 | 77 | 0.693548 | [
"MIT"
] | salmiakki/prpr | prpr/config.py | 437 | Python |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | 63.972603 | 143 | 0.649402 | [
"Apache-2.0",
"CC0-1.0"
] | pombredanne/scancode-toolkit | tests/textcode/test_analysis.py | 79,390 | Python |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..registration import MultiResolutionAffineRegistration
def test_MultiResolutionAffineRegistration_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
... | 34.288462 | 67 | 0.610768 | [
"Apache-2.0"
] | Abel-Gonzalez/nipype | nipype/interfaces/slicer/legacy/tests/test_auto_MultiResolutionAffineRegistration.py | 1,783 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | 34.746269 | 79 | 0.668814 | [
"MIT"
] | JordanWu1997/bettermoments | docs/conf.py | 2,328 | Python |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
import json
from re import compile
def boolean(x):
if x in [True, 1, '1', 'true', 'True']:
return "true"
if x in [False, 0, '0', 'false', 'False']:
return "false"
raise Value... | 27.813131 | 89 | 0.580897 | [
"BSD-2-Clause"
] | akerbergen/troposphere | troposphere/validators.py | 11,014 | Python |
from . import database_connect
from .exceptions import IrodsError, IrodsWarning
import logging
import re
def run_update(irods_config, cursor):
l = logging.getLogger(__name__)
new_schema_version = database_connect.get_schema_version_in_database(cursor) + 1
l.info('Updating to schema version %d...', new_sch... | 149.861111 | 1,001 | 0.779333 | [
"BSD-3-Clause"
] | macdaliot/irods | scripts/irods/database_upgrade.py | 10,790 | Python |
"""The Simulator class.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import numpy as np
import pybullet
from robovat.math.pose import Pose
from robovat.simulation import physics
from robovat.simulation.body import Body
from robovat.si... | 31.136161 | 79 | 0.538533 | [
"MIT"
] | StanfordVL/robovat | robovat/simulation/simulator.py | 13,949 | Python |
# -*- coding: utf-8 -*-
from openprocurement.planning.api.utils import opresource
from openprocurement.api.utils import get_now, context_unpack, json_view
from openprocurement.planning.api.validation import validate_plan_not_terminated
from openprocurement.api.validation import validate_file_update, validate_file_uploa... | 38.450704 | 115 | 0.684615 | [
"Apache-2.0"
] | BohdanBorkivskyi/openprocurement.api | src/openprocurement/planning/api/views/plan_milestone_document.py | 2,730 | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import rospy
import cv2
import sensor_msgs
import numpy as np
from cv_bridge import CvBridge
class CameraPublisher(object):
""" """
def __init__(self):
"""Default constructor"""
self.rgb_image_topic = rospy.get_param("~rgb_image_topic",... | 36.842857 | 118 | 0.633579 | [
"MIT"
] | Alexandre-Bonneau/uwds3_perception | scripts/camera_publisher_node.py | 2,579 | Python |
import time
import random
import os
import logging
import sys
from datetime import datetime
from datetime import timedelta
from urllib.parse import urlparse
from urllib.parse import urljoin
import click
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions imp... | 26.59719 | 99 | 0.588095 | [
"MIT"
] | kgantsov/instafollower | main.py | 11,363 | Python |
from datetime import datetime
from snuba.clickhouse.query_dsl.accessors import get_time_range
from snuba.datasets.factory import get_dataset
from snuba.datasets.plans.translator.query import identity_translate
from snuba.query.parser import parse_query
from snuba.query.processors.timeseries_processor import TimeSeries... | 35.977273 | 87 | 0.660771 | [
"Apache-2.0"
] | fpacifici/snuba | tests/clickhouse/query_dsl/test_time_range.py | 1,583 | Python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 36.562857 | 79 | 0.650231 | [
"Apache-2.0"
] | ISCAS-VDI/keystone | keystone/models/revoke_model.py | 12,797 | Python |
from .version import __version__
import pandoc_mustache
| 18.666667 | 32 | 0.875 | [
"CC0-1.0"
] | copart/pandoc-mustache | pandoc_mustache/__init__.py | 56 | Python |
import numpy as np
import cv2
# To capture webcam live stream, simply change the following line to: cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('./assets/video.mp4')
while (True):
# Capture frame by frame
_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# hsv (hue sat value) ... | 30.833333 | 128 | 0.658559 | [
"MIT"
] | randomvi/opencv-color-detector | main.py | 1,110 | Python |
'''Ensemble some predictions. '''
import argparse
import collections
import math
from scipy.special import logsumexp
import sys
MODES = ['mean', 'max', 'logsumexp', 'noisy_or', 'log_noisy_or', 'odds_ratio']
def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argument('mode', choices... | 32.425287 | 92 | 0.538107 | [
"Apache-2.0"
] | acproject/GNNs | NAACL/ensemble.py | 2,821 | Python |
names = ["John", "Bob", "Dell", "python"];
print(names[0])
print(names[-1])
print(names[-2])
names[0] = "Amina"
print(names[0])
print(names[0:3])
# List methods
numbers = [1, 2, 3, 4, 5]
numbers.append(6)
numbers.insert(0, -1)
numbers.remove(3)
is_there = 1 in numbers
numbers.count(3) # it will return count of 3
# ... | 17.5 | 49 | 0.687619 | [
"MIT"
] | anuragarwalkar/basic-python | basic/list.py | 525 | Python |
#!/usr/bin/env python3
"""Install certificates from AWS S3.
This file is a template. It should be processed by Terraform.
"""
# Third-Party Libraries
import boto3
# Inputs from terraform
CERT_BUCKET_NAME = "${cert_bucket_name}"
CERT_READ_ROLE_ARN = "${cert_read_role_arn}"
SERVER_FQDN = "${server_fqdn}"
# These fi... | 28.591837 | 74 | 0.734475 | [
"CC0-1.0"
] | cisagov/openvpn-server-tf-module | cloudinit/install-certificates.py | 1,401 | Python |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from PyQt5.QtGui import QImage, qRgb, QPixmap
import numpy as np
import numpy as np
gray_color_table = [qRgb(i, i, i) for i in range(256)]
def toQImage(data, copy=True):
if data is None:
return QImage()
data = data.copy()
data[data>255] = 255
da... | 35.576271 | 112 | 0.618866 | [
"MIT"
] | eddy-ilg/iviz | python/iviz/Util.py | 2,099 | Python |
from rest_framework import serializers
from human_services.locations import models
from human_services.addresses.serializers import AddressSerializer
from human_services.phone_at_location.serializers import PhoneAtLocationSerializer
class LocationAddressSerializer(serializers.ModelSerializer):
address = AddressSe... | 38.916667 | 82 | 0.756959 | [
"BSD-3-Clause"
] | DarwishMenna/pathways-backend | human_services/locations/serializers.py | 934 | Python |
# Copyright (c) 2018-2022 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... | 42.904421 | 124 | 0.599649 | [
"Apache-2.0"
] | uber/vertica-python | vertica_python/vertica/connection.py | 35,911 | Python |
"""Tests for the Timestamp class."""
#
# (C) Pywikibot team, 2014-2021
#
# Distributed under the terms of the MIT license.
#
import calendar
import datetime
import re
import unittest
from contextlib import suppress
from pywikibot import Timestamp
from tests.aspects import TestCase
class TestTimestamp(TestCase):
... | 35.006667 | 79 | 0.629404 | [
"MIT"
] | LeesahMasko/piwikibot | tests/timestamp_tests.py | 5,251 | Python |
"""Download an image from the Web App and detect coordinates.
download the image corresponding to the ID provided and run plant detection
and coordinate conversion
"""
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from plant_detection.PlantDetection import PlantDetection
from plant_detect... | 30 | 75 | 0.740278 | [
"MIT"
] | Pandinosaurus/farmbot_os | priv/farmware/quickscripts/download_and_detect_coordinates.py | 720 | Python |
class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.stack1 = []
self.stack2 = []
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.stack1.append(x)
if len(self.stack2) == 0... | 22.689189 | 109 | 0.48243 | [
"MIT"
] | Sycamore-City-passerby/ML | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | 1,679 | Python |
from scapy.all import *
interface ='mon0'
probe_req = []
ap_name = raw_input("Please enter the AP name ")
def probesniff(fm):
if fm.haslayer(Dot11ProbeReq):
client_name = fm.info
if client_name == ap_name :
if fm.addr2 not in probe_req:
print "New Probe Request: ", client_name
print "MAC ", fm.addr2
... | 26.133333 | 48 | 0.704082 | [
"MIT"
] | PacktPublishing/Python-Penetration-Testing-for-Developers | Module 2/Chapter 4/Chapter 4/probe_req.py | 392 | Python |
# Lint as: python2, python3
# Copyright 2019 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
#
... | 37.964567 | 80 | 0.657057 | [
"Apache-2.0"
] | hoangphucITJP/tpu | models/official/detection/modeling/architecture/resnet.py | 9,643 | Python |
import datetime
from constance import config
from django.conf import settings
from django.utils import dateparse , timezone
import django.db.models as db
def today(today=None):
if today is not None:
return dateparse.parse_date(today) if isinstance(today,basestring) else today
elif not getattr(settings,... | 33.608108 | 110 | 0.686771 | [
"Apache-2.0"
] | tperrier/mwachx | utils/utils.py | 2,487 | Python |
from typing import ClassVar, List, Optional, Tuple, Callable, Union, cast
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as D
from alphazero.network.distributions import SquashedNormal, GeneralizedBeta
from alphazero.network.utils import (
_map_nonli... | 38.708833 | 130 | 0.647087 | [
"MIT"
] | timoklein/A0C | alphazero/network/policies.py | 35,496 | Python |
#!/usr/bin/env python
# coding: utf-8
# This script creates a super tiny model that is useful inside tests, when we just want to test that
# the machinery works, without needing to the check the quality of the outcomes.
#
# This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny -... | 35.72 | 171 | 0.707353 | [
"Apache-2.0"
] | 1712871/transformers | scripts/fsmt/fsmt-make-super-tiny-model.py | 2,679 | Python |
from http_prompt.tree import Node
class Context(object):
def __init__(self, url=None, spec=None):
self.url = url
self.headers = {}
self.querystring_params = {}
self.body_params = {}
self.body_json_params = {}
self.options = {}
self.should_exit = False
... | 42.585366 | 98 | 0.505155 | [
"MIT"
] | Acidburn0zzz/http-prompt | http_prompt/context/__init__.py | 3,492 | Python |
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2014-2017 The CephCoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
# Add python-bitcoinr... | 35.356209 | 153 | 0.652509 | [
"MIT"
] | cephcoin/cephcoin | qa/rpc-tests/test_framework/util.py | 21,638 | Python |
from django.db import models
from django.utils.translation import gettext_lazy as _
class Summary(models.Model):
class Meta:
app_label = 'uwsgify'
managed = False
verbose_name = _('Summary')
verbose_name_plural = _('Summary')
class Configuration(models.Model):
class Meta:
... | 21.5 | 54 | 0.635659 | [
"BSD-3-Clause"
] | graceshaw/uwsgiconf | uwsgiconf/contrib/django/uwsgify/admin/models.py | 645 | Python |
import pandas as pd
from Event import Event
from Team import Team
from Constant import Constant
import numpy as np
class Game:
"""A class for keeping info about the games"""
def __init__(self, path_to_json):
# self.events = None
self.home_team = None
self.guest_team = None
self... | 27.242424 | 56 | 0.602892 | [
"MIT"
] | MediaBrain-SJTU/GroupNet | datasets/nba/Game.py | 899 | Python |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class CrawlerNewsItem(scrapy.Item):
url = scrapy.Field() # str
article_from = scrapy.Field() # str
article_type = scrapy.Field() # str
... | 27.583333 | 53 | 0.651057 | [
"MIT"
] | SecondDim/crawler-base | crawler_news/items.py | 662 | Python |
from codegen.generator.browser import BrowserCodegenStrategy
from codegen.generator.code_generator import CodeGenerator
from codegen.generator.node import NodeCodegenStrategy | 58 | 60 | 0.902299 | [
"Apache-2.0"
] | STScript-2020/cc21-artifact | codegen/generator/__init__.py | 174 | Python |
# -*- coding: utf-8 -*-
import pytest
from pytest_lazyfixture import sorted_by_dependency, lazy_fixture, _sorted_argnames
try:
import numpy
except ImportError:
numpy = None
def test_fixture_in_parametrize_with_params(testdir):
items = testdir.getitems("""
import pytest
@pytest.fixture(par... | 28.864184 | 114 | 0.570334 | [
"MIT"
] | TvoroG/pytest-lazy-fixture | tests/test_lazyfixture.py | 26,353 | Python |
import pandas as pd
import plotly.express as px
df = pd.read_csv('data/query_result.csv')
max_df = df.groupby(by='topic_id').max().reset_index()
df = df[df['topic_id'].isin(max_df[max_df['recall'] > 0]['topic_id'].to_list())]
for t in df['topic_id'].unique().tolist():
temp_df = df[df['topic_id'] == t]
fig = px... | 38.5 | 91 | 0.668831 | [
"MIT"
] | HamidSajjadi/SLR-Query-Formulation | analyze_results.py | 462 | Python |
import logging
from . import FileChecker
l = logging.getLogger(__name__)
class CheckPackageMetadata(FileChecker):
def check(self):
if self.sub_path("package-metadata.json").is_file():
self.fail("'package-metadata.json' is supposed to be automatically generated "
"by Pa... | 28.046875 | 99 | 0.610585 | [
"MIT"
] | Thom1729/st_package_reviewer | st_package_reviewer/check/file/check_redundant_files.py | 1,795 | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*
"""
Decorators to help manage our custom classes.
"""
TABLE_LIST = []
def register(cls):
"""
A decorator to register new table configuration classes.
"""
TABLE_LIST.append(cls)
return cls
def downloader(func):
"""
A decorator to download data... | 27.314286 | 83 | 0.634937 | [
"MIT"
] | JoeGermuska/census-data-downloader | census_data_downloader/core/decorators.py | 956 | Python |
from django.db import models
import uuid
from django.contrib.auth.models import User
from article.models import ArticlePost
from ckeditor.fields import RichTextField
from mptt.models import MPTTModel, TreeForeignKey
# Create your models here.
class Comment(models.Model): # 博文评论
article = models.ForeignKey(
... | 27.703704 | 53 | 0.679144 | [
"MIT"
] | jackyfzh/j_django_blog | comment/models.py | 760 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
from enum import Enum
from io import BytesIO
import logging
import optp... | 42.374508 | 310 | 0.606038 | [
"MIT"
] | THYMESIA-SECURITIES/T-Notes | test/functional/test_framework/test_framework.py | 53,858 | Python |
###############################################################################
# 1) This is a test case to verify that the deposit case works fine.
# 2) It also checks whether duplicate requests are processed correctly.
###############################################################################
############... | 47.607843 | 141 | 0.536656 | [
"Apache-2.0"
] | subincm/chain_replication | config/config1_3_add_server_1.py | 2,428 | Python |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import operator
import os
import platform
import sys
from setup... | 29.899696 | 93 | 0.603741 | [
"Unlicense"
] | Aimee-pacy/NEWS | env/env/lib/python3.6/site-packages/setuptools/_vendor/packaging/markers.py | 9,837 | Python |
import cannibalize
import xlsxwriter
import sys
import os
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
usage = "Kit Cannibaliztion\n" \
"usage: analyze.py kit_number serial1 serial2 serial3 ..."
if len(sys.argv) < 2:
print(usage)
else:
KIT = sys.argv[1]
SERIALS = [str... | 33.919355 | 89 | 0.543509 | [
"MIT"
] | IanDoarn/kit_cannibalization | analyze.py | 2,103 | Python |
# --------------------- Telegram.py --------------------------------- #
# Allows the integration with Telegram Bot.
# ------------------------------------------------------------------- #
from numpy.core.fromnumeric import around, std
import requests
import Elo
from Models import Models
import Helper
import pandas as p... | 43.275362 | 112 | 0.540522 | [
"MIT"
] | davideganna/NBA_Bet | NBABet/Telegram.py | 2,992 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 09:47:07 2019
@author: student
"""
import numpy as np
import os
np.set_printoptions(precision=3, linewidth=200, suppress=True)
LINE_WIDTH = 60
N_SIMULATION = 4000 # number of time steps simulated
dt = 0.002 # controller time step
q0 ... | 37.2 | 157 | 0.626882 | [
"BSD-2-Clause"
] | NimaPng/tsid | exercizes/ur5_conf.py | 1,860 | Python |
"""
Contains Catalyst DAO implementations.
"""
from django.conf import settings
from restclients.mock_http import MockHTTP
from restclients.dao_implementation import get_timeout
from restclients.dao_implementation.live import get_con_pool, get_live_url
from restclients.dao_implementation.mock import get_mockdata_url
i... | 34.792208 | 77 | 0.658081 | [
"Apache-2.0"
] | btb/uw-restclients | restclients/dao_implementation/catalyst.py | 2,679 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Mesmer.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are y... | 33.625 | 73 | 0.685874 | [
"Apache-2.0"
] | pythongiant/Mesmer | Mesmer/manage.py | 538 | Python |
import hashlib
import math
from http import HTTPStatus
from quart import jsonify, url_for, request
from lnurl import LnurlPayResponse, LnurlPayActionResponse, LnurlErrorResponse # type: ignore
from lnbits.core.services import create_invoice
from lnbits.utils.exchange_rates import get_fiat_rate_satoshis
from . import... | 32.009524 | 116 | 0.61321 | [
"MIT"
] | stepansnigirev/lnbits | lnbits/extensions/lnurlp/lnurl.py | 3,361 | Python |
# AMZ-Driverless
# Copyright (c) 2019 Authors:
# - Huub Hendrikx <hhendrik@ethz.ch>
#
# 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 ... | 41.677885 | 259 | 0.614834 | [
"MIT"
] | AMZ-Driverless/rbb_core | rbb_tools/src/rbb_tools/plugins/rviz_recorder.py | 8,669 | Python |
"""
Min Stack
-----
A LIFO abstract data type that serves as a collection of elements.
Supports retrieving the min from the stack in constant time.
"""
class MinStack(object):
def __init__(self):
"""
Attributes:
data (arr): data stored in the stack
minimum (arr): minimum values of data stored
"""
self... | 16.592105 | 66 | 0.634417 | [
"MIT"
] | tdudz/libalgs-py | libalgs-py/data_structures/min_stack.py | 1,261 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 52.725 | 172 | 0.739687 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py | 6,327 | Python |
import os
import time
import requests
from bs4 import BeautifulSoup
import datetime
from twilio.rest import Client
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import math
class Data():
def __init__(self,link): # Automatically stores the data from parsed link as the object's attribute
... | 36.828947 | 264 | 0.567256 | [
"MIT"
] | jtsuchiyama/hawaii-covid-tracker | app.py | 11,219 | Python |
#!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.beerchain import *
from test_framework.beerchainconfig import *
from test_framework.blocktools import *
i... | 35.721311 | 282 | 0.677375 | [
"MIT"
] | beerchainproject/beerchain | test/functional/beerchain_gas_limit.py | 2,179 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.