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 |
|---|---|---|---|---|---|---|---|---|
# encoding: utf-8
"""
This module defines the things that are used in setup.py for building JupyterLab
This includes:
* Functions for finding things like packages, package data, etc.
* A function for checking dependencies.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modif... | 30.969565 | 99 | 0.584164 | [
"BSD-3-Clause"
] | bualpha/jupyterlab | setupbase.py | 7,123 | Python |
# # SPDX-License-Identifier: MIT
# from augur.augurplugin import AugurPlugin
# from augur.application import Application
# class HousekeeperPlugin(AugurPlugin):
# """
# This plugin serves as an example as to how to load plugins into Augur
# """
# def __init__(self, augur_app):
# super().__init_... | 39.1 | 104 | 0.636829 | [
"MIT"
] | 0WeiyuFeng0/augur | augur/housekeeper/__init__.py | 1,173 | Python |
""" Video Link: https://youtu.be/1s-Tj65AKZA """
from seleniumbase import __version__
from seleniumbase import BaseCase
class HackTests(BaseCase):
def test_all_your_base_are_belong_to_us(self):
# First make sure that seleniumbase 1.65.0 or newer is installed
version = __version__.split(".")
... | 57.1477 | 79 | 0.631726 | [
"MIT"
] | GoVanguard/SeleniumBase | examples/hack_the_planet.py | 23,602 | Python |
from os.path import join as pjoin
from scrapy.spiders import (
Rule,
CrawlSpider,
)
from scrapy import exceptions
from scrapy.linkextractors import LinkExtractor
from django.conf import settings
from django.core.cache import caches
import tldextract
from core.extractors import ck0tp
from crawler import ite... | 22.777778 | 77 | 0.64878 | [
"MIT"
] | ikeikeikeike/scrape-django-app | scrape/crawler/crawler/spiders/ck0tp.py | 1,435 | Python |
import numpy as np
import pandas as pd
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import KFold
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
# import data and preprocess it
def preprocessing(file_name: str):
# ... | 41.509202 | 121 | 0.671593 | [
"Apache-2.0"
] | ofir-frd/Machine-Learning-Bootcamp | gradient-boosting/main.py | 6,766 | 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
# "License"); you may not u... | 37.75 | 74 | 0.772942 | [
"Apache-2.0"
] | Code-distancing/kafka-hue | kafka/src/kafka/settings.py | 1,057 | Python |
# -*- coding: utf-8 -*-
SUCCESSFUL_TERMINAL_STATUSES = ('complete', )
UNSUCCESSFUL_TERMINAL_STATUSES = ('cancelled', 'unsuccessful')
CONTRACT_REQUIRED_FIELDS = [
'awardID', 'contractID', 'items', 'suppliers',
'value', 'dateSigned',
#'documents'
]
CONTRACT_NOT_REQUIRED_FIELDS = [
'contractNumber', 'title... | 31 | 62 | 0.689826 | [
"Apache-2.0"
] | Scandie/openregistry.convoy | openregistry/convoy/loki/constants.py | 403 | Python |
"""
Plugin for Czech TV (Ceska televize).
Following channels are working:
* CT1 - https://www.ceskatelevize.cz/porady/ct1/
* CT2 - https://www.ceskatelevize.cz/porady/ct2/
* CT24 - https://ct24.ceskatelevize.cz/#live
* CT sport - https://www.ceskatelevize.cz/sport/zive-vysilani/
* CT Decko - https:... | 34.8327 | 121 | 0.539024 | [
"BSD-2-Clause"
] | Erk-/streamlink | src/streamlink/plugins/ceskatelevize.py | 9,161 | Python |
from __future__ import absolute_import
from sentry.testutils.cases import RuleTestCase
from sentry.rules.conditions.event_attribute import (EventAttributeCondition, MatchType)
class EventAttributeConditionTest(RuleTestCase):
rule_cls = EventAttributeCondition
def get_event(self):
event = self.create... | 29.662791 | 88 | 0.482634 | [
"BSD-3-Clause"
] | AlexWayfer/sentry | tests/sentry/rules/conditions/test_event_attribute.py | 12,755 | Python |
import re
class HeadersFormat(object):
@staticmethod
def call(header):
return HeadersFormat.format(re.sub(r'^HTTP(?:_|-)', '', header, flags=re.I))
@staticmethod
def format(header):
return '-'.join([v.capitalize() for v in re.split(r'_|-', header)])
| 23.75 | 84 | 0.617544 | [
"MIT"
] | castle/castle-python | castle/headers/format.py | 285 | Python |
a = input()
b = input()
something = a > b
if something:
print(a)
c = input()
<caret> | 12.285714 | 17 | 0.593023 | [
"Apache-2.0"
] | 06needhamt/intellij-community | python/testData/codeInsight/mlcompletion/isAfterIfWithoutElseAfterSameLevelLine.py | 86 | Python |
#basic example of dict synat
my_dict = {'key1':'value1','key2':'value2','key3':'value3'}
print(my_dict)
print(my_dict['key3'])
#xmpl 2
prices = {'apple':100,'banana':60,'gavava':90,'rice':50}
print(prices['rice'])
| 23.888889 | 59 | 0.669767 | [
"MIT"
] | alok-techqware/basic_python_practicse | python_basics/Dictionary/dict.py | 215 | Python |
import numpy as np
from time import sleep
import struct
import matplotlib.pyplot as plt
# input raw samples from MCU
# in_data = 'out/data_raw.txt'
in_data = 'out/8bit.txt'
fs = 5000
in_bits = 8
# load file
raw = np.loadtxt(in_data)
# Stats
print("Max=%d Min=%d Mean=%d swing=%d %.1fbits" % \
(np.max(raw), np.min(... | 28.080645 | 77 | 0.659391 | [
"Apache-2.0"
] | noah95/edison | audio/edison/audio/bit_depth_analyze.py | 1,741 | Python |
#!/home/pi/Documents/Codigos/API_Estacao/bin/python3
"""Simple FTDI EEPROM configurator.
"""
# Copyright (c) 2019-2020, Emmanuel Blot <emmanuel.blot@free.fr>
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
from argparse import ArgumentParser, FileType
from io import StringIO
from logging import Form... | 42.050314 | 78 | 0.542327 | [
"Apache-2.0"
] | andrario/API_Estacao | bin/ftconf.py | 6,686 | Python |
#!/usr/bin/env python3
######################################################
## Calibrating the extrinsics between T265 and D4xx ##
## Based on this example: https://github.com/IntelRealSense/librealsense/pull/4355
## with changes and modifications.
######################################################
#############... | 37.34593 | 154 | 0.617887 | [
"Apache-2.0"
] | mikobski/Critbot | robot/src/vision_to_mavros/scripts/calibrate_extrinsics.py | 12,847 | Python |
"""Implementation of Rule L044."""
from typing import Optional
from sqlfluff.core.rules.analysis.select_crawler import Query, SelectCrawler
from sqlfluff.core.parser import BaseSegment
from sqlfluff.core.rules.base import BaseRule, LintResult, RuleContext
from sqlfluff.core.rules.doc_decorators import document_groups
... | 41.633987 | 87 | 0.571115 | [
"MIT"
] | R7L208/sqlfluff | src/sqlfluff/rules/L044.py | 6,370 | Python |
import os, paramiko, time, schedule, smtplib, ssl
from datetime import datetime
from email.message import EmailMessage
host='localhost'
port='5432'
user='postgres'
password='admin'
database='testdb'
#chemin de sauvegarde locale
local_dir = 'C:\\Users\\Kamla\\projets\\auto-backup-sqldb\\backup\\'
#local_dir = 'Chemin ... | 33.315068 | 136 | 0.690789 | [
"MIT"
] | mykamla/auto-backup-sqldb | pgsqlbackup.py | 2,432 | 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:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 33.525773 | 94 | 0.679582 | [
"MIT"
] | ramanaditya/email-service | docs/conf.py | 3,252 | Python |
# NOTE - Still seems to be a leak here somewhere
# gateway count doesnt hit zero. Hence the print statements!
import sys
sys.coinit_flags = 0 # Must be free-threaded!
import win32api, pythoncom, time
import pywintypes
import os
import winerror
import win32com
import win32com.client.connect
from win32com.test.util i... | 34.930012 | 268 | 0.646166 | [
"MIT"
] | AndresFPerezG/jarvisProject | env/Lib/site-packages/win32com/test/testPyComTest.py | 29,446 | 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
# "License"); you may not u... | 33.763473 | 130 | 0.598031 | [
"Apache-2.0"
] | Vikas89/private-mxnet | python/mxnet/image/image.py | 45,108 | Python |
# coding: utf-8
"""
OpenShift API (with Kubernetes)
OpenShift provides builds, application lifecycle, image content management, and administrative policy on top of Kubernetes. The API allows consistent management of those objects. All API operations are authenticated via an Authorization bearer token that is... | 99.023256 | 3,380 | 0.793565 | [
"Apache-2.0"
] | flaper87/openshift-restclient-python | openshift/test/test_v1beta1_cpu_target_utilization.py | 4,258 | Python |
import warnings
import mmcv
import numpy as np
import torch
from torch.nn.modules.utils import _pair
from mmdet.core.anchor.builder import ANCHOR_GENERATORS
from mmdet.core.anchor import AnchorGenerator
@ANCHOR_GENERATORS.register_module(force=True)
class SSDAnchorGenerator(AnchorGenerator):
"""Anchor generator f... | 45.770833 | 103 | 0.591716 | [
"BSD-3-Clause"
] | www516717402/edgeai-mmdetection | xmmdet/core/anchor/anchor_generator.py | 6,591 | Python |
from __future__ import absolute_import
"""This module offers a display and interaction frontend with Qt.
It will try importing PySide first, and if that fails PyQt. The code will
constantly be tested with both bindings."""
from .displaywidgets import DisplayWidget, NewDisplayWidget
from .control import ControlWidget... | 28.981481 | 81 | 0.671565 | [
"BSD-3-Clause"
] | timo/zasim | zasim/gui/display.py | 1,565 | Python |
import json
import pytest
from typing import ClassVar, Dict, List, Sequence, Tuple, Union
from kat.harness import sanitize, variants, Query, Runner
from abstract_tests import AmbassadorTest, HTTP, AHTTP
from abstract_tests import MappingTest, OptionTest, ServiceType, Node, Test
class LogServiceTest(AmbassadorTest)... | 36.333333 | 145 | 0.616017 | [
"Apache-2.0"
] | DoodleScheduling/emissary | python/tests/kat/t_logservice.py | 10,464 | Python |
import typing
from typing import Dict, Union, Tuple, Iterator, Any
from typing import Optional
import numpy as np
import torch
from gym.utils import seeding
from advisor_losses import AlphaScheduler, AdvisorWeightedStage
from allenact.algorithms.offpolicy_sync.losses.abstract_offpolicy_loss import (
AbstractOffPo... | 33.497487 | 88 | 0.60156 | [
"Apache-2.0"
] | allenai/advisor | poisoneddoors_plugin/poisoneddoors_offpolicy.py | 6,666 | Python |
from django.contrib import admin
from django.db.models import get_model
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Condition = get_model('offer', 'Condition')
Benefit = get_model('offer', 'Benefit')
Range = get_model('offer', 'Range')
class ConditionAdmin(admin.ModelAdmin):
list_display = ('type',... | 31.611111 | 121 | 0.674868 | [
"BSD-3-Clause"
] | endgame/django-oscar | oscar/apps/offer/admin.py | 1,138 | Python |
import numpy
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
class ResizeImages3D(function_node.FunctionNode):
def __init__(self, output_shape):
self.out_H = output_shape[0]
self.out_W = output_shape[1]
self.out_D = output_shape[2]
... | 33.549738 | 79 | 0.508583 | [
"MIT"
] | pfnet-research/label-efficient-brain-tumor-segmentation | src/links/model/resize_images_3d.py | 6,408 | Python |
# coding=utf-8
'''
author: ShiLei Miao
analyses and build model about NBA
'''
import numpy as np
from numpy import *
import pandas as pd
from pandas import *
import os
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import KFold
from sklearn import metrics
os.chdir... | 33.537037 | 101 | 0.719216 | [
"MIT"
] | finlay-liu/rong360-dataanalysis2016 | Procedure/2_M1/train/m2-cv-rf.py | 3,732 | Python |
__author__ = 'miguel.freitas@checkmarx.com'
import os
import sys
import argparse
import pyodbc
import json
import array
DB = "CxDB"
def is_str(string):
return string is not None and isinstance(string, str) and len(string) > 0
def is_int(integer):
return not isinstance(integer, bool) and isinstance(integer... | 39.265504 | 84 | 0.554069 | [
"MIT"
] | cxpsemea/CxAddCustomCategory | add_custom_category.py | 20,261 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
class Post(models.Model):
status_ITEMS = (
(1, '上线'),
(2, '草稿'),
(3, '删除'),
)
title = models.CharField(max_length=50, verbose_name='标题')
desc = models.CharField(max_len... | 28.878378 | 89 | 0.732335 | [
"MIT"
] | liangtaos/typeidea | typeidea/blog/models.py | 2,307 | Python |
#!/usr/bin/env python2.7
# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
# Copyright 2016, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any
# commercial use m... | 38.324022 | 101 | 0.726531 | [
"MIT"
] | nttoole/AIT-Core | ait/core/test/test_dmc.py | 6,860 | Python |
# Copyright 2018 the GPflow 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 writi... | 35.013889 | 90 | 0.688616 | [
"Apache-2.0"
] | a-z-e-r-i-l-a/GPflow | tests/test_logdensities.py | 2,521 | Python |
# -*- coding: utf-8 -*-
"""
wsproto/handshake
~~~~~~~~~~~~~~~~~~
An implementation of WebSocket handshakes.
"""
from collections import deque
from typing import Deque, Dict, Generator, List, Optional, Union
import h11
from .connection import Connection, ConnectionState, ConnectionType
from .events import AcceptConne... | 37.212314 | 88 | 0.570605 | [
"MIT"
] | bluetech/wsproto | wsproto/handshake.py | 17,527 | Python |
import numpy as np
from astropy.io import fits
from scipy.interpolate import interp1d
# Fitting Sline3
def fit_spline3(y, x, order=3, nsum=3):
y_resampled = [np.median(y[i:i + nsum]) for i in range(0, len(y) - len(y) % nsum, nsum)]
x_resampled = np.linspace(0, len(y), len(y_resampled))
# Fitting
... | 37.510417 | 107 | 0.677312 | [
"MIT"
] | simontorres/goodman_ccdreduction | trim_slitedge.py | 3,601 | Python |
# -*- encoding: utf-8 -*-
# $Id: __init__.py,v 1.8.2.2 2007/05/22 21:06:52 customdesigned Exp $
#
# This file is part of the pydns project.
# Homepage: http://pydns.sourceforge.net
#
# This code is covered by the standard Python License.
#
# __init__.py for DNS class.
__version__ = '2.3.1'
import Type,Opcode,Status,... | 25.881356 | 80 | 0.722986 | [
"BSD-2-Clause"
] | levush/hipl | tools/hipdnsproxy/DNS/__init__.py | 1,527 | Python |
import os
import sys
import setuptools
# To prevent importing about and thereby breaking the coverage info we use this
# exec hack
about = {}
with open('python_utils/__about__.py') as fp:
exec(fp.read(), about)
if os.path.isfile('README.rst'):
long_description = open('README.rst').read()
else:
long_descr... | 27.615385 | 79 | 0.659239 | [
"BSD-3-Clause"
] | dvzrv/python-utils | setup.py | 1,077 | Python |
import logging as log
import cv2
import sys
import numpy as np
class LandmarksDetectionModel:
'''
Class for the Face Landmarks Detection Model.
Load and configure inference plugins for the specified target devices,
and performs either synchronous or asynchronous modes for the
specified infer requ... | 38.74359 | 119 | 0.627895 | [
"MIT"
] | ElisaCovato/Computer-pointer-controller---Intel-Edge-AI-Nanodegree | src/facial_landmarks_detection.py | 6,044 | Python |
"""
ASGI config for FYP project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_... | 22.529412 | 78 | 0.780679 | [
"BSD-3-Clause"
] | MustafaAbbas110/FinalProject | src/FYP/FYP/asgi.py | 383 | Python |
# -*- coding: utf-8 -*-
from __future__ import print_function
from IPython import get_ipython
from IPython.display import (
display,
Javascript,
)
from IPython.core import magic_arguments
from IPython.core.magic import (
Magics,
magics_class,
cell_magic,
)
from IPython.utils.importstring import imp... | 23.222222 | 78 | 0.558373 | [
"BSD-3-Clause"
] | bollwyvl/yamlmagic | yamlmagic.py | 2,090 | Python |
import h5py
import pickle
import numpy as np
# import read_affect_data as r
# from tqdm import tqdm
import random
from PIL import Image, ImageOps, ImageEnhance
import colorsys
# def read_h5_data_set(path):
# f = h5py.File(path, 'r')
# time_stamps = list(f[list(f.keys())[0]].keys())
# d = {time : dict() f... | 34.130137 | 338 | 0.553415 | [
"MIT"
] | HughMun/MultiBench | deprecated/robustness_tests_draft.py | 14,949 | Python |
import .rotor
| 7 | 13 | 0.785714 | [
"MIT"
] | HydrogenC/neox-tools | scripts/__init__.py | 14 | Python |
import os, sys
import ROOT
from ROOT import TH1F,TH2F,TFile,TTree,TCanvas, TProfile, TNtuple, gErrorIgnoreLevel, kInfo, kWarning
from tqdm import tqdm
from particle import Particle, PDGID
tqdm_disable = False
ROOT.gErrorIgnoreLevel = kWarning;
File = TFile("/home/kshi/Zprime/Zp_data_Ntuple/WmTo3l_ZpM45.root","READ")
... | 52.636364 | 295 | 0.68365 | [
"MIT"
] | Nik-Menendez/PyCudaAnalyzer | Wto3l/mom_counting.py | 3,474 | Python |
import logging
from korbit.client.korbit_client import KorbitClient
logging.basicConfig(level=logging.INFO)
properties_sandbox_file = '../properties_sandbox_test.json'
context_sandbox_file = '../context_sandbox.json'
kbclient = KorbitClient(properties_sandbox_file, context_sandbox_file)
print(kbclient.getUserInfo()... | 24.5 | 70 | 0.78863 | [
"MIT"
] | 0kim/korbit_client | test/korbit/client/korbit_client_tests.py | 694 | Python |
import asyncio
import socket
from stor.server.server import StorServer
from stor.types.peer_info import PeerInfo
def start_reconnect_task(server: StorServer, peer_info_arg: PeerInfo, log, auth: bool):
"""
Start a background task that checks connection and reconnects periodically to a peer.
"""
# If p... | 37.424242 | 106 | 0.647773 | [
"Apache-2.0"
] | Stor-Network/stor-blockchain | stor/server/reconnect_task.py | 1,235 | Python |
"""
Generates code metrics for a given project. Whereas code_metrics.py operates
on a single stream of source code input, this program walks a project tree and
generates reports based on all of the source code found.
TODO: project config should be supplied as input, not imported
"""
import os, shutil
import code_metr... | 34.466019 | 117 | 0.770423 | [
"MIT"
] | parappayo/code-metrics | project_metrics.py | 3,550 | Python |
"""
switchboard.manager
~~~~~~~~~~~~~~~~
:copyright: (c) 2015 Kyle Adams.
:license: Apache License 2.0, see LICENSE for more details.
"""
import logging
import sqlalchemy as sqla
from .base import ModelDict
from .models import (
Model,
Switch,
DISABLED, SELECTIVE, GLOBAL, INHERIT,
INCLUDE, EXCLUDE,
... | 33.752066 | 115 | 0.585945 | [
"Apache-2.0"
] | juju/switchboard | switchboard/manager.py | 8,168 | Python |
""" Player commands """
from .command import Command, ModelId, command
@command
class CreatePlayer(Command):
playlist_id: ModelId
@command
class PlayVideo(Command):
video_id: ModelId
@command
class StopPlayer(Command):
pass
@command
class TogglePlayerState(Command):
pass
@command
class SeekVi... | 11.840909 | 46 | 0.727447 | [
"MIT"
] | Tastyep/RaspberryCast | OpenCast/app/command/player.py | 521 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By Rodrigo Wilkens
# Last update 27/March/2022
# version ='1.0'
# ---------------------------------------------------------------------------
def join_institution(institution):
if ... | 42.67033 | 139 | 0.532578 | [
"MIT"
] | nueffing/ECNLP5_aclpub2 | openreview/util.py | 3,883 | Python |
from pdf_reports import ReportWriter
# DEFINE A WRITER WITH DEFAULT TEMPLATE AND VALUES
report_writer = ReportWriter(
default_stylesheets=["style.css"],
default_template="template.pug",
title="My default title",
version="0.1.2"
)
# THEN LATER IN YOUR CODE:
html = report_writer.pug_to_html(my_name="Zul... | 31.384615 | 72 | 0.762255 | [
"MIT"
] | Edinburgh-Genome-Foundry/pdf_reports | examples/example_reportwriter/example_reportwriter.py | 408 | Python |
from .interpreter_utils import (
SPEAKERLOOK,
SPEAKERPOS,
AGENTPOS,
is_loc_speakerlook,
process_spans_and_remove_fixed_value,
coref_resolve,
backoff_where,
strip_prefix,
ref_obj_lf_to_selector,
)
from .interpret_reference_objects import (
ReferenceObjectInterpreter,
interpre... | 24.453125 | 90 | 0.787859 | [
"MIT"
] | 1heart/fairo | droidlet/interpreter/__init__.py | 1,565 | Python |
# coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = [
'Foo',
]... | 21.65625 | 80 | 0.620491 | [
"Apache-2.0"
] | BearerPipelineTest/pulumi | pkg/codegen/testing/test/testdata/plain-schema-gh6957/python/pulumi_xyz/_inputs.py | 693 | Python |
import gorp
from gorp.readfiles import *
import unittest
ogdir = os.getcwd()
newdir = os.path.join(gorpdir, "testDir")
os.chdir(newdir)
is_version_2p0 = gorp.__version__[:3] == "2.0"
class XOptionTester(unittest.TestCase):
session = GorpSession(print_output=False)
@unittest.skipIf(
is_version_2p0,
... | 38.354839 | 211 | 0.547519 | [
"MIT"
] | molsonkiko/gorpy | gorp/test/test_x_option.py | 2,378 | Python |
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config import cfg
cfg = __C
#
# Training options
#
__C.TRAIN = edict()
# Online hard negative mining
__C.TRAIN.HARD_... | 30.031863 | 91 | 0.713458 | [
"MIT"
] | Juggernaut93/SSH-pytorch | model/utils/config.py | 12,253 | Python |
# Code in this file is copied and adapted from
# https://github.com/berkeleydeeprlcourse
import json
"""
Some simple logging functionality, inspired by rllab's logging.
Assumes that each diagnostic gets logged each iteration
Call logz.configure_output_dir() to start logging to a
tab-separated-values file (some_fo... | 28.67619 | 122 | 0.63733 | [
"MIT"
] | CoAxLab/AdaptiveDecisionMaking_2018 | ADMCode/snuz/ars/logz.py | 3,011 | Python |
# !/usr/bin/env python
# -*-coding: utf-8 -*-
__author__ = 'wtq'
LOG_PATH = "monitor_logging.log"
REDIS_HOST = "127.0.0.1"
REDIS_PORT = 6379
# 采集的间隔与间断时长
MONITOR_INTERVAL = 1
MONITOR_PEROID = 3
# 监控的读写速率的网卡
NET_NAME = 'eth0'
# 系统内各台机器的名字,以此来计算系统的平均负载信息
SYSTEM_MACHINE_NAME = ["storage1", "storage2"]
# 用来计算客户端链接数的... | 15.71875 | 46 | 0.735586 | [
"Apache-2.0"
] | wangtianqi1993/fuzzy_monitor | config/config.py | 631 | Python |
#!/usr/bin/env python
# (works in both Python 2 and Python 3)
# Offline HTML Indexer v1.32 (c) 2013-15,2020 Silas S. Brown.
# 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... | 53.635965 | 400 | 0.674053 | [
"Apache-2.0"
] | ssb22/indexer | ohi.py | 12,229 | Python |
import environ
from pathlib import Path
env = environ.Env(
# Sets debug to False if it cannot find .env
DEBUG=(bool, False)
)
environ.Env.read_env()
# GENERAL
# ------------------------------------------------------------------------------
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DI... | 37.266304 | 97 | 0.615429 | [
"MIT"
] | okayjones/django-x | config/settings.py | 6,857 | Python |
# model settings
model = dict(
type='CenterNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
add_summay_every_n_step=200,
style='pytorch'),
... | 30.117647 | 87 | 0.62793 | [
"Apache-2.0"
] | mrsempress/mmdetection | configs/centernext/eft18_o16_v1norm_3lr_alpha2_wd3e4_s123_nos_2x.py | 4,096 | Python |
import multiprocessing as mp
import itertools
import traceback
import pickle
import numpy as np
from numba import cuda
from numba.cuda.testing import (skip_on_cudasim, skip_under_cuda_memcheck,
ContextResettingTestCase, ForeignArray)
import unittest
def core_ipc_handle_test(the_work,... | 32.929825 | 77 | 0.591689 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | Emilka1604/numba | numba/cuda/tests/cudapy/test_ipc.py | 9,385 | Python |
#!/usr/bin/env python2
# Copyright 2016 Vimal Manohar
# 2016 Johns Hopkins University (author: Daniel Povey)
# Apache 2.0
from __future__ import print_function
import argparse
import logging
import sys
from collections import defaultdict
"""
This script reads and writes the 'ctm-edits' file that is
pro... | 45.164811 | 97 | 0.643178 | [
"Apache-2.0"
] | oplatek/kaldi | egs/wsj/s5/steps/cleanup/internal/modify_ctm_edits.py | 20,279 | Python |
P1 = float(input('Informe o primeiro preço: '))
P2 = float(input('Informe o primeiro preço: '))
P3 = float(input('Informe oprimeiro preço: '))
if (P1<P2) and (P1<P3):
print('O preço menor é {}'.format(P1))
elif (P2<P1) and (P2<P3):
print('O menor preço é {}'.format(P2))
else:
print('O menor preço é {}'.for... | 29.909091 | 47 | 0.62614 | [
"Apache-2.0"
] | kauaas/ATIVIDADES-PYTHON-N2 | ATIV07.py | 338 | Python |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, merge, publish... | 65.396226 | 254 | 0.841027 | [
"MIT"
] | MaximeBaudette/PyCIM | CIM15/CDPSM/Connectivity/IEC61970/Wires/__init__.py | 3,466 | Python |
from django.apps import AppConfig
class BooksConfig(AppConfig):
name = 'bookstudio.books'
verbose_name = 'books'
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass
| 19.714286 | 37 | 0.597826 | [
"MIT"
] | sudoabhinav/bookstudio | bookstudio/books/apps.py | 276 | Python |
# pylint: disable=too-few-public-methods, no-member
"""API for scheduling learning rate."""
from .. import symbol as sym
class LRScheduler(object):
"""Base class of a learning rate scheduler.
A scheduler returns a new learning rate based on the number of updates that have
been performed.
Parameters
... | 33.644068 | 94 | 0.645844 | [
"Apache-2.0"
] | 00liujj/tvm | nnvm/python/nnvm/compiler/lr_scheduler.py | 1,985 | Python |
import sys
import os
import re
import tempfile
import auto_editor
import auto_editor.vanparse as vanparse
from auto_editor.utils.log import Log
from auto_editor.ffwrapper import FFmpeg
def grep_options(parser):
parser.add_argument('--no-filename', action='store_true',
help='Never print filenames with outp... | 31.923611 | 97 | 0.58995 | [
"Unlicense"
] | chancat87/auto-editor | auto_editor/subcommands/grep.py | 4,597 | Python |
from project import app, socketio
if __name__ == "__main__":
print('Running BabyMonitorSoS \n')
socketio.run(app)
| 17.714286 | 38 | 0.701613 | [
"BSD-2-Clause"
] | BabyMonitorSimulation/BabyMonitorSoS | run.py | 124 | Python |
"""
Create a blueprint with endpoints for logins from configured identity providers.
The identity providers include, for example, Google, Shibboleth, or another
fence instance. See the other files in this directory for the definitions of
the endpoints for each provider.
"""
from authlib.common.urls import add_params_... | 35.984127 | 126 | 0.626305 | [
"Apache-2.0"
] | chicagopcdc/fence | fence/blueprints/login/__init__.py | 13,602 | Python |
#! /usr/bin/python
"""
Monitoring functions for xrootd cache server, producing classads
that can be handed to condor
"""
import os
import math
import time
import errno
import struct
import collections
import six
from six.moves import urllib
import classad
import XRootD.client
__all__ = ['collect_cache_stats']
# th... | 33.947977 | 118 | 0.596969 | [
"Apache-2.0"
] | ivukotic/xcache | src/xrootd_cache_stats.py | 11,746 | Python |
'''
dShell output classes
@author: tparker
'''
import os
import sys
import logging
import struct
import datetime
import dshell
import util
class Output(object):
'''
dShell output base class, extended by output types
'''
_DEFAULT_FORMAT = ''
_DEFAULT_TIMEFORMAT = '%Y-%m-%d %H:%M:%S'
_DEFAULT... | 38.886861 | 133 | 0.521445 | [
"BSD-2-Clause"
] | NTgitdude23/Dshell | lib/output/output.py | 21,310 | Python |
"""Auto-generated file, do not edit by hand. MQ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_MQ = PhoneMetadata(id='MQ', country_code=596, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[56]\\d{8}', possible_number_pattern='\\... | 85.3 | 182 | 0.759672 | [
"Apache-2.0"
] | Eyepea/python-phonenumbers | python/phonenumbers/data/region_MQ.py | 1,706 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 47.235656 | 2,846 | 0.658106 | [
"Apache-2.0"
] | sebtelko/pulumi-azure-native | sdk/python/pulumi_azure_native/network/v20200301/vpn_site.py | 23,051 | Python |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | 32.842324 | 81 | 0.707391 | [
"Apache-2.0"
] | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/cli/r2dt.py | 7,915 | Python |
import json
from django.http.response import Http404, HttpResponse, HttpResponseBadRequest
from hknweb.utils import login_and_permission
from hknweb.academics.models import Instructor
from hknweb.course_surveys.constants import Attr, COURSE_SURVEYS_EDIT_PERMISSION
@login_and_permission(COURSE_SURVEYS_EDIT_PERMISSIO... | 30.90625 | 80 | 0.744186 | [
"MIT"
] | Boomaa23/hknweb | hknweb/course_surveys/views/merge_instructors.py | 989 | Python |
import os
import pyudev
import psutil
import logging
import time
from arm.ripper import music_brainz
from arm.ui import db
from arm.config.config import cfg
from flask_login import LoginManager, current_user, login_user, UserMixin # noqa: F401
from prettytable import PrettyTable
hidden_attribs = ("OMDB_API_KEY", "EM... | 36.21447 | 119 | 0.610346 | [
"MIT"
] | charmarkk/automatic-ripping-machine | arm/models/models.py | 14,015 | Python |
# Copyright 2020 XEBIALABS
#
# 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, merge, publish, distribute, sublice... | 44.842105 | 462 | 0.720657 | [
"MIT"
] | xebialabs-community/xlr-logreport-plugin | src/main/resources/restapi/logger/getLogAppenders.py | 3,408 | Python |
import threading
from time import sleep
from .intcode import Intcode
class Amplifier(object):
def __init__(self, mem_str: str):
self._amps = [Intcode(mem_str, name=f'Amp {n + 1}') for n in range(5)]
def run(self, inputs: str or list, trace=False, quiet=True):
out = 0
p = self._amps[0... | 31.796296 | 78 | 0.522423 | [
"Unlicense"
] | GeoffRiley/AdventOfCode | intcode/amplifier.py | 1,717 | Python |
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: benedetto.abbenanti@gmail.com
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcente... | 27.1 | 133 | 0.760148 | [
"MIT"
] | Brantone/appcenter-sdks | sdks/python/test/test_DistributionGroupAppsDeleteRequest.py | 1,084 | Python |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | 34.704545 | 79 | 0.73019 | [
"Apache-2.0"
] | userzimmermann/robotframework | src/robot/model/criticality.py | 1,527 | Python |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Competition.url_redirect'
db.alter_column(u'web_compet... | 94.325866 | 264 | 0.578119 | [
"Apache-2.0"
] | AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public | codalab/apps/web/migrations/0082_auto__chg_field_competition_url_redirect.py | 46,314 | Python |
# Python program for implementation of Quicksort Sort
# This function takes last element as pivot, places
# the pivot element at its correct position in sorted
# array, and places all smaller (smaller than pivot)
# to left of pivot and all greater elements to right
# of pivot
def partition(arr, low, high):
i = (... | 25.875 | 53 | 0.591442 | [
"Apache-2.0"
] | goldy1992/algorithms | quicksort/quicksort.py | 1,449 | Python |
'''
Inter-coder agreement statistic Fleiss' Pi.
.. moduleauthor:: Chris Fournier <chris.m.fournier@gmail.com>
'''
from __future__ import absolute_import, division
from decimal import Decimal
from segeval.agreement import __fnc_metric__, __actual_agreement_linear__
def __fleiss_pi_linear__(dataset, **kwargs):
'''... | 36.45614 | 84 | 0.681906 | [
"BSD-3-Clause"
] | cfournie/segmentation.evaluation | segeval/agreement/pi.py | 2,078 | Python |
class Solution:
def knightProbability(self, N: int, K: int, r: int, c: int) -> float:
memo = {}
def dfs(i, j, p, k):
if 0 <= i < N and 0 <= j < N and k < K:
sm = 0
for x, y in ((-1, -2), (-2, -1), (-2, 1), (-1, 2), (1, 2), (2, 1), (2, -1), (1, -2)):
... | 42.4 | 101 | 0.327044 | [
"MIT"
] | nilax97/leetcode-solutions | solutions/Knight Probability in Chessboard/solution.py | 636 | Python |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torchvision import models
import torch.nn.functional as F
import math
import torch.utils.model_zoo as model_zoo
nonlinearity = nn.ReLU
class EncoderBlock(nn.Module):
def __init__(self, inchannel, outchannel, stride):
super().__init... | 35.429619 | 131 | 0.543931 | [
"MIT"
] | ZWZseven/Kaggle_TGS2018_solution | model/model.py | 24,163 | Python |
# Generated by Django 2.2 on 2021-12-05 14:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
... | 50.235294 | 266 | 0.639344 | [
"MIT"
] | harshavardhan-bhumi/profiles-rest-api | profiles_api/migrations/0001_initial.py | 1,708 | Python |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
'''
MapReduce Job Metrics
---------------------
mapreduce.job.elapsed_ime The elapsed time since the application started (in ms)
mapreduce.job.maps_total The total number of maps
map... | 40.253788 | 136 | 0.59043 | [
"BSD-3-Clause"
] | WPMedia/dd-agent | checks.d/mapreduce.py | 21,254 | Python |
"""
Create Sine function without using third-party plugins or expressions.
@Guilherme Trevisan - github.com/TrevisanGMW - 2021-01-25
1.0 - 2021-01-25
Initial Release
"""
try:
from shiboken2 import wrapInstance
except ImportError:
from shiboken import wrapInstance
try:
from PySide2.Q... | 46.27003 | 207 | 0.621946 | [
"MIT"
] | freemanpro/gt-tools | python-scripts/gt_add_sine_attributes.py | 15,593 | Python |
#!/usr/bin/python
# -*- coding: UTF-8, tab-width: 4 -*-
from sys import argv, stdin, stdout, stderr
from codecs import open as cfopen
import json
def main(invocation, *cli_args):
json_src = stdin
if len(cli_args) > 0:
json_src = cfopen(cli_args[0], 'r', 'utf-8')
data = json.load(json_src, 'utf... | 23.423077 | 78 | 0.514943 | [
"MIT"
] | mk-pmb/firefox-requestpolicy-util | rqpol-sort.py | 3,045 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
from typing import Optional
from fastapi import APIRouter, Depends, Request
from epicteller.core.controller import campaign as campaign_ctl
from epicteller.core.controller import room as room_ctl
from epicteller.core.error.base import NotFoundError
from epi... | 39.76 | 118 | 0.69165 | [
"MIT"
] | KawashiroNitori/epicteller | epicteller/web/handler/room.py | 1,988 | Python |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('parsing')
PARSER_TYPES = ['movie', 'series']
# Mapping of parser type to (m... | 39.43956 | 118 | 0.667317 | [
"MIT"
] | jbones89/Flexget | flexget/plugins/parsers/plugin_parsing.py | 3,589 | Python |
# Generated by Django 3.2.5 on 2021-07-20 12:31
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_article'),
]
operations = [
migrations.AlterField(
model_name='article',
name='detail',
... | 19.4 | 50 | 0.597938 | [
"MIT"
] | merveealpay/django-blog-project | blog/migrations/0004_alter_article_detail.py | 388 | Python |
import flask
from flask import request, jsonify
import sqlite3
app = flask.Flask(__name__)
app.config["DEBUG"] = True
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
@app.route('/', methods=['GET'])
def home():
return '''<h1>... | 24.621622 | 72 | 0.630626 | [
"BSD-3-Clause"
] | tuilagio/wordNotify-rev1 | tools/test_flask.py | 1,822 | Python |
#!/usr/bin/python3
# apt install libnetfilter-queue-dev
import os
import random
import string
import time
from multiprocessing import Pool
from netfilterqueue import NetfilterQueue
from scapy.all import *
SINGLE_QUEUE = False
if SINGLE_QUEUE:
nfqueue_number = 1
else:
nfqueue_number = 4
def setup():
k_m... | 30.6 | 145 | 0.586978 | [
"MIT"
] | moonlightelite/Traffic-Mod | traffic_modifier.py | 3,978 | Python |
# Copyright 2018 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... | 39.597015 | 81 | 0.707501 | [
"Apache-2.0"
] | uve/tensorflow | tensorflow/contrib/metrics/python/ops/metric_ops_large_test.py | 2,653 | Python |
# -*- coding: utf-8 -*-
import types
import copy
import inspect
import pprint
import re
import sys
import os
import pdb
import warnings
import logging
try:
import cProfile
import pstats
has_debug = True
except ImportError:
has_debug = False
import urlparse
import cgi
from wsgiref.simple_server import... | 38.074841 | 120 | 0.566225 | [
"MIT"
] | ghuntley/simpleapi | simpleapi/server/route.py | 23,912 | Python |
"""
Carbon Scraper Plugin for Userbot. //text in creative way.
usage: .carbon //as a reply to any text message
Thanks to @AvinashReddy3108 for a Base Plugin.
Go and Do a star on his repo: https://github.com/AvinashReddy3108/PaperplaneExtended/
"""
from selenium.webdriver.support.ui import Select
from selenium.webdriv... | 37.905405 | 111 | 0.700891 | [
"MPL-2.0"
] | Amazers03/Unitg | stdplugins/carbon.py | 2,805 | Python |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 31 20:29:57 2014
@author: garrett
"""
from user import User
def save_users(users, filename='output.csv'):
'''Save users out to a .csv file
Each row will represent a user UID, following by all the user's students
(if the user has any)
INPUT:
> ... | 28.986486 | 78 | 0.598601 | [
"MIT"
] | Garrett-R/infections | save_load.py | 2,145 | Python |
def equivalent(left, right):
if left.alphabet != right.alphabet:
raise ValueError("Input alphabets must be equal!")
transitions = []
previous_states = []
alphabet = left.alphabet
states = [(left.initial_state(), right.initial_state())]
while len(states) != 0:
l, r = states.pop(... | 32.785714 | 69 | 0.576253 | [
"MIT"
] | SHvatov/AutomataTheory | equivalence/equivalence.py | 918 | Python |
import torch
from torchvision.transforms import functional as TFF
import matplotlib.pyplot as plt
from theseus.base.trainer.supervised_trainer import SupervisedTrainer
from theseus.utilities.loading import load_state_dict
from theseus.classification.utilities.gradcam import CAMWrapper, show_cam_on_image
from theseus.ut... | 32.228571 | 102 | 0.566046 | [
"MIT"
] | lannguyen0910/theseus | theseus/classification/trainer/trainer.py | 9,024 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Beans Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test invalid p2p messages for nodes with bloom filters disabled.
Test that, when bloom filters are not e... | 40.673469 | 95 | 0.750627 | [
"MIT"
] | BakedInside/Beans-Core | test/functional/p2p_nobloomfilter_messages.py | 1,993 | Python |
# Copyright 2020 The SQLFlow Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 35.202128 | 78 | 0.658356 | [
"Apache-2.0"
] | awsl-dbq/sqlflow | python/runtime/step/xgboost/evaluate.py | 6,618 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.