Python345 Poetry로 프로젝트 패키지를 관리하자 Poetry는 왜 사용하는가? Poetry는 파이썬에서 종속성 관리 및 패키징을 위한 도구입니다. 즉, 프로젝트가 의존하고있는 라이브러리 패키지를 설치 및 삭제 등 효과적으로 관리할 수 있습니다. 때문에 Poetry는 pip의 requirements나 virtualenv를 대체할 수 있습니다. poetry를 pip로 설치하는 방법은 다음과 같습니다. pip install --user poetry 다른 경로의 설치 방법은 공식문서를 참고하기 바랍니다. installation Poetry로 프로젝트 생성하기 poetry를 설치했다면 이제 shell에서 poetry 명령어를 사용할 수 있습니다. poetry new project-name 위의 명령어를 통해 새로운 프로젝트를 생성할 수 있습니다. 생성된 프로젝.. 2022. 4. 11. Remove First and Last Character Part Two Description: This is a spin off of my first kata. You are given a string containing a sequence of character sequences separated by commas. Write a function which returns a new string containing the same character sequences except the first and the last ones but this time separated by spaces. If the input string is empty or the removal of the first and last items would cause the resulting string .. 2022. 4. 10. Total amount of points Description: Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the collection. For example: ["3:1", "2:2", "0:1", ...] Write a function that takes such collection and counts the points of our team in the championship. Rules for counting points for each match: if x > y: 3 points if x < y: 0 point if x = y: 1 point Notes: .. 2022. 4. 9. Transportation on vacation Description: After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you. You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers. Every day you rent the car costs $40. If you rent the car for 7 or more days,.. 2022. 4. 8. Beginner - Lost Without a Map Description: Given an array of integers, return a new array with each value doubled. For example: [1, 2, 3] --> [2, 4, 6] Solution: 1. Get the elements out of the array. 2. Multiply the element by 2 and put it back into the array. 3. Return an array. def maps(a): return list(map(lambda x: x * 2, a)) The lambda function is an anonymous function and is suitable for simple calculations. 2022. 4. 7. pre-commit 에서 ‘flake8’ 과 ‘black’ 커스텀 문제 예제 코드 # setup.cfg [flake8] exclude = .git max-line-length = 88 [black] line-length = 88 flake8 과 black 에 ‘line-length’설정 값이 중복되는 것이 아니냐는 의견이 있었습니다. 우선 결론부터 말씀드리자면 둘다 있어야 한다고 생각합니다. 그 이유는 어느 한쪽을 생략한 경우, 생략한 쪽은 기본값을 채택하여 개발자가 원하는대로 작동하지 않기 때문입니다. 예를들어 위에 문서에서 flake8의 ‘max-line-length = 88’ 를 생략하는 경우 # 코드 수정 [flake8] exclude = .git # max-line-length = 88 black은 88자를 통과시키지만 flake8은 기본값인 79자를 기준으로 검사.. 2022. 4. 7. 이전 1 ··· 40 41 42 43 44 45 46 ··· 58 다음