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 |
|---|---|---|---|---|---|---|
pmapi/app.py | jbushman/primemirror-api | 0 | 18800 | #!/usr/bin/python3
from pmapi.config import Config, get_logger
import os
import logging
import requests
import connexion
from flask import Flask, request
logger = get_logger()
# if not Config.TOKEN:
# data = {
# "hostname": Config.HOSTNAME,
# "ip": Config.IP,
# "state": Config.STATE,
# ... | 2.25 | 2 |
python/setup.py | chrisdembia/StateMint | 0 | 18801 | <reponame>chrisdembia/StateMint
import setuptools
with open('README.md') as f:
long_description=f.read()
setuptools.setup(
name="StateMint",
version="1.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="A library for finding State Space models of dynamical systems.",
long_description=long_description,... | 1.539063 | 2 |
cha_bebe/presente/migrations/0001_initial.py | intelektos/Cha_bebe | 0 | 18802 | <reponame>intelektos/Cha_bebe
# Generated by Django 3.0.6 on 2020-05-14 18:13
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Presente',
fields=[
... | 1.679688 | 2 |
src/rekognition_online_action_detection/models/feature_head.py | amazon-research/long-short-term-transformer | 52 | 18803 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
__all__ = ['build_feature_head']
import torch
import torch.nn as nn
from rekognition_online_action_detection.utils.registry import Registry
FEATURE_HEADS = Registry()
FEATURE_SIZES = {
'rgb_anet_resnet50':... | 1.84375 | 2 |
main.py | klarman-cell-observatory/cirrocumulus-app-engine | 0 | 18804 | <reponame>klarman-cell-observatory/cirrocumulus-app-engine
import os
import sys
sys.path.append('lib')
from flask import Flask, send_from_directory
import cirrocumulus
from cirrocumulus.cloud_firestore_native import CloudFireStoreNative
from cirrocumulus.api import blueprint
from cirrocumulus.envir import CIRRO_AUTH... | 2.015625 | 2 |
utils/load_externals.py | uvasrg/FeatureSqueezing | 56 | 18805 | import sys, os
external_libs = {'Cleverhans v1.0.0': "externals/cleverhans",
'Tensorflow-Model-Resnet': "externals/tensorflow-models",
}
project_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
for lib_name, lib_path in external_libs.iteritems():
lib_path = os... | 2.3125 | 2 |
research/seq_flow_lite/utils/misc_utils.py | hjkim-haga/TF-OD-API | 0 | 18806 | # Copyright 2020 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 ... | 2.75 | 3 |
parc/pra__/incomplete_13910.py | KwanHoo/Data-Structure__Algorithm | 0 | 18807 | ## 백준 13910번
## 개업
## 다이나믹 프로그래밍
## (짜장면 데이)
'''
##! ex) N = 4, 5그릇 이상 요리 X, 4사이즈 윅에 3그릇 이하 요리 X => 4윅에 4개
##* ex) N = 5, 윅 사이즈 1,3 / first : 1+3 = 4 그릇, second : 1 => 5 그릇 --> 2번의 요리로 주문 처리
##* 주문 받은 짜장면의 수, 가지고 있는 윅의 크기 => 주문 처리
# In1 ) N M : (주문 받은 짜장면의 수) N | (가지고 있는 윅의 수) M
# In2 ) S : 윅의 크기 S가 M개 만큼 주어... | 2.703125 | 3 |
manage/db_logger.py | ReanGD/web-home-manage | 0 | 18808 | <reponame>ReanGD/web-home-manage<filename>manage/db_logger.py
import sys
import traceback
from manage.models import LoadLog
class DbLogger(object):
def __init__(self, rec_id=None):
if rec_id is None:
self.rec = LoadLog.objects.create()
else:
self.rec = LoadLog.objects.get(p... | 2.15625 | 2 |
api/src/result_handler.py | Aragos/tichu-tournament | 7 | 18809 | <filename>api/src/result_handler.py
import webapp2
import json
from generic_handler import GenericHandler
from python.calculator import Calculate
from python.calculator import GetMaxRounds
from google.appengine.api import users
from handler_utils import BuildMovementAndMaybeSetStatus
from handler_utils import CheckUse... | 2.40625 | 2 |
electsysApi/shared/exception.py | yuxiqian/electsys-api | 5 | 18810 | <gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
'''
@author: yuxiqian
@license: MIT
@contact: <EMAIL>
@software: electsys-api
@file: electsysApi/shared/exception.py
@time: 2019/1/9
'''
class RequestError(BaseException):
pass
class ParseError(BaseException):
pass
class ParseWarning(Warning):
pas... | 1.539063 | 2 |
src/CryptoPlus/Cipher/ARC2.py | voytecPL/pycryptoplus | 1 | 18811 | from __future__ import absolute_import
from .blockcipher import *
import Crypto.Cipher.ARC2
import Crypto
from pkg_resources import parse_version
def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None,effective_keylen=None):
"""Create a new cipher object
ARC2 using pycrypto for algo and pycryptoplus... | 2.859375 | 3 |
extensions/roles.py | iLuiizUHD/Expertise-Bot-v2 | 2 | 18812 | # Utilities
import json
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
# Imports
from discord.ext import commands
from discord import Guild, Role
# Loading config file...
with open("./config.json", "r", encoding="utf-8") as config:
configFile = json.load(config)
class Roles(command... | 2.546875 | 3 |
amun/measure_accuracy.py | Elkoumy/amun | 10 | 18813 | """
In this module, we implement the accuracy measures to evaluate the effect of differential privacy injection.
In this module, we support the following measures:
* F1-score.
* Earth Mover's distance.
"""
from scipy.stats import wasserstein_distance
from pm4py.algo.discovery.inductive import factory as induct... | 2.9375 | 3 |
mkt/translations/models.py | ngokevin/zamboni | 0 | 18814 | import collections
from itertools import groupby
from django.db import connections, models, router
from django.db.models.deletion import Collector
from django.utils import encoding
import bleach
import commonware.log
from mkt.site.models import ManagerBase, ModelBase
from mkt.site.utils import linkify_with_outgoing
... | 1.960938 | 2 |
flow/sequential.py | altosaar/hierarchical-variational-models-physics | 14 | 18815 | import torch
from torch import nn
class FlowSequential(nn.Sequential):
"""Forward pass with log determinant of the Jacobian."""
def forward(self, input, context=None):
total_log_prob = torch.zeros(input.size(0), device=input.device)
for block in self._modules.values():
input, log_prob = block(input,... | 2.78125 | 3 |
inmoov/scripts/animation_executor.py | mish3albaiz/Robotics_ECE579 | 1 | 18816 |
import time
from os.path import join, dirname
import sys
whereami = dirname(__file__)
scripts_dir= join(whereami, "../scripts/")
sys.path.append(scripts_dir)
from json_parsing import read_json
import Inmoov
filename_pose = join(whereami, '../json/pose.json')
filename_animation = join(whereami, '../json/animations.jso... | 2.34375 | 2 |
Python/1629.py | GeneralLi95/leetcode | 0 | 18817 | #!/usr/bin/env python3
from typing import List, Optional
from collections import defaultdict, deque
from itertools import product,combinations,permutations
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
# -------------------------
class Solution:
def slowestKey(self, re... | 3.125 | 3 |
hexrd/sglite/setup.py | glemaitre/hexrd | 0 | 18818 | from distutils.core import setup, Extension
srclist = ['sgglobal.c','sgcb.c','sgcharmx.c','sgfile.c',
'sggen.c','sghall.c','sghkl.c','sgltr.c','sgmath.c','sgmetric.c',
'sgnorm.c','sgprop.c','sgss.c','sgstr.c','sgsymbols.c',
'sgtidy.c','sgtype.c','sgutil.c','runtests.c','sglitemodule.c'... | 1.421875 | 1 |
app/blogging/routes.py | Sjors/patron | 114 | 18819 | from app.blogging import bp
from datetime import datetime
from flask import flash, redirect, url_for
from flask_login import current_user
@bp.before_request
def protect():
'''
Registers new function to Flask-Blogging Blueprint that protects
updates to make them only viewable by paid subscribers.
'''
... | 2.578125 | 3 |
mini_cluster_07.py | jgpattis/Desres-sars-cov-2-apo-mpro | 0 | 18820 | <filename>mini_cluster_07.py
#cluster data into a small amount of clusters to later pull out structures
import pyemma.coordinates as coor
import numpy as np
sys = 'back'
tica_data = coor.load('tica_data_05/back_tica_data.h5')
n_clusters = 50
cl = coor.cluster_kmeans(tica_data, k=n_clusters, max_iter=50)
cl.save(f'{... | 2.609375 | 3 |
pydaily/images/tests/test_color.py | codingPingjun/pydaily | 0 | 18821 | <gh_stars>0
# -*- coding: utf-8 -*-
import os, sys, pdb
from pydaily.images import graymask2rgb
from pydaily import DATA_DIR
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
def test_graymask2rgb():
mask_img_path = os.path.join(DATA_DIR, "input/thyroid/mask/1273169.png")
assert os.pa... | 2.625 | 3 |
reqinstall/commands/freeze/__init__.py | QualiSystems/reqinstall | 0 | 18822 | from reqinstall.commands.freeze.freeze import PipFreezeCommand
| 1.125 | 1 |
scripts/configure.py | materialdigital/pmd-server | 1 | 18823 | <gh_stars>1-10
#! /usr/bin/env python3
import json, sys, argparse
from os.path import isfile
# ******************************************************************************
parser = argparse.ArgumentParser(description='Reads config.json and writes out docker-environment files.')
parser.add_argument('file', nargs='?... | 2.546875 | 3 |
src/lib/jianshu_parser/jianshuparser.py | eebook/jianshu2e-book | 7 | 18824 | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
from src.lib.jianshu_parser.base import BaseParser
from src.lib.jianshu_parser.content.JianshuAuthor import JianshuAuthorInfo
from src.lib.jianshu_parser.content.JianshuArticle import JianshuArticle
class JianshuParser(BaseParser):
u"""
获得jianshu_info表中所... | 2.6875 | 3 |
vox/utils/__init__.py | DSciLab/voxpy | 0 | 18825 | <reponame>DSciLab/voxpy
import numpy as np
from .one_hot import one_hot
from .rescale import LinearNormRescale255, \
CentralNormRescale255, \
GeneralNormRescale255
def threhold_seg(inp, th=0.5):
inp_ = np.copy(inp)
inp_[inp_>0.5] = 1.0
inp_[inp_<=0.5] = 0.0
re... | 2.21875 | 2 |
minimally_sufficient_pandas/__init__.py | dexplo/minimally_sufficient_pandas | 0 | 18826 | <reponame>dexplo/minimally_sufficient_pandas
from ._pandas_accessor import _MSP
__version__ = '0.0.1'
| 0.980469 | 1 |
src/rl/genotypes.py | xkp793003821/nas-segm-pytorch | 0 | 18827 | """List of operations"""
from collections import namedtuple
Genotype = namedtuple('Genotype', 'encoder decoder')
OP_NAMES = [
'conv1x1',
'conv3x3',
'sep_conv_3x3',
'sep_conv_5x5',
'global_average_pool',
'conv3x3_dil3',
'conv3x3_dil12',
'sep_conv_3x3_dil3',
'sep_conv_5x5_dil6',
... | 2.359375 | 2 |
solutions/python3/1089.py | sm2774us/amazon_interview_prep_2021 | 42 | 18828 | class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
i = 0
for num in list(arr):
if i >= len(arr): break
arr[i] = num
if not num:
i += 1
... | 3.46875 | 3 |
tools/download_typed_ast.py | hugovk/typed_ast | 0 | 18829 | #!/usr/bin/env python3
# Hacky script to download linux and windows typed_ast wheels from appveyor and gcloud
import os
import os.path
import json
import sys
from urllib.request import urlopen
# Appveyor download for windows wheels
api_url = 'https://ci.appveyor.com/api/'
def get_json(path):
url = api_url + path... | 2.328125 | 2 |
Contest/Keyence2021/a/main.py | mpses/AtCoder | 0 | 18830 | <reponame>mpses/AtCoder
#!/usr/bin/env python3
(n,), a, b = [[*map(int, o.split())] for o in open(0)]
from itertools import*
*A, = accumulate(a, max)
print(ans := a[0] * b[0])
for i in range(1, n):
ans = max(ans, A[i] * b[i])
print(ans) | 2.90625 | 3 |
service.py | ViscaElAyush/CSE598 | 35 | 18831 | #!/usr/bin/env python
# @author <NAME> <<EMAIL>>, Interactive Robotics Lab, Arizona State University
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import rclpy
from policy_translation.srv import NetworkPT, TuneNetwork
from model_src.model import PolicyTranslationModel
... | 2.25 | 2 |
model/pet_breed.py | IDRISSOUM/hospital_management | 0 | 18832 | <reponame>IDRISSOUM/hospital_management<gh_stars>0
# # -*- coding: utf-8 -*-
# # Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
#
# from odoo import api, fields, models, _
#
# class pet_breed(models.Model):
# _name = 'pet.breed'
#
# name = fields.Char('Name', required = True)
... | 1.3125 | 1 |
src/fireo/utils/utils.py | jshep23/FireO | 0 | 18833 | <filename>src/fireo/utils/utils.py<gh_stars>0
import re
from google.cloud import firestore
def collection_name(model):
return re.sub('(?!^)([A-Z]+)', r'_\1', model).lower()
def ref_path(key):
return key.split('/')
def collection_path(key):
return '/'.join(key.split('/')[:-1])
def get_parent(key):
... | 2.484375 | 2 |
src/rlib/debug.py | SOM-st/PySOM | 22 | 18834 | try:
from rpython.rlib.debug import make_sure_not_resized # pylint: disable=W
except ImportError:
"NOT_RPYTHON"
def make_sure_not_resized(_):
pass
| 1.296875 | 1 |
emr_eks_cdk/studio_live_stack.py | aws-samples/aws-cdk-for-emr-on-eks | 9 | 18835 | <reponame>aws-samples/aws-cdk-for-emr-on-eks
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from aws_cdk import aws_ec2 as ec2, aws_eks as eks, core, aws_emrcontainers as emrc, aws_iam as iam, aws_s3 as s3, custom_resources as custom, aws_acmpca as acmpca, aws_emr... | 2.046875 | 2 |
dev/user-agent-stacktrace/lib/utils.py | Katharine/apisnoop | 0 | 18836 | from collections import defaultdict
def defaultdicttree():
return defaultdict(defaultdicttree)
def defaultdict_to_dict(d):
if isinstance(d, defaultdict):
new_d = {}
for k, v in d.items():
new_d[k] = defaultdict_to_dict(v)
d = new_d
return d
| 3.5 | 4 |
WebMirror/management/rss_parser_funcs/feed_parse_extractKaedesan721TumblrCom.py | fake-name/ReadableWebProxy | 193 | 18837 | <gh_stars>100-1000
def extractKaedesan721TumblrCom(item):
'''
Parser for 'kaedesan721.tumblr.com'
'''
bad_tags = [
'FanArt',
"htr asks",
'Spanish translations',
'htr anime','my thoughts',
'Cats',
'answered',
'ask meme',
'relay convos',
'translation related post',
'nig... | 2.4375 | 2 |
l0bnb/tree.py | rahulmaz/L0BnB | 1 | 18838 | import time
import queue
import sys
import numpy as np
from scipy import optimize as sci_opt
from .node import Node
from .utilities import branch, is_integral
class BNBTree:
def __init__(self, x, y, inttol=1e-4, reltol=1e-4):
"""
Initiate a BnB Tree to solve the least squares regression problem ... | 2.84375 | 3 |
miniGithub/migrations/0003_auto_20200119_0955.py | stefan096/UKS | 0 | 18839 | # Generated by Django 3.0.2 on 2020-01-19 09:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('miniGithub', '0002_proje... | 1.65625 | 2 |
megatron/model/gpt_model.py | vat99/Megatron-LM | 1 | 18840 | <gh_stars>1-10
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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.... | 2.125 | 2 |
python/testData/inspections/PyMethodMayBeStaticInspection/documentedEmpty.py | jnthn/intellij-community | 2 | 18841 | <filename>python/testData/inspections/PyMethodMayBeStaticInspection/documentedEmpty.py
class A:
def foo(self):
"""Do something"""
pass | 1.203125 | 1 |
tests/utest/test_default_config.py | ngoan1608/robotframework-robocop | 2 | 18842 | <filename>tests/utest/test_default_config.py
import os
import sys
import importlib
from pathlib import Path
from unittest.mock import patch
import pytest
import robocop.config
from robocop.exceptions import InvalidArgumentError
@pytest.fixture
def config():
return robocop.config.Config()
@pytest.fixture
def p... | 2.375 | 2 |
tests/test_forms.py | haoziyeung/elasticstack | 2 | 18843 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_elasticstack
------------
Tests for `elasticstack` forms module.
"""
from django import forms
from django.test import TestCase
from elasticstack.forms import SearchForm
class TestForms(TestCase):
def test_named_search_field(self):
"""Ensure that ... | 2.625 | 3 |
AnkiIn/notetypes/ListCloze.py | Clouder0/AnkiIn | 1 | 18844 | <gh_stars>1-10
from .Cloze import get as cget
from ..config import dict as conf
from ..config import config_updater
notetype_name = "ListCloze"
if notetype_name not in conf["notetype"]:
conf["notetype"][notetype_name] = {}
settings = conf["notetype"][notetype_name]
priority = None
def update_list_cloze_config(... | 2.515625 | 3 |
app/routes.py | ptkaczyk/Ithacartists | 0 | 18845 | from flask import render_template, Flask, flash, redirect, url_for, abort, request
from flask_login import login_user, logout_user, login_required
from werkzeug.urls import url_parse
from app import app, db
from app.forms import *
from app.models import *
@app.route('/')
@app.route('/landing')
def landing():
ret... | 2.375 | 2 |
src/bloombox/schema/services/devices/v1beta1/DevicesService_Beta1_pb2_grpc.py | Bloombox/Python | 4 | 18846 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from devices.v1beta1 import DevicesService_Beta1_pb2 as devices_dot_v1beta1_dot_DevicesService__Beta1__pb2
class DevicesStub(object):
"""Specifies the devices service, which enables managed devices to check-in, authorize themselves, ... | 2.109375 | 2 |
oslo-modules/oslo_messaging/_drivers/amqp.py | esse-io/zen-common | 1 | 18847 | <filename>oslo-modules/oslo_messaging/_drivers/amqp.py
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | 1.890625 | 2 |
scripts/agenda.py | benjaminogles/vim-head | 3 | 18848 | #!/bin/python3
import datetime
import itertools
import sys
from heading import *
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
def priority_key():
weights = {}
sep = KEYWORDS.index('|')
for keyword in KEYWORDS[sep+1:]:
weights[keyword] = len(KEYWORDS)
idx = 1
while idx <= sep:... | 3.359375 | 3 |
clusterpy/core/toolboxes/cluster/componentsAlg/areamanager.py | CentroGeo/clusterpy_python3 | 3 | 18849 | # encoding: latin2
"""Algorithm utilities
G{packagetree core}
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import range
from builtins import object
from past.utils import old_div
__author__ = "<NAME>"
__credits__ = "Copyright (c) 2009-11 ... | 2.96875 | 3 |
geolocator.py | Kugeleis/TeslaInventoryChecker | 7 | 18850 | <reponame>Kugeleis/TeslaInventoryChecker
import http.client
import json
from types import SimpleNamespace
def get_token():
conn = http.client.HTTPSConnection("www.tesla.com")
payload = {
"resource": "geocodesvc",
"csrf_name": "",
"csrf_value": ""
}
headers = {
'Content-T... | 2.640625 | 3 |
client/runTFpose.py | BamLubi/tf-pose_Client | 1 | 18851 | import argparse
import cv2
import time
import numpy as np
from tf_pose.estimator import TfPoseEstimator
from tf_pose.networks import get_graph_path, model_wh
"""
封装并调用tf-openpose项目所提供的骨架信息识别接口
"""
class TFPOSE:
def __init__(self):
# 0. 参数
self.fps_time = 0
self.frame_count = 0
# 1.... | 2.40625 | 2 |
oldPython/driving_app.py | Awarua-/Can-I-Have-Your-Attention-COSC475-Research | 0 | 18852 | from kivy.app import App
from kivy.uix.label import Label
from kivy.core.window import Window
class DrivingApp(App):
def build(self):
Window.fullscreen = False
# Need to set the size, otherwise very pixalated
# wonders about pixel mapping?
Window.size(1920, 1080)
b = Label... | 2.59375 | 3 |
api/src/opentrons/calibration_storage/helpers.py | faliester/opentrons | 1 | 18853 | <filename>api/src/opentrons/calibration_storage/helpers.py
""" opentrons.calibration_storage.helpers: various miscellaneous
functions
This module has functions that you can import to save robot or
labware calibration to its designated file location.
"""
import json
from typing import Union, List, Dict, TYPE_CHECKING
f... | 2.78125 | 3 |
scripts/OpenRobotPyxl.py | coder-cell/robotframework-openpyxl | 0 | 18854 | import openpyxl
from robot.api.deco import keyword, library
from robot.api import logger
@library
class OpenRobotPyxl:
def __init__(self):
self.active_sheet = None
self.active_book = None
self.path = None
self.bookname = None
@keyword("Create New Workbook")
def create_new... | 2.71875 | 3 |
club/urls.py | NSYT0607/DONGKEY | 1 | 18855 | from django.urls import path
from . import views
app_name = 'club'
urlpatterns = [
path('create/', views.create_club, name='create_club'),
path('update/<int:club_pk>', views.update_club, name='update_club'),
path('read_admin_club/<str:club>/<int:ctg_pk>/', views.read_admin_club, name='read_admin_club_ctg... | 1.945313 | 2 |
interview_kickstart/01_sorting_algorithms/class_discussed_problems/python/0215_kth_largest_element_in_an_array.py | mrinalini-m/data_structures_and_algorithms | 2 | 18856 | from random import randint
from typing import List
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
jthSmallest = len(nums) - k
return self.quickSelect(nums, 0, len(nums) - 1, jthSmallest)
def quickSelect(self, nums: List[int], start: int, end: int, jthSmallest: int)... | 3.515625 | 4 |
termpixels/util.py | loganzartman/termpixels | 17 | 18857 | <reponame>loganzartman/termpixels<gh_stars>10-100
from unicodedata import east_asian_width, category
from functools import lru_cache
import re
def corners_to_box(x0, y0, x1, y1):
"""convert two corners (x0, y0, x1, y1) to (x, y, width, height)"""
x0, x1 = min(x0, x1), max(x0, x1)
y0, y1 = min(y0, y1), max(... | 2.875 | 3 |
json.py | AbhijithGanesh/Flask-HTTP-Server | 0 | 18858 | import json
'''
READ THE DATABASE README before operating
'''
File = r'''YOUR FILE'''
with open(File,'a') as fileObj:
data = json.load()
'''
YOUR DATA LOGIC GOES IN HERE
Once the data is changed, to write it to your JSON file use the following command.
'''
json.dump(object,File) | 3.140625 | 3 |
slash/hooks.py | omergertel/slash | 0 | 18859 | <reponame>omergertel/slash<filename>slash/hooks.py
import gossip
from .conf import config
from .utils.deprecation import deprecated
def _deprecated_to_gossip(func):
return deprecated(since="0.6.0", message="Use gossip instead")(func)
def _define(hook_name, **kwargs):
hook = gossip.define("slash.{0}".format(... | 2.140625 | 2 |
experiments/archived/20210203/bag_model/models/__init__.py | fxnnxc/text_summarization | 5 | 18860 | from .hub_interface import * # noqa
from .model import * # noqa | 1.046875 | 1 |
src/CodeLearn/plaintextCode/BloomTech/BTU5W1/U5W1P2_Task3_w1.py | MingjunGeng/Code-Knowledge | 0 | 18861 | <gh_stars>0
#!/usr/bin/python3
# --- 001 > U5W2P1_Task3_w1
def solution(i):
return float(i)
if __name__ == "__main__":
print('----------start------------')
i = 12
print(solution( i ))
print('------------end------------')
| 2.9375 | 3 |
plugins/modules/oci_sch_service_connector.py | A7rMtWE57x/oci-ansible-collection | 0 | 18862 | <filename>plugins/modules/oci_sch_service_connector.py
#!/usr/bin/python
# Copyright (c) 2017, 2020 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl... | 1.570313 | 2 |
Kattis/fallingapart.py | ruidazeng/online-judge | 0 | 18863 | <gh_stars>0
n = int(input())
intz = [int(x) for x in input().split()]
alice = 0
bob = 0
for i, num in zip(range(n), sorted(intz)[::-1]):
if i%2 == 0:
alice += num
else:
bob += num
print(alice, bob) | 3.265625 | 3 |
ffnn/rbf.py | RaoulMa/NeuralNets | 1 | 18864 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Description: Choose a set of data points as weights and calculate RBF nodes for the
first layer. Those are then used as inputs for a one-layer perceptron, which gives the
output
"""
import numpy as np
import pcn
class rbf:
""" radial basic function """
d... | 3.625 | 4 |
Bot/config.py | faelbreseghello/Monsters-Bot | 7 | 18865 | import datetime
import os
# General
Token = open('../Token.txt', 'r') # The token of the bot
Token = Token.read()
prefix = '*' # the command prefix
lang = 'en-us' # 'en-us' or 'pt-br'
memes = os.listdir('../Assets/monsters_memes') # memes db load
banchannel = None # the channel that will be used to ban messages
# Min... | 2.609375 | 3 |
postscripts/_city_transformer_postscripts.py | yasahi-hpc/CityTransformer | 0 | 18866 | """
Convert data and then visualize
Data Manupulation
1. Save metrics for validation and test data
Save figures
1. Loss curve
2. plume dispersion and errors
3. metrics
"""
import pathlib
import numpy as np
import xarray as xr
from numpy import ma
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplo... | 2.6875 | 3 |
OrangeInstaller/OrangeInstaller/Testing.py | mcolombo87/OrangeInstaller | 3 | 18867 | <filename>OrangeInstaller/OrangeInstaller/Testing.py
from Functions import functions, systemTools
import unittest
import sys
class systemToolsTests(unittest.TestCase):
"""
Class for testing
"""
def test_checkSystemTools(self):
check = False
if systemTools.isWindows() == True:
... | 2.75 | 3 |
quince/ui/components/game_frame.py | DnrkasEFF/quince | 0 | 18868 | """
The primary frame containing the content for the entire game
"""
import tkinter as tk
import random as random
from quince.utility import is_valid_pickup
from quince.ronda import Ronda
from quince.ui.components.opponents.opponent_frame \
import OpponentFrameHorizontal, OpponentFrameVertical
from quince.ui.compon... | 3.015625 | 3 |
Python_Projects/numeric/lossofsignificance.py | arifBurakDemiray/TheCodesThatIWrote | 1 | 18869 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 13:35:33 2020
"""
#for finding loss of significances
x=1e-1
flag = True
a=0
while (flag):
print (((2*x)/(1-(x**2))),"......",(1/(1+x))-(1/(1-x)))
x= x*(1e-1)
a=a+1
if(a==25):
flag=False
| 3.109375 | 3 |
easyfl/test.py | weimingwill/easyfl-pypi | 2 | 18870 | <reponame>weimingwill/easyfl-pypi<filename>easyfl/test.py
class Test:
def __init__(self):
pass
def hi(self):
print("hello world") | 1.546875 | 2 |
alphamind/model/treemodel.py | atefar2/alpha-mind | 1 | 18871 | <filename>alphamind/model/treemodel.py
# -*- coding: utf-8 -*-
"""
Created on 2017-12-4
@author: cheng.li
"""
import arrow
import numpy as np
import pandas as pd
import xgboost as xgb
from sklearn.ensemble import RandomForestClassifier as RandomForestClassifierImpl
from sklearn.ensemble import RandomForestRegressor a... | 2.484375 | 2 |
bot/welcome_leave.py | Thorappan7/loki | 0 | 18872 | <filename>bot/welcome_leave.py
from pyrogram import Client as bot, filters, emoji
MENTION = "[{}](tg://user?id={})"
text1="hi{} {} welcome to Group Chat"
group ="jangobotz"
@bot.on_message(filters.chat(group) &filters.new_chat_members)
async def welcome(bot, message):
new_members = [u.mention for u in message.n... | 2.625 | 3 |
script.deluge/resources/lib/basictypes/xmlgenerator.py | ogero/Deluge-Manager-XBMC | 0 | 18873 | <reponame>ogero/Deluge-Manager-XBMC
import locale
from xml.sax import saxutils
defaultEncoding = locale.getdefaultlocale()[-1]
class Generator(saxutils.XMLGenerator):
"""Friendly generator for XML code"""
def __init__(self, out=None, encoding="utf-8"):
"""Initialise the generator
Just overr... | 2.34375 | 2 |
scrape.py | darenr/contemporary-art--rss-scraper | 0 | 18874 | # -*- coding: utf-8 -*-
import json
import codecs
import traceback
import sys
import requests
import requests_cache
import feedparser
import collections
from bs4 import BeautifulSoup
from urlparse import urlparse, urljoin
one_day = 60 * 60 * 24
requests_cache.install_cache(
'rss_cache', backend='sqlite', expire_... | 2.640625 | 3 |
src/main/admin_api/endpoint/table_endpoint.py | lemilliard/kibo-db | 0 | 18875 | from src.main.common.model import endpoint
class TableEndpoint(endpoint.Endpoint):
@classmethod
def do_get(cls, *args, **kwargs):
from src.main.admin_api.utils.descriptor_utils import DescriptorUtils
db_system_name = kwargs.get("db_system_name")
tb_system_name = kwargs.get(... | 2.359375 | 2 |
tools/testbed_generator.py | vkolli/5.0_contrail-test | 0 | 18876 | <filename>tools/testbed_generator.py
#!/usr/bin/python
import yaml
import json
import sys
import re
import argparse
from distutils.version import LooseVersion
from collections import defaultdict
discovery_port = '5998'
config_api_port = '8082'
analytics_api_port = '8081'
control_port = '8083'
dns_port = '8092'
agent_... | 1.9375 | 2 |
sum of digits using recursion.py | kingRovo/PythonCodingChalenge | 1 | 18877 | <gh_stars>1-10
def rec_sum(n):
if(n<=1):
return n
else:
return(n+rec_sum(n-1))
| 2.921875 | 3 |
visualization/POF/data/Base2DReader.py | alvaro-budria/body2hands | 63 | 18878 | import tensorflow as tf
from data.BaseReader import BaseReader
import numpy as np
class Base2DReader(BaseReader):
# inherit from BaseReader, implement different 2D cropping (cropping from 2D)
def __init__(self, objtype=0, shuffle=True, batch_size=1, crop_noise=False):
super(Base2DReader, self).__init... | 2.46875 | 2 |
api/indexer/tzprofiles_indexer/models.py | clehner/tzprofiles | 0 | 18879 | from tortoise import Model, fields
class TZProfile(Model):
account = fields.CharField(36, pk=True)
contract = fields.CharField(36)
valid_claims = fields.JSONField()
invalid_claims = fields.JSONField()
errored = fields.BooleanField()
class Meta:
table = "tzprofiles"
| 2.25 | 2 |
pyscripts/Backups/wikipull.py | mrchaos10/AGRICULTURAL-DOMAIN-SPECIES-IDENTIFICATION-AND-SEMI-SUPERVISED-QUERYING-SYSTEM | 0 | 18880 | <gh_stars>0
#api for extracting the results from wikidata
#https://www.wikidata.org/w/api.php?search=las&language=en&uselang=en&format=jsonfm&limit=25&action=wbsearchentities
# importing modules
import requests
from lxml import etree
import wikipedia
import sys
import re
import pickle
import numpy as np
import os
... | 2.96875 | 3 |
alice.py | atamurad/coinflip | 1 | 18881 | <reponame>atamurad/coinflip
from Crypto.Util.number import getRandomRange
from sympy.ntheory.residue_ntheory import jacobi_symbol
N = int(input("N ? "))
x = getRandomRange(2, N)
x2 = (x*x) % N
J = jacobi_symbol(x, N)
print(f"x2 = {x2}")
guess = int(input("j_guess ? "))
print(f"x = {x}")
print("Outcome = Heads" if ... | 3.140625 | 3 |
accounts/management/commands/run-stats.py | ChristianJStarr/Scratch-Bowling-Series-Website | 1 | 18882 | <filename>accounts/management/commands/run-stats.py
from django.core.management.base import BaseCommand, CommandError
from scoreboard.ranking import calculate_statistics
class Command(BaseCommand):
help = 'Run Statistics'
def handle(self, *args, **options):
calculate_statistics() | 1.890625 | 2 |
LeetCode/TwoSum.py | batumoglu/Python_Algorithms | 0 | 18883 | <gh_stars>0
class Solution(object):
def twoSum(self, nums, target):
seen = {}
output = []
for i in range(len(nums)):
k = target - nums[i]
if k in seen:
output.append(seen[k])
output.append(i)
del seen[k]
... | 3.390625 | 3 |
src/rospy_crazyflie/crazyflie_server/crazyflie_control.py | JGSuw/rospy_crazyflie | 5 | 18884 | """
Copyright (c) 2018, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disc... | 1.4375 | 1 |
examples/imagenet_resnet50.py | inaccel/keras | 1 | 18885 | <filename>examples/imagenet_resnet50.py
import numpy as np
import time
from inaccel.keras.applications.resnet50 import decode_predictions, ResNet50
from inaccel.keras.preprocessing.image import ImageDataGenerator, load_img
model = ResNet50(weights='imagenet')
data = ImageDataGenerator(dtype='int8')
images = data.flo... | 2.609375 | 3 |
api/permissions.py | letsdowork/yamdb_api | 0 | 18886 | from rest_framework.permissions import BasePermission, SAFE_METHODS
from .models import User
class IsAdminOrReadOnly(BasePermission):
def has_permission(self, request, view):
return bool(
request.method in SAFE_METHODS or
request.user and request.user.is_authenticated and
... | 2.40625 | 2 |
morphological_classifier/classifier.py | selflect11/morphological_classifier | 0 | 18887 | <filename>morphological_classifier/classifier.py<gh_stars>0
# -*- coding: utf-8 -*-
from morphological_classifier.perceptron import AveragedPerceptron
from morphological_classifier.performance_metrics import PerformanceMetrics
from morphological_classifier.stats_plot import StatsPlotter
from morphological_classifie... | 2.4375 | 2 |
autoprover/evaluation/evaluation.py | nclab-admin/autoprover | 1 | 18888 | """evaluation function for chromosome
"""
import subprocess
from subprocess import PIPE, STDOUT
from autoprover.evaluation.coqstate import CoqState
def preprocess(theorem, chromosome):
"""
convert chromosome to complete Coq script
Args:
theorem (list): a list of string contains theorem or some pr... | 3.09375 | 3 |
steapy/velocity_field.py | Sparsh-Sharma/SteaPy | 1 | 18889 | import os
import numpy
from numpy import *
import math
from scipy import integrate, linalg
from matplotlib import pyplot
from pylab import *
from .integral import *
def get_velocity_field(panels, freestream, X, Y):
"""
Computes the velocity field on a given 2D mesh.
Parameters
---------
panel... | 3.0625 | 3 |
admin/hams_admin/container_manager.py | hku-systems/hams | 6 | 18890 | import abc
from .exceptions import HamsException
import logging
# Constants
HAMS_INTERNAL_QUERY_PORT = 1337
HAMS_INTERNAL_MANAGEMENT_PORT = 1338
HAMS_INTERNAL_RPC_PORT = 7000
HAMS_INTERNAL_METRIC_PORT = 1390
HAMS_INTERNAL_REDIS_PORT = 6379
HAMS_DOCKER_LABEL = "ai.hams.container.label"
HAMS_NAME_LABEL = "ai.hams.name"... | 2 | 2 |
solidata_api/api/api_auth/endpoint_user_tokens.py | co-demos/solidata-backend | 2 | 18891 | # -*- encoding: utf-8 -*-
"""
endpoint_user_tokens.py
"""
from solidata_api.api import *
# from log_config import log, pformat
log.debug(">>> api_auth ... creating api endpoints for USER_TOKENS")
### create namespace
ns = Namespace('tokens', description='User : tokens freshening related endpoints')
### import mo... | 2.125 | 2 |
tektonbundle/tektonbundle.py | chmouel/tektonbundle | 3 | 18892 | """Main module."""
import copy
import io
import logging
import re
from typing import Dict, List
import yaml
log = logging.getLogger(__name__)
TEKTON_TYPE = ("pipeline", "pipelinerun", "task", "taskrun", "condition")
class TektonBundleError(Exception):
pass
def tpl_apply(yaml_obj, parameters):
def _apply... | 2.34375 | 2 |
Scripts/sims4communitylib/classes/time/common_alarm_handle.py | ColonolNutty/Sims4CommunityLibrary | 118 | 18893 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
import os
from sims4.commands import Command, CommandType, ... | 2.078125 | 2 |
blackbook/migrations/0022_cleanup.py | bsiebens/blackbook | 1 | 18894 | # Generated by Django 3.1.4 on 2021-01-22 22:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blackbook', '0021_update_account_categories'),
]
operations = [
migrations.RemoveField(
model_name='budgetperiod',
name='bud... | 1.5625 | 2 |
core/myauthbackend.py | devendraotari/HRMS_project | 0 | 18895 | <gh_stars>0
from django.contrib.auth.backends import BaseBackend
from django.contrib.auth import get_user_model
class EmailPhoneBackend(BaseBackend):
"""
docstring
"""
def authenticate(self,request, email=None,phone=None, password=None):
# Check the username/password and return a user.
... | 2.578125 | 3 |
apps/core/management/commands/update-banned-email.py | sparcs-kaist/sparcssso | 18 | 18896 | <gh_stars>10-100
import requests
from django.core.management.base import BaseCommand, CommandError
from apps.core.models import EmailDomain
DATA_URL = (
'https://raw.githubusercontent.com/martenson/disposable-email-domains'
'/master/disposable_email_blacklist.conf'
)
class Command(BaseCommand):
help = ... | 2.25 | 2 |
LeetCode/Python3/Math/1323. Maximum 69 Number.py | WatsonWangZh/CodingPractice | 11 | 18897 | <reponame>WatsonWangZh/CodingPractice
# Given a positive integer num consisting only of digits 6 and 9.
# Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6).
# Example 1:
# Input: num = 9669
# Output: 9969
# Explanation:
# Changing the first digit results in 6669.
# Cha... | 4.0625 | 4 |
ticketing/userticket/createqrcode.py | autlamps/tessera-backend | 0 | 18898 | import base64
import rsa
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from ticketing.models import BalanceTicket, RideTicket
class VerifyFailedError(Exception):
pass
class QRCode:
"""
QRCode creator is used to create a user ticket/balance ID,
which is then... | 2.265625 | 2 |
CollabMoodle.py | dantonbertuol/PyCollab | 0 | 18899 | <filename>CollabMoodle.py
import datetime
from webService import WebService
import Utilidades as ut
import sys
if __name__ == "__main__":
param = ut.mainMoodle(sys.argv[1:])
#param = 'moodle_plugin_sessions.txt', '', '2020-08-01 00:00:00,2020-12-31 00:00:00'
webService = WebService()
report = []
re... | 2.8125 | 3 |