text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: VitoChien/py-mask-rcnn path: /lib/crop_seg/__init__.py # ------------------------------------------<|fim_suffix|>---------------------------------------------<|fim_middle|>-------------- # Crop the segmentation label image # Written by Tianrui Hui # -----------
code_fim
medium
{ "lang": "python", "repo": "VitoChien/py-mask-rcnn", "path": "/lib/crop_seg/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(">> Rankup pre-trained model") print(">> Start a new game") trajectories, payoffs = env.run(is_training=False) # If the human does not take the final action, we need to # print other players action if len(trajectories[0]) != 0: final_state = trajectories[0][-1][-2] action_record = final_sta...
code_fim
hard
{ "lang": "python", "repo": "cuijing1991/rlcard", "path": "/examples/rankup_human.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cuijing1991/rlcard path: /examples/rankup_human.py ''' An example of human players playing toy Rankup agaist two pretained DQN agents. ''' import rlcard from rlcard import models from rlcard.agents import RankupHumanAgent as HumanAgent from rlcard.utils import print_card import numpy as np # # ...
code_fim
hard
{ "lang": "python", "repo": "cuijing1991/rlcard", "path": "/examples/rankup_human.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>trajectories, payoffs = env.run(is_training=False) # If the human does not take the final action, we need to # print other players action if len(trajectories[0]) != 0: final_state = trajectories[0][-1][-2] action_record = final_state['action_record'] state = final_state['raw_obs'] action_l...
code_fim
hard
{ "lang": "python", "repo": "cuijing1991/rlcard", "path": "/examples/rankup_human.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>result: for line in result: print(line) else: print('Nenhum produto encontrado!')<|fim_prefix|># repo: josevini/python path: /Introdução à Programação/capitulo11/ex_11.4.py # Exercício 11.4 - Livro import sqlite3 from contextlib import closing min = float...
code_fim
medium
{ "lang": "python", "repo": "josevini/python", "path": "/Introdução à Programação/capitulo11/ex_11.4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: josevini/python path: /Introdução à Programação/capitulo11/ex_11.4.py # Exercício 11.4 - Livro import sqlite3 from contextlib import closing min = float(input('Digite um preço mínimo: ')) max = fl<|fim_suffix|> cursor: result = cursor.execute(f'select * from produto where preco >= {min}...
code_fim
medium
{ "lang": "python", "repo": "josevini/python", "path": "/Introdução à Programação/capitulo11/ex_11.4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Pipeline([ ('tfidf', TfidfTransformer(sublinear_tf=True)), ('lr', (RidgeCV())) ]) if pipeline is None else pipeline<|fim_prefix|># repo: JasonKessler/scattertext path: /scattertext/continuous/sklearnpipeline.py import pandas as pd from sklearn.feature_extrac...
code_fim
hard
{ "lang": "python", "repo": "JasonKessler/scattertext", "path": "/scattertext/continuous/sklearnpipeline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JasonKessler/scattertext path: /scattertext/continuous/sklearnpipeline.py import pandas as pd from sklearn.feature_extraction.text import TfidfTransformer from sklearn.linear_model import RidgeCV, ElasticNetCV, LassoCV from sklearn.pipeline import Pipeline from scattertext.continuous.coefficient...
code_fim
hard
{ "lang": "python", "repo": "JasonKessler/scattertext", "path": "/scattertext/continuous/sklearnpipeline.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param corpus: TermDocMatrix, should just have unigrams :param document_scores: np.array, continuous value for each document score :return: pd.DataFrame ''' assert document_scores.shape == (corpus.get_num_docs(),) tdm = self._get_tdm(corpus) model =...
code_fim
medium
{ "lang": "python", "repo": "JasonKessler/scattertext", "path": "/scattertext/continuous/sklearnpipeline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanqd0/csft path: /src/csft/_csft.py # -*- coding:utf-8 -*- """ The implementations of csft. """ import sys from collections import OrderedDict, namedtuple from distutils.version import LooseVersion from os.path import getsize, islink, join, split, splitext from pathlib import Path from pandas ...
code_fim
hard
{ "lang": "python", "repo": "yanqd0/csft", "path": "/src/csft/_csft.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sorted_data = data.sort_values(by, ascending=False) return sorted_data.reset_index(drop=True) def csft2data(path): paths = make_file_list(path) raw_data = make_raw_data(paths) type_data = sum_data_by_type(raw_data) sorted_data = sort_data_frame(type_data, column.SIZE) return ...
code_fim
hard
{ "lang": "python", "repo": "yanqd0/csft", "path": "/src/csft/_csft.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheLabbingProject/django_mri path: /django_mri/analysis/specifications/fsl/eddy.py """ Input and output specification dictionaries for FSL's eddy_ script. .. _eddy: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy """ from django_analyses.models.input.definitions import (BooleanInputDefinition, ...
code_fim
hard
{ "lang": "python", "repo": "TheLabbingProject/django_mri", "path": "/django_mri/analysis/specifications/fsl/eddy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ption": "Path/name of file with the cnr_maps.", }, "out_corrected": { "type": FileOutputDefinition, "description": "4D image file containing all the corrected volumes.", }, "out_movement_over_time": { "type": FileOutputDefinition, "description": "Text file c...
code_fim
hard
{ "lang": "python", "repo": "TheLabbingProject/django_mri", "path": "/django_mri/analysis/specifications/fsl/eddy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jvanz/salt path: /salt/_states/caasp_file.py from __future__ import absolute_import import salt.utils.files def managed(name, **kwargs): ''' Manage a given file, this function allows for a file to be downloaded from the salt master and potentially run through a templating system. ...
code_fim
hard
{ "lang": "python", "repo": "jvanz/salt", "path": "/salt/_states/caasp_file.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: # 2. if there is an existing file <name>, copy it to this <tmp_filename> if __salt__['file.file_exists'](name): debug('copying existing {} to temporary file {}'.format(name, tmp_filename)) try: # copy the existing file to /tmp/<name> ...
code_fim
hard
{ "lang": "python", "repo": "jvanz/salt", "path": "/salt/_states/caasp_file.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': findme()<|fim_prefix|># repo: MiracleWong/PythonPractice path: /Python-Std-Libraries/click/click_pos.py import click @click.command() @click.option('--pos', nargs=2, type=float) def findme(pos): <|fim_middle|> click.echo('%s / %s' % pos)
code_fim
easy
{ "lang": "python", "repo": "MiracleWong/PythonPractice", "path": "/Python-Std-Libraries/click/click_pos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MiracleWong/PythonPractice path: /Python-Std-Libraries/click/click_pos.py import click @click.command() @click.option('--pos', nargs=2, type=float) def findme(pos): <|fim_suffix|> if __name__ == '__main__': findme()<|fim_middle|> click.echo('%s / %s' % pos)
code_fim
easy
{ "lang": "python", "repo": "MiracleWong/PythonPractice", "path": "/Python-Std-Libraries/click/click_pos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': findme()<|fim_prefix|># repo: MiracleWong/PythonPractice path: /Python-Std-Libraries/click/click_pos.py import click @click.command() @click.option('--pos', nargs=2, type=float) def findme(pos): <|fim_middle|> click.echo('%s / %s' % pos)
code_fim
easy
{ "lang": "python", "repo": "MiracleWong/PythonPractice", "path": "/Python-Std-Libraries/click/click_pos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Epica-Wang/sequencing path: /sequencing/encoders/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: S<|fim_suffix|># No rights reserved. # from .rnn_encoder import StackBidirectionalRNNEncoder __all__ = ['StackBidirectionalRNNEncoder']<|fim_middle|>word York # GitHub: ht...
code_fim
medium
{ "lang": "python", "repo": "Epica-Wang/sequencing", "path": "/sequencing/encoders/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># No rights reserved. # from .rnn_encoder import StackBidirectionalRNNEncoder __all__ = ['StackBidirectionalRNNEncoder']<|fim_prefix|># repo: Epica-Wang/sequencing path: /sequencing/encoders/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: S<|fim_middle|>word York # GitHub: ht...
code_fim
medium
{ "lang": "python", "repo": "Epica-Wang/sequencing", "path": "/sequencing/encoders/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pysysops/opsmanager path: /virtualinfrastructure/apps.py from django.apps import AppConfig <|fim_suffix|> name = 'virtualinfrastructure' verbose_name = 'virtual infrastructure'<|fim_middle|> class VirtualInfrastructureConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "pysysops/opsmanager", "path": "/virtualinfrastructure/apps.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: pysysops/opsmanager path: /virtualinfrastructure/apps.py from django.apps import AppConfig <|fim_suffix|> name = 'virtualinfrastructure' verbose_name = 'virtual infrastructure'<|fim_middle|>class VirtualInfrastructureConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "pysysops/opsmanager", "path": "/virtualinfrastructure/apps.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> name = 'virtualinfrastructure' verbose_name = 'virtual infrastructure'<|fim_prefix|># repo: pysysops/opsmanager path: /virtualinfrastructure/apps.py from django.apps import AppConfig <|fim_middle|> class VirtualInfrastructureConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "pysysops/opsmanager", "path": "/virtualinfrastructure/apps.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: amkalsi/cmssw path: /TrackingTools/TrackFitters/python/KFTrajectoryFitterESProducer_cfi.py import FWCore.ParameterSet.Config as cms KFTrajectoryFitter = cms.ESProducer("KFTrajectoryFitterESP<|fim_suffix|> = cms.string('GlobalDetLayerGeometry'), minHits = cms.i...
code_fim
medium
{ "lang": "python", "repo": "amkalsi/cmssw", "path": "/TrackingTools/TrackFitters/python/KFTrajectoryFitterESProducer_cfi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ator = cms.string('PropagatorWithMaterial'), Updator = cms.string('KFUpdator'), RecoGeometry = cms.string('GlobalDetLayerGeometry'), minHits = cms.int32(3) )<|fim_prefix|># repo: amkalsi/cmssw path: /TrackingTools/TrackFitters/python/KFTrajectoryFitterESProduce...
code_fim
medium
{ "lang": "python", "repo": "amkalsi/cmssw", "path": "/TrackingTools/TrackFitters/python/KFTrajectoryFitterESProducer_cfi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: magma/magma path: /lte/gateway/python/magma/subscriberdb/tests/protocols/diameter/common.py import asyncio # pylint: disable=W0223 # We cannot create instances directly for transport we need them to be # created by event loop so hacking this. class MockTransport(asyncio.Transport): def __...
code_fim
medium
{ "lang": "python", "repo": "magma/magma", "path": "/lte/gateway/python/magma/subscriberdb/tests/protocols/diameter/common.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.open: self.sent.append(data) def close(self): self.open = False def flush(self): while self.sent: self.sent.pop() def get_extra_info(self, name, default=None): return self.extra.get(name, default) def is_closing(self): ...
code_fim
medium
{ "lang": "python", "repo": "magma/magma", "path": "/lte/gateway/python/magma/subscriberdb/tests/protocols/diameter/common.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: andriisoldatenko/fan path: /uva_answers/10137/main.py import sys FILE = sys.stdin # FILE = open('sample.in') for line in FILE: num_students = int(line.strip()) if num_students == 0: break expenses = [] for _ in range(num_students): d, c = map(int, FILE.readline(...
code_fim
medium
{ "lang": "python", "repo": "andriisoldatenko/fan", "path": "/uva_answers/10137/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> used_sum = max(sum_above, sum_below) print('${}.{:02d}'.format(used_sum // 100, used_sum % 100))<|fim_prefix|># repo: andriisoldatenko/fan path: /uva_answers/10137/main.py import sys FILE = sys.stdin # FILE = open('sample.in') for line in FILE: num_students = int(line.strip()) if num_s...
code_fim
hard
{ "lang": "python", "repo": "andriisoldatenko/fan", "path": "/uva_answers/10137/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhg03a/trafficcontrol path: /.github/actions/pr-to-update-go/pr_to_update_go/constants.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/li...
code_fim
hard
{ "lang": "python", "repo": "jhg03a/trafficcontrol", "path": "/.github/actions/pr-to-update-go/pr_to_update_go/constants.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nal = 'GO_VERSION_FILE' GIT_AUTHOR_EMAIL_TEMPLATE: Final = '{git_author_name}@users.noreply.github.com' GO_REPO_NAME: Final = 'golang/go' GO_VERSION_URL: Final = 'https://golang.org/dl/?mode=json' RELEASE_PAGE_URL: Final = 'https://golang.org/doc/devel/release.html'<|fim_prefix|># repo: jhg03a/trafficcont...
code_fim
hard
{ "lang": "python", "repo": "jhg03a/trafficcontrol", "path": "/.github/actions/pr-to-update-go/pr_to_update_go/constants.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>the License. # from typing import Final ENV_GIT_AUTHOR_NAME: Final = 'GIT_AUTHOR_NAME' ENV_GITHUB_REPOSITORY: Final = 'GITHUB_REPOSITORY' ENV_GITHUB_REPOSITORY_OWNER: Final = 'GITHUB_REPOSITORY_OWNER' ENV_GITHUB_TOKEN: Final = 'GITHUB_TOKEN' ENV_GO_VERSION_FILE: Final = 'GO_VERSION_FILE' GIT_AUTHOR_EMAIL...
code_fim
hard
{ "lang": "python", "repo": "jhg03a/trafficcontrol", "path": "/.github/actions/pr-to-update-go/pr_to_update_go/constants.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ".radiomessages": [], ".bush": [], ".grass": [], ".monstertype": ["^(.+/)?dialog/.+$"], #".monsterskill": ["^label$"], ".aimission": [".*Text$"], ".questtemplate": ["^.+Text(/[^0-9]+([0-9]+/1)?/[0-9]+)?$", "^scriptConfig/(descriptions|.+Note|parcel(Name|De...
code_fim
hard
{ "lang": "python", "repo": "ProjectSky/FrackinUniverse-sChinese-Project", "path": "/script/tools/parser_settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProjectSky/FrackinUniverse-sChinese-Project path: /script/tools/parser_settings.py from re import compile as regex foi = { "*": [".*escription$", "^(.+/)?[Tt]ext$", "^(.+/)?[Dd]ialog/[^/]+/[^/]+/.*[0-9]+$", "^(.+/)?(lbl)?([sS]ub)?[tT]itle(/value)?$", "^(.+/)+caption$", "^(.+/)?lab...
code_fim
hard
{ "lang": "python", "repo": "ProjectSky/FrackinUniverse-sChinese-Project", "path": "/script/tools/parser_settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhairyaagrawal/SmartMirror path: /WebServer/Users/migrations/0005_auto_20190321_1145.py # Generated by Django 2.1.5 on 2019-03-21 16:45 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone <|fim_suffix|> operations = [ migrations.Cre...
code_fim
hard
{ "lang": "python", "repo": "dhairyaagrawal/SmartMirror", "path": "/WebServer/Users/migrations/0005_auto_20190321_1145.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Stock', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Ticker', models.CharField(choices=[('0', 'AAPL'), ('1', 'MSFT'), ('2', 'FB'...
code_fim
hard
{ "lang": "python", "repo": "dhairyaagrawal/SmartMirror", "path": "/WebServer/Users/migrations/0005_auto_20190321_1145.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output = abstract.SMA(df) self.assertTrue(isinstance(output, pd.Series)) self.assertFalse(output.empty) self.assertTrue(pd.isna(output[0])) self.assertFalse(pd.isna(output[-1])) self.assertEqual(close.shape, output.shape) ...
code_fim
hard
{ "lang": "python", "repo": "alexanu/atpy", "path": "/tests/data/test_talib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexanu/atpy path: /tests/data/test_talib.py import unittest import pandas as pd import talib from talib import abstract from pandas.util.testing import assert_index_equal from atpy.data.iqfeed.iqfeed_history_provider import IQFeedHistoryProvider, BarsFilter class TestTALib(unittest.TestCase)...
code_fim
hard
{ "lang": "python", "repo": "alexanu/atpy", "path": "/tests/data/test_talib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with IQFeedHistoryProvider() as provider: df = provider.request_data(BarsFilter(ticker="AAPL", interval_len=300, interval_type='s', max_bars=1000), sync_timestamps=False) close = df['close'] output = abstract.SMA(df) self.assertTrue(isinstance(outpu...
code_fim
hard
{ "lang": "python", "repo": "alexanu/atpy", "path": "/tests/data/test_talib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gortali/EZyRB path: /tests/test_snapshots.py from unittest import TestCase import unittest import numpy as np import filecmp import os import sys from ezyrb.snapshots import Snapshots class TestSnapshots(TestCase): def test_snapshots(self): snaps = Snapshots(output_name='Pressure', ...
code_fim
hard
{ "lang": "python", "repo": "gortali/EZyRB", "path": "/tests/test_snapshots.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_files(self): snaps = Snapshots(output_name='Pressure', dformat="point") snaps.append("tests/test_datasets/matlab_00.vtk") snaps.append("tests/test_datasets/matlab_01.vtk") expected_files = [ "tests/test_datasets/matlab_00.vtk", "tests/te...
code_fim
hard
{ "lang": "python", "repo": "gortali/EZyRB", "path": "/tests/test_snapshots.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> snaps = Snapshots(output_name='Pressure', dformat="point") snaps.append("tests/test_datasets/matlab_00.vtk") snaps.append("tests/test_datasets/matlab_01.vtk") snaps.append("tests/test_datasets/matlab_02.vtk") snaps.append("tests/test_datasets/matlab_03.vtk") ...
code_fim
hard
{ "lang": "python", "repo": "gortali/EZyRB", "path": "/tests/test_snapshots.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Daetalus/pyston path: /test/extra/paste_test.py import os, sys, subprocess sys.path.append(os.path.dirname(__file__) + "/../lib") from test_helper import create_virtenv, run_test ENV_NAME = "paste_test_env_" + os.path.basename(sys.executable) PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, ...
code_fim
hard
{ "lang": "python", "repo": "Daetalus/pyston", "path": "/test/extra/paste_test.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print ">> " print ">> Running paste tests..." print ">> " # current cpython also does not pass all tests. (9 failed, 127 passed) # the additional test we fail are because: # - we have str.__iter__ # - no sys.settrace # - no shiftjis encoding # - slightly different error messages expected = [{"failed" : 2...
code_fim
hard
{ "lang": "python", "repo": "Daetalus/pyston", "path": "/test/extra/paste_test.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> = logging.getLogger() logger.debug('often makes a very good meal of %s', 'visiting tourists')<|fim_prefix|># repo: Mason-Lin/python_playground path: /buildin_modules/logging/try3.py import logging from logging.config import fileC<|fim_middle|>onfig fileConfig('logging_config.ini') logger
code_fim
easy
{ "lang": "python", "repo": "Mason-Lin/python_playground", "path": "/buildin_modules/logging/try3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mason-Lin/python_playground path: /buildin_modules/logging/try3.py import logging from logging.config import fileConfig fileConfig('logging_config.ini') logger<|fim_suffix|>s a very good meal of %s', 'visiting tourists')<|fim_middle|> = logging.getLogger() logger.debug('often make
code_fim
easy
{ "lang": "python", "repo": "Mason-Lin/python_playground", "path": "/buildin_modules/logging/try3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>s a very good meal of %s', 'visiting tourists')<|fim_prefix|># repo: Mason-Lin/python_playground path: /buildin_modules/logging/try3.py import logging from logging.config import fileConfig fileConfig('logging_config.ini') logger<|fim_middle|> = logging.getLogger() logger.debug('often make
code_fim
easy
{ "lang": "python", "repo": "Mason-Lin/python_playground", "path": "/buildin_modules/logging/try3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VIZ-Blockchain/viz-python-lib path: /viz/converter.py from .amount import Amount from .instance import shared_blockchain_instance class Converter(object): """ Converter simplifies the handling of different metrics of the blockchain. :param Steemd blockchain_instance: Steemd() insta...
code_fim
hard
{ "lang": "python", "repo": "VIZ-Blockchain/viz-python-lib", "path": "/viz/converter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def core_to_shares(self, amount): """ Obtain SHARES from CORE tokens. :param number amount: amount of CORE tokens to convert """ return amount / self.core_per_share()<|fim_prefix|># repo: VIZ-Blockchain/viz-python-lib path: /viz/converter.py from .amount impor...
code_fim
hard
{ "lang": "python", "repo": "VIZ-Blockchain/viz-python-lib", "path": "/viz/converter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asaparov/archivist path: /make_docs.py .attrib['class'] = 'codeblock' elif child.tag == 'codeline': child.tag = 'span' child.attrib['class'] = 'codeline' codelines.append(child) elif child.tag == 'highlight': child.tag = 'span' child.attrib['class'] = 'highlight ' + child.attri...
code_fim
hard
{ "lang": "python", "repo": "asaparov/archivist", "path": "/make_docs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def parse_typedef(member): type = member.find('type') name = member.find('name').text args = member.find('argsstring') description = member.find('detaileddescription') location_attrib = member.find('location').attrib location = Location(location_attrib['bodyfile'], int(location_attrib['bodystart']),...
code_fim
hard
{ "lang": "python", "repo": "asaparov/archivist", "path": "/make_docs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: asaparov/archivist path: /make_docs.py ompounddef/compoundname').text) description_element = tree.find('compounddef/detaileddescription') class_description = description_element location_attrib = tree.find('compounddef/location').attrib location = Location(location_attrib['bodyfile'], int(loc...
code_fim
hard
{ "lang": "python", "repo": "asaparov/archivist", "path": "/make_docs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: el-ideal-ideas/MocaTwitterUtils path: /src/moca_modules/moca_core/atexit.py # this will be executed at system exit. # -- Imports -------------------------------------------------------------------------- from .moca_variables import IS_DEBUG <|fim_suffix|>if IS_DEBUG: print(f'------ Moca Mo...
code_fim
medium
{ "lang": "python", "repo": "el-ideal-ideas/MocaTwitterUtils", "path": "/src/moca_modules/moca_core/atexit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># -------------------------------------------------------------------------- At Exit --<|fim_prefix|># repo: el-ideal-ideas/MocaTwitterUtils path: /src/moca_modules/moca_core/atexit.py # this will be executed at system exit. # -- Imports ------------------------------------------------------------------...
code_fim
medium
{ "lang": "python", "repo": "el-ideal-ideas/MocaTwitterUtils", "path": "/src/moca_modules/moca_core/atexit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathieucaroff/metravision path: /src/util/contexttool.py import contextlib @contextlib.contextmanager def neutralContextManager(): """This context manager has no effect. <|fim_suffix|> @contextlib.contextmanager def interactPostMortemUpon(exception=Exception): try: yield exc...
code_fim
hard
{ "lang": "python", "repo": "mathieucaroff/metravision", "path": "/src/util/contexttool.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@contextlib.contextmanager def interactPostMortemUpon(exception=Exception): try: yield except exception: # pylint: disable=broad-except interactPostMortem()<|fim_prefix|># repo: mathieucaroff/metravision path: /src/util/contexttool.py import contextlib @contextlib.contextmanager ...
code_fim
hard
{ "lang": "python", "repo": "mathieucaroff/metravision", "path": "/src/util/contexttool.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: yield except exception: # pylint: disable=broad-except import pdb, traceback traceback.print_exc() pdb.post_mortem() # https://stackoverflow.com/q/242485/starting-python-debugger-automatically-on-error def interactPostMortem(): import code, traceback, sys...
code_fim
medium
{ "lang": "python", "repo": "mathieucaroff/metravision", "path": "/src/util/contexttool.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Final sequence InitialStep = cms.Sequence(iterativeInitialSeeds +initialStepTrackCandidates +initialStepTracks +firstStepPrimaryVerticesBeforeMixing +initialSte...
code_fim
hard
{ "lang": "python", "repo": "amkalsi/cmssw", "path": "/FastSimulation/Tracking/python/IterativeInitialStep_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amkalsi/cmssw path: /FastSimulation/Tracking/python/IterativeInitialStep_cff.py import FWCore.ParameterSet.Config as cms ### ITERATIVE TRACKING: STEP 0 ### # seeding import FastSimulation.Tracking.TrajectorySeedProducer_cfi iterativeInitialSeeds = FastSimulation.Tracking.TrajectorySeedProduc...
code_fim
hard
{ "lang": "python", "repo": "amkalsi/cmssw", "path": "/FastSimulation/Tracking/python/IterativeInitialStep_cff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> to_scrape_items = [] python_title = [] python_results = [] @classmethod def setUpClass(cls): process = CrawlerProcess() crawler_to_scrape = Crawler(ToScrapeSpider) crawler_python = Crawler(PythonSpider) process.crawl(crawler_to_scrape) process.c...
code_fim
hard
{ "lang": "python", "repo": "vyvojer/scrapy-async-selenium", "path": "/tests/test-middlewares.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vyvojer/scrapy-async-selenium path: /tests/test-middlewares.py import unittest from scrapy import Spider from scrapy.http import Response from scrapy.crawler import CrawlerProcess, Crawler from scrapy.signals import item_scraped from selenium.webdriver.remote.webdriver import WebDriver from sel...
code_fim
hard
{ "lang": "python", "repo": "vyvojer/scrapy-async-selenium", "path": "/tests/test-middlewares.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Parse map roads and junctions roads, junctions = get_roads_and_junctions("borregasave.xodr") road_points, _ = interpolate_roads(roads) # Setup simulation sim = Simulator() # Find random position on any junction for junction in junctions: for connection in junction.c...
code_fim
hard
{ "lang": "python", "repo": "TrackerSB/IEEEAITestChallenge2021", "path": "/playground/lgsvl/executeRandomTests/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TrackerSB/IEEEAITestChallenge2021 path: /playground/lgsvl/executeRandomTests/main.py from queue import Queue from lgsvl import Simulator, dreamview from shapely.geometry import LineString, Point from shapely.ops import unary_union sim = None roads = None road_points = None junctions = None allo...
code_fim
hard
{ "lang": "python", "repo": "TrackerSB/IEEEAITestChallenge2021", "path": "/playground/lgsvl/executeRandomTests/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _main() -> None: from common.geometry import interpolate_roads from common.open_drive_reader import get_roads_and_junctions global sim, roads, junctions, road_points # Parse map roads and junctions roads, junctions = get_roads_and_junctions("borregasave.xodr") road_points, _ =...
code_fim
hard
{ "lang": "python", "repo": "TrackerSB/IEEEAITestChallenge2021", "path": "/playground/lgsvl/executeRandomTests/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self) -> None: self.state = One() self.expected_matrix = np.array([0.0, 1.0]) def test_one_matrix(self): self.assertTrue(np.allclose(self.state.matrix, self.expected_matrix)) def test_one_tensor(self): self.assertTrue(np.allclose(self.state.node.te...
code_fim
hard
{ "lang": "python", "repo": "jvscursulim/tensor-network-simulator", "path": "/tests/test_states.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertTrue(np.allclose(self.state.matrix, self.expected_matrix)) def test_zero_tensor(self): self.assertTrue(np.allclose(self.state.node.tensor, self.expected_matrix)) class TestOne(unittest.TestCase): def setUp(self) -> None: self.state = One() self.expect...
code_fim
medium
{ "lang": "python", "repo": "jvscursulim/tensor-network-simulator", "path": "/tests/test_states.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jvscursulim/tensor-network-simulator path: /tests/test_states.py import unittest import numpy as np import tensornetwork as tn from tsim.states import Zero, One <|fim_suffix|> def test_zero_matrix(self): self.assertTrue(np.allclose(self.state.matrix, self.expected_matrix)) def ...
code_fim
medium
{ "lang": "python", "repo": "jvscursulim/tensor-network-simulator", "path": "/tests/test_states.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return nodes def checkCorrectednessTree(nodes): ''' This function takes as input any of the tree-data structures returned by the buildTreeUpDown or the buildTreeGroundUp functions and, for each node in the tree, it prints their left- and right-hand children. This basically serves to ...
code_fim
hard
{ "lang": "python", "repo": "abunuwas/python-trees", "path": "/nodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abunuwas/python-trees path: /nodes.py def buildTreeGroundUp(tree): ''' This function takes as input a tree in the form of a list of lists, in which each row is a list where every element is an independent member of the list. The function returns a dictionary of nodes from the tre...
code_fim
hard
{ "lang": "python", "repo": "abunuwas/python-trees", "path": "/nodes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flosell/trailscraper path: /trailscraper/s3_download.py """Functions to download CloudTrail Logs from S3""" import concurrent.futures import datetime import logging import os import threading import boto3 import pytz from trailscraper.collection_utils import consume def _s3_key_prefix(prefix,...
code_fim
hard
{ "lang": "python", "repo": "flosell/trailscraper", "path": "/trailscraper/s3_download.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _list_files_to_download(current_prefix): files_to_download = [] logging.info("Listing %s", current_prefix) paginator = get_s3_client().get_paginator('list_objects') for result in paginator.paginate(Bucket=bucket, Prefix=current_prefix, Delimiter="/"): if...
code_fim
hard
{ "lang": "python", "repo": "flosell/trailscraper", "path": "/trailscraper/s3_download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not hasattr(thread_local, "s3_client"): thread_local.s3_client = boto3.client('s3') return thread_local.s3_client def _download_file(key): target_file = target_dir + os.sep + key logging.info("Downloading %s/%s to %s", bucket, key, target_file) #...
code_fim
hard
{ "lang": "python", "repo": "flosell/trailscraper", "path": "/trailscraper/s3_download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: makandok/datawinners path: /datawinners/main/management/commands/recreate_questionnaire_templates.py from django.core.management.base import BaseCommand from datawinners.main.initial_template_creation import create_questionnaire_templates class Command(BaseCommand): <|fim_suffix|> print ...
code_fim
easy
{ "lang": "python", "repo": "makandok/datawinners", "path": "/datawinners/main/management/commands/recreate_questionnaire_templates.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print "Creating questionnnaire templates..." create_questionnaire_templates()<|fim_prefix|># repo: makandok/datawinners path: /datawinners/main/management/commands/recreate_questionnaire_templates.py from django.core.management.base import BaseCommand from datawinners.main.initial_templat...
code_fim
medium
{ "lang": "python", "repo": "makandok/datawinners", "path": "/datawinners/main/management/commands/recreate_questionnaire_templates.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Page(models.Model): id = models.BigAutoField(primary_key=True) title = models.CharField(max_length=128) desc = models.TextField(max_length=1024, blank=True, null=True) emailTemplate = models.CharField(max_length=128, blank=True, null=True) startTime = models.DateTimeField('startT...
code_fim
hard
{ "lang": "python", "repo": "redamancyguy/LoremSurvey", "path": "/question/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: redamancyguy/LoremSurvey path: /question/models.py from django.db import models from pymongo import MongoClient from user.models import User class Respondent(models.Model): sid = models.BigIntegerField() name = models.CharField(max_length=32) school = models.CharField(max_length=32...
code_fim
hard
{ "lang": "python", "repo": "redamancyguy/LoremSurvey", "path": "/question/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Discriminator(nn.Module): def __init__(self, input_shape): super(Discriminator, self).__init__() self.input_shape = input_shape in_channels, in_height, in_width = self.input_shape patch_h, patch_w = int(in_height / 2 ** 4), int(in_width / 2 ** 4) self.out...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/Pix2Pix_ID0331_for_PyTorch/implementations/esrgan/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, x): inputs = x for block in self.blocks: out = block(inputs) inputs = torch.cat([inputs, out], 1) return out.mul(self.res_scale) + x class ResidualInResidualDenseBlock(nn.Module): def __init__(self, filters, res_scale=0.2): ...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/Pix2Pix_ID0331_for_PyTorch/implementations/esrgan/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/dev/cv/image_classification/Pix2Pix_ID0331_for_PyTorch/implementations/esrgan/models.py # # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary ...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/Pix2Pix_ID0331_for_PyTorch/implementations/esrgan/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: J535D165/datahugger path: /datahugger/__main__.py """Powerful datahugger command line interface Example: python -m datahugger https://doi.org/10.5061/dryad.31zcrjdm5 $(mktemp -d) """ import argparse import logging from datahugger import __version__ from datahugger import get from datahug...
code_fim
hard
{ "lang": "python", "repo": "J535D165/datahugger", "path": "/datahugger/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # version parser.add_argument( "-V", "--version", action="version", version=f"%(prog)s {__version__}", ) args, _ = parser.parse_known_args() logging.basicConfig(level=args.log_level) try: # Start downloading get( args.u...
code_fim
hard
{ "lang": "python", "repo": "J535D165/datahugger", "path": "/datahugger/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument( "-f", "--force-download", dest="force_download", action="store_true" ) parser.set_defaults(force_download=False) parser.add_argument("--no-unzip", dest="unzip", action="store_false") parser.set_defaults(unzip=True) parser.add_argument("--no-progress",...
code_fim
hard
{ "lang": "python", "repo": "J535D165/datahugger", "path": "/datahugger/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Runs in HW|C|F for all filters of Layer 3 self.debug_message('=== Layer 2.1: PW ===') pw2_start_indices = AttrDict({'hin': hin_2, 'win': win_2, 'cin': cin_2, 'hout': start_hout_idx, 'wout': star...
code_fim
hard
{ "lang": "python", "repo": "sfu-arch/TensorBricks", "path": "/TB-scheduler/dnn_schedules/cross_layer/hwcf_fire_two_layer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sfu-arch/TensorBricks path: /TB-scheduler/dnn_schedules/cross_layer/hwcf_fire_two_layer.py next_next_layer = items[idx + 2][1] if current_layer.attr_type == 'PW' and next_layer.attr_type == 'PW' \ and next_next_layer.attr_type == '3d': ...
code_fim
hard
{ "lang": "python", "repo": "sfu-arch/TensorBricks", "path": "/TB-scheduler/dnn_schedules/cross_layer/hwcf_fire_two_layer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> end_hin_idx = min(hin + first_layer_hw_params.hxx, first_layer.Hin) - 1 num_hin = end_hin_idx - hin + 1 # In case of last values -- need to add padding information, # Also num_hin - layer_attr.Kx has to be divisible - This depends on hx and wx values ...
code_fim
hard
{ "lang": "python", "repo": "sfu-arch/TensorBricks", "path": "/TB-scheduler/dnn_schedules/cross_layer/hwcf_fire_two_layer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gaoming714/arkham path: /util/log_logging.py import os import sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # BASE_DIR = os.path.dirname(os.getcwd()) # for jupyter sys.path.append(BASE_DIR) from datetime import datetime, timedelta import time import pytz import loggi...
code_fim
hard
{ "lang": "python", "repo": "gaoming714/arkham", "path": "/util/log_logging.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return logger if __name__ == '__main__': LOG = haunter() LOG.debug('debug message') LOG.info('info message') LOG.warning('warning message') LOG.error('error message') LOG.critical('critical message')<|fim_prefix|># repo: gaoming714/arkham path: /util/log_logging.py import os...
code_fim
medium
{ "lang": "python", "repo": "gaoming714/arkham", "path": "/util/log_logging.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ApocalypseMac/LeetCode path: /Code/py3/archived/51-100/59.py class Solution: def generateMatrix(self, n: int) -> List[List[int]]: layer = n // 2 result = [] for _ in range(n): result.append([0] * n) num = <|fim_suffix|>e(length): res...
code_fim
hard
{ "lang": "python", "repo": "ApocalypseMac/LeetCode", "path": "/Code/py3/archived/51-100/59.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m += 1 for j in range(length): result[n - 1 - i - j][i] = num num += 1 if n & 1: result[layer][layer] = num return result<|fim_prefix|># repo: ApocalypseMac/LeetCode path: /Code/py3/archived/51-100/59.py class Solution: def gener...
code_fim
hard
{ "lang": "python", "repo": "ApocalypseMac/LeetCode", "path": "/Code/py3/archived/51-100/59.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ks_done = set() for iev in range(len(runs)): run = np.uint32(runs[iev]) lumi = np.uint32(lumis[iev]) k = (run, lumi) if k not in ks_done: ks_done.add(k) tot_lumi[0] += index.get(k, 0) class LumiMask: """H...
code_fim
hard
{ "lang": "python", "repo": "CoffeaTeam/coffea", "path": "/src/coffea/lumi_tools/lumi_tools.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: CoffeaTeam/coffea path: /src/coffea/lumi_tools/lumi_tools.py import json import awkward as ak from numba import types from numba.typed import Dict from ..util import numba from ..util import numpy as np class LumiData: r"""Holds per-lumiSection integrated lumi values Parameters -...
code_fim
hard
{ "lang": "python", "repo": "CoffeaTeam/coffea", "path": "/src/coffea/lumi_tools/lumi_tools.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: es94129/hierarchical-explanation path: /hiexpl/nns/linear_model.py from torch import nn import time import glob import torch.optim as O from utils.reader import * from utils.tacred_f1 import score as f1_score from sklearn.metrics import accuracy_score class BOWRegression(nn.Module): def __...
code_fim
hard
{ "lang": "python", "repo": "es94129/hierarchical-explanation", "path": "/hiexpl/nns/linear_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # switch model to evaluation mode model.eval() dev_iter.init_epoch() avg_dev_loss = 0 # calculate accuracy on validation set n_dev_correct, dev_loss = 0, 0 truth_dev, pred_dev = [], [] ...
code_fim
hard
{ "lang": "python", "repo": "es94129/hierarchical-explanation", "path": "/hiexpl/nns/linear_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevin-ledinh/decartes path: /scrapyExample/scrapyExample/scrapyExample/spiders/tesco_spider.py import scrapy import datetime import json from scrapyExample.items import BabyFoodItem class TescoSpider(scrapy.Spider): name = "TescoSpider" storeName = "Tesco" urlJsonPath = "./urlList/te...
code_fim
hard
{ "lang": "python", "repo": "kevin-ledinh/decartes", "path": "/scrapyExample/scrapyExample/scrapyExample/spiders/tesco_spider.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # itemId = product.xpath('.//div[contains(@class, "tile-content")]/@data-auto-id').get() if currentItem['sku_no'] in json_data: currentItem['product_img'] = json_data[currentItem['sku_no']]['serializedData']['product']['defaultImageUrl'] # currentItem['p...
code_fim
hard
{ "lang": "python", "repo": "kevin-ledinh/decartes", "path": "/scrapyExample/scrapyExample/scrapyExample/spiders/tesco_spider.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pricePerWeight = product.xpath('.//div[contains(@class, "price-per-quantity-weight")]') if len(pricePerWeight) > 0 : currentItem['weightUnitprice'] = pricePerWeight.xpath('.//span[contains(@class, "currency")]//text()').get() + pricePerWeight.xpath('.//span[contains...
code_fim
hard
{ "lang": "python", "repo": "kevin-ledinh/decartes", "path": "/scrapyExample/scrapyExample/scrapyExample/spiders/tesco_spider.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: all-umass/superman-web path: /backend/handlers/filterplots.py from __future__ import absolute_import, print_function, division import ast import logging import numpy as np import os from collections import namedtuple from itertools import cycle, islice from matplotlib import rcParams from matplot...
code_fim
hard
{ "lang": "python", "repo": "all-umass/superman-web", "path": "/backend/handlers/filterplots.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make a new skinny subplot, then cover it with the legend. # This allows an out-of-axis legend without it getting cut off. # Uses the trick from http://stackoverflow.com/a/22885327/10601 gs = GridSpec(1, 2, width_ratios=(3, 1), wspace=0.02) ax.set_position(gs[0].get_position(fig)) ...
code_fim
hard
{ "lang": "python", "repo": "all-umass/superman-web", "path": "/backend/handlers/filterplots.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trishankkarthik/sizeof-uptane path: /TimeServerModule.py #!/usr/bin/env python3 # 2nd-party imports. import CommonModule def Tokens(num_of_ecus=1): Token = CommonModule.INTEGER_SIZE_IN_BYTES CommonModule.log('Token', Token) CommonModule.log('# of ECUs', num_of_ecus, unit=' ECUs') token...
code_fim
hard
{ "lang": "python", "repo": "trishankkarthik/sizeof-uptane", "path": "/TimeServerModule.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''https://github.com/uptane/asn1/blob/master/TimeServerModule.asn1''' numberOfTokens = CommonModule.LENGTH_SIZE_IN_BYTES tokens = Tokens(num_of_ecus=num_of_ecus) sequenceOfTokens = numberOfTokens + tokens CommonModule.log('SequenceOfTokens', sequenceOfTokens) return sequenceOfTokens def Cur...
code_fim
medium
{ "lang": "python", "repo": "trishankkarthik/sizeof-uptane", "path": "/TimeServerModule.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }