blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c1d315d049092f1ad21022489a8b852276b2c63c | Python | patpat321/Leetcode | /Two Pointers/42.py | UTF-8 | 1,430 | 3.859375 | 4 | [
"MIT"
] | permissive | """
Given n non-negative integers representing an elevation map where the width of each bar is 1,
compute how much water it is able to trap after raining.
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for ... | true |
481bd5f9bf98fa39fb48057bbfa4ab5ffb336cbe | Python | minse317/MSTI | /product_floral.py | UTF-8 | 4,289 | 2.546875 | 3 | [] | no_license | # floral type 향수 제품 설명화면
import sys
import main
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from moreResult import moreResultWindow
class ContentsWindow(QWidget):
def __init__(self):
super().__init__()
self.setStyleSheet('background-color: #ffffff')
... | true |
989d02e07ac1053a71747090dc9c2a7bc6bd7d40 | Python | cmg7111/Algorithm | /2667.py | UTF-8 | 1,329 | 2.84375 | 3 | [] | no_license | N=int(input())
map_lst=[]
dx=[0,-1,0,1]
dy=[-1,0,1,0]
def bfs():
visited=[[0]*N for loop in range(N)]
comp=1
for cur_x in range(N):
for cur_y in range(N):
flag=False
cnt = 1
queue=[[cur_x,cur_y]]
if visited[cur_x][cur_y]==0:
while qu... | true |
3b61d052b4734503e7fccfaf32bea1536929eaef | Python | hgotur/qbStudyTools | /flashcards.py | UTF-8 | 948 | 3.078125 | 3 | [] | no_license | import csv
import argparse
import random
parser = argparse.ArgumentParser()
parser.add_argument('--file')
parser.add_argument('--start', type=int)
parser.add_argument('--end', type=int)
parser.add_argument('--subject')
args = parser.parse_args()
clues = []
with open(args.file) as csvfile:
reader = csv.DictReader(... | true |
1ab081130022f8dc6e8628618897bdb65d31d97e | Python | kingsdigitallab/mmee-django | /photos/templatetags/mmee_wagtail_tags.py | UTF-8 | 1,976 | 2.515625 | 3 | [
"MIT"
] | permissive | import json as pjson
from django import template
from wagtail.core.models import Site
from django.utils.safestring import mark_safe
from django.template import loader
register = template.Library()
@register.simple_tag(takes_context=True)
def get_site_root(context):
# NB this returns a core.Page, not the implemen... | true |
45dd0ff1c171009a2cf86a8d6ab2ade17cd7d688 | Python | komm5233/age | /age.py | UTF-8 | 349 | 3.984375 | 4 | [] | no_license | driving = input('請問有沒有開過車?')
age = input('請問你的年齡?')
age = int(age)
if driving == '有':
if age >= 18:
print('通過')
else:
print('你沒駕照阿')
elif driving == '沒有':
if age < 18:
print('很好,過幾年就可以考了')
else:
print('你他媽能去考了')
else:
print('請輸入有或沒有')
| true |
631a6a5e069a5c0e4bc61255d3a2723135fc23ac | Python | yan7109/head-fi | /RunSqlite.py | UTF-8 | 846 | 2.71875 | 3 | [] | no_license | # Create the database for headphones
import sqlite3
import string
from InitDatabase import *
from RssParser import *
from HTMLWriter import *
from CleanUpEntries import *
import time
import os.path
database_name = 'headphones.db'
init = True
# Database already created
if os.path.isfile(database_name):
init = Fal... | true |
fcbc6c8e283663dfbd499ddadac7d0e8f22b365a | Python | SamG97/AdventOfCode2019 | /code/day10.py | UTF-8 | 2,102 | 3.296875 | 3 | [] | no_license | import math
from collections import defaultdict
def count_observable(grid, station):
station_x, station_y = station
angles = set()
for y in range(len(grid)):
for x in range(len(grid[0])):
if (x, y) == station or grid[y][x] == ".":
continue
diff_x = x - stati... | true |
3e23e3c09ece916033db79ca2c4549c00e39f0c0 | Python | yzl232/code_training | /mianJing111111/Google/In an unsorted array of numbers that occurs an odd number of times except one that occurs an even number of times, find the number that occurs an even number of times.py | UTF-8 | 729 | 3.78125 | 4 | [] | no_license | # encoding=utf-8
'''
In an unsorted array of numbers that occurs an odd number of times except one that occurs an even number of times, find the number that occurs an even number of times
'''
#做法1. 用hashmap统计了。 最后找出唯一一个frequency为偶数次
# hashmap最好
#做法2. set记录unique的数目。 xor一遍后, 剩下的是所有奇数的xor。 再xor所有的unique的key
... | true |
5b8513094d45e45d899e59f7fca02c6ea1595704 | Python | hikari-wl1225/Python_learn | /network-security/Secure_comm.py | UTF-8 | 4,782 | 2.609375 | 3 | [] | no_license | #/usr/bin/python2
#coding=utf-8
from Crypto import Random
from Crypto.Hash import SHA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs
from Crypto.Signature import PKCS1_v1_5 as Signature_pkcs
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES, DES
from RC4_prototype import rc4
import base64, hashlib
c... | true |
ae664330e171125ddf758a20d34c0a6a9d6e6a23 | Python | MrLIVB/BMSTU_CG_CP | /src/drawer.py | UTF-8 | 725 | 3.140625 | 3 | [
"MIT"
] | permissive | from PyQt5.QtGui import QImage, QPainter, QColor
from PyQt5.QtCore import Qt
class BaseDrawer(object):
def drawLine(self, x1: float, y1: float, x2: float, y2: float, color):
pass
def drawPoint(self, x: float, y: float, color):
pass
def clear(self):
pass
class QDrawer(BaseDrawer):... | true |
04ae22cefe13466f0a8583e7171f85ddd07f8a6e | Python | sudhakama/sudharshan | /dulicate.py | UTF-8 | 182 | 3.625 | 4 | [] | no_license | # creating a list using a dictionary
test_list = [1, 3, 5, 6, 3, 5, 6, 1]
#creating empty dictionary
res = {}
for i in test_list:
res[i]=res.get(i,0)+1
print(res)
| true |
73b919aa24b48bd69ac6c5fbc5e487b0b4ec110c | Python | zeroby0/iiitb.sem8.RTOS | /project/server.py | UTF-8 | 2,365 | 2.609375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | from flask import Flask
from flask import request
from flask import jsonify
from flask import render_template
import socket
import time
current_milli_time = lambda: int(round(time.time() * 1000))
class Path:
db = './databases/db.sqlite3'
class Config:
path = Path
config = Config
backend = Backend()
app = Flask... | true |
7c67911949bf11e165b1dc809015d6fee81de46e | Python | bbeckom/PythonBasics | /Database/dbupdate.py | UTF-8 | 672 | 3.484375 | 3 | [] | no_license | import sqlite3
db_filename = "Database.db"
db = sqlite3.connect(db_filename)
cursor = db.cursor()
# user can input their own data
nameinput = input("Input Name\n"
":")
# SQL query is run directly against query. Used % formatting to get variable into string
cursor.execute("INSERT INTO NAME_table (NA... | true |
99c67728023f33daca98e2d649421ccce061461c | Python | SGrafik/hyperskill-nlp-WebScraper | /stage5/scraper.py | UTF-8 | 3,069 | 3.078125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import string
import os
def get_website(target):
return requests.get(target, headers={'Accept-Language': 'en-US,en;q=0.5'})
def get_article_link(article_link, article_type):
site = get_website(article_link)
articles_link = []
if site.status_code != 200:... | true |
331bc2682dc2abfb4f4cd3312be7a00357bf1593 | Python | HarshadChovatiya/PrepareWell | /writing_skill.py | UTF-8 | 1,908 | 3.03125 | 3 | [] | no_license | import generate_text_paragraph
import difflib
import csv
from colorama import Fore
import time
import pyperclip
def test_writing_skill():
list_of_text = generate_text_paragraph.generate_text()
original_text = ""
print()
for line in list_of_text:
print(line)
original_text += line
... | true |
3b409533a8fcf88fbff1979068d6bcbfe3a3348c | Python | ethanolx/Hangman-py | /lib/dictionary_organised.py | UTF-8 | 8,960 | 2.828125 | 3 | [] | no_license | # finish library for 4 to 8 letter words
# for dictionary (temporary usage only)
def string_wrapper(string, step):
wrapped_string = ""
num_of_sections = len(string) / step
i = 0
while i < num_of_sections:
j = 0
wrapped_string += '"'
while j < step:
wrapp... | true |
223e25b8573d77c5eabc483300de11b18f0a36d4 | Python | haro-nl/pgo_hotspots_WEnR | /prepare_data/create_250m_mesh.py | UTF-8 | 2,305 | 2.9375 | 3 | [] | no_license | # script to create 250 m mesh polygon shapefile based on top-left coordinates
# Hans Roelofsen, WEnR, 20/03/1019
import os
import numpy as np
import geopandas as gp
import rasterio as rio
from shapely import geometry
import pandas as pd
from utils import pgo
def create_250m_hok(xy):
# return X,Y coordinates of 1... | true |
74fb79c751c0d36f47f960235f8e19616bc0dfc8 | Python | wojtekminda/Python3_Trainings | /SMG_classwork/02_function_input.py | UTF-8 | 124 | 3.75 | 4 | [] | no_license | print("Jak masz na imie?")
name = input()
surname = input("Jak masz na nazwisko? \n")
print("Czesc", name, surname + "!")
| true |
5b738ed64c7cfdedf60f237d5c370f7ee843ac8a | Python | snhwang/p1_navigation_SNH | /dqn_agent.py | UTF-8 | 16,136 | 2.75 | 3 | [] | no_license | import bisect
from collections import namedtuple, deque
import numpy as np
import random
import torch
import torch.nn.functional as F
import torch.optim as optim
#from model import QNetwork
from model import QNetNorm, QNetDueling, QNetDueling2, QNetNormDueling
BUFFER_SIZE = int(1e6) # replay buffer size
BATCH_SIZE =... | true |
420f247344487362b1ad5bd5777147f7c0a21d94 | Python | michaeljoseph/textlines | /textlines/__init__.py | UTF-8 | 1,681 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | """
Sparklines for text. text_lines counts your words, paragraphs, pages
and emits a short summary.
This text doesn't need to be here, but I'm trying to write a new paragraph.
"""
__author__ = 'Michael Joseph'
__email__ = 'michaeljoseph@gmail.com'
__url__ = 'https://github.com/michaeljoseph/textlines'
__version__ = '0... | true |
2ab9d3dbbc4e33e17f871475f777d50687850f95 | Python | chengscott/thegame-agent | /2018/HunTer.py | UTF-8 | 5,702 | 2.671875 | 3 | [] | no_license | from thegame import HeadlessClient, Ability, Polygon, Bullet, Hero
from thegame.gui import GuiClient
import random
import math
from functools import cmp_to_key
class Client(HeadlessClient):
def init(self):
self.name = 'HunTer' # 設定名稱
self.clk = 1
self.should_run = 0
self.atkID = i... | true |
30849ae84f67d11d05bf2e3c676d8586a7d582cd | Python | SkotBotCambo/wisdm_model_personalization | /wisdm_parallel_lib.py | UTF-8 | 1,983 | 2.828125 | 3 | [] | no_license | import sys
import pandas as pd
import time
temporary_dataframes_locations = "/home/sac086/wisdm_model_personalization/datasets/WISDM_v2/temporary_user_dataframes/"
def assign_segments_by_user(user_id, user_df, windowSize=10):
td = pd.Timedelta(str(windowSize) + ' seconds')
segment_col = pd.Series(index=user_df.inde... | true |
d12a292c904b9cf3e8c75fad06b496e1d946c603 | Python | enigmatic-cipher/basic_practice_program | /Q85) WAPto check whether a file path is a file or a directory.py | UTF-8 | 165 | 3.03125 | 3 | [] | no_license | import os
path = "Note.py"
if os.path.isdir(path):
print("It is a directory")
elif os.path.isfile(path):
print("It is file")
else:
print("Unknown file")
| true |
bbea05706b2f7ceb3641145814d4cd1861e34167 | Python | athalheim/TRS-80-MC-10 | /vbToC10.py | UTF-8 | 10,301 | 3.046875 | 3 | [] | no_license | # TRS-80 MC-10 Micro Color Computer
# This code is part of the process to convert a .vb file to .wav 'cassette' file for the MC-10
# Step 1: C10Builder.py: Convert .vb code to .C10 format
# Step 2: C10ToWav.py: Convert .C10 code to .WAV format
# This file covers step 1
# Albert M Thalheim
# January 2021... | true |
5458ba95588f5ddcf50e1e5c55d420b4cb8b24c9 | Python | Campbell-D/PiTemps | /gpio_python_code/7_temperature2.py | UTF-8 | 1,292 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
import glob, os
from time import sleep
from datetime import datetime
import RPi.GPIO as GPIO # import our GPIO library
GPIO.setmode(GPIO.BCM) # set the board numbering system to BCM
GPIO.setup(17,GPIO.OUT) # LED
GPIO.setup(22,GPIO.OUT) # Buzzer
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_UP) # But... | true |
9ce759f3f1ac3cd1272aeacbeac9c0ebd2715142 | Python | rkechols/Advent2020 | /day01/expense_report.py | UTF-8 | 1,160 | 3.46875 | 3 | [] | no_license | from constants import UTF_8
INPUT_FILE_NAME = "expense_report.txt"
TARGET = 2020
def two_numbers():
print("TWO NUMBERS:")
all_numbers = list()
with open(INPUT_FILE_NAME, "r", encoding=UTF_8) as in_file:
for line in in_file:
number_str = line.strip()
number = int(number_str)
for previous_number in all_... | true |
75968f3719fcfe1b2804972049fa177a3efc138f | Python | vaxav/Spaceships_game | /objects/laser.py | UTF-8 | 627 | 3.265625 | 3 | [] | no_license | import pygame
def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.y - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) is not None
class Laser:
def __init__(self, x, y, img):
self.x = x
self.y = y
self.img = img
self.mask = pygame.mask.... | true |
af532745721f06e2d40a22c6b92d2baa5c0a9891 | Python | JoSunJoo/CCTV- | /run_server.py | UTF-8 | 3,275 | 2.59375 | 3 | [] | no_license | from flask import Flask, request, render_template, redirect, url_for
import pymysql
app = Flask(__name__)
# CCTV 페이지 렌더링
@app.route('/cctv')
def cctv():
return render_template('cctv.html')
# traffic 처리 get/post로 접근가능
@app.route('/scheduler')
def scheduler():
# 요청이 get이면
if request.method ==... | true |
d35c57ec18d80ab87b7ecddfa4ad9ea531457a1d | Python | Tanya11/Practica2s12017_201443726 | /pila.py | UTF-8 | 4,226 | 3.09375 | 3 | [] | no_license | import subprocess
class pila:
def __init__(self):
self.cabeza = None
self.auxiliar = None
def insertar(self, numero):
self.auxiliar = nodopila(numero)
if(self.cabeza == None):
print ("esta vacia")
self.cabeza = self.auxiliar # setcabeza(auxiliar)
else:
self.auxiliar.siguiente = self.cabeza
sel... | true |
5da19e805c56f92d032e9b54c0a655802ae6d934 | Python | sowmya-sana/A-Compiler-based-Approach-for-Natural-Language-to-Code-Conversion | /codecompleter1/GeneralSyntaxes/char.py | UTF-8 | 6,208 | 2.828125 | 3 | [] | no_license | tokens = (
'CHAR', 'SIGNEDCHAR', 'UNSIGNEDCHAR', 'VAR', 'EQUALS', 'NUMBER', 'CHARACTER'
)
# Tokens
# t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*'
def t_NUMBER(t):
r'\d'
return t
def t_CHAR(t):
r'declare\sa(n)?\schar|create\sa(n)?\schar|char'
return t
def t_SIGNEDCHAR(t):
r'decl... | true |
b19da6ede898698671d857379fe7568aeb0a336c | Python | simonsandell/advent-of-code-2019 | /15/1.py | UTF-8 | 3,394 | 3.15625 | 3 | [] | no_license | import asyncio
import Tiles
import Intcode
import random
class Repairdroid:
def __init__(self, program):
self.x = 0
self.y = 0
self.surface = Tiles.Hallway()
self.output = []
self.Computer = Intcode.Intcode()
self.Computer.memory = program
self.Computer.incre... | true |
9f202cc7fb9c7b926f26cacdcbe69129b4a02ad2 | Python | huum4n/webstruct | /webstruct/features/block_features.py | UTF-8 | 1,450 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__all__ = ['parent_tag', 'InsideTag', 'borders', 'block_length']
def _inside_tag(elem, tagname):
"""
>>> from lxml.html import fragment_fromstring
>>> root = fragment_fromstring('<div><i>foo</i><strong><p>head 1</p></strong></div>')
>>> el... | true |
b587097e6ebd1847b7d08183a08642da5e8251fd | Python | tuhinpoddar77/MIT-6001x | /midtermproblem7.py | UTF-8 | 334 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 24 16:42:19 2020
@author: tuhinpoddar
"""
# Paste your function here
def applyF_filterG(L, f, g):
tempL = L[:]
for i in tempL:
if not g(f(i)):
L.remove(i)
if len(L) > 0:
return max(L)
else:
retu... | true |
89443e8bf97058d381a55c87d6d11a4b39d40b9e | Python | PTortello/Games | /TManager/helpers.py | UTF-8 | 332 | 3.3125 | 3 | [] | no_license | def select_from_menu(menu_options: dict):
selection = input('Make selection: ')
# do some dodgy things
action = menu_options.get(int(selection), None)
if action is None:
print('')
print('Invalid selection')
print('')
else:
print('')
action()
... | true |
a8da74bec990ff5850b55a32a6f7ffb21982b39b | Python | lsht312/pyTMD | /pyTMD/read_FES_model.py | UTF-8 | 12,526 | 2.921875 | 3 | [
"MIT",
"CC-BY-4.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | #!/usr/bin/env python
u"""
read_FES_model.py (12/2020)
Reads files for a tidal model and makes initial calculations to run tide program
Includes functions to extract tidal harmonic constants from the
FES (Finite Element Solution) tide models for given locations
ascii and netCDF4 files can be been compressed using g... | true |
9ce5e38c9bfdb297629cecbd9efc12578f598fa4 | Python | sensharma/caltech-ml-assignments | /01-02W-Assignment.py | UTF-8 | 4,590 | 3.3125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
def random_point_select(n, d=2, l_range=-1, h_range=1):
"""
inputs: n, no. of points required
d: dimension of points
l_range: min value for each dimension
h_range: max value for each dimension
returns: n uniform r... | true |
c1a80943f13007399d137d2b55dfccd4b6c30c3d | Python | addisonweiler/CS194Project | /Lowdown_Backend/Lowdown/Facebook_App/questions/liked_status_question.py | UTF-8 | 1,253 | 3.28125 | 3 | [] | no_license | from questions import MultipleChoiceQuestion
from utils import get_paged_data, QuestionNotFeasibleException
def get_liked_and_unliked_statuses(self_data, friend_id):
self_statuses_data = get_paged_data(self_data, 'statuses')
status_data = dict()
for status in self_statuses_data:
if 'likes' in stat... | true |
cb24d2d2383a14b84bfb0694fde2fe2588aaaf96 | Python | igl00/basic-sorter | /sorter.py | UTF-8 | 1,790 | 3.328125 | 3 | [] | no_license | """ Sorts the loose files in a given directory into folders based on the file type.
"""
import os
import sys
import shutil
# Add the directory you want to sort here
BASE_DIR = ''
class MyDict(dict):
"""Allows a dictionary entry to reference another entry in the same dictionary."""
def __getitem__(self, item... | true |
adb650908d11905bc7631e3b41f8cf481ad887ff | Python | sebastianv89/factoring-sat | /solve/sat/plot.py | UTF-8 | 2,675 | 2.734375 | 3 | [] | no_license | import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import numpy.polynomial.polynomial as poly
import sys
from collections import defaultdict
mpl.style.use('classic')
def rsquared(y, fit):
y_mean = np.mean(y)
ss_tot = np.sum((y-y_mean)**2)
ss_res = np.sum((y-fit)**2)
return 1.0... | true |
66c4455a35cdd832b4154c1ce63d1b7ac9bdd559 | Python | egibar/ShogiGame | /Shogi/Constants.py | UTF-8 | 3,770 | 2.625 | 3 | [] | no_license | COLORS = [BLACK, WHITE] = range(2)
PIECE_TYPES_WITH_NONE = [NONE,
PAWN, LANCE, KNIGHT, SILVER,
GOLD,
BISHOP, ROOK,
KING,
PROM_PAWN, PROM_LANCE, PROM_KNIGHT, PROM_SILVER,
PROM_BISHOP, PROM_ROOK,
] = range(15)
PIECE_TYPES = [
PAWN, ... | true |
7323b70ebbcc8b9f0dc7b5df612b7425e749b516 | Python | cozyo/algo-learn | /python/linkedlist/circular_linked_list.py | UTF-8 | 2,142 | 4.28125 | 4 | [
"MIT"
] | permissive |
# 循环链表实现
class ListNode:
def __init__(self, val):
self.val = val
self.prev = None
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
# 添加元素至链表尾部
def add(self, val: int):
node = ListNode(val... | true |
9f14ad6b0f0ff27810e6fd786d94ce72b5eb9834 | Python | typemytype/drawbot | /tests/drawBotScripts/imagePixelColor.py | UTF-8 | 1,192 | 3.078125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | # This is a test case derived from https://github.com/typemytype/drawbot/issues/171
# It ensures that rgb values specified in fill() end up in image output without
# being mangled by a color space (within 8-bit resulution).
from drawBot import *
from PIL import Image
canvasSize = 400
size(canvasSize, canvasSize)
# c... | true |
ee4f25f829a49833b79b40b2a31f602d769b8828 | Python | sbobade/mtda | /mtda/power/gpio.py | UTF-8 | 2,378 | 2.609375 | 3 | [
"MIT"
] | permissive | # System imports
import abc
import os
import threading
# Local imports
from mtda.power.controller import PowerController
class GpioPowerController(PowerController):
def __init__(self, mtda):
self.dev = None
self.ev = threading.Event()
self.mtda = mtda
self.pin = None
def ... | true |
20deadb477f9eee443d4de875e04bf0966709627 | Python | circlelychen/regioh | /regioh/exceptions.py | UTF-8 | 2,348 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from werkzeug.exceptions import default_exceptions, HTTPException
from flask import make_response, abort as flask_abort, request
ERROR_CODE = {
200: 'success',
201: 'created',
202: 'accepted',
204: 'no_content',
302: 'redirect',
304: 'not_modified',
400: 'bad_request... | true |
a7865f9d4339dabd13f16fa710179d9810ff7aaf | Python | nigelzor/advent-of-code | /2019/day15.py | UTF-8 | 5,746 | 2.90625 | 3 | [] | no_license | import doctest
import itertools
import copy
import networkx as nx
def decode(intcode):
"""
>>> decode(1002)
(2, 0, 1, 0)
>>> decode(1108)
(8, 1, 1, 0)
"""
op = intcode % 100
modes = intcode // 100
mode_c = modes % 10
modes = modes // 10
mode_b = modes % 10
modes = modes... | true |
7fe9a9a6da66440fba9e260e8f86e782d7b558e3 | Python | traffaillac/traf-kattis | /loorolls.py | UTF-8 | 79 | 2.921875 | 3 | [] | no_license | l, n = map(int, input().split())
k = 1
while l%n!=0:
n -= l%n
k += 1
print(k) | true |
bfba199329834f32d02fee22f7739dab1ce4a61e | Python | shiernee/Diffusion | /src/unused/utils/FileIO23.py | UTF-8 | 15,473 | 2.640625 | 3 | [] | no_license | """
This class is to read files in a specific folder
"""
import numpy as np
import csv
import os
import pickle
from sklearn.externals import joblib
import GlobalParameters as gp
# impo/rt Hyperparameters as hp
import matplotlib.pyplot as plt
class FileIO23:
def __init__(self, folder=None):
self.folder = f... | true |
3e98d5da2ebf7536f8a8bb64b7fa7b53839ce623 | Python | Jacob-Bordelon/CSC_442 | /Keystroke/typing2.py | UTF-8 | 1,039 | 2.78125 | 3 | [] | no_license | # Can we read the features from the file
DEBUG = True
password = raw_input()
features = raw_input()
if DEBUG:
print "password = {}".format(password)
print "features = {}".format(features)
password = password.split(",")
password = password[:len(password)/2 + 1]
password = ''.join(password)
... | true |
a75d598d239764cbcc491b707307c55cde6c072a | Python | mikeshihyaolin/linkcode | /1184. Distance Between Bus Stops.py | UTF-8 | 2,013 | 4.125 | 4 | [] | no_license | # 1184. Distance Between Bus Stops.py
# A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n.
# The bus goes along both directions i.e. clockwise and counterclockwise.
# ... | true |
a894c9d3a99eeffe6bcafa983c3c4c1a70cac620 | Python | kxxoling/wez | /wez/main.py | UTF-8 | 2,205 | 2.90625 | 3 | [] | no_license | # coding: utf-8
import os
import requests
API_URL = 'https://api.worldweatheronline.com/free/v2/weather.ashx'
DEFAULT_PARAM = dict(
format='json',
num_of_days=3,
tp=3,
lang='',
)
API_KEY = os.environ.get('WWO_API_KEY')
def get_weather_info(q):
"""
Get the weather status of ``q``.
:para... | true |
d548a4e07b660b6e4b6251bf7319403df35a8c87 | Python | ARM-software/core-benchmarks | /frontend/src/frontend/cfg_generator/generate_benchmark.py | UTF-8 | 1,624 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | """Generates a frontend benchmark.
Usage:
python3 generate_benchmark.py [cfg_type] [cfg_options] output_filename
Example: to generate an instruction pointer chase:
python3 generate_benchmark.py inst_pointer_chase_gen \
--depth=10 --num_callchains=10 /tmp/ichase.pb
"""
import argparse
from frontend.cfg_gen... | true |
63759751a637b64948c948fe89de0dab4ea0cadf | Python | MiddlebrookJF/iCompBio-Summer2021 | /Worksheets/PDB-to-TXT.py | UTF-8 | 1,222 | 2.625 | 3 | [] | no_license | import pandas as pd
# for pName in ['6acd', '7krq', '7lwt', '7lws', '7lww', '7lyn', '6zgh', '6zge',
# '6zgi', '6xkl', '7lyl', '7kdk', '6zgg', '7m8k', '7mjg']:
# with open(f'Proteins-PDB/{pName}.pdb', 'r') as f:
# pdb_lines = f.readlines()
# txt_lines = []
# for line in pdb_lines:
# ... | true |
d0c6ecf9043b23767c469d6d9440a0e6e2dfeaee | Python | yjfu/transNet | /flo_file_processor.py | UTF-8 | 3,308 | 3.234375 | 3 | [] | no_license | import struct
import os
def parse_flo_file(input_path, output_path):
"""
This function read data from .flo file, whose data are formed
as h(0,0) v(0,0) h(0,1) v(0,1)..., while h and v is the horizontal
and vertical speed of pixel respectively
And output the data formed like a 2-channel image file, ... | true |
cbdee0ce265d12d309ebe1b251561fe5af8644a0 | Python | Baduit/ScriptGUIfier | /scriptguifier/Options/AddrOption.py | UTF-8 | 2,538 | 2.546875 | 3 | [
"MIT"
] | permissive | import json
import os
import subprocess
import sys
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import askopenfilenames
from tkinter.filedialog import askdirectory
if sys.platform == "win32":
ping_option = "-n"
else: # I assume that the ping comm... | true |
dbca3e45de4b62ac6d2c54914208fa0d28b9fbda | Python | CompEpigen/KBH_thesis_work | /SNAKEMAKE/reformat_tsv.py | UTF-8 | 2,280 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import pandas as pd
def main ():
parser = argparse.ArgumentParser(description='convert methylation frequency tsv file to bedGraph for methrix')
required = parser.add_argument_group(
'Required',
'meth_freq tsv, and output prefix/location')
required.... | true |
2290c7f8401c9e9e4f6de573ae439b08c3721cf9 | Python | singultek/ModelAndLanguagesForBioInformatics | /Python/Matrix/7.matrix_sum_diagonal.py | UTF-8 | 377 | 3.953125 | 4 | [
"MIT"
] | permissive | def sum_diagonal(i_list: list)-> int:
"""
Sum all the element on the diagonal of the matrix
:param i_list: The source list
:return: The addition of all the element on the diagonal
"""
i=0
_sum = 0
for row in i_list:
_sum += row[i]
i+=1
return _sum
if __name__ == "__ma... | true |
fde740d6650194bcf4f227bd58dac954f3420652 | Python | memray/OpenNMT-kpg-release | /onmt/modules/copy_generator.py | UTF-8 | 13,648 | 2.515625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
from onmt.utils.misc import aeq
from onmt.utils.loss import CommonLossCompute
def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs=None,
batch_dim=1, batch_offset=None):
"""
Given scores from an expanded dictionary
corresponeding to a b... | true |
be50538c1e1ccc017e36b86ced1ff3f82318ca29 | Python | diegogcc/py-pluralsight | /intermediate/unit-testing/3-pytest/tests/conftest.py | UTF-8 | 751 | 2.859375 | 3 | [] | no_license | ''' Shared fixtures '''
import pytest
from phonebook.phonenumbers import PhoneBook
''' test fixtures
changing the 'return' statement for a 'yield' statement,
we can simulate a tearDown after each test because we can put code AFTER the yield.
OR
we can add 'tmpdir' as a argument and pytest will su... | true |
2c3f36c956aa04eeebdff21cd07df85dd0c03aef | Python | Josemaria123/PandasTutorial | /PandasTutorial.py | UTF-8 | 3,455 | 3.765625 | 4 | [] | no_license | import pandas as pd
#Load the Data
df = pd.read_csv("Pokemon.csv")
print(df.head())
#Reading the Headers
print(df.columns)
#Read a specific column
print(df.Name)
print(df[["Name", "Type 1", "Attack"]])
#Read a specific row
print(df.iloc[2]) #iloc = integer location (Row index)
#Read multiple rows
print(df[["Na... | true |
7075474bf018a94729e8b503a15117e90889f8ed | Python | ArunKarthi-Git/pythonProject | /Program31.py | UTF-8 | 322 | 3.515625 | 4 | [] | no_license | if __name__=='__main__':
a=ord(input("Enter the character"))
if a>=97 and a<=122:
print("Given character is lower")
elif a>=65 and a<=90:
print("Given Character is upper")
elif a>=48 and a <=57:
print("Given Character is interger")
else:
print("Given Character special... | true |
9d28872f8d62310d733ee01feda9ead5c60d0508 | Python | yveslym/portfolio | /MOB2/mongochallenge.py | UTF-8 | 4,215 | 2.71875 | 3 | [] | no_license | from flask import Flask, request, make_response
from flask_restful import Resource, Api
from pymongo import MongoClient
from bson.objectid import ObjectId
import pdb
#from utils.mongo_json_encoder import JSONEncoder
# Basic Setup
# 1
app = Flask(__name__)
# 2
mongo = MongoClient('localhost', 27017)
# 3
app.db = mongo.... | true |
a8fdc5a08f57f8735a8b44d209ab62564bb82fd1 | Python | Python-Repository-Hub/the-art-of-coding | /Level.1/Step.02/2.4_InsertionSort.py | UTF-8 | 299 | 3.46875 | 3 | [
"CC0-1.0"
] | permissive | def insertion_sort(S):
for i in range(1, len(S)):
x = S[i]
j = i - 1
while (j > 0 and S[j] > x):
S[j + 1] = S[j]
j -= 1
S[j + 1] = x
S = list(map(int, input().split()))
sorted = insertion_sort(S)
print(sorted)
print(sorted[0], sorted[-1]) | true |
e24ef57f5ae7241c0202844cc9ca278049275060 | Python | AShurikas/Messenger | /server.py | UTF-8 | 1,250 | 2.84375 | 3 | [] | no_license | from flask import Flask, request, abort
import time
app = Flask(__name__)
db = []
@app.route('/')
def hello():
return 'Hello World'
@app.route('/status')
def status():
return {
'status': True,
'name': 'Training messenger',
'time': time.strftime('%-d %B %Y %H:%M'),
'users': l... | true |
2863b4128d9848a5b2ca7a987ad02fc4fbb0152f | Python | josevini/python | /Introdução à Programação/capitulo8/ex_8-13.py | UTF-8 | 266 | 3.46875 | 3 | [
"MIT"
] | permissive | # Exercício 8.13 - Livro
def letraValida(op):
str(op.lower())
while True:
v = input('Digite uma letra: ').lower()
if v not in op:
print('Tente novamente!')
continue
else:
break
letraValida('mf')
| true |
2afe0a7224425cddea64d88289da5f6229fbc8d2 | Python | AbhinavUtkarsh/Cracking-The-Coding-Interview | /Solutions to Arrays and Strings/palindrome permutation.py | UTF-8 | 1,290 | 3.28125 | 3 | [] | no_license | def palindrome_P(P_string):
table=[0 for _ in range(ord("z")-ord("a")+1)]
oddcounter=0
for char in P_string:
location=number(char)
if location!=-1:
table[location]+=1
if table[location]%2==1:
oddcounter+=1
else:
... | true |
232a4bd8302f95040bf7e914f1a62fd452f31313 | Python | fodilB/MTCopula | /copulas/models/gaussian_copula.py | UTF-8 | 5,561 | 2.578125 | 3 | [
"MIT"
] | permissive | __author__ = 'BENALI Fodil'
__email__ = 'fodel.benali@gmail.com'
__copyright__ = 'Copyright (c) 2021, AdW Project'
import logging
import sys
import numpy as np
import pandas as pd
from scipy import stats
from copulas import (
EPSILON, get_instance, get_qualified_name, random_state, store_args)
from copulas.margi... | true |
ed44cf30008bd84876ccbc5d7c5bf16e375de6d7 | Python | sungho123/2020-Python-Algorithm- | /제출/Algorithm/3_05_2주차/5월 2주차 연습문제 1 홍성훈.py | UTF-8 | 466 | 3.6875 | 4 | [] | no_license | while True:
try :
n = int(input("0~20 사이의 정수를 입력하시오 : "))
if n < 0 :
print("0보다 작을 수 없습니다.")
elif n >= 20 :
print("20보다 작거나 같은 자연수를 입력하세요.")
else :
break
except :
print("정수만 입력하세요")
x1 = 0
x2 = 1
for i in rang... | true |
09aaf91c416e554a1a3b0d2dd4b089d9b1679b80 | Python | mihalyvaghy/tdd_katas | /greeting/test/test_greeting.py | UTF-8 | 1,197 | 3.234375 | 3 | [] | no_license | import unittest
from src import greeting
class GreetingTest(unittest.TestCase):
def test_properName(self):
self.assertEqual("Hello, Mitya!", greeting.greet("Mitya"))
def test_nullName(self):
self.assertEqual("Hello, my friend!", greeting.greet(None))
def test_shouting(self):
self.... | true |
bcd5df9930a841a730b985a1de3c896c9a0dd8e6 | Python | shubhamadep/Interview-Coding-Practice | /OOPDesign.py | UTF-8 | 6,684 | 3.5 | 4 | [] | no_license | '''
Steps to take:
1. Clarify requirement. think about entities
2. Relation between them.
3. Write them down. Assume payement services, database services are implement.
Before writing think about:
1) Encapsulation: Means binding the data together in objects.
2) Abstraction: Means hiding all but the relevant data ab... | true |
d5126a4c46f779e16daa7573f89753a9496b7fb0 | Python | diwakarjaiswal880/PythonWorkshop | /workshop/circlearea.py | UTF-8 | 131 | 3.484375 | 3 | [] | no_license | def findArea(r):
pi = 3.142
return pi * (r*r);
r=int(input("Enter radius of circle : "))
print("Area is ",findArea(r));
| true |
3f8e4068cfa084fc2a460164d5c8f97cc89acb3e | Python | sahansera/algo-src | /algo/find_middle_of_a_linked_list.py | UTF-8 | 1,157 | 4.4375 | 4 | [
"MIT"
] | permissive | '''
Find the middle of a linked list
Very often, linked list questions need to have O(n) time complexity, but not necessarily true
and space: O(1)
Technique - Fast and Slow Pointer
'''
class Node:
def __init__(self, val):
self.val = val
self.next = None
class SinglyLinkedList:
def __init__(se... | true |
18f3252ad9de8289e19b6aba64ee655dd5c924b2 | Python | njnathan/Fake-News-Identification-project | /KaggleToSQL.py | UTF-8 | 3,248 | 2.625 | 3 | [] | no_license | import pandas as pd
import pymysql
train = pd.read_csv("inputs/kaggleFakeandReal.csv", keep_default_na=False)
db = pymysql.connect(host="localhost", user='ylb14192', password='201445765', database='ylb14192')
cursor = db.cursor()
db2 = pymysql.connect(host="localhost", user='ylb14192', password='201445765', database... | true |
911160382f6052254e7d9feabddac19bd8ec82ec | Python | AmadoCab/Project-Euler | /pe_007.py | UTF-8 | 419 | 3.296875 | 3 | [] | no_license | from math import sqrt
def test_primalidad(n):
if n == 1:
return False
for i in range(2, int(sqrt(n)) + 1):
if n%i == 0:
return False
return True
contador = 0
respuesta = 0
for i in range(110000):
if test_primalidad(i) and contador<=10001:
contador = contador + 1
... | true |
b9b521eb438a02f3ae5ea69822685b6f7b1f0930 | Python | nikcbg/Begin-to-Code-with-Python | /9. Use classes to store data/EG9-04 Tiny Contacts Class.py | UTF-8 | 2,105 | 4.15625 | 4 | [
"MIT"
] | permissive | # EG9-04 Tiny Contacts Class
from BTCInput import *
# Create the contact class
class Contact:
pass
# Create the list to store contact information
contacts=[]
def new_contact():
'''
Reads in a new contact and stores it
'''
print('Create new contact')
# create a new instance
new_contact=... | true |
ecef175563abd253d70cf9086908a66a37df3b92 | Python | flowler/study | /venv/day1.py | UTF-8 | 219 | 3.75 | 4 | [] | no_license | #range在python2中返回列表,在python3中返回对象,节省内存
#求1-100的和
print(sum(range(101)))
#计算10以内偶数加和
total=0
for i in range(0,10,2):
total=total+i
print(i)
print(total) | true |
58b9abc849c3cd02cb839817d43f0c8a556ca593 | Python | vipul02/python_jenkins | /tests/test_calculator.py | UTF-8 | 595 | 2.734375 | 3 | [] | no_license | from unittest import TestCase
from src.calculator import add
class TestCalc(TestCase):
def setUP(self):
pass
def test_1(self):
expected = 6
actual = add(3, 3)
self.assertEqual(expected, actual)
def test_2(self):
expected = 10
actual = add(1, 9)
... | true |
0df2747cd8fd619dca8aaa12a0510b6ec5f048fb | Python | Naresh1430/jenkins_integration | /src/test_cases/test_example.py | UTF-8 | 404 | 2.5625 | 3 | [] | no_license | from src.main.example import hi, bye, how_are_you
import pytest
@pytest.fixture
def bob():
return {"name":"Naresh"}
def test_hi(bob):
#bob = {"name": "Naresh"}
assert hi(bob) == "Hi, Naresh"
def test_bye(bob):
#bob = {"name": "Naresh"}
assert bye(bob) == "Bye, Naresh"
def test_how_are_you(bob):... | true |
f24518e855fe7bacd50af855329cdb4f47ec5809 | Python | larsh0103/simret | /src/simret/retinanet/backbone_util.py | UTF-8 | 5,384 | 2.828125 | 3 | [] | no_license | from torch import nn
from torchvision.models import resnet
from torchvision.ops import misc as misc_nn_ops
from torchvision.ops.feature_pyramid_network import FeaturePyramidNetwork, LastLevelMaxPool
from . import _utils
class BackboneWithFPN(nn.Module):
"""
Adds a FPN on top of a model.
Intern... | true |
78044c948389d658c5273c1d4e388c0523a8c5bf | Python | HeshamBahgat/Learn-Python-The-Hard-Way | /ex38.py | UTF-8 | 1,003 | 4.46875 | 4 | [] | no_license |
ten_things = "Apples Oranges Crows Telephone Light Sugar" # create a string
print("Wait there are not 10 things in that list. let's fix that.")
stuff = ten_things.split(" ") # split all words seprated with a space and create alist
more_stuff = ["day", " Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"] #... | true |
f7ec88a590935d48f53997277baf0547592d84dc | Python | suppureme/IbridgePyImplementations | /market_calendar_factory/MarketCalendar.py | UTF-8 | 6,655 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 26 04:56:16 2018
@author: IBridgePy@gmail.com
"""
import datetime as dt
import numpy as np
import pandas as pd
from pandas.tseries.offsets import MonthEnd
import market_calendar_factory.market_calendar_lib as mcal
from BasicPyLib.BasicTools import convert_d... | true |
fa8fd0110bad29bf744d54ae5305447d8bb01b55 | Python | woellij/wiimote-musicmaker | /dragOperation.py | UTF-8 | 1,208 | 3.0625 | 3 | [] | no_license | from PyQt5.QtWidgets import QUndoCommand
class DragOperation(QUndoCommand):
"""
Class representing a drag operation on a widget.
Adjusting the position through the apply method.
"""
def __init__(self, widget, event):
super(DragOperation, self).__init__()
self.widget = widget # ty... | true |
7ce3b983074b15da976a8497cd0b90ba9670d6e5 | Python | pjh5/MLSiml | /mlsiml/classification/plan.py | UTF-8 | 2,806 | 2.796875 | 3 | [] | no_license |
from abc import ABCMeta, abstractmethod
from functools import wraps
class Workflow():
def __init__(self, workflow_steps):
pass
def evaluate_on(self, sources):
pass
class WorkflowStep(metaclass=ABCMeta):
"""Wrapper around transformations that have .transform(X, y) to use sources"""
... | true |
1942ddfc78d9cf779e5e09dda62b8dd9473eb6c5 | Python | AK-1121/code_extraction | /python/python_27781.py | UTF-8 | 203 | 2.625 | 3 | [] | no_license | # Python: Reading Fortran Binary file using numpy or scipy
with open('filepath','r') as f:
header = np.fromfile(f, dtype=np.int, count=number_of_integers)
data = np.fromfile(f, dtype=np.float32)
| true |
3e377c9323881891a27ed510c327fa9c14803d09 | Python | rakeshchauhan0007/class_LAB1 | /LabOne/q_5.PY.py | UTF-8 | 640 | 4 | 4 | [] | no_license | """
A school decided to replace the desks in three classrooms. Each desk sits two students.
Each desk sit two students.
Given the number of students in each class, print the smallest possible numbers of desk
that can be purchased.
"""
A = int(input("the number of students in A class: "))
P = A//2
X = A % 2
B = int(... | true |
ba9ebb7fcef6a54b2dfff684388b90c57345552a | Python | Vieuxnorris/Python | /python_print.py | UTF-8 | 673 | 3.59375 | 4 | [] | no_license | import string
def test(*par,sep=" ", espace="\n"):
for i,valeur in enumerate(par):
par = str(valeur);
chaine = par.split(sep);
chaine = espace.join(chaine);
verification = input("entrez 'M' pour majuscule ou 'm' pour minuscule : ");
verification = str(verification);
while verif... | true |
d06669b86bfbe5d8dbdca736375317e1ad2534de | Python | bob16795/autormd | /autodocx/formaters/doc.py | UTF-8 | 307 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | """
handles .doc files
"""
def setup(doc):
"""
formats a .doc file
"""
doc.styles.add_style("Quote", 1, True)
def header(doc, title, *_):
"""
Adds a heading to a .doc file
"""
print(f" + Doc {title}")
par = doc.paragraphs[0]
par.text = title
par.style = "Title"
| true |
bd4a0d73191ab02e287e56ea7775aab4edecfafc | Python | RianMarlon/Python-Geek-University | /secao6_estrutura_repeticao/exercicios/questao22.py | UTF-8 | 823 | 4.21875 | 4 | [] | no_license | """
22) Escreva um programa completo que permita a qualquer aluno
introduzir, pelo teclado, uma sequência arbitrária de notas(válidas no intervalo de
10 a 20) e que mostre na tela, como resultado, a correspondente média aritmética.
O número de notas com que o aluno pretenda efetuar o cálculo não será fornecido
ao progr... | true |
eaca5931cbb9c28d2c6af0c01adb3e1e9993ca9c | Python | wikibook/python36 | /1부/7장/7-1-4.py | UTF-8 | 193 | 3.328125 | 3 | [] | no_license | def divide(a, b):
return a / b
try:
c = divide(5, "af")
except TypeError as e:
print('에러: ', e.args[0])
except Exception:
print('음~ 무슨 에러인지 모르겠어요!!') | true |
4218992a09aa324f91d83e285dc4c8cd73d8fc57 | Python | Morgan88888888/pecos | /pecos/metrics.py | UTF-8 | 8,419 | 3.265625 | 3 | [
"BSD-3-Clause"
] | permissive | """
The metrics module contains metrics that describe the quality control
analysis or compute quantities that might be of use in the analysis
"""
import pandas as pd
import numpy as np
import datetime
import logging
logger = logging.getLogger(__name__)
def qci(mask, tfilter=None, per_day=True):
"""
Compute t... | true |
068065736a44e9ddced939322eba54555d495565 | Python | ilia-che/test_lanhuage | /test_items.py | UTF-8 | 709 | 2.65625 | 3 | [] | no_license | import time
from selenium.common.exceptions import NoSuchElementException
link = 'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/'
def test_add_to_basket_button(browser):
try:
browser.get(link)
time.sleep(5) # для визуальной проверки языка сайта
button = browser.find_el... | true |
93126484a169ef272de1005fd06a0da39b81ca48 | Python | allenz/ballin | /src/calcs.py | UTF-8 | 769 | 3.375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# Compute the tilt angle to reach a target position
# Written by Allen Zhu
# BSD License
import numpy as np
from scipy.optimize import fsolve
g = 9.8 # gravity
def calcTilt(v, d, h):
"""Returns tilt angle to hit target at dist d and height h with muzzle v."""
# Impossibility condition: at th... | true |
12d506084949370f99947f953cb4b039f7fa31ae | Python | olaurendin/Kriging | /tests/test_string.py | UTF-8 | 208 | 2.828125 | 3 | [] | no_license | def get_col_spec(scale,precision, x,y):
s = "{:0%s.%sf}" % (scale-precision,precision)
print(s)
s2 = ("POINT({},{})".format(s,s)).format(x,y)
return s2
print(get_col_spec(10,2,2.369,456.39))
| true |
42660ca2493a5d01b820ad911febef3ae4bcfe05 | Python | carodfr/Delicious | /www/app/views/userBP.py | UTF-8 | 1,424 | 2.640625 | 3 | [] | no_license | from flask import Blueprint, request, redirect, session, url_for, render_template, flash
from app.models.userModel import User
userBP = Blueprint('user', __name__, url_prefix='/user')
@userBP.route('/register', methods=['GET', 'POST'])
def register():
if request.method == 'POST':
username=request.form[... | true |
35385145c23c0a9d1466e0e2e7625df8648887cc | Python | iam91/thesis_master | /pub/data/stat.py | UTF-8 | 575 | 2.734375 | 3 | [] | no_license | import numpy as np
from sklearn.mixture import GaussianMixture
if __name__ == '__main__':
data = np.genfromtxt('data.csv', delimiter=',')
p = np.arange(0, 1.01, 0.01)
q = np.quantile(data, p)
np.savetxt("./result/eq.csv", q, delimiter=",", fmt='%15.6f')
gmm = GaussianMixture(7, covariance_type='... | true |
610d90b97db42896e56d400974ce32d7a7cdf6fd | Python | loociano/advent-of-code | /aoc2020/src/day16/solution.py | UTF-8 | 6,242 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | true |
141cf72b62311d0b958de4f5d21c7a221b5111d0 | Python | Pivi14/War-of-battleship | /function.py | UTF-8 | 572 | 3.5625 | 4 | [] | no_license | import os
def screen_clear():
os.system("clear||cls")
def print_menu(menu):
for element in range(len(menu) - 1):
print(f"({element + 1}) {menu[element]}")
print(f"(0) {menu[-1]}")
def get_input(question):
results = []
for quest in question:
answer = input(f"{quest}: ")
res... | true |
626e644511d8ff2894bf1fe47918b9c42bf31f00 | Python | rehomewebapp/REhome | /WebApp/views/templates/sidebar.py | UTF-8 | 2,357 | 2.609375 | 3 | [] | no_license | import dash
from dash_bootstrap_components._components.NavItem import NavItem
import dash_html_components as html
import dash_bootstrap_components as dbc
CHEVRON_UP = "/assets/chevron-up.svg"
CHEVRON_DOWN = "/assets/chevron-down.svg"
def create_sidebar(active_view):
"""Generate a sidebar with the given string as... | true |
7c40bb556d885fec244710bd76e7908eb81f3386 | Python | hj940709/Small-Widget | /progress.py | UTF-8 | 3,414 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
This class represents a progress bar. It displays progress in a way that does not clutter up the output.
If possible, it also estimates the remaining time.
ETR: Estimated time remaining
ET: Elapsed time
@Author Llorenç
'''
import sys, time, datetime
##Used to print nice progress bars. Pote... | true |
46d6c07a15eace00c882860f9acd43d175d80f77 | Python | fastestmk/atcoder-dp-contest | /solutions-in-python/F-LCS.py | UTF-8 | 477 | 3.09375 | 3 | [
"MIT"
] | permissive | dp = [[0]*3005]*3005 # arr = [[0]*cols]*rows
s = str(input())
t = str(input())
for i in range(1, len(s)+1):
for j in range(1, len(t)+1):
if s[i-1] == t[j-1]:
dp[i][j] = dp[i-1][j-1]+1
else:
dp[i][j] = max(dp[i-1][j], dp[i][j-1])
# print(dp[len(s)][len(t)])
i, j = (len(s), len(t))
ans = ""
while i >= 1 ... | true |