text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> ## load metadata information
df = pd.read_csv(data_dir+os.sep+"Mousebrain/Mousebrain_metadata.csv", index_col=0)
df = df[df["mouse_celltypes"] != "unknown"] # remove unknown cell types
common_barcodes = set(df["barcodes"]).intersection(set(adata.obs["barcode"])) # 53,204 cells
adata = ... | code_fim | hard | {
"lang": "python",
"repo": "marvinquiet/RefConstruction_supervisedCelltyping",
"path": "/preprocess/load_mousebrain_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marvinquiet/RefConstruction_supervisedCelltyping path: /preprocess/load_mousebrain_data.py
import os
import anndata
import numpy as np
import pandas as pd
def write_brain_adata(data_dir, region="FC"):
'''Loading data from different brain region and make it an anndata, store it
@region: F... | code_fim | hard | {
"lang": "python",
"repo": "marvinquiet/RefConstruction_supervisedCelltyping",
"path": "/preprocess/load_mousebrain_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @region: different brain regions
@ind: individuals to return; if None, return all
- FC: P60FCAldh1l1Rep1/P60FCCx3cr1Rep1/P60FCRep1,2,3,4,6
- HC: P60HippoRep1-6
can use _ as separator to input multiple
@celltype_gran: granularity of celltype, 0: major cell types, 1: sub-... | code_fim | hard | {
"lang": "python",
"repo": "marvinquiet/RefConstruction_supervisedCelltyping",
"path": "/preprocess/load_mousebrain_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gengmoqi/trinity path: /tests/p2p/test_behavior_and_logic_api.py
import asyncio
import contextlib
import pytest
from eth_utils import ValidationError
from p2p.p2p_proto import Ping
from p2p.behaviors import Behavior
from p2p.logic import (
BaseLogic,
Application,
CommandHandler,
... | code_fim | hard | {
"lang": "python",
"repo": "gengmoqi/trinity",
"path": "/tests/p2p/test_behavior_and_logic_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.asyncio
async def test_command_handler_logic():
got_ping = asyncio.Event()
class HandlePing(CommandHandler):
command_type = Ping
async def handle(self, connection, msg):
got_ping.set()
async with ConnectionPairFactory() as (alice, bob):
ping_... | code_fim | hard | {
"lang": "python",
"repo": "gengmoqi/trinity",
"path": "/tests/p2p/test_behavior_and_logic_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "Project1", None))
self.showhum_button.setText(_translate("MainWindow", "Current Humidity and Temperature", None))
self.close_button.setText(_translate("MainWindow", "Close", None))
... | code_fim | hard | {
"lang": "python",
"repo": "rheabcooper/Project1-EID",
"path": "/examples/A.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rheabcooper/Project1-EID path: /examples/A.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'A.ui'
#
# Created: Sun Oct 1 12:05:05 2017
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, Qt... | code_fim | hard | {
"lang": "python",
"repo": "rheabcooper/Project1-EID",
"path": "/examples/A.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def find_accuracy(self):
acc = list()
scores = cross_validation.cross_val_score(self.clf, self.X_train, self.Y_train, cv=10, scoring='f1_weighted')
acc.append(("%0.2f (+/- %0.2f)" % (scores.mean(), scores.std() * 2)))
for i, (train, test) in enumerate(self.cv):
... | code_fim | hard | {
"lang": "python",
"repo": "Xindictus/Machine-Learning-Project",
"path": "/Accuracy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xindictus/Machine-Learning-Project path: /Accuracy.py
#!/Python27/python
# -*- coding: UTF-8 -*-
from sklearn import cross_validation
class Accuracy:
def __init__(self, clf, cv, X_train, Y_train, X_test, Y_test):
self.clf = clf
self.cv = cv
self.X_train = ... | code_fim | hard | {
"lang": "python",
"repo": "Xindictus/Machine-Learning-Project",
"path": "/Accuracy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbestavros/keylime path: /keylime/registrar_client.py
import logging
import ssl
import sys
from typing import Any, Dict, Optional, Union
from keylime import api_version as keylime_api_version
from keylime import crypto, json, keylime_logging
from keylime.requests_client import RequestsClient
if... | code_fim | hard | {
"lang": "python",
"repo": "mbestavros/keylime",
"path": "/keylime/registrar_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if response.status_code == 200:
logger.debug("Registrar deleted.")
else:
logger.warning("Status command response: %s Unexpected response from registrar.", response.status_code)
keylime_logging.log_http_response(logger, logging.WARNING, response_body)
return response_bo... | code_fim | hard | {
"lang": "python",
"repo": "mbestavros/keylime",
"path": "/keylime/registrar_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :returns: The request response body
"""
client = RequestsClient(f"{registrar_ip}:{registrar_port}", True, tls_context=tls_context)
response = client.delete(f"/v{api_version}/agents/{agent_id}")
response_body: Dict[str, Any] = response.json()
if response.status_code == 200:
... | code_fim | hard | {
"lang": "python",
"repo": "mbestavros/keylime",
"path": "/keylime/registrar_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.home_page_title = tmp["Site"]["Home_page_title"]
self.site_prefix = tmp["Site"]["Prefix"]
self.site_author = tmp["Site"]["Author"]
self.home_size = tmp["Site"]["Home_size"]
self.time_style = tmp["Site"]["Time_style"]
self.archive_group = tmp["Site"]["Ar... | code_fim | hard | {
"lang": "python",
"repo": "54wedge/blog_builder",
"path": "/tool/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 54wedge/blog_builder path: /tool/config.py
from os import path as ospath
from os import getcwd
from sys import argv as args
from yaml import safe_load as read_config
from tool.utils import nsprint
<|fim_suffix|> def __init__(self, path):
self.config_path = path
with open(path,... | code_fim | medium | {
"lang": "python",
"repo": "54wedge/blog_builder",
"path": "/tool/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validar_css(self):
soup = BeautifulSoup(self.content, 'html.parser')
link_tags = soup.find_all('link')
for link_tag in link_tags:
href = link_tag.get('href')
if self.url not in href:
href = self.url + href
if re.search(... | code_fim | hard | {
"lang": "python",
"repo": "carlosbognar/TCC-WCGA-1",
"path": "/crawling/recommendations/recommendation01.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlosbognar/TCC-WCGA-1 path: /crawling/recommendations/recommendation01.py
from bs4 import BeautifulSoup
from string import Template
import re
import requests
from urllib.parse import quote, urlparse
from ..occurrences.occurrences import Occurrences
from ..occurrences.occurrence_interface impor... | code_fim | hard | {
"lang": "python",
"repo": "carlosbognar/TCC-WCGA-1",
"path": "/crawling/recommendations/recommendation01.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for link_tag in link_tags:
href = link_tag.get('href')
if self.url not in href:
href = self.url + href
if re.search('(app|main|styles?|global|estilos?|default).css', href) is not None \
and re.search('plugins?|libs?|portlet|boots... | code_fim | hard | {
"lang": "python",
"repo": "carlosbognar/TCC-WCGA-1",
"path": "/crawling/recommendations/recommendation01.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.MOVR16(AX, code)
self.INT(0x21)
def _byte(self, value):
return [value & 0xFF]
def _word(self, value):
return [value & 0xFF, (value & 0xFF00) >> 8]
### Compiler Methods ###
def getBytecode(self):
return self._bytecode
def c... | code_fim | hard | {
"lang": "python",
"repo": "mjkarki/asm8086",
"path": "/asm8086.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def CMPAX(self, val16b):
self._bytecode.extend([0x3D, val16b & 0xFFFF])
self._IP += 3
def JZ(self, dist8b):
self._bytecode.extend([0x74, dist8b & 0xFF])
self._IP += 2
def JNZ(self, dist8b):
self._bytecode.extend([0x75, dist8b & 0xFF])
... | code_fim | hard | {
"lang": "python",
"repo": "mjkarki/asm8086",
"path": "/asm8086.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mjkarki/asm8086 path: /asm8086.py
import re
### Glossary ###
#
# reg8b - 8 bit register: AL, CL, ... AH, CH, ...
# reg16b - 16 bit register: AX, CX, ...
# val8b - 8 bit value
# val16b - 16 bit value
# dist8b - jump distance from current position, range: -128 - +127
# dist16b - ju... | code_fim | hard | {
"lang": "python",
"repo": "mjkarki/asm8086",
"path": "/asm8086.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timati5/duckman-python_bot path: /main.py
await client.send_message(message.channel, embed=embed)
if author_xp < 3000 and author_levels == 11:
await set_level(message.author.id, 10)
if author_xp >= 3500 and author_levels <= 11:
LEVEL = 12
... | code_fim | hard | {
"lang": "python",
"repo": "timati5/duckman-python_bot",
"path": "/main.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if reaction.emoji == '🎮' and msgid == reaction_msg_stuff["r_role_msg_id"] and user.id == reaction_msg_stuff["r_role_msg_user_id"]:
for role in reaction.message.server.roles:
if role.name.lower() == "gamer 🎮":
await client.remove_roles(user, role)
... | code_fim | hard | {
"lang": "python",
"repo": "timati5/duckman-python_bot",
"path": "/main.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@client.event
async def on_member_join(member):
if member.server.id == "316177775239102464":
await db.create_user(member.id, member.name)
user_count = len(member.server.members)
log_channel = discord.Object('317560415699599362')
general_channel = discord.Object('3161777... | code_fim | hard | {
"lang": "python",
"repo": "timati5/duckman-python_bot",
"path": "/main.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Layer 1: needs input_shape as well.
model.add(Conv2D(num_featmaps, (w, h),
input_shape=(28, 28, 1),
activation = 'relu'))
# Layer 2:
model.add(Conv2D(num_featmaps, (w, h), activation = 'relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
# Layer 3: dense layer with 128 nodes
# Flatte... | code_fim | hard | {
"lang": "python",
"repo": "Herugga/SGN-41007",
"path": "/exercises/Ex4/EX4_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Herugga/SGN-41007 path: /exercises/Ex4/EX4_5.py
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 10:29:14 2019
@author: Mikko
"""
# Q5 #
# Training code
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Ac... | code_fim | hard | {
"lang": "python",
"repo": "Herugga/SGN-41007",
"path": "/exercises/Ex4/EX4_5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.scatter(x, y, 1)
z = np.polyfit(x, y, 1)
p = np.poly1d(z)
plt.plot(x,p(x),"r--")
plt.axhline(y=0.07,color = 'b',linestyle = '-')
plt.xlabel("Year")
plt.ylabel("Sea Level(m)")
plt.title("8665530 Charleston, SC")
plt.grid()
plt.show()<|fim_prefix|># repo: brsleep/sea-level-projection pat... | code_fim | hard | {
"lang": "python",
"repo": "brsleep/sea-level-projection",
"path": "/seaLevelAppV1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brsleep/sea-level-projection path: /seaLevelAppV1.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# This is a rough POC of using .csv data from NOAA to plot
# Regional Sea Level(rsl) change from Charleston, SC based on stu... | code_fim | hard | {
"lang": "python",
"repo": "brsleep/sea-level-projection",
"path": "/seaLevelAppV1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_test_rollback_on_exception_rollup_metrics = [
('Datastore/all', 2),
('Datastore/allOther', 2),
('Datastore/SQLite/all', 2),
('Datastore/SQLite/allOther', 2),
('Datastore/operation/SQLite/rollback', 1)]
if is_pypy:
_test_rollback_on_exception_scoped_metrics.ext... | code_fim | hard | {
"lang": "python",
"repo": "jbeveland27/newrelic-python-agent",
"path": "/tests/datastore_sqlite/test_database.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbeveland27/newrelic-python-agent path: /tests/datastore_sqlite/test_database.py
# Copyright 2010 New Relic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "jbeveland27/newrelic-python-agent",
"path": "/tests/datastore_sqlite/test_database.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iCodeIN/lite-frontend path: /unit_tests/caseworker/queues/test_templates.py
import pytest
from django.template.loader import render_to_string
<|fim_suffix|>
@pytest.mark.parametrize("elapsed,remaining", [(0, 0), (None, None), (10, 10), (25, 25),])
def test_sla_display_days(elapsed, remaining):
... | code_fim | hard | {
"lang": "python",
"repo": "iCodeIN/lite-frontend",
"path": "/unit_tests/caseworker/queues/test_templates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("elapsed,remaining", [(0, 0), (None, None), (10, 10), (25, 25),])
def test_sla_display_days(elapsed, remaining):
context = {"case": {"sla_days": elapsed, "sla_remaining_days": remaining,}}
assert render_to_string("includes/sla_display.html", context)<|fim_prefix|># repo: i... | code_fim | medium | {
"lang": "python",
"repo": "iCodeIN/lite-frontend",
"path": "/unit_tests/caseworker/queues/test_templates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silvioedu/opencv-tests path: /src/shapes-texts.py
import cv2
import numpy as np
WINDOW_NAME = 'Image'
# 0 -> black
# 1 -> white
img = np.zeros((512, 512, 3), np.uint8) # black image
# img [:] = 255, 0, 0 # blue image
# img[200:300, 100:300] = 255, 0, 0 # blue rectangle in black window
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "silvioedu/opencv-tests",
"path": "/src/shapes-texts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#--[Showing image]--#
cv2.imshow(WINDOW_NAME, img)
cv2.waitKey()<|fim_prefix|># repo: silvioedu/opencv-tests path: /src/shapes-texts.py
import cv2
import numpy as np
WINDOW_NAME = 'Image'
# 0 -> black
# 1 -> white
img = np.zeros((512, 512, 3), np.uint8) # black image
# img [:] = 255, 0, 0 # blue image
... | code_fim | hard | {
"lang": "python",
"repo": "silvioedu/opencv-tests",
"path": "/src/shapes-texts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = re.sub("VERSION\s*=\s*('|\")\d\.\d.\d('|\")", f"VERSION = '{major}.{minor}.{patch}'", s, re.MULTILINE)
s = re.sub("GIT_COMMIT\s*=\s*('|\")[a-zA-Z0-9]*('|\")", f"GIT_COMMIT = '{commit}'", s, re.MULTILINE)
with open(path, 'w') as f:
f.write(s)<|fim_prefix|># repo: oledid-forks/git-xl path: /script... | code_fim | hard | {
"lang": "python",
"repo": "oledid-forks/git-xl",
"path": "/scripts/windows/update-version-info.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># update git-xl.py (VERSION and COMMIT)
path = 'src\\cli.py'
with open(path, 'r') as f:
s = f.read()
s = re.sub("VERSION\s*=\s*('|\")\d\.\d.\d('|\")", f"VERSION = '{major}.{minor}.{patch}'", s, re.MULTILINE)
s = re.sub("GIT_COMMIT\s*=\s*('|\")[a-zA-Z0-9]*('|\")", f"GIT_COMMIT = '{commit}'", s, re.MUL... | code_fim | hard | {
"lang": "python",
"repo": "oledid-forks/git-xl",
"path": "/scripts/windows/update-version-info.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oledid-forks/git-xl path: /scripts/windows/update-version-info.py
import os
import json
import re
base_directory = os.path.join('scripts', 'windows')
# read build number, repo tag name and git commit hash from env vars
build = os.getenv('GITHUB_RUN_ATTEMPT', '0')
if os.getenv('GITHUB_REF_TYPE'... | code_fim | medium | {
"lang": "python",
"repo": "oledid-forks/git-xl",
"path": "/scripts/windows/update-version-info.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahajrod/MAVR path: /scripts/sanger/handle_sanger_files.py
#!/usr/bin/env python
__author__ = 'Sergei F. Kliver'
import argparse
from Pipelines import SangerPipeline
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input_dir", action="store", dest="input_dir", required=True,
... | code_fim | hard | {
"lang": "python",
"repo": "mahajrod/MAVR",
"path": "/scripts/sanger/handle_sanger_files.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>SangerPipeline.workdir = args.output_dir
SangerPipeline.handle_sanger_data(args.input_dir, args.output_prefix, outdir=None,
read_subfolders=args.read_subfolders,
min_mean_qual=args.min_mean_qual, min_median_qual=args.min_median_qual,
... | code_fim | hard | {
"lang": "python",
"repo": "mahajrod/MAVR",
"path": "/scripts/sanger/handle_sanger_files.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not np.shape(wind) == np.shape(self.data.wind) and \
np.shape(solar) == np.shape(self.data.solar) and \
np.shape(load) == np.shape(self.data.load):
raise ValueError("Array shape mismatch: check self.data.(wind,solar,load).shape")
self.data.tim... | code_fim | hard | {
"lang": "python",
"repo": "TueVJ/Bilevel-ATC",
"path": "/optimization_models/RT_Nodal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TueVJ/Bilevel-ATC path: /optimization_models/RT_Nodal.py
import numpy as np
import gurobipy as gb
import networkx as nx
import defaults
import pickle
from myhelpers import symmetrize_dict
from itertools import izip
from collections import defaultdict
from load_fnct import load_network, load_gener... | code_fim | hard | {
"lang": "python",
"repo": "TueVJ/Bilevel-ATC",
"path": "/optimization_models/RT_Nodal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> injection_to_flow = {}
from collections import defaultdict
indict = defaultdict(list)
outdict = defaultdict(list)
for e in edges:
outdict[e[0]].append(e)
indict[e[1]].append(e)
for t in taus:
for n in nodes:
... | code_fim | hard | {
"lang": "python",
"repo": "TueVJ/Bilevel-ATC",
"path": "/optimization_models/RT_Nodal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='pysaurus',
debug=False,
bootloader_ignore_signals=False,
... | code_fim | hard | {
"lang": "python",
"repo": "notoraptor/pysaurus",
"path": "/other/installation/pyinstaller/run.spec",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: notoraptor/pysaurus path: /other/installation/pyinstaller/run.spec
# -*- mode: python ; coding: utf-8 -*-
# pyinstaller.py --windowed --noconsole --clean --onefile AppStart\AppStart.spec
# pyinstaller --windowed --noconsole --clean --onefile run.spec
block_cipher = None
a = Analysis(['pysaur... | code_fim | hard | {
"lang": "python",
"repo": "notoraptor/pysaurus",
"path": "/other/installation/pyinstaller/run.spec",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Muhtadir/CSE-616-Semester-Form-Fillup-System path: /website/api/migrations/0009_auto_20190208_1101.py
# Generated by Django 2.1.5 on 2019-02-08 11:01
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='exam',
... | code_fim | medium | {
"lang": "python",
"repo": "Muhtadir/CSE-616-Semester-Form-Fillup-System",
"path": "/website/api/migrations/0009_auto_20190208_1101.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('api', '0008_auto_20190207_1427'),
]
operations = [
migrations.AlterField(
model_name='exam',
name='ldo_payment',
field=models.DateField(default=None, null=True),
),
migrations.AlterField(
model_... | code_fim | medium | {
"lang": "python",
"repo": "Muhtadir/CSE-616-Semester-Form-Fillup-System",
"path": "/website/api/migrations/0009_auto_20190208_1101.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mapattacker/cheatsheets path: /python/pandas.py
lip board into dataframe!!!
pd.read_clipboard()
# JSON
df=pd.read_json(path)
df.to_json('/Users/xxx/Desktop/d.json') # display by index
out = df.to_json(orient="records") # display by row, key=colname, value=cell value
dict_ = df.to_dict(o... | code_fim | hard | {
"lang": "python",
"repo": "mapattacker/cheatsheets",
"path": "/python/pandas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## regex
df['date'] = df['raw'].str.extract('(....-..-..)', expand=True) #extract
# 0 2014-12-23
# 1 2010-02-23
# 2 2014-06-20
# 3 2014-03-14
df['node'] = df['node'].str.replace(r'[1-9]+\s','') #replace
## split by delimiter
# example of value 'Online,Sales,Adult'
t... | code_fim | hard | {
"lang": "python",
"repo": "mapattacker/cheatsheets",
"path": "/python/pandas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mapattacker/cheatsheets path: /python/pandas.py
# get all keys
keys = [i for i in dict_of_companies]
# print each dataframe out
for i in keys:
print(dict_of_companies[i])
#--------------------------------------------------------
## SET VALUES PER CELL, GOOD FOR ITERATION
df.set_va... | code_fim | hard | {
"lang": "python",
"repo": "mapattacker/cheatsheets",
"path": "/python/pandas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def node(self) -> HtmlNode:
'''
Source code as an Arjuna :class:`~arjuna.tpi.parser.xml.XmlNode` for advanced inquiry and parsing.
'''
return self.__node
@property
def _elem_node(self):
return self.__elem_node
def _process_elem_no... | code_fim | hard | {
"lang": "python",
"repo": "amiablea2/arjuna",
"path": "/arjuna/tpi/guiauto/source/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amiablea2/arjuna path: /arjuna/tpi/guiauto/source/base.py
# This file is a part of Arjuna
# Copyright 2015-2021 Rahul Verma
# Website: www.RahulVerma.net
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | code_fim | hard | {
"lang": "python",
"repo": "amiablea2/arjuna",
"path": "/arjuna/tpi/guiauto/source/base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wannaphong/flappy path: /flappy/display/displayobjectcontainer.py
from flappy.display import InteractiveObject
from flappy._core import _DisplayObjectContainer
class DisplayObjectContainer(_DisplayObjectContainer, InteractiveObject):
def __init__(self, name=None):
InteractiveObject... | code_fim | hard | {
"lang": "python",
"repo": "wannaphong/flappy",
"path": "/flappy/display/displayobjectcontainer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def clear(self):
InteractiveObject.clear(self)
self.removeAllChildren()
@property
def mouseChildren(self):
return self.getMouseChildren()
@mouseChildren.setter
def mouseChildren(self, value):
self.setMouseChildren(value)
@property
def ... | code_fim | hard | {
"lang": "python",
"repo": "wannaphong/flappy",
"path": "/flappy/display/displayobjectcontainer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>l(log.DEBUG)
# set a format which is simpler for console use
formatter = log.Formatter('[%(asctime)s %(filename)18s] %(levelname)-7s - %(message)7s',
"%Y-%m-%d %H:%M:%S")
console.setFormatter(formatter)
# add the handler to the root logger
log.getLogger('').addHandler(console)
l... | code_fim | medium | {
"lang": "python",
"repo": "orlandodiaz/barchart",
"path": "/log.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "%Y-%m-%d %H:%M:%S")
console.setFormatter(formatter)
# add the handler to the root logger
log.getLogger('').addHandler(console)
logger = log.getLogger(__name__)<|fim_prefix|># repo: orlandodiaz/barchart path: /log.py
import logging as log
# Log to file settings
log.basicConfig(
filename='sto... | code_fim | medium | {
"lang": "python",
"repo": "orlandodiaz/barchart",
"path": "/log.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: orlandodiaz/barchart path: /log.py
import logging as log
# Log to file settings
log.basicConfig(
filename='stock_notify.log',
filemode='w',
format='[%(asctime)s %(filename)18s] %(levelname)-7s - %(message)7s',
datefmt='%Y-%m-%d %H:%M:%S',
level=log.DEBUG)
# Log to console set... | code_fim | medium | {
"lang": "python",
"repo": "orlandodiaz/barchart",
"path": "/log.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertpardillo/Funnel path: /src/server_CFD/algorithms/compressor/translator.py
openFoam.case import Case
from API.openFoam.blockMesh_2 import write_block_mesh
import os
import time
def init_analysis(session, args):
"""
args = [name, profile.up, profile.down, s, betta_1, betta_2... | code_fim | hard | {
"lang": "python",
"repo": "robertpardillo/Funnel",
"path": "/src/server_CFD/algorithms/compressor/translator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> session.case.file_T.set_field('boundaryField', {'inlet': {'type': 'fixedValue', 'value': 'uniform {}'.format(args[10])},
'outlet': {'type': 'zeroGradient'},
'intrados': {'type': 'zeroGradient'},
'extrados': {'type': 'z... | code_fim | hard | {
"lang": "python",
"repo": "robertpardillo/Funnel",
"path": "/src/server_CFD/algorithms/compressor/translator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertpardillo/Funnel path: /src/server_CFD/algorithms/compressor/translator.py
Foam.case import Case
from API.openFoam.blockMesh_2 import write_block_mesh
import os
import time
def init_analysis(session, args):
"""
args = [name, profile.up, profile.down, s, betta_1, betta_2, W1... | code_fim | hard | {
"lang": "python",
"repo": "robertpardillo/Funnel",
"path": "/src/server_CFD/algorithms/compressor/translator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(struct.unpack('<H', struct.pack('<H', (2**8)-1)))
print(struct.unpack('>H', struct.pack('>H', (2**8)-1)))
#b = bytes(4)
#struct.pack_into('<H', b, 2, (2**8)-1)#TypeError: argument must be read-write bytes-like object, not bytes
#print(b)
ba = bytearray(4)#引数=2だとstruct.error: pack_into requires a bu... | code_fim | medium | {
"lang": "python",
"repo": "pylangstudy/201708",
"path": "/31/00/pack_into.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pylangstudy/201708 path: /31/00/pack_into.py
import struct
print(struct.pack('<2B', 0, (2**8)-1))#リトルエンディアン, unsigned char * 2件
print(struct.pack('>2B', 0, (2**8)-1))#ビッグエンディアン, unsigned char * 2件
<|fim_suffix|>#b = bytes(4)
#struct.pack_into('<H', b, 2, (2**8)-1)#TypeError: argument must be rea... | code_fim | hard | {
"lang": "python",
"repo": "pylangstudy/201708",
"path": "/31/00/pack_into.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bitwise-JUET/BitsOJ path: /Server/Interface/interface_updates.py
import time
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPalette, QColor, QPixmap
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QTimer, Qt, QModelIndex, qInstallMessageHandler, QPoint
class interface_upda... | code_fim | hard | {
"lang": "python",
"repo": "Bitwise-JUET/BitsOJ",
"path": "/Server/Interface/interface_updates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif code == 'AddQuery':
row_count = self.query_model.rowCount()
self.query_model.setRowCount(row_count + 1)
self.query_model.setItem(row_count, 0, QTableWidgetItem(str(data['Query ID'])))
self.query_model.setItem(row_count, 1, QTableWidgetItem(str(data['Client ID'])))
self.query_mo... | code_fim | hard | {
"lang": "python",
"repo": "Bitwise-JUET/BitsOJ",
"path": "/Server/Interface/interface_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._company_id
@property
def title_id(self):
return self._title_id
@property
def company_name(self):
return self._company_name
@property
def category(self):
return self._category
@property
def notes(self):
return self._no... | code_fim | hard | {
"lang": "python",
"repo": "zembrodt/pymdb",
"path": "/pymdb/models/company.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> __slots__ = '_company_id', '_title_id', '_company_name', '_category', '_notes'
def __init__(self, company_id, title_id, company_name, category, notes):
self._company_id = company_id
self._title_id = title_id
self._company_name = company_name
self._category = catego... | code_fim | hard | {
"lang": "python",
"repo": "zembrodt/pymdb",
"path": "/pymdb/models/company.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zembrodt/pymdb path: /pymdb/models/company.py
"""The classes used to represent various information about companies on IMDb.
All information for the classes here will be scraped from IMDb web pages.
"""
from ..utils import is_int
class CompanyScrape:
"""Stores a title a company is credited... | code_fim | hard | {
"lang": "python",
"repo": "zembrodt/pymdb",
"path": "/pymdb/models/company.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: corgi-sw/multi-speaker-tacotron-tensorflow path: /app.py
import os, traceback
import hashlib
import argparse
from flask_cors import CORS
from flask import Flask, request, render_template, jsonify, \
send_from_directory, make_response, send_file
from hparams import hparams
from audio impo... | code_fim | hard | {
"lang": "python",
"repo": "corgi-sw/multi-speaker-tacotron-tensorflow",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser()
config = parser.parse_args()
config.log_dir = 'logs'
config.data_paths = './datasets/msw'
config.load_path = None
config.initialize_path = './logs/pre_m'
config.num_test_per_speaker = int(2)
config.random_seed = int(123)
config.summa... | code_fim | hard | {
"lang": "python",
"repo": "corgi-sw/multi-speaker-tacotron-tensorflow",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntg28/recall path: /recall/cli.py
import recall
from recall import conf
from os import (path, getenv)
from sys import argv
from typing import (Dict, List)
<|fim_suffix|> path_conf: str = getenv("HOME") + "/.config/recall/recall.conf"
user_conf: Dict[str, str] = conf.conf_from(path_conf)
... | code_fim | hard | {
"lang": "python",
"repo": "ntg28/recall",
"path": "/recall/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path_conf: str = getenv("HOME") + "/.config/recall/recall.conf"
user_conf: Dict[str, str] = conf.conf_from(path_conf)
fp: str = argv[1]
questions: recall.Questions
with open(fp, "r") as f:
questions = recall.get_questions(f.read(), user_conf)
if not questions:
ra... | code_fim | hard | {
"lang": "python",
"repo": "ntg28/recall",
"path": "/recall/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> argv_err: int = argv_validation(argv)
if (argv_err == 1):
raise SystemExit("E: missing [FILE] parameter.")
elif (argv_err == 2):
raise SystemExit(f"E: {argv[1]} not exists.")
path_conf: str = getenv("HOME") + "/.config/recall/recall.conf"
user_conf: Dict[str, str] = ... | code_fim | medium | {
"lang": "python",
"repo": "ntg28/recall",
"path": "/recall/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CrackerCat/ctypeslib path: /ctypeslib/__init__.py
# -*- coding: utf-8 -*-
# ctypeslib package
from pkg_resources import get_distribution, DistributionNotFound
import os
import sys
try:
_dist = get_distribution('ctypeslib2')
# Normalize case for Windows systems
# if you are in a virt... | code_fim | hard | {
"lang": "python",
"repo": "CrackerCat/ctypeslib",
"path": "/ctypeslib/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def clang_version():
return cindex.Config.library_file
from ctypeslib.codegen.codegenerator import translate, translate_files
__all__ = ['translate', 'translate_files', 'clang_version']<|fim_prefix|># repo: CrackerCat/ctypeslib path: /ctypeslib/__init__.py
# -*- coding: utf-8 -*-
# ctypeslib packa... | code_fim | hard | {
"lang": "python",
"repo": "CrackerCat/ctypeslib",
"path": "/ctypeslib/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t Coach
import figet.adaptive_thres
__all__ = [figet.Constants, figet.Models]<|fim_prefix|># repo: nlpAThits/figet path: /figet/__init__.py
import figet.Constants
import figet.Models
import figet.evaluate
import figet<|fim_middle|>.utils
from figet.Optim import Optim
from figet.Dataset import Dataset
fr... | code_fim | medium | {
"lang": "python",
"repo": "nlpAThits/figet",
"path": "/figet/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nlpAThits/figet path: /figet/__init__.py
import figet.Constants
import figet.Models
import figet.evaluate
import figet.utils
from figet.Optim import Optim
from figet.Dataset import Dataset
from fi<|fim_suffix|>t Coach
import figet.adaptive_thres
__all__ = [figet.Constants, figet.Models]<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "nlpAThits/figet",
"path": "/figet/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZR-Huang/AlgorithmsPractices path: /Leetcode/Coding Interviews/24_Reverse_linked_List.py
'''
注意:本题与主站 206 题相同:https://leetcode-cn.com/problems/reverse-linked-list/
定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。
示例:
输入: 1->2->3->4->5->NULL
输出: 5->4->3->2->1->NULL
<|fim_suffix|> # double pointers
... | code_fim | hard | {
"lang": "python",
"repo": "ZR-Huang/AlgorithmsPractices",
"path": "/Leetcode/Coding Interviews/24_Reverse_linked_List.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # double pointers
if not head.next: # only one node
return head
last_node, p1, p2 = None, head, head.next
while p2:
p1.next = last_node
last_node = p1
p1 = p2
p2 = p2.next
p1.next = last_node
return... | code_fim | medium | {
"lang": "python",
"repo": "ZR-Huang/AlgorithmsPractices",
"path": "/Leetcode/Coding Interviews/24_Reverse_linked_List.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with m.step("Step 1 - Performing log in with wrong user"):
login = LoginPage(driver)
login.type_to_username_tb("WrongUser")
login.type_to_password_tb("Wrong password")
login.click_on_login_btn_and_stay_in_login_page()
text = login.get_alert_msg_text()
as... | code_fim | medium | {
"lang": "python",
"repo": "itaiag/login-example",
"path": "/pytest-tests/tests/test_login.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with m.step("Step 1 - Doing some operations and then fails"):
login = LoginPage(driver)
login.type_to_username_tb("WrongUser")
login.type_to_password_tb("Wrong password")
login.click_on_login_btn_and_stay_in_login_page()
login.do_failure()
@m.fail
def test_tha... | code_fim | medium | {
"lang": "python",
"repo": "itaiag/login-example",
"path": "/pytest-tests/tests/test_login.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itaiag/login-example path: /pytest-tests/tests/test_login.py
'''
Created on Jul 9, 2015
Suite that tests the various login possibilities which
most of them should result as unsuccessful login
@author: Itai
'''
<|fim_suffix|>
@m.fail
def test_that_fails_with_failure(driver):
with m.step("S... | code_fim | hard | {
"lang": "python",
"repo": "itaiag/login-example",
"path": "/pytest-tests/tests/test_login.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunwei19910119/education_platform path: /apps/users/adminx.py
# encoding: utf-8
from courses.models import Course, Video, Lesson, CourseResource
__author__ = 'sunwei'
__date__ = '2018/5/9 上午9:3'
import xadmin
from django.contrib.auth.models import Group, Permission
from operation.models import... | code_fim | hard | {
"lang": "python",
"repo": "sunwei19910119/education_platform",
"path": "/apps/users/adminx.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 创建banner的管理类
class BannerAdmin(object):
#配置展示字段
list_display = ['title', 'image', 'url','index', 'add_time']
#配置搜索字段
search_fields = ['title', 'image', 'url','index']
#配置筛选字段
list_filter = ['title', 'image', 'url','index', 'add_time']
# 将model与admin管理器进行关联注册
xadmin.site.registe... | code_fim | hard | {
"lang": "python",
"repo": "sunwei19910119/education_platform",
"path": "/apps/users/adminx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: supramolecular-toolkit/stk path: /src/stk/molecular/topology_graphs/utilities/functional_group_sorter.py
"""
Functional Group Sorter
=======================
"""
import numpy as np
from stk.utilities import get_acute_vector
from .sorter import _Sorter
class _FunctionalGroupSorter(_Sorter):
... | code_fim | hard | {
"lang": "python",
"repo": "supramolecular-toolkit/stk",
"path": "/src/stk/molecular/topology_graphs/utilities/functional_group_sorter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._building_block = building_block
fg0_position = building_block.get_centroid(
atom_ids=next(
building_block.get_functional_groups()
).get_placer_ids(),
)
self._placer_centroid = (
placer_centroid
) = building_b... | code_fim | medium | {
"lang": "python",
"repo": "supramolecular-toolkit/stk",
"path": "/src/stk/molecular/topology_graphs/utilities/functional_group_sorter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dython-sky/AID1908 path: /study/1905/month01/code/Stage1/day08/exercise09.py
"""
定义函数,根据小时,分钟,秒,计算总秒数
要求:可以只计算小时 --> 秒
可以只计算分钟 --> 秒
可以只计算小时+分钟 --> 秒
<|fim_suffix|>second
# 小时 + 分钟 + 秒
print(get_total_second(1, 1, 1))
# 小时 + 分钟
print(get_total_second(2, 3))
# 分钟... | code_fim | medium | {
"lang": "python",
"repo": "Dython-sky/AID1908",
"path": "/study/1905/month01/code/Stage1/day08/exercise09.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>second
# 小时 + 分钟 + 秒
print(get_total_second(1, 1, 1))
# 小时 + 分钟
print(get_total_second(2, 3))
# 分钟 + 秒
print(get_total_second(minute=10, second=5))
# 小时
print(get_total_second(2))
# 分钟
print(get_total_second(minute=2))<|fim_prefix|># repo: Dython-sky/AID1908 path: /study/1905/month01/code/Stage1/day08/ex... | code_fim | medium | {
"lang": "python",
"repo": "Dython-sky/AID1908",
"path": "/study/1905/month01/code/Stage1/day08/exercise09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>get_total_second(minute=10, second=5))
# 小时
print(get_total_second(2))
# 分钟
print(get_total_second(minute=2))<|fim_prefix|># repo: Dython-sky/AID1908 path: /study/1905/month01/code/Stage1/day08/exercise09.py
"""
定义函数,根据小时,分钟,秒,计算总秒数
要求:可以只计算小时 --> 秒
可以只计算分钟 --> 秒
可以只计算小时+分钟 --> ... | code_fim | medium | {
"lang": "python",
"repo": "Dython-sky/AID1908",
"path": "/study/1905/month01/code/Stage1/day08/exercise09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xCrypt0r/Baekjoon path: /src/16/16199.py
"""
16199. 나이 계산하기
작성자: xCrypt0r
언어: Python 3
사용 메모리: 29,380 KB
소요 시간: 64 ms
해결 날짜: 2020년 9월 20일
"""
def main():
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_middle|> y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input()... | code_fim | medium | {
"lang": "python",
"repo": "xCrypt0r/Baekjoon",
"path": "/src/16/16199.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input().split())
age = y2 - y1
print(age - (0 if m1 < m2 or (m1 == m2 and d1 <= d2) else 1), age + 1, age, sep='\n')
if __name__ == '__main__':
main()<|fim_prefix|># repo: xCrypt0r/Baekjoon path: /src/16/16199.py
"""
16199... | code_fim | easy | {
"lang": "python",
"repo": "xCrypt0r/Baekjoon",
"path": "/src/16/16199.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> execute(
*(
f"{VENV_SHELL} pipenv_to_requirements "
f"--dev-output {settings.CONFIG_FOLDER}/requirements-dev.txt "
f"--output {settings.CONFIG_FOLDER}/requirements.txt".strip().split(" ")
)
)
if not os.path.exists(f"{settings.CONFIG_FOLDER}/r... | code_fim | hard | {
"lang": "python",
"repo": "matthewdeanmartin/cheese_grader",
"path": "/navio_tasks/dependency_commands/cli_pin_dependencies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matthewdeanmartin/cheese_grader path: /navio_tasks/dependency_commands/cli_pin_dependencies.py
"""
Pin deps
"""
import os
from navio_tasks import settings as settings
from navio_tasks.cli_commands import check_command_exists, execute
from navio_tasks.settings import VENV_SHELL
from navio_tasks.u... | code_fim | hard | {
"lang": "python",
"repo": "matthewdeanmartin/cheese_grader",
"path": "/navio_tasks/dependency_commands/cli_pin_dependencies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def portal_templates_id_delete(self, id, **kwargs):
"""
Delete a model instance by {{id}} from the data source.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be inv... | code_fim | hard | {
"lang": "python",
"repo": "tweak-com-public/tweak-api-client-python",
"path": "/TweakApi/apis/portal_template_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tweak-com-public/tweak-api-client-python path: /TweakApi/apis/portal_template_api.py
get(self, **kwargs):
"""
Find all instances of the model matched by filter from the data source.
This method makes a synchronous HTTP request by default. To make an
async... | code_fim | hard | {
"lang": "python",
"repo": "tweak-com-public/tweak-api-client-python",
"path": "/TweakApi/apis/portal_template_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Check whether a model instance exists in the data source.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def call... | code_fim | hard | {
"lang": "python",
"repo": "tweak-com-public/tweak-api-client-python",
"path": "/TweakApi/apis/portal_template_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # qemu
file_path = f"qemu_io_{i}.txt"
ssh_command = "ssh root@172.19.0.2"
os.system(f"{ssh_command} \"{io_command}\" > {file_path}")<|fim_prefix|># repo: I-Rinka/Virtualization-Comparison path: /IO_Disk/get_record.py
import os
io_command = 'iozone -r 1 -r 2 -r 3 -r 4 -r 5 -r 6 -r 7 -r 8 -... | code_fim | medium | {
"lang": "python",
"repo": "I-Rinka/Virtualization-Comparison",
"path": "/IO_Disk/get_record.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: I-Rinka/Virtualization-Comparison path: /IO_Disk/get_record.py
import os
io_command = 'iozone -r 1 -r 2 -r 3 -r 4 -r 5 -r 6 -r 7 -r 8 -r 9 -r 10 -r 16 -r 32 -r 64 -r 128 -r 256 -r 512 -i 0 -i 1 -i 2 -s 1G -I'
<|fim_suffix|> # qemu
file_path = f"qemu_io_{i}.txt"
ssh_command = "ssh root... | code_fim | medium | {
"lang": "python",
"repo": "I-Rinka/Virtualization-Comparison",
"path": "/IO_Disk/get_record.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: servvv/HumanManagerBattle path: /pygameDemo/pygameDemo4.py
# _*_ coding:utf-8 _*_
import pygame
from pygame.locals import *
from sys import exit
background_path="img/sushiplate.jpg"
pygame.init()
screen=pygame.display.set_mode((640,480),0,32)
background=pygame.image.load(background_path).convert(... | code_fim | medium | {
"lang": "python",
"repo": "servvv/HumanManagerBattle",
"path": "/pygameDemo/pygameDemo4.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
for event in pygame.event.get():
if event.type==QUIT:
exit()
if event.type==KEYDOWN:
if event.key==K_f:
FullScreen = not FullScreen
if FullScreen:
screen=pygame.display.set_mode((640,480),FULLSCREEN,32)
else:
screen=pygame.display.set_mode((640,480),0,32)
screen.blit... | code_fim | medium | {
"lang": "python",
"repo": "servvv/HumanManagerBattle",
"path": "/pygameDemo/pygameDemo4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(self.game.is_attacked('b1', 1))
def test_not_attacked_squares(self):
self.assertFalse(self.game.is_attacked('a1', 1))
def test_protect_alias(self):
self.assertTrue(self.game.is_protected(self.knight_h5))
def test_black_king_attack(self):
self.... | code_fim | hard | {
"lang": "python",
"repo": "thearrow9/pychess",
"path": "/test/test_piece_move.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thearrow9/pychess path: /test/test_piece_move.py
import unittest
import sys
sys.path.append('pychess')
import game
class PieceMoveTest(unittest.TestCase):
def setUp(self):
self.game = game.Game()
#build Kg5, Qh6, Re2, Bg6, Nh5, Pf5, Pf4, Pd3, Pb3, Pg2, Ph2
#kd5, ba4,... | code_fim | hard | {
"lang": "python",
"repo": "thearrow9/pychess",
"path": "/test/test_piece_move.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertSetEqual({'h7', 'g7', 'f8', 'h8'},
self.queen_h6.moves)
def test_king_g5_moves(self):
self.assertSetEqual({'f6', 'g4', 'h4'},
self.king_g5.moves)
def test_knight_h5_moves(self):
self.assertSetEqual({'g3', 'g7', 'f6'},
self.kn... | code_fim | hard | {
"lang": "python",
"repo": "thearrow9/pychess",
"path": "/test/test_piece_move.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.