blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
be8f74603a3e71a79909e960f00fa4bde998216c | Drummersbrother/rays-2019-teamwork | /scratch/hugo/mnist_fmnist/fashionmnist_scratch.py | UTF-8 | 3,780 | 3 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib as mpl
import matplotlib.cm as mplcm
from matplotlib import pyplot as plt
from tensorflow import keras
def show_pic(pic):
plt.figure()
plt.imshow(pic)
plt.colorbar()
plt.grid(False)
plt.show()
def show_pics(pics, labels):
plt.figur... | true |
06264f083ef86799cc4de24ec2dfb027af5bd42c | JLMengsk/leetCode | /String/Spiral_Matrix.py | UTF-8 | 2,389 | 3.9375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# @Time : 6/8/2020 6:40 PM
# @Author : Jupiter
# @Site :
# @File : Spiral_Matrix.py
# @Software : PyCharm
# Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
# Input:
# [
# [ 1, 2, 3 ],
# [ 4, 5, 6 ],
# [ 7, 8, 9 ]
# ]
# O... | true |
2608e6bb6a78e1bfaaf1901c78f8ae4d05e446a0 | mikesukim/ninestairs-1d1vAutomation | /WordCastBlogURL.py | UTF-8 | 4,867 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.com... | true |
fb41438b6093d1cd66f5e35664c9edb4507c7967 | DavidBitner/manipular-arquivo-texto | /modules/defs.py | UTF-8 | 5,516 | 3.796875 | 4 | [
"MIT"
] | permissive | def separador():
print('*' * 50)
def print_centralizado(txt):
print(f'{txt}'.center(50))
def print_personalizado(txt):
print('*' * 50)
print_centralizado(txt)
print('*' * 50)
def continuar():
input('Pressione enter para continuar...')
def gerar_numero(txt='lul'):
entrada = int(input(... | true |
afbaed56d9cb1374cecdaa66a4599ae72e078f9a | jiangshen95/UbuntuLeetCode | /BinaryTreePaths3.py | UTF-8 | 971 | 3.65625 | 4 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def binaryTreePaths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
if not root:
return []
paths = []
st... | true |
cab16afde85b337fbd83c4161059214c88fe5ffc | faizsyam/LatihanGit | /day6.py | UTF-8 | 5,093 | 3.515625 | 4 | [] | no_license |
# def bebas(kalimat, huruf) :
# rmv = kalimat.replace(huruf.upper(), '')
# rmv = rmv.replace(huruf.lower(), '')
# print(rmv)
# bebas('Anugrah', 'a')
# def MainSuit(ply1, ply2) :
# yang_boleh = ['batu', 'gunting', 'kertas']
# if not any(ply2 in s for s in yang_boleh) and not any(ply2 in s for s i... | true |
d6d3097317199a7fbd4d5ff9d46433cf3a87d34d | Minh-An/FCND-Motion-Planning | /planning_utils.py | UTF-8 | 3,932 | 3.03125 | 3 | [] | no_license | from enum import Enum
from queue import PriorityQueue
from bresenham import bresenham
from scipy.spatial import Voronoi, voronoi_plot_2d
import numpy as np
import numpy.linalg as LA
def create_grid_and_edges(data, drone_altitude, safety_distance):
"""
Returns a grid representation of a 2D configuration space
... | true |
54ff4cc20a575ba503b0893d4151492f4d04ac95 | indrawaspada/online_process_monitoring_using_incremental_state-space_expansion_an_exact_algorithm | /pm4py/algo/filtering/tracelog/start_activities/start_activities_filter.py | UTF-8 | 5,279 | 2.515625 | 3 | [] | no_license | from pm4py.algo.filtering.common.filtering_constants import DECREASING_FACTOR
from pm4py.algo.filtering.common.start_activities import start_activities_common
from pm4py.algo.filtering.tracelog.variants import variants_filter
from pm4py.objects.log.log import TraceLog
from pm4py.objects.log.util.xes import DEFAULT_... | true |
672431812ff5b3b39b0da06adb8f55991b91e432 | sainihimanshu1999/Data-Structures | /June2021/BackTrack/BinaryWatch.py | UTF-8 | 685 | 3.390625 | 3 | [] | no_license | '''We use simple recurrsion in this question, but it was quite tricky'''
def binaryWatch(nums):
def dfs(led,index,hours,minutes,n):
if hours>=12 or minutes>=60:
return
if not n:
result.append(str(hours)+':'+'0'*(minutes<10)+str(minutes))
return
if i... | true |
a90a5c4a108ded347e164b17804852b11bc19588 | redacted/XKCD-password-generator | /tests/test_xkcdpass.py | UTF-8 | 6,783 | 2.71875 | 3 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"CC-BY-3.0",
"BSD-3-Clause",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"EUPL-1.1",
"CC-BY-SA-3.0",
"CC-BY-4.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | """ Unit test for `xkcd_password` module. """
from subprocess import PIPE, Popen
import argparse
import io
import re
import sys
import unittest
try:
import unittest.mock as mock
except ImportError:
# python2.7 support via external lib
import mock
from xkcdpass import xkcd_password
WORDFILE = 'xkcdpass/s... | true |
e62a68af1bf1c9f7c62ed11fa97abb5b0c734d4c | aisola/ArcadeGames | /arcadegames/blockslib/PlayerClass.py | UTF-8 | 2,246 | 3.515625 | 4 | [] | no_license | #--------------------------------------------------------------------------------
# @file : PlayerClass.py
# @package: See __init__.py
# @author : See __init__.py
# @license: See __init__.py
#--------------------------------------------------------------------------------
import sys, os, math, random
import pygame
... | true |
1e54d9f9de275d9fd6756884d64464e6051fedf8 | dimdred/introduction_to_python | /part_1.py | UTF-8 | 508 | 3.671875 | 4 | [] | no_license | #дзен питона
import this
# встроеная помощь
help(help)
#все есть объект
#список методов класса ( если метод начинается c__ это специальные методы)
dir(int)
dir(1)
dir(dir)
# узнать тип объекта
type(1)
type('hello')
type(type)
# пример (ряд Фибоначчи)
n = 10
a = 0
b = 1
for i in range(n):
temp = a
a = b
... | true |
f2883203dc8e5e23ef27d0ddfa3741739fbb9a83 | wong02/inf1340_2015_asst1 | /exercise2.py | UTF-8 | 1,582 | 4.40625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
""" Assignment 1, Exercise 2, INF1340, Fall, 2015. Name that shape.
This module contains one function name_that_shape(). It prompts the user
to input the number of sides in a shape and outputs the name of the shape.
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = ... | true |
d56c580fad11f7bd87d5afac118f01c4d90093cf | CristianoPatricio/ZSL_Thesis | /Datasets/PubFig/extract_feats_im_crop.py | UTF-8 | 1,840 | 2.734375 | 3 | [
"MIT"
] | permissive | """
Python script to extract image features of the PubFig dataset.
"Attribute and Simile Classifiers for Face Verification,"
Neeraj Kumar, Alexander C. Berg, Peter N. Belhumeur, and Shree K. Nayar,
International Conference on Computer Vision (ICCV), 2009.
Author: Cristiano Patrício
E-mail: cristiano.patricio@ubi.pt
Un... | true |
cf4d159d996443c2cf8cde0418cd2d68d153959c | 0xmikemikemike/dotdotdot | /cesar2.py | UTF-8 | 613 | 2.65625 | 3 | [] | no_license |
plainText = """qweltzicrqktykmutdcxdtazxdkzgnyc
kwdiyqbadtlsoxlnxljihhnqltjzfjqx
acsnbbgkckqygmicwcdowfrzjrwjbzln
cbckhrjtdympjeljpxkbshiulfbgjafk
vcxhwbdwgfaovkgbiznfplzmushqarxz
erawqpwiuhjluqjkfsdumbdxeewzqwnn
zpyfuuqmqocoqextvypjwsfmdpqiiuby
txohmjtyxlkojsdgzdbhmdnotbiaypdn
ehmvsfijzzpwvkwcrrbzkzheheoroguy
bdsokyc... | true |
3a74daf98850cbd305641ad618e58e2b770410ba | Tconan99/Codeforces | /ac/Codeforces 1362A - Johnny and Ancient Computer.py | UTF-8 | 727 | 2.859375 | 3 | [] | no_license | # https://codeforces.com/problemset/problem/1362/A
import sys
import os
import heapq
import math
try:
path = "./file/input.txt"
if os.path.exists(path):
sys.stdin = open(path, 'r')
# sys.stdout = open(r"./file/output.txt", 'w')
except:
pass
t = int(input())
def printd(value):
# print... | true |
ed9ffe31fea5a7ee4bed81f5cf0e3761afedadf4 | felipequecole/pet_prod | /jogo/logica/Time.py | UTF-8 | 1,012 | 2.734375 | 3 | [] | no_license | from django.http import JsonResponse
class Estatistica:
entrada = []
saida = []
caixa = []
def __init__(self, caixa_inicial = 20000):
self.entrada.append(0)
self.saida.append(0)
self.caixa.append(caixa_inicial)
def nova_rodada(self, entrada, saida):
self.entrada... | true |
51b5a71dfc7d674cbdcaac37ae28520d8f773822 | VRufov/python_tail | /tail.py | UTF-8 | 2,276 | 2.796875 | 3 | [] | no_license | import os
import time
from pathlib import Path
from typing import BinaryIO
from parser import init_args_parser
from exceptions import IsNotFile, FileDeleted
def get_last_update(filepath: str) -> float:
stats = os.stat(filepath)
return stats.st_mtime
def is_file(filepath: str) -> bool:
return Path(fil... | true |
ff248f08649e058f22215b50be1a68122d09d9cf | Robert-Kolodziej/Python-Progams- | /ReadAFileAllAtOnce.py | UTF-8 | 260 | 3.734375 | 4 | [] | no_license | #ReadAFileAllAtOnce.py
#Read a file all at once
def main():
filename = input("Enter the file name, including the suffix: ")
wordFile = open(filename, "r")
contents = wordFile.read()
print (contents)
wordFile.close()
main()
| true |
8dc2389ba9d1b9283b5a6d75e77c468b48eba75c | leejy001/Algorithm | /Python/Practice/programmers_018.py | UTF-8 | 493 | 3.09375 | 3 | [] | no_license | def solution(n):
cnt = 0
answer = [True] * (n+1)
m = int(n ** 0.5)
for i in range(2, m+1):
if answer[i] == True:
for j in range(i+i, n+1, i):
answer[j] = False
for i in range(2, n+1):
if answer[i] == True:
cnt+=1
return cnt
# set을 이용한 풀이... | true |
09ed1bbad01fac8ad0b7caed3dd93cab105ae98e | LucasMassucci/Exercicios-Python | /Exercícios/imprime_matriz.py | UTF-8 | 321 | 3.078125 | 3 | [] | no_license | def imprime_matriz(minha_matriz):
linhas = len(minha_matriz)
colunas = len(minha_matriz[0])
for i in range(linhas):
for j in range(colunas):
if(j == colunas - 1):
print(minha_matriz[i][j], end = "\n")
else:
print(minha_matriz[i][j], end = " ")... | true |
5c8ba1e60c1b2fe17aea9bea8da965a552210030 | BjarkiThorJons/netforritun | /lokaverkefni/server.py | UTF-8 | 1,730 | 2.71875 | 3 | [] | no_license | import socket
import _thread
from tkinter import Tk
from tkinter.filedialog import askopenfilename
import os
HOST = socket.gethostname()
PORT = 12345
s = socket.socket()
s.bind((HOST,PORT))
s.listen(2)
c, addr = s.accept()
def faSkilabod():
while True:
try:
skilabod = c.recv(1024... | true |
5598ae18fd131c2c1033e4d22c8610c80316b373 | sonicwu/hacker-rank | /artificial-intelligence/bot_clean_partially_observable.py | UTF-8 | 4,400 | 3.078125 | 3 | [] | no_license | #!/bin/python
import random
import os.path
class Node:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def dist_to(self, target):
return abs(target.x - self.x) + abs(target.y - self.y)
def next_move(posx, posy, board):
n = len(board)
# read cleared nodes from the state fi... | true |
b95849b5d83f02e90b591a28491cbbd8ea7216d7 | sitedata/pyIsEmail | /tests/validators/__init__.py | UTF-8 | 2,830 | 2.546875 | 3 | [
"MIT"
] | permissive | import os
import sys
import xml.etree.ElementTree as ET
from pyisemail.diagnosis import CFWSDiagnosis, DeprecatedDiagnosis
from pyisemail.diagnosis import DNSDiagnosis, InvalidDiagnosis
from pyisemail.diagnosis import RFC5321Diagnosis, RFC5322Diagnosis
from pyisemail.diagnosis import ValidDiagnosis
__all__ = ["create_... | true |
13164f149f6875f912965bd42da9c39b93600f0c | shinshiner/Reinforcement-Learning-RL- | /Tensorflow Learning/Base Part/baseProcess.py | UTF-8 | 1,010 | 3.015625 | 3 | [] | no_license | # naive training, train a list of parameter (W & b)
# with these settings, the result will converge by 2500 steps
import tensorflow as tf
import numpy as np
# construct data set
target = [0.123, 0.234, 0.345, 0.456, 0.567, 0.678, 0.789, 0.898, 0.987, 10.654]
_x = np.float32(np.random.rand(10, 1000))
_y = np.dot(targe... | true |
754e08e39e10c72c9110dd0a60408081bc40706a | charlierproctor/tinderx | /core/user/swipe.py | UTF-8 | 1,369 | 2.65625 | 3 | [] | no_license | from ..db import Mongo
from ..profile import Profile
import cv2
import numpy as np
# swipe on a particular profile
def swipe(self,profile,direction,prediction):
print "*"*20, "PROCESS SWIPE", "*"*20
db = Mongo()
# like / dislike the profile accordingly
if direction == 'left':
res = db.dislike_user(self.fbid,p... | true |
2fd44e72d72d3c0d045eb074416d07cf5095bbec | huangketsudou/leetcode_python | /List/canConstruct.py | UTF-8 | 405 | 2.9375 | 3 | [] | no_license | class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
a=Counter(ransomNote)
b=Counter(magazine)
for k,v in a.items():
if k not in b or v>b[k]:
return False
return True
class Solution:
def canConstruct(self, ransomNote: str,... | true |
392919b53524bbf52cf9e4c71cb10ea7542d2c3d | jayantwu/studypython | /13.py | UTF-8 | 1,570 | 4.1875 | 4 | [] | no_license | """和静态方法比较类似,Python还可以在类中定义类方法,类方法的第一个参数约定名为cls,
它代表的是当前类相关的信息的对象(类本身也是一个对象,有的地方也称之为类的元数据对象),
通过这个参数我们可以获取和类相关的信息并且可以创建出类的对象"""
from time import time, localtime, sleep
class Clock(object):
"""数字时钟"""
def __init__(self, hour=0, minute=0, second=0):
self._hour = hour
self._minute = min... | true |
f4efb7cd09d38dcb3eb287218f93c794d9d2ed67 | tyronevb/data_miner | /scripts/tune_log_parser.py | UTF-8 | 2,776 | 2.765625 | 3 | [] | no_license | """
A script for tuning various log parsing methods implemented in LogParser.
Uses the ParserTuner class.
"""
__author__ = "tyronevb"
__date__ = "2020"
import sys
sys.path.append("../")
import argparse # noqa
from src.parser_tuner import ParserTuner # noqa
if __name__ == "__main__":
parser = argparse.Argumen... | true |
9fe094874cd20e9312eecd573d8fb3f16f5a4927 | frogfather78/python-cc | /cap 6-dictionaries/6-1_person.py | UTF-8 | 329 | 3.6875 | 4 | [] | no_license | #6-1 person
#a dictionary about a person
person_0 = {
"last_name": "Hughes",
"first_name": "Ass",
"city": "Los Angeles",
"phone_no": "555-7634"
}
print("Name: " +
person_0["first_name"] + " " +
person_0["last_name"] + ".")
print("Call: " +
person_0["city"] + " " +
person_0["phone_no"] +
" for a good time,... | true |
3f944cfb52fc1f0c32bc8e3297eb9414d6a2087f | Lavenderjiang/Hac112_f17 | /aubio/freq_amp.py | UTF-8 | 2,515 | 2.59375 | 3 | [] | no_license | import aubio
from workingaubio import *
from pydub import AudioSegment
from audio_segment_demo import *
def detect(filename):
downsample = 8
samplerate = 44100 // downsample
win_s = 4096 // downsample # fft size
hop_s = 512 // downsample # hop size
s = aubio.source(filename, s... | true |
0b3de31e42baa9a747a5ba903a11a9bc0c7e3282 | jyotiamage/Test_python | /sqlite_Demo.py | UTF-8 | 583 | 2.609375 | 3 | [] | no_license | import sqlite3
db=sqlite3.connect(':memory:')
db=sqlite3.connect(r'D:\TEM-Tivoli Endpoint Manager\Test_Python\mydb')
cursor=db.cursor()
#cursor.execute('''Create table Users(id Integer primary key, name text, phone text, email text unique, password text)''')
name1="Jyoti"
phone1="12345"
email1="user@example.com"
pas... | true |
006ee48dc0eb080bb9225bd556d5df82b2c303da | gabriellaec/desoft-analise-exercicios | /backup/user_325/ch15_2019_03_14_16_32_44_602971.py | UTF-8 | 100 | 2.921875 | 3 | [] | no_license | import math
def volume_da_pizza(r,a):
v=math.pi*(r**2)
return v
print (volume_da_pizza(2,1)) | true |
b986c452878b85bc590ff083f2842c500f6cd794 | leighbee/COMP173 | /lab2/server.py | UTF-8 | 2,232 | 2.875 | 3 | [] | no_license | #server
import socket, sys, os
port = int(sys.argv[1])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind( ("", port) )
s.listen(3) #listen on all ports
#print("server waiting on port", port)
while True:
#accept connection:
conn, address = s.accept()
#send a ready command
conn.send("READY".encode("UTF... | true |
f1194c84475b4499c6cb95a033362dfff761611c | leechoongyon/SystemTrading | /SystemTrading/das/data_model.py | UTF-8 | 3,185 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
import os,sys,datetime,pickle
import requests, json
import bs4 as BeautifulSoup
class BaseCollection:
def __init__(self):
self.items = {}
def clear(self):
self.items.clear()
def count(self):
return len(self.items.key())
... | true |
7055f238601de0c762b3bd4da413b382ab414faf | VitalyRomanov/document-clustering | /idf_index.py | UTF-8 | 340 | 2.8125 | 3 | [] | no_license | from tokenization import get_document_words
def build_idf_index(vocabulary,collection):
idf = {}
for w in vocabulary:
idf[w] = 0.
for doc in collection:
tokens = get_document_words(doc)
if w in tokens:
idf[w] += 1.
idf[w] = log(len(collection)/idf... | true |
6c2395994893db68900662f06ea255005e615405 | barclaysteven/python-sandbox | /exploration/basics/mathImports.py | UTF-8 | 73 | 2.90625 | 3 | [] | no_license | import math
print(math.pi)
print(math.sqrt(4))
print(math.factorial(5))
| true |
94768c1f82697218ca5526a21df318e0b7a8471a | BhavyanshM/3D_Motion_Capture | /nn.py | UTF-8 | 1,383 | 2.671875 | 3 | [] | no_license | import numpy as np
import time
n_hidden = 10
n_in = 10
n_out = 10
n_samples = 300
learning_rate = 0.01
momentum = 0.9
np.random.seed(0)
def sigmoid(x):
return 1.0*(1.0 + np.exp(-x))
def tanh_prime(x):
return 1 - np.tanh(x)**2
def train(x, t, V, W, bv, bw):
A = np.dot(x, V) + bv
Z = np.tanh(A)
B = np.dot... | true |
7fec0a1949e82d0e6b1a84f4feca6566837e6ddb | guangxush/Mozart | /generate_rl_data.py | UTF-8 | 990 | 2.734375 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
import pandas as pd
import numpy as np
def rl_data(data_path, j):
dataframe = pd.read_csv(data_path, header=0)
observation = []
reward = []
done = []
_ = []
_.append(np.array([0, 0, 0, 0]))
for i in range(10):
result_data = np.array(dataframe.ix[j, 5 * i:5 ... | true |
5ff4f0b4dc259f7c601888b851dc6f8277f8de8b | Tanmay53/cohort_3 | /submissions/sm_028_sagar/week_13/day_4/session_1/mirror_image.py | UTF-8 | 330 | 3.34375 | 3 | [] | no_license | a = 'AyzB'
cap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
small = 'abcdefghijklmnopqrstuvwxyz'
string = ''
for i in range(0,len(a)):
for j in range(0,len(cap)):
if(cap[j] == a[i]):
string += cap[-(j+1)]
for k in range(0,len(small)):
if(small[k] == a[i]):
string += small[-(k+1)]
pri... | true |
d5404bafc4c20b4b4fcf644b790eac8d43283cb6 | jellehelsen/dovetail | /dovetail/api/app/utils.py | UTF-8 | 678 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import json
import os
class Utils(object):
@staticmethod
def write_env_file(envs, file_path):
file_dir = os.path.dirname(file_path)
if not os.path.exists(file_dir):
os.makedirs(file_dir)
with open(file_path, "w") as f:
for key, value in envs.items():
... | true |
7d2608d4c8f90c95c55be9dbafb1d4e5eb0b0b56 | rhzx3519/leetcode | /python/11. Container With Most Water.py | UTF-8 | 472 | 3.25 | 3 | [] | no_license | class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
res = 0
l, h = 0, len(height) - 1
while l < h:
area = 0
if height[l] < height[h]:
area = (h-l)*height[l]
l +=... | true |
414b07070031d201d0f2b87c3cc092c00e2ed487 | CoolLikeGoose/messenger | /server.py | UTF-8 | 1,596 | 2.984375 | 3 | [] | no_license | import time
from datetime import datetime
from flask import Flask, request
messages = [
{'username': 'Jack', 'text': 'hello', 'time': time.time()},
{'username': 'Marry', 'text': 'Hi jack', 'time': time.time()}
]
app = Flask(__name__)
users = {
'jack': 'black',
'marry': '12345'
}
@app... | true |
9f4a38c4ee5b2cc9d272a2c02effd51b620569cc | CPSC-481/Connect4 | /minimaxFunctions.py | UTF-8 | 2,129 | 3.265625 | 3 | [] | no_license | from naryTree import swapTurnColor
from stateEvaluation import evaluateState
from naryTree import State
def minimax(stateTree, color):
isMax = getLeafMinOrMax(stateTree.isMax, stateTree.plyLevel)
currentLevelNodes = stateTree.leafs[:]
while currentLevelNodes[0].parent is not stateTree.root:
for st... | true |
a2a6b3c4aab6a996deea62172d840172ce23bf75 | mv2480/Fashion-MNIST | /mnist.py | UTF-8 | 1,626 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 20 14:40:52 2020
@author: 91989
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
# Importing the dataset
data_train = pd.read_csv('fashion-mnist_train.csv')
data_test = pd.read_csv('fashion-mnist_test.csv')
trainX = da... | true |
495f96f365ca11cb6d6149d11018764e28bc74d2 | answerrrrrrrrr/leetcode | /26.Easy.RemoveDuplicatesfromSortedArray.py | UTF-8 | 1,030 | 3.140625 | 3 | [] | no_license | class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# Set (extra space)
# 80ms+
# nums[:] = sorted(list(set(nums)))
nums[:] = list(set(nums))
nums.sort()
return len(nums)
# Remove duplicate... | true |
288629c7ad7cffb40303a152bfc3a7c1277a581b | TaimurGhani/PriceCheck | /app.py | UTF-8 | 5,635 | 2.609375 | 3 | [] | no_license | import requests, json
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from semantics3 import Products
import MySQLdb
app = Flask(__name__)
#Set up a client to talk to the Semantics3 API using your Semantics3 API Credentials
sem3 = Products(
api_key = "SEM... | true |
9e617303c82298d428ccf6c9b296f54ad4083581 | mandark97/Deep-Learning-Course | /trainer.py | UTF-8 | 3,061 | 2.6875 | 3 | [] | no_license | import json
from keras import backend as K
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.metrics import (AUC, BinaryAccuracy, FalseNegatives, FalsePositives,
Precision, Recall, TrueNegatives, TruePositives)
from sklearn.metrics import confusion_matrix
from utils impo... | true |
97bc87b22b4ba3ca00f13c00a0b01374f6670ea3 | rursino/carbon-cycle-feedbacks | /scripts/figures_and_results/fig_input_data.py | UTF-8 | 3,631 | 2.5625 | 3 | [] | no_license | """ Store all functionality to import and pre-process relevant input data for
past_trends figures here."""
""" IMPORTS """
from scipy import signal
import pandas as pd
import numpy as np
import xarray as xr
from copy import deepcopy
from core import inv_flux as invf
from core import trendy_flux as TRENDYf
import os
... | true |
d3dedf94650d889acfb2ea62bdf64f7384268848 | Jingyi-Wang-jessie/leetcode | /127 WordLadder.py | UTF-8 | 1,879 | 3.625 | 4 | [] | no_license | '''
_ot
h_t
ho_
_ot
d_t
do_
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that beginWord is not a transfor... | true |
9ee158c918a743a6250b01b81ad51bb8d10d5121 | llpyyz/InteractivePythonProgramming | /CodeFromLecture/InteractivePythonProg_Week2.py | UTF-8 | 7,133 | 3.859375 | 4 | [] | no_license | #Interactive Python - Week 2
###################################
#Interactive Applications In Python
###################################
#Events:
#1. Input: button, text box,
#2. Keyboard: key down, key up
#3. Mouse: click, drag
#4. Timer
#Simple event driven program
#CodeSkulptor GUI module
import simplegui
#Ev... | true |
53f20022a0e5e8401ffd1aff1261f02b36dd4fca | vinayvrv/PythonSMM | /Tweet_Preprocessing.py | UTF-8 | 2,893 | 2.8125 | 3 | [] | no_license | import re
import sqlite3
from collections import defaultdict
# conn = sqlite3.connect('FinalTweet.db')
# c = conn.cursor()
# c.execute("CREATE TABLE FinalTweet(key INT, candidates TEXT, tweets TEXT, TweetLocation TEXT, PersonLocation TEXT, Label TEXT)")
## Load the data from text file. ##
def load_data(tweet... | true |
6dfa35adc24be49e7a5b93b2d4620589a1ee8e7b | arunachalamev/PythonProgramming | /Algorithms/LeetCode/L1312 minInsertions.py | UTF-8 | 323 | 2.90625 | 3 | [] | no_license |
def minInsertions(s):
n = len(s)
dp = [[0] * (n + 1) for i in range(n + 1)]
for i in range(n):
for j in range(n):
dp[i + 1][j + 1] = dp[i][j] + 1 if s[i] == s[~j] else max(dp[i][j + 1], dp[i + 1][j])
return n - dp[n][n]
print (minInsertions('zzazz'))
print (minInsertions('leetcode'... | true |
4048dd6d8f7c0fea4e0935f61db982e07de8f1e9 | nathan-f-elazar/Distributed-Memory-Networks | /helper_scripts/training_plot.py | UTF-8 | 3,895 | 2.5625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import os
os.chdir('../')
base_dir_name = 'results'
color_list = {'LSTM': ((1, 0, 0, 1), (1, 0.5, 0.5, 0.8)),
'DKVMN': ((0, 1, 0, 1), (0.5, 1, 0.5, 0.8)),
'DMN': ((0, 0, 1, 1), (0.5, 0.5, 1, 0.8)),
'ADMN': ((... | true |
fb5cf3980425daa954a92dda5d329f1e26108684 | khangpham-hcmus/Crypto_RSA | /1712519_RSA_implementation/Parse_File_To_List.py | UTF-8 | 349 | 2.9375 | 3 | [] | no_license | # Reading a data.txt file
def parse_file(name_file):#tách file thành từng dòng rồi lưu về list
file = open(name_file, 'r', encoding='utf8')
list_line=[]
if (file == None):
return list_line
list_line = file.readlines()
return list_line # trả về 1 list gồm những dòng của file được phân tích... | true |
8bb21f98febb8df6533f590f05f254c9ca373ea2 | CloudBai1984/Tools | /2019个税计算器.py | UTF-8 | 1,465 | 3.5625 | 4 | [] | no_license | def tax(salary_pre, social_accumulation_insurance, deduction):
"""根据税前月薪,社保比例,公积金比例,专项扣除
算出2019每月应交税额"""
temp = salary_pre - social_accumulation_insurance - 5000 - deduction
month1 = []
count = 0
# 计算新税
for i in range(1, 13):
k = int(temp * i)
if k <= 0:
rate_tax = 0
... | true |
d6c27eeb5e492e0e0ec0cb6f37d6d439555f9922 | Aasthaengg/IBMdataset | /Python_codes/p03261/s625094021.py | UTF-8 | 261 | 3.0625 | 3 | [] | no_license | N=int(input())
ok=True
W2=input()
lis=[W2]
for i in range(N-1):
W=W2
W2=input()
if W2 in lis:
ok=False
break
lis.append(W2)
if(W2[0]!=W[len(W)-1]):
ok=False
break
if(ok):
print("Yes")
else:
print("No") | true |
378bb9f92849985dd9cc0d6da7f106d4d3e31501 | Samridhi-88/cows_bulls | /cows_bulls.py | UTF-8 | 1,436 | 3.59375 | 4 | [] | no_license | import random
digit = 5
name = input("enter your name=")
print("welcome",name,"in this gurssing game!!!!")
def getSecretNum():
number = list(range(10))
random.shuffle(number)
return number
def getclues():
numbers = getSecretNum()
secret_num = []
for i in range(digit):
secret_num.append... | true |
da9513085337175788fd63c6b579e5437deb3bd7 | aakashpydi/Perceptron-and-NBC-Implementation | /nbc.py | UTF-8 | 8,431 | 3.046875 | 3 | [] | no_license | import sys
import pandas as pd
import numpy as np
class NBC:
def __init__(self, data_train, data_test):
self.data_train = data_train
self.data_test = data_test
self.class_1_value_dict = dict()
self.class_0_value_dict = dict()
self.zero_one_loss = 0.0
self.squared... | true |
bcbb073d822b04566fa2ccee74c95c57dfa841f3 | Terlam/income_property_roi_proj | /income_property_roi_proj.py | UTF-8 | 1,057 | 3.828125 | 4 | [] | no_license | class IncomeProperty:
def __init__(self,monthlyIncome,monthlyExpenses,cashInvestment):
self.monthlyIncome = monthlyIncome
self.monthlyExpenses = monthlyExpenses
self.cashInvestment = cashInvestment
def cashCalc(self):
self.monthlyIncome =int(input("Give the total monthly income... | true |
0ea68317dc0be07eecba82b4d8a4b26c1665acd3 | datascientistone/udacity-intro-to-data-science | /titanic/titanic_custom_heuristic.py | UTF-8 | 9,667 | 3.65625 | 4 | [] | no_license | import math
import numpy
import pandas
import statsmodels.api as sm
import matplotlib.pyplot as plt
def custom_heuristic(file_path):
'''
You are given a list of Titantic passengers and their associated
information. More information about the data can be seen at the link below:
http://www.kaggle.com/c/t... | true |
f3e1a83e10ec6778a769a26c9d2f064fb2981c53 | Akashkumarsenthil/LeetCodePractice | /Random_java/recursion/sortStack.py | UTF-8 | 632 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 5 00:08:15 2020
@author: akashkumar
"""
def sortedInsert(s , element):
if len(s) == 0 or element > s[-1]:
s.append(element)
return
else:
temp = s.pop()
sortedInsert(s, element)
s.append(temp)
def sortStack(s):
if len(s) != 0: ... | true |
924894a68c13d910ff17201f80c0d5a01e6b1f23 | calebho/gameanalysis | /test/utils.py | UTF-8 | 1,170 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | """Utilities for testing"""
import itertools
from gameanalysis import rsgame
def basic_games():
"""Small basic games for testing"""
yield rsgame.empty(1, 2)
yield rsgame.empty(2, 2)
yield rsgame.empty(2, 3)
yield rsgame.empty(3, 2)
yield rsgame.empty(3, 3)
yield rsgame.empty([2, 3], [3, 2... | true |
e9530dedc343342304793e43633e8a9ebee5075d | samuelmgalan/pythonchallenge | /11.py | UTF-8 | 406 | 2.921875 | 3 | [] | no_license | #!/usr/bin/envYo lle python3
# http://www.pythonchallenge.com/pc/return/5808.html
from PIL import Image
im = Image.open("/home/samuel/Descargas/cave.jpg")
im_data = im.getdata()
pixelsEven = []
i = 0
for pixel in iter(im_data):
if i % 2 == 0:
pixelsEven.append(pixel)
i+=1
# Create the new image
im_even = Im... | true |
eb6e223f085b7e3a6e955892e8de2f150b7b3366 | anjmittu/covid-risk-factors | /metalda/institutions/get_stats.py | UTF-8 | 524 | 2.59375 | 3 | [] | no_license | import os
import pandas as pd
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
papers_table = pd.read_csv(os.path.join(PROJECT_ROOT, "data/mallet/institution/papers.csv"),
sep="\t",
names=["paper_id", "authors_in... | true |
d83fa27849ff264965f873728b68f7d84f3973ba | atsss/nyu_deep_learning | /examples/intermediate/01_all_enumeration/001.py | UTF-8 | 914 | 3.21875 | 3 | [] | no_license | from itertools import combinations
nx = []
while(1):
n, x = map(int,input().split())
if n==0 and x==0:
break
nx.append((n,x))
for n,x in nx:
cnt = 0
for c in list(combinations(range(1,n+1),3)):
if sum(c)==x:
cnt += 1
print (cnt)
# My answer
# 2021/04/20
# from itert... | true |
28bbe9c00b5eb64604cd8f75352c49e45d71819b | Slam4you/pythonOOP | /scrtch.py | UTF-8 | 1,300 | 3.125 | 3 | [] | no_license | n = int(input())
mydict = {}
all_parents_dict = {}
for i in range(n):
str = input().split(':')
print(str)
if len(str) == 1:
mydict[str[0]] = []
else:
mydict[str[0].strip()] = str[1].strip().split()
print(mydict)
for key, value in mydict.items():
all_parents_dict[key] = []
if len... | true |
d9b0581bd6d78e91c765ccb84c23cb43642103a9 | 240-coding/2020-winter-python | /0115 - 라이브러리/2 - answer.py | UTF-8 | 188 | 3.390625 | 3 | [] | no_license | import temperature
temp = float(input('조리 온도를 화씨로 입력하세요: '))
cel = str(temperature.convert_to_cel(temp))
print('오븐을 섭씨 '+cel+'도로 예열하세요')
| true |
c865911a60db5dc7b310d6494bf5dbe296877161 | DBrianKimmel/PyHouse | /Project/src/Modules/Core/Utilities/uuid_tools.py | UTF-8 | 2,288 | 2.578125 | 3 | [] | permissive | """
@name: PyHouse/src/Modules.Core.Utilities.uuid_tools.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2015-2019 by D. Brian Kimmel
@license: MIT License
@note: Created on Jun 22, 2015
@Summary:
"""
__updated__ = '2019-10-24'
# Import system type stuff
import os
impo... | true |
0dbd0a0e46562fd5b9d8a92046a542f8fd72af24 | thapadipendra/hacking_tools | /dns_spoof.py | UTF-8 | 4,679 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# this program used to modify packet to redirect to different site.
# program to change the response from dns server rather than request with different ip.
# here ip of url given as response from dns server is changed to our own desire ip.
import scapy.all as scapy
import netfilterqueue
# he... | true |
1c882d3373b974aef820905866d2ac3dbd72c788 | ry3s/atcoder | /abc033/a.py | UTF-8 | 106 | 3.484375 | 3 | [] | no_license | n = list(input())
if all([digit == n[0] for digit in n]):
print("SAME")
else:
print("DIFFERENT")
| true |
49fc518743c0fa3b844e9848d0393970b39acdd7 | cybertraining-dsc/sp20-516-240 | /google-cloud/helloworld.py | UTF-8 | 2,253 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import os
from google.oauth2 import service_account
import googleapiclient.discovery
import io
from google.cloud import storage, vision
#!export GOOGLE_APPLICATION_CREDENTIALS = ""
# Get credentials
credentials = service_account.Credentials.from_service_account_file(
'../../google-api-key.json')
# Create the C... | true |
adcb6041930a2e122041ade9d06f868a2b6edc0f | mramirez7/CompetitiveProgramming | /codeforces_contests/round#623_Div2/test_case_maker.py | UTF-8 | 292 | 3.125 | 3 | [] | no_license | import random
n = 200000
s = ""
t = ""
for i in range (n):
if i:
s += " "
t += " "
s += str(random.randint(1,2))
t += str(random.randint(1,10**5))
with open("../in.txt", "w") as f:
f.write(str(n) + "\n")
f.write(s+ "\n")
f.write(t+ "\n") | true |
f0c3960af0caadcd8b88622915b1ad83d4927956 | mskcc/retained-intron-neoantigen-pipeline | /kmaToPeptideSeqs.py | UTF-8 | 10,499 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | # ----------------------------------------------------------------------------------------------- #
# Claire Margolis
# kmaToPeptideSeqs.py
# Summary: Reads in KMA output .flat_filtered.csv file, extracts chromosome locations for each
# unique intron, then focuses on the most biologically relevant scenario: A nucleot... | true |
a693020a9b19369ccc57661daf854cd71fc78db6 | wis6d/python-master | /chapter3/3-3/uri2.py | UTF-8 | 147 | 3.421875 | 3 | [] | no_license | s = '瓜売りが瓜売りに来て 瓜売り残し売り売り帰る 瓜売りの声'
result = s.replace('瓜', 'cake')
print(s)
print(result) | true |
c745ccc7ea7a5654c9012a2ac4c2a2d9f97dd2bd | speth/RMG-Py | /rmgpy/kinetics/modelTest.py | UTF-8 | 5,375 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... | true |
98192a0e8339cfa2a6d57f76f21172ae461d99fd | RoAriel/proyecto-so | /so-proyect/system/clock.py | UTF-8 | 1,349 | 2.59375 | 3 | [] | no_license | '''
Created on 13/05/2013
@author: j di meglio
'''
import threading as t
import time
from interruptions import Interruption
import interruptions as i
import logging
class Clock(t.Thread):
def __init__(self,cpu,timer):
t.Thread.__init__(self)
self.cpu=cpu;
self.timer... | true |
58647d87014a1c2c0c5fd468dfa6a0d0e0fe099c | cmychina/Leetcode | /leetcode_栈_去除重复字母.py | UTF-8 | 811 | 3.953125 | 4 | [] | no_license | """
给你一个仅包含小写字母的字符串,请你去除字符串中重复的字母,使得每个字母只出现一次。需保证返回结果的字典序最小(要求不能打乱其他字符的相对位置)。
"""
class Solution:
def removeDuplicateLetters(self, s: str) -> str:
counts = {}
for c in s: # 字符计数
counts[c] = counts.get(c, 0) + 1
stack, stacked = [], set()
for c in s:
if c no... | true |
7202617f7da07a7ccb243bdd58b420e9ea0004c0 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2491/60666/252241.py | UTF-8 | 349 | 3.25 | 3 | [] | no_license | num1=input()
num2=input()
num1=num1[1:-1]
num2=num2[1:-1]
number1=[]
number2=[]
for x in num1:
if x.isdigit():
number1.append(int(x))
else:
continue
for y in num2:
if y.isdigit():
number2.append(int(y))
else:
continue
result=[value for value in number1 if value in number2... | true |
5f98923d84596cb7cecd35ceb2123f1c6c629425 | jiangshouqiang/FinanceProject_python | /FinanceProject/test/tempFileTest.py | UTF-8 | 228 | 3.0625 | 3 | [] | no_license | from tempfile import TemporaryFile,NamedTemporaryFile
#用文件描述符来操作临时文件
f = TemporaryFile()
f.write(b'abcdef')
f.seek(0)
f.read(100)
ntf = NamedTemporaryFile()
#返回文件路径
print(ntf.name)
f.close() | true |
2fb9e8fedd0916e8cf69864b7e9f885c4434010a | emyhr/UK_accidents | /time-processing.py | UTF-8 | 1,844 | 2.984375 | 3 | [] | no_license | # importing the necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import src.utilities as utils
import seaborn as sns
from datetime import datetime as dt, timedelta
# setting display properties of pandas
pd... | true |
56217f36c5d419298caa7f0e6a3fc8c9753d7edd | polowis/GodOfWar | /entity/enemy/base.py | UTF-8 | 1,180 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/python3
"""
Author: Hung Tran
Date Created: 15 April 2021
Date Last Changed: 20 April 2021
Inherit from Character class, this class is designed for enemy objects
"""
from entity.character import Character
class Enemy(Character):
def __init__(self, name, scene):
super().__init__(name, sce... | true |
4d5d347127e1364cd92b15a82eeaa7de552cbe68 | zdwweb/python | /hw01/main.py | UTF-8 | 148 | 3.640625 | 4 | [] | no_license | for i in range(1, 10):
for j in range(i, 10):
print("{0:1}x{1:1}={2:>2}".format(i, j, i*j), end=" ")
print()
print(end=" "*7*i)
| true |
87c5d2279629a1acf2ae2883d4a7395471ab250e | brot/gpodder-hook-scripts | /tagging_hook.py | UTF-8 | 2,922 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
####
# 01/2011 Bernd Schlapsi <brot@gmx.info>
#
# This script is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | true |
7b870aa178470e619262aa3cdcd640401acab576 | ymh12345/FD | /main.py | UTF-8 | 881 | 2.578125 | 3 | [] | no_license | import numpy as np
import glob
from FD1D import FD1D
from gif import create_gif
import os
def f(t):
return np.power(np.sin(np.pi * t / 5), 2)
# if t == 1:
# return 1
# else:
# return 0
velocity_list = [4 for i in range(100)]
velocity_list[25:30] = [5 for i in ran... | true |
61d392a161a19a8ab8679b4bc5fb5139a8a96238 | IsaelDornelesJunior/did-tico-eureka- | /test2.py | UTF-8 | 283 | 3.953125 | 4 | [] | no_license | nome = str(input('Digite seu nome: ')).strip().title()
print(f'Olá, {nome}!')
if nome == 'Caio' or 'Monica' or 'Pedro' or 'Isael':
print('Que lindo nome você tem.')
elif nome == 'Joana' or 'Kaline' or 'Kailanne':
print('Que nome diferente')
else:
print('Nome normal.')
| true |
07f94e4bac6c7a36f21aadf87ac11e8f419e5bca | googlefonts/glyphsLib | /tests/eraseOpenCorners_test.py | UTF-8 | 13,170 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from defcon import Font
from glyphsLib.filters.eraseOpenCorners import EraseOpenCornersFilter
@pytest.fixture(
params=[
{
"glyphs": [
{"name": "space", "width": 500},
{
"name": "hasCornerGlyph",
"width": 600... | true |
23a657bdb4bf8a75f6e9e9b361fce509d72350dc | hessifer/Python | /ProgrammingExpert/banking_class_test.py | UTF-8 | 1,075 | 3.375 | 3 | [] | no_license | import inspect
import unittest
from banking_class import BankAccount
class TestProgram(unittest.TestCase):
def test_case_1(self):
self.assertTrue(inspect.isclass(BankAccount), "BankAccount should be a class.")
def test_case_2(self):
account = BankAccount("Tim")
self.assertTrue(hasatt... | true |
1762999846b4f95a5b817ea21295b6dcee3b4ffd | amir-allam/PRYSM | /examples/icecore_driver.py | UTF-8 | 6,602 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# Sylvia Dee
# PSM d18O Ice Cores
# ENVIRONMENT SUB-MODEL
# a.k.a. driver script
# Modified 01/27/2015 <sdee@usc.edu>
"""
Ice Core d18O Environment Model (Wrapper Script)
~ Load Environmental Variables to compute d18O calcite/dripwater.
INPUTS:
Isotope-Enabled GCM INPUTS:
... | true |
8eb410ca29484e818eb3fe1da6382db76d74097f | gu98/developmentmodels | /csvaverage.py | UTF-8 | 220 | 2.515625 | 3 | [] | no_license | import numpy as np
path = 'data.csv'
all= np.genfromtxt(path, delimiter=",")
results=all.mean(axis=0)
#print(results)
file = open("results.csv","w+")
file.write(",".join(str(value) for value in results))
file.close() | true |
d5fde79e83f0b09773bc39222c68055890787317 | wuhagui/download_jable.tv | /jable.tv/M3u8.py | UTF-8 | 1,906 | 2.65625 | 3 | [] | no_license | import requests
from config import headers
from utils import log, save
from bs4 import BeautifulSoup as bs
import m3u8
class M3u8():
def __init__(self, page_url, dirname):
self.page_url = page_url
self.url_prefix = ''
self.m3u8_path = dirname + '/' + 'm3u8.m3u8'
self.dirname = dirn... | true |
20540c9e7414f574953a0cb95ec2824a71a80ec2 | Rahmanism/python_designpatterns | /singleton/log.py | UTF-8 | 454 | 3.34375 | 3 | [] | no_license | class Logger():
def __init__(self, file_name):
self.file_name = file_name
def _write_log(self, level, msg):
with open(self.file_name, "a") as log_file:
log_file.write(f"[{level}] {msg}\n")
def critical(self, msg):
self._write_log('CRITICAL', msg)
def error(self, msg):
self._write_log('... | true |
b888b81cbed5cd1535a7fd747e72e4972dbefe97 | TeamSixOneSeven/leetcode_exe | /是代码呀/num_31.py | UTF-8 | 1,320 | 3.375 | 3 | [] | no_license | # ac
# 下一个序列
# 不会,看了别人的思路写的
# nums
# 从后往前找,找到索引最大的k,nums[k]<=nums[k+1]
# 然后找到索引最大的l,使得nums[l]>nums[k]
# 把k索引以后的颠倒顺序
class Solution(object):
def nextPermutation(self, nums):
if len(nums) == 2:
if nums[0] >= nums[1]:
return nums
else:
change_num = nums[... | true |
4e2f3739998f80b6f162e293e507e3b8581d22e2 | gnsaddy/Python | /pythonTuple.py | UTF-8 | 609 | 4.46875 | 4 | [] | no_license | # tuple is an ordered sequence of items same as list.The only difference is that tuples are immutable in nature.It can not be modified.
name = ('a', 'd', 'i', 't', 'y', 'a')
print("tuple is", name)
num = (1, 2, 3, 4, 5, 6)
print(num)
# converting tuple into list
num2 = list(num)
print("tuple as list", num2)
n... | true |
f6201c07c5b2d90544f23b9b47923ac240317d71 | KarenLim0202/pySYL | /sylgit/sylgit/spiders/sylgitspider.py | UTF-8 | 637 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from sylgit.items import SylgitItem
class SylgitspiderSpider(scrapy.Spider):
name = 'sylgitspider'
# allowed_domains = ['github.com']
# start_urls = ['http://github.com/']
@property
def start_urls(self):
url_tmpl="https://github.com/shiyanlou?page={}&ta... | true |
d91afa073b6c065bcbe6ab373b734cfd35c6d532 | mbeswetherick/dank-hash-table | /hashTable.py | UTF-8 | 1,479 | 3.921875 | 4 | [] | no_license | from listNode import *
class hashTable:
#constructor: creates an array the size of a large prime number
def __init__(self):
primesText = open("primes.txt")
self.primes = primesText.read().split()
self.data = [None] * int(self.primes[100])#you can change the number on this to vary your array size
# inserts... | true |
f2af26b214a23bf0bb22445d5c36ba03af8a5ae5 | ramkumarr02/earning_tagging | /utils/data_prep.py | UTF-8 | 4,579 | 2.75 | 3 | [] | no_license | from utils.packages import *
from config.variables import *
def analyze_observations(data):
for col_name in data["df"].columns:
col_type = data["df"][col_name].dtype
if col_type != 'int64':
print('---------------------')
print(f'{col_name}')
print(data["df"][col_... | true |
01ddb8fc980e683b457a9af8510bfea44827342e | KT19/pytorch | /Fader_Network/data_loader.py | UTF-8 | 2,322 | 2.515625 | 3 | [] | no_license | #-*-coding:utf-8-*-
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils import data
from torchvision import transforms
from torchvision.datasets import ImageFolder
from PIL import Image
import random
import os
from utils import *
class CelebA(data.Dataset):
def __init... | true |
727f73dda243848a4f908ff51f8047955ab4b36a | kirkthaker/farm2table | /farm2table.py | UTF-8 | 2,402 | 3.359375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from collections import namedtuple
from Table import *
import urllib
import re
class Page:
def __init__(self, url):
"""
Retrieves and stores the urllib.urlopen object for a given url
"""
self.link = urllib.urlopen(url)
def get_tables(self):
... | true |
50dd9c5ce88580c36135c47cc841d18bd419fd56 | kenfar/DataGristle | /datagristle/file_type.py | UTF-8 | 3,555 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
""" Used to identify characteristics of a file
contains:
- FileTyper class
todo:
- explore details around quoting flags - they seem very inaccurate
See the file "LICENSE" for the full license governing this code.
Copyright 2011-2021 Ken Farmer
"""
import csv
import fil... | true |