在使用 box bento/centos-7 的新 Vagrant VM 上,以下命令破坏了我的 pip 安装:
yum update
yum install epel-release -y
yum install python-pip -y
/usr/bin/pip2 install --upgrade pip setuptools pyOpenSSL psycopg2-binary lxml
Run Code Online (Sandbox Code Playgroud)
这最终失败了
Downloading https://files.pythonhosted.org/packages/84/48/5c99d8770fd0a9eb0f82654c3294aad6d0ba9f8600638c2e2ad74f2c5d52/setuptools-52.0.0.tar.gz (2.1MB)
100% |????????????????????????????????| 2.1MB 821kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "setuptools/version.py", line 1, in <module>
import pkg_resources
File "pkg_resources/__init__.py", line 1367
raise SyntaxError(e) from e
^
SyntaxError: invalid …
Run Code Online (Sandbox Code Playgroud) 我有一个 github 单一存储库(mono repo),如下所示:
/
- .github
- docs
- web
- mobile
Run Code Online (Sandbox Code Playgroud)
问题:
我想仅为web
但不为其他文件夹创建拉取请求模板。github上可以实现吗?
我的pull_request_template.md
:
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
## Web checklist
Run Code Online (Sandbox Code Playgroud) 我正在上课。
class A {
constructor() {
}
getThis() {
return this;
}
}
class B extends A {
constructor() {
super();
this.superclass = super; // SyntaxError: 'super' keyword unexpected here
this.superclass = super.getThis(); // this.superclass is this(B and not A)
}
}
Run Code Online (Sandbox Code Playgroud)
如何访问超类(不是属性或方法)?
编辑:
class A {
constructor() {
this.a = 1;
}
getThis() {
return this;
}
}
class B extends A {
constructor() {
super();
this.b = 2;
console.log( [get the super class] ); // A { a: …
Run Code Online (Sandbox Code Playgroud) 我有一个模型model.py
,并在 中生成模型表单inventory_form.py
。
在我的模型中命名了一个字段watercourse
,并且表单字段被标记为Watercourse
。
model.py
class Inventory(models.Model):
watercourse = models.CharField(max_length=255, null=False)
Run Code Online (Sandbox Code Playgroud)
inventory_form.py
class InventoryModelForm(forms.ModelForm):
class Meta:
model = Inventory
fields = ['watercourse',]
widgets = {
'watercourse': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': 'lorem ipsum',
}),
}
Run Code Online (Sandbox Code Playgroud)
如何将标签更改为Insert a watercourse
?
我通过 python 程序发送一个名为test.txt
附件的文件。它成功发送,但当我在 Gmail 收件箱中收到它时,附件显示Untitled
的是text.txt
. 我的电子邮件代码块如下,看起来是正确的。有什么建议么?
# Setup the email
mail_content = '''Hello,
The attached document contains the results of the file scan.
Please contact the IT Help Desk if you have any questions.
Thank You!!!
'''
message = MIMEMultipart()
message['From'] = sender_address
message['To'] = receiver_address
message['Subject'] = 'A test mail sent by Python. It has an attachment.'
message.attach(MIMEText(mail_content, 'plain'))
attach_file_name = 'david.txt'
# attach_file_name = file_name
attach_file = open(attach_file_name, 'rb') # Open the …
Run Code Online (Sandbox Code Playgroud)