python-3.7

Push rejected, failed to compile Python app.| I can't deploy a Django app to Heroku

末鹿安然 提交于 2020-05-15 21:45:30
问题 I'm beginner and learned how to deploy a Django app to production with this article https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment. Author of this has django app https://github.com/mdn/django-locallibrary-tutorial that I can push to heroku. I have ~copied/pasted this and added some things https://github.com/Altay02/altai_application1. I can't push my repository to heroku and i can't find different between my and him repo that causes the problem. I've tried to

Pylint and pre-commit python 3.7

不打扰是莪最后的温柔 提交于 2020-05-13 21:25:03
问题 I am trying to set up pylint to work with pre-commit. I have looked into the docs, but still I am confused. I do not know how to setup .pre-commit-config.yaml properly. Could you provide the most basic possible template? - repo: myrepo rev: '' # Don't know that to type here hooks: - id: pylint 回答1: The most basic possible template would be this: - repo: https://github.com/pre-commit/mirrors-pylint rev: v2.3.1 hooks: - id: pylint You can also pass arguments to pylint: - repo: https://github

Pylint and pre-commit python 3.7

两盒软妹~` 提交于 2020-05-13 21:20:25
问题 I am trying to set up pylint to work with pre-commit. I have looked into the docs, but still I am confused. I do not know how to setup .pre-commit-config.yaml properly. Could you provide the most basic possible template? - repo: myrepo rev: '' # Don't know that to type here hooks: - id: pylint 回答1: The most basic possible template would be this: - repo: https://github.com/pre-commit/mirrors-pylint rev: v2.3.1 hooks: - id: pylint You can also pass arguments to pylint: - repo: https://github

How to make “keyword-only” fields with dataclasses?

允我心安 提交于 2020-05-12 11:10:01
问题 Since 3.0 there is support to make an argument keyword only: class S3Obj: def __init__(self, bucket, key, *, storage_class='Standard'): self.bucket = bucket self.key = key self.storage_class = storage_class How to get that kind of signature using dataclasses? Something like this, but preferably without the SyntaxError : @dataclass class S3Obj: bucket: str key: str * storage_class: str = 'Standard' Ideally declarative, but using the __post_init__ hook and/or a replacement class decorator is

How to make “keyword-only” fields with dataclasses?

烈酒焚心 提交于 2020-05-12 11:09:11
问题 Since 3.0 there is support to make an argument keyword only: class S3Obj: def __init__(self, bucket, key, *, storage_class='Standard'): self.bucket = bucket self.key = key self.storage_class = storage_class How to get that kind of signature using dataclasses? Something like this, but preferably without the SyntaxError : @dataclass class S3Obj: bucket: str key: str * storage_class: str = 'Standard' Ideally declarative, but using the __post_init__ hook and/or a replacement class decorator is

Check if a field is typing.Optional

試著忘記壹切 提交于 2020-05-09 05:03:26
问题 What is the best way to check if a field from a class is typing.Optional? Example code: from typing import Optional import re from dataclasses import dataclass, fields @dataclass(frozen=True) class TestClass: required_field_1: str required_field_2: int optional_field: Optional[str] def get_all_optional_fields(fields) -> list: return [field.name for field in fields if __is_optional_field(field)] def __is_optional_field(field) -> bool: regex = '^typing.Union\[.*, NoneType\]$' return re.match

Msys2 with python 3.8: ImportError: cannot import name 'open_code' from 'io'

丶灬走出姿态 提交于 2020-05-09 02:36:51
问题 NOTE: There have been several EDITs to the question, as per comments. They are indicated below, and separated by lines. As of now, the only remaining issue seems to be that numpy cannot load, possibly (but not certainly) due to two alternative python 3.8 systems present. I have updated my msys2 system a couple of months ago. That apparently included an update from python 3.7 to 3.8, but which left me with two broken pythons: I can start python when it is 3.7, but there are no associated

Python Inconsistent Special Character Storage In String

谁都会走 提交于 2020-03-24 02:44:56
问题 Version is Python 3.7. I've just found out python sometimes will store the character ñ in a string with multiple representations and I'm completely at a loss as to why or how to deal with it. I'm not sure the best way to show this issue, so I'm just going to show some code output. I have two strings, s1 and s2 both set to equal 'Dan Peña' They are both of type string. I can run the code: print(s1 == s2) # prints false print(len(s1)) # prints 8 print(len(s2)) # prints 9 print(type(s1)) #

speech recognition for anaconda installation

风格不统一 提交于 2020-03-17 02:59:22
问题 I am currently trying to install speech recognition for anaconda but I am getting error (base) C:>conda install -c conda - forge/label/cf201901 Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following packages are not available from

speech recognition for anaconda installation

落花浮王杯 提交于 2020-03-17 02:57:10
问题 I am currently trying to install speech recognition for anaconda but I am getting error (base) C:>conda install -c conda - forge/label/cf201901 Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following packages are not available from