text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: Darkria8/Deep-Transfer-Meta-Learning path: /configs.py save_dir = './logs' miniImageNet_path = '/home/data3/WYX/CrossDomainFewShot-master/filelists/miniImagenet' DTD_path = '/ssd/dtd/images/' CUB_path = '/home/data3/WYX/cdfsl-ben<|fim_su...
code_fim
medium
{ "lang": "python", "repo": "Darkria8/Deep-Transfer-Meta-Learning", "path": "/configs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._window @property def reset_at(self) -> int: """Timestamp at which the rate limit will be reset""" return int(self.window[0] + 1) @property def remaining(self) -> int: """Quantity remaining for this rate limit""" return self.window[1]...
code_fim
hard
{ "lang": "python", "repo": "alisaifee/flask-limiter", "path": "/flask_limiter/wrappers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alisaifee/flask-limiter path: /flask_limiter/wrappers.py from __future__ import annotations import dataclasses import typing import weakref from typing import Callable, Iterator, List, Optional, Tuple, Union from flask import request from flask.wrappers import Response from limits import RateLi...
code_fim
hard
{ "lang": "python", "repo": "alisaifee/flask-limiter", "path": "/flask_limiter/wrappers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._cost() @property def method_exempt(self) -> bool: """Check if the limit is not applicable for this method""" return self.methods is not None and request.method.lower() not in self.methods def scope_for(self, endpoint: str, method: Optional[str]) -> str: ...
code_fim
hard
{ "lang": "python", "repo": "alisaifee/flask-limiter", "path": "/flask_limiter/wrappers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v13/enums/types/policy_approval_status.pyi from typing import Any import proto class PolicyApprovalStatusEnum(proto.Message): class PolicyApprovalStatus(proto.Enum): <|fim_suffix|> self, mapping: Any | None = ..., ...
code_fim
medium
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v13/enums/types/policy_approval_status.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Make prediction of batch of samples. :param states: <np.ndarray> Input batch of states. :return: <tf.python.framework.ops.EagerTensor> Run session. """ return self.model(states, training=False) @tf.function def train_batch( self, ...
code_fim
hard
{ "lang": "python", "repo": "mit-ccrg/ml4c3-mirror", "path": "/rl4cs/model_training/nn_model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mit-ccrg/ml4c3-mirror path: /rl4cs/model_training/nn_model.py # Imports: standard library from typing import List, Optional # Imports: third party import numpy as np import tensorflow as tf from tensorflow.keras import Input, Model, layers, losses, optimizers class NNModel: """ Neural ...
code_fim
hard
{ "lang": "python", "repo": "mit-ccrg/ml4c3-mirror", "path": "/rl4cs/model_training/nn_model.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: YuhengZhi/demix path: /demix_autoencoder.py import torch import torch.nn as nn from termcolor import colored class Demix(nn.Module): def __init__(self, mix_begin="input"): super(Demix, self).__init__() self.conv1 = nn.Sequential( nn.Conv2d(3, 96, kernel_size=11,...
code_fim
hard
{ "lang": "python", "repo": "YuhengZhi/demix", "path": "/demix_autoencoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, x, mix_ratio=0.8): n_batch = x.size()[0] # print(n_batch) pic1_interm = self.independent_encode(x[:n_batch // 2]) pic2_interm = self.independent_encode(x[n_batch // 2:]) mixup_interm = mix_ratio * pic1_interm + (1 - mix_ratio) * pic2_interm ...
code_fim
hard
{ "lang": "python", "repo": "YuhengZhi/demix", "path": "/demix_autoencoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 27 -> 27 nn.ConvTranspose2d(256, 192, 5, stride=1, padding=2), nn.BatchNorm2d(192), nn.ReLU(inplace=True), # 27 -> 55 nn.ConvTranspose2d(192, 192, 3, 2), nn.BatchNorm2d(192), nn.ReLU(inplace=True), ...
code_fim
hard
{ "lang": "python", "repo": "YuhengZhi/demix", "path": "/demix_autoencoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>5), font, 2, (255, 255, 255), 2, cv2.LINE_AA) cv2.imshow('Lena', image) cv2.waitKey(0)<|fim_prefix|># repo: cassiobotaro/rivendell path: /cv/text.py # Module to write a text into an image import cv2 image = cv2.imread('lena.jpg') font = cv2.FONT_HERSHEY_TRIPLEX # cv2.putText(img, text, org, fontFace, fon...
code_fim
medium
{ "lang": "python", "repo": "cassiobotaro/rivendell", "path": "/cv/text.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cassiobotaro/rivendell path: /cv/text.py # Module to write a text into an image import cv2 image = cv2.imread('lena.jpg') font = cv2.FONT_HERSHEY_TRIPLEX # cv2.putText(img, text, org, fontFace, fontScale, color[, <|fim_suffix|>5), font, 2, (255, 255, 255), 2, cv2.LINE_AA) cv2.imshow('Lena', image...
code_fim
medium
{ "lang": "python", "repo": "cassiobotaro/rivendell", "path": "/cv/text.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuanquanghpvn/flask-intro path: /migrations/versions/196bcc3133cb_.py """empty message Revision ID: 196bcc3133cb Revises: 5d3ded72de8 Create Date: 2015-11-30 13:53:29.212438 """ # revision identifiers, used by Alembic. revision = '196bcc3133cb' down_revision = '5d3ded72de8' from alembic impor...
code_fim
hard
{ "lang": "python", "repo": "tuanquanghpvn/flask-intro", "path": "/migrations/versions/196bcc3133cb_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('user', 'staff', existing_type=mysql.TINYINT(display_width=1), nullable=True) op.alter_column('user', 'active', existing_type=mysql.TINYINT(display_width=1)...
code_fim
hard
{ "lang": "python", "repo": "tuanquanghpvn/flask-intro", "path": "/migrations/versions/196bcc3133cb_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MartinHowarth/s3os path: /s3os/s3_wrapper.py """Wrapper around boto3 to make it simpler to use.""" import boto3 import botocore import io import logging from botocore.exceptions import ClientError from dataclasses import dataclass, field from typing import Generator, Optional log = logging.g...
code_fim
hard
{ "lang": "python", "repo": "MartinHowarth/s3os", "path": "/s3os/s3_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param object_location: Location of the object to delete. """ s3 = boto3.client("s3") result = s3.delete_object( Bucket=object_location.bucket.name, Key=object_location.key ) log.debug(f"Result of delete of {object_location}: {result}") def generate_items_in_bucket( b...
code_fim
hard
{ "lang": "python", "repo": "MartinHowarth/s3os", "path": "/s3os/s3_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuxitao/tushare path: /examples/test_sqlite.py # -*- coding: utf-8 -*- """ Created on Wed Aug 31 21:51:30 2016 @author: yuxitao """ <|fim_suffix|>#df = pd.DataFrame({'A': [1,2,3], 'B': ['a', 'b', 'c']}) #df.to_sql('db_table', engine, index=False) #df = pd.read_sql_query('SELECT * FROM ...
code_fim
hard
{ "lang": "python", "repo": "yuxitao/tushare", "path": "/examples/test_sqlite.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#engine = create_engine('sqlite:///:memory:') #engine_mysql = create_engine('mysql+pymysql://root:xitao@127.0.0.1/test?charset=utf8') engine_sqlite = create_engine('sqlite:///foo.db') #df = pd.DataFrame({'A': [1,2,3], 'B': ['a', 'b', 'c']}) #df.to_sql('db_table', engine, index=False) #df = pd...
code_fim
medium
{ "lang": "python", "repo": "yuxitao/tushare", "path": "/examples/test_sqlite.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pcoss_scheduler_pkg.output.output_dict.update({(so.job, so.machine): (so, me)}) return ret def _correct_schedule(so: scheduled_operation): if c.PRINT_SCHEDULE_CORRECTION_MESSAGE: print('Schedule needs correction') else: pass<|fim_prefix|># repo: ksazon/pcoss path: /co...
code_fim
hard
{ "lang": "python", "repo": "ksazon/pcoss", "path": "/code/client/pcoss_scheduler_pkg/operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ksazon/pcoss path: /code/client/pcoss_scheduler_pkg/operations.py import asyncio import time import aiohttp import requests import urllib3 import pcoss_scheduler_pkg.constants as c import pcoss_scheduler_pkg.output from pcoss_scheduler_pkg.helpers import Measurement, scheduled_operation urllib...
code_fim
medium
{ "lang": "python", "repo": "ksazon/pcoss", "path": "/code/client/pcoss_scheduler_pkg/operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> op_time = max(0, int(so.operation_duration-c.DEFAULT_ADDED_TIME_MS)) url = f'{so.base_url}/{so.endpoint}/{so.machine}/{int(so.item)}/{op_time}' await asyncio.sleep(so.start_time/1000.0) it1 = time.perf_counter() async with session.get(url, ssl=False, timeout=600) as resp: ...
code_fim
hard
{ "lang": "python", "repo": "ksazon/pcoss", "path": "/code/client/pcoss_scheduler_pkg/operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sumitsj/workflow-web-app path: /app/models/log.py import datetime import enum from ..database import db class LogLevel(enum.Enum): debug = "DEBUG" info = "INFO" warn = "WARN" error = "ERROR" critical = "CRITICAL" def __str__(self): return str(self.value) <|fi...
code_fim
hard
{ "lang": "python", "repo": "sumitsj/workflow-web-app", "path": "/app/models/log.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.__repr__() def __repr__(self): return "<Log: %s - %s>" % (self.created_at.strftime('%m/%d/%Y-%H:%M:%S'), self.message)<|fim_prefix|># repo: sumitsj/workflow-web-app path: /app/models/log.py import datetime import enum from ..database import db class LogLevel(enum.Enum)...
code_fim
hard
{ "lang": "python", "repo": "sumitsj/workflow-web-app", "path": "/app/models/log.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __unicode__(self): return self.__repr__() def __repr__(self): return "<Log: %s - %s>" % (self.created_at.strftime('%m/%d/%Y-%H:%M:%S'), self.message)<|fim_prefix|># repo: sumitsj/workflow-web-app path: /app/models/log.py import datetime import enum from ..database import db ...
code_fim
hard
{ "lang": "python", "repo": "sumitsj/workflow-web-app", "path": "/app/models/log.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cnachi/gammapy path: /gammapy/background/template.py # Licensed under a 3-clause BSD style license - see LICENSE.rs<|fim_suffix|>ort absolute_import, division, print_function, unicode_literals<|fim_middle|>t """Template background estimation. Reference: http://adsabs.harvard.edu/abs/2003A%26A......
code_fim
medium
{ "lang": "python", "repo": "cnachi/gammapy", "path": "/gammapy/background/template.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ort absolute_import, division, print_function, unicode_literals<|fim_prefix|># repo: cnachi/gammapy path: /gammapy/background/template.py # Licensed under a 3-clause BSD style license - see LICENSE.rs<|fim_middle|>t """Template background estimation. Reference: http://adsabs.harvard.edu/abs/2003A%26A......
code_fim
medium
{ "lang": "python", "repo": "cnachi/gammapy", "path": "/gammapy/background/template.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: 418sec/py-crypto-exchange-api-client path: /crypto_exchange/constants.py # -*- coding: utf-8 -*- # ******************* kline cycle **************************** class KlineCycle: KLine1Min = 1 KLine3Min = 2 KLine5Min = 3 KLine15Min = 4 KLine30Min = 5 KLine1hour = 6 K...
code_fim
hard
{ "lang": "python", "repo": "418sec/py-crypto-exchange-api-client", "path": "/crypto_exchange/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> USDT = COMMON_USDT + OK_USDT BTC = COMMON_BTC + OK_BTC ETH = COMMON_ETH + OK_ETH HT = COMMON_HT + OK_HT @property def usdt_symbol(self): return [symbol.lower() for symbol in self.USDT] @property def btc_symbol(self): return [symbol.lower() for symbol i...
code_fim
hard
{ "lang": "python", "repo": "418sec/py-crypto-exchange-api-client", "path": "/crypto_exchange/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> o = PyObjCTestExceptions.alloc().init() try: o.raiseUnicodeName() except objc.error as e: if sys.version_info[0] == 2: self.assertEqual(str(e), 'SimpleException\u1234\u2049 - hello world'.encode('utf-8')) else: s...
code_fim
hard
{ "lang": "python", "repo": "apple-open-source/macos", "path": "/pyobjc/pyobjc/pyobjc-core-2.5.1/PyObjCTest/test_exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apple-open-source/macos path: /pyobjc/pyobjc/pyobjc-core-2.5.1/PyObjCTest/test_exceptions.py # # Some more tests for exception handling. # XXX: we should centralize all exception handling tests into this file, this # is now mostly used to check general unicode support in exceptions. # from _...
code_fim
hard
{ "lang": "python", "repo": "apple-open-source/macos", "path": "/pyobjc/pyobjc/pyobjc-core-2.5.1/PyObjCTest/test_exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: femmerling/Flask-GAE-py27 path: /utils.py import uuid from datetime import datetime import re _punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+') def generate_id(): return str(uuid.uuid4()) def datetime_to_unix(timestamp): epoch = datetime.utcfromtimestamp(0) return ...
code_fim
medium
{ "lang": "python", "repo": "femmerling/Flask-GAE-py27", "path": "/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def unix_to_datetime(unixtime): return datetime.utcfromtimestamp(long(unixtime)) def generate_slug(text, delim=u'-'): extra=datetime_to_unix(datetime.now()) result = [] for word in _punct_re.split(text.lower()): result.extend(word.split()) result = delim.join(result) retur...
code_fim
medium
{ "lang": "python", "repo": "femmerling/Flask-GAE-py27", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaelgale/toolbox-py path: /toolbox/geometry/point.py #! /usr/bin/env python3 # # Copyright (C) 2020 Michael Gale # This file is part of the legocad python module. # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # f...
code_fim
hard
{ "lang": "python", "repo": "michaelgale/toolbox-py", "path": "/toolbox/geometry/point.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def floatize(self): """Convert co-ordinate values to floats.""" self.x = float(self.x) self.y = float(self.y) def move_to(self, x, y): """Reset x & y coordinates.""" self.x = x self.y = y def translate(self, x, y=None): """Move to new (...
code_fim
hard
{ "lang": "python", "repo": "michaelgale/toolbox-py", "path": "/toolbox/geometry/point.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunpy/sunpy path: /examples/plotting/wcsaxes_map_example.py """ =========================== Imshow and maps coordinates =========================== How to use imshow with a map and overplot points specified by pixel coordinates and map coordinates. """ import matplotlib.pyplot as plt import ast...
code_fim
hard
{ "lang": "python", "repo": "sunpy/sunpy", "path": "/examples/plotting/wcsaxes_map_example.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>################################################################################ # Using the transform command expects coordinates in degrees and not arcseconds. map_coord = ([-300, 200] * u.arcsec) ax.plot(map_coord[0].to('deg'), map_coord[1].to('deg'), 'o', color='white', transform=ax.get_tran...
code_fim
hard
{ "lang": "python", "repo": "sunpy/sunpy", "path": "/examples/plotting/wcsaxes_map_example.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ax.coords.grid(color='yellow', linestyle='solid', alpha=0.5) ################################################################################ # plot a point in the middle of the image # sphinx_gallery_defer_figures pixel_coord = [smap.data.shape[0]/2., smap.data.shape[1]/2.] * u.pix ax.plot(pixel_coord...
code_fim
hard
{ "lang": "python", "repo": "sunpy/sunpy", "path": "/examples/plotting/wcsaxes_map_example.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Sets the complementary color as material's color complementaryMat.SetParameter(c4d.MATERIAL_COLOR_COLOR, complementaryColor, c4d.DESCFLAGS_SET_0) #Inserts the material with complementary color into the active document doc.InsertMaterial(complementaryMat) c4d.EventAdd() if __nam...
code_fim
hard
{ "lang": "python", "repo": "tdapper/cinema4d_py_sdk", "path": "/scripts/release18/colorchooser/colorchooser_complementary.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdapper/cinema4d_py_sdk path: /scripts/release18/colorchooser/colorchooser_complementary.py # This example reads the color value from the active material. # The complementary color is calculated and applied to a new material. import c4d from c4d.modules import colorchooser as cc def main(): ...
code_fim
medium
{ "lang": "python", "repo": "tdapper/cinema4d_py_sdk", "path": "/scripts/release18/colorchooser/colorchooser_complementary.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if "thumbnail" in request.GET and self.attachment.mimetype[0:6] != "image/": # thumbnail of non-image requested, return svg "icon" response = HttpResponse(content_type="image/svg+xml") response.write(svgthumbnail(self.attachment.mimetype)) else: ...
code_fim
hard
{ "lang": "python", "repo": "tykling/socialrating", "path": "/src/attachment/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> model = Attachment pk_url_kwarg = "attachment_uuid" permission_required = "attachment.view_attachment" def get(self, request, *args, **kwargs): if "thumbnail" in request.GET and self.attachment.mimetype[0:6] != "image/": # thumbnail of non-image requested, return svg "...
code_fim
hard
{ "lang": "python", "repo": "tykling/socialrating", "path": "/src/attachment/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tykling/socialrating path: /src/attachment/views.py import magic from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.shortcuts import redirect from django.http impor...
code_fim
hard
{ "lang": "python", "repo": "tykling/socialrating", "path": "/src/attachment/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> mating_pool = [] for i in range(mating_pool_size): mating_pool.append(np.random.choice(population, p=fitness)) return mating_pool def reproduce(mating_pool,population_size,mutation_rate): new_population = [] while len(new_population) < population_size: parent_A = random.choice(mating_...
code_fim
hard
{ "lang": "python", "repo": "jensengroup/GB_GA", "path": "/GB_GA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return new_population def sanitize(population,scores,population_size, prune_population): if prune_population: smiles_list = [] population_tuples = [] for score, mol in zip(scores,population): smiles = Chem.MolToSmiles(mol) smiles = Chem.MolToSmiles(Chem.MolFrom...
code_fim
hard
{ "lang": "python", "repo": "jensengroup/GB_GA", "path": "/GB_GA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jensengroup/GB_GA path: /GB_GA.py ''' Written by Jan H. Jensen 2018. Many subsequent changes inspired by https://github.com/BenevolentAI/guacamol_baselines/tree/master/graph_ga ''' from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Descriptors from rdkit.Chem import rd...
code_fim
hard
{ "lang": "python", "repo": "jensengroup/GB_GA", "path": "/GB_GA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: getcircle/services path: /file/actions.py from tempfile import NamedTemporaryFile import uuid import boto3 from boto.s3.connection import S3ResponseError from boto.s3.multipart import MultiPartUpload from django.conf import settings from service import ( actions, validators, ) import ser...
code_fim
hard
{ "lang": "python", "repo": "getcircle/services", "path": "/file/actions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> type_validators = { 'ids': [validators.is_uuid4_list], } required_fields = ('ids',) def run(self, *args, **kwargs): files = models.File.objects.filter( organization_id=self.parsed_token.organization_id, pk__in=self.request.ids, ) if ...
code_fim
hard
{ "lang": "python", "repo": "getcircle/services", "path": "/file/actions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmazeika/outlier-exposure path: /MNIST/test_calibration.py import numpy as np import sys import os import pickle import argparse import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as trn import torchvision.datasets as dset import torch.nn.functio...
code_fim
hard
{ "lang": "python", "repo": "mmazeika/outlier-exposure", "path": "/MNIST/test_calibration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dummy_targets = torch.ones(ood_num_examples*args.num_to_avg) ood_data = torch.from_numpy( np.random.uniform(size=(ood_num_examples*args.num_to_avg, 1, 28, 28), low=0.0, high=1.0).astype(np.float32)) ood_data = torch.utils.data.TensorDataset(ood_data, dummy_targets) ood_loader = t...
code_fim
hard
{ "lang": "python", "repo": "mmazeika/outlier-exposure", "path": "/MNIST/test_calibration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RMLio/rule-driven-resolution path: /resglass-random/run.py #!/usr/bin/env python3 from rbo import rbo import csv import sys def getVector(filename, topK): with open(filename) as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') myMap = {} for row in...
code_fim
medium
{ "lang": "python", "repo": "RMLio/rule-driven-resolution", "path": "/resglass-random/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> v1 = getVector(sys.argv[1], topK) v2 = getVector(sys.argv[2], topK) result = rbo(v1, v2, p=0.8) print(str(result["ext"])) # print("res " + str(result["res"])) # print("min " + str(result["min"]))<|fim_prefix|># repo: RMLio/rule-driven-resolution path: /resglass-random/run.py #!/usr...
code_fim
hard
{ "lang": "python", "repo": "RMLio/rule-driven-resolution", "path": "/resglass-random/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": topK = None if len(sys.argv) == 4: topK = int(sys.argv[3]) v1 = getVector(sys.argv[1], topK) v2 = getVector(sys.argv[2], topK) result = rbo(v1, v2, p=0.8) print(str(result["ext"])) # print("res " + str(result["res"])) # print("min " + str...
code_fim
medium
{ "lang": "python", "repo": "RMLio/rule-driven-resolution", "path": "/resglass-random/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>und a line at the exact indent level *and* we have sublevel # items. This means the sublevel items have come to an end sublevel.append(line.strip()) out.append("".join(sublevel)) sublevel = [] else: # found a line ...
code_fim
hard
{ "lang": "python", "repo": "trichter/inter_source_interferometry", "path": "/util/misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trichter/inter_source_interferometry path: /util/misc.py # https://stackoverflow.com/a/35513958 def collapse_json(text, indent=4): """Compacts a string of json data by collapsing whitespace after the specified indent level NOTE: will not produce correct results when indent level is n...
code_fim
hard
{ "lang": "python", "repo": "trichter/inter_source_interferometry", "path": "/util/misc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: levkovalenko/finance-ml path: /ml_model/vector_model_mnist.py from keras.datasets import mnist from keras.models import Model from keras.layers import Input, Dense from PreProcessors.csv_pre_processor_vector import PreProcessor import matplotlib.pyplot as plt <|fim_suffix|>X_test, Y_test = PP.ge...
code_fim
hard
{ "lang": "python", "repo": "levkovalenko/finance-ml", "path": "/ml_model/vector_model_mnist.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>X_test, Y_test = PP.get_test() inp = Input(shape=(20,)) hidden_1 = Dense(hidden_size, activation='relu')(inp) hidden_2 = Dense(hidden_size, activation='relu')(hidden_1) out = Dense(3, activation='softmax')(hidden_2) model = Model(input=inp, output=out) if __name__ == "__main__": model.compile(loss=...
code_fim
medium
{ "lang": "python", "repo": "levkovalenko/finance-ml", "path": "/ml_model/vector_model_mnist.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CiaburroGiuseppe/Hands-On-Simulation-Modeling-with-Python path: /Chapter07/SciPyOptimize.py import numpy as np from scipy.optimize import minimize import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter from mpl_toolkits.mplot...
code_fim
medium
{ "lang": "python", "repo": "CiaburroGiuseppe/Hands-On-Simulation-Modeling-with-Python", "path": "/Chapter07/SciPyOptimize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#def booth(x): # return (x[0]+2*x[1]-7)**2+(2*x[0]+x[1]-5)**2 x = np.linspace(-10,10,100) y = np.linspace(-10,10,100) x, y = np.meshgrid(x, y) z = matyas([x,y]) fig = plt.figure() ax = fig.gca(projection='3d') surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap...
code_fim
medium
{ "lang": "python", "repo": "CiaburroGiuseppe/Hands-On-Simulation-Modeling-with-Python", "path": "/Chapter07/SciPyOptimize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x0 = np.array([-10, 10]) PowellOptimizeResults = minimize(matyas, x0, method='Powell', options={'xtol': 1e-8, 'disp': True}) print(PowellOptimizeResults.x)<|fim_prefix|># repo: CiaburroGiuseppe/Hands-On-Simulation-Modeling-with-Python path: /Chapter07/SciPyOptimize.py import numpy as ...
code_fim
hard
{ "lang": "python", "repo": "CiaburroGiuseppe/Hands-On-Simulation-Modeling-with-Python", "path": "/Chapter07/SciPyOptimize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Entry point """ # Command line interface parser = build_parser() options = parser.parse_args() Tester(options).run() if __name__ == '__main__': main()<|fim_prefix|># repo: rmaguire31/sisr path: /sisr/bin/test.py #!/usr/bin/env python3 """SiSR PyTorch Network training entr...
code_fim
hard
{ "lang": "python", "repo": "rmaguire31/sisr", "path": "/sisr/bin/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rmaguire31/sisr path: /sisr/bin/test.py #!/usr/bin/env python3 """SiSR PyTorch Network training entry-point """ <|fim_suffix|>logger = logging.getLogger(__name__) def build_parser(): """Build CLI parser with options for train.py """ # Inherit package arguments parents = sisr.bi...
code_fim
medium
{ "lang": "python", "repo": "rmaguire31/sisr", "path": "/sisr/bin/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): """Entry point """ # Command line interface parser = build_parser() options = parser.parse_args() Tester(options).run() if __name__ == '__main__': main()<|fim_prefix|># repo: rmaguire31/sisr path: /sisr/bin/test.py #!/usr/bin/env python3 """SiSR PyTorch Network ...
code_fim
medium
{ "lang": "python", "repo": "rmaguire31/sisr", "path": "/sisr/bin/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: applegreengrape/tf-provider-demo path: /aws/api/lambda/tag.py import json import os import boto3 from boto3.dynamodb.conditions import Key import re def get_tag(team): dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('tag') response = table.query( TableName='tag',...
code_fim
hard
{ "lang": "python", "repo": "applegreengrape/tf-provider-demo", "path": "/aws/api/lambda/tag.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if event["headers"]["Authorization"]: tok = re.findall('Bearer\s(.*)',event["headers"]["Authorization"]) if tok[0] == os.getenv('apiTok') : body["msg"] = "👍Yep! it is the right api key" if event["queryStringParameters"]: if 'team' in event["quer...
code_fim
medium
{ "lang": "python", "repo": "applegreengrape/tf-provider-demo", "path": "/aws/api/lambda/tag.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> return { "statusCode": status_code, "body": json.dumps(body, ensure_ascii=False), "headers": { "Content-Type": "application/json" } }<|fim_prefix|># repo: applegreengrape/tf-provider-demo path: /aws/api/lambda/tag.py import json ...
code_fim
hard
{ "lang": "python", "repo": "applegreengrape/tf-provider-demo", "path": "/aws/api/lambda/tag.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_file_name(self): return self.name @classmethod def get_object(cls, file_name): if cls.get_storage().exists(file_name): obj = cls() obj.name = file_name obj.file = file_name obj.thumbnail = cls.get_thumbnail(file_name) ...
code_fim
hard
{ "lang": "python", "repo": "Microdisseny/django-field-filemanager", "path": "/dj_field_filemanager/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Microdisseny/django-field-filemanager path: /dj_field_filemanager/models.py import io import logging import os import uuid from importlib import import_module from urllib.parse import urljoin from django.conf import settings as django_settings from django.core.files.base import ContentFile from ...
code_fim
hard
{ "lang": "python", "repo": "Microdisseny/django-field-filemanager", "path": "/dj_field_filemanager/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Generates a document thumbnail """ modified = False if self.thumbnail: self.thumbnail.delete(save=False) modified = True result = self._thumbnail_save() if result: bytes, extension = result filenam...
code_fim
hard
{ "lang": "python", "repo": "Microdisseny/django-field-filemanager", "path": "/dj_field_filemanager/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Another way to represent how much EM energy there is a specific distance away from a transmitter. Calls `field_strength_at_distance()` internally. Args: power: A `float` with the EIRP of the transmitter. See `mode` for more info on the units. distance: A `fl...
code_fim
hard
{ "lang": "python", "repo": "elvd/rf_sewer_pipes", "path": "/itur_p525.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elvd/rf_sewer_pipes path: /itur_p525.py """Implementation of some of the ITU-R P.525 formulas ITU-R Recommendation P.525 (08/2019) Calculation of Free-Space Attenuation is a short Recommendation which specifies how to calculate free-space path loss. In addition it contains several formulas for c...
code_fim
hard
{ "lang": "python", "repo": "elvd/rf_sewer_pipes", "path": "/itur_p525.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shiehinms/vminspector path: /ui/textedit.py #!/usr/bin/env python # Copyright (c) 2007-8 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foun...
code_fim
hard
{ "lang": "python", "repo": "shiehinms/vminspector", "path": "/ui/textedit.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> exception = None fh = None try: fh = QFile(self.filename) if not fh.open(QIODevice.ReadOnly): raise IOError, unicode(fh.errorString()) stream = QTextStream(fh) stream.setCodec("UTF-8") self.setPlainText(str...
code_fim
hard
{ "lang": "python", "repo": "shiehinms/vminspector", "path": "/ui/textedit.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: irzu/osmtilecalc path: /src/osmtilecalc/calculators.py import math import random def _lon_to_x(lon, zoom_level): """ Converts longitude to x-axis points. """ return math.floor((lon + 180) / 360 * math.pow(2, zoom_level)) def _lat_to_y(lat, zoom_level): """ Converts lat...
code_fim
hard
{ "lang": "python", "repo": "irzu/osmtilecalc", "path": "/src/osmtilecalc/calculators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Generates url with given x,y,z params. """ subdomain = random.choice(["a", "b", "c"]) resource_url = "https://{0}.tile.openstreetmap.org/{1}/{2}/{3}.png" return resource_url.format(subdomain, tile_z, tile_x, tile_y) def get_tile_coords(bounding_box, zoom_level): """ I...
code_fim
hard
{ "lang": "python", "repo": "irzu/osmtilecalc", "path": "/src/osmtilecalc/calculators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wilfongjt/soke path: /soke-scripts/process/process.py class Process(): def __init__(self, settings=None): self.dataframe=None self.settings=settings self.list=[] self.dictionary={} def getClassName(self): return self.__class__.__name__ <|fim_suf...
code_fim
medium
{ "lang": "python", "repo": "Wilfongjt/soke", "path": "/soke-scripts/process/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.settings == None: raise Exception('Initialize settings in {}'.format(self.getClassName())) return self.settings def process(self): raise Exception('Overload process() in {}'.format(self.getClassName())) def run(self): self.process() ...
code_fim
hard
{ "lang": "python", "repo": "Wilfongjt/soke", "path": "/soke-scripts/process/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise Exception('Overload process() in {}'.format(self.getClassName())) def run(self): self.process() return self<|fim_prefix|># repo: Wilfongjt/soke path: /soke-scripts/process/process.py class Process(): def __init__(self, settings=None): self.dataframe...
code_fim
hard
{ "lang": "python", "repo": "Wilfongjt/soke", "path": "/soke-scripts/process/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> blab = bnds.astype('str') blab[ii] = r'$t_{}$'.format(ii+1) label = [blab[0], 's, ', blab[1], 's, ', blab[2], 's, ', blab[3], 's'] labelL += ["".join(label)] zips = zip(range(4), tLL, cL, bnds, labelL) plt.figure(num=sy...
code_fim
hard
{ "lang": "python", "repo": "aldsim/aldopt", "path": "/uptake_curve_trad.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aldsim/aldopt path: /uptake_curve_trad.py import warnings import time import matplotlib.pyplot as plt import numpy as np import seaborn as sns from ALDmodel import ALDGrowth from core import plot_2d, plot_uq from functools import partial from scipy.stats import halfcauchy, triang from sopt import...
code_fim
hard
{ "lang": "python", "repo": "aldsim/aldopt", "path": "/uptake_curve_trad.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> t0 = time.perf_counter() result = func(*args) elapsed = time.time() - t0 name = func.__name__ args = ', '.join(repr(arg) for arg in args) result = repr(result) print(fmt.format(**locals())) return result ...
code_fim
medium
{ "lang": "python", "repo": "xu6148152/Binea_Python_Project", "path": "/FluentPython/function_decorator_closures/clockdeco.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def decorate(func): @functools.wraps(func) def clocked(*args): t0 = time.perf_counter() result = func(*args) elapsed = time.time() - t0 name = func.__name__ args = ', '.join(repr(arg) for arg in args) result = repr...
code_fim
medium
{ "lang": "python", "repo": "xu6148152/Binea_Python_Project", "path": "/FluentPython/function_decorator_closures/clockdeco.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xu6148152/Binea_Python_Project path: /FluentPython/function_decorator_closures/clockdeco.py #!/usr/bin/env python3 # -*- encoding: utf-8 -*- import time import functools DEFAULT_FMT = '[{elapsed:0.8f}s] {name}({args}) -> {result}' <|fim_suffix|> t0 = time.perf_counter() ...
code_fim
medium
{ "lang": "python", "repo": "xu6148152/Binea_Python_Project", "path": "/FluentPython/function_decorator_closures/clockdeco.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bachya/regenmaschine path: /regenmaschine/endpoints/__init__.py """Define API endpoint objects.""" from __future__ import annotations from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, Generic, TypeVar from typing_extensions import ParamSpec from regenmaschine.er...
code_fim
hard
{ "lang": "python", "repo": "bachya/regenmaschine", "path": "/regenmaschine/endpoints/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_P = ParamSpec("_P") _T = TypeVar("_T", dict, list, str) class EndpointManager(Generic[_P, _T]): # pylint: disable=too-few-public-methods """Define an object to manage a API endpoints of a certain category.""" def __init__(self, controller: Controller) -> None: """Initialize. ...
code_fim
medium
{ "lang": "python", "repo": "bachya/regenmaschine", "path": "/regenmaschine/endpoints/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atishay-ipsy/pyspark-stubs path: /third_party/3/pyspark/sql/_typing.pyi from typing import Any, List, Optional, TypeVar, Union from typing_extensions import Protocol import datetime import decimal import pyspark.sql.column import pyspark.sql.types <|fim_suffix|>class SupportsProcess(Protocol): ...
code_fim
hard
{ "lang": "python", "repo": "atishay-ipsy/pyspark-stubs", "path": "/third_party/3/pyspark/sql/_typing.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class SupportsClose(Protocol): def close(self, error: Exception) -> None: ...<|fim_prefix|># repo: atishay-ipsy/pyspark-stubs path: /third_party/3/pyspark/sql/_typing.pyi from typing import Any, List, Optional, TypeVar, Union from typing_extensions import Protocol import datetime import decim...
code_fim
medium
{ "lang": "python", "repo": "atishay-ipsy/pyspark-stubs", "path": "/third_party/3/pyspark/sql/_typing.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>points = 6 random_zhen = random.choice(zhen) print('Компьютер случайным образом загадывает название одной из шести официальных жен Ивана IV Грозного, а игрок должен его угадать.') print('Начальное колличество баллов: ', points) print('Жены Ивана IV Грозного:', end=' ') for x in zhen: print(x, end=" ") ...
code_fim
medium
{ "lang": "python", "repo": "kseniamogucheva/pythonintask", "path": "/ISTp/2013/MOGUCHEVA_K_S/task_7_16.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kseniamogucheva/pythonintask path: /ISTp/2013/MOGUCHEVA_K_S/task_7_16.py #Задача 7. Вариант 16. #Создайте игру, в которой компьютер загадывает имя одной из шести официальных жен Ивана IV Грозного, а игрок должен его угадать. #Разработайте систему начисления очков для задачи 6, в соответствии с к...
code_fim
medium
{ "lang": "python", "repo": "kseniamogucheva/pythonintask", "path": "/ISTp/2013/MOGUCHEVA_K_S/task_7_16.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>random_zhen = random.choice(zhen) print('Компьютер случайным образом загадывает название одной из шести официальных жен Ивана IV Грозного, а игрок должен его угадать.') print('Начальное колличество баллов: ', points) print('Жены Ивана IV Грозного:', end=' ') for x in zhen: print(x, end=" ") print() vibr_...
code_fim
medium
{ "lang": "python", "repo": "kseniamogucheva/pythonintask", "path": "/ISTp/2013/MOGUCHEVA_K_S/task_7_16.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ethereum/web3.py path: /tests/core/contracts/test_contract_example.py # This file is used by the documentation as an example # of how to write unit tests with web3.py import pytest import pytest_asyncio from web3 import ( EthereumTesterProvider, Web3, ) from web3.eth import ( AsyncE...
code_fim
hard
{ "lang": "python", "repo": "ethereum/web3.py", "path": "/tests/core/contracts/test_contract_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # send transaction that updates the greeting tx_hash = foo_contract.functions.setBar("testing contracts is easy").transact( { "from": w3.eth.accounts[1], } ) receipt = w3.eth.wait_for_transaction_receipt(tx_hash, 180) # get all of the `barred` logs for the ...
code_fim
hard
{ "lang": "python", "repo": "ethereum/web3.py", "path": "/tests/core/contracts/test_contract_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>model = TechnicalAnalysis(df) model.addATR(14) df = model.getDataFrame() print (df)<|fim_prefix|># repo: T-i-m-m/pycryptobot path: /script-technical-analysis.py from models.PyCryptoBot import PyCryptoBot from models.Trading import TechnicalAnalysis <|fim_middle|>app = PyCryptoBot() df = app.getHistorica...
code_fim
medium
{ "lang": "python", "repo": "T-i-m-m/pycryptobot", "path": "/script-technical-analysis.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: T-i-m-m/pycryptobot path: /script-technical-analysis.py from models.PyCryptoBot import PyCryptoBot from models.Trading import TechnicalAnalysis <|fim_suffix|>model = TechnicalAnalysis(df) model.addATR(14) df = model.getDataFrame() print (df)<|fim_middle|>app = PyCryptoBot() df = app.getHistorica...
code_fim
medium
{ "lang": "python", "repo": "T-i-m-m/pycryptobot", "path": "/script-technical-analysis.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CruelSoftware/django-market path: /src/market/models.py # -*- coding: utf-8 -*- import string import random from django.conf import settings from django.db import models from django.template.defaultfilters import slugify from unidecode import unidecode # Create your models here. def image_upl...
code_fim
hard
{ "lang": "python", "repo": "CruelSoftware/django-market", "path": "/src/market/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> object = models.ForeignKey(Object, related_name='images') image = models.ImageField(upload_to=image_upload_to, null=True, blank=True, width_field="width", height_field="height") ...
code_fim
hard
{ "lang": "python", "repo": "CruelSoftware/django-market", "path": "/src/market/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: ordering = ['id'] def __str__(self): return '{}/{}'.format(self.object.title, self.value) class Image(models.Model): object = models.ForeignKey(Object, related_name='images') image = models.ImageField(upload_to=image_upload_to, n...
code_fim
hard
{ "lang": "python", "repo": "CruelSoftware/django-market", "path": "/src/market/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stefantaubert/text-selection path: /src/text_selection_core_tests/sorting/random_py/test_sort_random.py from collections import OrderedDict from logging import getLogger from ordered_set import OrderedSet from text_selection_core.common import SortingDefaultParameters from text_selection_core....
code_fim
hard
{ "lang": "python", "repo": "stefantaubert/text-selection", "path": "/src/text_selection_core_tests/sorting/random_py/test_sort_random.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_3_1_a_b__returns_1_2_0__3_4_5(): ds = Dataset(3, "a") ds.subsets["b"] = OrderedSet((3, 4, 5)) sel_param = SortingDefaultParameters(ds, OrderedSet(("a",))) changed_anything = sort_random(sel_param, seed=1, logger=getLogger()) assert isinstance(changed_anything, bool) assert changed_...
code_fim
hard
{ "lang": "python", "repo": "stefantaubert/text-selection", "path": "/src/text_selection_core_tests/sorting/random_py/test_sort_random.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(''' <div class="container"> <h1 class="text-center">Products</h1> <hr> <div class="row"> ''') for product in products: search = search.lower() completeName = f"{product['brand']} {product['p_name']}" searchWords = search.split() completeNameWords = completeName.lower()...
code_fim
medium
{ "lang": "python", "repo": "brainmentorspvtltd/MSIT_AdvancePython", "path": "/OnlineShop/cgi-bin/search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>base.header() print(''' <div class="container"> <h1 class="text-center">Products</h1> <hr> <div class="row"> ''') for product in products: search = search.lower() completeName = f"{product['brand']} {product['p_name']}" searchWords = search.split() completeNameWords = compl...
code_fim
medium
{ "lang": "python", "repo": "brainmentorspvtltd/MSIT_AdvancePython", "path": "/OnlineShop/cgi-bin/search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }