text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>fn_y0s = os.path.join('.', 'rc3_body_y0s.p') print('Testing Restricted Circular 3 Body Model') alphas = [.7, .75, .8, .85, .9, .98] #alphas = [.7, .8] Ns = [1, 3, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 300] #Ns = [3] T0s = [50, 100, 150, 200, 300, 500] #T0s = [30] params = list(itertools.pr...
code_fim
medium
{ "lang": "python", "repo": "lkwilson/Honors-Thesis", "path": "/doc/paper/scripts/AnalyzeR3BodyProb.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @add_classmethod(Class, override=True) def fun(cls): return False assert(hasattr(Class, 'fun')) assert(not Class.fun())<|fim_prefix|># repo: yhtang/GraphDot path: /test/util/test_util.py #!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from graphdot.util import add_cla...
code_fim
hard
{ "lang": "python", "repo": "yhtang/GraphDot", "path": "/test/util/test_util.py", "mode": "spm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_suffix|> return False @add_classmethod(Class, override=True) def fun(cls): return False assert(hasattr(Class, 'fun')) assert(not Class.fun())<|fim_prefix|># repo: yhtang/GraphDot path: /test/util/test_util.py #!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from gr...
code_fim
hard
{ "lang": "python", "repo": "yhtang/GraphDot", "path": "/test/util/test_util.py", "mode": "spm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_prefix|># repo: yhtang/GraphDot path: /test/util/test_util.py #!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from graphdot.util import add_classmethod def test_add_classmethod(): <|fim_suffix|> return False assert(hasattr(Class, 'fun')) assert(not Class.fun())<|fim_middle|> clas...
code_fim
hard
{ "lang": "python", "repo": "yhtang/GraphDot", "path": "/test/util/test_util.py", "mode": "psm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_prefix|># repo: jphacks/NG_1802 path: /src/kernel/RecipeSelecter.py import find_cook import random def selectRecipe(cook_name): fc = find_cook.find_cook(cook_name) fc_material = fc.get_material() fc_recipe = fc.get_recipe() <|fim_suffix|>#selectRecipe("おむらいす") #selectRecipe("ぱすた") #selectRecipe("は...
code_fim
hard
{ "lang": "python", "repo": "jphacks/NG_1802", "path": "/src/kernel/RecipeSelecter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#selectRecipe("おむらいす") #selectRecipe("ぱすた") #selectRecipe("はんばーぐ") #selectRecipe("おこのみやき")<|fim_prefix|># repo: jphacks/NG_1802 path: /src/kernel/RecipeSelecter.py import find_cook import random def selectRecipe(cook_name): fc = find_cook.find_cook(cook_name) fc_material = fc.get_material() ...
code_fim
hard
{ "lang": "python", "repo": "jphacks/NG_1802", "path": "/src/kernel/RecipeSelecter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cheukting/emoprint path: /emoprint/nlp_emoprint.py import builtins from .pick_emoji import pick_emoji import sys <|fim_suffix|> pricked = pick_emoji(str(*objects)) builtins.print(*objects, pricked)<|fim_middle|>def print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False):
code_fim
medium
{ "lang": "python", "repo": "Cheukting/emoprint", "path": "/emoprint/nlp_emoprint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pricked = pick_emoji(str(*objects)) builtins.print(*objects, pricked)<|fim_prefix|># repo: Cheukting/emoprint path: /emoprint/nlp_emoprint.py import builtins from .pick_emoji import pick_emoji import sys <|fim_middle|> def print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False):
code_fim
medium
{ "lang": "python", "repo": "Cheukting/emoprint", "path": "/emoprint/nlp_emoprint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('grapher_admin', '0043_auto_20180310_1846'), ] operations = [ migrations.AlterField( model_name='variable', name='datasetId', field=models.ForeignKey(db_column='datasetId', on_delete=django.db.models.deletion.CASCADE, to='g...
code_fim
medium
{ "lang": "python", "repo": "owid/owid-importer", "path": "/grapher_admin/migrations/0044_auto_20180310_1851.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: owid/owid-importer path: /grapher_admin/migrations/0044_auto_20180310_1851.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-03-10 18:51 from __future__ import unicode_literals <|fim_suffix|> dependencies = [ ('grapher_admin', '0043_auto_20180310_1846'), ] operat...
code_fim
medium
{ "lang": "python", "repo": "owid/owid-importer", "path": "/grapher_admin/migrations/0044_auto_20180310_1851.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ComputerNetworks-UFRGS/OpERA path: /python/utils/__init__.py from channel import Channel from channel import ChannelModeler from channel import ChannelThread from logger import Logger <|fim_suffix|>from rpcProxy import RPCExporter from rpcProxy import RPCImporter from verify import Verify<...
code_fim
medium
{ "lang": "python", "repo": "ComputerNetworks-UFRGS/OpERA", "path": "/python/utils/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from rpcProxy import RPCExporter from rpcProxy import RPCImporter from verify import Verify<|fim_prefix|># repo: ComputerNetworks-UFRGS/OpERA path: /python/utils/__init__.py from channel import Channel from channel import ChannelModeler from channel import ChannelThread from logger import Logger <...
code_fim
medium
{ "lang": "python", "repo": "ComputerNetworks-UFRGS/OpERA", "path": "/python/utils/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: quantamc/EmokitVisualizer path: /UI/HeadStatusWidget.py # !/usr/bin/python # -*- coding: utf-8 -*- from PySide.QtGui import * from PySide.QtCore import Qt class HeadStatusWidget(QWidget): def __init__(self, callback, parent=None): super(HeadStatusWidget, self).__init__(parent) ...
code_fim
hard
{ "lang": "python", "repo": "quantamc/EmokitVisualizer", "path": "/UI/HeadStatusWidget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def updateHeadsetStatus(self, packet): painter = QPainter() if painter.begin(self.pixmap): painter.setFont(QFont('Decorative', 12)) for key in self.electrodesPosition: if key[0] == "O": painter.drawText(self.electrodesPosition...
code_fim
hard
{ "lang": "python", "repo": "quantamc/EmokitVisualizer", "path": "/UI/HeadStatusWidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ibo.models.grover import Grover from qibo.models import hep<|fim_prefix|># repo: ZDQpeter/qibo path: /src/qibo/models/__init__.py from qibo.models.circuit import Circuit, QFT from qibo.models.evolution import StateEvolution, AdiabaticEvolution fr<|fim_middle|>om qibo.models.variational import VQE, QAOA, ...
code_fim
easy
{ "lang": "python", "repo": "ZDQpeter/qibo", "path": "/src/qibo/models/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZDQpeter/qibo path: /src/qibo/models/__init__.py from qibo.models.circuit import Circuit, QFT from qibo.mod<|fim_suffix|>ibo.models.grover import Grover from qibo.models import hep<|fim_middle|>els.evolution import StateEvolution, AdiabaticEvolution from qibo.models.variational import VQE, QAOA, ...
code_fim
medium
{ "lang": "python", "repo": "ZDQpeter/qibo", "path": "/src/qibo/models/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmg217/python_projects path: /goodreads-0.2.4/books.py #!/usr/bin/env python ok = gc.book(1) <|fim_suffix|>#zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU<|fim_middle|>from goodreads import client gc = client.GoodreadsClient('HoaoSehpdXTpNVZs6v6hg', 'zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU') book ...
code_fim
medium
{ "lang": "python", "repo": "jmg217/python_projects", "path": "/goodreads-0.2.4/books.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU<|fim_prefix|># repo: jmg217/python_projects path: /goodreads-0.2.4/books.py #!/usr/bin/env python ok = gc.book(1) from goodreads import client <|fim_middle|>gc = client.GoodreadsClient('HoaoSehpdXTpNVZs6v6hg', 'zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU') book ...
code_fim
medium
{ "lang": "python", "repo": "jmg217/python_projects", "path": "/goodreads-0.2.4/books.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmg217/python_projects path: /goodreads-0.2.4/books.py #!/usr/bin/env python ok = gc.book(1) from goodreads import client <|fim_suffix|>#zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU<|fim_middle|>gc = client.GoodreadsClient('HoaoSehpdXTpNVZs6v6hg', 'zLjmPasPHRHG4c5yxielBhwJUtGigbXPrwiAqzmJU') book ...
code_fim
medium
{ "lang": "python", "repo": "jmg217/python_projects", "path": "/goodreads-0.2.4/books.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shenganzhang/cloudnetpy path: /cloudnetpy/instruments/ceilometer.py from typing import Tuple, Optional import numpy as np import numpy.ma as ma import scipy.ndimage from cloudnetpy import utils class Ceilometer: """Base class for all types of ceilometers.""" def __init__(self, full_pat...
code_fim
hard
{ "lang": "python", "repo": "shenganzhang/cloudnetpy", "path": "/cloudnetpy/instruments/ceilometer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return array * self.range_squared def _calc_sigma_units(time_vector: list, range_los: np.ndarray) -> Tuple[float, float]: """Calculates Gaussian peak std parameters. The amount of smoothing is hard coded. This function calculates how many steps in time and height corresponds to this...
code_fim
hard
{ "lang": "python", "repo": "shenganzhang/cloudnetpy", "path": "/cloudnetpy/instruments/ceilometer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> query = "SELECT " i = 0 length = len(columns) while length - 1 > i: query += columns[i] + ", " i += 1 query += columns[i] + " FROM " + table if where_columns is None: query += ";" else: length = len(whe...
code_fim
hard
{ "lang": "python", "repo": "grupo-2-diseno-web/flask-cachimbogo", "path": "/Querys/query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: with self.get_cursor() as cursor: if where_values is None: cursor.execute(join_query) else: cursor.execute(join_query, where_values) data = cursor.fetchall() return data ...
code_fim
hard
{ "lang": "python", "repo": "grupo-2-diseno-web/flask-cachimbogo", "path": "/Querys/query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: grupo-2-diseno-web/flask-cachimbogo path: /Querys/query.py from DB.connection import Connection from pymysql import Error class Query(object): def get_cursor(self): return Connection.mysql.get_db().cursor() def get_connection(self): return Connection.mysql.get_db() ...
code_fim
hard
{ "lang": "python", "repo": "grupo-2-diseno-web/flask-cachimbogo", "path": "/Querys/query.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: metric-python/metric path: /metric/database/error.py from sqlalchemy.exc import SQLAlchemyError class BaseError(Exception): pass class AddQueryInvalid(Exception): def __init__(self, exception, message="Parameter Add condition is invalid"): self.message = message self.e...
code_fim
hard
{ "lang": "python", "repo": "metric-python/metric", "path": "/metric/database/error.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DataValueInvalid(BaseError): def __init__(self, exception, message="Invalid value data given"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {self.exception}' class NoneTypeVal...
code_fim
medium
{ "lang": "python", "repo": "metric-python/metric", "path": "/metric/database/error.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class DataValueInvalid(BaseError): def __init__(self, exception, message="Invalid value data given"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {self.exception}' class NoneTypeValu...
code_fim
medium
{ "lang": "python", "repo": "metric-python/metric", "path": "/metric/database/error.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NiclasEriksen/py-towerwars path: /src/grid.py from main import pypf import subprocess from functions import get_neighbors from main import logger class Grid: 'The main grid constructor' def __init__(self, game): self.t_grid = [] self.w_grid = [] self.fullgrid =...
code_fim
hard
{ "lang": "python", "repo": "NiclasEriksen/py-towerwars", "path": "/src/grid.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def getPath(self, start, flying=False): if flying: if not self.flying_path: logger.debug("Generating flying path") path, success = pypf.get_path( self.f_grid, self.f_grid, start, self.goal ...
code_fim
hard
{ "lang": "python", "repo": "NiclasEriksen/py-towerwars", "path": "/src/grid.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if new == "update": # x1, y1 = str(self.start[0]), str(self.start[1]) # x2, y2 = str(self.goal[0]), str(self.goal[1]) # subprocess.call(["./genpath", x1, y1, x2, y2]) # points = self.importGrid() # self.path = points newpath =...
code_fim
hard
{ "lang": "python", "repo": "NiclasEriksen/py-towerwars", "path": "/src/grid.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nyxaoc/plydata path: /plydata/utils.py from contextlib import contextmanager from .eval import EvalEnvironment def hasattrs(obj, names): """ Return True of obj has all the names attributes """ return all(hasattr(obj, attr) for attr in names) @contextmanager def temporary_key(...
code_fim
hard
{ "lang": "python", "repo": "Nyxaoc/plydata", "path": "/plydata/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> The dictionary will hold the key for the duration of the context. Parameters ---------- obj : object Object onto which to add a temporary attribute. name : str Name of attribute to add to ``obj``. value : object Value of ``attr``. """ setattr(ob...
code_fim
hard
{ "lang": "python", "repo": "Nyxaoc/plydata", "path": "/plydata/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> >>> df >> define(y='class+1') Traceback (most recent call last): File "<string>", line 1 class+1 ^ SyntaxError: invalid syntax >>> df >> define(y='Q("class")+1') class y 0 10 11 1 20 21 2 30 31 Note that it is ``'Q("some n...
code_fim
hard
{ "lang": "python", "repo": "Nyxaoc/plydata", "path": "/plydata/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: daleal/queue path: /counter.py """ This module includes every model used inside the API to model the counter. """ from app import app, db class Counter(db.Model): <|fim_suffix|> def get(self): """Returns the counter.""" return self.counter def increment(self): "...
code_fim
hard
{ "lang": "python", "repo": "daleal/queue", "path": "/counter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get(self): """Returns the counter.""" return self.counter def increment(self): """Increments the counter.""" self.counter += 1 def reset(self): """Resets the counter.""" self.counter = 1 def __repr__(self): return f"<Counter - ...
code_fim
medium
{ "lang": "python", "repo": "daleal/queue", "path": "/counter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdehezclementi/libpolycrypto path: /scripts/linux/plot-threshsig.py #!/usr/bin/env python2.7 import matplotlib.pyplot as plt import matplotlib.ticker as plticker from cycler import cycler import pandas import sys import time import numpy as np setTitle=False if len(sys.argv) < 5: print "Us...
code_fim
hard
{ "lang": "python", "repo": "mdehezclementi/libpolycrypto", "path": "/scripts/linux/plot-threshsig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># recompute total, just to be safe csv_data.total_usec = csv_data.lagr_usec + csv_data.multiexp_usec csv_data.lagr_usec /= 1000*1000 # microsecs to secs csv_data.multiexp_usec /= 1000*1000 # microsecs to secs csv_data.total_usec /= 1000*1000 # microsecs to secs #SMALL_SIZE = 10 MEDIUM_SIZE = ...
code_fim
hard
{ "lang": "python", "repo": "mdehezclementi/libpolycrypto", "path": "/scripts/linux/plot-threshsig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if is_paper_plot: csv_data.interpolation_method.replace('fft-eval', 'Fast Lagrange', inplace=True) csv_data.interpolation_method.replace('naive-lagr-wnk', 'Naive Lagrange', inplace=True) else: csv_data.interpolation_method.replace('fft-eval', 'Fast threshold BLS aggregation', inplace=True) ...
code_fim
hard
{ "lang": "python", "repo": "mdehezclementi/libpolycrypto", "path": "/scripts/linux/plot-threshsig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> upstream_sha = get_upstream_index_sha(repo) upstream_index_diff = get_diff(repo, upstream_sha) if upstream_sha else None if head_index_diff or upstream_sha or upstream_index_diff: return UncommittedChanges(head_index_diff, upstream_index_diff, upstream_sha) def track_uncommitted_cha...
code_fim
hard
{ "lang": "python", "repo": "neptune-ai/neptune-client", "path": "/src/neptune/internal/utils/git.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: neptune-ai/neptune-client path: /src/neptune/internal/utils/git.py # # Copyright (c) 2022, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "neptune-ai/neptune-client", "path": "/src/neptune/internal/utils/git.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: from git.exc import ( InvalidGitRepositoryError, NoSuchPathError, ) try: return get_git_repo(repo_path=initial_repo_path) except (NoSuchPathError, InvalidGitRepositoryError): return None except ImportError: ...
code_fim
hard
{ "lang": "python", "repo": "neptune-ai/neptune-client", "path": "/src/neptune/internal/utils/git.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> idade = input('Qual a sua idade :') if not idade.isnumeric(): print( 'Você precisa digitar apenas números') else: idade=int(idade) if idade > 120 : print('Fim do programa') break if idade < 120 : usario = 'Você é maior de idad...
code_fim
hard
{ "lang": "python", "repo": "JlucasS777/Aprendendo-Python", "path": "/Aprendendo Python/cursopythonudamy/aula24_operadorternario.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JlucasS777/Aprendendo-Python path: /Aprendendo Python/cursopythonudamy/aula24_operadorternario.py # Operador Ternário '''login_user = False if login_user : # isso é o mesmo que if login_user == True: msg = 'Usuário logado' <|fim_suffix|> idade = input('Qual a sua idade :') if not id...
code_fim
hard
{ "lang": "python", "repo": "JlucasS777/Aprendendo-Python", "path": "/Aprendendo Python/cursopythonudamy/aula24_operadorternario.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: osamadel/Python-Online-Courses path: /MITx6001/Midterm/problem6.py # -*- coding: utf-8 -*- """ Created on Fri Oct 14 09:59:04 2016 @author: Osama """ <|fim_suffix|> for i in L: for j in range(len(i)//2): temp = i[j] i[j] = i[-1-j] i[-1-j] = temp ...
code_fim
hard
{ "lang": "python", "repo": "osamadel/Python-Online-Courses", "path": "/MITx6001/Midterm/problem6.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> L = [[1, 2], [3, 4], [5, 6, 7]] print(L) deep_reverse(L) print(L)<|fim_prefix|># repo: osamadel/Python-Online-Courses path: /MITx6001/Midterm/problem6.py # -*- coding: utf-8 -*- """ Created on Fri Oct 14 09:59:04 2016 @author: Osama """ def deep_reverse(L): """ assumes L is a list of lists whose e...
code_fim
medium
{ "lang": "python", "repo": "osamadel/Python-Online-Courses", "path": "/MITx6001/Midterm/problem6.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>L = [[1, 2], [3, 4], [5, 6, 7]] print(L) deep_reverse(L) print(L)<|fim_prefix|># repo: osamadel/Python-Online-Courses path: /MITx6001/Midterm/problem6.py # -*- coding: utf-8 -*- """ Created on Fri Oct 14 09:59:04 2016 <|fim_middle|>@author: Osama """ def deep_reverse(L): """ assumes L is a list of ...
code_fim
hard
{ "lang": "python", "repo": "osamadel/Python-Online-Courses", "path": "/MITx6001/Midterm/problem6.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser( description="""Generate static IIIF image tiles from source images. Must specify a source directory or a list of files.""" ) parser.add_argument( "-d", "--dest", metavar="DEST_DIR", help="b...
code_fim
hard
{ "lang": "python", "repo": "Princeton-CDH/geniza", "path": "/scripts/tile_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # adapted from call in iiif_static command line script # using defaults option # dest_dir = os.path.join(base_path, "iiif-images") dest_url = base_url.rstrip("/") + "/images/" # CHECK # base destination url required for generating ids in info.json sg = IIIFStatic(dst=dest_dir, pre...
code_fim
hard
{ "lang": "python", "repo": "Princeton-CDH/geniza", "path": "/scripts/tile_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Princeton-CDH/geniza path: /scripts/tile_images.py #! /usr/bin/env python # Stand-alone python script to generate IIIF Image API level 0 # image tiles for static IIIF content. # # Install python dependencies with pip: # # pip install iiif # # Script requires a destination directory where tile ...
code_fim
hard
{ "lang": "python", "repo": "Princeton-CDH/geniza", "path": "/scripts/tile_images.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": test_spectral_units() test_import_1D() test_import_2D() test_import_2D_survey() test_import_3D()<|fim_prefix|># repo: wright-group/WrightTools path: /tests/data/from_LabRAM.py import WrightTools as wt from WrightTools.datasets import LabRAM def test_spect...
code_fim
hard
{ "lang": "python", "repo": "wright-group/WrightTools", "path": "/tests/data/from_LabRAM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wright-group/WrightTools path: /tests/data/from_LabRAM.py import WrightTools as wt from WrightTools.datasets import LabRAM def test_spectral_units(): d = wt.data.from_LabRAM(LabRAM.spectrum_nm) assert d.wm.units == "nm" d.close() d = wt.data.from_LabRAM(LabRAM.spectrum_wn) a...
code_fim
hard
{ "lang": "python", "repo": "wright-group/WrightTools", "path": "/tests/data/from_LabRAM.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_import_3D(): d = wt.data.from_LabRAM(LabRAM.map_nm) d.close() if __name__ == "__main__": test_spectral_units() test_import_1D() test_import_2D() test_import_2D_survey() test_import_3D()<|fim_prefix|># repo: wright-group/WrightTools path: /tests/data/from_LabRAM.py i...
code_fim
medium
{ "lang": "python", "repo": "wright-group/WrightTools", "path": "/tests/data/from_LabRAM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cv2.imwrite('out.png', dst)<|fim_prefix|># repo: QuantumFractal/hackisu-2017-nucleus path: /point-cloud-stuff/cleanup.py import cv2 import numpy as np from PIL import Image img = cv2.imread('images/front.bmp',0) mask = cv2.imread('images/mask_front.bmp', 0) <|fim_middle|>dst = cv2.inpaint(img,...
code_fim
easy
{ "lang": "python", "repo": "QuantumFractal/hackisu-2017-nucleus", "path": "/point-cloud-stuff/cleanup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: QuantumFractal/hackisu-2017-nucleus path: /point-cloud-stuff/cleanup.py import cv2 import numpy as np from PIL import Image <|fim_suffix|>cv2.imwrite('out.png', dst)<|fim_middle|>img = cv2.imread('images/front.bmp',0) mask = cv2.imread('images/mask_front.bmp', 0) dst = cv2.inpaint(img,...
code_fim
medium
{ "lang": "python", "repo": "QuantumFractal/hackisu-2017-nucleus", "path": "/point-cloud-stuff/cleanup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> aux = remover_separator_filename_mode(separator_filename_mode, file_name) aux = str(str(aux).split(separator_receptor)[1]).strip() return aux<|fim_prefix|># repo: rodrigofaccioli/drugdesignCassandra path: /src/commonFunctions.py """ Removes separator_filename_mode from file name. Exam...
code_fim
hard
{ "lang": "python", "repo": "rodrigofaccioli/drugdesignCassandra", "path": "/src/commonFunctions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodrigofaccioli/drugdesignCassandra path: /src/commonFunctions.py """ Removes separator_filename_mode from file name. Example: separator_filename_mode : +----+ file_name ns3pro_dm_0_-_NuBBE_102_obabel_3D+----+1 return ns3pro_dm_0_-_NuBBE_102_obabel_3D """ def remover_separator...
code_fim
hard
{ "lang": "python", "repo": "rodrigofaccioli/drugdesignCassandra", "path": "/src/commonFunctions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#folders from . import _io from . import _serialization<|fim_prefix|># repo: rramji/nanome-lib path: /nanome/_internal/_volumetric/__init__.py from ._unit_cell import _UnitCell from ._volume_data import _VolumeData from ._volume_layer import _VolumeLay<|fim_middle|>er from ._volume_properties import _Vol...
code_fim
easy
{ "lang": "python", "repo": "rramji/nanome-lib", "path": "/nanome/_internal/_volumetric/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rramji/nanome-lib path: /nanome/_internal/_volumetric/__init__.py from ._unit_cell import _UnitCell from ._volume_data i<|fim_suffix|>er from ._volume_properties import _VolumeProperties #folders from . import _io from . import _serialization<|fim_middle|>mport _VolumeData from ._volume_layer im...
code_fim
easy
{ "lang": "python", "repo": "rramji/nanome-lib", "path": "/nanome/_internal/_volumetric/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fgh95/pubmed_parser path: /tests/test_reference_remove.py from lxml import etree from pubmed_parser.utils import stringify_children SAMPLE1 = """<p>Both types of NP formulations demonstrated size ranges that were considered to be suitable for IV administration for long-circulating sustained-rele...
code_fim
hard
{ "lang": "python", "repo": "fgh95/pubmed_parser", "path": "/tests/test_reference_remove.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_removebibrefs(): xml_text = etree.fromstring(SAMPLE2) parsed_text = stringify_children(node=xml_text) assert parsed_text == "The adsorption isotherms were characterized with the model presented in eq 22 where a is the measure of the capacity (Bmax), m is a heterogeneity index, and F ...
code_fim
hard
{ "lang": "python", "repo": "fgh95/pubmed_parser", "path": "/tests/test_reference_remove.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mukultaneja/ansible-modules-vCenter-automation path: /modules/vcenter_datacenter.py from pyVmomi import vim from ansible.module_utils.vc import VcAnsibleModule VC_DATACENTER_STATES = ['present', 'absent'] def vc_datacenter_argument_spec(): return dict( dc_name=dict(type='str', req...
code_fim
hard
{ "lang": "python", "repo": "mukultaneja/ansible-modules-vCenter-automation", "path": "/modules/vcenter_datacenter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def create(self): content = self.si.content root = content.rootFolder response = dict() response['changed'] = False dc_name = self.params.get("dc_name") try: root.CreateDatacenter(dc_name) except vim.fault.DuplicateName: ...
code_fim
hard
{ "lang": "python", "repo": "mukultaneja/ansible-modules-vCenter-automation", "path": "/modules/vcenter_datacenter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): argument_spec = vc_datacenter_argument_spec() response = dict(msg=dict(type='str')) module = VcDatacenter(argument_spec=argument_spec, supports_check_mode=True) try: response = module.manage_states() except Exception as error: response['msg'] = error.__str...
code_fim
hard
{ "lang": "python", "repo": "mukultaneja/ansible-modules-vCenter-automation", "path": "/modules/vcenter_datacenter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # A[i] 之前恰好有 j - 1 个元素,而它们一共组成了长度为 j 的子数组 # 相当于当前子数组可以表示为 A[:j] # if i - j < 0: # dp[i] = max(dp[i], subarray_max * j) # else: # dp[i] = max(dp[i], dp[i - j] + subarray_max * j) ...
code_fim
hard
{ "lang": "python", "repo": "Yuziquan/LeetCode", "path": "/Problemset/partition-array-for-maximum-sum/partition-array-for-maximum-sum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n = len(A) if n <= K: return max(A) * n if K == 1: return sum(A) dp = [0 for _ in range(n)] for i, a in enumerate(A): subarray_max = a # j 代表当前子数组的长度,包括 A[i],子数组为 A[i - j + 1: i + 1] for j in range(1, K + 1...
code_fim
hard
{ "lang": "python", "repo": "Yuziquan/LeetCode", "path": "/Problemset/partition-array-for-maximum-sum/partition-array-for-maximum-sum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yuziquan/LeetCode path: /Problemset/partition-array-for-maximum-sum/partition-array-for-maximum-sum.py # @Title: 分隔数组以得到最大和 (Partition Array for Maximum Sum) # @Author: KivenC # @Date: 2019-05-18 23:46:56 # @Runtime: 660 ms # @Memory: 12.9 MB <|fim_suffix|> def maxSumAfterPartitioning(self, ...
code_fim
hard
{ "lang": "python", "repo": "Yuziquan/LeetCode", "path": "/Problemset/partition-array-for-maximum-sum/partition-array-for-maximum-sum.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alonsocarrillo/NetworkServicesManagement path: /Practica1/datagramasUDP.py import time import rrdtool from Practica1.getSNMP import consultaSNMP total_input_traffic = 0 total_output_traffic = 0 #Datagramas entregados a usuarios UDP #consultaSNMP("acarrillo", "localhost", "1.3.6.1.2.1.7.1.0") <|...
code_fim
hard
{ "lang": "python", "repo": "alonsocarrillo/NetworkServicesManagement", "path": "/Practica1/datagramasUDP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> time.sleep(1) tiempo += 1 if tiempo == 1: break # if ret: # print (rrdtool.error()) # time.sleep(300)<|fim_prefix|># repo: alonsocarrillo/NetworkServicesManagement path: /Practica1/datagramasUDP.py import time import rrdtool from Practica1.getSNMP ...
code_fim
hard
{ "lang": "python", "repo": "alonsocarrillo/NetworkServicesManagement", "path": "/Practica1/datagramasUDP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: visargbsoneji/bigscholarlydata path: /BigScholarlyDataCrawler/Crawler/Crawler_doi.py import string from bs4 import BeautifulSoup as BS import xml.etree.ElementTree as ET class Crawler_doi: <|fim_suffix|> def get_doi_IEEE(self, document): try: return document.find('doi').text except: r...
code_fim
medium
{ "lang": "python", "repo": "visargbsoneji/bigscholarlydata", "path": "/BigScholarlyDataCrawler/Crawler/Crawler_doi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_doi_IEEE(self, document): try: return document.find('doi').text except: return None def get_doi_Springer(self, soup): try: doi = soup.find('meta', {'name': 'citation_doi'})['content'] except: doi = None finally: return doi<|fim_prefix|># repo: visargbsoneji/bigscho...
code_fim
medium
{ "lang": "python", "repo": "visargbsoneji/bigscholarlydata", "path": "/BigScholarlyDataCrawler/Crawler/Crawler_doi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> except: return None def get_doi_Springer(self, soup): try: doi = soup.find('meta', {'name': 'citation_doi'})['content'] except: doi = None finally: return doi<|fim_prefix|># repo: visargbsoneji/bigscholarlydata path: /BigScholarlyDataCrawler/Crawler/Crawler_doi.py import string ...
code_fim
medium
{ "lang": "python", "repo": "visargbsoneji/bigscholarlydata", "path": "/BigScholarlyDataCrawler/Crawler/Crawler_doi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: heyoeyo/batteryCheck path: /batCheck.py import os import time import re import sys # Specify sixad log file path logPath='/var/log/sixad' # Specify battery check display file path dispExecPath='./code/batDisplay' dispCmdOptions = '-x 24 -y 16 -t 5' # Can change '-x 32 -y 32 -s 32 -t 3' # Get ...
code_fim
hard
{ "lang": "python", "repo": "heyoeyo/batteryCheck", "path": "/batCheck.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __debug: print 'PID ' + pidVal + ' is running' # Process is running. Only display battery info if it's not in our already displayed list if pidVal not in pidList: if __debug: print 'PID ' + pidVal + ' is not in PID list' # Get battery value for display batVal = getBrackets[...
code_fim
hard
{ "lang": "python", "repo": "heyoeyo/batteryCheck", "path": "/batCheck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Call the battery display function dispCmd = dispExecPath + ' ' + dispCmdOptions + ' ' + iconPath + str(batVal) + '.png' if __debug: print 'calling display function: ' + dispCmd os.system(dispCmd) # Add PID to displayed list so we don't repeatedly display it pidList.ap...
code_fim
hard
{ "lang": "python", "repo": "heyoeyo/batteryCheck", "path": "/batCheck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not self.disable_url_printing: print(f'Serving app from {self.url}') self.dash_app.run_server(debug=debug, host=host, port=port, use_reloader=False, **extra_options) class CustomWebEnginePage(web_widgets.QWebEnginePage): def createWindow(self, _type): page = Cu...
code_fim
hard
{ "lang": "python", "repo": "argabor/dash-desktop", "path": "/dashui/dashui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: argabor/dash-desktop path: /dashui/dashui.py from threading import Thread import PyQt5.QtCore as core import PyQt5.QtWidgets as core_widgets import PyQt5.QtWebEngine as web_engine import PyQt5.QtWebEngineWidgets as web_widgets import PyQt5.QtGui as gui import logging import sys import socket d...
code_fim
hard
{ "lang": "python", "repo": "argabor/dash-desktop", "path": "/dashui/dashui.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.dash_thread.start() def run_gui(self): self.view.load(core.QUrl(self.url)) change_setting = self.view.page().settings().setAttribute settings = web_widgets.QWebEngineSettings change_setting(settings.LocalStorageEnabled, True) change_setting(settin...
code_fim
hard
{ "lang": "python", "repo": "argabor/dash-desktop", "path": "/dashui/dashui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liting-dev/scfcli path: /tcfcli/cmds/logs/__init__.py import click import time from datetime import datetime from datetime import timedelta from tcfcli.cmds.native.common.invoke_context import InvokeContext from tcfcli.cmds.local.common.options import invoke_common_options from tcfcli.common.user...
code_fim
hard
{ "lang": "python", "repo": "liting-dev/scfcli", "path": "/tcfcli/cmds/logs/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if _start: start = datetime.strptime(_start, tm_format) if _end: end = datetime.strptime(_end, tm_format) # specify starttime and endtime if start and end: pass elif start: # the combination of starttime and interval end = start + timedelta(m...
code_fim
hard
{ "lang": "python", "repo": "liting-dev/scfcli", "path": "/tcfcli/cmds/logs/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ilumb/tortuga path: /src/installer/src/tortuga/db/tables/mapper_hardware_profiles.py # Copyright 2008-2018 Univa Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
code_fim
hard
{ "lang": "python", "repo": "ilumb/tortuga", "path": "/src/installer/src/tortuga/db/tables/mapper_hardware_profiles.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> backend_opts = db_manager.get_backend_opts() hardwareprofilenetworks_table = Table( 'HardwareProfileNetworks', db_manager.metadata, Column('hardwareProfileId', Integer, ForeignKey('HardwareProfiles.id'), primary_key=True), ...
code_fim
hard
{ "lang": "python", "repo": "ilumb/tortuga", "path": "/src/installer/src/tortuga/db/tables/mapper_hardware_profiles.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidhendel/galpy path: /galpy/snapshot/__init__.py from . import Snapshot from . import snapshotMovies <|fim_suffix|># # Classes # Snapshot= Snapshot.Snapshot<|fim_middle|># # Functions # snapshotToMovie= snapshotMovies.snapshotToMovie
code_fim
medium
{ "lang": "python", "repo": "davidhendel/galpy", "path": "/galpy/snapshot/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># # Classes # Snapshot= Snapshot.Snapshot<|fim_prefix|># repo: davidhendel/galpy path: /galpy/snapshot/__init__.py from . import Snapshot from . import snapshotMovies <|fim_middle|># # Functions # snapshotToMovie= snapshotMovies.snapshotToMovie
code_fim
medium
{ "lang": "python", "repo": "davidhendel/galpy", "path": "/galpy/snapshot/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tktaofik/airnd-market path: /services/job/job/config.py import os from dotenv import load_dotenv <|fim_suffix|> def get_config(): return { "port": os.getenv('PORT'), "db_name": os.getenv('DB_NAME'), "db_user": os.getenv('DB_USER'), "db_password": os.getenv('D...
code_fim
easy
{ "lang": "python", "repo": "tktaofik/airnd-market", "path": "/services/job/job/config.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>def get_config(): return { "port": os.getenv('PORT'), "db_name": os.getenv('DB_NAME'), "db_user": os.getenv('DB_USER'), "db_password": os.getenv('DB_PASSWORD'), "db_host": os.getenv('DB_HOST'), "db_port": os.getenv('DB_PORT'), "sentry_key": os.ge...
code_fim
easy
{ "lang": "python", "repo": "tktaofik/airnd-market", "path": "/services/job/job/config.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: prefeiturasp/SME-PortalUniforme-BackEnd path: /sme_uniforme_apps/utils/base64ToFile.py from django.core.files.base import ContentFile import base64 <|fim_suffix|> format, imgstr = base.split(';base64,') ext = format.split('/')[-1] data = ContentFile(base64.b64decode(imgstr), name='t...
code_fim
easy
{ "lang": "python", "repo": "prefeiturasp/SME-PortalUniforme-BackEnd", "path": "/sme_uniforme_apps/utils/base64ToFile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> format, imgstr = base.split(';base64,') ext = format.split('/')[-1] data = ContentFile(base64.b64decode(imgstr), name='temp.' + ext) return {'data': data, 'ext': ext }<|fim_prefix|># repo: prefeiturasp/SME-PortalUniforme-BackEnd path: /sme_uniforme_apps/utils/base64ToFile.py from django...
code_fim
easy
{ "lang": "python", "repo": "prefeiturasp/SME-PortalUniforme-BackEnd", "path": "/sme_uniforme_apps/utils/base64ToFile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DuelLoss(_Loss): def __init__(self, num_points_mesh, sym_list): super(DuelLoss, self).__init__(True) self.num_pt_mesh = num_points_mesh self.sym_list = sym_list def forward(self, pred_q1 ,pred_q2, pred_z, true_r): loss, lik = duel_loss_calculation(pred_q1 ,p...
code_fim
medium
{ "lang": "python", "repo": "r-pad/DenseFusion", "path": "/lib/loss_bing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r-pad/DenseFusion path: /lib/loss_bing.py from torch.nn.modules.loss import _Loss from torch.autograd import Variable import torch import time import numpy as np import torch.nn as nn import random #from dense_fusion.bingham_const import bingham_const #from object_pose_utils.utils.interpolation i...
code_fim
hard
{ "lang": "python", "repo": "r-pad/DenseFusion", "path": "/lib/loss_bing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dir = './data' result=[] for school in os.listdir(dir): if(school.find('.') != -1): continue schoolDir = os.path.join(dir,school) for professor in os.listdir(schoolDir): if(professor.find('.') != -1): continue isAcmfellow = 0 isIeeefellow = 0 isGranted = 0 professorDir = os.path.join(sch...
code_fim
medium
{ "lang": "python", "repo": "bsnsk/CSInfoCollector", "path": "/task2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bsnsk/CSInfoCollector path: /task2.py import os def findall(text,s): res = [] index = 0 while ((text.find(s,index)) != -1): pos = text.find(s,index); res.append(pos) index = pos + 1 return res <|fim_suffix|> pos = findall(text,s) for p in pos: if s in text[p-15:p+15]: return Tru...
code_fim
medium
{ "lang": "python", "repo": "bsnsk/CSInfoCollector", "path": "/task2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProjetsPlusIA/kerosene path: /kerosene/nn/criterions.py # -*- coding: utf-8 -*- # Copyright 2019 Kerosene Authors. All Rights Reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://...
code_fim
hard
{ "lang": "python", "repo": "ProjetsPlusIA/kerosene", "path": "/kerosene/nn/criterions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, inputs: torch.Tensor, targets: torch.Tensor): """ Computes the Sørensen–Dice loss. Note that PyTorch optimizers minimize a loss. In this case, we would like to maximize the dice loss so we return the negated dice loss. Args: inputs ...
code_fim
hard
{ "lang": "python", "repo": "ProjetsPlusIA/kerosene", "path": "/kerosene/nn/criterions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xurten/python-training path: /tips/tip_75_use_repr_for_debug.py # Tip 75 use repr for debug # Both __str__ and __repr__ functions return string representation of the object # __str__ string representation is more human-friendly and for logging # __repr__ information about object so that it can be...
code_fim
medium
{ "lang": "python", "repo": "xurten/python-training", "path": "/tips/tip_75_use_repr_for_debug.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return f'BetterClass({self.x!r}, {self.y!r})' obj = BetterClass(1, 'bar') print(obj) print(obj.__dict__)<|fim_prefix|># repo: xurten/python-training path: /tips/tip_75_use_repr_for_debug.py # Tip 75 use repr for debug # Both __str__ and __repr__ functions return string representation of the obj...
code_fim
medium
{ "lang": "python", "repo": "xurten/python-training", "path": "/tips/tip_75_use_repr_for_debug.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, file): self.media = file # if file is link if urlparse(file).scheme in ('http', 'https'): self.pathFile = self.downloadMediaFromLink(file) self.isLink = True # if file is a local file else: self.pathFile =...
code_fim
medium
{ "lang": "python", "repo": "MacherIT/pybuho", "path": "/instapy_cli/media.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MacherIT/pybuho path: /instapy_cli/media.py import os, requests #import urlparse for Python2 and Python3 try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse class Media(object): pathFile = None media = None isLink = False def __init_...
code_fim
medium
{ "lang": "python", "repo": "MacherIT/pybuho", "path": "/instapy_cli/media.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def downloadMediaFromLink(self,url): print('Downloading Media..') # print(urlparse(url)) fileName = urlparse(url).path.split('/')[-1] # print(fileName) r = requests.get(url, allow_redirects=True) open(fileName, 'wb').write(r.content) return fileN...
code_fim
hard
{ "lang": "python", "repo": "MacherIT/pybuho", "path": "/instapy_cli/media.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sample_count = 7 step = Dictionary.MAX_SYMBOL // (sample_count + 1) if step == 0: return self._token_usage_by_symbol[Dictionary.MAX_SYMBOL // 2].count j = step - 1 samples = list() for i in range(sample_count): samples.append(self._to...
code_fim
hard
{ "lang": "python", "repo": "bidfx/bidfx-api-py", "path": "/bidfx/pricing/_puffin/token_dictionary.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bidfx/bidfx-api-py path: /bidfx/pricing/_puffin/token_dictionary.py __all__ = ["Dictionary", "Token", "TokenType"] import io import logging import socket from enum import Enum, unique from bidfx import PricingError from .element import Element log = logging.getLogger("bidfx.pricing.puffin.deco...
code_fim
hard
{ "lang": "python", "repo": "bidfx/bidfx-api-py", "path": "/bidfx/pricing/_puffin/token_dictionary.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }