Skip to content

Instantly share code, notes, and snippets.

Avatar

LevBravE LevBravE

View GitHub Profile
View app.py
from flask import Flask, request
import logging
import json
from geo import get_country, get_distance, get_coordinates
app = Flask(__name__)
logging.basicConfig(level=logging.INFO, filename='app.log', format='%(asctime)s %(levelname)s %(name)s %(message)s')
@app.route('/post', methods=['POST'])
View geo.py
import requests
from math import sin, cos, sqrt, atan2, radians
def get_coordinates(city):
url = "https://geocode-maps.yandex.ru/1.x/"
params = {
'geocode': city,
View alice-2-game.py
from flask import Flask, request
import logging
import json
import random
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
cities = {
View flask_app.py
# импортируем библиотеки
from flask import Flask, request
import logging
# библиотека, которая нам понадобится для работы с JSON
import json
# создаем приложение
# мы передаем __name__, в нем содержится информация, в каком модуле мы находимся.
# В данном случае там содержится '__main__', так как мы обращаемся к переменной из запущенного модуля.
View pytest_real_sample.py
import pytest
import sys
import solution
class TestAggregatorsBase:
@pytest.fixture
def base_class(self):
return None
View game.py
import os
import sys
import pygame
pygame.init()
pygame.key.set_repeat(200, 70)
FPS = 50
WIDTH = 400
HEIGHT = 300
View landing.py
import os
import pygame
pygame.init()
size = width, height = 800, 400
screen = pygame.display.set_mode(size)
def load_image(name, color_key=None):
View balls.py
import os
import random
import pygame
def load_image(name, color_key=None):
fullname = os.path.join('data', name)
try:
image = pygame.image.load(fullname).convert()
except pygame.error as message:
View bomb_class.py
import os
import random
import pygame
size = width, height = 400, 300
screen = pygame.display.set_mode(size)
def load_image(name, color_key=None):
fullname = os.path.join('data', name)
image = pygame.image.load(fullname).convert()
View sprites.py
import os
import random
import pygame
def load_image(name, color_key=None):
fullname = os.path.join('data', name)
try:
image = pygame.image.load(fullname).convert()