This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format: | |
n: | |
regexp1_try1 try2 try3 regexp2_try1 try2 try3 | |
10 : | |
4.35, 4.30, 4.31, 4.80, 4.81, 4.71, | |
4.31, 4.35, 4.33, 5.00, 5.04, 4.99, | |
3.88, 3.84, 3.85, 4.03, 3.99, 4.02, | |
4.13, 4.14, 4.17, 4.54, 4.53, 4.54, | |
4.42, 4.47, 4.37, 5.00, 4.96, 5.04, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from random import choice | |
#e1 = re.compile('((x((y|z))*x)|(y|z))*$') # my | |
#e2 = re.compile('(y|z)*(x(y|z)*x(y|z)*)*$') | |
e1 = re.compile('(?:(?:x(?:[yz])*x)|[yz])*$') #my | |
e2 = re.compile('(?:y|z)*(?:x(?:y|z)*x(?:y|z)*)*$') | |
res = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from random import choice | |
e1 = re.compile('(?:(?:x(?:[yz])*x)|[yz])*$') #my | |
e2 = re.compile('(?:y|z)*(?:x(?:y|z)*x(?:y|z)*)*$') | |
res = 0 | |
def test(e, s): | |
global res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jinja2 | |
env = jinja2.Environment(extensions=['jinja2.ext.do']) | |
template = ''' | |
{% set p = [4,5,6] %} | |
{% set res = [] %} | |
{% for i in p %} | |
{% do res.append(i) %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test(markdown('[Google - поиск №1](http://google.com)'), | |
'<a href="http://google.com">Google - поиск №1</a>') | |
test(markdown('[MS Bing] компания [Microsoft Bing](http://bing.com)'), | |
'[MS Bing] компания <a href="http://bing.com">Microsoft Bing</a>') | |
test(markdown('[Python](http://python.org)(v3.7)'), | |
'<a href="http://python.org">Python</a>(v3.7)') | |
test(markdown('[Яндекс!](http://ya.ru) и [百度](http://baidu.com)'), | |
'<a href="http://ya.ru">Яндекс!</a> и <a href="http://baidu.com">百度</a>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTALLED_APPS = [ | |
'core', | |
'django.contrib.admin', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
class Book(models.Model): | |
author = models.ForeignKey(User) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
managers=[ | |
('objects', django.contrib.auth.models.UserManager()), | |
], | |
), | |
migrations.RunSQL("INSERT INTO core_customuser SELECT * FROM auth_user"), # <--- this line | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Book(models.Model): | |
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User | |
from django.contrib.contenttypes.fields import GenericForeignKey | |
from django.contrib.contenttypes.models import ContentType | |
from django.db import models | |
class Book(models.Model): | |
author = models.ForeignKey(User, on_delete=models.CASCADE) | |
class Comment(models.Model): | |
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) |
OlderNewer