This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django.core.management import call_command | |
from django.core.urlresolvers import reverse | |
from django.test import TestCase, Client | |
from django.contrib.admin.sites import AdminSite | |
from common.test.factories import MealOptionFactory, MealOptionCategoryFactory, MealFactory, RestaurantFactory, \ | |
MealCategoryFactory, UserFactory | |
from gloodny.models import * |
This file contains hidden or 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.sites.shortcuts import get_current_site | |
from django.core.exceptions import ObjectDoesNotExist | |
from django.http import Http404 | |
from django.conf import settings | |
from django.contrib.sessions.middleware import SessionMiddleware | |
class RedirectSiteMiddleware(object): | |
def process_request(self, request): |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
class_red = np.array([[0.05, 0.91], | |
[0.14, 0.96], | |
[0.16, 0.9], | |
[0.07, 0.7], | |
[0.2, 0.63]]) |
This file contains hidden or 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 math import sqrt | |
import matplotlib.pyplot as plt | |
import numpy as np | |
RANDOM_POINTS_COUNT = 10 | |
def get_euclidean_distance(point_one, point_two): | |
dx = (point_one[0] - point_two[0]) ** 2 |
This file contains hidden or 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 random | |
def main(): | |
print('SUPER FIGHT GAME!') | |
player = None | |
Player1 = { | |
'name': 'Power man', | |
'power': 15, | |
'skill': 1.0, |
This file contains hidden or 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
''' | |
ЛАБ 2 - ЧАСТЬ 2 | |
Пример для этапов 7-8 | |
''' | |
##1 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Функция уравнения прямой y=a*x+b |
This file contains hidden or 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
CREATE TABLE STUDENTS ( | |
ID INTEGER PRIMARY KEY, | |
FIRST_NAME VARCHAR(50) NOT NULL, | |
LAST_NAME VARCHAR(50) NOT NULL, | |
ADDRESS VARCHAR(100) | |
); | |
CREATE TABLE ORDERS | |
( | |
Id INTEGER PRIMARY KEY, |
This file contains hidden or 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 sqlite3 | |
conn = sqlite3.connect(":memory") | |
cursor = conn.cursor() | |
sql_command = 'CREATE TABLE STUDENTS ( ID INTEGER PRIMARY KEY, FIRST_NAME VARCHAR(50) NOT NULL, LAST_NAME VARCHAR(50) NOT NULL, ADDRESS VARCHAR(100) );' | |
cursor.execute(sql_command) | |
sql_command = "INSERT INTO students VALUES (2, 'Ivan', 'Ivanon', 'My address');" | |
cursor.execute(sql_command) | |
conn.commit() |
OlderNewer