Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
64 changes: 64 additions & 0 deletions seoyoung/seoyoung-0/lister.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import sys
import random

file_list=[]

def search(dir):
files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
file_list.append(fullFilename)
search(fullFilename)
else:
file_list.append(fullFilename)



def searchTwo(dir,third):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 콤마(,) 뒤에는 한 칸 띄워주는 것이 PEP8 가이드입니다. dir, third
  • 함수명은 언더스코어(_) 기반 소문자로 짓는 것이 PEP8 가이드입니다. search_two

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 감사드립니다.
참고하겠습니다.

files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
for ig in third:
if ig in fullFilename:
break
else:
if fullFilename.endswith(ig):
searchTwo(fullFilename,third)

else:
for ig in third:
if ig in fullFilename:
break
else:
file_list.append(fullFilename)

Comment on lines +22 to +37
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

들여쓰기는 줄마다 4칸씩 주는 것이 PEP8 가이드입니다.

def print_list(list):
for file_name in list:
print(file_name)


def main():
if len(sys.argv) == 2:
searchDir=sys.argv[1]
search(searchDir)
print_list(file_list)
elif len(sys.argv) ==3:
searchDir=sys.argv[1]
second = sys.argv[2]
if second =="random":
search(searchDir)
random.shuffle(file_list)
print_list(file_list)
elif second.startswith("ignore"):
third=second[7:].split('-')
print("ignored:",third)
searchTwo(searchDir, third)
print_list(file_list)


if __name__ == "__main__":
main()

64 changes: 64 additions & 0 deletions seoyoung/seoyoung-0/week3_modify/lister.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import sys
import random

file_list=[]

def search(dir):
files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
file_list.append(fullFilename)
search(fullFilename)
else:
file_list.append(fullFilename)



def searchTwo(dir,third):
files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
for ig in third:
if ig in fullFilename:
break
else:
if fullFilename.endswith(ig):
searchTwo(fullFilename,third)

else:
for ig in third:
if ig in fullFilename:
break
else:
file_list.append(fullFilename)

def print_list(list):
for file_name in list:
print(file_name)


def main():
if len(sys.argv) == 2:
searchDir=sys.argv[1]
search(searchDir)
print_list(file_list)
elif len(sys.argv) ==3:
searchDir=sys.argv[1]
second = sys.argv[2]
if second =="random":
search(searchDir)
random.shuffle(file_list)
print_list(file_list)
elif second.startswith("ignore"):
third=second[7:].split('-')
print(third)
searchTwo(searchDir, third)
print_list(file_list)


if __name__ == "__main__":
main()

64 changes: 64 additions & 0 deletions seoyoung/seoyoung-0/week3_modify/lister_dst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import sys
import random

file_list=[]

def search(dir):
files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
file_list.append(fullFilename)
search(fullFilename)
else:
file_list.append(fullFilename)



def searchTwo(dir,third):
files = os.listdir(dir)
for file in files:
fullFilename = os.path.join(dir, file)
if os.path.isdir(fullFilename):
for ig in third:
if ig in fullFilename:
break
else:
if fullFilename.endswith(ig):
searchTwo(fullFilename,third)

else:
for ig in third:
if ig in fullFilename:
break
else:
file_list.append(fullFilename)

def print_list(list):
for file_name in list:
print(file_name)


def main():
if len(sys.argv) == 2:
searchDir=sys.argv[1]
search(searchDir)
print_list(file_list)
elif len(sys.argv) ==3:
searchDir=sys.argv[1]
second = sys.argv[2]
if second =="random":
search(searchDir)
random.shuffle(file_list)
print_list(file_list)
elif second.startswith("ignore"):
third=second[7:].split('-')
print(third)
searchTwo(searchDir, third)
print_list(file_list)


if __name__ == "__main__":
main()

14 changes: 14 additions & 0 deletions seoyoung/seoyoung-0/week3_modify/tabto4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys

src = sys.argv[1]
dst = sys.argv[2]

f=open(src)
tab_content = f.read()
f.close()

space_content = tab_content.replace("\t"," "*4)

f = open(dst, 'w')
f.write(space_content)
f.close()
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AccountsConfig(AppConfig):
name = 'accounts'
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
20 changes: 20 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/templates/accounts/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% extends 'base.html' %}
{% block title %}
{% endblock %}

{% block content %}
<div class="row">
<div class="col"></div>
<div class="col-6">
<div class="alert alert-primary" role="alert">
Please enter your login information.</div>
<form action="" method="post">
{% csrf_token %}
{{form.as_p}}
<input type="submit" value="login" class="btn btn-outline-primary">
</form>
</div>
<div class="col"></div>

</div>
{% endblock %}
16 changes: 16 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/templates/accounts/logout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends 'base.html' %}
{% block title %}
{% endblock %}

{% block content %}
<div class="row">
<div class="col"></div>
<div class="col-6">
<div class="alert alert-primary" role="alert">
로그아웃 되었습니다. </div>

<a href="{% url 'accounts:login' %}" class="btn btn-outline-success">login 하기 </a>
</div>
<div class="col"></div>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
11 changes: 11 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.urls import path
from django.contrib.auth.views import LoginView, LogoutView


app_name = "accounts"

urlpatterns = [
path('login/', LoginView.as_view(template_name = 'accounts/login.html'), name='login'),
path('logout/', LogoutView.as_view(template_name = 'accounts/logout.html'), name='logout' ),

]
3 changes: 3 additions & 0 deletions seoyoung/seoyoung-0/week5/accounts/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
Binary file added seoyoung/seoyoung-0/week5/db.sqlite3
Binary file not shown.
117 changes: 117 additions & 0 deletions seoyoung/seoyoung-0/week5/layout/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %} {% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>

<body>
{% load static %}
<style>
.btn-like{
display: inline-block;
width: 50px;
height: 50px;
background:url({% static 'images/instagramicon.png' %});
background-position: -100px -400px;
text-indent: -9999px;
overflow:hidden;
border:none;
}
.btn-like.active{
display: inline-block;
width: 50px;
height: 50px;
background:url({% static 'images/instagramicon.png' %});
background-position: -50px -400px;
text-indent: -9999px;
overflow:hidden;
border:none;
}
.btn-favorite{
display: inline-block;
width: 50px;
height: 50px;
background:url({% static 'images/instagramicon.png' %});
background-position: -515px -150px;
text-indent: -9999px;
overflow:hidden;
border:none;
}
.btn-favorite.active{
display: inline-block;
width: 50px;
height: 50px;
background:url({% static 'images/instagramicon.png' %});
background-position: -515px -100px;
text-indent: -9999px;
overflow:hidden;
border:none;
}

</style>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">instagram</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02"
aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link" href="{% url 'photo:index' %}"> Home <span class="sr-only">(current)</span></a>
</li>
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% url 'photo:create' %}">사진 올리기<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'accounts:logout' %}">Logout<span class="sr-only">(current)</span></a>
</li>
{% else %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'accounts:login' %}">Login <span class="sr-only">(current)</span></a>
</li>
{% endif %}
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<div class="container">
{% if messages %}
<div class="row">
<div class="col"></div>
<div class="col-6">
{% for message in messages %}
<div class="alert alert-{{message.tag}}">{{message}}</div>
{% endfor %}
</div>
<div class="col"></div>
</div>
</div>
{% endif %}

{% block content %}
{% endblock %}




<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
</body>
</html>
Loading