text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def remove_info(i): with mock.patch("os.getpid", lambda: 76540 + i): manager.remove_info_file() self.assertCountEqual(manager.get_all(), []) add_info(1) self.assertCountEqual(manager.get_all(), [_make_info(1)]) add_info(2) self.a...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorboard", "path": "/tensorboard/manager_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Should be a no-op, except to create the info directory if # necessary. In particular, should not raise any exception. manager.remove_info_file() def test_get_all(self): def add_info(i): with mock.patch("os.getpid", lambda: 76540 + i): mana...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorboard", "path": "/tensorboard/manager_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>om .mr_tree_view import MrTreeView from .mr_double_tree_handler import MrDoubleTreeHandler<|fim_prefix|># repo: mjredmond/FEMApp path: /fem/utilities/tree_widget/__init__.py from __future__ import print_function, absol<|fim_middle|>ute_import __author__ = 'Michael Redmond' fr
code_fim
easy
{ "lang": "python", "repo": "mjredmond/FEMApp", "path": "/fem/utilities/tree_widget/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjredmond/FEMApp path: /fem/utilities/tree_widget/__init__.py from __future__ import print_function, absol<|fim_suffix|>om .mr_tree_view import MrTreeView from .mr_double_tree_handler import MrDoubleTreeHandler<|fim_middle|>ute_import __author__ = 'Michael Redmond' fr
code_fim
easy
{ "lang": "python", "repo": "mjredmond/FEMApp", "path": "/fem/utilities/tree_widget/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChanJeunlam/geolearn path: /hydroDL/app/plot.py from mpl_toolkits import basemap import matplotlib.pyplot as plt import numpy as np def plotMap(ax, lat, lon, data, dataN, title=None, vRange=None): if np.isnan(data).all(): print('all nan in data') return if vRange is None...
code_fim
hard
{ "lang": "python", "repo": "ChanJeunlam/geolearn", "path": "/hydroDL/app/plot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s=80, marker='.', vmin=vmin, vmax=vmax) cs = mm.scatter(lon[ind2], lat[ind2], c=data[ind2], cmap=plt.cm.jet, s=30, marker='*', vmin=vmin, vmax=vmax) mm.colorbar(cs, location='bottom', pad='5%') ax.set_title(title)<|fim_prefix|># repo: ChanJeunlam/geolearn path: /...
code_fim
hard
{ "lang": "python", "repo": "ChanJeunlam/geolearn", "path": "/hydroDL/app/plot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert 0 <= idx < self._capacity return self._value[self._capacity + idx] class SumSegmentTree(SegmentTree): # stolen from https://github.com/Shmuma/ptan/blob/master/ptan/common/utils.py def __init__(self, capacity): super(SumSegmentTree, self).__init__( capac...
code_fim
hard
{ "lang": "python", "repo": "cpnota/autonomous-learning-library", "path": "/all/memory/segment_tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cpnota/autonomous-learning-library path: /all/memory/segment_tree.py # This entire module was stolen from: # https://github.com/Shmuma/ptan/blob/master/ptan/common/utils.py import operator class SegmentTree(object): def __init__(self, capacity, operation, neutral_element): """Build ...
code_fim
hard
{ "lang": "python", "repo": "cpnota/autonomous-learning-library", "path": "/all/memory/segment_tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- samples : ndarray (..., N) N samples on a unit sphere for each point, stored along the last axis of the array. out : ndrray (..., N), optional An array to store the normalized samples. Returns ------- out : ndarray, (..., N) ...
code_fim
hard
{ "lang": "python", "repo": "jbrustle/dipy", "path": "/dipy/reconst/odf.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbrustle/dipy path: /dipy/reconst/odf.py from __future__ import division, print_function, absolute_import from .base import ReconstModel, ReconstFit import numpy as np # Classes OdfModel and OdfFit are using API ReconstModel and ReconstFit from # .base class OdfModel(ReconstModel): <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "jbrustle/dipy", "path": "/dipy/reconst/odf.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def register(app): app.add_url_rule("/api/hello", view_func=Hello.as_view("hello"))<|fim_prefix|># repo: codeforpdx/recordexpungPDX path: /src/backend/expungeservice/endpoints/hello.py """Example endpoint.""" from flask.views import MethodView class Hello(MethodView): def get(self): <|fim_mid...
code_fim
easy
{ "lang": "python", "repo": "codeforpdx/recordexpungPDX", "path": "/src/backend/expungeservice/endpoints/hello.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codeforpdx/recordexpungPDX path: /src/backend/expungeservice/endpoints/hello.py """Example endpoint.""" from flask.views import MethodView <|fim_suffix|> app.add_url_rule("/api/hello", view_func=Hello.as_view("hello"))<|fim_middle|> class Hello(MethodView): def get(self): return ...
code_fim
medium
{ "lang": "python", "repo": "codeforpdx/recordexpungPDX", "path": "/src/backend/expungeservice/endpoints/hello.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luwoldy/creative-morning-board-generator path: /app/routes.py from app import app from flask import render_template import pandas as pd work_df = pd.read_csv('app/data/looking_for_work.csv') talent_df = pd.read_csv('app/data/looking_for_talent.csv') collab_df = pd.read_csv('app/data/looking_t...
code_fim
hard
{ "lang": "python", "repo": "luwoldy/creative-morning-board-generator", "path": "/app/routes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/collab') def collab(): posts = [] for i,j in zip(collab_df['description'],collab_df['contact']): posts.append({'description': i, 'contact': j}) return render_template('board.html', title = 'Looking to Collaborate',posts=posts, month=month) @app.route('/talent') def talent...
code_fim
hard
{ "lang": "python", "repo": "luwoldy/creative-morning-board-generator", "path": "/app/routes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@cli.command() def version() -> None: """Display the version.""" click.echo(f"Blowhole v{__version__}") cli.add_command(env)<|fim_prefix|># repo: tacheo/blowhole path: /blowhole/cli/cli.py """Main CLI interface for Blowhole.""" import click from blowhole import __version__ from blowhole.cli.e...
code_fim
hard
{ "lang": "python", "repo": "tacheo/blowhole", "path": "/blowhole/cli/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Display the version.""" click.echo(f"Blowhole v{__version__}") cli.add_command(env)<|fim_prefix|># repo: tacheo/blowhole path: /blowhole/cli/cli.py """Main CLI interface for Blowhole.""" import click from blowhole import __version__ from blowhole.cli.env import env @click.group('bh', inv...
code_fim
hard
{ "lang": "python", "repo": "tacheo/blowhole", "path": "/blowhole/cli/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tacheo/blowhole path: /blowhole/cli/cli.py """Main CLI interface for Blowhole.""" import click from blowhole import __version__ from blowhole.cli.env import env @click.group('bh', invoke_without_command=True) @click.pass_context def cli(ctx: click.Context) -> None: <|fim_suffix|> """Displa...
code_fim
hard
{ "lang": "python", "repo": "tacheo/blowhole", "path": "/blowhole/cli/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>timeout = httpx.Timeout(5.0, connect_timeout=5.0) client = httpx.AsyncClient(timeout=timeout) stop_time = time.time() + 5 TEST_MESSAGE = "http test running..." async def main(): sys.stdout.write(TEST_MESSAGE) sys.stdout.flush() count = 0 while time.time() < stop_time: res = awa...
code_fim
medium
{ "lang": "python", "repo": "ijl/orjson", "path": "/integration/client", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ijl/orjson path: /integration/client #!/usr/bin/env python3 import asyncio import sys import time import httpx port = sys.argv[1] url = f"http://127.0.0.1:{port}" timeout = httpx.Timeout(5.0, connect_timeout=5.0) client = httpx.AsyncClient(timeout=timeout) stop_time = time.time() + 5 TEST_M...
code_fim
hard
{ "lang": "python", "repo": "ijl/orjson", "path": "/integration/client", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>port = sys.argv[1] url = f"http://127.0.0.1:{port}" timeout = httpx.Timeout(5.0, connect_timeout=5.0) client = httpx.AsyncClient(timeout=timeout) stop_time = time.time() + 5 TEST_MESSAGE = "http test running..." async def main(): sys.stdout.write(TEST_MESSAGE) sys.stdout.flush() count = 0...
code_fim
medium
{ "lang": "python", "repo": "ijl/orjson", "path": "/integration/client", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.header: scale_column = [self.header[i] for i in self.scale_column_idx] else: scale_column = ["_".join(["col", str(i)]) for i in self.scale_column_idx] if not self.data_shape: self.data_shape = -1 meta_proto_obj = ScaleMeta(metho...
code_fim
hard
{ "lang": "python", "repo": "FederatedAI/FATE", "path": "/python/federatedml/feature/feature_scale/min_max_scale.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f = functools.partial(MinMaxScale.__scale, max_value_list=self.column_max_value, min_value_list=self.column_min_value, scale_value_list=self.column_range, process_cols_list=self.scale_column_idx) transform_data = data.mapValues(f...
code_fim
hard
{ "lang": "python", "repo": "FederatedAI/FATE", "path": "/python/federatedml/feature/feature_scale/min_max_scale.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FederatedAI/FATE path: /python/federatedml/feature/feature_scale/min_max_scale.py # # Copyright 2019 The FATE Authors. All Rights Reserved. # # 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...
code_fim
hard
{ "lang": "python", "repo": "FederatedAI/FATE", "path": "/python/federatedml/feature/feature_scale/min_max_scale.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: StephenSorriaux/ansible-kafka-admin path: /molecule/default/tests/test_quotas_default.py """ Main tests for library """ import os import time import testinfra.utils.ansible_runner from tests.ansible_utils import ( quotas_default_configuration, sasl_default_configuration, ensure_kafk...
code_fim
hard
{ "lang": "python", "repo": "StephenSorriaux/ansible-kafka-admin", "path": "/molecule/default/tests/test_quotas_default.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_quotas_create(host): """ Check if can create quotas """ # Given test_quotas_configuration = quotas_default_configuration.copy() test_quotas_configuration.update({ 'entries': [{ 'entity': { 'client': get_entity_name(), 'us...
code_fim
hard
{ "lang": "python", "repo": "StephenSorriaux/ansible-kafka-admin", "path": "/molecule/default/tests/test_quotas_default.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def configure_dbsession(config): from snovault import DBSESSION settings = config.registry.settings DBSession = settings.pop(DBSESSION, None) if DBSession is None: engine = configure_engine(settings) if asbool(settings.get('create_tables', False)): from snovaul...
code_fim
hard
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'elasticsearch.server' in config.registry.settings: config.include('snovault.elasticsearch') config.include('.vis_indexer') config.include('.cart_view') config.include('encoded.search_views') if 'snp_search.server' in config.registry.settings: addresses ...
code_fim
hard
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ENCODE-DCC/encoded path: /src/encoded/__init__.py from future.standard_library import install_aliases install_aliases() # NOQA import encoded.schema_formats # needed to import before snovault to add FormatCheckers import base64 import codecs import copy import json import os from pathlib import ...
code_fim
hard
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: h3llrais3r/tvdb_api path: /tvdb_api/api/__init__.py from __future__ import absolute_import # flake8: noqa # import apis into api package from tvdb_api.api.authentication_<|fim_suffix|>.series_api import SeriesApi from tvdb_api.api.updates_api import UpdatesApi from tvdb_api.api.users_api import...
code_fim
hard
{ "lang": "python", "repo": "h3llrais3r/tvdb_api", "path": "/tvdb_api/api/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.series_api import SeriesApi from tvdb_api.api.updates_api import UpdatesApi from tvdb_api.api.users_api import UsersApi<|fim_prefix|># repo: h3llrais3r/tvdb_api path: /tvdb_api/api/__init__.py from __future__ import absolute_import # flake8: noqa # import apis into api package from tvdb_api.api.authen...
code_fim
medium
{ "lang": "python", "repo": "h3llrais3r/tvdb_api", "path": "/tvdb_api/api/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nguagesApi from tvdb_api.api.movies_api import MoviesApi from tvdb_api.api.search_api import SearchApi from tvdb_api.api.series_api import SeriesApi from tvdb_api.api.updates_api import UpdatesApi from tvdb_api.api.users_api import UsersApi<|fim_prefix|># repo: h3llrais3r/tvdb_api path: /tvdb_api/api/__i...
code_fim
medium
{ "lang": "python", "repo": "h3llrais3r/tvdb_api", "path": "/tvdb_api/api/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yux1991/PyRHEED path: /src/process.py = offset self.substrate_CIF_path = substrate_CIF_path self.epilayer_CIF_path = epilayer_CIF_path self.sub_orientation = sub_orientation self.epi_orientation = epi_orientation self.distribution = distribution se...
code_fim
hard
{ "lang": "python", "repo": "yux1991/PyRHEED", "path": "/src/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yux1991/PyRHEED path: /src/process.py max_gridx = device.get_attribute(drv.device_attribute.MAX_GRID_DIM_X) max_gridy = device.get_attribute(drv.device_attribute.MAX_GRID_DIM_Y) max_gridz = device.get_attribute(drv.device_attribute.MAX_GRID_DIM_Z) self.UP...
code_fim
hard
{ "lang": "python", "repo": "yux1991/PyRHEED", "path": "/src/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def left_or_right(self,p1,p2,p3): return (p1[0]-p3[0])*(p2[1]-p3[1]) - (p2[0]-p3[0])*(p1[1]-p3[1]) def within_vertex(self,v,p,r): return (v[0]-p[0])**2+(v[1]-p[1])**2 < (r/2)**2 def get_boundaryless_domain(self, a, b, angle, rectangle, unit_cell_sites_epi): epilayer_d...
code_fim
hard
{ "lang": "python", "repo": "yux1991/PyRHEED", "path": "/src/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print = log_message def latest_logs(infr, colored=False): index = infr.log_index infr.log_index = len(infr.logs) if colored: return [infr.logs[x] for x in range(index, len(infr.logs))] else: return [infr.logs[x][0] for x in range(index, len(...
code_fim
hard
{ "lang": "python", "repo": "WildMeOrg/wildbook-ia", "path": "/wbia/algo/graph/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class MiscHelpers(object): def _rectify_nids(infr, aids, nids): if nids is None: if infr.ibs is None: nids = [-aid for aid in aids] else: nids = infr.ibs.get_annot_nids(aids) elif ut.isscalar(nids): nids = [nids] * le...
code_fim
hard
{ "lang": "python", "repo": "WildMeOrg/wildbook-ia", "path": "/wbia/algo/graph/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WildMeOrg/wildbook-ia path: /wbia/algo/graph/core.py infr.unreviewed_graph.number_of_edges(), ) return msg # return 'nAids={}, nEdges={}, nCCs={}'.format( # len(infr.aids), # infr.graph.number_of_edges(), # infr.p...
code_fim
hard
{ "lang": "python", "repo": "WildMeOrg/wildbook-ia", "path": "/wbia/algo/graph/core.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class TrigramSearchEngine(BaseSearchEngine): pass<|fim_prefix|># repo: bnznamco/django-postgresql-trigram-search path: /postgre_trigram_search/__init__.py from .searchengine import BaseSearchEngine from django.conf import settings <|fim_middle|>if 'django.contrib.postgres' not in settings.INSTALLED...
code_fim
medium
{ "lang": "python", "repo": "bnznamco/django-postgresql-trigram-search", "path": "/postgre_trigram_search/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bnznamco/django-postgresql-trigram-search path: /postgre_trigram_search/__init__.py from .searchengine import BaseSearchEngine from django.conf import settings <|fim_suffix|>class TrigramSearchEngine(BaseSearchEngine): pass<|fim_middle|>if 'django.contrib.postgres' not in settings.INSTALLED...
code_fim
medium
{ "lang": "python", "repo": "bnznamco/django-postgresql-trigram-search", "path": "/postgre_trigram_search/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>environments=True) settings.configure(settings_module=__file__) assert settings.is_overridden("FOO") is False<|fim_prefix|># repo: mjpieters/dynaconf path: /tests/test_django.py import os import sys import dynaconf def test_djdt_382(tmpdir): sys.path.insert(0, str(tmpdir)) settings_f<|...
code_fim
hard
{ "lang": "python", "repo": "mjpieters/dynaconf", "path": "/tests/test_django.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rite("") os.environ["DJANGO_SETTINGS_MODULE"] = str("settings") settings = dynaconf.DjangoDynaconf(__name__, environments=True) settings.configure(settings_module=__file__) assert settings.is_overridden("FOO") is False<|fim_prefix|># repo: mjpieters/dynaconf path: /tests/test_django.py im...
code_fim
medium
{ "lang": "python", "repo": "mjpieters/dynaconf", "path": "/tests/test_django.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjpieters/dynaconf path: /tests/test_django.py import os import sys import dynaconf def test_djdt_382(tmpdir): sys.path.insert(0, str(tmpdir)) settings_f<|fim_suffix|>environments=True) settings.configure(settings_module=__file__) assert settings.is_overridden("FOO") is False<|...
code_fim
hard
{ "lang": "python", "repo": "mjpieters/dynaconf", "path": "/tests/test_django.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chrisrsantiago/chiplibrary path: /chiplibrary/scripts/buildindex.py # -*- coding: utf-8 -*- import os import sys import logging import transaction from pyramid.paster import get_appsettings, setup_logging from pyramid.scripts.common import parse_vars from ..db import get_session from ..db.chip ...
code_fim
medium
{ "lang": "python", "repo": "chrisrsantiago/chiplibrary", "path": "/chiplibrary/scripts/buildindex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(argv) < 2: usage(argv) config_uri = argv[1] options = parse_vars(argv[2:]) setup_logging(config_uri) log = logging.getLogger(__name__) settings = get_appsettings(config_uri, options=options) settings['config_path'] = os.path.dirname(config_uri) settings['whoo...
code_fim
hard
{ "lang": "python", "repo": "chrisrsantiago/chiplibrary", "path": "/chiplibrary/scripts/buildindex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MTES-MCT/envergo path: /envergo/stats/models.py from django.db import models from django.utils.translation import gettext_lazy as _ class Stat(models.Model): <|fim_suffix|> verbose_name = _("Stat") verbose_name_plural = _("Stats") ordering = ["order"]<|fim_middle|> tit...
code_fim
medium
{ "lang": "python", "repo": "MTES-MCT/envergo", "path": "/envergo/stats/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> verbose_name = _("Stat") verbose_name_plural = _("Stats") ordering = ["order"]<|fim_prefix|># repo: MTES-MCT/envergo path: /envergo/stats/models.py from django.db import models from django.utils.translation import gettext_lazy as _ <|fim_middle|> class Stat(models.Model): tit...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/envergo", "path": "/envergo/stats/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gwu-libraries/sfm-twitter-harvester path: /twitter_rest_warc_iter.py #!/usr/bin/env python3 from __future__ import absolute_import import re from sfmutils.warc_iter import BaseWarcIter from dateutil.parser import parse as date_parse import json import sys from twarc.expansions import ensure_fla...
code_fim
hard
{ "lang": "python", "repo": "gwu-libraries/sfm-twitter-harvester", "path": "/twitter_rest_warc_iter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _item_iter(self, url, json_obj): return TwitterRestWarcIter._get_iter(url, json_obj) @staticmethod def _get_iter(url, json_obj): # Ignore error messages if isinstance(json_obj, dict) and ('error' in json_obj or 'errors' in json_obj): return # Se...
code_fim
hard
{ "lang": "python", "repo": "gwu-libraries/sfm-twitter-harvester", "path": "/twitter_rest_warc_iter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cdata = json.loads( CliRunner() .invoke( area, ["-x", "date", "-y", "price", "--colorvar", "company", *STOCK_ARGS] ) .output ) e = cdata["encoding"]["fill"] assert e["field"] == "company" assert e["type"] == "nominal" assert "title" not i...
code_fim
hard
{ "lang": "python", "repo": "dannguyen/csvviz", "path": "/tests/vizzes/test_area.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dannguyen/csvviz path: /tests/vizzes/test_area.py #!/usr/bin/env python import pytest from click.testing import CliRunner import json from pathlib import Path from csvviz.exceptions import * from csvviz.settings import * from csvviz.vizzes.area import Areakit area = Areakit.register_command(...
code_fim
hard
{ "lang": "python", "repo": "dannguyen/csvviz", "path": "/tests/vizzes/test_area.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_area_error_when_normalize_but_no_fill_color_stack(): """ User shouldn't be allowed to create normalized bars of 1 segment, even though it's technically valid """ result = CliRunner().invoke(area, ["-N", *NORMAL_ARGS]) assert result.exit_code == 1 assert ( "Conflic...
code_fim
hard
{ "lang": "python", "repo": "dannguyen/csvviz", "path": "/tests/vizzes/test_area.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": debug(True) run(host="localhost", port = 8080, reloader = True)<|fim_prefix|># repo: huijuannan/OMOOC2py path: /_src/om2py4w/4wex0/diary.py # -*- coding: utf-8 -*- #!/usr/bin/env python ''' Usage: ''' from bottle import run, route, debug, template, request @route('/diary')...
code_fim
medium
{ "lang": "python", "repo": "huijuannan/OMOOC2py", "path": "/_src/om2py4w/4wex0/diary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huijuannan/OMOOC2py path: /_src/om2py4w/4wex0/diary.py # -*- coding: utf-8 -*- #!/usr/bin/env python ''' Usage: ''' from bottle import run, route, debug, template, request @route('/diary') def submit_diary(): <|fim_suffix|> if __name__ == "__main__": debug(True) run(host="localhost", port = ...
code_fim
hard
{ "lang": "python", "repo": "huijuannan/OMOOC2py", "path": "/_src/om2py4w/4wex0/diary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": debug(True) run(host="localhost", port = 8080, reloader = True)<|fim_prefix|># repo: huijuannan/OMOOC2py path: /_src/om2py4w/4wex0/diary.py # -*- coding: utf-8 -*- #!/usr/bin/env python ''' Usage: ''' from bottle import run, route, debug, template, request @route('/diary') de...
code_fim
medium
{ "lang": "python", "repo": "huijuannan/OMOOC2py", "path": "/_src/om2py4w/4wex0/diary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def to_wiggle_pairs(filein, fileout, region_string, endcrop=False): """ Constructs fragment pile-ups in wiggle format using paired-end information :param filein: BAM file that contains paired-end reads :param fileout: base output file name with extension (.wig) omitted :param region_strin...
code_fim
hard
{ "lang": "python", "repo": "rogerzou/chipseq_cgRNA", "path": "/src/chipseq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def to_bins(filein, fileout, window, numbins, chr=None, generator=None): """ Outputs CSV file that counts number of reads in each bin (column) for each window (row) :param filein: BAM file that contains paired-end reads :param fileout: base output file name with extension (.csv) omitted; each...
code_fim
hard
{ "lang": "python", "repo": "rogerzou/chipseq_cgRNA", "path": "/src/chipseq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rogerzou/chipseq_cgRNA path: /src/chipseq.py # -*- coding: utf-8 -*- """ Useful functions for ChIP-seq analysis after Cas9 cleavage """ __author__ = "Roger Zou" __license__ = "MIT" __version__ = "0.9" __maintainer__ = "Roger Zou" from collections import defaultdict import pysam import os import ...
code_fim
hard
{ "lang": "python", "repo": "rogerzou/chipseq_cgRNA", "path": "/src/chipseq.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fpierfed/owl_web path: /monitor/tests.py # Copyright (C) 2010 Association of Universities for Research in Astronomy(AURA) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributio...
code_fim
medium
{ "lang": "python", "repo": "fpierfed/owl_web", "path": "/monitor/tests.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Tests that 1 + 1 always equals 2. """ self.failUnlessEqual(1 + 1, 2) __test__ = {"doctest": """ Another way to test that 1 + 1 is equal to 2. >>> 1 + 1 == 2 True """}<|fim_prefix|># repo: fpierfed/owl_web path: /monitor/tests.py # Copyright (C) 2010 Association of Un...
code_fim
medium
{ "lang": "python", "repo": "fpierfed/owl_web", "path": "/monitor/tests.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> max_len=64, max_vocab_size=20000, ctx=mx.cpu()): train_arr = [] tokenizer = BasicTokenizer(do_lower_case=True) labels = [] indices = [] values = [] indptrs = [0] cumulative = 0 total_num_words = 0 ndocs = 0 if not vocab: ...
code_fim
hard
{ "lang": "python", "repo": "BwRy/tmnt", "path": "/tmnt/seq_bow_ved/sb_data_loader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BwRy/tmnt path: /tmnt/seq_bow_ved/sb_data_loader.py # coding: utf-8 """ Copyright (c) 2019 The MITRE Corporation. """ import io import itertools import os import logging import json import numpy as np import re import string import gluonnlp as nlp import mxnet as mx from mxnet import gluon from...
code_fim
hard
{ "lang": "python", "repo": "BwRy/tmnt", "path": "/tmnt/seq_bow_ved/sb_data_loader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedroramaciotti/meltylog-analysis path: /cluster-melty.py import time as timelib import pandas as pd pd.options.mode.chained_assignment = None # default='warn' import numpy as News_proportion from sklearn.cluster import KMeans from log2traces import * from markov import * from information_theor...
code_fim
hard
{ "lang": "python", "repo": "pedroramaciotti/meltylog-analysis", "path": "/cluster-melty.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # recap center latex_output.write(" \\begin{tabular}{|c|c|") for dim in dimensions: latex_output.write("c|") latex_output.write("}\n \\hline\n cluster & size") for dim in dimensions: latex_output.write(" &...
code_fim
hard
{ "lang": "python", "repo": "pedroramaciotti/meltylog-analysis", "path": "/cluster-melty.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def saveDslData(self, dslDataset, filename=""): self.setup() filename = filename or "dsl-data-" + self.timestamp + ".json" fullpath = os.path.join(self.output_path_cached_data, filename) dslDataset.save_json(filename=fullpath) url = "file://" + fullpath ...
code_fim
hard
{ "lang": "python", "repo": "lambdamusic/dice", "path": "/dice/app/fmanager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lambdamusic/dice path: /dice/app/fmanager.py #!/usr/bin/python # -*- coding: utf-8 -*- import os import time import shutil from .settings import * class FileManager(object): """Handle file-related operations and provide state for them. """ <|fim_suffix|> def saveDslData(self, ds...
code_fim
hard
{ "lang": "python", "repo": "lambdamusic/dice", "path": "/dice/app/fmanager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dvlab-research/DeepVision3D path: /OpenPCDet/pcdet/models/backbones_3d/pointnet2_backbone.py import torch import torch.nn as nn from ...ops.pointnet2.pointnet2_batch import pointnet2_modules class PointNet2MSG(nn.Module): def __init__(self, model_cfg, input_channels, **kwargs): supe...
code_fim
hard
{ "lang": "python", "repo": "dvlab-research/DeepVision3D", "path": "/OpenPCDet/pcdet/models/backbones_3d/pointnet2_backbone.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> xyz_batch_cnt = xyz.new_zeros(batch_size).int() for bs_idx in range(batch_size): xyz_batch_cnt[bs_idx] = (batch_idx == bs_idx).sum() assert xyz_batch_cnt.min() == xyz_batch_cnt.max() xyz = xyz.view(batch_size, -1, 3) features = features.view(batch_size,...
code_fim
hard
{ "lang": "python", "repo": "dvlab-research/DeepVision3D", "path": "/OpenPCDet/pcdet/models/backbones_3d/pointnet2_backbone.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass def run(self): subprocess.run( args=['npm', 'run', 'build'], cwd=os.path.join('.', 'extension'), stdout=sys.stdout, stderr=sys.stderr, ) with open(os.path.join('.', 'extension', 'local', 'credentials.json')) as f: ...
code_fim
hard
{ "lang": "python", "repo": "dair-targ/Korred", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dair-targ/Korred path: /setup.py import json import os from setuptools import setup, Command import subprocess import sys import glob import shutil class BuildWebExtensionCommand(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): <|...
code_fim
hard
{ "lang": "python", "repo": "dair-targ/Korred", "path": "/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # row_count = sum(1 for row in csv_reader) # message = 'Number of rows: {}\t'.format(row_count) # print(message) counter = 0 failed_rows = 0 # TODO: make this less hacky/kludgy and improve error handling + reporting if 'latest_export.csv' in csv_file: with open(csv_fil...
code_fim
hard
{ "lang": "python", "repo": "industrydive/sourcedive", "path": "/sources/management/commands/import_csv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: industrydive/sourcedive path: /sources/management/commands/import_csv.py import csv from datetime import datetime import sys from django.core.management.base import BaseCommand, CommandError from django.core.management import call_command from django.contrib.auth.models import User, Group from d...
code_fim
hard
{ "lang": "python", "repo": "industrydive/sourcedive", "path": "/sources/management/commands/import_csv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: svilen-ivanov/sgp path: /ep2/en/scenes/dynamic_programming.py from manim import * from numpy.random._generator import default_rng from ep2.scenes.description import Coin from ep2.scenes.utils import CyrTex import numpy as np random_points = [ [0.6942365002997297, 1.7215149309793558], [1...
code_fim
hard
{ "lang": "python", "repo": "svilen-ivanov/sgp", "path": "/ep2/en/scenes/dynamic_programming.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def construct(self): term_en = CyrTex(r"Dynamic Programming").scale(2) #term_bg = CyrTex(r"\foreignlanguage{bulgarian}{\textit{Динамично програмиране}}").scale(1.5) group = VGroup(term_en) self.play(FadeIn(term_en)) #term_bg.next_to(term_en, direction=DOWN) ...
code_fim
medium
{ "lang": "python", "repo": "svilen-ivanov/sgp", "path": "/ep2/en/scenes/dynamic_programming.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> photo = ImageMobject("Richard_Ernest_Bellman.jpg").set_height(6) title_below = CyrTex(r"\foreignlanguage{english}{Richard Ernest Bellman}") group2 = Group(photo, title_below) self.play(FadeIn(photo), photo.to_edge, UP) title_below.next_to(photo, direction=DOWN) ...
code_fim
hard
{ "lang": "python", "repo": "svilen-ivanov/sgp", "path": "/ep2/en/scenes/dynamic_programming.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns `fips` code of `cname`.""" return self.__call__(cname) def iso(self, cname: str)->str: """Returns `iso` code of `cname`.""" return self.like(cname, mx=1)[0]['ISO'] def name(self, cname: str)->str: """Returns a `str` of the first of country name ...
code_fim
hard
{ "lang": "python", "repo": "kdorichev/joshuaproject", "path": "/joshuaproject/countrycodes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kdorichev/joshuaproject path: /joshuaproject/countrycodes.py # AUTOGENERATED! DO NOT EDIT! File to edit: 01_countrycodes.ipynb (unless otherwise specified). __all__ = ['__doc__', 'CountryCodes'] # Cell __doc__ = """Country codes module""" import pandas as pd # Cell class CountryCodes(): ""...
code_fim
hard
{ "lang": "python", "repo": "kdorichev/joshuaproject", "path": "/joshuaproject/countrycodes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: darkLord19/GraphColoringPy path: /greedy_coloring.py from graph import Graph def get_chromatic_number(g): chromatic_number = 0 li = sorted(g.vertices, key=len, reverse=True) vertex_color_idx = {0:1} available = [True for i in range(0, g.V)] for i in range(1, g.V): ...
code_fim
medium
{ "lang": "python", "repo": "darkLord19/GraphColoringPy", "path": "/greedy_coloring.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in colored: if i==1: chromatic_number += 1 print(chromatic_number) return chromatic_number, vertex_color_idx<|fim_prefix|># repo: darkLord19/GraphColoringPy path: /greedy_coloring.py from graph import Graph def get_chromatic_number(g): chromatic_number = 0 ...
code_fim
medium
{ "lang": "python", "repo": "darkLord19/GraphColoringPy", "path": "/greedy_coloring.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oaao/smsos path: /smsos/classifiers/classifiers.py # classifiers from sklearn.calibration import CalibratedClassifierCV from sklearn.dummy import DummyClassifier from sklearn.ensemble import ( AdaBoostClassifier, BaggingClassifier, ExtraTreesClassifier, GradientBoostingClassifier,...
code_fim
medium
{ "lang": "python", "repo": "oaao/smsos", "path": "/smsos/classifiers/classifiers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>CLASSIFIERS = [ AdaBoostClassifier(), BaggingClassifier(), BernoulliNB(), CalibratedClassifierCV(), DecisionTreeClassifier(), DummyClassifier(), ExtraTreesClassifier(), GradientBoostingClassifier(), KNeighborsClassifier(), OneVsRestClassifier(LogisticRegression()), ...
code_fim
medium
{ "lang": "python", "repo": "oaao/smsos", "path": "/smsos/classifiers/classifiers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # embedded = [batch size, sent len, emb dim] # In PyTorch, RNNs want the input with the batch dimension second, whereas CNNs want the batch dimension first # - we do not have to permute the data here as we have already set batch_first = True in our TEXT field. # We then pa...
code_fim
hard
{ "lang": "python", "repo": "macabdul9/BloomNet", "path": "/models/baselines/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: macabdul9/BloomNet path: /models/baselines/CNN.py import torch import torch.nn as nn import torch.nn.functional as F #Source: https://github.com/RaffaeleGalliera/pytorch-cnn-text-classification/edit/master/model.py class CNNClassifier(nn.Module): def __init__(self, vocab_size, hidden_size=7...
code_fim
hard
{ "lang": "python", "repo": "macabdul9/BloomNet", "path": "/models/baselines/CNN.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> embedded = embedded.unsqueeze(1) # embedded = [batch size, 1, sent len, emb dim] conved = [F.relu(conv(embedded)).squeeze(3) for conv in self.convs] # conved_n = [batch size, n_filters, sent len - filter_sizes[n] + 1] pooled = [F.max_pool1d(conv, conv.shape[2])....
code_fim
hard
{ "lang": "python", "repo": "macabdul9/BloomNet", "path": "/models/baselines/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _prepare_insert_statement(self, columns: List[str]) -> str: query = ( self.db.query_class.into(self.model._meta.table()) .columns(*columns) .insert(*[self.parameter(i) for i in range(len(columns))]) ) query = query.returning(*self.model....
code_fim
medium
{ "lang": "python", "repo": "nextfit/tortoise-orm", "path": "/tortoise/backends/asyncpg/executor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nextfit/tortoise-orm path: /tortoise/backends/asyncpg/executor.py from typing import List, Optional import asyncpg from pypika import Parameter from tortoise.backends.base.executor import BaseExecutor from tortoise.models import Model <|fim_suffix|> query = query.returning(*self.model...
code_fim
hard
{ "lang": "python", "repo": "nextfit/tortoise-orm", "path": "/tortoise/backends/asyncpg/executor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def _process_insert_result(self, instance: Model, results: Optional[asyncpg.Record]): if results: col_to_field_name = instance._meta.db_column_to_field_name_map for column_name, val in zip(self.model._meta.generated_column_names, results): setattr(...
code_fim
hard
{ "lang": "python", "repo": "nextfit/tortoise-orm", "path": "/tortoise/backends/asyncpg/executor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: strayfluxinteractive/castrumserver path: /gameapi/serializers.py from django.forms import widgets from rest_framework import serializers from gameapi.models import World <|fim_suffix|> class Meta: model = World fields = ('id', 'created', 'title')<|fim_middle|>class WorldSerializer(seria...
code_fim
easy
{ "lang": "python", "repo": "strayfluxinteractive/castrumserver", "path": "/gameapi/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = World fields = ('id', 'created', 'title')<|fim_prefix|># repo: strayfluxinteractive/castrumserver path: /gameapi/serializers.py from django.forms import widgets from rest_framework import serializers from gameapi.models import World <|fim_middle|>class WorldSerializer(seria...
code_fim
easy
{ "lang": "python", "repo": "strayfluxinteractive/castrumserver", "path": "/gameapi/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class QueryQPaieLight(object): def __init__(self, chem_base): constr = 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=' + chem_base # Requ?te sur la db ListeEmployes sSQL_Emp = ("SELECT " "EM.Numero, " "CL....
code_fim
hard
{ "lang": "python", "repo": "nrollet/quadratools", "path": "/src/quadratools/quadrapaie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__ (self, chem_base, periode) : constr = 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=' + chem_base #per_access = periode.strftime('#%m/%d/%y#') # Requête sur la table DSN_EVT_ArretReprise sSQL = ("SELECT " "NumeroEmpl...
code_fim
hard
{ "lang": "python", "repo": "nrollet/quadratools", "path": "/src/quadratools/quadrapaie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nrollet/quadratools path: /src/quadratools/quadrapaie.py #!/usr/bin/env python3 # -*-coding:Utf-8 -* import pyodbc import logging import sys import os import pprint from collections import namedtuple from datetime import datetime, timedelta def add_one_month(dt0): dt1 = dt0.replace(day=1) ...
code_fim
hard
{ "lang": "python", "repo": "nrollet/quadratools", "path": "/src/quadratools/quadrapaie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheCoder777/Report-Booklet-Writer path: /models/message.py class MSG: """ Simple msg object that a<|fim_suffix|> def __init__(self, content, color): self.content = content self.color = color<|fim_middle|>cts as a message for the messagequeue. """
code_fim
easy
{ "lang": "python", "repo": "TheCoder777/Report-Booklet-Writer", "path": "/models/message.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>elf.content = content self.color = color<|fim_prefix|># repo: TheCoder777/Report-Booklet-Writer path: /models/message.py class MSG: """ Simple msg object that acts as a message for the messagequeue. """ <|fim_middle|> def __init__(self, content, color): s
code_fim
easy
{ "lang": "python", "repo": "TheCoder777/Report-Booklet-Writer", "path": "/models/message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # parse date parser = reqparse.RequestParser() parser.add_argument('date_start', default=datetime.now().replace(hour=0, second=0, minute...
code_fim
hard
{ "lang": "python", "repo": "Starfight/web-jrnl", "path": "/webjrnl/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Starfight/web-jrnl path: /webjrnl/api.py # -*- coding: utf-8 -*- import os from datetime import datetime from flask import Blueprint, jsonify from flask_restful import Api, Resource, abort, reqparse from webjrnl.utils import convert_to_datetime, get_journal BP = Blueprint('api', __name__, url_pr...
code_fim
hard
{ "lang": "python", "repo": "Starfight/web-jrnl", "path": "/webjrnl/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model.eval() val_logits = model(img, tab) oof.append(val_logits.data.cpu().numpy()) oof_targets.append(label.data.cpu().numpy()) # prepare mean over components oof = np.concatenate(oof, axis=0...
code_fim
hard
{ "lang": "python", "repo": "nicohrubec/trends_3d_resnet", "path": "/src/eval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicohrubec/trends_3d_resnet path: /src/eval.py import os import torch import numpy as np from src import configs from src.model import BaselineResnet from src.utils import weighted_nae_npy def eval_fold(val_loader, fold_index): device = torch.device("cuda:0" if torch.cuda.is_available() el...
code_fim
hard
{ "lang": "python", "repo": "nicohrubec/trends_3d_resnet", "path": "/src/eval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryangillard/misc path: /leetcode/283_move_zeroes/283_move_zeroes.py class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. """ self.slow_fast(nums) <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "ryangillard/misc", "path": "/leetcode/283_move_zeroes/283_move_zeroes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def slow_fast(self, nums): slow, fast = 0, 0 while slow <= fast and fast < len(nums): if nums[fast] != 0: nums[slow] = nums[fast] slow += 1 fast += 1 while slow < len(nums): nums[slow] = 0 slow +=...
code_fim
hard
{ "lang": "python", "repo": "ryangillard/misc", "path": "/leetcode/283_move_zeroes/283_move_zeroes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> slow, fast = 0, 0 while slow <= fast and fast < len(nums): if nums[fast] != 0: nums[slow] = nums[fast] slow += 1 fast += 1 while slow < len(nums): nums[slow] = 0 slow += 1<|fim_prefix|># repo: ryangil...
code_fim
hard
{ "lang": "python", "repo": "ryangillard/misc", "path": "/leetcode/283_move_zeroes/283_move_zeroes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }