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 |
|---|---|---|---|---|---|---|
eucaconsole/models/auth.py | ccassler/eucaconsole | 0 | 40100 | # -*- coding: utf-8 -*-
# Copyright 2013-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this... | 1.148438 | 1 |
mitzasql/ui/widgets/session_popup_launcher.py | vladbalmos/mitzasql | 69 | 40101 | # Copyright (c) 2021 <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
# See LICENSE file
import urwid
from .. import main_loop as shared_main_loop
from .error_dialog import ErrorDialog
from .info_dialog import InfoDialog
from .quit_dialog import QuitDialog
class SessionPopupLauncher(urwid.PopUpLauncher):
DEFAULT_WR =... | 2.40625 | 2 |
Desafios/Desafio110.py | vaniaferreira/Python | 0 | 40102 | #Adicione ao módulo moeda.py criado nos desafios anteriores, uma função chamada resumo(), que mostre na tela algumas
#informaçôes geradas pelas funções que já temos no módulo criado até aqui.
import moeda
p = float(input('Preço: R$'))
moeda.resumo(p, 20, 12)
| 3.296875 | 3 |
gpvolve/__init__.py | clararehmann/gpvolve | 1 | 40103 | <filename>gpvolve/__init__.py
from .__version__ import __version__
from . import simulate
from . import markov
from . import utils
from . import check
from . import pyplot
from .markovmodel import GenotypePhenotypeMSM
from .slimsim import GenotypePhenotypeSLiM
# from .visualization import *
#from .utils import *
# fr... | 1.179688 | 1 |
t108.py | showerhhh/leetcode_python | 0 | 40104 | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def sortedArrayToBST(self, nums) -> TreeNode:
def func(left, right) -> TreeNode:
if left > right:
return None
... | 3.703125 | 4 |
devices/ssh_connection.py | premandfriends/boardfarm-1 | 74 | 40105 | import pexpect
class SshConnection:
'''
To use, set conn_cmd in your json to "ssh root@192.168.1.1 -i ~/.ssh/id_rsa""
and set connection_type to "ssh"
'''
def __init__(self, device=None, conn_cmd=None, ssh_password='<PASSWORD>', **kwargs):
self.device = device
self.con... | 2.6875 | 3 |
search the no of time in a list.py | Max143/Python_programs | 0 | 40106 | # Write a python program to search the number of Times a paricular number in a list
'''
a = []
n = int(input("Enter a no. of element: "))
for i in range(n+1): #(n+1) here I can use input function but this is different method
b = int(input("Enter element: "))
a.append(b)
print(a)
k = 0
num... | 4 | 4 |
gpu/gpu_client.py | increasinglyy/deeper-server | 0 | 40107 | <filename>gpu/gpu_client.py<gh_stars>0
import sys
import os
import argparse
from tools import remote
class Action(object):
'''Class for register action to special argument.'''
def __init__(self, name='None'):
self.name = name
self.args = {}
def register(cmd, action):
if self.args.get(cmd, 'None') != 'None'... | 2.765625 | 3 |
src/minio_console/client.py | cinaq/minio-console | 1 | 40108 | <gh_stars>1-10
import requests
import json
class MinioConsoleClient:
def __init__(self, url, username, password):
# docs: https://github.com/minio/console/blob/master/swagger-console.yml
self.url = url + "/api/v1"
self.username = username
self.password = password
self.token ... | 2.421875 | 2 |
examples/TomatoDemo/GetCamImage.py | wmh123456789/cozmo-python-wmh | 0 | 40109 | # The Demo to test the Cozmo's camera image
import asyncio
import time
import os
import cozmo
# BUFF_PATH = "/home/wmh/work/seqbuff/"
BUFF_PATH = "/Users/wty/work/TestSeq/MoveInLine5/"
BUFF_LENGTH = 10000
last_image = None
def loop(robot: cozmo.robot.Robot):
inc = 1
HeadAngle = 0
robot.set_lift_heigh... | 2.359375 | 2 |
app/oauth_office365/tests.py | ricardojba/PwnAuth | 304 | 40110 | <filename>app/oauth_office365/tests.py<gh_stars>100-1000
from django.test import TestCase
# Create your tests here.
# TODO add test to validate application scopes are enforced when creating
# TODO add test to validate that application redirect and refresh URL match the site's base url
# TODO add unicode handling test... | 1.648438 | 2 |
sell-oco-remaining-coins.py | jthhk/Binance-volatility-trading-bot | 4 | 40111 | <filename>sell-oco-remaining-coins.py<gh_stars>1-10
import sys
#sys.path.append('..')
import json
import os
from helpers.parameters import parse_args, load_config
from binance.client import Client
from binance.exceptions import BinanceAPIException, BinanceOrderException
from binance.helpers import round_step_size
from... | 2.109375 | 2 |
10 days of statistics/Day5PoissonDistribution2.py | rahamath2009/git-github.com-nishant-sethi-HackerRank | 76 | 40112 | '''
Created on May 28, 2018
@author: nishant.sethi
'''
import math
mean_x=0.88
mean_y=1.55
result_x=160+40*(mean_x+mean_x**2)
result_y=128+40*(mean_y+mean_y**2)
print(round(result_x,3))
print(round(result_y,3)) | 3.65625 | 4 |
pipeline/mtl_analysis/Data.py | LiuDaveLiu/map-ephys | 1 | 40113 | <filename>pipeline/mtl_analysis/Data.py
import os, sys, glob, copy, cv2
import numpy as np
import utils
import torch
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from process_configs import process_configs
import pandas as pd
class FrameBaseDataset(Dataset):
def __init__(self, configs, df... | 1.820313 | 2 |
transform/transformers/pdf_transformer.py | uk-gov-mirror/ONSdigital.sdx-transform-cs | 1 | 40114 | <filename>transform/transformers/pdf_transformer.py
import arrow
from io import BytesIO
from reportlab.lib import colors
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph
from report... | 2.546875 | 3 |
MD_simulation_on_alanine_dipeptide/current_work/src/coordinates_data_files_list.py | weiHelloWorld/MD_simulation_research | 19 | 40115 | from config import *
from helper_func import *
class coordinates_data_files_list(object):
def __init__(self,
list_of_dir_of_coor_data_files = CONFIG_1, # this is the directory that holds corrdinates data files
):
assert (isinstance(list_of_dir_of_coor_data_files, list)) #... | 2.734375 | 3 |
public_admin/admin.py | jhrdt/django-public-admin | 36 | 40116 | from django.contrib.admin import ModelAdmin
from public_admin.sites import PublicAdminSite
class PublicModelAdmin(ModelAdmin):
"""This mimics the Django's native ModelAdmin but filters URLs that should
not exist in a public admin, and deals with request-based permissions."""
def has_view_permission(self,... | 2.65625 | 3 |
PortScan/portScan.py | Pter18/PruebasPentest | 0 | 40117 | <gh_stars>0
#|/bin/python
'''
<NAME>
Plan de Becarios generacion 13
Curso: Pruebas de penetracion
Programa que escanea una IP y detenrmina los puertos
abiertos con ayuda de scapy.
'''
import time
from scapy.all import *
# IP a escanear
ip = "192.168.2.70"
# Cuenta de puertos cerrados
closed_ports = 0
# Arreglo donde ... | 3.078125 | 3 |
test_translate.py | pablogadhi/TranslationDetector | 0 | 40118 | import dill
import torch
from torchtext.datasets import TranslationDataset
from translation.transformer import Transformer
from translation.translate import translate_dataset
if __name__ == "__main__":
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
src_field_f = open("data/SRC_Field.pt"... | 2.421875 | 2 |
sdf-net/lib/torchgp/load_las.py | benmatok/nglod | 0 | 40119 | <filename>sdf-net/lib/torchgp/load_las.py<gh_stars>0
import numpy as np
import torch
import laspy
import sys
import os
def load_las(
fname : str):
assert fname is not None and os.path.exists(fname), \
'Invalid file path and/or format, must be an existing Wavefront .obj'
fname = convert_laz_... | 2.5 | 2 |
packages/syft/src/syft/core/tensor/autodp/initial_gamma.py | eelcovdw/PySyft | 1 | 40120 | <filename>packages/syft/src/syft/core/tensor/autodp/initial_gamma.py
# stdlib
from typing import Any
from typing import List as TypeList
from typing import Optional
from typing import Union
# third party
import numpy as np
# relative
from ...adp.vm_private_scalar_manager import VirtualMachinePrivateScalarManager
from... | 1.90625 | 2 |
tests/test_adaptor/test_model.py | richlewis42/pandas-learn | 1 | 40121 | <reponame>richlewis42/pandas-learn<filename>tests/test_adaptor/test_model.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of pandas-learn
# https://github.com/RichLewis42/pandas-learn
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
# Copyright (c) 2015, <NAME> <<EMAI... | 2.78125 | 3 |
examples/tensorflow/dataDeal.py | catchlove666/XLearning | 0 | 40122 | <reponame>catchlove666/XLearning<gh_stars>0
#!/usr/bin/python
# -*- coding:utf-8 -*-
import tensorflow as tf
import numpy as np
import os
def get_train(data_path, batch_size=32):
for s in os.listdir(data_path):
with open(data_path+"/"+s, "r") as f:
for line in f:
y, x = line.strip("\n").split(... | 2.546875 | 3 |
pygfa/operations.py | Francesco2304/pygfa | 3 | 40123 | from networkx.algorithms.components.connected import node_connected_component as nx_node_connected_component
from networkx.algorithms.components.connected import connected_components as nx_connected_components
import pygfa.gfa # required for GFAError (gives error otherwise)
def nodes_connected_component(gfa_, nid):
... | 2.96875 | 3 |
linetools/spectra/tests/test_xspec_attrib.py | marijana777/linetools | 0 | 40124 | <gh_stars>0
""" Module to run tests on XSpectrum1D attributes
"""
from __future__ import print_function, absolute_import, \
division, unicode_literals
import numpy as np
import os
import pytest
import astropy.io.ascii as ascii
from astropy import units as u
import astropy.table
from linetools.spectra import io
f... | 2.21875 | 2 |
exercicios/dicionarios/desafio92.py | costagguilherme/python-desafios | 0 | 40125 | <gh_stars>0
info = {}
nome = str(input('NOME: '))
nasc = int(input('ANO DE NASCIMENTO: '))
idade = 2020 - nasc
cart = int(input('CARTEIRA DE TRABALHO (0 Se não tiver): '))
info['NOME'] = nome
info['IDADE'] = idade
info['NASCIMENTO'] = nasc
info['CTPS'] = cart
if cart == 0:
for k, v in info.items():
print(f'... | 3.390625 | 3 |
programs/hello.py | russhughes/TurtlePlotBot | 11 | 40126 | """
hello.py: Simple example using write
"""
#pylint: disable-msg=import-error
from turtleplotbot import TurtlePlotBot
def main():
"""
Write "Hello!"
"""
bot = TurtlePlotBot()
bot.setscale(2)
bot.write("Hello!", "fonts/scripts.fnt")
bot.done()
main()
__import__("menu") # optional ret... | 2.265625 | 2 |
plugins/speechhandler/gmail/__init__.py | narfman0/jeeves | 4 | 40127 | # -*- coding: utf-8 -*-
from .gmail import GmailPlugin
| 1.015625 | 1 |
server/opendp_apps/model_helpers/msg_util.py | mikephelan/opendp-ux | 6 | 40128 | <reponame>mikephelan/opendp-ux
def msg(m):
"""
Shorthand for print statement
"""
print(m)
def dashes(cnt=40):
"""
Print dashed line
"""
msg('-' * cnt)
def msgt(m):
"""
Add dashed line pre/post print statment
"""
dashes()
msg(m)
dashes()
| 2.671875 | 3 |
snappy_wrappers/wrappers/gcnv/contig_ploidy/wrapper.py | PotatoThrone/snappy-pipeline | 5 | 40129 | # -*- coding: utf-8 -*-
from snakemake.shell import shell
paths_tsv = " ".join(snakemake.input.tsv)
shell(
r"""
export TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" ERR EXIT
export THEANO_FLAGS="base_compiledir=$TMPDIR/theano_compile_dir"
PRIORS=$TMPDIR/ploidy_priors.tsv
echo -e "CONTIG_NAME\tPLOIDY_PRIOR_0\tPLOID... | 1.9375 | 2 |
otp/otpbase/OTPRender.py | chrisd149/OpenLevelEditor | 25 | 40130 | <gh_stars>10-100
from panda3d.core import *
# global bitmasks for cameras
MainCameraBitmask = BitMask32.bit(0)
ReflectionCameraBitmask = BitMask32.bit(1)
ShadowCameraBitmask = BitMask32.bit(2)
SkyReflectionCameraBitmask = BitMask32.bit(3)
GlowCameraBitmask = BitMask32.bit(4)
EnviroCameraBitmask = BitMask32.bit(5)
# ... | 2.265625 | 2 |
test/deepclustering/augment/test_tensor_aug.py | jizongFox/deep-clustering-toolbox | 34 | 40131 | <filename>test/deepclustering/augment/test_tensor_aug.py
import requests
from PIL import Image
import numpy as np
from unittest import TestCase
import torch
from deepclustering.augment.tensor_augment import (
RandomCrop,
RandomHorizontalFlip,
RandomVerticalFlip,
)
URL = f"https://cdn1.medicalnewstoday.com/... | 2.609375 | 3 |
python/tvm/relay/op/_mlas.py | dvhg/tvm | 90 | 40132 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.84375 | 2 |
app.py | chitralputhran/Drive-Curve-Machine-Learning-App | 0 | 40133 | from flask import Flask, render_template, url_for, request
import numpy as np
import pandas as pd
import pickle
import warnings
warnings.filterwarnings("ignore")
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/predict', methods=['GET', 'POST'])
def predict(... | 2.71875 | 3 |
pineboolib/fllegacy/aqsobjects/aqs.py | juanjosepablos/pineboo | 0 | 40134 | <reponame>juanjosepablos/pineboo
# -*- coding: utf-8 -*-
"""
AQS package.
Main entrance to the different AQS resources.
"""
from PyQt5 import QtCore, QtWidgets, QtGui, QtXml
from pineboolib.core.utils import logging
from typing import Any, Optional, Union
from . import aqshttp, aqods
logger = logging.getLogger("A... | 2.015625 | 2 |
src/level_editor.py | rschwa6308/Momo-Is-You | 1 | 40135 | # Standalone GUI Applet for creating levels
import os
os.environ['pg_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame as pg
from multiprocessing import Process
from ui_helpers import *
from levels import levels, read_level, write_level, LEVELS_DIR
from main import play_level
from engine import Level, board_copy
# --- ... | 2.421875 | 2 |
scrapy/selector/lxmlsel.py | hobson/scrapy | 0 | 40136 | <reponame>hobson/scrapy<filename>scrapy/selector/lxmlsel.py
"""
XPath selectors based on lxml
"""
from .unified import Selector, SelectorList
__all__ = ['HtmlXPathSelector', 'XmlXPathSelector', 'XPathSelector',
'XPathSelectorList']
class XPathSelector(Selector):
__slots__ = ()
_default_type = 'ht... | 2.5625 | 3 |
ftx_cli/cmds/markets.py | YungBowsie/ftx-cli | 2 | 40137 | <filename>ftx_cli/cmds/markets.py
from ftx_cli.abstractions import ACmd
import pprint
class MarketsCmd(ACmd):
CMD_NAME = "markets"
CMD_HELP = "Commands related to the Markets API for FTX"
CMD_USAGE = """
$ ftx-cli markets -m ETH-PERP
$ ftx-cli markets
$ ftx-cli markets --api_key --api_secret -... | 2.796875 | 3 |
experiments/riskaverseplot.py | tcpedersen/deephedging | 0 | 40138 | # -*- coding: utf-8 -*-
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib as mpl
import simulators
import derivatives
import utils
import books
import hedge_models
import preprocessing
import approximators
from constants import FLOAT_DTYPE
class BrownianMotion(simulators.GBM):
def __init_... | 2.5 | 2 |
labs/lab4/lab4b.py | MITLLRacecar/racecar-arpan-kumar | 0 | 40139 | """
Copyright MIT and Harvey Mudd College
MIT License
Summer 2020
Lab 4B - LIDAR Wall Following
"""
########################################################################################
# Imports
########################################################################################
import sys
import cv2 as cv
i... | 2.296875 | 2 |
Pandas/DataFrame1.py | mehmet-karagoz/Python-Pandas | 1 | 40140 | <reponame>mehmet-karagoz/Python-Pandas<gh_stars>1-10
import pandas as pd
import numpy as np
#sozluk yapisi ve seriler ile Dataframe olusturma
# data = {
# 'first':pd.Series([1,2,3,4,5],index=['a','b','c','d','e']),
# 'second':pd.Series([5,4,3,2],index=['a','b','c','d'])
# }
# df = pd.DataFrame(data)
... | 3.484375 | 3 |
model.py | prat7mish/Behavioral_Cloning | 0 | 40141 | <gh_stars>0
# import libraries
import csv
import cv2
import random
import numpy as np
from keras.models import Sequential
from keras.layers import Cropping2D
from keras.layers.core import Dense, Flatten, Lambda, Dropout
from keras.layers.convolutional import Conv2D
import sklearn
from sklearn.model_selection import ... | 2.671875 | 3 |
tests/conftest.py | podaac/concise | 1 | 40142 | <reponame>podaac/concise
import pytest
def pytest_addoption(parser):
parser.addoption(
'--keep-tmp',
action='store_true',
help='Keep temporary directory after testing. Useful for debugging.')
@pytest.fixture(scope='class')
def pass_options(request):
request.cls.KEEP_TMP = request.con... | 1.773438 | 2 |
courses/MITx 6.00.1x/lec9/coordinate.py | NomikOS/learning | 0 | 40143 | <reponame>NomikOS/learning<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue May 10 08:18:02 2016
@author: WELG
"""
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, other):
x_diff_sq = (self.x-other.x)**2
y_diff_sq = (self.y-oth... | 3.9375 | 4 |
resync/test/test_client.py | isabella232/resync | 1 | 40144 | <reponame>isabella232/resync
import unittest
import re
import os
import logging
import sys
import io
import contextlib
from resync.client import Client, ClientFatalError
# From
# http://stackoverflow.com/questions/2654834/capturing-stdout-within-the-same-process-in-python
class Data(object):
pass
@contextlib.... | 2.125 | 2 |
bookmark/serializers.py | UNIZAR-30226-2021-05/Lector--Backend | 0 | 40145 | <filename>bookmark/serializers.py<gh_stars>0
from rest_framework import serializers
from .models import Bookmark, Usuario
class BookmarkSerializer(serializers.ModelSerializer):
"""
API endpoint
"""
class Meta:
model = Bookmark
fields = [
"esAnotacion",
"cuerpo... | 2.25 | 2 |
src/myResume.py | charlielin99/Jobalytics | 13 | 40146 | import indicoio, os, json
indicoio.config.api_key = '27df1eee04c5b65fb3113e9458d1d701'
fileDir = os.path.dirname(os.path.realpath('__file__'))
fileResumeTxt = open(os.path.join(fileDir, "data/resume.txt"), 'w')
resume = "data/resumePDF.pdf"
print(json.dumps(indicoio.pdf_extraction(resume))) | 2.203125 | 2 |
tracpro/polls/tasks.py | rapidpro/tracpro | 5 | 40147 | <reponame>rapidpro/tracpro<filename>tracpro/polls/tasks.py
from __future__ import absolute_import, unicode_literals
from django.apps import apps
from django.utils import timezone
from celery.utils.log import get_task_logger
from djcelery_transactions import task
from django_redis import get_redis_connection
from tem... | 1.953125 | 2 |
instance/config.py | tw8130/News-Article | 0 | 40148 | NEWS_API_KEY ='82c66d6d002e4468a5b3199925f4e5de'
SECRET_KEY='Flashpill' | 1.070313 | 1 |
api/serializers.py | swarup-kharul/Flo-In | 2 | 40149 | <filename>api/serializers.py
from django.forms.fields import ImageField
from rest_framework import serializers
from django.contrib.auth import get_user_model
from djoser.serializers import UserCreateSerializer
from accounts.models import UserData
User = get_user_model()
class UserCreateSerializer(UserCreate... | 2.375 | 2 |
tests/test_utils.py | gyermolenko/pytest-benchmark | 0 | 40150 | <filename>tests/test_utils.py
import argparse
import distutils.spawn
import os
import subprocess
import pytest
from pytest import mark
from pytest_benchmark.utils import clonefunc
from pytest_benchmark.utils import get_commit_info
from pytest_benchmark.utils import get_project_name
from pytest_benchmark.utils import ... | 2.09375 | 2 |
kolibri/core/content/zip_wsgi.py | MBKayro/kolibri | 545 | 40151 | <filename>kolibri/core/content/zip_wsgi.py
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import mimetypes
import os
import re
import time
import zipfile
import html5lib
from cheroot import wsgi
from django.core.cache import cache
fr... | 1.921875 | 2 |
test/unit/parser/test_parser_helper.py | buddly27/champollion | 3 | 40152 | # :coding: utf-8
import pytest
import os
import champollion.parser.helper
@pytest.mark.parametrize(
("content_lines", "line_number", "expected"),
[
(
[
"/**",
" * An function example.",
" *",
" * Detailed description.",
... | 2.53125 | 3 |
MyHDLSim/Manager.py | mattsnowboard/msu-myhdlsim | 1 | 40153 | <gh_stars>1-10
import wx
import wx.lib.ogl as ogl
from myhdl import Signal, Simulation, delay, instance, StopSimulation, now
from MyHDLSim.Wrappers.SignalWrapper import SignalWrapper
from MyHDLSim.Module import Module
from MyHDLSim.wxApplication import MainWindow, ThreadTimer, EVT_THREAD_TIMER
class Manager:
""" T... | 2.421875 | 2 |
tbs/helper/checks.py | ODEX-TOS/tos-build-system | 1 | 40154 | import os
import tbs.logger.log as logger
import tbs.helper.filedescriptor as fd
def checkRoot(message):
"""
Check if the user is root otherwise error out
"""
if os.geteuid() != 0:
logger.log(message, logger.LOG_ERROR)
raise Exception("You need root privileges to do this operation.")
de... | 2.453125 | 2 |
examples/xusb.py | DCC-Lab/libusb | 0 | 40155 | # Copyright (c) 2016-2020 <NAME>
# Licensed under the zlib/libpng License
# https://opensource.org/licenses/Zlib
# xusb: Generic USB test program
# Copyright © 2009-2012 <NAME> <<EMAIL>>
# Contributions to Mass Storage by <NAME>.
#
# This library is free software; you can redistribute it and/or
# modify it under the t... | 1.773438 | 2 |
tasks/filesystem.py | kuwv/spades | 0 | 40156 | # -*- coding: utf-8 -*-
# type: ignore
# copyright: (c) 2020 by <NAME>.
# license: Apache 2.0, see LICENSE for more details.
'''Validation Task-Runner.'''
import os
import shutil
from invoke import task
@task
def mkdir(ctx, path):
'''Make directory path.'''
try:
os.makedirs(path, exist_ok=True)
... | 2.046875 | 2 |
tefingerprint/util/__init__.py | timothymillar/TEFingerprint | 0 | 40157 | from . import numpy
| 0.984375 | 1 |
time_machine/analyze_data.py | ZviBaratz/time_machine | 0 | 40158 | <reponame>ZviBaratz/time_machine
def analyze(data):
return
| 1.007813 | 1 |
tests/src/dirac_notation/test_bra.py | KaroliShp/Quantumformatics | 2 | 40159 | <reponame>KaroliShp/Quantumformatics
import pytest
from pytest_mock import mocker
from hamcrest import *
import numpy as np
from src.dirac_notation.ket import Ket
from src.dirac_notation.bra import Bra
from src.dirac_notation.matrix import Matrix
@pytest.mark.parametrize('input_1,input_2,expected_output_1,expected_o... | 2.453125 | 2 |
PySeismoSoil/helper_hh_calibration.py | mgrubisic/PySeismoSoil | 1 | 40160 | # Author: <NAME>
'''
Hierarchy of subroutines::
hh_param_from_profile
|--- _calc_rho()
|--- helper_site_response.thk2dep()
|--- _calc_Gmax()
|--- _calc_vertical_stress()
|--- _calc_OCR()
|--- _calc_K0()
|--- _calc_PI()
|--- _calc_shear_strength()
|--- _calc_K0()
|--- pro... | 1.890625 | 2 |
AccGenBot/plugins/gen.py | AL-Noman21/AccGenBot | 0 | 40161 | <reponame>AL-Noman21/AccGenBot
from AccGenBot import AccGen
from AccGenBot.verify import verify
from telethon import events, Button
from Configs import Config
@AccGen.on(events.callbackquery.CallbackQuery(data="gen"))
async def gen(gen):
TEXT = """
**Heya {}**
Choose the account you wanna generate.
""".format(ge... | 2.53125 | 3 |
_estudoPython_solid/scriptTeste-03.py | carlos-freitas-gitHub/Python_Analise_De_Dados | 0 | 40162 | <filename>_estudoPython_solid/scriptTeste-03.py
numero = 42
chute = input('Digite um número: \n')
converte = int(chute)
if numero == converte:
print('Voçê acertou!')
else:
print('Voçê errou!') | 3.734375 | 4 |
evaluation_hpatch/models/MTLDesc.py | vignywang/MTLDesc | 9 | 40163 | #
# Created on 2020/2/25
#
import os
import sys
sys.path.append("..")
import cv2 as cv
from nets import get_model
from nets.network import *
class Mtldesc(object):
def __init__(self, **config):
self.name = 'MTLDesc'
self.config = {
"detection_threshold": 0.9,
"nms_dist": ... | 2.375 | 2 |
p125e/valid_palindrome.py | l33tdaima/l33tdaima | 1 | 40164 | class Solution:
def isPalindrome(self, s: str) -> bool:
lo, hi = 0, len(s) - 1
while lo < hi:
if not s[lo].isalnum():
lo += 1
elif not s[hi].isalnum():
hi -= 1
else:
if s[lo].lower() != s[hi].lower():
... | 3.671875 | 4 |
Solution_1.py | R3DDY97/Solutions-Pychallenge | 0 | 40165 | <gh_stars>0
#!/usr/bin/env python3
import webbrowser
def soln1():
url1 = "http://www.pythonchallenge.com/pc/def/0.html"
url2 = url1.replace("0",str(2**38))
webbrowser.open(url2)
if __name__ == "__main__":
soln1()
| 2.625 | 3 |
models/objects.py | YTXIRE/able_crm_concrete_accounting_python_tests | 1 | 40166 | from peewee import CharField, IntegerField
from core.db.db import BaseModel
class Objects(BaseModel):
name = CharField(unique=True)
is_archive = IntegerField()
class Meta:
table_name = 'objects'
| 2.28125 | 2 |
thenewboston_node/business_logic/tests/test_blockchain_base/test_get_root_account_file.py | MLonTNB/thenewboston-node | 0 | 40167 | <reponame>MLonTNB/thenewboston-node<filename>thenewboston_node/business_logic/tests/test_blockchain_base/test_get_root_account_file.py
import pytest
from thenewboston_node.business_logic.tests.mocks.utils import patch_blockchain_states
def test_can_get_account_root_file_count(blockchain_base, blockchain_state_10, bl... | 2.125 | 2 |
bmi.py | manmik2323/lifeisawesome.online | 0 | 40168 | <filename>bmi.py
import cgitb
cgitb.enable()
print("This is a simple BMI convertor")
weight = float(input("Enter weight in pounds: "))
height = float(input("Enter height in inches: "))
weight_kg = weight / 2.205 # pounds to kg
height_m = height / 39.37
BMI = weight_kg / (height_m ** 2)
print(f'BMI is {BMI:.2f}')
| 3.875 | 4 |
src/ykfan_utils/time/time_utils.py | fanyongkang87/ykfan_utils | 1 | 40169 | import time
import functools
import numpy as np
def time_compute(fun):
@functools.wraps(fun)
def wrapper(*args, **kwargs):
start_time = time.time()
tmp = fun(*args, **kwargs)
end_time = time.time()
print('{} cost {} s.'.format(fun.__name__, end_time-start_time))
return ... | 3.296875 | 3 |
qlever/settings_secret_template.py | ad-freiburg/qleverUI | 4 | 40170 | # Change these values and rename this file to "settings_secret.py"
# SECURITY WARNING: If you are using this in production, do NOT use the default SECRET KEY!
# See: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY
SECRET_KEY = '!!super_secret!!'
# https://docs.djangoproject.com/en/3.0/ref/se... | 1.117188 | 1 |
grr/server/grr_response_server/blob_stores/dual_blob_store.py | Codehardt/grr | 0 | 40171 | #!/usr/bin/env python
"""A BlobStore proxy that writes to two BlobStores."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
import time
from future.moves import queue
from typing import Dict, Iterable, Optional, Text
fro... | 2.234375 | 2 |
Chapter 15/ch15_20.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | 0 | 40172 | import numpy as np
arr1 = np.ones (2, dtype=float)
print("1D Array with ones ")
print(arr1)
#[1. 1.] | 2.96875 | 3 |
Python/questions/ConsecutiveCharacters/consecutive-characters.py | udcymen/leetcode | 0 | 40173 | <reponame>udcymen/leetcode
def maxPower(s: str) -> int:
if not s or len(s) == 0:
return 0
result = 1
temp_result = 1
curr = s[0]
for c in s[1:]:
if c == curr:
temp_result += 1
else:
result = max(result, temp_result)
temp_result = ... | 3.734375 | 4 |
python_retweet/__main__.py | av1m/python-retweet | 6 | 40174 | <filename>python_retweet/__main__.py<gh_stars>1-10
# coding: utf-8
from random import randint
from time import sleep
import tweepy
from .configuration.logger import Logger
try:
from .configuration.credentials_test import Configuration # for testing
except ImportError:
from .configuration.credentials import ... | 2.96875 | 3 |
python/problem4.py | kirinthos/AdventOfCode2018 | 0 | 40175 | <reponame>kirinthos/AdventOfCode2018
#!/usr/bin/python
import itertools, re, sys
from lib import readProblem, take, rowprint, partitionP, flatMap, flatten, group, writeFile, rowstr, groupP, partition
lines = readProblem('../adventofcode/problems/problem4.input')
extractorPattern = re.compile(r'\[....-(..)-(..) (..)... | 2.828125 | 3 |
mamonsu/tools/report/format.py | sgrinko/mamonsu | 188 | 40176 | <filename>mamonsu/tools/report/format.py
# -*- coding: utf-8 -*-
import re
import sys
import mamonsu.lib.platform as platform
class color(object):
mapping = {
'BOLD': '\033[0;0m\033[1;1m',
'RED': '\033[1;31m',
'GRAY': '\033[1;30m',
'PURPLE': '\033[1;35m',
'BLUE': '\033[1;... | 2.546875 | 3 |
BI-IOS/semester-project/webapp/beecon/campaigns/libs/cinemas/mvMovieSchedules.py | josefdolezal/fit-cvut | 20 | 40177 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from DataSource import CinemaCity
from bs4 import BeautifulSoup
from datetime import datetime
import re
class MovieSchedule:
def __init__( self, url, date ):
self.url = url
self._load_schedule()
def closest_movies( self ):
print( self.movies )
def _load_sch... | 2.796875 | 3 |
polybar-scripts/system-cpu-percentage-runcat/system-cpu-runcat.py | KaboomPhysicist/polybar-scripts | 0 | 40178 | #!/usr/bin/python3
import json
import os
import subprocess
# Icons for the animation
sleep = ""
icons_base = ["","","","",""]
# Path to the script
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
# Run the script for getting the CPU usage
subprocess.Popen([os.path.join... | 3.078125 | 3 |
models/networks_sketch_rec.py | brian220/Sketch2PointCloud | 3 | 40179 | <filename>models/networks_sketch_rec.py
# -*- coding: utf-8 -*-
#
# Developed by <NAME> <<EMAIL>>
#
# References:
# - https://github.com/hzxie/Pix2Vox/blob/master/models/encoder.py
# - https://github.com/shawnxu1318/MVCNN-Multi-View-Convolutional-Neural-Networks/blob/master/mvcnn.py
from collections import OrderedDict... | 1.804688 | 2 |
emailsender.py | dirghagarwal/python | 1 | 40180 | <filename>emailsender.py
import smtplib
to = input('enter the recipients email id:\n')
content = input('enter the content:')
def sendemail(to, content):
servr = smtplib.SMTP('smtp.gmail.com', 587)
servr.ehlo()
servr.starttls()
servr.login('<EMAIL>', '1234')
servr.sendmail('<EMAIL>', to,con... | 2.953125 | 3 |
django_fileuploadvalidation/modules/validation/validator.py | IV1T3/django-middleware-fileuploadvalidation | 0 | 40181 | <gh_stars>0
import clamd
import logging
from io import BytesIO
from . import basic, image, quicksand
def get_clamAV_results(file_object):
# Connects to UNIX socket on /var/run/clamav/clamd.ctl
clam_daemon = clamd.ClamdUnixSocket()
clamd_res = clam_daemon.instream(BytesIO(file_object.content))
retu... | 2.46875 | 2 |
contrib/report_builders/__init__.py | berndonline/flan | 3,711 | 40182 | <gh_stars>1000+
from .report_builder import ReportBuilder
from .latex_report_builder import LatexReportBuilder
from .markdown_report_builder import MarkdownReportBuilder
from .json_report_builder import JsonReportBuilder
from .html_report_builder import JinjaHtmlReportBuilder
| 1.078125 | 1 |
pajbot/web/routes/playsound.py | leecopland/bullbot | 1 | 40183 | <gh_stars>1-10
from flask import render_template
def init(app):
@app.route('/playsound')
def playsound():
return render_template('playsoundlist.html')
| 1.96875 | 2 |
archive_cli.py | mitre-attack/attack-archives | 6 | 40184 | <reponame>mitre-attack/attack-archives<gh_stars>1-10
import argparse
import shutil
import stat
import os
import tqdm
import re
import git
import json
# STATIC PROPERTIES
# the route for previous versions to be saved under.
previous_route = "previous"
# I'm doing spaces here for readability with symbol characters.
# Th... | 2.71875 | 3 |
UNet/Visualize.py | glisses/segmentation-and-uncertainty-estimation-on-CityScapes | 1 | 40185 | import matplotlib.pyplot as plt
import numpy as np
import operator
import os
import sys
import tensorflow as tf
# 256*256 映射到 0~1 区间
def Transform(input):
if not (operator.eq(input.shape, (256, 256))):
print("not matched")
sys.exit(1)
max = np.max(input)
min = np.min(input)
for i in r... | 2.671875 | 3 |
001146StepikPyBegin/Stepik001146PyBeginсh11p06st07TASK03_20210311_lists_methods.py | SafonovMikhail/python_000577 | 0 | 40186 | import string
def onlyletters(s):
s1 = []
for i in s:
if i not in string.punctuation: # проверяем посимвольно, есть ли в списке пунктуационных знаков
s1.append(i)
s2 = ''.join(s1) # соединяем массив символов в слово
return s2
words = (input().lower()).split() # преобразуем сло... | 3.890625 | 4 |
cgi-bin/remove.py | sam-glendenning/dynafed-oidc-plugin | 0 | 40187 | <gh_stars>0
#!/usr/bin/python3.6
"""
Receives information via POST from IRIS DynaFed web UI for removing a bucket
Sends it off to manage_config.py
"""
# Import modules for CGI handling
import cgi
import argparse
import sys
CONFIG_PATH = "/etc/ugr/conf.d/"
sys.path.append(CONFIG_PATH)
from manage_config import rem... | 2.4375 | 2 |
libs/data.py | masloff-open-projects/OpenCV-Webcam-Recorder-and-Streamer | 7 | 40188 | <reponame>masloff-open-projects/OpenCV-Webcam-Recorder-and-Streamer
class data:
def __init__(self):
self._ = {}
def set(self, key, data_):
self._[key] = data_
return data_
def get(self, key):
if key in self._:
return self._[key]
else:
return... | 2.78125 | 3 |
setup.py | schyczewski/electrum-sum-server | 0 | 40189 | <reponame>schyczewski/electrum-sum-server
from setuptools import setup
setup(
name="electrum-sum-server",
version="1.0",
scripts=['run_electrum_sum_server.py','electrum-sum-server'],
install_requires=['plyvel','jsonrpclib', 'irc >= 11, <=14.0'],
package_dir={
'electrumsumserver':'src'
... | 1.257813 | 1 |
hyperion/torch/narchs/resnet.py | hyperion-ml/hyperion | 14 | 40190 | <reponame>hyperion-ml/hyperion
"""
Copyright 2019 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import logging
import numpy as np
import torch
import torch.nn as nn
from torch.nn import Conv1d, Linear, BatchNorm1d
from ..layers import ActivationFactory as A... | 2.5625 | 3 |
dimsim/tests/test_dimsim.py | NTHU-NLPLAB/DimSim | 0 | 40191 | <gh_stars>0
# -*- coding: utf-8 -*-
# Dependencies
import pytest
# The module to test
from dimsim.core.model import get_distance, get_candidates
def test_distance_near():
dist = get_distance(u'大侠', u'大虾')
assert dist == 0.0002380952380952381
def test_distance_far():
dist = get_distance(u'大侠', u'大人')
... | 2.40625 | 2 |
patient/image_block.py | 11pawan11/ehealth | 0 | 40192 | import tensorflow as tf
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
from keras.preprocessing import image
import zipfile
import os
import pickle
from keras.models import model_from_json
from django.conf import settings
from django.conf import settings
def training():
zip_ref = zipf... | 2.75 | 3 |
src/hamcrest/library/number/__init__.py | rbalint/PyHamcrest | 6 | 40193 | """Matchers that perform numeric comparisons."""
from .iscloseto import close_to
from .ordering_comparison import (
greater_than,
greater_than_or_equal_to,
less_than,
less_than_or_equal_to,
)
__author__ = "<NAME>"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
| 1.617188 | 2 |
run_measure_seeing.py | marissakotze/timDIMM | 1 | 40194 | <filename>run_measure_seeing.py
#!/usr/bin/env python
import os, shutil
import datetime
import ox_wagon
import pick_star
from find_boxes import find_boxes
from guide_gto900 import guide_gto900
from pygto900 import GTO900, status
from spiral_search_gto900 import spiralsearch
import time
import sys
old_star = None
re... | 2.53125 | 3 |
plugins/levelops-gcloud.py | levelops-tools-admin/levelops-plugins | 0 | 40195 | <filename>plugins/levelops-gcloud.py
#!/usr/bin/env python
##################################################################
# Copyright (C) 2019-2020 LevelOps Inc <<EMAIL>>
#
# This file is part of the LevelOps Inc Tools.
#
# This tool is licensed under Apache License, Version 2.0
############################... | 1.71875 | 2 |
pyHalo/Rendering/two_halo.py | DarthLazar/pyHalo | 7 | 40196 | from pyHalo.Rendering.SpatialDistributions.uniform import LensConeUniform
import numpy as np
from copy import deepcopy
from pyHalo.Rendering.MassFunctions.power_law import GeneralPowerLaw
from pyHalo.Rendering.rendering_class_base import RenderingClassBase
class TwoHaloContribution(RenderingClassBase):
"""
Th... | 2.484375 | 2 |
utils.py | konichar/footprint-api | 1 | 40197 | from decouple import config
import heroku3
import uuid
HEROKU_API_KEY = config("HEROKU_API_KEY")
heroku_conn = heroku3.from_key(HEROKU_API_KEY)
def footprint_walt():
appy = heroku_conn.create_app(name=f"footprint-{uuid.uuid4().hex[:8]}")
appy.create_build(f'{config("GIT_URL")}/tarball/master')
appy.conf... | 2.078125 | 2 |
app/views/index.py | Depado/LostInNetworkWeb | 1 | 40198 | <filename>app/views/index.py
# -*- coding: utf-8 -*-
from flask import render_template
from app import app
@app.route('/', methods=['GET'])
def index():
return render_template("index.html")
| 2.125 | 2 |
src/eduid_userdb/tests/test_profile.py | SUNET/eduid-userdb | 0 | 40199 | # -*- coding: utf-8 -*-
from unittest import TestCase
from eduid_userdb.element import DuplicateElementViolation
from eduid_userdb.profile import Profile, ProfileList
__author__ = 'lundberg'
OPAQUE_DATA = {'a_string': 'I am a string', 'an_int': 3, 'a_list': ['eins', 2, 'drei'], 'a_map': {'some': 'data'}}
class P... | 2.65625 | 3 |