text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> @hidden.setter def hidden(self, value): return def get_help_record(self, ctx): """ Has "None" as its help record. All that is needed. """ return class DocumentableArgument(click.Argument): def __init__(self, *args, **kwargs): doc_help = kw...
code_fim
hard
{ "lang": "python", "repo": "mobiusklein/glycresoft", "path": "/src/glycan_profiling/cli/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewDoing/chess_ai path: /Joueur.py/games/chess/search.py Location (RANK, FILE) - Capture? 1 otherwise 0 - Castling? 1 character following FEN, otherwise - - Promotion? Indicates which piece the pawn becomes, otherwise - """ action_list = [] if state.active...
code_fim
hard
{ "lang": "python", "repo": "andrewDoing/chess_ai", "path": "/Joueur.py/games/chess/search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewDoing/chess_ai path: /Joueur.py/games/chess/search.py ry[idx]: return False return True def is_checkmate(state): """Returns a boolean as to whether the active color's king is in checkmate. """ in_check = check.space_under_attack(state, state.active_king,...
code_fim
hard
{ "lang": "python", "repo": "andrewDoing/chess_ai", "path": "/Joueur.py/games/chess/search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Change priority queue back to a list of moves for entry in q.queue: sorted_moves.append(entry[2]) return sorted_moves def tl_ht_qs_ab_id_dl_minimax(node, qs_depth, history_table, percentage, time_remaining): """Time Limited, Alpha Beta Pruning, Iterative Deepening, Depth Limi...
code_fim
hard
{ "lang": "python", "repo": "andrewDoing/chess_ai", "path": "/Joueur.py/games/chess/search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Brothers-Coins/BrothersCoinsDataCollector path: /src/model/transaction/transaction.py from abc import ABCMeta from src.model.date.date import Date from src.model.transaction.type_transaction import TypeTransaction class Transaction: __metaclass__ = ABCMeta # define transaction abstract ...
code_fim
medium
{ "lang": "python", "repo": "Brothers-Coins/BrothersCoinsDataCollector", "path": "/src/model/transaction/transaction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def type_transaction(self): return TypeTransaction.BUY_TRANSACTION if self.__value > 0 else TypeTransaction.SELL_TRANSACTION @property def value(self): return self.__value @property def abs_value(self): return abs(self.__value) @property ...
code_fim
hard
{ "lang": "python", "repo": "Brothers-Coins/BrothersCoinsDataCollector", "path": "/src/model/transaction/transaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if speed <= 10: print(f'slow') elif 10 < speed <= 50: print(f'average') elif 50 < speed <= 150: print(f'fast') elif 150 < speed <= 1000: print(f'ultra fast') elif speed > 1000: print(f'extremely fast')<|fim_prefix|># repo: karolinanikolova/SoftUni-Software-Engineering path: /1-Python-...
code_fim
medium
{ "lang": "python", "repo": "karolinanikolova/SoftUni-Software-Engineering", "path": "/1-Python-Programming-Basics (Sep 2020)/Course-Exercises-and-Exams/02_Conditional-Statements/02.Exercise-03-Speed-Info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gorilik324/yabc path: /src/yabc/taxdoc.py from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String <|fim_suffix|> class TaxDoc(yabc.Base): """ TODO: If we need to store these, do so in an encrypted object storage, not a...
code_fim
medium
{ "lang": "python", "repo": "gorilik324/yabc", "path": "/src/yabc/taxdoc.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> """ TODO: If we need to store these, do so in an encrypted object storage, not as rows in a databse. """ __tablename__ = "taxdoc" id = Column(Integer, primary_key=True) user_id = Column(Integer, ForeignKey("user.id")) file_name = Column(String) file_hash = Column(String) ...
code_fim
medium
{ "lang": "python", "repo": "gorilik324/yabc", "path": "/src/yabc/taxdoc.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: daspiker/fakie path: /app/models.py from app import db class SyslogSettings(db.Model): id = db.Column(db.Integer, primary_key=True) serverIP = db.Column(db.String(64), index=True, unique=True) comment = db.Column(db.String(128)) <|fim_suffix|> id = db.Column(db.Integer, primary_k...
code_fim
easy
{ "lang": "python", "repo": "daspiker/fakie", "path": "/app/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> id = db.Column(db.Integer, primary_key=True) workspaceId = db.Column(db.String(64), index=True, unique=True) workspaceKey = db.Column(db.String(128)) comment = db.Column(db.String(128)) db.create_all()<|fim_prefix|># repo: daspiker/fakie path: /app/models.py from app import db class Sys...
code_fim
easy
{ "lang": "python", "repo": "daspiker/fakie", "path": "/app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zqbxx/mytools path: /dnscache/dnscache.py import ctypes import datetime import json import logging import logging.config import os import sys import time import traceback from pathlib import Path from random import shuffle from shutil import copyfile from typing import List from appdirs import A...
code_fim
hard
{ "lang": "python", "repo": "zqbxx/mytools", "path": "/dnscache/dnscache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(file_path, 'w', newline=os.linesep) as f: for line in lines: f.write(line + '\n') class DnsCache: dns_cache_record_begin = '----------------------------------------' dns_cache_record_name = '记录名称' dns_cache_a_record = 'A (主机)记录' def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "zqbxx/mytools", "path": "/dnscache/dnscache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def is_admin(): try: return ctypes.windll.shell32.IsUserAnAdmin() except: return False def get_admin(): if sys.version_info[0] == 3: ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1) else:#in python2.x ctypes.wind...
code_fim
hard
{ "lang": "python", "repo": "zqbxx/mytools", "path": "/dnscache/dnscache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rwl/PYPOWER path: /pypower/t/t_loadcase.py ) t_is(baseMVA1, baseMVA, 12, [t, 'baseMVA']) t_is(bus1, bus, 12, [t, 'bus']) t_is(gen1, gen, 12, [t, 'gen']) t_is(branch1, branch, 12, [t, 'branch']) t_is(areas1, areas, 12, [t, 'areas']) ...
code_fim
hard
{ "lang": "python", "repo": "rwl/PYPOWER", "path": "/pypower/t/t_loadcase.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ## read version 1 PF data matrices baseMVA, bus, gen, branch = t_case9_pf() savemat(pfmatfile + '.mat', {'baseMVA': baseMVA, 'bus': bus, 'gen': gen, 'branch': branch}, oned_as='column') ## read version 2 PF data matrices ppc = t_case9_pfv2() tmp = (ppc['baseMVA'],...
code_fim
hard
{ "lang": "python", "repo": "rwl/PYPOWER", "path": "/pypower/t/t_loadcase.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rwl/PYPOWER path: /pypower/t/t_loadcase.py ## read version 2 OPF data matrices ppc = t_case9_opfv2() ## save as .mat file savemat(matfilev2 + '.mat', {'ppc': ppc}, oned_as='column') ## prepare expected matrices for v1 load ## (missing gen cap curve & branch ang diff lims...
code_fim
hard
{ "lang": "python", "repo": "rwl/PYPOWER", "path": "/pypower/t/t_loadcase.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Informatica-EIC/REST-API-Samples path: /python/similarityReport.py """ Created on Jul 11, 2018 @author: dwrigley similarityReport - get information about all similar relationships for an object Note: this is 10.2.1+ only - the method is different starting with 10.2.1 & uses v1 (undocum...
code_fim
hard
{ "lang": "python", "repo": "Informatica-EIC/REST-API-Samples", "path": "/python/similarityReport.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print("\t\t" + scoreSim +":" + patternSim +":" + nameSim +":" + # valSim +":" + frqSim +":") simLinks += 1 colWriter.writerow( [itemId, dstId, scoreSim, valSim, frqSim, patternSim, nameSim] ...
code_fim
hard
{ "lang": "python", "repo": "Informatica-EIC/REST-API-Samples", "path": "/python/similarityReport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("url=" + objectsurl) print("user=" + uid) print("query=" + query) print("") itemCount = 0 itemsWithSim = 0 simLinks = 0 while offset < total: page += 1 parameters = {"q": query, "offset": offset, "pageSize": pageSize} # execute catalog rest call, for a page of results resp = reques...
code_fim
hard
{ "lang": "python", "repo": "Informatica-EIC/REST-API-Samples", "path": "/python/similarityReport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lodemo/CATANA path: /src/face_recognition/trimFeatures.py # -*- coding: utf-8 -*- ''' Due to memory usage problems, if features array is present as file on-disk, its loaded here and used for computing sparse distance matrix. Features array cant be loaded as numpy memmap, as its not a "perfect"...
code_fim
hard
{ "lang": "python", "repo": "lodemo/CATANA", "path": "/src/face_recognition/trimFeatures.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import networkx as nx fileDir = os.path.dirname(os.path.realpath(__file__)) # Load features array from disk features = np.load(os.path.join(fileDir,'features_3MONTH.npy')) print 'Loaded feature:', features.shape np.save('features_3MONTH_15.npy', np.asarray([f[:15] for f in features]))<|fim_prefix|># r...
code_fim
hard
{ "lang": "python", "repo": "lodemo/CATANA", "path": "/src/face_recognition/trimFeatures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import hdbscan from sklearn.cluster import DBSCAN from sklearn.cluster import AgglomerativeClustering import facedist32 import networkx as nx fileDir = os.path.dirname(os.path.realpath(__file__)) # Load features array from disk features = np.load(os.path.join(fileDir,'features_3MONTH.npy')) print 'Lo...
code_fim
medium
{ "lang": "python", "repo": "lodemo/CATANA", "path": "/src/face_recognition/trimFeatures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { 'scan': 'scan', 'track': 'track', 'acq_date': 'acq_date', 'acq_time': 'acq_time', 'satellite': 'satellite', 'point': 'POINT' }<|fim_prefix|># repo: pjdufour/ex2 path: /ex2/enumerations.py COUNTRY_MAPPING = { 'name': 'name', 'iso2': 'iso2', 'iso3': 'iso<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "pjdufour/ex2", "path": "/ex2/enumerations.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pjdufour/ex2 path: /ex2/enumerations.py COUNTRY_MAPPING = { 'name': 'name', 'iso2': 'iso2', 'iso3': 'iso<|fim_suffix|> 'acq_time': 'acq_time', 'satellite': 'satellite', 'point': 'POINT' }<|fim_middle|>3', 'pop2005': 'pop2005', 'mpoly': 'MULTIPOLYGON' } HOTSPOT_MAPPING ...
code_fim
medium
{ "lang": "python", "repo": "pjdufour/ex2", "path": "/ex2/enumerations.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>Max AC Charger Current", "int", "A", {"device-class": "current"}], [26, "PV1 Input Current", "int", "A", {"icon": "mdi:solar-power", "device-class": "power"}], [ 27, "Battery Discharge Current", "int", "A", ...
code_fim
hard
{ "lang": "python", "repo": "jblance/mpp-solar", "path": "/mppsolar/protocols/pi30m045.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jblance/mpp-solar path: /mppsolar/protocols/pi30m045.py import logging from .pi30max import pi30max log = logging.getLogger("pi30m045") QUERY_COMMANDS = { "QDI": { "name": "QDI", "description": "Default Settings inquiry", "type": "QUERY", "response": [ ...
code_fim
hard
{ "lang": "python", "repo": "jblance/mpp-solar", "path": "/mppsolar/protocols/pi30m045.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Inserts a dimension of length one at a given index of the dimension array. Args: module: Module object corresponding to the arrays. array: The array whose dimension to expand. dimension: The index at which to insert the new dimension. Returns: ...
code_fim
hard
{ "lang": "python", "repo": "simonpf/quantnn", "path": "/quantnn/generic/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonpf/quantnn path: /quantnn/generic/__init__.py ) elif module == tf: return module.convert_to_tensor(array) raise UnknownModuleException(f"Module {module.__name__} not supported.") def sample_uniform(module, shape, like=None): """ Create a tensor with random values sa...
code_fim
hard
{ "lang": "python", "repo": "simonpf/quantnn", "path": "/quantnn/generic/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def expand_dims(module, array, dimension): """ Expand tensor dimension along given axis. Inserts a dimension of length one at a given index of the dimension array. Args: module: Module object corresponding to the arrays. array: The array whose dimension to expand. ...
code_fim
hard
{ "lang": "python", "repo": "simonpf/quantnn", "path": "/quantnn/generic/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MickaelRigault/pysedm path: /bin/extractstar.py ################################# # # MAIN # ################################# if __name__ == "__main__": import argparse import numpy as np from pysedm import get_sedmcube, io # ================= # # Options ...
code_fim
hard
{ "lang": "python", "repo": "MickaelRigault/pysedm", "path": "/bin/extractstar.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MickaelRigault/pysedm path: /bin/extractstar.py Parser( description=""" run the interactive plotting of a given cube""", formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('infile', type=str, default="None", help='cube filepath') #...
code_fim
hard
{ "lang": "python", "repo": "MickaelRigault/pysedm", "path": "/bin/extractstar.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument('--byecr_showcube', action="store_true", default=False, help="Show a cube with detected cosmic rays.") # Centroid parser.add_argument('--centroid', type=str, default="auto", nargs="+", help='Where is the point source expec...
code_fim
hard
{ "lang": "python", "repo": "MickaelRigault/pysedm", "path": "/bin/extractstar.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: camoz/snakecube path: /vector.py #!/usr/bin/env python3 def multiply(matrix, vector): """Return the matrix product of a matrix and a vector. Args: matrix (list(list(int))): A matrix of size m*n. vector (list(int)): A vector of size n. Returns: Vector3D: A v...
code_fim
hard
{ "lang": "python", "repo": "camoz/snakecube", "path": "/vector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __next__(self): if self._pos >= self.__len__(): raise StopIteration pos = self._pos self._pos += 1 return self[pos] def __add__(self, other): return Vector3D(self.x + other.x, self.y + other.y, self.z + other.z) def __sub__(self, other)...
code_fim
hard
{ "lang": "python", "repo": "camoz/snakecube", "path": "/vector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return res print Solution().findDiagonalOrder( [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] )<|fim_prefix|># repo: xiaonanln/myleetcode-python path: /src/498. Diagonal Traverse.py class Solution(object): def findDiagonalOrder(self, matrix): """ :type matrix: List[List[int]] :rtype: List[int] ...
code_fim
hard
{ "lang": "python", "repo": "xiaonanln/myleetcode-python", "path": "/src/498. Diagonal Traverse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print Solution().findDiagonalOrder( [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] )<|fim_prefix|># repo: xiaonanln/myleetcode-python path: /src/498. Diagonal Traverse.py class Solution(object): def findDiagonalOrder(self, matrix): """ :type matrix: List[List[int]] :rtype: List[int] """ R = len(...
code_fim
hard
{ "lang": "python", "repo": "xiaonanln/myleetcode-python", "path": "/src/498. Diagonal Traverse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaonanln/myleetcode-python path: /src/498. Diagonal Traverse.py class Solution(object): def findDiagonalOrder(self, matrix): """ :type matrix: List[List[int]] :rtype: List[int] """ R = len(matrix) if not R: return [] C = len(matrix[0]) r, c = 0, 0 dir = 1 # dir can be (-1...
code_fim
medium
{ "lang": "python", "repo": "xiaonanln/myleetcode-python", "path": "/src/498. Diagonal Traverse.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: babybunny/rebuildingtogethercaptain path: /dev_server.py import subprocess import sys import time import os import dev_utilities my_path = os.path.realpath(__file__) app_yaml = os.path.join(os.path.dirname(my_path), 'gae', 'app.yaml') <|fim_suffix|> print("check out the local server at http://...
code_fim
hard
{ "lang": "python", "repo": "babybunny/rebuildingtogethercaptain", "path": "/dev_server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("check out the local server at http://localhost:8080") try: while True: time.sleep(1) except KeyboardInterrupt: print("Received KeyboardInterrupt") sys.exit(0)<|fim_prefix|># repo: babybunny/rebuildingtogethercaptain path: /dev_server.py import subprocess import sys import ...
code_fim
hard
{ "lang": "python", "repo": "babybunny/rebuildingtogethercaptain", "path": "/dev_server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/third_party/thriftpy/_shaded_thriftpy/protocol/binary.py # -*- coding: utf-8 -*- from __future__ import absolute_import import struct from ..thrift import TType from .exc import TProtocolException from .base import TProtocolBase # VERSION_MA...
code_fim
hard
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/helpers/third_party/thriftpy/_shaded_thriftpy/protocol/binary.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def read_val(inbuf, ttype, spec=None, decode_response=True): if ttype == TType.BOOL: return bool(unpack_i8(inbuf.read(1))) elif ttype == TType.BYTE: return unpack_i8(inbuf.read(1)) elif ttype == TType.I16: return unpack_i16(inbuf.read(2)) elif ttype == TType.I32:...
code_fim
hard
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/helpers/third_party/thriftpy/_shaded_thriftpy/protocol/binary.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Remmeauth/block-producers-directory-back path: /directory/block_producer/migrations/0007_add_status_description_field.py # Generated by Django 2.2.5 on 2019-09-27 15:12 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ mig...
code_fim
medium
{ "lang": "python", "repo": "Remmeauth/block-producers-directory-back", "path": "/directory/block_producer/migrations/0007_add_status_description_field.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('block_producer', '0006_add_created_at'), ] operations = [ migrations.AddField( model_name='blockproducer', name='status_description', field=models.TextField(blank=True, max_length=1000), ), migrations.Alter...
code_fim
medium
{ "lang": "python", "repo": "Remmeauth/block-producers-directory-back", "path": "/directory/block_producer/migrations/0007_add_status_description_field.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='blockproducer', name='status_description', field=models.TextField(blank=True, max_length=1000), ), migrations.AlterField( model_name='blockproducer', name='full_descripti...
code_fim
medium
{ "lang": "python", "repo": "Remmeauth/block-producers-directory-back", "path": "/directory/block_producer/migrations/0007_add_status_description_field.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ This function transfers data from local file system to remote S3 storage :param input_path: :param bucket_name: :param file_ext: :return: """ client = boto3.client('s3', aws_access_key_id=self.access_key, ...
code_fim
hard
{ "lang": "python", "repo": "SwiftDerek/USImmigrationETL", "path": "/load/aws_load.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SwiftDerek/USImmigrationETL path: /load/aws_load.py import os from boto3.s3.transfer import S3Transfer import boto3 import logging class AWSLoad: def __init__(self, access_key, secret_key): <|fim_suffix|> """ This function transfers data from local file system to remote S3 ...
code_fim
hard
{ "lang": "python", "repo": "SwiftDerek/USImmigrationETL", "path": "/load/aws_load.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: materialsproject/MPContribs path: /mpcontribs-api/mpcontribs/api/core.py ) description = f"List of fields to include in response ({fields_avail})." description += " Use dot-notation for nested subfields." fields_param = { "name": "_fields", "in": "q...
code_fim
hard
{ "lang": "python", "repo": "materialsproject/MPContribs", "path": "/mpcontribs-api/mpcontribs/api/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: materialsproject/MPContribs path: /mpcontribs-api/mpcontribs/api/core.py if hasattr(op, "fmt"): filter_params[-1]["format"] = op.fmt if op.allow_negation: suffix = "not__" suffix += op.suf if hasattr(op, "suf") else op.op name = f"{l...
code_fim
hard
{ "lang": "python", "repo": "materialsproject/MPContribs", "path": "/mpcontribs-api/mpcontribs/api/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return spec class SwaggerView(OriginalSwaggerView, ResourceView): """A class-based view defining additional methods""" def __init_subclass__(cls, **kwargs): """initialize Schema, decorators, definitions, and tags""" super().__init_subclass__(**kwargs) if not __name_...
code_fim
hard
{ "lang": "python", "repo": "materialsproject/MPContribs", "path": "/mpcontribs-api/mpcontribs/api/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x_train, y_train = shuffle(x_train, y_train, random_state=0) model = bd_lstm(embedding_matrix) batch_size = 64 epochs = 20 PATIENCE=4 _, tmpfn = tempfile.mkstemp() callbacks = [EarlyStopping(patience=PATIENCE), ModelCheckpoint( tmpfn, save_best_only=True, save_weight...
code_fim
hard
{ "lang": "python", "repo": "thunlp/SememePSO-Attack", "path": "/SST/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_x = pad_sequences(dataset.test_seqs2, maxlen=250, padding='post') test_y = np.array(dataset.test_y) train_y=np.array([[0,1] if t==1 else [1,0] for t in train_y]) #valid_y = np.array([[0, 1] if t == 1 else [1, 0] for t in valid_y]) test_y = np.array([[0, 1] if t == 1 else [1, 0] ...
code_fim
hard
{ "lang": "python", "repo": "thunlp/SememePSO-Attack", "path": "/SST/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thunlp/SememePSO-Attack path: /SST/train_model.py from __future__ import print_function from keras.callbacks import EarlyStopping, ModelCheckpoint import tempfile from keras.models import Sequential from keras.layers import * from keras.layers import Dense, Dropout, Activation from keras.layers i...
code_fim
hard
{ "lang": "python", "repo": "thunlp/SememePSO-Attack", "path": "/SST/train_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amwelch/a10sdk-python path: /a10sdk/core/cgnv6/cgnv6_one_to_one_global.py from a10sdk.common.A10BaseClass import A10BaseClass class Global(A10BaseClass): """ :param mapping_timeout: {"description": "Configure timeout for the one-to-one NAT mapping (Timeout in minutes (default: 10 mi...
code_fim
medium
{ "lang": "python", "repo": "amwelch/a10sdk-python", "path": "/a10sdk/core/cgnv6/cgnv6_one_to_one_global.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ def __init__(self, **kwargs): self.ERROR_MSG = "" self.required=[] self.b_key = "global" self.a10_url="/axapi/v3/cgnv6/one-to-one/global" self.DeviceProxy = "" self.mapping_timeout = "" self.uuid = "" for keys, value in kwa...
code_fim
hard
{ "lang": "python", "repo": "amwelch/a10sdk-python", "path": "/a10sdk/core/cgnv6/cgnv6_one_to_one_global.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def on_event(self, event, extension): if event.id == "todoist_kw": extension.keyword = event.new_value elif event.id == "todoist_api_token": extension.api_token = event.new_value<|fim_prefix|># repo: cmuench/ulauncher-todoist path: /todoistext/PreferencesEventL...
code_fim
hard
{ "lang": "python", "repo": "cmuench/ulauncher-todoist", "path": "/todoistext/PreferencesEventListener.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmuench/ulauncher-todoist path: /todoistext/PreferencesEventListener.py from ulauncher.api.client.EventListener import EventListener <|fim_suffix|> if event.id == "todoist_kw": extension.keyword = event.new_value elif event.id == "todoist_api_token": extens...
code_fim
hard
{ "lang": "python", "repo": "cmuench/ulauncher-todoist", "path": "/todoistext/PreferencesEventListener.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shawnkx/multiDDS path: /util_scripts/word_freq.py import sys filename = sys.argv[1] words = {} with open(filename, 'r') as myfile: for line in myfile: toks = line.split() for w in toks: if w in words: words[w] += 1 else: ...
code_fim
easy
{ "lang": "python", "repo": "shawnkx/multiDDS", "path": "/util_scripts/word_freq.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sorted_words = sorted(words.items(), key=lambda kv:kv[1])[::-1] with open(out_filename, 'w') as myfile: for w, count in sorted_words: myfile.write("{} {}\n".format(count, w))<|fim_prefix|># repo: shawnkx/multiDDS path: /util_scripts/word_freq.py import sys filename = sys.argv[1] words = {}...
code_fim
easy
{ "lang": "python", "repo": "shawnkx/multiDDS", "path": "/util_scripts/word_freq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> await setup_platform(hass, [SENSOR_DOMAIN], usage=MOCK_VOIP_USAGE) assert hass.states.get("sensor.mobile_national_calls").state == "1" assert hass.states.get("sensor.mobile_sms_sent").state == STATE_UNKNOWN assert hass.states.get("sensor.mobile_data_used").state == STATE_UNKNOWN<|fim_pref...
code_fim
medium
{ "lang": "python", "repo": "JeffLIrion/home-assistant", "path": "/tests/components/aussie_broadband/test_sensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeffLIrion/home-assistant path: /tests/components/aussie_broadband/test_sensor.py """Aussie Broadband sensor platform tests.""" from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import STATE_UNKNOWN from .common import setup_platform MOCK_NBN_USAGE = {...
code_fim
hard
{ "lang": "python", "repo": "JeffLIrion/home-assistant", "path": "/tests/components/aussie_broadband/test_sensor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Accepts a string containing a location and formats it properly.""" prompt = ConversionPrompt( 'I', 'O', ("lenox ma", "Lenox, MA"), ("london", "London, U.K."), ("chicago", "Chicago, IL"), ("dallas, tx", "Dallas, TX"), engine='babbage' ) ret...
code_fim
easy
{ "lang": "python", "repo": "nelsonlove/gpt-utils", "path": "/src/gpt_utils/location.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nelsonlove/gpt-utils path: /src/gpt_utils/location.py from . import GPT from .prompt import ConversionPrompt <|fim_suffix|> """Accepts a string containing a location and formats it properly.""" prompt = ConversionPrompt( 'I', 'O', ("lenox ma", "Lenox, MA"), ("londo...
code_fim
easy
{ "lang": "python", "repo": "nelsonlove/gpt-utils", "path": "/src/gpt_utils/location.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_model_instance(name, tensor_dim): return { 'unet':{'2D': unet_2D, '3D': unet_3D}, 'unet_nonlocal':{'2D': unet_nonlocal_2D, '3D': unet_nonlocal_3D}, 'unet_grid_gating': {'3D': unet_grid_attention_3D}, 'unet_ct_dsv': {'3D': unet_CT_dsv_3D}, 'unet_ct_sing...
code_fim
hard
{ "lang": "python", "repo": "Lorna-Liu/Attention-Gated-Networks", "path": "/models/networks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lorna-Liu/Attention-Gated-Networks path: /models/networks/__init__.py from .unet_2D import * from .unet_3D import * from .unet_nonlocal_2D import * from .unet_nonlocal_3D import * from .unet_grid_attention_3D import * from .unet_CT_dsv_3D import * from .unet_CT_single_att_dsv_3D import * from .un...
code_fim
hard
{ "lang": "python", "repo": "Lorna-Liu/Attention-Gated-Networks", "path": "/models/networks/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if name in ['unet', 'unet_ct_dsv']: model = model(n_classes=n_classes, is_batchnorm=True, in_channels=in_channels, feature_scale=feature_scale, is_deconv=False) elif name in ['unet_nonlocal']: m...
code_fim
hard
{ "lang": "python", "repo": "Lorna-Liu/Attention-Gated-Networks", "path": "/models/networks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chreman/embedbot path: /workflow/workflow.py from os import path import time import logging import argparse from pyspark import SparkContext, SparkConf from pyspark.sql import SparkSession from pyspark.ml import Pipeline from pyspark.ml.feature import RegexTokenizer, Word2Vec from transformers im...
code_fim
hard
{ "lang": "python", "repo": "chreman/embedbot", "path": "/workflow/workflow.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> w2vpipeline = Pipeline(stages=[stringconcat, tokenizer, word2Vec]) logger.info('Fitting feature pipeline.') w2vpipeline_model = w2vpipeline.fit(fulltexts) w2vmodel = w2vpipeline_model.stages[-1] vectors = w2vmodel.ge...
code_fim
hard
{ "lang": "python", "repo": "chreman/embedbot", "path": "/workflow/workflow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': parser = argparse.ArgumentParser(description='do stuff') parser.add_argument('--input', dest='input', help='relative or absolute ' 'path of the input folder') parser.add_argument('--output', dest='output', help='relative or absolute ' ...
code_fim
hard
{ "lang": "python", "repo": "chreman/embedbot", "path": "/workflow/workflow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> files = [] for root, dirnames, filenames in os.walk(directory_name): for filename in fnmatch.filter(filenames, pattern): files.append(os.path.join(root, filename)) return files<|fim_prefix|># repo: Laymer/renode path: /src/Renode/RobotFrameworkEngine/helper.py import netif...
code_fim
hard
{ "lang": "python", "repo": "Laymer/renode", "path": "/src/Renode/RobotFrameworkEngine/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> proc = subprocess.Popen(['ip', 'addr', 'show', name, 'up'], stdout=subprocess.PIPE) (output, err) = proc.communicate() exit_code = proc.wait() if exit_code != 0 or len(output) == 0: raise Exception('Network interface {} is not up.'.format(name)) def network_interface_should_have_a...
code_fim
medium
{ "lang": "python", "repo": "Laymer/renode", "path": "/src/Renode/RobotFrameworkEngine/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Laymer/renode path: /src/Renode/RobotFrameworkEngine/helper.py import netifaces import subprocess import fnmatch import os def network_interface_should_exist(name): if name not in netifaces.interfaces(): raise Exception('Network interface {} not found.'.format(name)) <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "Laymer/renode", "path": "/src/Renode/RobotFrameworkEngine/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LuizArmesto/mootiro-maps path: /mootiro_komoo/apps/search/utils.py # -*- coding=utf-8 -*- import requests import simplejson as json from django.conf import settings ES = settings.ELASTICSEARCH_URL ES_INDEX = settings.ELASTICSEARCH_INDEX_NAME ES_TYPE = 'komoo_objects' MAPPINGS_DICT = { ES_TY...
code_fim
hard
{ "lang": "python", "repo": "LuizArmesto/mootiro-maps", "path": "/mootiro_komoo/apps/search/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> requests.post(es_url('{ES}/{INDEX}]_refresh')) def es_index_dict(obj): return { 'object_id': obj.id, 'table_ref': '{}.{}'.format( obj._meta.app_label, obj.__class__.__name__), 'name': obj.name, 'description': getattr(obj, 'description', ''), 'e...
code_fim
hard
{ "lang": "python", "repo": "LuizArmesto/mootiro-maps", "path": "/mootiro_komoo/apps/search/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> GET /databases """ r = self.__get_response(settings.LST_DBS) if r["status"] == 200: return r["result"] raise Exception(r["result"]["message"]) def list_collections(self, database): """Returns a list of collections name of database selecte...
code_fim
hard
{ "lang": "python", "repo": "puentesarrin/pymongolab", "path": "/mongolabclient/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: puentesarrin/pymongolab path: /mongolabclient/client.py # -*- coding: utf-8 *-* try: import simplejson as json except ImportError: import json import requests from bson import json_util from mongolabclient import settings, validators, errors class MongoLabClient(object): """Instanc...
code_fim
hard
{ "lang": "python", "repo": "puentesarrin/pymongolab", "path": "/mongolabclient/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: leafvmaple/pyluadec path: /pyluadec/utility.py import sys import json import struct BYTE_ORDER = { '*': sys.byteorder, '+': 'big', '-': 'little', } def get_null_string(data, offset): idx = data.find(b'\0', offset) return bytes.decode(data[offset: idx]) def fread(file, size)...
code_fim
hard
{ "lang": "python", "repo": "leafvmaple/pyluadec", "path": "/pyluadec/utility.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self._form[key] = form setattr(self, key, read(file, form, initvars)) def tojson(self, indent='\t'): return json.dumps(self.format(), indent=indent) def to_bytes(self): return to_bytes(self, self._export) class Version: def __init__(self, file, export): ...
code_fim
hard
{ "lang": "python", "repo": "leafvmaple/pyluadec", "path": "/pyluadec/utility.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jyurkiw/py_cyberpunk_2020_rest_api path: /util/__init__.py from pymongo import MongoClient from pyconst import loadConstantsFile from random import choices import os if os.path.exists(".dbConstants"): _db_consts = loadConstantsFile("DatabaseConstants", ".dbConstants") db = MongoCl...
code_fim
hard
{ "lang": "python", "repo": "jyurkiw/py_cyberpunk_2020_rest_api", "path": "/util/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # We're distributing based on an index list because weighting requires using # random.choices indexList = [i for i in range(0, len(valueList))] while points > 0: points -= ( 1 if incrementAtIndex( valueList, choices(indexList, weight...
code_fim
hard
{ "lang": "python", "repo": "jyurkiw/py_cyberpunk_2020_rest_api", "path": "/util/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def convertValueNameListToDict(valueList): """Returns a dictionary formed from a list of name/value pairs. Not recursive.""" return {k["name"]: k["value"] for k in valueList} def distributePoints(valueList, **args): """Returns a list of random numbers that line up with a valueIndexMap....
code_fim
hard
{ "lang": "python", "repo": "jyurkiw/py_cyberpunk_2020_rest_api", "path": "/util/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/esphome/camera.py """Support for ESPHome cameras.""" from __future__ import annotations import asyncio from collections.abc import Callable, Coroutine from functools import partial from typing import Any from aioesphomeapi import CameraInfo, C...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/esphome/camera.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Notify listeners of new image when update arrives.""" super()._on_state_update() self._set_futures(True) async def async_camera_image( self, width: int | None = None, height: int | None = None ) -> bytes | None: """Return single camera image bytes.""" ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/esphome/camera.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_true(): return True<|fim_prefix|># repo: AbdallahCoptan/presence path: /tests/test_presence.py """Tests for presence""" import json import os import sys <|fim_middle|>sys.path.insert(0, os.path.abspath('.')) #from tests.resources import *
code_fim
medium
{ "lang": "python", "repo": "AbdallahCoptan/presence", "path": "/tests/test_presence.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AbdallahCoptan/presence path: /tests/test_presence.py """Tests for presence""" import json import os import sys <|fim_suffix|>#from tests.resources import * def test_true(): return True<|fim_middle|>sys.path.insert(0, os.path.abspath('.'))
code_fim
easy
{ "lang": "python", "repo": "AbdallahCoptan/presence", "path": "/tests/test_presence.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alliefitter/boto3_type_annotations path: /boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py from typing import Dict from botocore.paginate import Paginator class ListCertificateAuthorities(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: <|fim_suffix|>...
code_fim
medium
{ "lang": "python", "repo": "alliefitter/boto3_type_annotations", "path": "/boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ListTags(Paginator): def paginate(self, CertificateAuthorityArn: str, PaginationConfig: Dict = None) -> Dict: pass<|fim_prefix|># repo: alliefitter/boto3_type_annotations path: /boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py from typing import Dict from botocore.pagi...
code_fim
medium
{ "lang": "python", "repo": "alliefitter/boto3_type_annotations", "path": "/boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass class ListTags(Paginator): def paginate(self, CertificateAuthorityArn: str, PaginationConfig: Dict = None) -> Dict: pass<|fim_prefix|># repo: alliefitter/boto3_type_annotations path: /boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py from typing import Dict fro...
code_fim
medium
{ "lang": "python", "repo": "alliefitter/boto3_type_annotations", "path": "/boto3_type_annotations/boto3_type_annotations/acm_pca/paginator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: biogui/simple-image-editor-with-opencv path: /blur.py from cv2 import blur as blurCV from validChoice import validChoice <|fim_suffix|> i = validChoice(input(">> "), 5) kernels = [1, 3, 5, 9, 11] k = kernels[i] print("Creating the new image...") newImage = blurCV(image, (k, k)) ...
code_fim
medium
{ "lang": "python", "repo": "biogui/simple-image-editor-with-opencv", "path": "/blur.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Creating the new image...") newImage = blurCV(image, (k, k)) return newImage<|fim_prefix|># repo: biogui/simple-image-editor-with-opencv path: /blur.py from cv2 import blur as blurCV from validChoice import validChoice def blur(image): <|fim_middle|> print("Choice the blur intensity") ...
code_fim
hard
{ "lang": "python", "repo": "biogui/simple-image-editor-with-opencv", "path": "/blur.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ A list of references to all virtual machines in the Dedicated Host. """ return pulumi.get(self, "virtual_machines") class AwaitableGetDedicatedHostResult(GetDedicatedHostResult): # pylint: disable=using-constant-test def __await__(self): if False: ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/compute/v20230701/get_dedicated_host.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> host_group_name: Optional[str] = None, host_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDedicatedHostResult: """ Retrie...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/compute/v20230701/get_dedicated_host.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/compute/v20230701/get_dedicated_host.py # coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/compute/v20230701/get_dedicated_host.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashesh-0/kaggle_competitions path: /sales_prediction/tests/test_train_test_similarity.py import pandas as pd import numpy as np from train_test_similarity import make_train_have_similar_zeroed_entries_as_test, get_monthly_sales def dummy_sales(): columns = ['date', 'date_block_num', 'shop_i...
code_fim
hard
{ "lang": "python", "repo": "ashesh-0/kaggle_competitions", "path": "/sales_prediction/tests/test_train_test_similarity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert output_df[output_df.date_block_num == 11].shape[0] == 6 assert all(output_df[output_df.date_block_num == 11].groupby('item_id')['shop_id'].count().unique() == [2]) assert all(output_df[output_df.date_block_num == 11].groupby('shop_id')['item_id'].count().unique() == [3]) # original...
code_fim
hard
{ "lang": "python", "repo": "ashesh-0/kaggle_competitions", "path": "/sales_prediction/tests/test_train_test_similarity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Test Simple """ tests = [ {"name": "foo", "gtest": True}, {"name": "test_bar"}, {"name": "test_baz", "pytest": True} ] qitest_json = tmpdir.join("qitest.json") qitest_json.write(json.dumps(tests)) qitest_action("list", cwd=tmpdir.strpath) assert reco...
code_fim
medium
{ "lang": "python", "repo": "aldebaran/qibuild", "path": "/python/qitest/test/test_qitest_list.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: aldebaran/qibuild path: /python/qitest/test/test_qitest_list.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ Test QiTest List """ from __futu...
code_fim
medium
{ "lang": "python", "repo": "aldebaran/qibuild", "path": "/python/qitest/test/test_qitest_list.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: modichirag/galference path: /code/clean_rim/dm_multi_single.py """ Implementation of Cosmic RIM estimator""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf physical_devices = tf.config.experimental.list_physica...
code_fim
hard
{ "lang": "python", "repo": "modichirag/galference", "path": "/code/clean_rim/dm_multi_single.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ########################################### ####Train ### #Training losses = [] for epoch in range(args.epochs): print("\nFor epoch %d\n"%epoch) #TRAIN LOOP total_loss = 0.0 num_batches = 0 starte = time.time() for x in train_dist_dataset: startb = time.time() ...
code_fim
hard
{ "lang": "python", "repo": "modichirag/galference", "path": "/code/clean_rim/dm_multi_single.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> per_replica_losses = strategy.run(train_step, args=(dataset_inputs,)) return strategy.reduce(tf.distribute.ReduceOp.SUM, per_replica_losses, axis=None) @tf.function def distributed_test_step(dataset_inputs): return strategy.run(test_step, args=(dataset_inputs,)) #######...
code_fim
hard
{ "lang": "python", "repo": "modichirag/galference", "path": "/code/clean_rim/dm_multi_single.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }