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 |
|---|---|---|---|---|---|---|
upcfcardsearch/c8.py | ProfessorSean/Kasutamaiza | 0 | 3900 | <gh_stars>0
import discord
from discord.ext import commands
from discord.utils import get
class c8(commands.Cog, name="c8"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Sacrosanct_Devouring_Pyre', aliases=['c8'])
async def example_embed(self, ctx):
embed =... | 2.765625 | 3 |
SVMmodel_withSKF.py | tameney22/DCI-Capstone | 0 | 3901 | """
This script is where the preprocessed data is used to train the SVM model to
perform the classification. I am using Stratified K-Fold Cross Validation to
prevent bias and/or any imbalance that could affect the model's accuracy.
REFERENCE: https://medium.com/@bedigunjit/simple-guide-to-text-classification-nlp-usin... | 3.53125 | 4 |
red_dwarf/entrypoints/project_management.py | JesseMaitland/red-dwarf | 0 | 3902 | <gh_stars>0
from rsterm import EntryPoint
from red_dwarf.project import provide_project_context, ProjectContext
class InitProject(EntryPoint):
@provide_project_context
def run(self, project_context: ProjectContext) -> None:
project_context.init_project()
| 1.390625 | 1 |
src/consensus.py | dschwoerer/samscripts | 0 | 3903 | <reponame>dschwoerer/samscripts
#! /usr/bin/env python
# Copyright <NAME>, 2015. www.sovic.org
#
# Creates a pileup from a given SAM/BAM file, and calls consensus bases (or variants).
import os
import sys
import operator
import subprocess
def increase_in_dict(dict_counter, value):
try:
dict_counter[valu... | 2.4375 | 2 |
web/addons/account_payment/wizard/account_payment_populate_statement.py | diogocs1/comps | 0 | 3904 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 1.851563 | 2 |
libqtile/widget/imapwidget.py | akloster/qtile | 1 | 3905 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 <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, merg... | 1.773438 | 2 |
game/views/tests/game_definition_view_test.py | dimadk24/english-fight-api | 0 | 3906 | <reponame>dimadk24/english-fight-api
from rest_framework.response import Response
from rest_framework.test import APIClient
from game.models import GameDefinition, AppUser
def create_game_definition(api_client: APIClient) -> Response:
return api_client.post("/api/game_definition")
def get_game_definition(api_c... | 2.4375 | 2 |
2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/08-Text-Processing/01_Lab/02-Repeat-Strings.py | karolinanikolova/SoftUni-Software-Engineering | 0 | 3907 | # 2. Repeat Strings
# Write a Program That Reads a list of strings. Each string is repeated N times, where N is the length of the string. Print the concatenated string.
strings = input().split()
output_string = ""
for string in strings:
N = len(string)
output_string += string * N
print(output_string)
| 4.375 | 4 |
cloudkeeperV1/plugins/cleanup_aws_loadbalancers/test/test_args.py | mesosphere/cloudkeeper | 99 | 3908 | from cklib.args import get_arg_parser, ArgumentParser
from cloudkeeper_plugin_cleanup_aws_loadbalancers import CleanupAWSLoadbalancersPlugin
def test_args():
arg_parser = get_arg_parser()
CleanupAWSLoadbalancersPlugin.add_args(arg_parser)
arg_parser.parse_args()
assert ArgumentParser.args.cleanup_aws_... | 2.09375 | 2 |
mayan/apps/metadata/migrations/0011_auto_20180917_0645.py | prezi/mayan-edms | 4 | 3909 | <reponame>prezi/mayan-edms<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metadata', '0010_auto_20180823_2353'),
]
... | 1.703125 | 2 |
algorithm/dfs/boj_1260.py | ruslanlvivsky/python-algorithm | 3 | 3910 | <filename>algorithm/dfs/boj_1260.py
def dfs(V):
print(V, end=' ')
visited[V] = True
for n in graph[V]:
if not visited[n]:
dfs(n)
def dfs_s(V):
stack = [V]
visited[V] = True
while stack:
now = stack.pop()
print(now, end=' ')
for n in graph[now]:
... | 3.375 | 3 |
redirector.py | UKPLab/DiGAT | 8 | 3911 | from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
__author__ = "<NAME>, <NAME>, and <NAME>"
__copyright__ = "Copyright 2013-2015 UKP TU Darmstadt"
__credits__ = ["<NAME>", "<NAME>", "<NAME>"]
__license__ = "ASL"
class Redirector(webapp.RequestHandler):
def get(self)... | 2.453125 | 2 |
imgaug/augmenters/flip.py | pAoenix/image-Augmented | 1 | 3912 | <reponame>pAoenix/image-Augmented
"""
Augmenters that apply mirroring/flipping operations to images.
Do not import directly from this file, as the categorization is not final.
Use instead ::
from imgaug import augmenters as iaa
and then e.g. ::
seq = iaa.Sequential([
iaa.Fliplr((0.0, 1.0)),
... | 2.53125 | 3 |
2. Add Two Numbers DC(12-1-21).py | Dharaneeshwar/Leetcode | 4 | 3913 | # Time Complexity - O(n) ; Space Complexity - O(n)
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
carry = 0
out = temp = ListNode()
while l1 is not None and l2 is not None:
tempsum = l1.val + l2.val
tempsum += carry
... | 3.703125 | 4 |
deepgp_dsvi/demos/step_function.py | dks28/Deep-Gaussian-Process | 21 | 3914 | <reponame>dks28/Deep-Gaussian-Process
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from gpflow.kernels import White, RBF
from gpflow.likelihoods import Gaussian
from deep_gp import DeepGP
np.random.seed(0)
tf.random.set_seed(0)
def get_data():
Ns = 300
Xs = np.linspace(-0.5, 1.... | 2.515625 | 3 |
metaspace/engine/sm/engine/annotation_lithops/moldb_pipeline.py | METASPACE2020/METASPACE | 32 | 3915 | from __future__ import annotations
import json
import logging
from contextlib import contextmanager, ExitStack
from typing import List, Dict
import pandas as pd
from lithops.storage import Storage
from lithops.storage.utils import CloudObject, StorageNoSuchKeyError
from sm.engine.annotation_lithops.build_moldb impor... | 1.820313 | 2 |
gui/main_window/node_editor/items/connector_top_item.py | anglebinbin/Barista-tool | 1 | 3916 | from PyQt5.QtWidgets import QMenu
from gui.main_window.node_editor.items.connector_item import ConnectorItem
class ConnectorTopItem(ConnectorItem):
""" Class to provide top connector functionality """
def __init__(self, index, nodeItem, nodeEditor, parent=None):
super(ConnectorTopItem, self).__init_... | 3.015625 | 3 |
modules/platforms/python/pyignite/api/key_value.py | DirectXceriD/gridgain | 1 | 3917 | <gh_stars>1-10
# GridGain Community Edition Licensing
# Copyright 2019 GridGain Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause
# Restriction; you may not use this file except in compliance with the License. You may obtain... | 1.640625 | 2 |
wrt/wrt-manifest-tizen-tests/const.py | linshen/crosswalk-test-suite | 0 | 3918 | #!/usr/bin/env python
import sys, os
import itertools, shutil
path = os.path.abspath(__file__)
path = os.path.split(path)[0]
os.chdir(path)
print path
device_ssh_ip = ""
ssh_device = device_ssh_ip.split(",")
path_tcs = path + "/tcs"
path_result= path + "/result"
path_allpairs = path + "/allpairs"
path_resource = path ... | 2.28125 | 2 |
api/src/opentrons/protocol_engine/commands/thermocycler/open_lid.py | Opentrons/protocol_framework | 0 | 3919 | <reponame>Opentrons/protocol_framework
"""Command models to open a Thermocycler's lid."""
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from typing_extensions import Literal, Type
from pydantic import BaseModel, Field
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandC... | 2.453125 | 2 |
deep_utils/nlp/utils/utils.py | pooya-mohammadi/deep_utils | 36 | 3920 | def multiple_replace(text: str, chars_to_mapping: dict):
"""
This function is used to replace a dictionary of characters inside a text string
:param text:
:param chars_to_mapping:
:return:
"""
import re
pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
return re.sub(patter... | 4.125 | 4 |
apps/gamedoc/models.py | mehrbodjavadi79/AIC21-Backend | 3 | 3921 | <reponame>mehrbodjavadi79/AIC21-Backend<filename>apps/gamedoc/models.py
from django.db import models
# Create your models here.
class Gamedoc(models.Model):
link = models.URLField(max_length=500)
title = models.CharField(max_length=500)
repo_name = models.CharField(max_length=512, blank=True, null=True)
... | 2.203125 | 2 |
assignment/users/admin.py | LongNKCoder/SD4456_Python_Assignment_2 | 0 | 3922 | from django.contrib import admin
from users.models import Friendship
admin.site.register(Friendship)
# Register your models here.
| 1.398438 | 1 |
python/Word/demo_doc.py | davidgjy/arch-lib | 0 | 3923 | import docx
doc = docx.Document('demo.docx')
print('paragraphs number: %s' % len(doc.paragraphs))
print('1st paragraph: %s' % doc.paragraphs[0].text)
print('2nd paragraph: %s' % doc.paragraphs[1].text)
print('paragraphs runs: %s' % len(doc.paragraphs[1].runs))
print('1st paragraph run: %s' % doc.paragraphs[1].r... | 3.390625 | 3 |
src/GL/sim/gql_ql_sims_ml_analysis.py | kylmcgr/RL-RNN-SURF | 2 | 3924 | <reponame>kylmcgr/RL-RNN-SURF<filename>src/GL/sim/gql_ql_sims_ml_analysis.py
# Analysis the data generated from on policy simulations of QL, QLP and GQL.
from BD.sim.sims import sims_analysis, merge_sim_files, extract_run_rew
from BD.util.paths import Paths
def sims_analysis_BD():
input_folder = Paths.rest_path ... | 1.8125 | 2 |
scripts/randomize_sw2_seed.py | epichoxha/nanodump | 0 | 3925 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import glob
import random
import struct
def get_old_seed():
with open('include/syscalls.h') as f:
code = f.read()
match = re.search(r'#define SW2_SEED (0x[a-fA-F0-9]{8})', code)
assert match is not None, 'SW2_SEED not found!'
... | 2.4375 | 2 |
checker/checker/executer.py | grimpy/hexa-a | 3 | 3926 | <filename>checker/checker/executer.py
from subprocess import run, PIPE, TimeoutExpired, CompletedProcess
from codes import exitcodes
def _error_decode(response):
stderr = ""
if response.returncode:
if response.returncode < 0:
errmsg = exitcodes.get(abs(response.returncode), "Unknown Error")... | 2.328125 | 2 |
pfm/pf_command/update.py | takahi-i/pfm | 9 | 3927 | <reponame>takahi-i/pfm
import json
from pfm.pf_command.base import BaseCommand
from pfm.util.log import logger
class UpdateCommand(BaseCommand):
def __init__(self, name, forward_type,
remote_host, remote_port, local_port,
ssh_server, server_port, login_user, config):
sup... | 2.578125 | 3 |
tests/atfork/test_atfork.py | luciferliu/xTools | 0 | 3928 | <reponame>luciferliu/xTools
#!/usr/bin/python
#
# Copyright 2009 Google 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/licenses/LICENSE-2.0
#
# U... | 1.9375 | 2 |
IO/files/handling.py | brendano257/Zugspitze-Schneefernerhaus | 0 | 3929 | import os
from pathlib import Path
__all__ = ['list_files_recur', 'scan_and_create_dir_tree', 'get_all_data_files', 'get_subsubdirs']
def list_files_recur(path):
"""
Cheater function that wraps path.rglob().
:param Path path: path to list recursively
:return list: list of Path objects
"""
fi... | 3.5625 | 4 |
tools/mo/openvino/tools/mo/ops/detection_output_onnx.py | ryanloney/openvino-1 | 1,127 | 3930 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.utils import dynamic_dimension_value, shape_array, set_input_shapes
from openvino.tools.mo.ops.op import Op
class ExperimentalDetectronDetectionOutput(Op):
op = ... | 1.796875 | 2 |
driver.py | FahimMahmudJoy/Physionet_2019_Sepsis | 1 | 3931 | #!/usr/bin/env python
import numpy as np, os, sys
from get_sepsis_score import load_sepsis_model, get_sepsis_score
def load_challenge_data(file):
with open(file, 'r') as f:
header = f.readline().strip()
column_names = header.split('|')
data = np.loadtxt(f, delimiter='|')
# Ignore Seps... | 2.875 | 3 |
src/LspRuntimeMonitor.py | TafsirGna/ClspGeneticAlgorithm | 0 | 3932 | <gh_stars>0
#!/usr/bin/python3.5
# -*-coding: utf-8 -*
from collections import defaultdict
from threading import Thread
from time import perf_counter, time
from LspLibrary import bcolors
import time
import matplotlib.pyplot as plt
class LspRuntimeMonitor:
"""
"""
clockStart = None
clockEnd = None
... | 2.4375 | 2 |
core/github/parsers/__init__.py | goranc/GraphYourCodeVulnerability | 0 | 3933 | from .python.parser import PythonParser
all_parsers = [PythonParser]
| 1.125 | 1 |
methylcheck/predict/sex.py | FoxoTech/methylcheck | 0 | 3934 | <reponame>FoxoTech/methylcheck<filename>methylcheck/predict/sex.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
#app
import methylcheck # uses .load; get_sex uses methylprep models too and detect_array()
import logging
LOGGER = logging.getLogger(... | 2.375 | 2 |
backend/accounts/migrations/0003_auto_20201115_1537.py | mahmoud-batman/quizz-app | 0 | 3935 | # Generated by Django 3.1.2 on 2020-11-15 15:37
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20201115_1531'),
]
operations = [
migrations.AlterField(
model_name='customu... | 1.75 | 2 |
tests/test_basics.py | sirosen/git-fortune | 0 | 3936 | <reponame>sirosen/git-fortune<filename>tests/test_basics.py
import subprocess
from git_fortune._compat import fix_line_endings
from git_fortune.version import __version__
def test_help(capfd):
subprocess.check_call(["git-fortune", "-h"])
captured = capfd.readouterr()
assert (
fix_line_endings(
... | 2.4375 | 2 |
configs/keypoints/faster_rcnn_r50_fpn_keypoints.py | VGrondin/CBNetV2_mask_remote | 0 | 3937 | <reponame>VGrondin/CBNetV2_mask_remote<gh_stars>0
_base_ = [
'../_base_/models/faster_rcnn_r50_fpn.py'
]
model = dict(
type='FasterRCNN',
# pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen... | 1.609375 | 2 |
maskrcnn_benchmark/layers/roi_align_rotated_3d.py | picwoon/As_built_BIM | 2 | 3938 | <reponame>picwoon/As_built_BIM
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch, math
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from SparseConvNet.sparseconvnet.tools_3d_2d... | 1.71875 | 2 |
src/model/utils/utils.py | J-CITY/METADATA-EXTRACTOR | 0 | 3939 | <reponame>J-CITY/METADATA-EXTRACTOR<filename>src/model/utils/utils.py
import numpy as np
import os
from .logger import printLog
UNK = "$UNK$"
NUM = "$NUM$"
NONE = "O"
class ParrotIOError(Exception):
def __init__(self, filename):
message = "ERROR: Can not find file {}.".format(filename)
super(Parro... | 2.578125 | 3 |
noxfile.py | fatcat2/biggestContributor | 2 | 3940 | import nox
FILE_PATHS = ["utils", "main.py"]
@nox.session
def format(session):
session.install("black")
session.run("black", *FILE_PATHS)
| 1.453125 | 1 |
discordbot/economy/currencies.py | minhhoang1023/GamestonkTerminal | 1 | 3941 | import os
import df2img
import disnake
import pandas as pd
from PIL import Image
import discordbot.config_discordbot as cfg
from discordbot.config_discordbot import logger
from discordbot.helpers import autocrop_image
from gamestonk_terminal.economy import wsj_model
async def currencies_command(ctx):
"""Currenc... | 2.6875 | 3 |
aiovectortiler/config_handler.py | shongololo/aiovectortiler | 4 | 3942 | <filename>aiovectortiler/config_handler.py<gh_stars>1-10
import os
import yaml
import logging
logger = logging.getLogger(__name__)
class Configs:
server = None
recipes = {}
DB = None
plugins = None
@classmethod
def init_server_configs(cls, server_configs):
with open(server_configs) a... | 2.375 | 2 |
volksdep/converters/__init__.py | repoww/volksdep | 271 | 3943 | from .torch2onnx import torch2onnx
from .onnx2trt import onnx2trt
from .torch2trt import torch2trt
from .base import load, save
| 1.164063 | 1 |
t2vretrieval/models/mlmatch.py | Roc-Ng/HANet | 34 | 3944 | <reponame>Roc-Ng/HANet<gh_stars>10-100
import numpy as np
import torch
import framework.ops
import t2vretrieval.encoders.mlsent
import t2vretrieval.encoders.mlvideo
import t2vretrieval.models.globalmatch
from t2vretrieval.models.criterion import cosine_sim
from t2vretrieval.models.globalmatch import VISENC, TXTENC
c... | 1.953125 | 2 |
bench_fastapi/authentication/controllers/login.py | sharkguto/teste_carga | 1 | 3945 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# login.py
# @Author : <NAME> (<EMAIL>)
# @Link :
# @Date : 12/12/2019, 11:43:07 AM
from typing import Optional, Any
from fastapi import APIRouter, Body, Depends, HTTPException
from fastapi import Header, Security
from authentication.models.users import... | 2.453125 | 2 |
dronesym-python/flask-api/src/dronepool.py | dilinade/DroneSym | 1 | 3946 | <reponame>dilinade/DroneSym<filename>dronesym-python/flask-api/src/dronepool.py
#DronePool module which handles interaction with SITLs
from dronekit import Vehicle, VehicleMode, connect
from dronekit_sitl import SITL
from threading import Lock
import node, time
import mavparser
import threadrunner
drone_pool = {}
ins... | 2.546875 | 3 |
Problemset/longest-string-chain/longest-string-chain.py | KivenCkl/LeetCode | 7 | 3947 |
# @Title: 最长字符串链 (Longest String Chain)
# @Author: KivenC
# @Date: 2019-05-26 20:35:25
# @Runtime: 144 ms
# @Memory: 13.3 MB
class Solution:
# # way 1
# def longestStrChain(self, words: List[str]) -> int:
# # 动态规划
# # dp[i] = max(dp[i], dp[j] + 1) (0 <= j < i 且 words[j] 是 words[i] 的前身)
# ... | 3.390625 | 3 |
IKFK Builder/IKFK_Builder.py | ssimbox/ssimbox-rigTools | 1 | 3948 | <reponame>ssimbox/ssimbox-rigTools
from ctrlUI_lib import createClav2, createSphere
import maya.cmds as cmds
import maya.OpenMaya as om
from functools import partial
def duplicateChain(*args):
global ogChain
global chainLen
global switcherLoc
global side
global controllerColor
global clavC... | 2.21875 | 2 |
pipng/imagescale-q-m.py | nwiizo/joke | 1 | 3949 | <filename>pipng/imagescale-q-m.py
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module 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 t... | 2.328125 | 2 |
test/integration_test.py | NoopDog/azul | 0 | 3950 | <filename>test/integration_test.py
from abc import (
ABCMeta,
)
from concurrent.futures.thread import (
ThreadPoolExecutor,
)
from contextlib import (
contextmanager,
)
import csv
from functools import (
lru_cache,
)
import gzip
from io import (
BytesIO,
TextIOWrapper,
)
import json
import loggi... | 1.765625 | 2 |
server/openapi_server/controllers/data_transformation_controller.py | mintproject/MINT-ModelCatalogIngestionAPI | 2 | 3951 | import connexion
import six
from openapi_server import query_manager
from openapi_server.utils.vars import DATATRANSFORMATION_TYPE_NAME, DATATRANSFORMATION_TYPE_URI
from openapi_server.models.data_transformation import DataTransformation # noqa: E501
from openapi_server import util
def custom_datasetspecifications_i... | 2.140625 | 2 |
shap/plots/monitoring.py | NunoEdgarGFlowHub/shap | 8 | 3952 | import numpy as np
import scipy
import warnings
try:
import matplotlib.pyplot as pl
import matplotlib
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from . import labels
from . import colors
def truncate_text(text, max_len):
if len(text) > max_len:
return text[:i... | 3.3125 | 3 |
mod_core.py | nokia-wroclaw/innovativeproject-dbshepherd | 0 | 3953 | import re
import os
import cmd
import sys
import common
from getpass import getpass
from kp import KeePassError, get_password
from configmanager import ConfigManager, ConfigManagerError
common.init()
class ParseArgsException(Exception):
def __init__(self, msg):
self.msg = msg
class ModuleCore(cmd.Cmd):
def __... | 2.484375 | 2 |
code/testbed/pde1/FemPde1.py | nicolai-schwartze/Masterthesis | 1 | 3954 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 14:57:32 2020
@author: Nicolai
"""
import sys
import os
importpath = os.path.dirname(os.path.realpath(__file__)) + "/../"
sys.path.append(importpath)
from FemPdeBase import FemPdeBase
import numpy as np
# import from ngsolve
import ngsolve as ngs
from netgen.geom2d i... | 2.578125 | 3 |
cvxpy/cvxcore/tests/python/364A_scripts/power_lines.py | jasondark/cvxpy | 38 | 3955 | <reponame>jasondark/cvxpy<filename>cvxpy/cvxcore/tests/python/364A_scripts/power_lines.py
import numpy as np
from cvxpy import *
import copy
import time
# data for power flow problem
import numpy as np
n = 12 # total number of nodes
m = 18 # number of edges (transmission lines)
k = 4 # number of generator... | 2.234375 | 2 |
LeetCode/530 Minimum Absolute Difference in BST.py | gesuwen/Algorithms | 0 | 3956 | # Binary Search Tree
# Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.
#
# Example:
#
# Input:
#
# 1
# \
# 3
# /
# 2
#
# Output:
# 1
#
# Explanation:
# The minimum absolute difference is 1, which is the difference between 2 a... | 4.3125 | 4 |
backends/search/__init__.py | dev-easyshares/company | 0 | 3957 | <gh_stars>0
from company.choices import fr as choices
from mighty.errors import BackendError
import datetime, logging
logger = logging.getLogger(__name__)
CHOICES_APE = dict(choices.APE)
CHOICES_LEGALFORM = dict(choices.LEGALFORM)
CHOICES_SLICE = dict(choices.SLICE_EFFECTIVE)
class SearchBackend:
message = None
... | 2.421875 | 2 |
app/database/database.py | luisornelasch/melp | 0 | 3958 | <reponame>luisornelasch/melp
from sqlalchemy import create_engine, engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import os
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL").replace("postgres://", "postgresql+psycopg2://")
engine = create_engine(SQLALCHEMY_DAT... | 2.265625 | 2 |
ragweed/framework.py | soumyakoduri/ragweed | 0 | 3959 | <gh_stars>0
import sys
import os
import boto
import boto.s3.connection
import json
import inspect
import pickle
import bunch
import yaml
import ConfigParser
import rados
from boto.s3.key import Key
from nose.plugins.attrib import attr
from nose.tools import eq_ as eq
from .reqs import _make_admin_request
ragweed_env ... | 1.867188 | 2 |
exposing/_version.py | w4k2/exposing | 0 | 3960 | <filename>exposing/_version.py
"""
``exposing``
"""
__version__ = '0.2.2'
| 1.164063 | 1 |
opensteer/teams/admin.py | reckonsys/opensteer | 5 | 3961 | <filename>opensteer/teams/admin.py
from django.contrib import admin
from opensteer.teams.models import Team, Member
admin.site.register(Team)
admin.site.register(Member)
| 1.515625 | 2 |
tests/test_utils.py | ozora-ogino/tflite-human-tracking | 3 | 3962 | <gh_stars>1-10
from src.utils import check_direction, direction_config, is_intersect
# pylint:disable=unexpected-keyword-arg
class TestCheckDirection:
def test_true(self):
"""Test true case."""
directions = {
"right": {"prev_center": [0, 0], "current_center": [20, 0], "expect": True},... | 2.75 | 3 |
scpp_base/scpp_base/src/db/__init__.py | scorelab/social-currency | 4 | 3963 | _all__ = ["db_handler","coin_value_handler"] | 1.007813 | 1 |
test/test_parameter_set.py | crest-cassia/caravan_search_engine | 0 | 3964 | <reponame>crest-cassia/caravan_search_engine
import unittest
from caravan.tables import Tables
from caravan.parameter_set import ParameterSet
class ParameterSetTest(unittest.TestCase):
def setUp(self):
self.t = Tables.get()
self.t.clear()
def test_ps(self):
ps = ParameterSet(500, (2, ... | 2.390625 | 2 |
tests/unit/transport/s3/test_settings.py | TinkoffCreditSystems/overhave | 33 | 3965 | import pytest
from pydantic import ValidationError
from overhave.transport import OverhaveS3ManagerSettings
class TestS3ManagerSettings:
""" Unit tests for :class:`OverhaveS3ManagerSettings`. """
@pytest.mark.parametrize("test_s3_enabled", [False])
def test_disabled(self, test_s3_enabled: bool) -> None:... | 2.359375 | 2 |
examples/elCmd.py | mark-nicholson/python-editline | 4 | 3966 | <reponame>mark-nicholson/python-editline
"""A generic class to build line-oriented command interpreters.
Interpreters constructed with this class obey the following conventions:
1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
of c... | 2.828125 | 3 |
ecommerce-website/orders/admin.py | Shanu85/FCS_Project | 0 | 3967 | <reponame>Shanu85/FCS_Project
from django.contrib import admin
from .models import Order, receiverInfo
@admin.register(Order)
class OrderAdmin(admin.ModelAdmin):
date_hierarchy = 'created_at'
list_display = ('user', 'code', 'total_price', 'shipping_status', 'created_at')
list_display_links = ('user',)
... | 2.046875 | 2 |
data_structures/linked_lists/ll-kth-from-end/ll_kth.py | jeremyCtown/data-structures-and-algorithms | 0 | 3968 | <gh_stars>0
from node import Node
class LinkedList:
"""
initializes LL
"""
def __init__(self, iter=[]):
self.head = None
self._size = 0
for item in reversed(iter):
self.insert(item)
def __repr__(self):
"""
assumes head will have a val and we wi... | 3.859375 | 4 |
MuonAnalysis/MomentumScaleCalibration/test/LikelihoodPdfDBReader_cfg.py | ckamtsikis/cmssw | 852 | 3969 | import FWCore.ParameterSet.Config as cms
process = cms.Process("LIKELIHOODPDFDBREADER")
# process.load("MuonAnalysis.MomentumScaleCalibration.local_CSA08_Y_cff")
process.source = cms.Source("EmptySource",
numberEventsInRun = cms.untracked.uint32(1),
firstRun = cms.untracked.uint32(1)
)
process.load("Configur... | 1.320313 | 1 |
fast_fine_tuna/fast_fine_tuna.py | vinid/fast_fine_tuna | 0 | 3970 | <reponame>vinid/fast_fine_tuna
from transformers import AutoModel, AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
from sklearn.model_selection import StratifiedKFold
import numpy as np
import torch
from fast_fine_tuna.dataset import MainDatasetDouble, MainDataset
from transformers import AdamW
from torch... | 2.125 | 2 |
Message/Message.py | gauravyeole/KVstoreDB | 1 | 3971 | <filename>Message/Message.py
# Message class Implementation
# @author: <NAME> <<EMAIL>>
class Message:
class Request:
def __init__(self, action="", data=None):
self.action = action
self.data = data
class Rsponse:
def __init__(self):
self.status = False
... | 2.96875 | 3 |
wpt/websockets/websock_handlers/open_delay_wsh.py | gsnedders/presto-testo | 0 | 3972 | #!/usr/bin/python
from mod_pywebsocket import msgutil
import time
def web_socket_do_extra_handshake(request):
pass # Always accept.
def web_socket_transfer_data(request):
time.sleep(3)
msgutil.send_message(request, "line")
| 2.0625 | 2 |
airflow/providers/microsoft/psrp/operators/psrp.py | augusto-herrmann/airflow | 4 | 3973 | #
# 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... | 1.851563 | 2 |
appengine/monorail/services/api_pb2_v1_helpers.py | mithro/chromium-infra | 1 | 3974 | <gh_stars>1-10
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Convert Monorail PB objects to API PB objects"""
import datetime
import loggi... | 1.921875 | 2 |
excut/feedback/rulebased_deduction/deduction_engine_extended.py | mhmgad/ExCut | 5 | 3975 | """
This module contains the rule-based inference (rulebased_deduction engine)
"""
import itertools
from collections import defaultdict
from itertools import chain
from excut.explanations_mining.descriptions import dump_explanations_to_file
from excut.explanations_mining.descriptions_new import Description2, Atom, loa... | 2.234375 | 2 |
dataloader/viperlist_train.py | urasakikeisuke/rigidmask | 138 | 3976 | <reponame>urasakikeisuke/rigidmask<gh_stars>100-1000
import torch.utils.data as data
from PIL import Image
import os
import os.path
import numpy as np
import pdb
import glob
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
... | 2.234375 | 2 |
floodcomparison/__init__.py | jsosa/floodcomparison | 0 | 3977 | <filename>floodcomparison/__init__.py
from floodcomparison.core import floodcomparison
| 1.195313 | 1 |
weaver/wps_restapi/quotation/quotes.py | crim-ca/weaver | 16 | 3978 | import logging
import random
from datetime import timedelta
from typing import TYPE_CHECKING
from duration import to_iso8601
from pyramid.httpexceptions import HTTPBadRequest, HTTPCreated, HTTPNotFound, HTTPOk
from weaver import sort
from weaver.config import WEAVER_CONFIGURATION_ADES, WEAVER_CONFIGURATION_EMS, get_w... | 2.015625 | 2 |
strava.py | AartGoossens/streamlit-activity-viewer | 4 | 3979 | <reponame>AartGoossens/streamlit-activity-viewer
import base64
import os
import arrow
import httpx
import streamlit as st
import sweat
from bokeh.models.widgets import Div
APP_URL = os.environ["APP_URL"]
STRAVA_CLIENT_ID = os.environ["STRAVA_CLIENT_ID"]
STRAVA_CLIENT_SECRET = os.environ["STRAVA_CLIENT_SECRET"]
STRAV... | 2.75 | 3 |
appliance/src/ufw_interface.py | reap3r/nmfta-bouncer | 1 | 3980 | <filename>appliance/src/ufw_interface.py
#!/usr/bin/env python
#shamelessy stolen from: https://gitlab.com/dhj/easyufw
# A thin wrapper over the thin wrapper that is ufw
# Usage:
# import easyufw as ufw
# ufw.disable() # disable firewall
# ufw.enable() # enable firewall
# ufw.allow() #... | 2.078125 | 2 |
test/libsalt/test_vehicle.py | etri-city-traffic-brain/traffic-simulator | 8 | 3981 | <reponame>etri-city-traffic-brain/traffic-simulator
import libsalt
def test(salt_scenario):
libsalt.start(salt_scenario)
libsalt.setCurrentStep(25200)
step = libsalt.getCurrentStep()
while step <= 36000:
if (step % 100 == 0):
print("Simulation Step: ", step)
test_funcs(... | 2.4375 | 2 |
Masters/Copy Layer to Layer.py | davidtahim/Glyphs-Scripts | 1 | 3982 | #MenuTitle: Copy Layer to Layer
# -*- coding: utf-8 -*-
__doc__="""
Copies one master to another master in selected glyphs.
"""
import GlyphsApp
import vanilla
import math
def getComponentScaleX_scaleY_rotation( self ):
a = self.transform[0]
b = self.transform[1]
c = self.transform[2]
d = self.transform[3]
... | 2.609375 | 3 |
vunit/test/unit/test_tokenizer.py | bjacobs1/vunit | 1 | 3983 | <reponame>bjacobs1/vunit
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2018, <NAME> <EMAIL>
"""
Test of the general tokenizer
"""
from unittes... | 2.53125 | 3 |
modules/star_se_SP.py | tbersez/Allmine | 5 | 3984 | <filename>modules/star_se_SP.py
# STAR aligner single end mode, second pass
#
# This module runs the second pass of the STAR aligner 2 path
# strategy. The goal is to align reads taking in account splice
# junction found in the fist pass..
#
# Inputs:
# - sample_trim.fastq.gz
# - splicing junction f... | 2.375 | 2 |
Udemy/REST-Django-VueJS/C3-practice/03-demo/job_board/jobs/models.py | runzezhang/MOOCs | 3 | 3985 | from django.db import models
class JobOffer(models.Model):
company_name = models.CharField(max_length=50)
company_email = models.EmailField()
job_title = models.CharField(max_length=60)
job_description = models.TextField()
salary = models.PositiveIntegerField()
city = models.CharField(max_leng... | 2.296875 | 2 |
memeapp/views.py | barbaramootian/Memes-app | 0 | 3986 | from django.shortcuts import render,redirect
from django.contrib.auth.models import User
from django.contrib import messages
from .forms import PictureUploadForm,CommentForm
from .models import Image,Profile,Likes,Comments
from django.contrib.auth.decorators import login_required
from django.contrib .auth import authen... | 2.140625 | 2 |
sparv/modules/hist/diapivot.py | spraakbanken/sparv-pipeline | 17 | 3987 | """Create diapivot annotation."""
import logging
import pickle
import xml.etree.ElementTree as etree
import sparv.util as util
from sparv import Annotation, Model, ModelOutput, Output, annotator, modelbuilder
log = logging.getLogger(__name__)
PART_DELIM1 = "^1"
# @annotator("Diapivot annotation", language=["swe-1... | 2.546875 | 3 |
src/xbot/util/path.py | xinyang178/xbot | 77 | 3988 | import os
def get_root_path():
current_path = os.path.abspath(os.path.dirname(__file__))
root_path = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.dirname(current_path)))
)
return os.path.join(root_path, "xbot")
def get_config_path():
config_path = os.path.abspath(os.path.join... | 3.03125 | 3 |
home/website/wagtail_hooks.py | HackSoftware/hackconf.bg | 12 | 3989 | from django.utils.html import format_html
from wagtail.wagtailcore import hooks
@hooks.register('insert_editor_js')
def enable_source():
return format_html(
"""
<script>
registerHalloPlugin('hallohtml');
</script>
"""
)
| 1.585938 | 2 |
src/reporter/tests/test_api.py | msgis/ngsi-timeseries-api | 0 | 3990 | from conftest import QL_URL
import requests
def test_api():
api_url = "{}/".format(QL_URL)
r = requests.get('{}'.format(api_url))
assert r.status_code == 200, r.text
assert r.json() == {
"notify_url": "/v2/notify",
"subscriptions_url": "/v2/subscriptions",
"entities_... | 2.671875 | 3 |
zorg/buildbot/conditions/FileConditions.py | dyung/llvm-zorg | 27 | 3991 | from buildbot.process.remotecommand import RemoteCommand
from buildbot.interfaces import WorkerTooOldError
import stat
class FileExists(object):
"""I check a file existence on the worker. I return True if the file
with the given name exists, False if the file does not exist or that is
a directory.
Us... | 2.90625 | 3 |
gym_combat/gym_combat/envs/main.py | refaev/combat_gym | 0 | 3992 | <filename>gym_combat/gym_combat/envs/main.py
from matplotlib import style
from tqdm import tqdm
style.use("ggplot")
from gym_combat.envs.Arena.CState import State
from gym_combat.envs.Arena.Entity import Entity
from gym_combat.envs.Arena.Environment import Environment, Episode
from gym_combat.envs.Common.constants imp... | 2.28125 | 2 |
libqif/core/hyper.py | ramongonze/libqif | 2 | 3993 | """Hyper-distributions."""
from libqif.core.secrets import Secrets
from libqif.core.channel import Channel
from numpy import array, arange, zeros
from numpy import delete as npdelete
class Hyper:
def __init__(self, channel):
"""Hyper-distribution. To create an instance of this class it is
class i... | 3.28125 | 3 |
ansible/venv/lib/python2.7/site-packages/ansible/modules/network/fortios/fortios_system_virtual_wan_link.py | gvashchenkolineate/gvashchenkolineate_infra_trytravis | 17 | 3994 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program 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 Lic... | 1.671875 | 2 |
src/Puerta.py | victorlujan/Dise-odeSoftwarePatrones | 0 | 3995 | <filename>src/Puerta.py
from ElementoMapa import ElementoMapa
class Puerta (ElementoMapa):
def __init__(self):
self.abierta= True
self.lado2=None
self.lado1=None
def get_abierta(self):
return self.abierta
def print_cosas(self):
print("hola")
def set_abierta(self,... | 3.171875 | 3 |
pong.py | Teenahshe/ponggame | 0 | 3996 | """
# Step 1 - Create the App
# Step 2 - Create the Game
# Step 3 - Build the Game
# Step 4 - Run the App
"""
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty
from kivy.vector import Vector
from kivy.clock import C... | 3.984375 | 4 |
get_block_data/relation.py | cyclone923/blocks-world | 1 | 3997 | class SceneRelation:
def __init__(self):
self.on_ground = set()
self.on_block = {}
self.clear = set()
def print_relation(self):
print(self.on_ground)
print(self.on_block)
print(self.clear) | 2.453125 | 2 |
bridge_RL_agent_v16.py | EricZLou/BridgeRLAgent | 0 | 3998 | <filename>bridge_RL_agent_v16.py
"""
CS 238 Final Project: Bridge RL Agent
<NAME> & <NAME>
"""
import copy
import datetime
import numpy as np
import random
from collections import namedtuple
"""'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
REPRESENTATIONS OF BRIDGE
Representing a "Card" as an integer:
... | 3.046875 | 3 |
tests/hacsbase/test_hacsbase_data.py | chbonkie/hacs | 2 | 3999 | """Data Test Suite."""
from aiogithubapi.objects import repository
import pytest
import os
from homeassistant.core import HomeAssistant
from custom_components.hacs.hacsbase.data import HacsData
from custom_components.hacs.helpers.classes.repository import HacsRepository
from custom_components.hacs.hacsbase.configuratio... | 1.953125 | 2 |