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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3c362e6a9abc4726ac4753ecbcde76d8a0467565 | Python | detianitatibs/getCryptocurrency | /loadCryptocurrecyGcsToBigQuery/main.py | UTF-8 | 1,994 | 2.515625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
StorageにたまったTSVファイルを日次でBigQueryにロードする(GCF版)
"""
__author__ = "@detian_itatbs"
__status__ = "development"
__version__ = "0.0.1"
__date__ = "16 January 2021"
import datetime
import os
from google.cloud import bigquery
def getNowDtStrAgo(isConvertJST=False):
"""
現時刻から1日前の文字列(%Y%m... | true |
c49b8c57b765585d198b31f13ce9f86de67a86a6 | Python | Josh-Ay/breakout-game | /main.py | UTF-8 | 2,000 | 3.6875 | 4 | [] | no_license | from turtle import Screen
from ball import Ball
from paddle import Paddle
from block import Block
from scoreboard import Score
from random import choice
game_on = True
# Creating the screen
screen = Screen()
# Configuring the screen
screen.title("BreakOut Game")
screen.setup(700, 600)
screen.bgcolor("black")
screen... | true |
7640bc5c7d0590d59eb3309183b673ad858ba0ac | Python | 201411096/study_flask | /flask/ex_04_full-stack-basic/01_backend/01_decorator/02_First-class-function.py | UTF-8 | 781 | 4.15625 | 4 | [] | no_license | """
First-class function
1. 함수를 식별자에 바인딩할 수 있는지
2. 함수를 데이터 구조에 저장할 수 있는지
3. 함수 호출에서 함수를 인수로 전달할 수 있는지
4. 함수 호출에서 함수를 반환할 수 있는지
"""
print('==============================')
def my_func(arg_num):
return arg_num *2
print(my_func(4))
tempFunc = my_func
print(tempFunc(4))
print('==============================')
def m... | true |
017309b7f3ceba4f2c8c252e988dc6845c1161c3 | Python | ornellaolivastri/python_projects | /hello-world/hello_world.py | UTF-8 | 1,828 | 4.4375 | 4 | [] | no_license | print ("Hello, world!")
# asi se escriben los comentarios de una linea
"""
esto es un comentario
de multiples lineas
"""
"""
# variables
texto = "Esto es un texto guardado en la variable texto"
nombre = "mi nombre es ornella"
edad = 23
anio = 2021
print(texto)
print(f"{nombre} -y mi edad- {edad}") #edad puede tr... | true |
2ed5c80a96971e76bfd594921045f49819346c51 | Python | chow1340/fleeting_interest | /chat/ChatService.py | UTF-8 | 1,745 | 2.625 | 3 | [] | no_license | from config.MongoConnectionConfig import MongoConnectionConfig
from bson import json_util, ObjectId
from bson.json_util import dumps
from datetime import timedelta
class ChatService():
__instance = None
@staticmethod
def getInstance():
""" Static access method. """
if ChatService.__instan... | true |
953d5228a112b7c2031064ee7b24992879d163a1 | Python | a1anwolker/bot | /natali37.py | UTF-8 | 1,580 | 2.640625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as BS
from tqdm import tqdm
req_link = requests.get('https://natali37.ru/catalog/products/label/1')
html = BS(req_link.content, 'lxml')
#get max_count of new-products on the site
counter = (html.select('div.products__right-counter.products__counter')[0]).get_text(... | true |
cb1f676f8432faf6ee5a510fd49bd6dcb22dbdad | Python | animjain/PythonAdvancedTraining | /2019_Apr16/design_patterns/chainofactions_test.py | UTF-8 | 326 | 2.65625 | 3 | [] | no_license | from chain_of_actions import ChainOfActions
@ChainOfActions
def add_test(x, y):
return x + y
@ChainOfActions
def mul_test(x, y):
return x * y
@ChainOfActions
def sub_test(x, y):
return x - y
dataset = [(10, 20), (4.5, 6.7), ("55", 78), (None, False)]
ChainOfActions.add_data(dataset)
ChainOfActions.... | true |
fb2abffbf69d977ae12243f52db76dddf48499c1 | Python | NovikovMA/python_training_mantis | /test/test_project_del.py | UTF-8 | 3,996 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
__author__ = 'M.Novikov'
from model.project import Project # Проекты Mantis
from random import randrange # Случайности
import random # Случайнос... | true |
bc62bd3f66f78580d3c9135d81b7a6c2060a43d4 | Python | NirmalVatsyayan/python-revision | /language_programs/python_numpy/18_numpy_comparison.py | UTF-8 | 1,052 | 4.125 | 4 | [] | no_license | import numpy as np
a = np.array([3, 3, 1], float)
b = np.array([0, 3, 2], float)
if False:
'''
comparing 2 numpy arrays
'''
print(a>b)
print(a>=b)
print(a<b)
print(a<=b)
print(a==b)
print(a!=b)
if False:
'''
comparing numpy array with scalar
'''
print(a>2)
if Fa... | true |
27784d0bd477add5ad530a344b39f4e2963ebf88 | Python | TheLycaeum/letterinvasion | /letter_invader.py | UTF-8 | 1,773 | 3.28125 | 3 | [] | no_license | import curses
import string
import random
import time
def max_dimensions(window):
height, width = window.getmaxyx()
return height - 2, width - 1
def create_random_letter(width):
letter = random.choice(string.ascii_lowercase)
column = random.randrange(0, width)
return 0, column, letter
def move_i... | true |
7127833a9d19413f7f5f1c028d4a6fe3c823b990 | Python | sublimelsp/LSP | /plugin/core/promise.py | UTF-8 | 7,637 | 3.203125 | 3 | [
"MIT"
] | permissive | from .typing import Callable, Generic, List, Optional, Protocol, Tuple, TypeVar, Union
import functools
import threading
T = TypeVar('T')
S = TypeVar('S')
TExecutor = TypeVar('TExecutor')
T_contra = TypeVar('T_contra', contravariant=True)
TResult = TypeVar('TResult')
class ResolveFunc(Protocol[T_contra]):
def __... | true |
c696694d9532538bba60aa872da6e39709200409 | Python | jgingh7/Problem-Solving-Python | /FindTheWinnerOfAnArrayGame.py | UTF-8 | 656 | 3.59375 | 4 | [] | no_license | # https://leetcode.com/problems/find-the-winner-of-an-array-game/
# Time: O(n)
# Time: O(1)
class Solution:
def getWinner(self, arr: List[int], k: int) -> int:
currWinner = arr[0]
currK = k
for i in range(1, len(arr)):
if currWinner > arr[i]:
currK -= 1
... | true |
849a86780d72e5cd5dde8ee9023bb7ab6ae498fe | Python | JacobGT/SQLite3PythonTutorial | /formatResults.py | UTF-8 | 560 | 3.84375 | 4 | [] | no_license | import sqlite3
# Connect to database
conn = sqlite3.connect("customers.db")
# Create a cursor
c = conn.cursor()
# Query the database (db)
c.execute("SELECT * FROM customers")
# The fetch command brings out the results as a tuple inside a python list, so you can access it like that ex. ()[#]
items = c.fetchall()
# ... | true |
5736caf9ab2f502796d43e7d0e6d33377dba8a0a | Python | sfarrens/sf_tools | /sf_tools/image/shape.py | UTF-8 | 12,027 | 3.3125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""SHAPE ESTIMATION ROUTINES
This module contains methods and classes for estimating galaxy shapes.
:Author: Samuel Farrens <samuel.farrens@gmail.com>
:Version: 1.4
:Date: 20/10/2017
Notes
-----
Some of the methods in this module are based on work by Fred Ngole.
"""
from __future__ impor... | true |
717c20366a4a162e6d12b71785e340a45bd59078 | Python | hemeshwarkonduru/leetcode-codes | /Add Two Numbers.py | UTF-8 | 1,156 | 3.359375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
p1=l1
p2=l2
c=0
head=curr=ListNode(0) #just to assign likedlist head... | true |
b2c5b08407e17810ccdfa0e1deb58302426a77d9 | Python | zbaolong/an | /cx_tqsk.py | UTF-8 | 1,254 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# 查询天气实况信息的模块。
__author__ = 'Andy'
import requests, os, sys
from bs4 import BeautifulSoup
# 用于解析URL页面:
def getSoup(url):
soup_url = url
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/51.0.2704.63 S... | true |
91497b0b3d30e757eacc39d090e45d60c7487f60 | Python | netsill/web-Safety | /python/pxssh破解.py | UTF-8 | 2,054 | 2.625 | 3 | [] | no_license | #coding=utf-8
import pxssh
import optparse
import time
import threading
MaxConnections = 5
ConnectLock = threading.BoundedSemaphore(value = MaxConnections)
Found = False
Fails = 0
def Connect(Host,User,Password,Release):
global Found,Fails
try:
Ssh = pxssh.pxssh()
Ssh.login(Host,User,Passwor... | true |
71890b0a8a271c9fb6d035d116fea3236f7f5447 | Python | Darainer/AdventOfCode2019 | /IntCode_tests.py | UTF-8 | 3,946 | 2.625 | 3 | [] | no_license | import unittest
from IntCode import IntCode
from Day2_IntCode.Day2_1202_Program_Alarm import find_inputs_for_computeResult
from Day7_Amplification_Circuit.AmplificationConfig import CalculateMaxAmplification, FeedbackAmplification
class Day2_part1(unittest.TestCase):
def test_something(self):
input_program... | true |
bf9361ac4af0f24c8ea28328a829911d05777963 | Python | joojaeyoon/PS | /BOJ/3000-4000/3078/3078.py | UTF-8 | 324 | 2.75 | 3 | [] | no_license | import sys
from collections import deque
N, K = map(int, input().split())
answer = 0
q = [deque([]) for _ in range(21)]
for i in range(N):
length = len(sys.stdin.readline())-1
while q[length] and i-q[length][0] > K:
q[length].popleft()
answer += len(q[length])
q[length].append(i)
print(answ... | true |
bf1ba1d77c5526d50d8fb0ca12158416ffb30753 | Python | upgradeb/ViolentPython | /Chapter01/pwdCrack.py | UTF-8 | 840 | 2.875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import crypt
import hashlib
import sys
def EnCrypt(word, salt):
cryptWord = crypt.crypt(word, salt)
print(cryptWord)
return cryptWord
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('key.txt', 'r')
for word in dictFile.readlines(... | true |
eb7696cef736b34b6440462fcac3cc7c4ab2e133 | Python | srikanthpragada/25_FEB_2019_PYTHONDEMO | /oop/sum_of_nums.py | UTF-8 | 149 | 4.09375 | 4 | [] | no_license | sum = 0
for i in range(1, 6):
try:
num = int(input("Enter number :"))
sum += num
except:
pass
print(f"Sum = {sum}")
| true |
84eeecab695d7301ed1437208981589a3b6162f9 | Python | scikit-optimize/scikit-optimize.github.io | /0.7/_downloads/2f6e22007265fe3158cce44853e94a58/strategy-comparison.py | UTF-8 | 4,632 | 3.40625 | 3 | [] | permissive | """
==========================
Comparing surrogate models
==========================
Tim Head, July 2016.
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
Bayesian optimization or sequential model-based optimization uses a surrogate
model to model the expensive to evaluate function `func`. There are se... | true |
0660a760a158a0aefde75aa79c9aab969d9238ab | Python | Tchekda/IVAOWrapper | /ivao/pilot.py | UTF-8 | 5,549 | 2.53125 | 3 | [
"MIT"
] | permissive | from .client import Client
class Pilot(Client):
def __init__(self, callsign, vid, latitude, longitude, altitude, server, connection_time, soft_name, soft_version,
admin_rating, client_rating, groundspeed, aircraft, cruise_speed, departure_airport, cruise_level,
destination_airpo... | true |
99a4c1c90c76e8c353a5ccb5c0abba75e78b17e4 | Python | bchretien/PyUDT | /legacy/example/pyudt/epoll/server.py | UTF-8 | 4,097 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
"""
:module udtserver
"""
import struct
import udt4 as udt
from udt4 import pyudt
import socket as socklib
from subprocess import Popen
import sys
def configure_epoll(udt_clients, sys_clients):
epoll = pyudt.Epoll()
for client in udt_clients:
epoll.add_usock(client, ud... | true |
d8ff438375b4bdd79ecfba103c5f65afd2bcb714 | Python | MengSunS/daily-leetcode | /fb高频/211.py | UTF-8 | 1,207 | 3.734375 | 4 | [] | no_license | class TrieNode():
def __init__(self):
self.children = collections.defaultdict(TrieNode)
self.isWord = False
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode()
def addWord(self, word: str) ... | true |
b19ccfc2ae58230bad4a2218cf0890e0023681af | Python | IgorxutStepikOrg/AlgorithmsTheoryAndPracticeMethods | /Module8_2/Step 6/python/solution.py | UTF-8 | 973 | 2.96875 | 3 | [] | no_license | def func(len, list):
P = [0] * len
M = [0] * (len + 1)
L = 0
list = list[:: -1]
for i in range(len):
lo = 1
hi = L
while lo <= hi:
mid = (lo + hi) // 2
if list[M[mid]] < list[i]:
lo = mid + 1
elif list[M[mid]] == list[i]... | true |
e53df48b9eec7de6de631439daca0dd07219d51f | Python | Aasthaengg/IBMdataset | /Python_codes/p03796/s181516620.py | UTF-8 | 84 | 2.65625 | 3 | [] | no_license | import math
N = int(input())
N = math.factorial(N)
N = (N % (1000000000+7))
print(N) | true |
7a4474272ecae5659cdc018cd2331f9908463903 | Python | FoFxjc/ChangXing-Tool | /utils/mysql.py | UTF-8 | 10,778 | 3 | 3 | [] | no_license | # coding=utf-8
"""
爬虫工具-基础工具包:MySQL数据库支持函数
"""
import re
import mysql.connector
def select_by_sql(host: str, user: str, password: str, database: str, sql: str, columns: list,
use_unicode: bool = True):
"""
:param host: <str> MySQL数据库主机的Url
:param user: <str> MySQL数据库的访问用户名
:param ... | true |
70650e335045e2d7edc9f20555b82eaee1d37d41 | Python | msabrishami/EE559_discussion1 | /test1.py | UTF-8 | 86 | 2.5625 | 3 | [] | no_license |
# This is our first python code
print "Hellow World!"
print "Its nice to be here"
| true |
ce465f049296bbc7fb0c80bedb5aa39a0ab4bae3 | Python | shimomura314/non-bit-reversi | /gui.py | UTF-8 | 9,413 | 2.890625 | 3 | [
"MIT"
] | permissive | """GUI."""
import copy
import time
import wx
from color import color_pallet as cp
from menu import MenuBar
import othello
class MyFrame(wx.Frame):
"""Make frame for GUI."""
def __init__(self, parent=None, id=-1, title=None, size=(640, 480), othello=None):
wx.Frame.__init__(self, parent, id, title, si... | true |
eb99c0b19214c53c472654bf7a9dc618dc4e4b5f | Python | saurabh-mani/ToDoList | /to-do-list-1.0.py | UTF-8 | 1,111 | 3.140625 | 3 | [] | no_license | import mysql.connector
#Connection to MySQL
mydb = mysql.connector.connect(host='localhost',user='username',passwd='password',database='ToDoList')
#cursor
mycursor = mydb.cursor()
print("1. List all records")
print("2. List pending")
print("3. Mark done")
print("4. Add entry")
operation = input("Choose an operation... | true |
7d46b9f184bf46a9c5abdcbd83ae4fd7772908f8 | Python | virtru/audit-export-client | /auditexport/auditclient/auditclient.py | UTF-8 | 4,704 | 2.734375 | 3 | [
"MIT"
] | permissive |
import random
import hashlib
import base64
import binascii
import requests
import jwt
import time
import sys
import logging
from binascii import Error
from . import errors
logger = logging.getLogger(__name__)
VJWT_TTL_SECONDS = 300.0
API_HOST = 'audit.virtru.com'
API_PATH = '/api/messages'
class AuditClient:
"... | true |
1bb2542c2251001f68f2670136fb1b90de646585 | Python | jb26444/lazynet | /Python/Learning/square_1.py | UTF-8 | 645 | 3.875 | 4 | [] | no_license | import turtle
def draw():
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("blue")
brad.speed(2)
offset = 0
brad1 = 0
while ( brad1 < 25 ):
brad.right(offset)
brad.forward(100)
brad.right(90)
brad.forward(100)
brad.right(90)
brad.forw... | true |
3cdaed0736b8eb6ad45719659d45a2bbf3dff21f | Python | artemmarkaryan/price_checker | /database/facade/user.py | UTF-8 | 210 | 2.53125 | 3 | [] | no_license | from database.models import User, Platform
def get_or_create(user_id: int, platform: str) -> User:
platform = Platform.get(name=platform)
return User.get_or_create(user_id=user_id, platform=platform)
| true |
a7ab3180d0059ea8f2e4cf069e99146d3d938cfd | Python | joyzhaoyang/Financial-Computing-III | /FC3_HW2_Q1_Merkle-Hellman_Knapsack_Cryptosystem.py | UTF-8 | 3,092 | 3.84375 | 4 | [] | no_license | """
This file: FC3HW2Prob1.py
Programmer: Joy Zhao (yangzhao@tepper.cmu.edu)
Course/Section: 46-903
Assignment: Homework2, Problem1
Description: Merkle-Hellman Knapsack Cryptosystem
Performing key generation, encryption and decryption and using Python lists.
Methods: http://en.wikipedia.org/wiki/Merkle%E2%80%93Hellman_... | true |
74c5bd78f50d96f1f32a8ebddd3d9cfed64d1788 | Python | vsupe/jobeasy_snake_game | /snake.py | UTF-8 | 6,202 | 3.15625 | 3 | [] | no_license | import sys
from time import sleep
import pygame
from random import randrange
# Window
WINDOW_HEIGHT = 480
WINDOW_WIDTH = 640
SNAKE_COLOR = (0, 255, 0)
FOOD_COLOR = (255, 0, 0)
BACKGROUND_COLOR = (0, 0, 0)
FONT_COLOR = (255, 255, 255)
DIFFICULTY = {
'easy': 10,
'medium': 25,
'hard': 40
}
class Game:
... | true |
592a93202545cc27955482b5ec82800ea78012e3 | Python | JiahangGu/leetcode | /DFS+BFS/src/20-10-16-207-course-schedule.py | UTF-8 | 2,423 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
# @Time:2020/10/16 11:52
# @Author:JiahangGu
from typing import List
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
"""
判断图中是否存在环,使用拓扑排序判断。BFS方法求解拓扑排序时,每次在弹出队首元素后,
将所有邻点的结点入度-1,并将入度为0的结点放入队列中。弹出队列的元素顺序就是... | true |
d1f4d55299894d251eb48076873f246c5778fe4b | Python | jdassonvil/OpenClassRoom | /table7_deffonction.py | UTF-8 | 132 | 3.21875 | 3 | [] | no_license | def table(nb):
i=0
while i<10:
print(i+1,"*",nb,"=",(i+1)*nb)
i+=1
print("merci beau gosse !")
table(8)
| true |
fccc8174cd7607146fe3b03e8e02ce07c02f3635 | Python | nodepy/nodepy | /src/nodepy/utils/path/urlpath.py | UTF-8 | 4,055 | 2.53125 | 3 | [
"MIT"
] | permissive | # The MIT License (MIT)
#
# Copyright (c) 2017-2018 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | true |
7697c03ccbf86647c1cb6738e0b908a4c27de193 | Python | wcmaclean/home-repo | /Python_Ruby/surf_spy_client_server/surf_spy_client.py | UTF-8 | 514 | 2.59375 | 3 | [] | no_license | # surf_spy_client.py
#
# Will MacLean
# CSPP 51060
# Final Project
#
import socket
import sys
# variables, for ease of editing
host = 'localhost'
port = 56767
backlog = 5
size = 16384
# grab hostname from command-line input
if (len(sys.argv) == 2):
host = sys.argv[1]
else:
pass
# create socket
s = s... | true |
7cfe75f4eb6c03dbe9bb938954ca3a48601943b6 | Python | muthazhagu/EPA | /ViolationRecord.py | UTF-8 | 2,371 | 2.6875 | 3 | [] | no_license | from decimal import Decimal
class ViolationRecord:
"""
This class encapsulates the recommendation data.
"""
def __init__(self):
self.year = ''
self.state = ''
self.efsi = ''
self.fsn = ''
self.lead_latest, self.lead_mean = 'no data', 'no data'
self.co_la... | true |
2451e398988872784f2ea63875660e5ce9c559f4 | Python | AllenKd/algorithm_practice | /second_stage/pythagorean_triplet_in_array.py | UTF-8 | 435 | 3.421875 | 3 | [] | no_license | def pythagorean_triplet(arr):
arr = sorted([i ** 2 for i in arr])
for i in range(len(arr)-1, 1, -1):
j = 0
k = i - 1
while j < k:
if arr[j] + arr[k] == arr[i]:
return True
elif arr[j] + arr[k] < arr[i]:
j += 1
else:
... | true |
01b7c371c432dd20ec30b296d6fa0d80c27e47be | Python | jcai0o0/My_Leetcode_Solutions | /September_2020/sep_21_Car_Pooling.py | UTF-8 | 376 | 2.828125 | 3 | [] | no_license | class Solution:
def carPooling(self, trips: List[List[int]], capacity: int) -> bool:
temp = []
for n, start, end in trips:
temp.append((start, n))
temp.append((end, -n))
temp.sort()
par = 0
for i in temp:
par += i[1]
if par > ca... | true |
2177b4a7362fb057b88d98a6a863454ef177d15b | Python | lishion/easy-spider | /easy_spider/core/recoverable.py | UTF-8 | 2,930 | 3 | 3 | [] | no_license | from abc import ABC, abstractmethod
from os.path import exists, join
from typing import List
from easy_spider.tool import pickle_load, pickle_dump, get_type_name
class Recoverable(ABC):
@abstractmethod
def stash(self, resource): pass
@abstractmethod
def recover(self, resource): pass
@classmetho... | true |
7ac1d75c5122dad09a7b891d2ad4dc0e0c3536a6 | Python | nikpaa/compress_project | /src/tests/lzss_test.py | UTF-8 | 1,041 | 2.90625 | 3 | [] | no_license | import unittest
from lzss import lzss_encode, lzss_decode
class TestLZSSFunctionality(unittest.TestCase):
def test_simple_encode(self):
test_string = bytearray(b'best test in bestest tester fest')
result_string = b'\x0cbest t\t\x05\x06in \t\r\x11\x10\x08er f\x07\x07'
self.assertEqual(lzss_... | true |
68e802610a169a6772b26cc5076fa2582da191fa | Python | Heron593/Heron_project | /Python/test_with_open_as.py | UTF-8 | 685 | 3.09375 | 3 | [] | no_license | import re
with open('d:/data.txt', 'w') as f:
f.write('hello world3')
'''open读写模式有:
rU 或 Ua 以读方式打开, 同时提供通用换行符支持 (PEP 278)
w 以写方式打开,
a 以追加模式打开 (从 EOF 开始, 必要时创建新文件)
r+ 以读写模式打开
w+ 以读写模式打开 (参见 w )
a+ 以读写模式打开 (参见 a )
rb 以二进制读模式打开
wb 以二进制写模式打开 (参见 w )
ab 以二进制追加模式打开 (参见 a )
rb+ ... | true |
f334afca6ed166b2c18bb37b8c82fc29cc58ddf8 | Python | jfc4050/SLAlgorithms1 | /Deterministic Selection.py | UTF-8 | 1,697 | 3.6875 | 4 | [] | no_license | def dSelect(arrA, queryIndex, lIndex=0, rIndex=None):
# returns value of arrA[queryIndex]
if rIndex is None:
rIndex = len(arrA)
if lIndex == rIndex:
# terminate if array length reaches 0
return
if rIndex-lIndex <= 5:
# select first element as pivVal if array size is... | true |
3a0997b173170edb516c4c105911593be6d297f8 | Python | sikdarsaurav10/RestAPI | /zenithApp/webApp/restrauntapi/routes.py | UTF-8 | 5,684 | 2.71875 | 3 | [] | no_license | import random
import string
from flask import Blueprint, jsonify, request, url_for, make_response
from webApp import db
from webApp.models import Food, Menu
from webApp.utils import save_rest_pic, login_required
food = Blueprint('Food', __name__)
# to save or push a new restraunt record
@food.route('/food_details/ne... | true |
8ba7c0a13ef72657bb1eb02578f777cffbfaed18 | Python | lessunc/python-guanabara | /task058.py | UTF-8 | 1,272 | 4.34375 | 4 | [
"MIT"
] | permissive | #coding: utf-8
#-----------------------------------------------------------------
# Um jogo em que o programa escolhe um número entre 0 e 10.
# Pedindo em seguida que o jogador adivinhe qual foi, recebendo
# valores até que esse seja igual ao escolhido pelo programa, e
# retornando quantas partidas foram necessári... | true |
82a32f62172bfcd943b1ea9dbe1adddce00732b8 | Python | flrobson77/febrace | /facesample08.py | UTF-8 | 601 | 3.171875 | 3 | [] | no_license | import face_recognition
import os
from PIL import Image
image = face_recognition.load_image_file('./images/robrodtar.jpg')
face_locations = face_recognition.face_locations(image)
#(Array) Coordenadas de rostos encontrados
print ("Foram encontraas ", format(len(face_locations)), "face(s) nessa imagem")
for face_locat... | true |
70a238a363498d0ce4d8f113c2e655834bccc499 | Python | MFarelS/instagram_static | /main.py | UTF-8 | 2,011 | 2.640625 | 3 | [] | no_license | import requests, threading,time
from datetime import datetime
import matplotlib.pyplot as plt
hed = {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0'}
trakhir = 0
krg = 0
pengurangan = [0,0,0,0,0,0,0] #ambil 6 data atau 60 menit
ttt = ['60 Menit lalu','50 Menit lalu','40 Menit lalu','... | true |
5fbbd9d3cfc0fdb1f11a7b7cea5e6621a089aaa2 | Python | h3nok/MLIntro | /Notebooks/core/database/data_mappers/test_classification_group.py | UTF-8 | 1,622 | 2.65625 | 3 | [] | no_license | from unittest import TestCase
from data_mappers.classification_group import viNetClassGroup, viNetClassGroupMapper
from tabulate import tabulate
from vinet_frame_label import viNetTrainingFrameLabel
class TestClassGroupMapper(TestCase):
class_group = viNetClassGroup('Python-Test-Classification-Group', comment="Te... | true |
712a88c36db609ca313b1c80af4a244b563d9bb1 | Python | Showherda/aoc2020 | /aoc_09_2.py | UTF-8 | 363 | 2.8125 | 3 | [] | no_license | import sys
sys.stdin=open('input.txt')
inp=[int(v) for v in sys.stdin.readlines()]
n=len(inp)
val=542529149
num=inp.copy()
for i in range(1, n):
num[i]+=num[i-1]
p1=0
while p1<n:
p2=p1
while num[p2]-num[p1]<val:
p2+=1
if p2-p1>1 and num[p2]-num[p1]==val:
print(min(inp[p1+1:p2+1])+max(inp[p1+1:p2+1]))
while p2>... | true |
6dc9e83e24d1a2e0243fc5b60b1ac4f41a843a7f | Python | Lv-474-Python/ngfg | /src/tests/app/helper/test_row_validation.py | UTF-8 | 1,062 | 3.125 | 3 | [] | no_license | """
Tests for a google sheet row validator
"""
from app.helper.row_validation import validate_row
def test_validate_row_valid():
"""
Test for validate_row()
Test case for when row has been specified correctly
"""
row = 'AAA123'
assert validate_row(row) is True
def test_validate_row_extra_le... | true |
0f542843dcc5a0fd107b8f96a917e5da8bfc11dc | Python | Nahom-S/python-file | /amharic app.py | UTF-8 | 686 | 2.921875 | 3 | [] | no_license | from tkinter import *
me = Tk()
me.title("ልምምድ")
e = Entry(me, width=35, bg="blue", fg="yellow", borderwidth=5)
e.grid(row=0, column=1, columnspan=1, padx=40, pady=40)
def button1():
try:
x = e.get()
e.delete(0, END)
c = int(x) + 1
e.insert(0, c)
except:
e.delete(0, E... | true |
74ec49b19db64ebcbb1d43b9f7f27ba182b5313c | Python | troyhonegger/agbot-srvr | /lib/darknet_wrapper.py | UTF-8 | 2,027 | 2.671875 | 3 | [] | no_license | '''
This module allows us to run darknet on in-memory images, rather than writing an image to
disk and then reading it again using darknet. This should substantially speed up the process.
Admittedly, most of this is shamelessly copied off the Internet, with very minimal modifications.
Credits go to Glenn Jocher for a ... | true |
bb64ca6c4a927ef11c2325923372e914579449b5 | Python | BIRDDYTTP/elabProgrammingConcept | /python/trial/กบกระโดด.py | UTF-8 | 580 | 3.984375 | 4 | [] | no_license | depth = int(input("Enter the depth of the well : "))
jump = int(input("Enter the height the frog can jump : "))
slip = int(input("Enter the height the frog slips down : "))
day = 1
if jump == slip:
print("The frog will never escape from the well.")
else:
while depth > jump :
leaps = depth - jump
... | true |
b39a12b1e2fc5afc819743a89686db86824055c0 | Python | IngabireTina/m_blog | /tests/comment_test.py | UTF-8 | 1,585 | 2.59375 | 3 | [] | no_license | import unittest
from app.models import Comment, Blog, User
from app import db
class CommentModelTest(unittest.TestCase):
def setUp(self):
self.new_comment = Comment(id = 1, comment = 'comment', user = self.user_tina, blog_id = self.new_blog)
def tearDown(self):
Blog.query.delete()
... | true |
7be7588b778c00f9a7f6f46d33588be5cdb6bcf6 | Python | jeffrey-hsu/w266-project-patent | /bag_of_words/patent_counter.py | UTF-8 | 1,913 | 3.21875 | 3 | [] | no_license | '''Simply counts the number of patents in the
csv file.'''
from datetime import datetime as dt
def clump(filename):
'''Sorts through the lines, combining them according
to patent number, and outputs the joined text.'''
# Initialize values
last_patent_number = 0
clump_text = ''
with open(file... | true |
54830ebe784b155875ae9ed5bcd35094ee19536a | Python | PengFrankJi/machine_learning | /LogisticRegression/Logistic.py | UTF-8 | 6,314 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import statsmodels.api as sm
import pylab as pl
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import statsmodels.api as sm
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_curve, auc ###计算roc和au... | true |
94a27b5b5a5f4f772a6b0a1eb168b1f8e7358d5a | Python | mmubarak0/TimeTracker | /time.py | UTF-8 | 8,994 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python3
import time
import os
import shelve
import datetime
# TODO > start counting the time when I start this program (start_time) $START
# TODO > pause counting the time when I press P (pause_time)
# TODO > continue counting the time when I press n (continue_time)
# TODO > stop counting the time when I p... | true |
1c3024ab9db9d26e95daa20e6cb981c064b09f18 | Python | hexane360/pyRPC | /pyrpc/test_marshal.py | UTF-8 | 2,460 | 2.75 | 3 | [] | no_license | import math
import re
import pytest
import numpy as np
from .marshal import marshal_to_str, unmarshal_from_str
from .marshal import marshal_obj
from .marshal import marshal, unmarshal
from .marshal import MARSHAL_VERSION_STR
TEST_ROUNDTRIP = {
"int": 5,
"float": 1./32.,
"infinity": math.inf,
"complex": complex(... | true |
624af699a94883688daf8c52c1b4115bfc42c5a0 | Python | HenriqueSilva29/infosatc-lp-avaliativo-06 | /atividade 2.py | UTF-8 | 292 | 3.5625 | 4 | [] | no_license | caracter = ""
def parametroCaracter ():
caracter = input ( "Insira os caracteres {[()]}:" )
if "{[()]}" in caracter:
print ( "Parâmetro certo" )
return true
else:
print ( "ops, algo está errado!" )
return false
parametroCaracter () | true |
0237bbc540daab859fb1efec7740c0f827901989 | Python | Paruyr31/Basic-It-Center | /Basic/Homework.2/21_.py | UTF-8 | 200 | 3.453125 | 3 | [] | no_license | a = int(input("a = ")) # nermucum enq a
b = int(input("b = ")) # nermucum enq b
c = int(input("c = ")) # nermucum enq c
max = a
if b>max:
max = b
if c>max:
max = c
print("Max = "+str(max))
| true |
4adfc4672d7817e46706f81b0a75518436a71c22 | Python | paulhkoester16/automatic_diff | /automatic_diff/activations.py | UTF-8 | 452 | 3 | 3 | [] | no_license | '''
Standard library of activation functions, implemented for dual numbers.
https://en.wikipedia.org/wiki/Activation_function
'''
from automatic_diff.dual_number import DualNumber
def identity(d: DualNumber):
'''Identity activation'''
return d
def softsign(d: DualNumber):
'''Softsign activation'''
... | true |
a64151e7e9ce7fdb013470ce6b6f0df8619bc058 | Python | arlenk/pi-monitor | /pi_monitor/configuration/parser.py | UTF-8 | 1,641 | 3.109375 | 3 | [
"MIT"
] | permissive | import os
from pathlib import Path
import toml
def parse_config(config_file: str, dotenv_file: str, include_os_env: bool) -> dict:
"""
Parse configuration file(s)
"""
config_file = Path(config_file)
if not config_file.exists():
raise IOError("could not find config file: {}".format(config... | true |
185b664c190a9719de4fb1787cba8b2277c8eba7 | Python | ymm000596/dac | /play.py | UTF-8 | 1,655 | 2.59375 | 3 | [] | no_license | #===================================================================
# FileName: play_audio.py
# Author: Yin Mingming
# Email: ymingming@gmail.com
# WebSite: http://www.????.com
# CreateTime: 2010.01.01
#===================================================================
import time
import numpy as n... | true |
10f51dd4a5fb286a8792b6009658ac20c1365352 | Python | Assaf-Mor/Blind-75-Must-Do-Leetcode | /CombinationSum.py | UTF-8 | 755 | 3.28125 | 3 | [] | no_license | class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
result = [] # init the result set
def dfs(i, current, total):
if total == target:
re... | true |
ad9d670ce7319be6c1dac8702c94cce6a8805718 | Python | IraPS/homework | /1.py | UTF-8 | 844 | 2.875 | 3 | [] | no_license | import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet
wnl = WordNetLemmatizer()
file = open('input.txt', 'r', encoding='utf-8')
text = file.read().split()
t = 'he was learning how to drive'.split()
print(type(t))
t = nltk.pos_tag(t)
mappedtags = {'NN': 'n', 'NNS': 'n', 'NNPS': 'n', 'NNP... | true |
7705cfc440d27f113c61f9059a3caf84c8f97c09 | Python | thebusfactor/p11 | /src/model/bus.py | UTF-8 | 1,402 | 3.125 | 3 | [
"MIT"
] | permissive | # MIT License
# Copyright (c) 2018 ENGR301-302-2018 / Project-11
class Bus:
"""
Parameters
----------
tl_x: int
Top left x coordinate.
tl_y: int
Top left y coordinate.
br_x: int
Bottom right x coordinate.
br_y: int
Bot... | true |
107ecccac093a3904fede11ca0abcbcc23ab2083 | Python | betty29/code-1 | /recipes/Python/146066_Exiting_loop_single_key/recipe-146066.py | UTF-8 | 570 | 3.375 | 3 | [
"Python-2.0",
"MIT"
] | permissive | import msvcrt
while 1:
print 'Testing..'
# body of the loop ...
if msvcrt.kbhit():
if ord(msvcrt.getch()) == 27:
break
"""
Here the key used to exit the loop was <ESC>, chr(27).
You can use the following variation for special keys:
if ord(msvcrt.getch()) == 0:
if ord(msvcrt.getch()) =... | true |
88c0b1031a0e46c762b35450c7a1e8d1e2cb8252 | Python | egrahl/iolite | /src/iolite/overlaps/overlapping_spots.py | UTF-8 | 30,939 | 2.8125 | 3 | [
"BSD-2-Clause"
] | permissive | import itertools
from timeit import default_timer as timer
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import pylab
from dials.array_family import flex
from dxtbx.model.experiment_list import ExperimentListFactory
from dials.util.options import flatten_experiments
class OverlapCounter:
""... | true |
f062ca3ae0bdae0412c8da652896e108764d9054 | Python | gittenberg/rosalind | /Finding a Shared Motif.py | UTF-8 | 810 | 3.140625 | 3 | [] | no_license | # https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring#Python_3
from Bio import SeqIO
input_file = 'rosalind_lcsm.txt'
with open(input_file) as f:
fasta_sequences = list(SeqIO.parse(f, 'fasta'))
sequences = [str(fasta.seq) for fasta in fasta_sequences]
def long_substr(data... | true |
4008b2b25e909f87aa36747e74371b26692549f9 | Python | Lirein/vosk-server | /websocket/test_gram.py | UTF-8 | 3,474 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import os
import sys
import pathlib
import random
import re
def readFile(path: str) -> tuple:
read_data = []
with open(path, "r") as f:
read_data = f.readlines()
return read_data
def parseGram(grammar: tuple) -> dict:
gramdata = {}
publicgrams = {}
for line in g... | true |
004e09d1fd8687702d589e52b9190c9d9e534525 | Python | beatrizgoa/TFM | /LearningTheano/Ejemplos_sencillos_theano.py | UTF-8 | 2,929 | 3.5625 | 4 | [] | no_license | import theano
import theano.tensor as T
print '----------------------'
print 'Funcion'
print '---------------------'
###################
#FUNCIoN LOGISTICA:
###################
#Se define la variable simbolica en forma de matriz
x = T.dmatrix('x')
#Se define la sigmoide
s = 1 / (1 + T.exp(-x))
#Se crea la funciOn d... | true |
1b68affb3d87351c40f3d3472ba14c0698ce40bb | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2417/60734/265174.py | UTF-8 | 265 | 2.859375 | 3 | [] | no_license | lst = list(map(int,input().split(',')))
max_n = min(lst)
flag = True
for i in range(2,max_n+1):
count = 0
for index in range(len(lst)):
if lst[index]%i == 0:
count+=1
if count==len(lst):
flag = False
break
print(flag) | true |
17f79789fb4dbfa4a050cbf0f499e6570b70182d | Python | hitaitengteng/mytool | /自然语言处理/textcompareutil.py | UTF-8 | 347 | 2.75 | 3 | [] | no_license | from difflib import Differ
a="17.3如发包方有证据认为承包方无法完全履行本合同而承包方无法提供有效的担保时,"
b="173如发包方有证虽“为采包方无法完全用行木合同而承包方无法提供有效的担保时"
d = Differ()
diff = d.compare(a.splitlines(), b.splitlines())
print('\n'.join(list(diff))) | true |
2274b2b394702b0c8f403492c66bc98f54ccba40 | Python | tjsdud594/BasicClass | /06.Crawling/4.selenium/step03mypagesearch.py | UTF-8 | 634 | 3.15625 | 3 | [] | no_license | # 미션 : 구글에서 검색 가능하게 step01 처럼 작업 권장
from selenium import webdriver
import time # 실행을 잠시 중지(sleep(초단위))
driver = webdriver.Chrome("c:/driver/chromedriver")
driver.get("http://127.0.0.1:5500/4.selenium/step03mypage.html")
# input tag
search_box = driver.find_element_by_name("data")
# button tag
# 검색버튼 찾기
btn = dri... | true |
d9281e89c000a3b6511793b74caab0d1aee7297d | Python | artemii-yanushevskyi/RemoteRetail | /TelegramBots/AsyncTelegramPython.py | UTF-8 | 3,150 | 2.53125 | 3 | [] | no_license | """
This is a echo bot.
It echoes any incoming text messages.
"""
import asyncio
import logging, time
from aiogram import Bot, Dispatcher, executor, types, exceptions
# to run aiogram we should create
# a new environment 'conda create --name py36 python=3.6' (/anaconda3/envs/py37)
# to activate it 'conda activate py37... | true |
bfb4ab1330697ec65392963bd8e25cad45bd345b | Python | SaraWestWA/TwitOff_SW | /twitoff/round_one/app_old.py | UTF-8 | 3,019 | 2.75 | 3 | [
"MIT"
] | permissive | '''"""'''
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from dotenv import load_dotenv
import os
from .db_model import DB, User, Tweet
from .twitter import add_user_tweepy, update_all_users
from .predict import predict_user
import traceback
load_dotenv()
def create_app():
... | true |
bb4ec6c8ae33056f681450fe4e2e69730b9b0544 | Python | Aasthaengg/IBMdataset | /Python_codes/p03337/s732659715.py | UTF-8 | 66 | 2.9375 | 3 | [] | no_license | a,b=map(int,input().split())
ans=max(a+b,a-b)
print(max(ans,a*b))
| true |
12fd64dc24c1a8d967b9249f90ef55dbdb4eb40a | Python | Flood1993/ProjectEuler | /p433.py | UTF-8 | 421 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 11:39:15 2013
@author: guillermo
"""
cont = 0
def gcd(n, m):
global cont
cont += 1
if n == m:
return
elif m > n:
return gcd(m, n)
# elif m == 1:
# return
elif n%m != 0:
return gcd(n, n%m)
benchmark = 11000
for i i... | true |
a8a9a2df9e80ee45868c8b1ed1e65fba290f3fb3 | Python | jaggergit/bot-tester | /issue-bot/handler.py | UTF-8 | 2,380 | 2.765625 | 3 | [] | no_license | import requests, json, os, sys
from github import Github
def handle(req):
"""handle a request to the function
Args:
req (str): request body
"""
event_header = os.getenv("Http_X_Github_Event")
req_user_agent = os.getenv("Http_User_Agent")
sys.stderr.write("User Agent: " + req_user_agen... | true |
52b0f51c044de8f7b47f895f3e8fcb8c78be7b59 | Python | yskang/AlgorithmPractice | /baekjoon/python/teleport_station_18232.py | UTF-8 | 1,102 | 3.078125 | 3 | [
"MIT"
] | permissive | # Title: 텔레포트 정거장
# Link: https://www.acmicpc.net/problem/18232
import sys
from collections import deque, defaultdict
sys.setrecursionlimit(10 ** 6)
read_list_int = lambda: list(map(int, sys.stdin.readline().strip().split(' ')))
def solution(n: int, m: int, s: int, e: int, stations: list):
visite... | true |
2a4c2a7bb90f0c55c24a875e95dd640fe99875f4 | Python | MicherlaneSilva/ifpi-ads-algoritmos2020 | /atividades/iteracao_WHILE/f3_q17_soma_inverso.py | UTF-8 | 636 | 4 | 4 | [] | no_license | def mostrar(cont_crescente, cont_decrescente, n):
if cont_crescente < n - 1:
print(f'{1}/{cont_decrescente} +', end = " ")
else:
print(f'{1}/{cont_decrescente} =')
def soma_inverso(n):
somatorio = 0
contador = 0
den = n
while contador < n:
... | true |
af4a5a78d5c2b01e89b02ce38f6dd5937126dcf9 | Python | sunqianggg/alltools | /keras/mnist_mlp_compare.py | UTF-8 | 2,144 | 2.9375 | 3 | [] | no_license | #encoding:utf8
'''
compare NN to another classify approaches like (svm,regression).
'''
from keras.datasets import mnist
import numpy as np
from keras.utils import np_utils
from sklearn import svm
# the data, shuffled and split between train and test sets
(X_train, y_train), (X_test, y_test) = mnist.load_data()
X_tra... | true |
cdf27515a22178fbe50a82245b34b24fa457a55f | Python | qcrew-lab/qcore | /codebase/datasaver/plot.py | UTF-8 | 2,276 | 2.96875 | 3 | [] | no_license | import numpy as np
from qcrew.codebase.analysis.fit import do_fit, eval_fit
def fit_analysis(data: dict, i_tag: str, q_tag: str, x: np.ndarray, fit_function: str) -> None:
if i_tag in data.keys():
last_avg_i = data[i_tag][-1]
else:
raise ValueError(f"No data for the tag {i_tag}")
if q_tag... | true |
2635985781e149b307532f2e3834ea73c52fd497 | Python | EwenFin/exercism_solutions | /python/robot-simulator/robot_simulator.py | UTF-8 | 1,101 | 3.890625 | 4 | [] | no_license | # Globals for the bearings
# Change the values as you see fit
EAST = 2
NORTH = 1
WEST = 4
SOUTH = 3
class Robot(object):
def __init__(self, bearing=NORTH, x=0, y=0):
self.bearing = bearing
self.x = x
self.y = y
@property
def coordinates(self):
return (self.x, self.y)
... | true |
7d0d78d30dfabfe674540a300ce16a28811754e0 | Python | epot/Domotic-prototype | /src/opennitoo/buscommand.py | UTF-8 | 506 | 2.734375 | 3 | [] | no_license | '''
Created on 22 janv. 2011
@author: epot
This module handles bus command messages
'''
class BusCommand():
'''
classdocs
'''
def __init__(self, who, what, where):
'''
Constructor
'''
self.who = who
self.what = what
self.where = where
def ... | true |
b83bd2e0b72bea6f1700b73b41307432bbaca4ac | Python | jcrumpton/py-mcftracker | /test.py | UTF-8 | 1,113 | 2.734375 | 3 | [
"MIT"
] | permissive | """
Copyright 2018 watanika, all rights reserved.
Licensed under the MIT license <LICENSE-MIT or
http://opensource.org/licenses/MIT>. This file may
not be copied, modified,or distributed except
according to those terms.
"""
import time
from mcftracker import MinCostFlowTracker
# Example usage of mcftracker
def main(... | true |
7abe2deb65bf33b9b5274969f5b9948f5c471515 | Python | KlemenGrebovsek/cargo-stowage-optimization | /src/core/benchmark/benchmark.py | UTF-8 | 2,194 | 2.75 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
from src.model.dataset import Dataset
from src.domain.cargo_space import CargoSpace
class BenchmarkC(object):
def __init__(self, dataset: Dataset):
self.Lower: int = 0
self.Upper: int = 1
self._dataset: ... | true |
2c5569c99d54e1fa5aa523b6071862f237bc6334 | Python | DemondLove/Python-Programming | /CodeFights/28. alphabetShift.py | UTF-8 | 951 | 4.53125 | 5 | [] | no_license | '''
Given a string, your task is to replace each of its characters by the next one in the English alphabet; i.e. replace a with b, replace b with c, etc (z would be replaced by a).
Example
For inputString = "crazy", the output should be alphabeticShift(inputString) = "dsbaz".
Input/Output
[execution time limit] 4 s... | true |
581d9ec7fbbba9654e2661d6feac9c2f979319f9 | Python | brauliotegui/SPICED | /Week_10/flask-app/recommender.py | UTF-8 | 2,703 | 2.90625 | 3 | [] | no_license | """Machine-Learning Code that returns movie recommendations"""
import numpy as np
from sklearn.decomposition import NMF
from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
import pickle5 as pickle
MOVIES = pd.read_csv('ml-latest-small/movies.csv')
RATINGS = pd.read_csv('ml-latest-small/ratings.c... | true |
1124f53f4cfc8b811e067349cc49078d1ad65549 | Python | n0thing233/n0thing233.github.io | /noodlewhale/amazon/VO/algorithm/207. Course Schedule.py | UTF-8 | 1,025 | 3.265625 | 3 | [] | no_license | #一遍bug-free
#topological sort, for indegree = 0 ,push to queue ,pop queue , if any node left, then cannot, else can
#time:O(V+E)
#space:O(E+V)
from collections import deque,defaultdict
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
neighbors = defaultdict(list)... | true |
7a443ab3885153c224a1135267315dd9f369c94c | Python | chris-0511/crawler | /Dating_software.py | UTF-8 | 866 | 2.765625 | 3 | [] | no_license | # ch23_3.py
import requests
import csv
def get_data(page):
url = 'http://www.lovewzly.com/api/user/pc/list/search?'
form_data = {'gender':'2', 'mary':'1', 'page':'1'}
# 傳遞參數
form_data['page']=page
datahtml = requests.get(url, params=form_data)
datas = datahtml.json()
nickname,bir,educat... | true |
a38302f284a9844f2ae458e6f9ace69b15d012d0 | Python | sbridgens/Basic_Scripts_Collection | /Test_BOTO_S3Downloader.py | UTF-8 | 745 | 2.828125 | 3 | [] | no_license | #!/usr/local/bin/python2.7
import os
import boto3
import sys
s3bucket='SomeBucket'
s3basekey='SomeKey'
s3asset=sys.argv[1]
def Download_From_S3():
try:
session = boto3.Session(profile_name='s3prod')
dl_client = session.client('s3')
print("[+] Attempting download of s3 media fi... | true |
b31e8a7cf46c0c4f459acd81f32f4c2ac930e462 | Python | FirebirdSQL/firebird-qa | /tests/bugs/core_3314_test.py | UTF-8 | 922 | 2.546875 | 3 | [
"MIT"
] | permissive | #coding:utf-8
"""
ID: issue-3681
ISSUE: 3681
TITLE: Dependencies are not removed after dropping the procedure and the table it
depends on in the same transaction
DESCRIPTION:
JIRA: CORE-3314
FBTEST: bugs.core_3314
"""
import pytest
from firebird.qa import *
init_script = """create ... | true |
b4776ae7c617a8cff2fb00b39571bd25b8ddb986 | Python | PushkrajSonalkar/Python11-07-2019 | /sets_prog/ex1.py | UTF-8 | 915 | 4.625 | 5 | [] | no_license | # creating a set
# Python program to demonstrate
# Creation of Set in Python
# Creating a Set
set1 = set()
print "Initial blank set\n", set1
# Creating a Set with
# the use of a String
set2 = set("Arnav")
print "\nSet with use of String:", set2
# Creating a Set with
# the use of a List
set3 = set(["Arnav", "Ravindr... | true |
cb0600bf47a369b59cf0f18c0f9e84fc8c02c0be | Python | High-Bee/TIL | /Chatbot/python-recap-master/백준.py | UTF-8 | 1,641 | 3.984375 | 4 | [] | no_license | # 문제
# N개의 정수가 주어진다. 이때, 최솟값과 최댓값을 구하는 프로그램을 작성하시오.
# 입력
# 첫째 줄에 정수의 개수 N (1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에는 N개의 정수를 공백으로 구분해서 주어진다.
# 모든 정수는 -1,000,000보다 크거나 같고, 1,000,000보다 작거나 같은 정수이다.
# 출력
# 첫째 줄에 주어진 정수 N개의 최솟값과 최댓값을 공백으로 구분해 출력한다.
# 예제 입력 1
# 5
# 20 10 35 30 7
# 예제 출력 1
# 7 35
import sys
<<<<<<< HEAD
# n = int(i... | true |
98bea716038dd2e5db3c2fb69b4730cb60c3d20d | Python | suitengu/recenh | /app/routes.py | UTF-8 | 4,414 | 2.65625 | 3 | [] | no_license | import json
import os
import requests
from app import app
from app.forms import UsernameForm
from flask import Flask, flash, request, redirect, url_for, abort
from flask import send_from_directory
from flask import render_template
from werkzeug.utils import secure_filename
from bs4 import BeautifulSoup
HEADERS = {
... | true |