prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>day10.py<|end_file_name|><|fim▁begin|>from math import floor
def score_syntax_errors(program_lines):
points = {')': 3, ']': 57, '}': 1197, '>': 25137}
s = 0
scores_auto = []
for line in program_lines:
corrupted, stack = corrupted_character(line)
if corrupted:
... | test_corrupted_character_stack |
<|file_name|>day10.py<|end_file_name|><|fim▁begin|>from math import floor
def score_syntax_errors(program_lines):
points = {')': 3, ']': 57, '}': 1197, '>': 25137}
s = 0
scores_auto = []
for line in program_lines:
corrupted, stack = corrupted_character(line)
if corrupted:
... | test_scoring_autocomplete |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os<|fim▁hole|>import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 ... | |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | sys.stdout.write(prompt)
sys.stdout.flush()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
try:
sock.connect((input_host, input_port))
userdata = sock.recv(1024)
except ConnectionRefusedError:
... |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | sys.stdout.write(prompt)
sys.stdout.flush()
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((input_host, input_port))
userdata = sock.recv(1024)
except socket.error:
userdata = b'<u... |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | if sys.version_info.major > 2:
import builtins
def _input(prompt=''):
sys.stdout.write(prompt)
sys.stdout.flush()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
try:
sock.connect((input_host, input_port))
... |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | import builtins
def _input(prompt=''):
sys.stdout.write(prompt)
sys.stdout.flush()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
try:
sock.connect((input_host, input_port))
userdata = sock.recv... |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | import __builtin__
builtins = __builtin__
def _raw_input(prompt=''):
sys.stdout.write(prompt)
sys.stdout.flush()
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((input_host, input_port))
... |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | _input |
<|file_name|>sitecustomize.py<|end_file_name|><|fim▁begin|>import os
import socket
import sys
input_host = '127.0.0.1'
input_port = 65000
batch_enabled = int(os.environ.get('_BACKEND_BATCH_MODE', '0'))
if batch_enabled:
# Since latest Python 2 has `builtins`and `input`,
# we cannot detect Python 2 with the ex... | _raw_input |
<|file_name|>production.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.re... | |
<|file_name|>production.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.re... | SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# INSTALLED_APPS
INSTALLED_APPS = Common.INSTALLED_APPS
# END INSTALLED_APPS
# SECRET KEY
SECRET_KEY = values.SecretValue()
# END SECRET KEY
# django-secure
INSTALLED_APPS += ("djangosecure", )
# set this to 60 sec... |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | return socket.inet_ntoa(fcntl.ioctl( |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24]) |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1)
s.connect((host, port))
s.close()
except:
print "host: %s:%s DOWN" % (host, port)
return False
print "host: %s:%s UP" % (host, port)
return True |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | print "master seems to be up, slaving"
xserver = mserver |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | print "no master yet, will become master" |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | poolCount = 0
pooled = False
# check pooling
try:
poolDom = parseString(xserver.discover_server_pool())
print xserver.discover_server_pool()
for node in poolDom.getElementsByTagName('Server_Pool'):
id = node.getElementsByTagName('Uniqu... |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | pooled = True |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | poolMembers.append(mip) |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | print "setup repo"
print server.mount_repository_fs(repomount, repo)
try:
print "adding repo"
print server.add_repository(repomount, repo)
except Error, v:
print "will create the repo, as it's not there", v
p... |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | print "no pool yet, create it"
# check if a pool exists already if not create
# pool if so add us to the pool
print "create pool fs"
print server.create_pool_filesystem(
fstype,
"%s/VirtualMachines/" ... |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | print "join the pool"
print server.join_server_pool(poolalias,
pooluuid,
poolmvip,
poolCount,
hostname,
ip,
role
) |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | get_ip_address |
<|file_name|>repo_pool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to... | is_it_up |
<|file_name|>ur.py<|end_file_name|><|fim▁begin|>from ..rerequest import TemplateRequest
init_req = TemplateRequest(
re = r'(http://)?(www\.)?(?P<domain>ur(play)?)\.se/(?P<req_url>.+)',
encode_vars = lambda v: { 'req_url': 'http://%(domain)s.se/%(req_url)s' % v } )
hls = { 'title': 'UR-play', 'url': 'http://... | |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
<|fim_middle|>
<|fim▁end|> | __slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
import supriya.patterns
if not isinstance(expr, supriya.patterns.Event):
expr = supriya.patterns.NoteEvent(**expr)
if expr.get("uuid") is None:
expr = new(expr, uuid... |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | import supriya.patterns
if not isinstance(expr, supriya.patterns.Event):
expr = supriya.patterns.NoteEvent(**expr)
if expr.get("uuid") is None:
expr = new(expr, uuid=uuid.uuid4())
return expr |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | import supriya.patterns
import supriya.realtime
event_player = supriya.patterns.RealtimeEventPlayer(
self, clock=clock, server=server or supriya.realtime.Server.default()
)
event_player.start()
return event_player |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | import supriya.patterns
return supriya.patterns.Pbus(
self,
calculation_rate=calculation_rate,
channel_count=channel_count,
release_time=release_time,
) |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | import supriya.patterns
return supriya.patterns.Pfx(
self, synthdef=synthdef, release_time=release_time, **settings
) |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | import supriya.patterns
return supriya.patterns.Pgroup(self, release_time=release_time) |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | expr = supriya.patterns.NoteEvent(**expr) |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | expr = new(expr, uuid=uuid.uuid4()) |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def <|fim_middle|>(self, expr, state=None):
import ... | _coerce_iterator_output |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | play |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | with_bus |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | with_effect |
<|file_name|>EventPattern.py<|end_file_name|><|fim▁begin|>import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
... | with_group |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
<|fim_middle|>
ss GameOfLife(object):
"""
Łączy wszystkie elementy gry w całość.
"""
def __init__(self, width, height, cell_size=10):
"""
Przyg... | """
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry.
:param width: szerokość w pikselach
:param height: wysokość w pikselach
"""
self.surface = py... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
<|fim_middle|>
def draw(self, *args):
"""
R... | """
Konstruktor planszy do gry. Przygotowuje okienko gry.
:param width: szerokość w pikselach
:param height: wysokość w pikselach
"""
self.surface = pygame.display.set_mode((width, height), 0, 32)
pygame.display.set_caption('Game of life')
|
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... |
Rysuje okno gry
:param args: lista obiektów do narysowania
"""
background = (0, 0, 0)
self.surface.fill(background)
for drawable in args:
drawable.draw_on(self.surface)
# dopiero w tym miejscu następuje fatyczne rysowanie
#... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | Łączy wszystkie elementy gry w całość.
"""
def __init__(self, width, height, cell_size=10):
"""
Przygotowanie ustawień gry
:param width: szerokość planszy mierzona liczbą komórek
:param height: wysokość planszy mierzona liczbą komórek
:param cell_size: bok ko... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | rzygotowanie ustawień gry
:param width: szerokość planszy mierzona liczbą komórek
:param height: wysokość planszy mierzona liczbą komórek
:param cell_size: bok komórki w pikselach
"""
pygame.init()
self.board = Board(width * cell_size, height * cell_size)
... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | ry
"""
while not self.handle_events():
# działaj w pętli do momentu otrzymania sygnału do wyjścia
self.board.draw()
self.fps_clock.tick(15)
def handle_events(self):
|
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | mowych, tutaj zinterpretujemy np. ruchy myszką
:return True jeżeli pygame przekazał zdarzenie wyjścia z gry
"""
for event in pygame.event.get():
if event.type == pygame.locals.QUIT:
pygame.quit()
return True
# magiczne liczby używa... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | ef __init__(self, width, height, cell_size=10):
"""
Przygotowuje ustawienia populacji
:param width: szerokość planszy mierzona liczbą komórek
:param height: wysokość planszy mierzona liczbą komórek
:param cell_size: bok komórki w pikselach
"""
self.bo... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | i
:param width: szerokość planszy mierzona liczbą komórek
:param height: wysokość planszy mierzona liczbą komórek
:param cell_size: bok komórki w pikselach
"""
self.box_size = cell_size
self.height = height
self.width = width
self.generat... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... |
"""
# w pętli wypełnij listę kolumnami
# które także w pętli zostają wypełnione wartością 0 (DEAD)
return [[DEAD for y in xrange(self.height)] for x in xrange(self.width)]
def handle_mouse(self):
# pobierz stan guzików myszki z |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | # ignoruj zdarzenie jeśli żaden z guzików nie jest wciśnięty
return
# dodaj żywą komórką jeśli wciśnięty jest pierwszy guzik myszki
# będziemy mogli nie tylko dodawać żywe komórki ale także je usuwać
alive = True if buttons[0] else False
# pobierz pozycję kursora na planszy m... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | f.box_size, self.box_size)
position = (x * self.box_size, y * self.box_size)
color = (255, 255, 255)
thickness = 1
pygame.draw.rect(surface, color, pygame.locals.Rect(position, size), thickness)
def alive_cells(self):
"""
Generator zwracający współrzędne żywych komór... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | tion)):
column = self.generation[x]
for y in range(len(column)):
if column[y] == ALIVE:
# jeśli komórka jest żywa zwrócimy jej współrzędne
yield x, y
# Ta część powinna być zawsze na końcu modułu (ten plik jest modułem)
# chcemy uruchomić naszą ... |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | ue
# magiczne liczby używane do okreś |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | myszk |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | dopiero p |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def <|fim_middle|>(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okien... | __init__ |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | (sel |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | width, |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... |
Obsł |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | zwraca macierz |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | staniem func |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | cells() |
<|file_name|>code1a.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry... | in range(le |
<|file_name|>Methuselah.py<|end_file_name|><|fim▁begin|>from .View import View
class MethuselahView(View):
type = "Methuselah"<|fim▁hole|> "stableAfter": {"pick": "l"}
}<|fim▁end|> | trans = { |
<|file_name|>Methuselah.py<|end_file_name|><|fim▁begin|>from .View import View
class MethuselahView(View):
<|fim_middle|>
<|fim▁end|> | type = "Methuselah"
trans = {
"stableAfter": {"pick": "l"}
} |
<|file_name|>solution_1_wrong.py<|end_file_name|><|fim▁begin|>def calc():<|fim▁hole|>
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
maior_num = n
qtd = [0 for i in range(maior_num + 1)]
for ro... | h, l = input().split(' ')
mapa = [] |
<|file_name|>solution_1_wrong.py<|end_file_name|><|fim▁begin|>def calc():
<|fim_middle|>
calc()
<|fim▁end|> | h, l = input().split(' ')
mapa = []
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
maior_num = n
qtd = [0 for i in range(maior_num + 1)]
for row in mapa:
for col in row:
n = int(col)
... |
<|file_name|>solution_1_wrong.py<|end_file_name|><|fim▁begin|>def calc():
h, l = input().split(' ')
mapa = []
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
<|fim_middle|>
qtd = [0 for i... | maior_num = n |
<|file_name|>solution_1_wrong.py<|end_file_name|><|fim▁begin|>def calc():
h, l = input().split(' ')
mapa = []
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
maior_num = n
qtd = [0 for i in ra... | menor = i |
<|file_name|>solution_1_wrong.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>():
h, l = input().split(' ')
mapa = []
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
maior_num = n
qtd = [0 f... | calc |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | def __init__(self):
super().__init__()
def handle_request(self, request):
res = super(System, self).handle_request(request)
if res is not None: return res |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | super().__init__() |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | res = super(System, self).handle_request(request)
if res is not None: return res |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | return res |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | __init__ |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | handle_request |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.<|fim▁hole|>#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must reta... | |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse<|fim▁hole|>
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
Random quotes from the D... | from errbot import botcmd, BotPlugin |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
<|fim_middle|>
<|fim▁end|> | """
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
Random quotes from the DEVOPS_BORAT twitter account
"""
myfeed = parse('http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=DEVOPS_BORAT')
item... |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
<|fim_midd... | """
Random quotes from the DEVOPS_BORAT twitter account
"""
myfeed = parse('http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=DEVOPS_BORAT')
items = myfeed['entries']
return choice(items).description |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
... | """
Random quotes from the devops_jesus twitter account
"""
myfeed = parse('http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=devops_jesus')
items = myfeed['entries']
return choice(items).description |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
... | """
Random quotes from the UXYoda twitter account
"""
myfeed = parse('http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=UXYoda')
items = myfeed['entries']
return choice(items).description |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def <|fim_middle|>(self, mess, args):
"... | borat |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
... | jesus |
<|file_name|>devops_borat.py<|end_file_name|><|fim▁begin|>from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
... | yoda |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|>from typing import List
class Solution:<|fim▁hole|> for i in range(0, 26):
c = chr(97+i)
lastPos[c] = S.rfind(c)
for i, c in enumerate(S):
# Encounter new index higher than currMax
if i > currMax:
... | def partitionLabels(self, S: str) -> List[int]:
lastPos, seen, currMax = {}, set(), -1
res = [] |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|>from typing import List
class Solution:
<|fim_middle|>
<|fim▁end|> | def partitionLabels(self, S: str) -> List[int]:
lastPos, seen, currMax = {}, set(), -1
res = []
for i in range(0, 26):
c = chr(97+i)
lastPos[c] = S.rfind(c)
for i, c in enumerate(S):
# Encounter new index higher than currMax
if i > curr... |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|>from typing import List
class Solution:
def partitionLabels(self, S: str) -> List[int]:
<|fim_middle|>
<|fim▁end|> | lastPos, seen, currMax = {}, set(), -1
res = []
for i in range(0, 26):
c = chr(97+i)
lastPos[c] = S.rfind(c)
for i, c in enumerate(S):
# Encounter new index higher than currMax
if i > currMax:
res.append(currMax+1)
... |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|>from typing import List
class Solution:
def partitionLabels(self, S: str) -> List[int]:
lastPos, seen, currMax = {}, set(), -1
res = []
for i in range(0, 26):
c = chr(97+i)
lastPos[c] = S.rfind(c)
for i, c in e... | res.append(currMax+1) |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|>from typing import List
class Solution:
def <|fim_middle|>(self, S: str) -> List[int]:
lastPos, seen, currMax = {}, set(), -1
res = []
for i in range(0, 26):
c = chr(97+i)
lastPos[c] = S.rfind(c)
for i, c in en... | partitionLabels |
<|file_name|>format_CIAAW.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import re
import mpmath as mp
mp.dps=250
mp.mp.dps = 250
if len(sys.argv) != 2:
print("Usage: format_CIAAW.py ciaawfile")
quit(1)
path = sys.argv[1]
atomre = re.compile(r'^(\d+) +(\w\w*) +(\w+) +\[?(\d+)\]?\*? +(.*... | brange = re.compile(r'^\[([\d\.]+),([\d\.]+)\].*$')
buncertain = re.compile(r'^([\d\.]+)\((\d+)\)[a-z]*$') |
<|file_name|>format_CIAAW.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import re
import mpmath as mp
mp.dps=250
mp.mp.dps = 250
if len(sys.argv) != 2:
print("Usage: format_CIAAW.py ciaawfile")
quit(1)
path = sys.argv[1]
atomre = re.compile(r'^(\d+) +(\w\w*) +(\w+) +\[?(\d+)\]?\*? +(.*... | s = n.replace(' ', '')
# remove "exactly" for the carbon mass
s = s.replace('(exactly)', '')
# if only a number, put it three times
m = bnum.match(s)
if m:
s = "{:<25} {:<25} {:<25}".format(m.group(1), m.group(1), m.group(1))
# if parentheses uncertainty...
m = buncertain.match(s)
if m:
... |
<|file_name|>format_CIAAW.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import re
import mpmath as mp
mp.dps=250
mp.mp.dps = 250
if len(sys.argv) != 2:
<|fim_middle|>
path = sys.argv[1]
atomre = re.compile(r'^(\d+) +(\w\w*) +(\w+) +\[?(\d+)\]?\*? +(.*) *$')
isore = re.compile(r'^(\d+... | print("Usage: format_CIAAW.py ciaawfile")
quit(1) |
<|file_name|>format_CIAAW.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import sys
import re
import mpmath as mp
mp.dps=250
mp.mp.dps = 250
if len(sys.argv) != 2:
print("Usage: format_CIAAW.py ciaawfile")
quit(1)
path = sys.argv[1]
atomre = re.compile(r'^(\d+) +(\w\w*) +(\w+) +\[?(\d+)\]?\*? +(.*... | s = "{:<25} {:<25} {:<25}".format(m.group(1), m.group(1), m.group(1)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.