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 |
|---|---|---|---|---|---|---|
setup.py | mMeijden/three3cpo | 6 | 52900 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='t3cpo',
packages=find_packages(exclude=['tests', '.github']),
version='0.1',
license='MIT',
description='Python wrapper for the several 3Commas api endpoints',
author='mmeijden',
author_email='<EMAIL>', # Type in y... | 1.296875 | 1 |
SSH/ex1_show_version.py | ramyacr97/RamyaPython | 0 | 52901 | from __future__ import print_function, unicode_literals
from datetime import datetime
from netmiko import ConnectHandler
from my_devices import device_list
def Netmiko_connect(device,command):
"""Execute show version command using Netmiko."""
print()
print("#" * 80)
remote_conn = ConnectHandler(**dev... | 2.734375 | 3 |
python/src/year2021/day09.py | Farbfetzen/Advent_of_Code | 4 | 52902 | # https://adventofcode.com/2021/day/9
from math import prod
from src.util.types import Data, Point2, Solution
def prepare_data(data: str) -> tuple[tuple[tuple[int, ...], ...], list[Point2]]:
heightmap = tuple(tuple(int(x) for x in list(line)) for line in data.splitlines())
low_points = get_low_points(height... | 3.671875 | 4 |
snippets/unfix_train2017.py | tgandor/urban_oculus | 0 | 52903 | <filename>snippets/unfix_train2017.py
#!/usr/bin/env python
import pathlib
import shutil
bak_dir = pathlib.Path("~/datasets/coco/png_bak").expanduser()
bak_dir.mkdir(exist_ok=True)
bak_file = bak_dir / '000000320612.png'
target = pathlib.Path("~/datasets/coco/train2017/000000320612.jpg").expanduser()
if not bak_fil... | 2.375 | 2 |
training/experimental/obj_thresh_test.py | isabella232/ftc-object-detection | 37 | 52904 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.484375 | 2 |
setup.py | jsmentch/dyneusr | 39 | 52905 | from setuptools import find_packages, setup
import re
# parse dyneusr/_version.py
try:
version_fn = 'dyneusr/_version.py'
with open(version_fn) as version_fd:
version = version_fd.read()
version_re = r"^__version__ = ['\"]([^'\"]*)['\"]"
version = re.findall(version_re, version, re.M)[0]
except... | 1.757813 | 2 |
src/paper/management/commands/clean_paper_abstracts.py | ResearchHub/ResearchHub-Backend-Open | 18 | 52906 | <reponame>ResearchHub/ResearchHub-Backend-Open
'''
Clean HTML tags in abstract
'''
import utils.sentry as sentry
from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
from paper.models import Paper
class Command(BaseCommand):
def handle(self, *args, **options):
papers = Pa... | 2.359375 | 2 |
application.py | Nikolas-01/Lesson_18 | 0 | 52907 | from flask import Flask, render_template, request
from api_hh_skills import parsing_skills
from api_hh_salary import parsing_av_salary
from db_sqlalchemy_creator import Vacancy_info, City, Vacancy, Contacts
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm ... | 2.703125 | 3 |
merfishdecoder/util/imagereader.py | r3fang/MERlin | 0 | 52908 | <reponame>r3fang/MERlin<filename>merfishdecoder/util/imagereader.py
import hashlib
import numpy as np
import re
import tifffile
from typing import List
from merfishdecoder.util import dataportal
# The following code is adopted from github.com/ZhuangLab/storm-analysis and
# is subject to the following license:
#
# Th... | 1.859375 | 2 |
examples/bqm_response.py | hotmess47/dwave-inspector | 3 | 52909 | import sys
import dimod
import dwave.inspector
from minorminer import find_embedding
from dwave.cloud import Client
from dwave.embedding import embed_bqm, unembed_sampleset
from dwave.embedding.utils import edgelist_to_adjacency
# define problem
bqm = dimod.BQM.from_ising({}, {'ab': 1, 'bc': 1, 'ca': 1})
# or, load ... | 2.453125 | 2 |
undoredu.py | DiegoMGouveia/praticando | 0 | 52910 | <reponame>DiegoMGouveia/praticando
#exercicio 93 curso de python
lista_de_tarefa = []
desfeito = []
menu_0 = '''
|_______________________|
| [1] - Adicionar tarefa|
| [2] - Listar tarefas |
| [3] - Desfazer tarefa |
| [4] - Refazer tarefa |
| [5] - Sair
|_______________________|
... | 4.03125 | 4 |
src/bitvavo_api_upgraded/settings.py | Thaumatorium/python-bitvavo-api | 1 | 52911 | <reponame>Thaumatorium/python-bitvavo-api
import logging
from pathlib import Path
from decouple import Choices, AutoConfig
from bitvavo_api_upgraded.type_aliases import ms
# don't use/import python-decouple's `config`` variable, because the search_path isn't set,
# which means applications that use a .env file can't... | 2.203125 | 2 |
thirdparty_xentax/test_extraction.py | tinkerbeast/ffx-ai | 0 | 52912 | <filename>thirdparty_xentax/test_extraction.py
# -*- coding: utf-8 -*-
import phyre, importlib, os
importlib.reload(phyre)
# 1 or 2
ffx=1
# pc, npc, mon, obj, skl, sum, or wep
tp = 'pc'
# model number (no leading zeros)
num = 106
ffxBaseDir=r'C:\SteamLibrary\steamapps\common\FINAL FANTASY FFX&FFX-2 H... | 1.976563 | 2 |
cli/proxyparser.py | seomoz/roger-mesos-tools | 0 | 52913 | #!/usr/bin/env python
from __future__ import print_function
import os
import requests
import subprocess
import sys
import re
from cli.appconfig import AppConfig
from cli.settings import Settings
requests.packages.urllib3.disable_warnings()
class ProxyParser:
path_begin_values = {}
backend_services_tcp_ports... | 2.296875 | 2 |
algoritmoEstacionesAnalisis.py | jorgemauricio/ResearchWheatRust | 0 | 52914 | <filename>algoritmoEstacionesAnalisis.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 7 10:46:52 2017
@author: jorgemauricio
"""
#%% librerias
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
def main():
#%% read data stations
dataStations = pd.rea... | 3.15625 | 3 |
docs/examples/required_note.py | JonathanGrant/marbles | 109 | 52915 | import marbles.core
class ComplexTestCase(marbles.core.AnnotatedTestCase):
def test_for_edge_case(self):
self.assertTrue(False)
if __name__ == '__main__':
marbles.core.main()
| 2.171875 | 2 |
pbsmrtpipe/tests/test_driver.py | PacificBiosciences/pbsmrtpipe | 26 | 52916 | <reponame>PacificBiosciences/pbsmrtpipe<filename>pbsmrtpipe/tests/test_driver.py
"""This needs to be completely redone to use the DI model"""
import logging
import pprint
import unittest
from collections import namedtuple
from nose.plugins.attrib import attr
import time
import pbsmrtpipe.driver as D
import pbsmrtpipe... | 1.789063 | 2 |
tests/test_gc_collector.py | cpmclouth/client_python | 0 | 52917 | <filename>tests/test_gc_collector.py<gh_stars>0
from __future__ import unicode_literals
import unittest
from prometheus_client import CollectorRegistry, GCCollector
class TestGCCollector(unittest.TestCase):
def setUp(self):
self.registry = CollectorRegistry()
self.gc = _MockGC()
def test_wo... | 2.4375 | 2 |
challenges/repeated_words/repeated.py | glasscharlie/data-structures-and-algorithms | 0 | 52918 | <reponame>glasscharlie/data-structures-and-algorithms
from collections import Counter
def punctuation(str):
punc = '.,;!/?#:@$%&'
new_str = ""
for i in str:
if i not in punc:
new_str += i
return new_str
def repeated_word(str):
string = punctuation(str)
string = string.casef... | 3.609375 | 4 |
craft/ops/box_ops.py | nunenuh/craft.pytorch | 5 | 52919 | <gh_stars>1-10
from typing import *
import numpy as np
from shapely.geometry import Polygon
def order_points(pts):
# initialzie a list of coordinates that will be ordered
# such that the first entry in the list is the top-left,
# the second entry is the top-right, the third is the
# bottom-right, and... | 2.46875 | 2 |
Semester IV/Numerical Methods/AstarProj/AI-Astar.py | RianWardanaPutra/School | 0 | 52920 | <filename>Semester IV/Numerical Methods/AstarProj/AI-Astar.py
import pandas
import heapq
tabel = pandas.read_csv('jarak nyata.csv', sep=';')
h_tabel = pandas.read_csv('jarak lurus v2.csv', sep=';')
list_kota = {
0: 'yogyakarta', 1: 'klaten', 2: 'boyolali', 3: 'solo', 4: 'salatiga', 5: 'magelang',
6: ... | 3.390625 | 3 |
plyer/platforms/android/vibrator.py | EdwardCoventry/plyer | 1,184 | 52921 | """Implementation Vibrator for Android."""
from jnius import autoclass, cast
from plyer.facades import Vibrator
from plyer.platforms.android import activity
from plyer.platforms.android import SDK_INT
Context = autoclass("android.content.Context")
vibrator_service = activity.getSystemService(Context.VIBRATOR_SERVICE)... | 2.984375 | 3 |
phd_satellite_trajectory/wrappers/normalize_observation_space.py | zampanteymedio/phd-satellite-trajectory-public | 2 | 52922 | <gh_stars>1-10
from gym.spaces import Box
from gym.wrappers import TransformObservation
class NormalizeObservationSpace(TransformObservation):
def __init__(self, env, f):
super(NormalizeObservationSpace, self).__init__(env, f)
if isinstance(self.observation_space, Box):
self.observation_... | 2.5 | 2 |
diary/apps.py | bbengfort/memorandi | 0 | 52923 | # diary.apps
# App specific configuration for lazy loading.
#
# Author: <NAME> <<EMAIL>>
# Created: Wed Dec 02 13:14:57 2020 -0500
#
# Copyright (C) 2020 Bengfort.com
# For license information, see LICENSE
#
# ID: apps.py [] <EMAIL> $
"""
App specific configuration for lazy loading.
"""
###########################... | 1.40625 | 1 |
Dataset/Leetcode/train/5/414.py | kkcookies99/UAST | 0 | 52924 | <gh_stars>0
class Solution:
def XXX(self, s: str) -> str:
# 1025 third coding two pointers
n = len(s)
if n<=1: return s
def isValid(left,right,maxlen,res):#中心扩展法的复杂度更低,减少一层循环!
while left>=0 and right<n and s[left]==s[right]:
#如果把s[left]==s[right]放在下边判断,需要... | 3.03125 | 3 |
instagram/views.py | NIelsen-Mudaki/gramclone | 0 | 52925 | <gh_stars>0
from django.http import HttpResponse
from django.shortcuts import render,redirect,get_object_or_404,HttpResponseRedirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, authenticate
from .models import Im... | 2.296875 | 2 |
tests/test_cfloader.py | shachibista/mloader | 0 | 52926 | <filename>tests/test_cfloader.py
#!/usr/bin/env python
"""Tests for `cfloader` package."""
import json
from pathlib import Path
import pytest
import cfloader
from cfloader.loader import Loader
from cfloader.readers import ConfigFileNotFoundError
def test_cfloader_can_open_path_objects():
config_filepath = Path... | 2.53125 | 3 |
src/generateExecutableTests.py | LASER-UMASS/Swami | 9 | 52927 | <filename>src/generateExecutableTests.py
# MIT License
#
# Copyright (c) 2018 LASER-UMASS
#
# 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 t... | 1.664063 | 2 |
src/secml/ml/features/normalization/tests/test_c_normalizer_mean_std.py | zangobot/secml | 63 | 52928 | from secml.ml.features.normalization.tests import CNormalizerTestCases
from sklearn.preprocessing import StandardScaler
from secml.ml.features.normalization import CNormalizerMeanStd
class TestCNormalizerMeanStd(CNormalizerTestCases):
"""Unittests for CNormalizerMeanStd."""
def test_transform(self):
... | 2.6875 | 3 |
api/user.py | yishuangxi/car-tornado | 0 | 52929 | # coding=utf8
from base import ApiBase
from tornado.gen import coroutine, Return
from service.user import ServiceUser
class ApiUserBase(ApiBase):
def __init__(self, *args, **kwargs):
super(ApiUserBase, self).__init__(*args, **kwargs)
self.srv_user = ServiceUser()
class ApiUserLogin(ApiUserBase):... | 2.484375 | 2 |
rbe_benchmarks/tools/generate_yml.py | jiyangchen/benchmarks | 0 | 52930 | <reponame>jiyangchen/benchmarks
"""Generates Kubernetes config yml file from benchmark_configs.yml file.
This script should only be run from opensource repository.
"""
import argparse
import logging
import os
from string import maketrans
import k8s_tensorflow_lib
import yaml
_TEST_NAME_ENV_VAR = 'TF_DIST_BENCHMARK_... | 2.09375 | 2 |
test/test_user_cli.py | gokul-koganti/auto_anki | 1 | 52931 | # Copyright 2021 sunehabose
# MIT License
import sys
import unittest
from unittest.mock import patch
sys.path.insert(0, 'code')
import code.user_cli
class TestUserCLI(unittest.TestCase):
@patch('builtins.input', return_value='1')
def test_user_menu_1(self, mock_input) -> None:
code.user_cli.user_men... | 2.8125 | 3 |
models/wrf_hydro/hydro_dart_py/setup.py | hkershaw-brown/feature-preprocess | 2 | 52932 | <reponame>hkershaw-brown/feature-preprocess<gh_stars>1-10
from setuptools import find_packages, setup
setup(
name='hydrodartpy',
version='0.0.1',
packages=find_packages(),
package_data={'hydrodartpy': ['core/data/*']},
url='https://github.com/NCAR/wrf_hydro_dart',
license='MIT',
install_req... | 1.421875 | 1 |
RobotSimulation/PlanningCore/core/simulation.py | benbenlijie/BilliardRobot | 0 | 52933 | from itertools import combinations
import numpy as np
from PlanningCore.core.constants import State
from PlanningCore.core.physics import (
ball_ball_collision,
ball_cushion_collision,
cue_strike,
evolve_ball_motion,
get_ball_ball_collision_time,
get_ball_cushion_collision_time,
get_roll_t... | 2.46875 | 2 |
tests/tests.py | sasriawesome/django_products | 1 | 52934 | from django.utils import timezone
from django.test import TestCase | 1.203125 | 1 |
core/views.py | dishad/ADD | 0 | 52935 | from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.template import Context, loader
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth import authenticate
from django.contrib.auth im... | 2.234375 | 2 |
pachong.py | echo6120/pythonhomework | 2 | 52936 | #coding=utf-8
#抓取精品课网站中的课程,把有优惠券的课程筛选出来
#第一步:访问ke.youdao.com 获取精品课网页的所有的标签内容,例如:四六级,考研,实用英语...:
#第二步:访问标签页,获取课程详情页的url
#第三步:获取课程详情页需要的信息
#第四步:保存到Excel表中
import requests
import urllib3
import re
import sys
from bs4 import BeautifulSoup
from openpyxl import Workbook
from openpyxl import load_workbook
#抓取标签,"http://ke.... | 2.90625 | 3 |
classification/classification/train.py | yuyay/ASNG-NAS | 96 | 52937 | <reponame>yuyay/ASNG-NAS
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import numpy as np
import torch
from torch import nn
from classification import utils
def write_row(filename, data, reset=False):
with open(filename, 'w' if reset else 'a') as o:
row = ''
for i, c in enumerate(da... | 2.265625 | 2 |
dof/app-hierarchy-testrunner.py | RamonvdW/dof | 1 | 52938 | # -*- coding: utf-8 -*-
# Copyright (c) 2019-2020 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.test.runner import DiscoverRunner
from unittest import TestSuite
class HierarchyRunner(DiscoverRunner):
""" variant of the DiscoverRunner with abili... | 2.3125 | 2 |
tests/test_accis_ex/test_accis.py | dsanchez-garcia/accim | 0 | 52939 | <reponame>dsanchez-garcia/accim
from accim.sim import accis
def test_addAccis():
from accim.sim import accis
from os import listdir
scriptTypeList = ['ex_mm', 'ex_ac']
outputsList = ['simplified', 'standard', 'timestep']
EPlist = ['ep95']
for i in scriptTypeList:
for j in outputsList:
... | 2.28125 | 2 |
menu.py | chatea/948 | 0 | 52940 | # -*- coding: utf-8 -*-
import json
import csv
import logging
_TEST_MENU_ID = u'-1'
_KEY_MENU_ID = u'menu_id'
_KEY_MENU_NAME = u'name'
_KEY_MENU_TITLE = u'title'
_KEY_MENU_IMAGE_URL = u'image_url'
_KEY_MENU_PATH = u'path_to_file'
KEY_ITEM_ID = u'id'
KEY_ITEM_NAME = u'name'
KEY_ITEM_ITEMS = u'items'
KEY_ITEM_IMAGE_UR... | 3.234375 | 3 |
0.1.build_BST/0.1.py | teryokhin/bsu-famcs-algo-solutions | 0 | 52941 |
class BinarySearchTree:
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
def __init__(self):
self.root = None
def add(self, value):
if self.root:
self._add(value, self.root)
... | 3.78125 | 4 |
blinkeye.py | DevC-Istanbul/Eye-Blinking | 1 | 52942 | <gh_stars>1-10
import cv2
import PIL
import dlib
import numpy as np
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor("C:\\Users\\nuret\\Desktop\\PYTHON\\COMPUTERVISION\\Eye Blinding\\shape_predictor_68_face_landmarks.dat")
cap = cv2.VideoCapture(0)
while True :
_,frame = ca... | 2.734375 | 3 |
usecase-2/passenger-info/seat-info-proxy/src/preload_db/main.py | edgefarm/edgefarm-demos | 0 | 52943 | import argparse
import logging
import sys
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import ProgrammingError, OperationalError
import models
from seat_info_proxy import __version__
import yaml
__author__ = "<NAME>"
__copyright__ = "Ci4Rail GmbH"
__lic... | 2.21875 | 2 |
quiz/models.py | gamersdestiny/fuzzyquizgame | 0 | 52944 | <filename>quiz/models.py
from django.db import models
class Question(models.Model):
question = models.TextField()
category = models.ForeignKey('Category', default=1, on_delete=models.DO_NOTHING, related_name='question')
choice1 = models.CharField(max_length=50)
choice2 = models.CharField(max_length=50)
choice3 =... | 2.546875 | 3 |
supervised_learning/__init__.py | liewmanchoi/NaiveMLA | 1 | 52945 | # -*- coding: utf-8 -*-
# __author__ = wangsheng
# __copyright__ = "Copyright 2018, Trump Organization"
# __email__ = "<EMAIL>"
# __status__ = "experiment"
# __time__ = 2018/11/8 11:15
# __file__ = __init__.py.py
from .knearestneighbor import KNN
from .linear_model import Ridge, Lasso, ElasticNet, LogisticRegression
f... | 1.601563 | 2 |
step-functions-example/app.py | jamesshapiro/cdk-utilities | 0 | 52946 | #!/usr/bin/env python3
import os
import jsii
import aws_cdk as cdk
from aws_cdk import (
Aspects,
CfnResource
)
@jsii.implements(cdk.IAspect)
class ForceDeletion:
def visit(self, scope):
if isinstance(scope, CfnResource):
scope.apply_removal_policy(cdk.RemovalPolicy.DESTROY)
from ste... | 2.125 | 2 |
lib/solutions/FIZ/fizz_buzz_solution.py | DPNT-Sourcecode/FIZ-xnph01 | 0 | 52947 | <filename>lib/solutions/FIZ/fizz_buzz_solution.py<gh_stars>0
# noinspection PyUnusedLocal
def fizz_buzz(number):
strings = []
numstring = str(number)
# fizz if divisible by 3 or has a 3 in it
if (number % 3 == 0) or ("3" in numstring):
strings.append("fizz")
# buzz if divisible by 5 or it ha... | 3.921875 | 4 |
PR_JSON_Scripts/plot_scaling_components.py | arm-hpc/allinea_json_analysis | 3 | 52948 | #!/usr/bin/env python
# Copyright 2015-2017 ARM Limited
#
# 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... | 2.3125 | 2 |
tests/test_config_pumpkin_proxy.py | oza6ut0ne/wifipumpkin3 | 911 | 52949 | <gh_stars>100-1000
import unittest
from wifipumpkin3.core.common.platforms import Linux
import wifipumpkin3.core.utility.constants as C
from wifipumpkin3.core.utility.collection import SettingsINI
class TestConfigPumpkinProxy(unittest.TestCase):
def test_config_key_set(self):
self.config = SettingsINI(C.C... | 2.21875 | 2 |
alembic/dev_seeds.py | ryanmahan/police-data-trust | 0 | 52950 | <gh_stars>0
from backend.database.core import db
from backend.database import User, UserRole
from backend.auth import user_manager
from backend.database.models.incident import Incident
from backend.database.models.officer import Officer
from backend.database.models.use_of_force import UseOfForce
def create_user(user)... | 2.359375 | 2 |
allencv/tests/models/basic_classifier_test.py | sethah/allencv | 8 | 52951 | <filename>allencv/tests/models/basic_classifier_test.py<gh_stars>1-10
from allencv.common.testing import AllenCvTestCase, ModelTestCase
from allencv.data.dataset_readers import ImageClassificationDirectory
from allencv.models import BasicImageClassifier
from allencv.modules.im2im_encoders import FeedforwardEncoder
from... | 2.1875 | 2 |
ambuild2/frontend/v2_2/cpp/msvc.py | Wend4r/ambuild | 0 | 52952 | # vim: set ts=8 sts=4 sw=4 tw=99 et:
#
# This file is part of AMBuild.
#
# AMBuild 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 License, or
# (at your option) any later version.
#
# ... | 2.015625 | 2 |
utils/tools.py | alexchungio/DCGAN-MNIST | 0 | 52953 | <filename>utils/tools.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#------------------------------------------------------
# @ File : tools.py
# @ Description:
# @ Author : <NAME>
# @ Contact : <EMAIL>
# @ License : Copyright (c) 2017-2018
# @ Time : 2020/9/29 下午6:09
# @ Software : PyCharm... | 2.625 | 3 |
dashboard/plant_care/wikipedia_scraper.py | LSaldyt/plantsitter | 1 | 52954 | import wikipedia
from pprint import pprint
import json, os
class WikipediaScraper:
def __init__(self):
pass
def get(self, term):
try:
results = wikipedia.search(term)
if len(results) == 0:
raise RuntimeError(f'No wikipedia page for: {term}')
... | 3.703125 | 4 |
Darlington/phase-3/python challenge/day 90 solution/qtn2.py | darlcruz/python-challenge-solutions | 0 | 52955 | # program to find whether it contains an additive sequence or not.
class Solution(object):
# DFS: iterative implement.
def is_additive_number(self, num):
length = len(num)
for i in range(1, int(length/2+1)):
for j in range(1, int((length-i)/2 + 1)):
first, second, others ... | 4.09375 | 4 |
src/python/WMCore/WMBS/Oracle/Subscriptions/KillWorkflow.py | khurtado/WMCore | 21 | 52956 | #!/usr/bin/env python
"""
_KillWorkflow_
Oracle implementation of Subscriptions.KillWorkflow
"""
from WMCore.WMBS.MySQL.Subscriptions.KillWorkflow import KillWorkflow as MySQLKillWorkflow
class KillWorkflow(MySQLKillWorkflow):
"""
_KillWorkflow_
Mark all files that are not complete/failed and belong to ... | 1.796875 | 2 |
fatf/utils/models/models.py | So-Cool/fat-forensics | 48 | 52957 | """
The :mod:`fatf.utils.models.models` module holds custom models.
The models implemented in this module are mainly used for used for
FAT Forensics package testing and the examples in the documentation.
"""
# Author: <NAME> <<EMAIL>>
# License: new BSD
import abc
from typing import Optional
import numpy as np
imp... | 2.703125 | 3 |
setup.py | aroden-crowdstrike/eamcsv2json | 0 | 52958 | <filename>setup.py
from setuptools import find_packages, setup
setup(
name='eamcsv2json',
description='Converts EAM CSV export to JSON',
long_description=open('README.md').read(),
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/crowdstrike/eamcsv2json',
# excludes requires ... | 1.335938 | 1 |
tests/test_noise_cropout.py | marco-willi/HiDDeN-tensorflow | 0 | 52959 | import tensorflow as tf
from noise import cropout
class CropoutTest(tf.test.TestCase):
def setUp(self):
self.layer = cropout.Cropout()
def testCropProportions(self):
shapes = [(1, 28, 28, 1), (2, 28, 28, 1),
(1, 28, 28, 3), (2, 28, 28, 3),
(2, 33, 33, 3)]... | 2.5625 | 3 |
src/run.py | bugdaryan/Smile-detector | 0 | 52960 | import cv2
import numpy as np
import sys
import haar_cascade as cascade
from datetime import datetime
import os.path
output_dir = "../images"
class SmileDetectStatus:
def __init__(self):
self.begin_take_photo = False
self.face_found = False
self.smile_detected = False
self.restart ... | 2.71875 | 3 |
tests/test_temporary_package.py | Thom1729/package_util | 0 | 52961 | from unittest import TestCase
from sublime_lib import ResourcePath
from package_util import TemporaryPackage
class TestTemporaryPackage(TestCase):
def test_temporary_package_name(self):
expected_resource_path = ResourcePath('Packages/TemporaryPackageTest')
expected_file_path = expected_resource_... | 2.828125 | 3 |
meshed/base.py | sylvainbonnot/meshed | 0 | 52962 | """
Base functionality of meshed
"""
from collections import Counter
from dataclasses import dataclass, field
from functools import partial
from typing import Callable, MutableMapping, Iterable, Union, Sized, Sequence
from i2 import Sig, call_somewhat_forgivingly
from meshed.util import ValidationError, NameValidation... | 2.796875 | 3 |
python/code/mail/smtpplugin.py | hgfgood/note | 0 | 52963 | <reponame>hgfgood/note
#! /usr/bin/python
# coding:utf-8
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
__author__ = 'hgf'
HOST = "smtp.qq.com"
SUBJECT = u"业务性能数据表"
FROM = "<EMAIL>"
TO = "<EMAIL>"
def addimg(src, imgid):
... | 2.265625 | 2 |
Mathematics_for_Machine_Learning/Linear Algebra/readonly/bearNecessities.py | PerpetualSmile/-Coursera | 1 | 52964 | <reponame>PerpetualSmile/-Coursera
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import numpy.linalg as la
bear_black = (0.141,0.11,0.11)
bear_white = (0.89,0.856,0.856)
magenta = (0xfc/255, 0x75/255, 0xdb/255) # Brighter magenta
orange = (218/255, 171/255, 115/255)
green =... | 2.921875 | 3 |
hangman/solution.py | kyclark/playful_python_2 | 6 | 52965 | #!/usr/bin/env python3
"""Hangman game"""
import argparse
import io
import random
import re
import sys
# --------------------------------------------------
def get_args():
"""parse arguments"""
parser = argparse.ArgumentParser(
description='Hangman',
formatter_class=argparse.ArgumentDefaults... | 3.546875 | 4 |
pupil/sampling/uncertainty.py | hadi-gharibi/pupil | 2 | 52966 | <gh_stars>1-10
from __future__ import annotations
import math
from typing import Callable
import numpy as np
from pupil.types import NDArray2D
def least_confidence(prob_dist: NDArray2D) -> np.ndarray:
"""
Returns the uncertainty score of an array using
least confidence sampling in a 0-1 range where 1 i... | 3.53125 | 4 |
f5/bigip/tm/auth/test/unit/test_ldap.py | nghia-tran/f5-common-python | 272 | 52967 | <gh_stars>100-1000
# Copyright 2017 F5 Networks 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
#
# Unless required by applicable law or... | 1.804688 | 2 |
hoodie/views.py | bellahOchola/Hood_watch | 0 | 52968 | from django.shortcuts import render
from .forms import RegistrationForm,UploadProfile,CreatePost, BusinessForm
from django.contrib.auth import login, authenticate
from django.contrib.auth.models import User
from django.shortcuts import redirect, get_object_or_404
from django.views.decorators.csrf import csrf_exempt
fro... | 2.015625 | 2 |
example_services/rest_api/app.py | herzo175/cicada-2 | 11 | 52969 | from flask import Flask, request, jsonify
from sqlalchemy import create_engine
app = Flask(__name__)
engine = create_engine("mysql+pymysql://root:admin@db:3306/mydb")
@app.route("/members", methods=["POST"])
def members():
body = request.json
with engine.connect() as connection:
connection.execute(... | 3.21875 | 3 |
integration-test/1562-australia-shield-text-prefixes.py | rinnyB/vector-datasource | 0 | 52970 | # -*- encoding: utf-8 -*-
from . import FixtureTest
class AustraliaShieldTextPrefixesTest(FixtureTest):
def test_m(self):
import dsl
z, x, y = (16, 60295, 39334)
self.generate_fixtures(
dsl.is_in('AU', z, x, y),
# https://www.openstreetmap.org/way/170318728
... | 2.203125 | 2 |
jacket/drivers/openstack/compute_driver.py | bopopescu/jacket | 0 | 52971 | <gh_stars>0
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 1.460938 | 1 |
tests/test_reflector.py | yuvipanda/kubernetes-informers | 2 | 52972 | from kubernetes_informers import Reflector, CoalescingQueue
from kubernetes_informers.reflector import Delta
import asyncio
import pytest
from kubernetes_asyncio import client
def make_pod(ns, name, rv):
return client.V1Pod(
metadata=client.V1ObjectMeta(namespace=ns, resource_version=rv, name=name),
)
... | 2.1875 | 2 |
PrepareData/wavelet_prices_smooth.py | cony89/TimeSeriesForecast | 0 | 52973 | <reponame>cony89/TimeSeriesForecast
#### created by <NAME> ####
import pickle
import pywt
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.insert(0, '../')
from Utils.utils import *
from Utils.base_dir import *
#font family for the charts
font = {'family':'sans-serif', 'color':'black', 'weight':... | 2.78125 | 3 |
Library_Manage_System/login.py | zyhang8/libraray_manage_system_gui | 1 | 52974 | <filename>Library_Manage_System/login.py
# -*- coding: utf-8 -*-
import pymssql
import tkinter as tk
import re
r1=re.compile(r'.*')
import tkinter.messagebox
import tkinter.messagebox as messagebox
from tkinter import StringVar
#sql服务器名,这里(127.0.0.1)是本地数据库IP
serverName = 'localhost'
#登陆用户名和密码
userName = 'sa'
passWord... | 2.765625 | 3 |
tests/test_assert_in_validators.py | jasujm/pydantic | 6 | 52975 | <reponame>jasujm/pydantic<gh_stars>1-10
"""
PYTEST_DONT_REWRITE
"""
import pytest
from pydantic import BaseModel, ValidationError, validator
def test_assert_raises_validation_error():
class Model(BaseModel):
a: str
@validator('a')
def check_a(cls, v):
assert v == 'a', 'invali... | 2.625 | 3 |
src/causallift/dataobjects/loggers.py | farismosman/causallift | 1 | 52976 | <gh_stars>1-10
import json, logging.config
from pathlib import Path
root_dir = str(Path(__file__).resolve().parent.parent.parent.parent)
class Loggers:
def __init__(self, config_file=None):
self.config_file = config_file
self.log_level = {
0: 'ERROR',
1: 'WARN',
... | 2.515625 | 3 |
flask/app.py | oleacapricorn/phclone | 0 | 52977 | <gh_stars>0
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from flask_cors import CORS
import os
app = Flask(__name__)
CORS(app)
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.... | 2.796875 | 3 |
src/nti/externalization/datastructures.py | NextThought/nti.externalization | 0 | 52978 | # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
# -*- coding: utf-8 -*
"""
Datastructures to help externalization.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# There are a *lot* of fixme (XXX and the like) in this file.
... | 1.65625 | 2 |
Python/Chapter03/my_stack.py | msiplab/EicProgLab | 1 | 52979 | <filename>Python/Chapter03/my_stack.py
import sys
class MyStack:
"""push-down スタッククラス"""
def __init__(self, stacksize):
"""コンストラクタ(初期化)"""
# フィールド
self.mystack = [ ' ' for i in range(stacksize) ]
self.top = -1;
def pushdown(self, data):
"""プッシ... | 3.8125 | 4 |
skywinder/communication/packet_classes.py | PolarMesosphericClouds/SkyWinder | 0 | 52980 | <reponame>PolarMesosphericClouds/SkyWinder<gh_stars>0
import struct
from multiprocessing import Value
import numpy as np
from PyCRC.CRCCCITT import CRCCCITT
import logging
logger = logging.getLogger(__name__)
def get_checksum(data):
return int(np.sum(np.frombuffer(data, dtype='uint8'), dtype='uint8'))
def get... | 2.25 | 2 |
PE-Python/P085/P085.py | Tiny-Snow/Project-Euler-Problem-Solutions | 1 | 52981 | <reponame>Tiny-Snow/Project-Euler-Problem-Solutions<filename>PE-Python/P085/P085.py
# -*- coding:UTF-8 -*-
# Author:<NAME>
# Date: Tue, 30 Mar 2021, 17:09
# Project Euler # 085 Counting rectangles
#=============================================================Solution
def get_rectangles(m, n):
return m * (m + 1) * ... | 3.53125 | 4 |
flows/Actions/BufferAction.py | mastro35/flows | 5 | 52982 | <gh_stars>1-10
#!/usr/bin/env python3
'''
BufferAction.py
----------------------------
Copyright 2016 <NAME>
'''
import re
from flows.Actions.Action import Action
class BufferAction(Action):
"""
BufferAction Class
"""
type = "buffer"
buffer = None
regex = ""
def on_init(self):
... | 2.671875 | 3 |
society_bureau/admin.py | JeekStudio/StudentPlatform | 4 | 52983 | <gh_stars>1-10
from django.contrib import admin
from society_bureau.models import SocietyBureau, SiteSettings
# Register your models here.
admin.site.register(SocietyBureau)
admin.site.register(SiteSettings)
| 1.367188 | 1 |
server/server_pb2_grpc.py | MruV-RP/mruv-pb-python | 0 | 52984 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from server import server_model_pb2 as server_dot_server__model__pb2
from server import server_pb2 as server_dot_server__pb2
class MruVServerServiceStub(object... | 2.046875 | 2 |
app/app/crud/__init__.py | Tall-Programacion-FIME/backend | 0 | 52985 | from .crud_book import *
from .crud_user import *
| 1.070313 | 1 |
0844_BackspaceStringCompare.py | taro-masuda/leetcode | 0 | 52986 | <filename>0844_BackspaceStringCompare.py
class Solution:
def backspaceCompare(self, S: str, T: str) -> bool:
s = []; t = []
for i in range(len(S)):
if S[i] == "#":
if len(s) > 0:
s.pop(-1)
else:
s.append(S[i])
for i ... | 3.5 | 4 |
sast_controller/drivers/rp/rp_portal_controller.py | dovbiyi/reapsaw | 41 | 52987 | # Copyright (c) 2018 <NAME> & Company, 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
#
# Unless required by applicable law or ag... | 2.3125 | 2 |
main.py | H2ydrogen/HCP_based_prediction | 0 | 52988 | import logging
import time
from torch.utils.data import DataLoader
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch
import torch.nn.functional as functional
import numpy as np
from DTI import models, dataset, cli, utils, analyse
import os
device = torch.device('cuda:0... | 2.25 | 2 |
jygsaw/group.py | talwai/jygsaw | 2 | 52989 | <filename>jygsaw/group.py
"""
A Group is a convenient way to manage a group of GraphicsObjects.
"""
from graphicsobject import *
from shape import Shape
class Group():
"""
A Group object will hold a list of shapes, text, images and other objects, that are grouped together for convenience.
"""
def ... | 3.828125 | 4 |
wallet_manager/command_processor.py | DEX-Company/wallet-manager | 0 | 52990 | <gh_stars>0
import inspect
import re
import os.path
import json
import secrets
import time
import logging
import sys
from web3 import (
Web3,
HTTPProvider
)
from eth_account import Account as EthAccount
from starfish import Ocean
from starfish.account import Account as OceanAccount
from wallet_manager.wallet_... | 1.859375 | 2 |
MS17-010/checker.py | eaneatfruit/ExploitDev | 0 | 52991 | <filename>MS17-010/checker.py
from mysmb import MYSMB
from impacket import smb, smbconnection, nt_errors
from impacket.uuid import uuidtup_to_bin
from impacket.dcerpc.v5.rpcrt import DCERPCException
from struct import pack
import sys
'''
Script for
- check target if MS17-010 is patched or not.
- find accessible named ... | 1.851563 | 2 |
backend/bigeye/schemas/schemas.py | Astropilot/BigEye | 0 | 52992 | from marshmallow import fields, validate
from marshmallow_enum import EnumField
from bigeye.models.base import ma
from bigeye.models.user import UserRoles
from bigeye.models.challenge import ChallengeDifficulty
class ChallengeCategorySchema(ma.Schema):
id = fields.Integer(dump_only=True)
name = fields.String... | 2.140625 | 2 |
mrcnn_based/post_processing.py | Klimroth/action_classifier_ungulates | 1 | 52993 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2020, <NAME>, <NAME>, <NAME>, <NAME>"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "1.0"
__status__ = "Development"
import configuration as cf
import copy
import csv, os
import... | 2.21875 | 2 |
tests/test_api.py | phileaton/tradier-python | 0 | 52994 | import os
import pytest
from tradier_python import TradierAPI
from tradier_python.models import *
@pytest.fixture
def t():
token = os.environ["TRADIER_TOKEN"]
account_id = os.environ["TRADIER_ACCOUNT_ID"]
base_url = os.environ.get("TRADIER_BASE_URL")
return TradierAPI(token=token, default_account_id... | 2.125 | 2 |
problems/test_0693.py | chrisxue815/leetcode_python | 1 | 52995 | import unittest
# O(1). Bit manipulation.
class Solution:
def hasAlternatingBits(self, n):
"""
:type n: int
:rtype: bool
"""
prev = n & 1
n >>= 1
while n:
if n & 1 ^ prev:
prev ^= 1
n >>= 1
else:
... | 3.5 | 4 |
Web App/sbadmin/core.py | DinhLamPham/PredictiveHRA | 0 | 52996 | import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import sbadmin.convertGraph as convert
G = nx.generators.directed.random_k_out_graph(10, 3, 0.5)
pos = nx.layout.spring_layout(G)
node_sizes = [3 + 10 * i for i in range(len(G))]
M = G.number_of_edges()
edge_colors = range(2, M + 2)
edge_a... | 2.53125 | 3 |
groco/utils/equivariance.py | APJansen/GroupConv | 3 | 52997 | <reponame>APJansen/GroupConv
import tensorflow as tf
def test_equivariance(
layer, signal, group=None, spatial_axes: tuple = (1, 2), group_axis=None,
acting_group='', domain_group='', target_group=''):
"""
Test the equivariance of a `layer` L under the transformation of an `acting_group` G on ... | 2.84375 | 3 |
rotate.py | JSchwalb11/OpenCV_Practical | 0 | 52998 | <reponame>JSchwalb11/OpenCV_Practical
import numpy as np
import argparse
import imutils
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "Path to the image")
args = vars(ap.parse_args())
image = cv2.imread(args["image"])
cv2.imshow("Original", image)
(h,w) = image.sh... | 3.03125 | 3 |
accounts/urls.py | akhiparmar/devresources | 31 | 52999 | <filename>accounts/urls.py
from django.urls import path, include
from django.contrib.auth.decorators import login_required
from accounts.views import (
SignInView,
SignOutView,
SignUpView,
ProfileView,
)
urlpatterns = [
path('signin/', SignInView.as_view(), name='signin_view'),
path('signo... | 2.03125 | 2 |