max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
beet/contrib/render.py | Arcensoth/beet | 46 | 12100 | <filename>beet/contrib/render.py
"""Plugin that invokes the built-in template renderer."""
__all__ = [
"RenderOptions",
"render",
]
from typing import Dict, List
from pydantic import BaseModel
from beet import Context, configurable
class RenderOptions(BaseModel):
resource_pack: Dict[str, List[str]] ... | 2.3125 | 2 |
customtkinter/customtkinter_progressbar.py | thisSELFmySELF/CustomTkinter | 1 | 12101 | import sys
import tkinter
from .customtkinter_tk import CTk
from .customtkinter_frame import CTkFrame
from .appearance_mode_tracker import AppearanceModeTracker
from .customtkinter_color_manager import CTkColorManager
class CTkProgressBar(tkinter.Frame):
""" tkinter custom progressbar, always horizontal, values ... | 2.5625 | 3 |
backtest/tests/test_strategy.py | Christakou/backtest | 0 | 12102 | import pytest
from backtest.strategy import BuyAndHoldEqualAllocation
@pytest.fixture
def strategy():
symbols = ('AAPL', 'GOOG')
strategy = BuyAndHoldEqualAllocation(relevant_symbols=symbols)
return strategy
def test_strategy_execute(strategy):
strategy.execute()
assert len(strategy.holdings) > 0... | 2.71875 | 3 |
onnx/backend/test/case/node/constant.py | stillmatic/onnx | 0 | 12103 | # SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import onnx
from ..base import Base
from . import expect
class Constant(Base):
@staticmethod
def exp... | 1.96875 | 2 |
nvd3/multiChart.py | areski/python-nvd3 | 442 | 12104 | <filename>nvd3/multiChart.py<gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/are... | 3.21875 | 3 |
utils/config.py | AlbertiPot/nar | 2 | 12105 | """
Date: 2021/09/23
Target: config utilities for yml file.
implementation adapted from Slimmable: https://github.com/JiahuiYu/slimmable_networks.git
"""
import os
import yaml
class LoaderMeta(type):
"""
Constructor for supporting `!include`.
"""
def __new__(mcs, __name__, __bases__, __dict__):
... | 2.359375 | 2 |
src/api/fundings/entities.py | cbn-alpin/gefiproj-api | 2 | 12106 | <filename>src/api/fundings/entities.py<gh_stars>1-10
from marshmallow import Schema, fields, validate
from sqlalchemy import Column, String, Integer, Float, Date, ForeignKey
from sqlalchemy.orm import relationship
from ..funders.entities import Funder, FunderSchema
from src.api import db
from src.shared.entity import ... | 2.359375 | 2 |
src/extensions/COMMANDS/CommitCommand.py | DMTF/python-redfish-utility | 15 | 12107 | <filename>src/extensions/COMMANDS/CommitCommand.py<gh_stars>10-100
###
# Copyright Notice:
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/python-redfish-utility/blob/master/LICENSE.md
###
""" Commit Co... | 2.078125 | 2 |
rosetta/views.py | evrenesat/ganihomes | 24 | 12108 | from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.template i... | 1.882813 | 2 |
examples/experiment_pulse.py | HySynth/HySynth | 4 | 12109 | # to run this, add code from experiments_HSCC2021.py
def time_series_pulse():
path = Path(__file__).parent.parent / "data" / "real_data" / "datasets" / "basic_data"
filename1 = path / "pulse1-1.csv"
filename2 = path / "pulse1-2.csv"
filename3 = path / "pulse1-3.csv"
f1 = load_time_series(filename1,... | 2.5625 | 3 |
ironic/drivers/modules/drac/management.py | Tehsmash/ironic | 0 | 12110 | # -*- coding: utf-8 -*-
#
# Copyright 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 1.734375 | 2 |
matrix_diagonalization/finite_barrier_square_well.py | coherent17/physics_calculation | 1 | 12111 | import numpy as np
import matplotlib.pyplot as plt
#grid number on half space (without the origin)
N=150
#total grid number = 2*N + 1 (with origin)
N_g=2*N+1
#finite barrier potential value = 300 (meV)
potential_value=300
#building potential:
def potential(potential_value):
V=np.zeros((1,N_g),dtype=float)
V[0... | 2.890625 | 3 |
SVDD/__init__.py | SolidusAbi/SVDD-Python | 0 | 12112 | <filename>SVDD/__init__.py
from .BaseSVDD import BaseSVDD | 1 | 1 |
setup.py | SteveLTN/iex-api-python | 0 | 12113 | <reponame>SteveLTN/iex-api-python<filename>setup.py
import setuptools
import glob
import os
required = [
"requests",
"pandas",
"arrow",
"socketIO-client-nexus"
]
setuptools.setup(name='iex-api-python',
version="0.0.5",
description='Fetch data from the IEX API',
... | 1.640625 | 2 |
src/models/train_model.py | 4c697361/e-commerce | 3 | 12114 | import os
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
from keras.callbacks import ModelCheckpoint, EarlyStopping
import src.utils.utils as ut
import src.utils.model_utils as mu
import src.models.model as md
import src.models.data_generator as dg
import src.data.da... | 2.03125 | 2 |
Jobs/pm_match.py | Shantanu48114860/DPN-SA | 2 | 12115 | <gh_stars>1-10
"""
MIT License
Copyright (c) 2020 <NAME>
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, ... | 1.679688 | 2 |
varcode/effects/effect_prediction.py | openvax/varcode | 39 | 12116 | # Copyright (c) 2016-2019. Mount Sinai School of Medicine
#
# 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 ... | 1.820313 | 2 |
configs.py | platonic-realm/UM-PDD | 0 | 12117 | # OS-Level Imports
import os
import sys
import multiprocessing
from multiprocessing import cpu_count
# Library Imports
import tensorflow as tf
from tensorflow.keras import mixed_precision
from tensorflow.python.distribute.distribute_lib import Strategy
# Internal Imports
from Utils.enums import Environme... | 2.171875 | 2 |
Legacy/Audit_Sweep/daily_audit_cron.py | QualiSystemsLab/Power-Management | 0 | 12118 | <filename>Legacy/Audit_Sweep/daily_audit_cron.py
from power_audit import PowerAudit
def main():
local = PowerAudit()
local.full_audit()
if __name__ == '__main__':
main()
| 1.421875 | 1 |
python/hayate/store/actions.py | tao12345666333/Talk-Is-Cheap | 4 | 12119 | from turbo.flux import Mutation, register, dispatch, register_dispatch
import mutation_types
@register_dispatch('user', mutation_types.INCREASE)
def increase(rank):
pass
def decrease(rank):
return dispatch('user', mutation_types.DECREASE, rank)
| 1.867188 | 2 |
data_service/api/data_api.py | statisticsnorway/microdata-data-service | 0 | 12120 | import logging
import os
import io
from fastapi import APIRouter, Depends, Header
from fastapi.responses import FileResponse, StreamingResponse
from fastapi import HTTPException, status
import pyarrow as pa
import pyarrow.parquet as pq
from data_service.api.query_models import (
InputTimePeriodQuery, InputTimeQue... | 2.21875 | 2 |
lib/parser/augur/Bonus.py | Innoviox/QuizDB | 0 | 12121 | <filename>lib/parser/augur/Bonus.py
from utils import sanitize
class Bonus:
def __init__(self, number, leadin="", texts=None, answers=None,
category="", subcategory="",
tournament="", round=""):
self.number = number
self.leadin = leadin
self.texts = texts... | 2.953125 | 3 |
train_folds.py | wubinbai/argus-freesound | 1 | 12122 | import json
import argparse
from argus.callbacks import MonitorCheckpoint, \
EarlyStopping, LoggingToFile, ReduceLROnPlateau
from torch.utils.data import DataLoader
from src.datasets import FreesoundDataset, FreesoundNoisyDataset, RandomDataset
from src.datasets import get_corrected_noisy_data, FreesoundCorrecte... | 1.734375 | 2 |
source_code/day001/input-exercise.py | MKutka/100daysofcode | 0 | 12123 | #Day 1.3 Exercise!!
#First way I thought to do it without help
name = input("What is your name? ")
print(len(name))
#Way I found to do it from searching google
print(len(input("What is your name? "))) | 4.1875 | 4 |
pyvalidator/is_strong_password.py | theteladras/py.validator | 15 | 12124 | from typing import TypedDict
from .utils.Classes.String import String
from .utils.assert_string import assert_string
from .utils.merge import merge
class _IsStrongPasswordOptions(TypedDict):
min_length: int
min_uppercase: int
min_lowercase: int
min_numbers: int
min_symbols: int
return_score: ... | 2.75 | 3 |
boilerplate_app/serializers.py | taher-systango/DjangoUnboxed | 0 | 12125 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Python imports.
import logging
import datetime
import calendar
# Django imports.
from django.db import transaction
# Rest Framework imports.
from rest_framework import serializers
# Third Party Library imports
# local imports.... | 2.140625 | 2 |
wagtail/wagtailadmin/blocks.py | patphongs/wagtail | 3 | 12126 | <gh_stars>1-10
from __future__ import absolute_import, unicode_literals
import warnings
from wagtail.wagtailcore.blocks import * # noqa
warnings.warn("wagtail.wagtailadmin.blocks has moved to wagtail.wagtailcore.blocks", UserWarning, stacklevel=2)
| 1.117188 | 1 |
src/olympia/stats/management/commands/theme_update_counts_from_file.py | mstriemer/olympia | 0 | 12127 | <reponame>mstriemer/olympia
import codecs
from datetime import datetime, timedelta
from optparse import make_option
from os import path, unlink
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import commonware.log
from olympia import amo
from olympia.addons.models i... | 2.140625 | 2 |
KRR/Saved/Run 4/plot_all.py | MadsAW/machine-learning-on-materials | 2 | 12128 | <reponame>MadsAW/machine-learning-on-materials
import numpy as np
import pickle
import matplotlib.pyplot as plt
import os
import fnmatch
folder = "GP/"
ktype = "lin/"
matrices=os.listdir(folder+ktype)
for matrix in matrices:
if fnmatch.fnmatch(matrix, '*_val_*'):
with open(folder+ktype+matrix, "rb") as pic... | 2.78125 | 3 |
FATERUI/common/camera/mindvision/camera_mindvision.py | LynnChan706/Fater | 4 | 12129 | <reponame>LynnChan706/Fater
#!/usr/bin/env python2.7
# coding=utf-8
import logging
import traceback
import time
from FATERUI.common.camera.camera import Camera
from . import CameraMindVision
from FATERUI.common.camera.common_tools import *
import cv2
# from aoi.common.infraredcontrol import infraredcontrol
from time ... | 2.265625 | 2 |
tests/conftest.py | arosen93/jobflow | 10 | 12130 | import pytest
@pytest.fixture(scope="session")
def test_data():
from pathlib import Path
module_dir = Path(__file__).resolve().parent
test_dir = module_dir / "test_data"
return test_dir.resolve()
@pytest.fixture(scope="session")
def database():
return "jobflow_test"
@pytest.fixture(scope="ses... | 1.851563 | 2 |
src/utilities/download_file_from_zip.py | Bhaskers-Blu-Org2/arcticseals | 16 | 12131 | # This script allows to download a single file from a remote ZIP archive
# without downloading the whole ZIP file itself.
# The hosting server needs to support the HTTP range header for it to work
import zipfile
import requests
import argparse
class HTTPIO(object):
def __init__(self, url):
self.url = url... | 3.5625 | 4 |
cxphasing/CXFileReader.py | jbgastineau/cxphasing | 3 | 12132 | <filename>cxphasing/CXFileReader.py
import Image
import readMDA
import h5py
import os
import numpy
from mmpad_image import open_mmpad_tif
import numpy as np
import scipy as sp
import sys
#import libtiff
from cxparams import CXParams as CXP
class CXFileReader(object):
"""
file_reader
A generic and confi... | 2.828125 | 3 |
homeassistant/components/notify/file.py | SKarthick5121995/karthickmaduraai | 0 | 12133 | <filename>homeassistant/components/notify/file.py
"""
Support for file notification.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.file/
"""
import logging
import os
import homeassistant.util.dt as dt_util
from homeassistant.components.notify im... | 2.609375 | 3 |
app/eSignature/views/eg035_scheduled_sending.py | docusign/eg-03-python-auth-code-grant | 7 | 12134 |
""" Example 035: Scheduled sending and delayed routing """
from os import path
from docusign_esign.client.api_exception import ApiException
from flask import render_template, session, Blueprint, request
from ..examples.eg035_scheduled_sending import Eg035ScheduledSendingController
from ...docusign import authentica... | 2.34375 | 2 |
Informatik1/Finals Prep/HS20/1 Warmup/tally.py | Queentaker/uzh | 8 | 12135 | #-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --#
def tally(costs, discounts, rebate_factor):
cost = sum(costs)
discount = sum(discounts)
pre = (cost - discount) * rebate_factor
if pre < 0:
return 0
else:
return round(pre, 2)
#-- THIS LINE SHOULD BE THE LAST LINE OF ... | 3.140625 | 3 |
linear_sequence_of_dominos/valid_sequence.py | bhpayne/domino_tile_floor | 0 | 12136 | <reponame>bhpayne/domino_tile_floor
#!/usr/bin/env python3
"""
Given a set of dominos, construct a linear sequence
For example, if the set of dominos is
[ (0,0) (1,0), (1,1)]
then a valid linear sequence of length four would be
(0,0),(0,1),(1,1),(1,0)
In this script we first create a set of dominos to sample from.
The... | 3.9375 | 4 |
Projects/Arena/old-version.py | hastysun/Python | 1 | 12137 | ## Unit 4 Project - Two Player Game
## <NAME> - Computer Programming II
## The Elder Scrolls X
# A fan made 2 player game successor the The Elder Scrolls Series
# Two players start off in an arena
# Can choose starting items
# Can choose classes
## Libraries
import time # Self explanatory
import random # ... | 3.546875 | 4 |
chromium/tools/telemetry/telemetry/internal/image_processing/video.py | wedataintelligence/vivaldi-source | 925 | 12138 | <gh_stars>100-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.
import subprocess
from catapult_base import cloud_storage
from telemetry.core import platform
from telemetry.util import image_util
from ... | 2.40625 | 2 |
homeassistant/components/renault/renault_coordinator.py | basicpail/core | 5 | 12139 | <gh_stars>1-10
"""Proxy to handle account communication with Renault servers."""
from __future__ import annotations
from collections.abc import Awaitable
from datetime import timedelta
import logging
from typing import Callable, TypeVar
from renault_api.kamereon.exceptions import (
AccessDeniedException,
Kame... | 1.960938 | 2 |
Pacote Dowload/pythonProject/aula020.py | J297-hub/exercicios-de-python | 0 | 12140 | <reponame>J297-hub/exercicios-de-python<filename>Pacote Dowload/pythonProject/aula020.py
def soma (a,b):
print(f'A = {a} e B = {b}')
s=a+b
print(f'A soma A + B ={s}')
#Programa Principal
soma(4,5)
| 2.265625 | 2 |
docs/script/CLI_docker_image_uri_script.py | ai4eu/on-boarding | 0 | 12141 | #!/usr/bin/env python3
# ===================================================================================
# Copyright (C) 2019 Fraunhofer Gesellschaft. All rights reserved.
# ===================================================================================
# This Acumos software file is distributed by Fraunhofer G... | 1.75 | 2 |
zeus/networks/pytorch/backbones/getter.py | shaido987/vega | 1 | 12142 | <filename>zeus/networks/pytorch/backbones/getter.py
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be ... | 2.015625 | 2 |
pure_ee/lista.py | geosconsulting/gee_wapor | 2 | 12143 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 20 08:40:22 2017
@author: fabio
"""
import ee
import ee.mapclient
ee.Initialize()
collection = ee.ImageCollection('MODIS/MCD43A4_NDVI')
lista = collection.toList(10)
#print lista.getInfo()
image = ee.Image('LC8_L1T/LC81910312016217LGN00')
#prin... | 2.359375 | 2 |
pkg/tests/helpers_test.py | hborawski/rules_pkg | 0 | 12144 | <filename>pkg/tests/helpers_test.py
# Copyright 2019 The Bazel 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
... | 2.34375 | 2 |
atendimento/admin.py | alantinoco/django-crmsmart | 0 | 12145 | from django.contrib import admin
from .models import Contato, Venda, FormaPagamento
admin.site.register(Contato)
admin.site.register(Venda)
admin.site.register(FormaPagamento)
| 1.296875 | 1 |
pome/models/transaction.py | pome-gr/pome | 3 | 12146 | <filename>pome/models/transaction.py
import os
import re
import urllib
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Tuple, Union
from money.currency import Currency
from money.money import Money
from werkzeug.utils import secure_filename
from pome import g
from pome.models.enc... | 2.296875 | 2 |
site/external/moya.logins/py/oauth1.py | moyaproject/moya-techblog | 31 | 12147 | from __future__ import unicode_literals
from __future__ import print_function
import moya
from moya.compat import text_type
from requests_oauthlib import OAuth1Session
def get_credentials(provider, credentials):
client_id = credentials.client_id or provider.get('client_id', None)
client_secret = credentials... | 2.140625 | 2 |
cgp.py | BakudanKame/CGPCatAndRat | 0 | 12148 | """
Cartesian genetic programming
"""
import operator as op
import random
import copy
import math
from settings import VERBOSE, N_COLS, LEVEL_BACK
class Function:
"""
A general function
"""
def __init__(self, f, arity, name=None):
self.f = f
self.arity = arity
self.name = f.... | 3.203125 | 3 |
historia/pops/logic/refiner.py | eranimo/historia | 6 | 12149 | <filename>historia/pops/logic/refiner.py
from historia.pops.logic.logic_base import LogicBase
from historia.economy.enums.resource import Good
class RefinerLogic(LogicBase):
def perform(self):
bread = self.get_good(Good.bread)
tools = self.get_good(Good.tools)
iron_ore = self.get_good(Good... | 2.625 | 3 |
image_processing/manual_features/extract-features.py | ColoredInsaneAsylums/PrivacySensitiveTranscription | 0 | 12150 | <reponame>ColoredInsaneAsylums/PrivacySensitiveTranscription
import argparse
import cv2
import numpy as np
import os
import _pickle as pickle
from descriptors import HOG
#from skimage.morphology import skeletonize
# run image filtering and HOG feature extraction
def main(im_path, desc_name):
print('[INFO] Prepari... | 2.921875 | 3 |
src/exco/extractor_spec/spec_source.py | thegangtechnology/excel_comment_orm | 2 | 12151 | import abc
class SpecSource(abc.ABC):
@abc.abstractmethod
def describe(self) -> str:
"""
Returns:
str to print in case there is an error constructing extractor for tracing back
"""
raise NotImplementedError()
class UnknownSource(SpecSource):
def describe(sel... | 3.25 | 3 |
app/admin.py | CS-Hunt/Get-Placed | 14 | 12152 | <filename>app/admin.py
from django.contrib import admin
from .models import Placement_Company_Detail,Profile,StudentBlogModel,ResorcesModel
admin.site.register(Placement_Company_Detail)
admin.site.register(Profile)
admin.site.register(StudentBlogModel)
admin.site.register(ResorcesModel) | 1.429688 | 1 |
data/mapping.py | wby1905/Graph-Transformer-SSPR | 2 | 12153 | import torch as t
import torch_geometric.utils as utils
def qw_score(graph):
"""
未实现qw_score,采用度数代替
:param graph:
"""
score = utils.degree(graph.edge_index[0])
return score.sort()
def pre_processing(graph, m, score, trees):
score, indices = score
indices.squeeze_()
old_edges = gr... | 2.390625 | 2 |
.archived/snakecode/0460.py | gearbird/calgo | 4 | 12154 | <gh_stars>1-10
from typing import Optional, Any
class Node:
def __init__(self, key: int = 0, val: int = 0):
self.key: int = key
self.val: int = val
self.freq: int = 0
self.pre: Optional[Node] = None
self.next: Optional[Node] = None
class DLList:
def __init__(self):
... | 3.296875 | 3 |
scripts/sha3.py | cidox479/ecc | 0 | 12155 | #/*
# * Copyright (C) 2017 - This file is part of libecc project
# *
# * Authors:
# * <NAME> <<EMAIL>>
# * <NAME> <<EMAIL>>
# * <NAME> <<EMAIL>>
# *
# * Contributors:
# * <NAME> <<EMAIL>>
# * <NAME> <<EMAIL>>
# *
# * This software is licensed under a dual BSD and GPL v2 license.
# * See LI... | 2.0625 | 2 |
lps/seeds.py | fernandoleira/lps-platform | 0 | 12156 | <reponame>fernandoleira/lps-platform
import csv
from pathlib import Path
from datetime import datetime
from lps.models import *
from lps.schemas import *
SEED_FOLDER_PATH = Path("db/seeds/")
def import_from_csv(csv_filename):
with open(SEED_FOLDER_PATH / csv_filename) as csv_file:
csv_read = csv.DictRe... | 2.71875 | 3 |
Python/Least_Common_Multiple_for_large_numbers.py | DeathcallXD/DS-Algo-Point | 0 | 12157 | <reponame>DeathcallXD/DS-Algo-Point<gh_stars>0
def GCD(a,b):
if b == 0:
return a
else:
return GCD(b, a%b)
a = int(input())
b = int(input())
print(a*b//(GCD(a,b)))
| 3.28125 | 3 |
matgendb/builders/examples/maxvalue_builder.py | Tinaatucsd/pymatgen-db | 0 | 12158 | <filename>matgendb/builders/examples/maxvalue_builder.py
"""
Build a derived collection with the maximum
value from each 'group' defined in the source
collection.
"""
__author__ = '<NAME> <<EMAIL>>'
__date__ = '5/21/14'
from matgendb.builders import core
from matgendb.builders import util
from matgendb.query_engine im... | 2.609375 | 3 |
dvc/dependency/ssh.py | yfarjoun/dvc | 2 | 12159 | from __future__ import unicode_literals
from dvc.output.ssh import OutputSSH
from dvc.dependency.base import DependencyBase
class DependencySSH(DependencyBase, OutputSSH):
pass
| 1.226563 | 1 |
multiscaleloss.py | praveeenbadimala/flow_unsupervised | 0 | 12160 | import torch
import torch.nn as nn
import optflow.compute_tvl1_energy as compute_tvl1_energy
def EPE(input_flow, target_flow, sparse=False, mean=True):
EPE_map = torch.norm(target_flow-input_flow,2,1)
if sparse:
EPE_map = EPE_map[target_flow != 0]
if mean:
return EPE_map.mean()
else:
... | 2.171875 | 2 |
object_detector/src/object_detector/object_detector.py | Ajapaik/ml-2021-ajapaik | 0 | 12161 | <gh_stars>0
import numpy as np
import time
import cv2
import argparse
import sys
import os
import glob
import json
from pathlib import Path
class ObjectDetector:
def file_exist(file_names_list: list) -> bool:
if all(list(map(os.path.isfile,file_names_list))):
return True
else:
... | 2.53125 | 3 |
pipeline/tests/engine/core/data/test_api.py | wkma/bk-sops | 2 | 12162 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 1.929688 | 2 |
pactools/mne_api.py | mathurinm/pactools | 0 | 12163 | import numpy as np
def _check_mne(name):
"""Helper to check if h5py is installed"""
try:
import mne
except ImportError:
raise ImportError('Please install MNE-python to use %s.' % name)
return mne
def raw_to_mask(raw, ixs, events=None, tmin=None, tmax=None):
"""
A function to ... | 2.796875 | 3 |
1101-1200/1152-Analyze User Website Visit Pattern/1152-Analyze User Website Visit Pattern.py | jiadaizhao/LeetCode | 49 | 12164 | <filename>1101-1200/1152-Analyze User Website Visit Pattern/1152-Analyze User Website Visit Pattern.py
import collections
from itertools import combinations
from collections import Counter
class Solution:
def mostVisitedPattern(self, username: List[str], timestamp: List[int], website: List[str]) -> List[str]:
... | 3.0625 | 3 |
src/tarot/magicEight.py | tjweldon/St_Germain | 0 | 12165 | import random
async def magicEightBall(ctx, message=True):
if message:
eightBall = random.randint(0, 19)
outlooks = [
"As I see it, yes.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again."... | 2.5625 | 3 |
app/mod_check/MySQL.py | RITC3/Hermes | 2 | 12166 | <reponame>RITC3/Hermes
import pymysql.cursors
from ..mod_check import app
@app.task
def check(host, port, username, password, db):
result = None
connection = None
try:
connection = pymysql.connect(host=host,
port=port,
user... | 1.992188 | 2 |
src/adafruit-circuitpython-bundle-4.x-mpy-20190713/examples/hue_simpletest.py | mbaaba/solar_panel | 1 | 12167 | import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp32spi
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
import neopixel
# Import Philips Hue Bridge
from adafruit_hue import Bridge
# Get wifi details and more from a secrets.py file
... | 2.515625 | 3 |
examples/python-echo/src/echo.py | mdelete/kore | 0 | 12168 | #
# Copyright (c) 2013-2018 <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIM... | 2.296875 | 2 |
src/token/__init__.py | mingz2013/py.script | 1 | 12169 | <gh_stars>1-10
# -*- coding:utf-8 -*-
"""
"""
__date__ = "14/12/2017"
__author__ = "zhaojm"
| 0.96875 | 1 |
pesto-cli/pesto/ws/service/process.py | CS-SI/pesto | 25 | 12170 | import asyncio
import logging
import traceback
import uuid
from typing import Optional, Tuple, Any, Callable
from pesto.ws.core.payload_parser import PayloadParser, PestoConfig
from pesto.ws.core.pesto_feature import PestoFeatures
from pesto.ws.core.utils import load_class, async_exec
from pesto.ws.features.algorithm_... | 1.773438 | 2 |
migration_runner/helpers.py | beveradb/ecs-digital-interview-test | 0 | 12171 | # -*- coding: utf-8 -*-
import logging
import os
import re
import sys
class Helpers:
def __init__(self, logger=None):
if logger is None:
self.logger = logging.getLogger(__name__)
else:
self.logger = logger
@staticmethod
def extract_sequence_num(filename):
s... | 2.6875 | 3 |
sitri/providers/contrib/ini.py | Elastoo-Team/sitri | 11 | 12172 | import configparser
import os
import typing
from sitri.providers.base import ConfigProvider
class IniConfigProvider(ConfigProvider):
"""Config provider for Initialization file (Ini)."""
provider_code = "ini"
def __init__(
self,
ini_path: str = "./config.ini",
):
"""
... | 2.59375 | 3 |
xpanse/api/assets/v2/ip_range.py | PaloAltoNetworks/cortex-xpanse-python-sdk | 3 | 12173 | <reponame>PaloAltoNetworks/cortex-xpanse-python-sdk<gh_stars>1-10
from typing import Any, Dict, List
from xpanse.const import V2_PREFIX
from xpanse.endpoint import ExEndpoint
from xpanse.iterator import ExResultIterator
class IpRangeEndpoint(ExEndpoint):
"""
Part of the Assets v2 API for handling IP Ranges.
... | 2.59375 | 3 |
polus-color-pyramid-builder-plugin/src/main.py | blowekamp/polus-plugins | 0 | 12174 | <reponame>blowekamp/polus-plugins<gh_stars>0
from bfio import BioReader
import argparse, logging
import numpy as np
from pathlib import Path
import filepattern, multiprocessing, utils
from concurrent.futures import ThreadPoolExecutor
COLORS = ['red',
'green',
'blue',
'yellow',
'... | 2.546875 | 3 |
kinetics/reaction_classes/general_rate_Law.py | wlawler45/kinetics | 13 | 12175 | from kinetics.reaction_classes.reaction_base_class import Reaction
class Generic(Reaction):
"""
This Reaction class allows you to specify your own rate equation.
Enter the parameter names in params, and the substrate names used in the reaction in species.
Type the rate equation as a string in rate_equa... | 3.453125 | 3 |
examples/03-interception/api.py | nomadsinteractive/migi | 3 | 12176 | <gh_stars>1-10
from ctypes import *
from migi.decorators import stdcall
@stdcall('MessageBoxW', 'User32.dll', interceptable=True)
def _native_message_box_w(hwnd: c_void_p, content: c_wchar_p, title: c_wchar_p, flags: c_uint32) -> c_int32:
if wstring_at(content) == "I'm in":
return _native_message_box_w.c... | 1.992188 | 2 |
adapters/heiman/HS1RC.py | russdan/domoticz-zigbee2mqtt-plugin | 146 | 12177 | <filename>adapters/heiman/HS1RC.py
from adapters.adapter_with_battery import AdapterWithBattery
from devices.switch.selector_switch import SelectorSwitch
class HeimanAlarmRemoteAdapter(AdapterWithBattery):
def __init__(self):
super().__init__()
self.switch = SelectorSwitch('Remote', 'action')
... | 2.375 | 2 |
tennis_model_scraper/tennis_model_scraper/spiders/tennis_data_co_uk_spider.py | DrAndrey/tennis_model | 0 | 12178 | # -*- coding: utf-8 -*-
"""
"""
import scrapy
from tennis_model.tennis_model_scraper.tennis_model_scraper import items
class TennisDataCoUkSpider(scrapy.Spider):
name = "tennis_data_co_uk"
allowed_domains = ["www.tennis-data.co.uk"]
start_urls = ["http://www.tennis-data.co.uk/alldata.php"]
custom_... | 2.71875 | 3 |
aoc20211219b.py | BarnabyShearer/aoc | 0 | 12179 | <reponame>BarnabyShearer/aoc
from aoc20211219a import *
def aoc(data):
sensors, _ = slam(parse(data))
return max(sum(abs(x) for x in sub(a, b)) for a in sensors for b in sensors)
| 2.296875 | 2 |
pyhmy/rpc/request.py | difengJ/pyhmy | 37 | 12180 | import json
import requests
from .exceptions import (
RequestsError,
RequestsTimeoutError,
RPCError
)
_default_endpoint = 'http://localhost:9500'
_default_timeout = 30
def base_request(method, params=None, endpoint=_default_endpoint, timeout=_default_timeout) -> str:
"""
Basic RPC request
... | 2.75 | 3 |
gaze_api/scripts/vidPub.py | ajdroid/tobii_ros | 0 | 12181 | <reponame>ajdroid/tobii_ros
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import socket
import threading
import rospy
from publisher import *
import cv2
import imagezmq
import numpy as np
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
def parse_sent_msg(msg):
ctr, fram... | 2.46875 | 2 |
LAImapping_SNAP/snappy_backscatterLAI.py | dipankar05/aws4agrisar | 5 | 12182 | import sys
import numpy
import numpy as np
from snappy import Product
from snappy import ProductData
from snappy import ProductIO
from snappy import ProductUtils
from snappy import FlagCoding
##############
import csv
###############MSVR
from sklearn.svm import SVR
from sklearn.preprocessing import StandardScaler
fro... | 2.421875 | 2 |
test_fiona_issue383.py | thomasaarholt/fiona-wheels | 0 | 12183 | <filename>test_fiona_issue383.py<gh_stars>0
import fiona
d = {
"type": "Feature",
"id": "0",
"properties": {
"ADMINFORES": "99081600010343",
"REGION": "08",
"FORESTNUMB": "16",
"FORESTORGC": "0816",
"FORESTNAME": "El Yunque National Forest",
"GIS_ACRES": 5582... | 1.828125 | 2 |
pre_commit_hooks/forbid_crlf.py | henryiii/pre-commit-hooks | 62 | 12184 | from __future__ import print_function
import argparse, sys
from .utils import is_textfile
def contains_crlf(filename):
with open(filename, mode='rb') as file_checked:
for line in file_checked.readlines():
if line.endswith(b'\r\n'):
return True
return False
def main(argv=Non... | 3.265625 | 3 |
backend/code/start.py | socek/iep | 0 | 12185 | if __name__ == "__main__":
print("Nothing yet...")
| 1.296875 | 1 |
vantage6/server/model/organization.py | jaspersnel/vantage6-server | 2 | 12186 | <gh_stars>1-10
import base64
from sqlalchemy import Column, String, LargeBinary
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm.exc import NoResultFound
from vantage6.common.globals import STRING_ENCODING
from .base import Base, Database
class Organizat... | 2.328125 | 2 |
checkov/terraform/checks/resource/aws/EKSSecretsEncryption.py | cclauss/checkov | 1 | 12187 | <reponame>cclauss/checkov<gh_stars>1-10
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class EKSSecretsEncryption(BaseResourceCheck):
def __init__(self):
name = "Ensure EKS Cluster has Secrets Encrypt... | 2.171875 | 2 |
analysis/models/nodes/analysis_node.py | SACGF/variantgrid | 5 | 12188 | <gh_stars>1-10
""" AnalysisNode is the base class that all analysis nodes inherit from. """
import logging
import operator
from functools import reduce
from random import random
from time import time
from typing import Tuple, Sequence, List, Dict, Optional
from celery.canvas import Signature
from django.conf import se... | 1.632813 | 2 |
lbrc_flask/standard_views.py | LCBRU/lbrc_flask_ui | 0 | 12189 | <reponame>LCBRU/lbrc_flask_ui<filename>lbrc_flask/standard_views.py<gh_stars>0
import os
import traceback
from flask import render_template, send_from_directory, current_app, g
from .emailing import email
def init_standard_views(app):
@app.route("/favicon.ico")
def favicon():
return send_from... | 2.40625 | 2 |
tests/data/program_analysis/PyAST2CAST/import/test_import_3.py | rsulli55/automates | 17 | 12190 | <filename>tests/data/program_analysis/PyAST2CAST/import/test_import_3.py
# 'from ... import ...' statement
from sys import exit
def main():
exit(0)
main() | 1.320313 | 1 |
postmanparser/form_parameter.py | appknox/postmanparser | 5 | 12191 | from dataclasses import dataclass
from typing import List
from typing import Union
from postmanparser.description import Description
from postmanparser.exceptions import InvalidObjectException
from postmanparser.exceptions import MissingRequiredFieldException
@dataclass
class FormParameter:
key: str
value: s... | 2.625 | 3 |
pip-check.py | Urucas/pip-check | 0 | 12192 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import pip
import os
import sys
def err(msg):
print "\033[31m✗ \033[0m%s" % msg
def ok(msg):
print "\033[32m✓ \033[0m%s" % msg
def main():
cwd = os.getcwd()
json_file = os.path.join(cwd, 'dependencies.json')
if os.path.isfile(json_file) =... | 2.484375 | 2 |
hxl/scripts.py | HXLStandard/libhxl-python | 30 | 12193 | <filename>hxl/scripts.py
"""
Console scripts
<NAME>
April 2015
This is a big, ugly module to support the libhxl
console scripts, including (mainly) argument parsing.
License: Public Domain
Documentation: https://github.com/HXLStandard/libhxl-python/wiki
"""
from __future__ import print_function
import argparse, jso... | 2.703125 | 3 |
1801-1900/1807.evaluate-thebracket-pairs-of-a-string.py | guangxu-li/leetcode-in-python | 0 | 12194 | #
# @lc app=leetcode id=1807 lang=python3
#
# [1807] Evaluate the Bracket Pairs of a String
#
# @lc code=start
import re
class Solution:
def evaluate(self, s: str, knowledge: list[list[str]]) -> str:
mapping = dict(knowledge)
return re.sub(r"\((\w+?)\)", lambda m: mapping.get(m.group(1), "?"), s)... | 3.28125 | 3 |
Math Functions/Uncategorized/Herons formula.py | adrikagupta/Must-Know-Programming-Codes | 13 | 12195 | <reponame>adrikagupta/Must-Know-Programming-Codes
#Heron's formula#
import math
unit_of_measurement = "cm"
side1 = int(input("Enter the length of side A in cm: "))
side2 = int(input("Enter the length of side B in cm: "))
side3 = int(input("Enter the length of side C in cm: "))
braket1 = (side1 ** 2) * (side2**2) + (... | 4.40625 | 4 |
viewer/bitmap_from_array.py | TiankunZhou/dials | 2 | 12196 | from __future__ import absolute_import, division, print_function
import numpy as np
import wx
from dials.array_family import flex
from dials_viewer_ext import rgb_img
class wxbmp_from_np_array(object):
def __init__(
self, lst_data_in, show_nums=True, palette="black2white", lst_data_mask_in=None
):
... | 2.15625 | 2 |
spinesTS/utils/_validation.py | BirchKwok/spinesTS | 2 | 12197 | import numpy as np
def check_x_y(x, y):
assert isinstance(x, np.ndarray) and isinstance(y, np.ndarray)
assert np.ndim(x) <= 3 and np.ndim(y) <= 2
assert len(x) == len(y)
| 3 | 3 |
sphinxsharp-pro/sphinxsharp.py | madTeddy/sphinxsharp-pro | 2 | 12198 | """
CSharp (С#) domain for sphinx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sphinxsharp Pro (with custom styling)
:copyright: Copyright 2021 by MadTeddy
"""
import re
import warnings
from os import path
from collections import defaultdict, namedtuple
from docutils import nodes
from docutils.parsers.rst import... | 1.601563 | 2 |
articles/migrations/0003_article_published_at.py | mosalaheg/django3.2 | 0 | 12199 | <filename>articles/migrations/0003_article_published_at.py
# Generated by Django 3.2.7 on 2021-10-02 08:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0002_auto_20211002_1019'),
]
operations = [
migrations.AddField(
... | 1.4375 | 1 |