text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: StingSting/2048-api path: /game2048/agents.py import numpy as np import torch import torch.nn as nn import torch.utils.data as data CHANNEL=12 def grid_ohe(input): out=[] each_c=[] for i in range(CHANNEL): ret=np.zeros(shape=(4,4),dtype=int) for r in range(4): ...
code_fim
hard
{ "lang": "python", "repo": "StingSting/2048-api", "path": "/game2048/agents.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> x_col = st.selectbox("Select x axis for bar chart", mana.columns) xcol_string=x_col+":O" if st.checkbox("Show as continuous?",key="bar_chart_x_is_cont"): xcol_string=x_col+":Q" y_col = st.selectbox("Select y axis for bar chart", mana.columns) z_col = st.selectbox("Select ...
code_fim
medium
{ "lang": "python", "repo": "banjtheman/grimoire", "path": "/grim/spells/nature/bar_chart.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: banjtheman/grimoire path: /grim/spells/nature/bar_chart.py import pandas as pd import numpy as np import altair as alt import streamlit as st import sys, argparse, logging import json <|fim_suffix|> x_col = st.selectbox("Select x axis for bar chart", mana.columns) xcol_string=x_col+":O" ...
code_fim
medium
{ "lang": "python", "repo": "banjtheman/grimoire", "path": "/grim/spells/nature/bar_chart.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tjsullivan1/tjs.python.sdk path: /utilities/general.py import logging, os, json, csv def main(): return None def init_logging(log_file='log_filename.txt'): logger = logging.getLogger() logger.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(levelname)s -...
code_fim
hard
{ "lang": "python", "repo": "tjsullivan1/tjs.python.sdk", "path": "/utilities/general.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def write_to_csv(usage_detail_dict, csv_file, header): preexist = os.path.exists(csv_file) with open(csv_file, "a", newline='') as file: writer = csv.DictWriter(file, fieldnames=header) if not preexist: writer.writeheader() writer.writerow(usage_detail_dict) ...
code_fim
hard
{ "lang": "python", "repo": "tjsullivan1/tjs.python.sdk", "path": "/utilities/general.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> preexist = os.path.exists(csv_file) with open(csv_file, "a", newline='') as file: writer = csv.DictWriter(file, fieldnames=header) if not preexist: writer.writeheader() writer.writerow(usage_detail_dict) return None if __name__ == '__main__': main()<...
code_fim
hard
{ "lang": "python", "repo": "tjsullivan1/tjs.python.sdk", "path": "/utilities/general.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def is_label_definition(line): """Returns if the line is a LABEL node.""" return line.startswith("LABEL ")<|fim_prefix|># repo: RDIL/dockerlint path: /dockerlint/parser.py def is_base_image_definition(line): """Returns if the line is a FROM node.""" <|fim_middle|> return line.startswith...
code_fim
easy
{ "lang": "python", "repo": "RDIL/dockerlint", "path": "/dockerlint/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns if the line is a LABEL node.""" return line.startswith("LABEL ")<|fim_prefix|># repo: RDIL/dockerlint path: /dockerlint/parser.py def is_base_image_definition(line): <|fim_middle|> """Returns if the line is a FROM node.""" return line.startswith("FROM ") def is_label_definit...
code_fim
medium
{ "lang": "python", "repo": "RDIL/dockerlint", "path": "/dockerlint/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RDIL/dockerlint path: /dockerlint/parser.py def is_base_image_definition(line): """Returns if the line is a FROM node.""" return line.startswith("FROM ") <|fim_suffix|> """Returns if the line is a LABEL node.""" return line.startswith("LABEL ")<|fim_middle|>def is_label_definit...
code_fim
easy
{ "lang": "python", "repo": "RDIL/dockerlint", "path": "/dockerlint/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rshk/CliApp path: /cliapp/__init__.py """ Helpers to create CLI applications. The "standard" application accepts a bunch of options, followed by a command that can accept options + arguments. Example invokation:: myapp.py --dir=/tmp/hello --async create --force --title="Yeah!" Hello Getti...
code_fim
hard
{ "lang": "python", "repo": "rshk/CliApp", "path": "/cliapp/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.old_completer = readline.get_completer() readline.set_completer(new_completer) def __exit__(self, exc_type, exc_val, exc_tb): readline.set_completer(self.old_completer) return CustomCompleter() def run_interactive(self): ...
code_fim
hard
{ "lang": "python", "repo": "rshk/CliApp", "path": "/cliapp/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>00) i, j, k = int(val/100), int(val/10)%10, val%10 if opcode in ops: mode = [k, j, i] mode_index = 0 inputs = [] for input_n in range(1, ops[opcode]['in']+1): a = nums[pc+input_n] if mode[mode_index] == 0: ...
code_fim
hard
{ "lang": "python", "repo": "lamperi/aoc", "path": "/2019/09/solve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lamperi/aoc path: /2019/09/solve.py with open("input.txt") as f: data = f.read().strip() n = [int(a) for a in data.split(",")] from collections import defaultdict def run(nums, INPUT): ops = { 1: { 'in': 2, 'out': 1, 'op': lambda a, b: a+b, ...
code_fim
hard
{ "lang": "python", "repo": "lamperi/aoc", "path": "/2019/09/solve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smilesLzw/SomeIntersting path: /filedownload.py # _*_ coding: utf-8 _*_ # @Author: smiles # @Time : 2020/9/16 9:42 # @File : filedownload.py import os import queue import logging import threading import requests from fake_useragent import UserAgent # 日志配置 logging.basicConfig(le...
code_fim
hard
{ "lang": "python", "repo": "smilesLzw/SomeIntersting", "path": "/filedownload.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while 1: url = self.q.get() print(f'{self.name} begin download {url}') self.download_file(url) self.q.task_done() print(f'{self.name} download completed') def download_file(self, url): ua = UserAgent() header...
code_fim
hard
{ "lang": "python", "repo": "smilesLzw/SomeIntersting", "path": "/filedownload.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: team-c3250-noname/Dork path: /tests/test_dork_cli.py ey', 'use key', 'north', 'move north', 'punch', 'checkscore', 'quit']) run(dork.cli.main, input_values=['play', '...
code_fim
hard
{ "lang": "python", "repo": "team-c3250-noname/Dork", "path": "/tests/test_dork_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_pre_cli_init(run): """init should load given file or print not found message """ out, err = run(dork.cli.the_predork_cli, [], *("", "-i", "test")) assert "test" in out, \ "Failed run the dork.cli.the_predork_cli method: {err}"\ .format(err=err) out, err = run(d...
code_fim
hard
{ "lang": "python", "repo": "team-c3250-noname/Dork", "path": "/tests/test_dork_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_fight(run): """This will test the fight function """ with open('./dork/yaml/default.yml') as file: # Should not call load directly data = yaml.safe_load(file.read()) game = types.Game(data) game.player.position['location'] = 'Jail hallway' damage = 2 ou...
code_fim
hard
{ "lang": "python", "repo": "team-c3250-noname/Dork", "path": "/tests/test_dork_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_partial_channel_non_square_matrix_2(): """Matrix must be square with sys arg.""" with np.testing.assert_raises(ValueError): rho = np.array([[1, 2, 3, 4], [2, 2, 2, 2], [12, 11, 10, 9]]) partial_channel(rho, depolarizing(3), 2) def test_partial_channel_invalid_dim(): ...
code_fim
hard
{ "lang": "python", "repo": "vprusso/toqito", "path": "/tests/test_channel_ops/test_partial_channel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vprusso/toqito path: /tests/test_channel_ops/test_partial_channel.py """Tests for partial_channel.""" import numpy as np import pytest from toqito.channel_ops import partial_channel from toqito.channels import depolarizing from toqito.matrices import pauli def test_partial_channel_depolarizing...
code_fim
hard
{ "lang": "python", "repo": "vprusso/toqito", "path": "/tests/test_channel_ops/test_partial_channel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @blog_blueprint.errorhandler(404) @cache.cached(timeout=app.config.get('CACHE_TIMEOUT'), key_prefix='blog_blueprint.errorhandler') def blog_page_not_found(e): return render_template('blog/404.html'), 404<|fim_prefix|># repo: AndrewNeudegg/CIMC path: /CIMC/routes/blog/views.py from flask import rende...
code_fim
medium
{ "lang": "python", "repo": "AndrewNeudegg/CIMC", "path": "/CIMC/routes/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@blog_blueprint.errorhandler(404) @cache.cached(timeout=app.config.get('CACHE_TIMEOUT'), key_prefix='blog_blueprint.errorhandler') def blog_page_not_found(e): return render_template('blog/404.html'), 404<|fim_prefix|># repo: AndrewNeudegg/CIMC path: /CIMC/routes/blog/views.py from flask import render...
code_fim
hard
{ "lang": "python", "repo": "AndrewNeudegg/CIMC", "path": "/CIMC/routes/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndrewNeudegg/CIMC path: /CIMC/routes/blog/views.py from flask import render_template, abort from jinja2 import TemplateNotFound from ...cache import cache from ... import app from . import blog_blueprint <|fim_suffix|> @blog_blueprint.errorhandler(404) @cache.cached(timeout=app.config.get('CAC...
code_fim
hard
{ "lang": "python", "repo": "AndrewNeudegg/CIMC", "path": "/CIMC/routes/blog/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: htryppcook/data_salmon path: /data_salmon/dataset_writer/csv_dataset_writer.py class CsvDatasetWriter: def __init__(self, dataset, records, output_encoding): <|fim_suffix|> output_stream.write((self.header + "\n").encode(self.output_encoding)) for _, evaluated in zip(range(0, ...
code_fim
medium
{ "lang": "python", "repo": "htryppcook/data_salmon", "path": "/data_salmon/dataset_writer/csv_dataset_writer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def write(self, output_stream, count): output_stream.write((self.header + "\n").encode(self.output_encoding)) for _, evaluated in zip(range(0, int(count)), self.records): output_stream.write( (','.join(evaluated) + "\n").encode(self.output_encoding))<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "htryppcook/data_salmon", "path": "/data_salmon/dataset_writer/csv_dataset_writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('O jogador Venceu!') cont += 1 else: print('O computador Venceu!') break print('Vamos de novo...') print(f'O jogador ganhou {cont} vezes.')<|fim_prefix|># repo: MatheusFilipe21/exercicios-python-3 path: /exercicio68.py from random import randi...
code_fim
hard
{ "lang": "python", "repo": "MatheusFilipe21/exercicios-python-3", "path": "/exercicio68.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MatheusFilipe21/exercicios-python-3 path: /exercicio68.py from random import randint cont = 0 while True: n = int(input('Digite um número: ')) ncomputador = randint(0, 10) total = n + ncomputador op = ' ' while op not in 'PI': <|fim_suffix|> print('O jo...
code_fim
hard
{ "lang": "python", "repo": "MatheusFilipe21/exercicios-python-3", "path": "/exercicio68.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> paragraph_details = { 'type': 'Paragraph', 'style': p.style.name, 'style_ok': style_ok, 'text': text } paragraph_details.update(detail) paragraphs.append(paragraph_details) return paragraph...
code_fim
hard
{ "lang": "python", "repo": "developingAlex/jacow-validator", "path": "/src/jacowvalidator/docutils/paragraph.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: developingAlex/jacow-validator path: /src/jacowvalidator/docutils/paragraph.py import re from jacowvalidator.docutils.styles import check_style from jacowvalidator.docutils.heading import HEADING_DETAILS PARAGRAPH_DETAILS = { 'styles': { 'jacow': 'JACoW_Body Text Indent', 'no...
code_fim
hard
{ "lang": "python", "repo": "developingAlex/jacow-validator", "path": "/src/jacowvalidator/docutils/paragraph.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if dots_R.dir != current_R_dir: dots_R_vel = dots_R_velocity(dots_R.dir) # print(dots.dir, ': ', dots_vel) current_R_dir = dots_R.dir if dots_L.dir != current_L_dir: dots_L_vel = dots_L_velocity(dots_L.dir) # print(dots.dir, ': ', dots_vel) ...
code_fim
hard
{ "lang": "python", "repo": "jLenouvel/muspinB-py", "path": "/plaid_and_dots_Juliette_Juin_2021.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jLenouvel/muspinB-py path: /plaid_and_dots_Juliette_Juin_2021.py #%% from psychopy import visual, clock from psychopy.iohub import client import percepts import utils import stims import expsetup import numpy as np # setting up the plaids init = utils.load_init('./config/init.yaml') ...
code_fim
hard
{ "lang": "python", "repo": "jLenouvel/muspinB-py", "path": "/plaid_and_dots_Juliette_Juin_2021.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dots.speed = dots_vel * (new_time - old_time) # speed in °/frame plaid.phase += velocity(vel_ori) * (new_time - old_time) win.flip()''' while trial_timer.getTime()>0: old_time = new_time new_time = trial_timer.getTime() if new_time <20:#10 Condition = 'Amb' ...
code_fim
hard
{ "lang": "python", "repo": "jLenouvel/muspinB-py", "path": "/plaid_and_dots_Juliette_Juin_2021.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def do_build(self, attributes): return build_load_balancer_target(attributes) def get_service_name(self) -> AwsServiceName: return AwsServiceName.AWS_LOAD_BALANCER_TARGET_GROUP_ATTACHMENT<|fim_prefix|># repo: cbc506/cloudrail-knowledge path: /cloudrail/knowledge/context/aws/reso...
code_fim
hard
{ "lang": "python", "repo": "cbc506/cloudrail-knowledge", "path": "/cloudrail/knowledge/context/aws/resources_builders/terraform/load_balancer_builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbc506/cloudrail-knowledge path: /cloudrail/knowledge/context/aws/resources_builders/terraform/load_balancer_builder.py from cloudrail.knowledge.context.aws.resources_builders.terraform.aws_terraform_builder import AwsTerraformBuilder from cloudrail.knowledge.context.aws.resources_builders.terraf...
code_fim
medium
{ "lang": "python", "repo": "cbc506/cloudrail-knowledge", "path": "/cloudrail/knowledge/context/aws/resources_builders/terraform/load_balancer_builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class LoadBalancerTargetGroupAssociationBuilder(AwsTerraformBuilder): def do_build(self, attributes): return build_load_balancer_target_group_association(attributes) def get_service_name(self) -> AwsServiceName: return AwsServiceName.AWS_LOAD_BALANCER_LISTENER class LoadBalance...
code_fim
hard
{ "lang": "python", "repo": "cbc506/cloudrail-knowledge", "path": "/cloudrail/knowledge/context/aws/resources_builders/terraform/load_balancer_builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: roholazandie/ParlAI path: /parlai/agents/programr/parser/template/nodes/learn.py import xml.etree.ElementTree as ET from parlai.agents.programr.parser.exceptions import ParserException from parlai.agents.programr.parser.template.nodes.base import TemplateNode from parlai.agents.programr.parser.t...
code_fim
hard
{ "lang": "python", "repo": "roholazandie/ParlAI", "path": "/parlai/agents/programr/parser/template/nodes/learn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> xml = "" for category in self.children: xml += "<category>" xml += ET.tostring(category.pattern, 'utf-8').decode('utf-8') xml += ET.tostring(category.topic, 'utf-8').decode('utf-8') xml += ET.tostring(category.that, 'utf-8').decode('utf-8') ...
code_fim
hard
{ "lang": "python", "repo": "roholazandie/ParlAI", "path": "/parlai/agents/programr/parser/template/nodes/learn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": startNode = input() endNode = input() findSimilarity(startNode, endNode)<|fim_prefix|># repo: prashik-s/alexaConnectTheDots path: /similarity.py import wikipedia from connect import giveContent def findSimilarity(fromNode, toNode): <|fim_middle|> ''' Decide the order of sim...
code_fim
hard
{ "lang": "python", "repo": "prashik-s/alexaConnectTheDots", "path": "/similarity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prashik-s/alexaConnectTheDots path: /similarity.py import wikipedia from connect import giveContent def findSimilarity(fromNode, toNode): <|fim_suffix|>if __name__ == "__main__": startNode = input() endNode = input() findSimilarity(startNode, endNode)<|fim_middle|> ''' Decide the order of sim...
code_fim
hard
{ "lang": "python", "repo": "prashik-s/alexaConnectTheDots", "path": "/similarity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NMGRL/pychron path: /pychron/pipeline/tasks/panes.py bj) def enable(self, info, obj): self._toggle_enable(info, obj, True) def disable(self, info, obj): self._toggle_enable(info, obj, False) def enable_permanent(self, info, obj): self._toggle_permanent(info,...
code_fim
hard
{ "lang": "python", "repo": "NMGRL/pychron", "path": "/pychron/pipeline/tasks/panes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def unknowns_toggle_status(self, info, obj): obj = info.ui.context["object"] obj.unknowns_toggle_status() def save_analysis_group(self, info, obj): obj = info.ui.context["object"] obj.save_analysis_group() def play_analysis_video(self, info, obj): obj ...
code_fim
hard
{ "lang": "python", "repo": "NMGRL/pychron", "path": "/pychron/pipeline/tasks/panes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> obj = info.ui.context["object"] obj.recall_references() def configure_unknowns(self, info, obj): pane = info.ui.context["pane"] pane.configure_unknowns() def configure_references(self, info, obj): pane = info.ui.context["pane"] pane.configure_refer...
code_fim
hard
{ "lang": "python", "repo": "NMGRL/pychron", "path": "/pychron/pipeline/tasks/panes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinpz/tools path: /covid19-dashboard/helper_functions.py # Copyright 2020 Google LLC # # 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 # # https://www.apache.org/lice...
code_fim
medium
{ "lang": "python", "repo": "jinpz/tools", "path": "/covid19-dashboard/helper_functions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(state): prev_to_new[name] = state.iloc[0]['state_name'] elif len(county): prev_to_new[name] = " ".join(county.iloc[0]['county_name'].split()[:-1]) + ', ' + county.iloc[0]['state_name'] else: continue return series.rename(prev_to_new)<...
code_fim
hard
{ "lang": "python", "repo": "jinpz/tools", "path": "/covid19-dashboard/helper_functions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thanhkaist/homura path: /test/test_vision/test_data/test_loaders.py from pathlib import Path import pytest from torchvision import transforms from homura.vision import mnist_loaders, cifar10_loaders <|fim_suffix|> for data in ret[0]: data break @pytest.mark.skipif(not Path...
code_fim
hard
{ "lang": "python", "repo": "thanhkaist/homura", "path": "/test/test_vision/test_data/test_loaders.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for data in ret[0]: data break @pytest.mark.skipif(not Path("~/.torch/data/cifar10").expanduser().exists(), reason="To avoid downloading") @pytest.mark.parametrize("val_size", [0, 1000]) def test_cifar10_loaders(val_size): data_augmentation = [transforms.RandomCrop(32, padding=4)...
code_fim
hard
{ "lang": "python", "repo": "thanhkaist/homura", "path": "/test/test_vision/test_data/test_loaders.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rosspeckomplekt/interpersonal path: /interpersonal/classes/trait.py """ A Trait is a type of behavior that a Person displays """ from .trait_dao import TraitDao class Trait(object): """ A Trait is a type of behavior that a Person displays """ def __init__(self, name): ...
code_fim
medium
{ "lang": "python", "repo": "rosspeckomplekt/interpersonal", "path": "/interpersonal/classes/trait.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Get the dominance value of the Trait """ trait = self.traitDao.get_dominance(self.name) dominance = trait[1] return dominance<|fim_prefix|># repo: rosspeckomplekt/interpersonal path: /interpersonal/classes/trait.py """ A Trait is a type of behavior that...
code_fim
hard
{ "lang": "python", "repo": "rosspeckomplekt/interpersonal", "path": "/interpersonal/classes/trait.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Get the friendliness value of the Trait """ trait = self.traitDao.get_friendliness(self.name) friendliness = trait[1] return friendliness def get_dominance(self): """ Get the dominance value of the Trait """ trait = s...
code_fim
hard
{ "lang": "python", "repo": "rosspeckomplekt/interpersonal", "path": "/interpersonal/classes/trait.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: josecriane/MES_srv path: /api/views/user.py from django.contrib.auth.models import User from rest_framework import viewsets <|fim_suffix|> """ This viewset automatically provides `list` and `detail` actions. """ queryset = User.objects.all() serializer_class = UserSerializer<...
code_fim
medium
{ "lang": "python", "repo": "josecriane/MES_srv", "path": "/api/views/user.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ This viewset automatically provides `list` and `detail` actions. """ queryset = User.objects.all() serializer_class = UserSerializer<|fim_prefix|># repo: josecriane/MES_srv path: /api/views/user.py from django.contrib.auth.models import User from rest_framework import viewsets f...
code_fim
easy
{ "lang": "python", "repo": "josecriane/MES_srv", "path": "/api/views/user.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: qyz-thu/gnn_vae path: /tensorkit/layers/split_.py from typing import * from ..tensor import Tensor, Module from .core import * __all__ = ['Branch'] class Branch(BaseLayer): """ A module that maps the input tensor into multiple tensors via sub-modules. :: shared_output = ...
code_fim
medium
{ "lang": "python", "repo": "qyz-thu/gnn_vae", "path": "/tensorkit/layers/split_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, branches: Sequence[Module], shared: Optional[Module] = None): """ Construct a enw :class:`Branch` module. Args: branches: The branch sub-modules. shared: The shared module to apply before the branch s...
code_fim
medium
{ "lang": "python", "repo": "qyz-thu/gnn_vae", "path": "/tensorkit/layers/split_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Constants.State.Building: [(0, 320, True), (32, 320, True), (64, 320, True), (96, 320, True), (128, 320, True)], Constants.State.Harvesting: [(0, 320, True), (32, 320, True), (64, 320, True), (96, 320, True)], ...
code_fim
hard
{ "lang": "python", "repo": "cair/deep-rts", "path": "/DeepRTS/python/gui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cair/deep-rts path: /DeepRTS/python/gui.py bar_width = size for h in range(0, 101): health_bar_surface = pygame.Surface((bar_width, bar_height), flags=SURFTYPE).convert_alpha() rect_green = pygame.Rect((0, 0, h, bar_height)) # Green ...
code_fim
hard
{ "lang": "python", "repo": "cair/deep-rts", "path": "/DeepRTS/python/gui.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for key, value in submods.items(): # Add path separator to end of submodule path to ensure we are matching a directory if path.lstrip('/').startswith(os.path.join(key, '')): return value.url.replace('.git', ''), value.rev, re.sub('^/{}/'.form...
code_fim
hard
{ "lang": "python", "repo": "espressif/esp-afr-sdk", "path": "/docs/idf_extensions/link_roles.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: espressif/esp-afr-sdk path: /docs/idf_extensions/link_roles.py # based on http://protips.readthedocs.io/link-roles.html from __future__ import print_function from __future__ import unicode_literals import re import os import subprocess from docutils import nodes from collections import namedtupl...
code_fim
hard
{ "lang": "python", "repo": "espressif/esp-afr-sdk", "path": "/docs/idf_extensions/link_roles.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',) # DEBUG_TOOLBAR_CONFIG = { # 'DISABLE_PANELS': [ # 'debug_toolbar.panels.redirects.RedirectsPanel', # ], # 'SHOW_TEMPLATE_CONTEXT': True, # } # # end django-debug-toolbar # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev...
code_fim
hard
{ "lang": "python", "repo": "nrsimha/tovp", "path": "/tovp/tovp/settings/local.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># DEBUG_TOOLBAR_CONFIG = { # 'DISABLE_PANELS': [ # 'debug_toolbar.panels.redirects.RedirectsPanel', # ], # 'SHOW_TEMPLATE_CONTEXT': True, # } # # end django-debug-toolbar # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases # DATABASES = { # ...
code_fim
hard
{ "lang": "python", "repo": "nrsimha/tovp", "path": "/tovp/tovp/settings/local.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nrsimha/tovp path: /tovp/tovp/settings/local.py # -*- coding: utf-8 -*- ''' Local Configurations - Runs in Debug mode - Uses console backend for emails - Use Django Debug Toolbar ''' import os from os.path import join <|fim_suffix|># INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',) # DEBUG_TOOLBAR_CO...
code_fim
hard
{ "lang": "python", "repo": "nrsimha/tovp", "path": "/tovp/tovp/settings/local.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rafa-santana/Curso-Python path: /Aula 08/ex20.py import random a1 = input ('Digite o nome do 1º aluno: ') a2 = input ('Digite o nome do 2º aluno: ') a3 = input ('Digite o nome do 3º aluno: ') a4 = <|fim_suffix|>4], k=4) print('A ordem de apresentação sorteada foi: {}'.format(sorteio))<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "rafa-santana/Curso-Python", "path": "/Aula 08/ex20.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>input ('Digite o nome do 4º aluno: ') sorteio = random.sample ([a1,a2,a3,a4], k=4) print('A ordem de apresentação sorteada foi: {}'.format(sorteio))<|fim_prefix|># repo: rafa-santana/Curso-Python path: /Aula 08/ex20.py import random a1 = input ('Digite o nome do 1º aluno: ') a2 = input ('Digi<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "rafa-santana/Curso-Python", "path": "/Aula 08/ex20.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/ironic-inspector path: /ironic_inspector/process.py # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-inspector", "path": "/ironic_inspector/process.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> node_info.finished(istate.Events.finish) LOG.info('Introspection finished successfully', node_info=node_info, data=introspection_data) def reapply(node_uuid, data=None): """Re-apply introspection steps. Re-apply preprocessing, postprocessing and introspection rules on s...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-inspector", "path": "/ironic_inspector/process.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: store_introspection_data(node_uuid, data, processed=False) except Exception: LOG.exception('Encountered exception saving unprocessed ' 'introspection data for node %s', node_uuid, data=data) def get_introspection_data(uuid, processed=True, get_json=Fals...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-inspector", "path": "/ironic_inspector/process.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thkm/LearningApacheSpark path: /doc/code/test_pyspark.py ## set up SparkSession from pyspark.sql import SparkSession <|fim_suffix|>df = spark.read.format('com.databricks.spark.csv').\ options(header='true', \ inferschema='true').\ ...
code_fim
medium
{ "lang": "python", "repo": "thkm/LearningApacheSpark", "path": "/doc/code/test_pyspark.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>df = spark.read.format('com.databricks.spark.csv').\ options(header='true', \ inferschema='true').\ load("/home/feng/Spark/Code/data/Advertising.csv",header=True) df.show(5) df.printSchema()<|fim_prefix|># repo: thkm/Learn...
code_fim
medium
{ "lang": "python", "repo": "thkm/LearningApacheSpark", "path": "/doc/code/test_pyspark.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.udp_socket.close() def query_word(self): while True: # 接收 发送消息 data-->bytes word, addr = self.udp_socket.recvfrom(1024) # 查询到单词解释 mean = self.db.find_word(word.decode()) self.udp_socket.sendto(mean.encode(), addr) if __...
code_fim
hard
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month02/day10/exercise01_server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaofan-zheng/tedu-python-demo path: /month02/day10/exercise01_server.py """ 练习2. 基于udp循环收发程序完成 在客户端输入单词,从服务端那里得到单词解释 并打印出来,要求多个客户端可以一起查询 服务端,利用数据库dict->words表 帮助 客户端完成单词查询,将解释发送给客户端 """ from socket import * import pymysql # 用于数据库的交互 class Database: database_args = { "host": "loca...
code_fim
hard
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month02/day10/exercise01_server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi path: /sdk/python/lib/test/test_translate_output_properties.py ... @pulumi.output_type class InvalidTypeDeclaredSequenceStr(dict): def __init__(self, value: Sequence[str]): pulumi.set(self, "value", value) @property @pulumi.getter def value(self) -> Se...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/sdk/python/lib/test/test_translate_output_properties.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class TranslateOutputPropertiesTests(unittest.TestCase): def test_str_enum(self): result = rpc.translate_output_properties("red", translate_output_property, ContainerColor) self.assertIsInstance(result, ContainerColor) self.assertIsInstance(result, Enum) self.assertEqu...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/sdk/python/lib/test/test_translate_output_properties.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> (InvalidTypeDictStr, {"foo": dict_value}), (InvalidTypeDeclaredDictStr, {"foo": dict_value}), (InvalidTypeOptionalDictStr, {"foo": dict_value}), (InvalidTypeDeclaredOptionalDictStr, {"foo": dict_value}), (InvalidTypeDictOptionalStr, {"foo": dict_...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/sdk/python/lib/test/test_translate_output_properties.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> DEFAULT_TRACKER_POSITIONS = [ ('tracker-head-top', 'Head - near top'), ('tracker-head-bottom', 'Head - near bottom'), ('tracker-body-top', 'Body - near top'), ('tracker-body-bottom', 'Body - near bottom') ] def get_tracker_position_options(): """ This creates the dropdown in the...
code_fim
hard
{ "lang": "python", "repo": "WGBH/django-tracking", "path": "/tracking/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WGBH/django-tracking path: /tracking/utils.py from datetime import datetime from django.conf import settings import pytz def check_tracker(obj, simple=True): if simple: if obj.status > 0: return True return False # we have a gatekeeper now = datet...
code_fim
hard
{ "lang": "python", "repo": "WGBH/django-tracking", "path": "/tracking/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bonlime/pytorch-tools path: /pytorch_tools/segmentation_models/deeplabv3_plus.py import logging import torch.nn as nn from pytorch_tools.modules.decoder import DeepLabHead from pytorch_tools.modules import bn_from_name from .base import EncoderDecoder from .encoders import get_encoder class Dee...
code_fim
hard
{ "lang": "python", "repo": "bonlime/pytorch-tools", "path": "/pytorch_tools/segmentation_models/deeplabv3_plus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(encoder, decoder) self.upsample = nn.Upsample(scale_factor=4, mode="bilinear") if last_upsample else nn.Identity() self.name = f"deeplabv3plus-{encoder_name}" def forward(self, x): """Sequentially pass `x` trough model`s `encoder` and `decoder` (return...
code_fim
hard
{ "lang": "python", "repo": "bonlime/pytorch-tools", "path": "/pytorch_tools/segmentation_models/deeplabv3_plus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Joyce-yanqiongzhang/proj2_storytelling path: /storytelling/storytelling/urls.py """storytelling URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an impor...
code_fim
hard
{ "lang": "python", "repo": "Joyce-yanqiongzhang/proj2_storytelling", "path": "/storytelling/storytelling/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> views.upload_img), path('map_character/', views.map_character), path('generate_story/', views.generate_story), path('sepastory/', views.sepa_storypage), path('take_photo/', views.take_photo_page), path('update_content/', views.update_content), ]<|fim_prefix|># repo: Joyce-yanqiongzhan...
code_fim
hard
{ "lang": "python", "repo": "Joyce-yanqiongzhang/proj2_storytelling", "path": "/storytelling/storytelling/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> theme = models.ForeignKey( 'theme.Theme', verbose_name='統一テーマ案', on_delete=models.CASCADE ) class FirstVote(AbstractVote): class Meta: verbose_name = '予選投票/投票先' verbose_name_plural = verbose_name class FinalVote(AbstractVote): class Meta: ...
code_fim
hard
{ "lang": "python", "repo": "kai0310/penguin", "path": "/theme/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """予選投票 EPTID 記録用のモデル """ class Meta: verbose_name = '予選投票/EPTID' verbose_name_plural = verbose_name class FinalVoteEptid(AbstractVoteEptid): """決選投票 EPTID 記録用のモデル """ class Meta: verbose_name = '決選投票/EPTID' verbose_name_plural = verbose_name cla...
code_fim
hard
{ "lang": "python", "repo": "kai0310/penguin", "path": "/theme/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kai0310/penguin path: /theme/models.py from django.core.validators import MinLengthValidator from django.db import models class Theme(models.Model): """ 統一テーマ案 """ class Meta: verbose_name = '統一テーマ案' verbose_name_plural = verbose_name ordering = ('pk',) ...
code_fim
hard
{ "lang": "python", "repo": "kai0310/penguin", "path": "/theme/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for digit in a: if digit % 2 == 0: even.append(digit) else: odd.append(digit) odd.sort(reverse=True) even.sort(reverse=True) min_len = min(len(odd), len(even)) max_len = max(len(odd), len(even)) ans = 0 if len(odd) == max_len: ans += sum(odd[min(min_len + 1, len(odd)):]) el...
code_fim
easy
{ "lang": "python", "repo": "sgrade/pytest", "path": "/codeforces/1144B.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sgrade/pytest path: /codeforces/1144B.py # B. Parity Alternated Deletions n = int(input()) a = list(map(int, input().split())) <|fim_suffix|>if len(odd) == max_len: ans += sum(odd[min(min_len + 1, len(odd)):]) else: ans += sum(even[min(min_len + 1, len(even)):]) print(ans)<|fim_middle|...
code_fim
hard
{ "lang": "python", "repo": "sgrade/pytest", "path": "/codeforces/1144B.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alexeino/oauth-microservice path: /api/users/serializers.py from django.contrib.auth import models from rest_framework import serializers class UserPermissionSerializer(serializers.HyperlinkedModelSerializer): """ User permissions are serialized/deserialized with the following fields. ...
code_fim
hard
{ "lang": "python", "repo": "Alexeino/oauth-microservice", "path": "/api/users/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_permissions(self, user): # Django doesn't have a get_all_permissions method that returns the # actual permissions, only the string names, so we have to build our # own result queryset to use. qs = list(user.user_permissions.all()) for group in user.group...
code_fim
hard
{ "lang": "python", "repo": "Alexeino/oauth-microservice", "path": "/api/users/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ghomsi/PyRate path: /pyrate/core/gamma.py # This Python module is part of the PyRate software package. # # Copyright 2020 Geoscience Australia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
code_fim
hard
{ "lang": "python", "repo": "ghomsi/PyRate", "path": "/pyrate/core/gamma.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _frequency_to_wavelength(freq): """ Convert radar frequency to wavelength """ return ifc.SPEED_OF_LIGHT_METRES_PER_SECOND / freq def combine_headers(hdr0, hdr1, dem_hdr): """ Combines metadata for first and second image epochs and DEM into a single dictionary for an inter...
code_fim
hard
{ "lang": "python", "repo": "ghomsi/PyRate", "path": "/pyrate/core/gamma.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucgiffon/psm-nets path: /code/scripts/2020/01/0_0_soft_entropy_regularization_sprase_facto_net.py """ This script finds a palminized model with given arguments then finetune it. Usage: script.py [-h] [-v|-vv] --walltime int [--seed int] [--sparsity-factor=int] [--nb-factor=intorstr] [--tb]...
code_fim
hard
{ "lang": "python", "repo": "lucgiffon/psm-nets", "path": "/code/scripts/2020/01/0_0_soft_entropy_regularization_sprase_facto_net.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # "nb_flop": nb_flop_model, # "nb_param": nb_param_model, } resprinter.add(dct_results) resprinter.print() base_model.summary() call_backs = [] model_checkpoint_callback = keras.callbacks.ModelCheckpoint(str(paraman["output_file_modelprinter"]), monitor='val_loss...
code_fim
hard
{ "lang": "python", "repo": "lucgiffon/psm-nets", "path": "/code/scripts/2020/01/0_0_soft_entropy_regularization_sprase_facto_net.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>v0.1.0 + Initial version + requirements.txt """ __version__ = '0.2.1' __requires__ = ['requests', 'colorama', 'urllib', 'lxml']<|fim_prefix|># repo: deskflop/ohrenbaer-podcast path: /source/version.py # -*- coding: utf-8 -*- """ Changelog v0.2.1 + minor code changes/cleanup regarding unicode <|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "deskflop/ohrenbaer-podcast", "path": "/source/version.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__version__ = '0.2.1' __requires__ = ['requests', 'colorama', 'urllib', 'lxml']<|fim_prefix|># repo: deskflop/ohrenbaer-podcast path: /source/version.py # -*- coding: utf-8 -*- """ Changelog v0.2.1 + minor code changes/cleanup regarding unicode v0.2.0 + removed arg 'podcast-url' + set url for podcast t...
code_fim
easy
{ "lang": "python", "repo": "deskflop/ohrenbaer-podcast", "path": "/source/version.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deskflop/ohrenbaer-podcast path: /source/version.py # -*- coding: utf-8 -*- """ Changelog v0.2.1 + minor code changes/cleanup regarding unicode <|fim_suffix|>v0.1.0 + Initial version + requirements.txt """ __version__ = '0.2.1' __requires__ = ['requests', 'colorama', 'urllib', 'lxml']<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "deskflop/ohrenbaer-podcast", "path": "/source/version.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xhtml2pdf/xhtml2pdf path: /xhtml2pdf/builders/watermarks.py import pypdf from PIL import Image from reportlab.pdfgen.canvas import Canvas from xhtml2pdf.files import pisaFileObject, getFile class WaterMarks: @staticmethod def get_size_location(img, context, pagesize, is_portrait): ...
code_fim
hard
{ "lang": "python", "repo": "xhtml2pdf/xhtml2pdf", "path": "/xhtml2pdf/builders/watermarks.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def generate_pdf_background(pisafile, pagesize, is_portrait, context={}): """ pypdf requires pdf as background so convert image to pdf in temporary file with same page dimensions :param pisafile: Image File :param pagesize: Page size for the new pdf ...
code_fim
hard
{ "lang": "python", "repo": "xhtml2pdf/xhtml2pdf", "path": "/xhtml2pdf/builders/watermarks.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if context.pisaBackgroundList: pages = list(map(lambda x: x[0], context.pisaBackgroundList))+[max_numpage+1] pages.pop(0) counter=0 for page, bgfile, pgcontext in context.pisaBackgroundList: if not bgfile.notFound(): ...
code_fim
hard
{ "lang": "python", "repo": "xhtml2pdf/xhtml2pdf", "path": "/xhtml2pdf/builders/watermarks.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def resolve_data(item, title, itemvalue): for key, value in title_define.items(): if title.find(value) != -1: item[key] = itemvalue break<|fim_prefix|># repo: siyuanCai/patent-crawler path: /service/item_collection.py # -*- coding: utf-8 -*- """ Created on 2018/2/27 <...
code_fim
medium
{ "lang": "python", "repo": "siyuanCai/patent-crawler", "path": "/service/item_collection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: siyuanCai/patent-crawler path: /service/item_collection.py # -*- coding: utf-8 -*- """ Created on 2018/2/27 @author: will4906 """ from entity.query_item import title_define <|fim_suffix|> for key, value in title_define.items(): if title.find(value) != -1: item[key] = item...
code_fim
easy
{ "lang": "python", "repo": "siyuanCai/patent-crawler", "path": "/service/item_collection.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gems-uff/noworkflow path: /capture/noworkflow/patterns/rules/temporal_inference_rules.py # Copyright (c) 2017 Universidade Federal Fluminense (UFF) # Copyright (c) 2017 Polytechnic Institute of New York University. # This file is part of noWorkflow. # Please, consult the license terms in the LICE...
code_fim
hard
{ "lang": "python", "repo": "gems-uff/noworkflow", "path": "/capture/noworkflow/patterns/rules/temporal_inference_rules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """match *File* accesses that belongs to an *Activation* stack in a given trial (*TrialId*). """ activation_stack = var("_stack") return ( access_stack_id(trial_id, file, activation_stack) & member(activation, activation_stack) ) @prolog_rule("access_influence_id(...
code_fim
hard
{ "lang": "python", "repo": "gems-uff/noworkflow", "path": "/capture/noworkflow/patterns/rules/temporal_inference_rules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> q1, q2, q3, u1, u2, u3 = dynamicsymbols('q1:4, u1:4') l1, l2, l3, l4, rho = symbols('l1:5, rho') N = ReferenceFrame('N') inertias = [inertia(N, 0, 0, rho * l ** 3 / 12) for l in (l1, l2, l3, l4)] link1 = Body('Link1', frame=N, mass=rho * l1, central_inertia=inertias[0]) link2 = Bo...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/physics/mechanics/tests/test_jointsmethod.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }