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 |
|---|---|---|---|---|---|---|
value_based_1.py | frankfangy/gridlab | 0 | 32200 | <reponame>frankfangy/gridlab
# -*- coding: utf-8 -*-
'''
这个来源于 udacity 的讲座
验证基础的概念和算法
'''
from grid_world import *
import sys
#from PyQt5.QtCore import QPoint, QRect, QSize, Qt
#from PyQt5.QtGui import (QBrush, QPainter, QColor, QPen )
#from PyQt5.QtWidgets import (QApplication, QPushButton, QCheckB... | 2.421875 | 2 |
src/simmate/calculators/vasp/error_handlers/test/test_large_sigma.py | laurenmm/simmate-1 | 9 | 32201 | <filename>src/simmate/calculators/vasp/error_handlers/test/test_large_sigma.py
# -*- coding: utf-8 -*-
import os
import pytest
from simmate.conftest import copy_test_files
from simmate.calculators.vasp.inputs import Incar
from simmate.calculators.vasp.error_handlers import LargeSigma
def test_large_sigma(tmpdir):
... | 2.1875 | 2 |
wyggles/wyggle/dna.py | kfields/wyggles-arcade | 1 | 32202 | import math
import random
from PIL import Image
import cairo
from wyggles import Dna
PI = math.pi
RADIUS = 32
WIDTH = RADIUS
HEIGHT = RADIUS
class WyggleDna(Dna):
def __init__(self, klass):
super().__init__(klass)
name = self.name
r = random.uniform(0, .75)
r1 = r + .20
r... | 2.828125 | 3 |
scripts/trajectories.py | Miedema/MCNetwork | 0 | 32203 | #!/usr/bin/python3
from tools import *
from sys import argv
from os.path import join
import h5py
import matplotlib.pylab as plt
from matplotlib.patches import Wedge
import numpy as np
if len(argv) > 1:
pathToSimFolder = argv[1]
else:
pathToSimFolder = "../data/"
parameters, electrodes = readParameters(pathT... | 2.1875 | 2 |
rest_framework_sav/views.py | JamesRitchie/django-rest-framework-session-endpoint | 21 | 32204 | <gh_stars>10-100
"""Views for Django Rest Framework Session Endpoint extension."""
from django.contrib.auth import login, logout
from rest_framework import parsers, renderers
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.response import Response
from rest_framework.views imp... | 2.359375 | 2 |
app.py | thesadru/genshinstats-api | 7 | 32205 | <filename>app.py
import os
import time
from concurrent.futures import ThreadPoolExecutor
from enum import Enum
from hashlib import sha256
from typing import List, Type
import genshinstats as gs
from cachetools import TTLCache
from fastapi import Depends, FastAPI, HTTPException, Path, Query, Request
from fastapi.respon... | 2.234375 | 2 |
tests/integration/serialization_test.py | markowanga/stweet | 101 | 32206 | import pytest
import stweet as st
from tests.test_util import get_temp_test_file_name, get_tweets_to_tweet_output_test, \
two_lists_assert_equal
def test_csv_serialization():
csv_filename = get_temp_test_file_name('csv')
tweets_collector = st.CollectorTweetOutput()
get_tweets_to_tweet_output_test([
... | 2.609375 | 3 |
scripts/python/calculus/ch2.py | jeremiahmarks/dangerzone | 1 | 32207 | #
from mypy.physics import constants
def averageVelocity(positionEquation, startTime, endTime):
"""
The position equation is in the form of a one variable lambda and the
averagevelocity=(changeinposition)/(timeelapsed)
"""
startTime=float(startTime)
endTime=float(endTime)
vAvg=(positionEquation(star... | 3.53125 | 4 |
Maths_And_Stats/Number_Theory/Segmented_Sieve/segmented_sieve.py | arslantalib3/algo_ds_101 | 182 | 32208 | <gh_stars>100-1000
def segmented_sieve(n):
# Create an boolean array with all values True
primes = [True]*n
for p in range(2,n):
#If prime[p] is True,it is a prime and its multiples are not prime
if primes[p]:
for i in range(2*p,n,p):
# Mark every multiple of ... | 3.796875 | 4 |
setup.py | UCL/scikit-surgerytf | 0 | 32209 | # coding=utf-8
"""
Setup for scikit-surgerytf
"""
from setuptools import setup, find_packages
import versioneer
# Get the long description
with open('README.rst') as f:
long_description = f.read()
setup(
name='scikit-surgerytf',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
... | 1.390625 | 1 |
Codigos Python/String_to_int.py | BrunoHarlis/Solucoes_LeetCode | 0 | 32210 | <gh_stars>0
# Fonte: https://leetcode.com/problems/string-to-integer-atoi/
# Autor: <NAME>
# Data: 03/08/2021
"""
Implemente a função myAtoi(string s), que converte uma string em um
inteiro assinado de 32 bits (semelhante à função C / C ++ atoi).
O algoritmo para myAtoi(string s) é o seguinte:
Leia e ignore qualquer... | 3.4375 | 3 |
tests/bench_bgra2rgb.py | RedFantom/python-mss | 0 | 32211 | # coding: utf-8
"""
2018-03-19.
Maximum screenshots in 1 second by computing BGRA raw values to RGB.
GNU/Linux
pil_frombytes 139
mss_rgb 119
pil_frombytes_rgb 51
numpy_flip 31
numpy_slice 29
macOS
pil_frombytes 209
mss_rgb 174
pil_frombytes_rgb 113
numpy_fl... | 2.75 | 3 |
app1/migrations/0002_auto_20210925_0546.py | rianaansari/My_library | 0 | 32212 | <reponame>rianaansari/My_library
# Generated by Django 3.2.7 on 2021-09-25 05:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app1', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='author',
name=... | 1.382813 | 1 |
third_party/blink/renderer/bindings/scripts/blink_idl_parser_test.py | zealoussnow/chromium | 14,668 | 32213 | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=no-member,relative-import
"""Unit tests for blink_idl_parser.py."""
import unittest
from blink_idl_parser import BlinkIDLParser
class B... | 2.109375 | 2 |
encode.py | Kyobito/Pencil-Unrefined | 0 | 32214 | import calc
def caesar_cipher(word, base):
up_alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
low_alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x... | 4.0625 | 4 |
snuba/utils/types.py | fpacifici/snuba | 0 | 32215 | <gh_stars>0
from dataclasses import dataclass
from typing import Any, Generic, TypeVar
from typing_extensions import Protocol
TComparable = TypeVar("TComparable", contravariant=True)
class Comparable(Protocol[TComparable]):
"""
Defines the protocol for comparable objects. Objects that satisfy this
prot... | 2.71875 | 3 |
ACME/render/renderer.py | mauriziokovacic/ACME | 3 | 32216 | import neural_renderer as nr
from ..math.unitvec import *
class Renderer(nr.Renderer):
"""
A class extending the Neural Renderer
Attributes
----------
device : str or torch.device (optional)
the tensor the renderer will be stored to (default is 'cuda:0')
culling : str (optional)
... | 3.0625 | 3 |
src/codeGameSimulation/Multirun.py | LukasWallisch/game-ur-analysis | 0 | 32217 | <reponame>LukasWallisch/game-ur-analysis
import copy
from datetime import datetime
from typing import List, Tuple
from .store2db import createTabels, store_data_2_db
from .GameUr import GameUr
from .GameSettings import GameSettings
import multiprocessing as mp
import tqdm
def getThreadCount()->int:
return mp.cpu... | 2.453125 | 2 |
setup.py | Wirtos/aioregex | 0 | 32218 | <gh_stars>0
import setuptools
setuptools.setup(
name="aioregex",
version="0.1",
author="Wirtos_new",
author_email="<EMAIL>",
description="regex to allow both sync and async callables in the sub as repl",
url="https://wirtos.github.io/aioregex/",
packages=setuptools.find_packages(),
proj... | 1.304688 | 1 |
scripts/pyqtgraph-develop/pyqtgraph/pixmaps/__init__.py | kuldeepaman/tf-pose | 0 | 32219 | """
Allows easy loading of pixmaps used in UI elements.
Provides support for frozen environments as well.
"""
import os, sys, pickle
from ..functions import makeQImage
from ..Qt import QtGui
from ..python2_3 import basestring
if sys.version_info[0] == 2:
from . import pixmapData_2 as pixmapData
else:
... | 2.890625 | 3 |
defx/metrics/f1_measure.py | DFKI-NLP/defx | 5 | 32220 | <reponame>DFKI-NLP/defx<filename>defx/metrics/f1_measure.py
from statistics import mean
from typing import Dict, List, Optional, Set
from collections import defaultdict
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.nn.util import get_lengths_from_binary_sequence_mask
from allennlp.d... | 2.03125 | 2 |
test/test.py | hcamacho4200/dev_opts_training | 1 | 32221 | def test_test():
"""A generic test
:return:
"""
assert True
| 1.414063 | 1 |
create.py | felipesantoos/mython | 0 | 32222 | # -*- encoding: utf-8 -*-
# Importação das bibliotecas necessárias.
import mysql.connector
import datetime
# Configuração da conexão.
connection = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="teste"
)
# Variável que executará as operações.
cursor = connection.cursor(... | 3.390625 | 3 |
pydm/tests/widgets/test_enum_combo_box.py | KurtJacobson/pydm | 89 | 32223 | # Unit Tests for the Enum Combo Box
import pytest
from logging import ERROR
from qtpy.QtCore import Slot, Qt
from ...widgets.enum_combo_box import PyDMEnumComboBox
from ... import data_plugins
# --------------------
# POSITIVE TEST CASES
# --------------------
def test_construct(qtbot):
"""
Test the const... | 2.515625 | 3 |
byol_train.py | jhvics1/pytorch-byol | 0 | 32224 | import os
import random
import argparse
import multiprocessing
import numpy as np
import torch
from torchvision import models, transforms
from torch.utils.data import DataLoader, Dataset
from pathlib import Path
from PIL import Image
from utils import Bar, config, mkdir_p, AverageMeter
from datetime import datetime
fro... | 2.015625 | 2 |
electrum/networks/auxpow_mixin.py | ZenyattaAbosom/AbosomElectrum | 4 | 32225 | class AuxPowMixin(object):
AUXPOW_START_HEIGHT = 0
AUXPOW_CHAIN_ID = 0x0001
BLOCK_VERSION_AUXPOW_BIT = 0
@classmethod
def is_auxpow_active(cls, header) -> bool:
height_allows_auxpow = header['block_height'] >= cls.AUXPOW_START_HEIGHT
version_allows_auxpow = header['version'] & cls.B... | 2.21875 | 2 |
Problems/dicecup.py | rikgj/Kattis | 0 | 32226 | from sys import stdin
a,b = [int(x) for x in stdin.readline().split(' ')]
diff = abs(a-b) +1
a = min(a,b) +1
print(a)
for x in range(1,diff):
print(a+x)
| 3.0625 | 3 |
Castessoft_Python/Castessoft_Dahianna.py | JuanDiegoCastellanos/All-in-one-Python-Full | 1 | 32227 | import os
class Cajero:
def __init__(self):
self.continuar = True
self.monto = 5000
self.menu()
def contraseña(self):
contador = 1
while contador <= 3:
x = int(input("ingrese su contraseña:" ))
if x == 5467:
print("Contraseña ... | 3.828125 | 4 |
modules.py | faber6/kings-raid-daily | 0 | 32228 | from threading import Thread, enumerate
from random import choice
from time import sleep as slp
from time import time as tiime
from os import mkdir, getcwd, path as pth
from subprocess import run as run_
from math import ceil
from traceback import format_exc
from sys import exit
import logging, json, ctypes
from ppadb... | 2.046875 | 2 |
sarikasama/0012/0012.py | saurabh896/python-1 | 3,976 | 32229 | #!/usr/bin/env python3
#filter sensitive words in user's input
def replace_sensitive_words(input_word):
s_words = []
with open('filtered_words','r') as f:
line = f.readline()
while line != '':
s_words.append(line.strip())
line = f.readline()
for word in s_words:
... | 4.0625 | 4 |
moceansdk/modules/command/mc_object/tg_request_contact.py | d3no/mocean-sdk-python | 2 | 32230 | <filename>moceansdk/modules/command/mc_object/tg_request_contact.py
from builtins import super
from moceansdk.modules.command.mc_object import AbstractMc
class TgRequestContact(AbstractMc):
def __init__(self, param=None):
super().__init__(param)
self.set_button_text('Share button')
def actio... | 2.328125 | 2 |
tests/engine/backend/test_multiprocess_backend.py | sanchitcop19/web-api-async | 0 | 32231 | <gh_stars>0
"""Test the execute method of the synchronous backend."""
import os
import shutil
import time
import unittest
from vizier.datastore.fs.factory import FileSystemDatastoreFactory
from vizier.engine.backend.multiprocess import MultiProcessBackend
from vizier.engine.controller import WorkflowController
from v... | 1.898438 | 2 |
main.py | Stormjotne/oslomet-disease-model | 2 | 32232 | <reponame>Stormjotne/oslomet-disease-model<gh_stars>1-10
from time import sleep
from random import random, uniform
from OMDM import Evolution
"""
Run the model optimization program we're creating from this script.
"""
hyper_parameters = {
"number_of_generations": 10,
"genome_length": ... | 2.625 | 3 |
pyoat/__init__.py | berkanlafci/pyoat | 5 | 32233 | #-----
# Description : Import classes/functions from subfolders
# Date : February 2021
# Author : <NAME>
# E-mail : <EMAIL>
#-----
# package version
__version__ = "1.0.0"
# oa recon codes
from pyoat.reconstruction import cpuBP, cpuMB, modelOA
# data readers
from pyoat.readers import oaReader... | 1.4375 | 1 |
game/cactus.py | gmunumel/trex404 | 0 | 32234 | <filename>game/cactus.py
from game.globals import *
from game.lib import load_sprite_sheet
import pygame, random
class Cactus(pygame.sprite.Sprite):
def __init__(self, speed = 5, sizeX = -1, sizeY = -1):
pygame.sprite.Sprite.__init__(self, self.containers)
self.images, self.rect = load_sprite_sheet('cacti-sm... | 3.03125 | 3 |
src/api/auth/views/token_views.py | Chromico/bk-base | 84 | 32235 | <reponame>Chromico/bk-base<filename>src/api/auth/views/token_views.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
Lic... | 1.335938 | 1 |
fdrtd/builtins/util/kvstorage.py | chart21/fdrtd | 0 | 32236 | <reponame>chart21/fdrtd
"""
contains microservice KeyValueStorage
"""
import uuid as _uuid
from fdrtd.server.microservice import Microservice
class KeyValueStorage(Microservice):
"""stores and retrieves values by key"""
def __init__(self, bus, endpoint):
super().__init__(bus, endpoint)
self... | 2.640625 | 3 |
tests/unit/handlers/test_HTTPSClientAuthHandler.py | sivel/requisitor | 7 | 32237 | <filename>tests/unit/handlers/test_HTTPSClientAuthHandler.py
import pytest
from requisitor.session import Session
def test_client_cert_auth(mocker):
conn = mocker.patch('http.client.HTTPSConnection',
side_effect=RuntimeError)
s = Session()
with pytest.raises(RuntimeError):
... | 2.4375 | 2 |
Dataset/Leetcode/valid/35/31.py | kkcookies99/UAST | 0 | 32238 | <gh_stars>0
class Solution:
def XXX(self, nums: List[int], target: int) -> int:
l, r = 0, len(nums)-1
# 找到第一个大于或等于target的位置
while l<r:
m = (l+r) // 2
if nums[m] >= target:
r = m
else:
l = m + 1
if nums[r] >= targe... | 2.765625 | 3 |
gracc-oneoffs/remove-odd-procs/remove-odd-procs.py | opensciencegrid/gracc-tools | 0 | 32239 | #!/usr/bin/python
import elasticsearch
from elasticsearch_dsl import Search, A, Q
#import logging
import sys
import os
#logging.basicConfig(level=logging.WARN)
#es = elasticsearch.Elasticsearch(
# ['https://gracc.opensciencegrid.org/q'],
# timeout=300, use_ssl=True, verify_certs=False)
es = elasticsea... | 2.25 | 2 |
Hasoc/create_folds.py | tezike/Hasoc | 1 | 32240 | <filename>Hasoc/create_folds.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/create_folds.ipynb (unless otherwise specified).
__all__ = ['df', 'df', 'y', 'kf', 'df', 'y']
# Cell
import os
import pandas as pd
from sklearn.model_selection import StratifiedKFold
# Cell
df = pd.read_csv(os.path.join('../data', 'en_t... | 2.4375 | 2 |
heat/tests/test_components.py | citrix-openstack-build/heat | 0 | 32241 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 | 2 |
pycstruct/pycstruct.py | midstar/pycstruct | 14 | 32242 | """pycstruct definitions
Copyright 2021 by <NAME>.
All rights reserved.
This file is part of the pycstruct python library and is
released under the "MIT License Agreement". Please see the LICENSE
file that should have been included as part of this package.
"""
# pylint: disable=too-many-lines, protected-access
impor... | 1.71875 | 2 |
cosymlib/simulation/__init__.py | GrupEstructuraElectronicaSimetria/cosymlib | 0 | 32243 | import huckelpy
from huckelpy import file_io
class ExtendedHuckel:
def __init__(self, geometry, charge=0):
self._EH = huckelpy.ExtendedHuckel(geometry.get_positions(), geometry.get_symbols(), charge=charge)
self._alpha_electrons = None
self._beta_electrons = None
self._total_elect... | 2.765625 | 3 |
ex012.py | sml07/Meus-Estudos-Python | 0 | 32244 | <reponame>sml07/Meus-Estudos-Python
#Faça um algoritimo que leia o preço de um produto e mostre o seu novo preço com 5% de desconto.
price = float(input("Digite o preço do produto: "))
sale = price - (price * 0.05)
print("O valor bruto do produto é: {:.2f}R$.".format(price))
print("Com o desconto de 5%: {:.2f}R$".form... | 3.953125 | 4 |
tests/r/test_bcdeter.py | hajime9652/observations | 199 | 32245 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.bcdeter import bcdeter
def test_bcdeter():
"""Test module bcdeter.py by downloading
bcdeter.csv and testing... | 2.484375 | 2 |
multi_parser/shared/__init__.py | ilya-mezentsev/multi-parser | 14 | 32246 | <filename>multi_parser/shared/__init__.py
from .request import *
from .response import *
| 1.164063 | 1 |
wmf_embed/core/lang_embedding.py | shilad/wmf-embeddings | 0 | 32247 | <filename>wmf_embed/core/lang_embedding.py
import logging
import math
import os.path
import re
import annoy
import numpy as np
from gensim.models import KeyedVectors
from gensim.utils import to_unicode
from smart_open import smart_open
from .utils import NP_FLOAT
def from_mikolov(lang, inpath, outpath):
if not o... | 2.21875 | 2 |
test/util/test_function_factory.py | ediphy-dwild/gpytorch | 0 | 32248 | <filename>test/util/test_function_factory.py
import math
import torch
import unittest
import gpytorch
import numpy as np
from torch.autograd import Variable
from gpytorch.utils import approx_equal, function_factory
from gpytorch.lazy import NonLazyVariable
_exact_gp_mll_class = function_factory.exact_gp_mll_factory()... | 2.46875 | 2 |
tests/boardfarm_plugins/boardfarm_prplmesh/tests/ap_config_bss_tear_down.py | SWRT-dev/easymesh | 0 | 32249 | # SPDX-License-Identifier: BSD-2-Clause-Patent
# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md)
# This code is subject to the terms of the BSD+Patent license.
# See LICENSE file for more details.
from .prplmesh_base_test import PrplMeshBaseTest
from boardfarm.exceptions import SkipTest
from ca... | 2.0625 | 2 |
taller_estructuras_de_control/codigo_python_ejercicios/ejercicio_9.py | JMosqueraM/algoritmos_y_programacion | 0 | 32250 | #Calcular el salario neto de un tnrabajador en fucion del numero de horas trabajadas, el precio de la hora
#y el descuento fijo al sueldo base por concepto de impuestos del 20%
horas = float(input("Ingrese el numero de horas trabajadas: "))
precio_hora = float(input("Ingrese el precio por hora trabajada: "))
sueldo_ba... | 3.90625 | 4 |
cs15211/BattleshipsInABoard.py | JulyKikuAkita/PythonPrac | 1 | 32251 | <reponame>JulyKikuAkita/PythonPrac
__source__ = 'https://github.com/kamyu104/LeetCode/blob/master/Python/battleships-in-a-board.py'
# Time: O(m * n)
# Space: O(1)
#
#
# Description: 419. Battleships in a Board
#
# Given an 2D board, count how many different battleships are in it.
# The battleships are represented with... | 4.0625 | 4 |
catch_video.py | ZXin0305/hri | 0 | 32252 | <gh_stars>0
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
import message_filters
import cv2
import torch
import torchvision.transforms as transforms
from exps.stage3_root2.config import cfg
# from demo import process_video
from model.main_model.smap import SMAP
from model.refine_model.r... | 1.960938 | 2 |
bouncer.py | pard68/epub-bouncer | 0 | 32253 | <gh_stars>0
from typing import Dict
import correct_spellings
import epub_handling
import xml_handling
import argparse
import string
import re
# ---------------------------------------------------------------------------------------------------
def correct_file_contents(corrections : Dict[str, str], file_contents : st... | 3.125 | 3 |
detect.py | MahmudulAlam/Object-Detection-Using-GPM | 1 | 32254 | import cv2
import pickle
import numpy as np
from flag import Flag
flag = Flag()
with open('assets/colors.h5', 'rb') as f:
colors = pickle.loads(f.read())
with open('label.txt', 'r') as f:
classes = f.readlines()
def detector(image, label):
image = np.asarray(image * 255., np.uint8)
image = cv2.cvtCo... | 2.484375 | 2 |
instabot/liking.py | jakerobinson19/instabot | 1 | 32255 | import retrieve
import validation
from time_functions import time_delay
from selenium.webdriver import ActionChains
def like_pic(browser):
heart = retrieve.like_button(browser)
time_delay()
if validation.already_liked(heart):
heart.click()
def like_pic_in_feed(browser, number = 1):
loop = 1
wh... | 2.71875 | 3 |
tollan/utils/qt/colors.py | toltec-astro/tollan | 0 | 32256 | <gh_stars>0
#! /usr/bin/env python
import matplotlib.colors as mc
import numpy as np
import re
class Palette(object):
black = "#000000"
white = "#ffffff"
blue = "#73cef4"
green = "#bdffbf"
orange = "#ffa500"
purple = "#af00ff"
red = "#ff6666"
yellow = "#ffffa0"
@staticmethod
... | 2.828125 | 3 |
mom/itertools.py | ands904/ands904-tinypyclone | 16 | 32257 | <filename>mom/itertools.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""":synopsis: Implements :mod:`itertools` for older versions of Python.
:module: mom.itertools
:copyright: 2010-2011 by <NAME>
:license: BSD, PSF
Borrowed from brownie.itools.
"""
from __future__ import absolute_import
import itertools
from mo... | 3.09375 | 3 |
Sampling_based_Planning/rrt_3D/env3D.py | CodesHub/PathPlanning | 3,693 | 32258 | <filename>Sampling_based_Planning/rrt_3D/env3D.py
# this is the three dimensional configuration space for rrt
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
# from utils3D import OBB2AABB
def R_matrix(z_angle,y_angle,x_angle):
# s angle: row; y angle: pitch; z ... | 2.53125 | 3 |
tests/test_wrong_url.py | alexella1/python-ascii_magic | 0 | 32259 | from context import ascii_magic
try:
output = ascii_magic.from_url('https://wow.zamimg.com/uploads/blog/images/20516-afterlives-ardenweald-4k-desktop-wallpapers.jpg')
ascii_magic.to_terminal(output)
except OSError as e:
print(f'Could not load the image, server said: {e.code} {e.msg}') | 2.265625 | 2 |
book/code/imdb - project4+5 scrape popular film list and poster.py | marcus-pham/test | 0 | 32260 | <gh_stars>0
from bs4 import BeautifulSoup
from selenium import webdriver
import requests
import time
class Film(object):
"""docstring for film"""
def __init__(self):
self.title = ""
self.rank = ""
self.year_of_production = ""
self.link = ""
def create_phantom_driver():
driver = webdriver.PhantomJS(execut... | 3.296875 | 3 |
mqtt_io/modules/sensor/mcp3008.py | DominicWindisch/mqtt-io | 231 | 32261 | <reponame>DominicWindisch/mqtt-io<filename>mqtt_io/modules/sensor/mcp3008.py
"""
MCP3008 analog to digital converter
"""
import logging
from typing import cast
from mqtt_io.types import ConfigType, SensorValueType
from . import GenericSensor
REQUIREMENTS = ("adafruit-mcp3008",)
CONFIG_SCHEMA = {
"spi_port": di... | 2.59375 | 3 |
aristaflow/worklist_model.py | riuns/aristaflowpy | 0 | 32262 | """
Worklist model classes
"""
# AristaFlow REST Libraries
from af_worklist_manager.models.qualified_agent import QualifiedAgent
from af_worklist_manager.models.worklist_revision import WorklistRevision
from af_worklist_manager.models.worklist_update_configuration import WorklistUpdateConfiguration
class Worklist(obj... | 2.140625 | 2 |
tests/examples/minlplib/arki0019.py | ouyang-w-19/decogo | 2 | 32263 | <reponame>ouyang-w-19/decogo<filename>tests/examples/minlplib/arki0019.py<gh_stars>1-10
# NLP written by GAMS Convert at 04/21/18 13:51:02
#
# Equation counts
# Total E G L N X C B
# 3 2 0 1 0 0 0 0
#
#... | 1.734375 | 2 |
bin/build_upset_input.py | NCBI-Hackathons/AssesSV | 4 | 32264 | <reponame>NCBI-Hackathons/AssesSV
#!/usr/bin/env python3
from glob import glob
import pandas as pd
import os
import gzip
import sys
path_to_vcf_files = sys.argv[1]
true_variants = sys.argv[2]
vcf_files = glob(path_to_vcf_files + "/*tp-base.vcf")
print(vcf_files)
all_variants = []
summary = {}
## Build master list of... | 2.546875 | 3 |
Apple EFI Package Extractor/Linux_Pre-Alpha/Apple_EFI_Package.py | Coool/BIOSUtilities | 0 | 32265 | #!/usr/bin/env python3
"""
Apple EFI Package
Apple EFI Package Extractor
Copyright (C) 2019-2021 <NAME>
"""
print('Apple EFI Package Extractor v2.0_Linux_a1')
import os
import sys
import zlib
import shutil
import subprocess
if len(sys.argv) >= 2 :
pkg = sys.argv[1:]
else :
pkg = []
in_path = input('\nEnter the f... | 2.75 | 3 |
sourcing_code_pro.py | kiwi0fruit/open-fonts | 30 | 32266 | # -*- coding: utf-8 -*-
# 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 License, or
# (at your option) any later version.
#
# This program is distributed in the hope that... | 2.09375 | 2 |
apple/bundling/debug_symbol_actions.bzl | kastiglione/rules_apple | 2 | 32267 | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 1.96875 | 2 |
uplift/tree/_utils.py | Antiguru11/uplift | 0 | 32268 | <filename>uplift/tree/_utils.py
import numpy as np
def group_stats(y, w, groups):
uts = list()
nts = list()
nc = (w == 0).sum()
if nc == 0:
yc = 0
else:
yc = y[w == 0].mean()
for group in groups:
ng = (w == group).sum()
if ng == 0:
uts.append(-yc)
... | 2.625 | 3 |
ipyannotator/ipytyping/annotations.py | itepifanio/ipyannotator | 0 | 32269 | <reponame>itepifanio/ipyannotator
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00c_annotation_types.ipynb (unless otherwise specified).
__all__ = []
# Internal Cell
from pathlib import Path
from collections.abc import MutableMapping
from typing import Dict, Optional, Iterable, Any, Union
from ipywidgets import Lay... | 1.851563 | 2 |
optapy-core/tests/test_inverse_relation.py | optapy/optapy | 85 | 32270 | <gh_stars>10-100
import optapy
import optapy.score
import optapy.config
import optapy.constraint
@optapy.planning_entity
class InverseRelationEntity:
def __init__(self, code, value=None):
self.code = code
self.value = value
@optapy.planning_variable(object, ['value_range'])
def get_value(... | 2.265625 | 2 |
pizza_store/models/user.py | astsu-dev/pizza-store-backend | 2 | 32271 | import datetime
import uuid
from pizza_store.enums.role import Role
from pydantic import BaseModel
class UserBase(BaseModel):
username: str
email: str
class UserCreate(UserBase):
"""User register model"""
password: str
class UserIn(BaseModel):
"""User login model."""
username: str
p... | 2.65625 | 3 |
mautrix/types/event/batch.py | tulir/mautrix-appservice-python | 1 | 32272 | <filename>mautrix/types/event/batch.py<gh_stars>1-10
# Copyright (c) 2022 <NAME>, <NAME>
#
# 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/.
from typing import Any
from a... | 2.015625 | 2 |
dbks/runtime.py | vincentlam/dbks | 0 | 32273 | class Runtime:
@staticmethod
def v3(major: str, feature: str, ml_type: str = None, scala_version: str = "2.12"):
if ml_type and ml_type.lower() not in ["cpu", "gpu"]:
raise ValueError('"ml_type" can only be "cpu" or "gpu"!')
return "".join(
[
f"{major}.",
... | 2.3125 | 2 |
dvc/path/s3.py | zb0th/dvc | 0 | 32274 | from dvc.scheme import Schemes
from .base import PathCloudBASE
class PathS3(PathCloudBASE):
scheme = Schemes.S3
| 1.382813 | 1 |
filter_distance_01-1.py | jgpattis/Desres-sars-cov-2-apo-mpro | 0 | 32275 | <filename>filter_distance_01-1.py<gh_stars>0
#! /usr/bin/env/ python
# filter out CA distances with large minimum
# filter out CA distances with small standard deviations
# save to file for later use
# will plot distances used
import mdtraj as md
import pyemma.coordinates as coor
import numpy as np
import pickle
from ... | 2.09375 | 2 |
src/panoptoindexconnector/implementations/coveo_implementation.py | bschlintz/panopto-index-connector | 0 | 32276 | <gh_stars>0
"""
Methods for the connector application to convert and sync content to the target endpoint
Start with this template to implement these methods for the connector application
"""
# Standard Library Imports
import json
import logging
import os
# Third party
import requests
# Global constants
DIR = os.pat... | 2.078125 | 2 |
dashboard/scripts/webscraper.py | lynetteoh/COVID19dashboard | 0 | 32277 | # script for daily update
from bs4 import BeautifulSoup
# from urllib.request import urlopen
import requests
import csv
import time
from datetime import datetime, timedelta
import os
from pathlib import Path
from dashboard.models import Case, Country, District, State, Zone
def run():
scrapeStateStats()
def scrapeC... | 2.828125 | 3 |
GAN/Architectures/models/conditional_gan.py | FlipWebApps/computer-vision-playground | 0 | 32278 | <reponame>FlipWebApps/computer-vision-playground<filename>GAN/Architectures/models/conditional_gan.py
import numpy as np
from keras.layers import Concatenate, Input, Dense, Reshape, Flatten, Dropout, multiply, \
BatchNormalization, Activation, Embedding, ZeroPadding2D, Conv2DTranspose
from keras.layers.advanced_ac... | 2.59375 | 3 |
ema.py | rsprouse/ema_head_correction | 0 | 32279 | <filename>ema.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 14 21:19:42 2017
@author: ubuntu
"""
import numpy as np
from numpy import cross,dot
from numpy.linalg import norm
import pandas as pd
import os
def read_ndi_data(mydir, file_name,sensors,subcolumns):
'''
Read data produced ... | 2.78125 | 3 |
applications/convection_diffusion_application/tests/test_apply_thermal_face_process.py | AndreaVoltan/MyKratos7.0 | 2 | 32280 | <filename>applications/convection_diffusion_application/tests/test_apply_thermal_face_process.py
from __future__ import print_function, absolute_import, division
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as UnitTest
import KratosMultiphysics.ConvectionDiffusionApplication as ConvectionDiffusion... | 2.3125 | 2 |
library/twisted/mod/regex.py | Kelbec-Nef/EVE-bot-discord | 59 | 32281 | <filename>library/twisted/mod/regex.py
import re
import datetime
def sub(message, regex):
regex=re.split("(?<!\\\\)/",regex)
if len(regex)>3:
regex[3] = regex[3].strip()
if not regex[3]:
count = 1
elif "g" in regex[3]:
count = 0
elif regex[3].isdigit():
... | 2.4375 | 2 |
02/01/isupper.py | pylangstudy/201708 | 0 | 32282 | s = 'abc'; print(s.isupper(), s)
s = 'Abc'; print(s.isupper(), s)
s = 'aBc'; print(s.isupper(), s)
s = 'abC'; print(s.isupper(), s)
s = 'abc'; print(s.isupper(), s)
s = 'ABC'; print(s.isupper(), s)
s = 'abc'; print(s.capitalize().isupper(), s.capitalize())
| 4.03125 | 4 |
tests/test_scriptfields.py | ttimasdf/pyes | 175 | 32283 | <filename>tests/test_scriptfields.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from pyes import scriptfields
class ScriptFieldsTest(unittest.TestCase):
def test_scriptfieldserror_imported(self):
self.assertTrue(hasattr(scriptfields, 'ScriptFieldsError'))
def test_i... | 2.5 | 2 |
flow/urls.py | Xinghui-Wu/FlowMeter | 0 | 32284 | <filename>flow/urls.py<gh_stars>0
"""FlowMeter URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', ... | 2.390625 | 2 |
psp/gcp_utils.py | amckenna41/DCBLSTM_PSP | 1 | 32285 | <gh_stars>1-10
################################################################################
######## Google Cloud Platform Utilities ########
################################################################################
#Importing required libraries and dependancies
import numpy a... | 2.4375 | 2 |
Glassdoor scraping/main.py | stancld/MSc-Project | 2 | 32286 | <gh_stars>1-10
# import libraries
import time
import datetime
from argparse import ArgumentParser
from datetime import date
import re
import json
import numpy as np
import pandas as pd
import django
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support im... | 2.5 | 2 |
week12/api/urls.py | yestemir/web | 0 | 32287 | from django.urls import path
#from api.views import company_list, company_details, company_vacancies, vacancies_list, vacancy_detail
from api.views import company_list, company_details
urlpatterns = [
path('companies/', company_list),
path('companies/<int:company_id>/', company_details),
#path('companies/<... | 1.625 | 2 |
ex02_randomness_test/tests/test_main.py | ittigorn-tra/exercises | 0 | 32288 | from logging import getLogger
from lottery_config import LotteryConfig
from main import draw_lottery
logger = getLogger()
def test_draw_lottery():
for test_count in range(10000):
draw_results = draw_lottery()
logger.info(f'Test #{str(test_count).ljust(4)} Draw Results : {draw_results}')
... | 3.234375 | 3 |
.ipynb_checkpoints/get-checkpoint.py | Ferruolo/delphi | 0 | 32289 |
import requests
import io
import dask
from bs4 import BeautifulSoup as BS
import nltk
import pandas
import numpy as np
def News(ticker):
B = BS(requests.get(f"https://www.wsj.com/market-data/quotes/{ticker}", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ... | 3.09375 | 3 |
glom/test/test_path_and_t.py | justinvanwinkle/glom | 0 | 32290 |
from pytest import raises
from glom import glom, Path, S, T, A, PathAccessError, GlomError, BadSpec
def test_list_path_access():
assert glom(list(range(10)), Path(1)) == 1
def test_path():
_obj = object()
target = {'a': {'b.b': [None, {_obj: [None, None, 'd']}]}}
assert glom(target, Path('a', 'b.b... | 2.46875 | 2 |
dissononce/dh/x448/private.py | dineshks1/dissononce | 34 | 32291 | from dissononce.dh import private
class PrivateKey(private.PrivateKey):
pass
| 1.070313 | 1 |
main.py | BXRSRUDIOS/Shooter-Game | 0 | 32292 | from pygame import *
from random import randint
import json
#fonts and captions
font.init()
font1 = font.SysFont('Comic Sans', 60)
win = font1.render('Dam you actually poggers', True, (255, 255, 255))
lose = font1.render('Yeah you suck, you lost', True, (180, 0, 0))
font2 = font.SysFont('Comic Sans', 36)
ammo_lose ... | 3.46875 | 3 |
lib_bgp_data/collectors/traceroutes/tables.py | jfuruness/lib_bgp_data | 16 | 32293 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from ...utils.database import Generic_Table
class ROAs_Table(Generic_Table):
"""Announcements table class"""
__slots__ = []
name = "roas"
columns = ["asn", "prefix", "max_length", "created_at"]
def _create_tables(s... | 2.390625 | 2 |
install/app_store/tk-multi-about/v0.2.7/python/tk_multi_about/dialog.py | JoanAzpeitia/lp_sg | 0 | 32294 | # Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | 1.742188 | 2 |
FHIR_Tester_backend/services/monkey/MonkeyInterpreter.py | ideaworld/FHIR_Tester | 0 | 32295 | <filename>FHIR_Tester_backend/services/monkey/MonkeyInterpreter.py
from CodeGenerator import *
class MonkeyInterpreter:
def __init__(self, prog, filename="", identify="", base_path=""):
self.prog = prog
self.func_table = {}
self.code_str = ''
self.filename = filename
self.url... | 2.4375 | 2 |
arviz/plots/backends/matplotlib/distcomparisonplot.py | sudojarvis/arviz | 1,159 | 32296 | <filename>arviz/plots/backends/matplotlib/distcomparisonplot.py
"""Matplotlib Density Comparison plot."""
import matplotlib.pyplot as plt
import numpy as np
from ...distplot import plot_dist
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, backend_show
def plot_dist_comparison(
ax,... | 2.390625 | 2 |
migrations/versions/1a869ac514c_.py | isabella232/comport | 35 | 32297 | <filename>migrations/versions/1a869ac514c_.py<gh_stars>10-100
"""empty message
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2015-09-29 11:06:57.293537
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
... | 1.664063 | 2 |
site_scons/grouptest.py | svn2github/Escript | 0 | 32298 | <reponame>svn2github/Escript
##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LIC... | 1.734375 | 2 |
setup.py | wusung/ipython-notebook-tabs | 0 | 32299 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
# Backwards compatibility for Python 2.x
try:
from itertools import ifilter
filter = ifilter
except Impor... | 1.96875 | 2 |