text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: Alzpeta/oarepo-multilingual path: /oarepo_multilingual/mapping/mapping_handler.py # -*- coding: utf-8 -*- # """Simple test of version import.""" def handler(type=None, resource=None, id=None, json_pointer=None, <|fim_suffix|> default_template = app.config.get("ELASTICSEARCH_DEFAULT_LANGUAGE_TE...
code_fim
medium
{ "lang": "python", "repo": "Alzpeta/oarepo-multilingual", "path": "/oarepo_multilingual/mapping/mapping_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># n = int(input()) # naturalNumbers = list(number for number in range(1, n + 1)) # print(naturalNumbers)<|fim_prefix|># repo: anishLearnsToCode/python-workshop-6 path: /day_2/list_comrehension.py """ Generators { x^2 | x is a natural number} { x^2 | 1 <= x <= 8 } { 5x | x is an integr} <|fim_middle|>(ge...
code_fim
medium
{ "lang": "python", "repo": "anishLearnsToCode/python-workshop-6", "path": "/day_2/list_comrehension.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anishLearnsToCode/python-workshop-6 path: /day_2/list_comrehension.py """ Generators { x^2 | x is a natural number} { x^2 | 1 <= x <= 8 } { 5x | x is an integr} (generator(x) for x in iterable) --> generators are iterable """ <|fim_suffix|># n = int(input()) # naturalNumbers = list(number for n...
code_fim
medium
{ "lang": "python", "repo": "anishLearnsToCode/python-workshop-6", "path": "/day_2/list_comrehension.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n = int(input()) odd_even = list([number, 'even' if number % 2 == 0 else 'odd'] for number in range(0, n + 1)) print(odd_even) # n = int(input()) # naturalNumbers = list(number for number in range(1, n + 1)) # print(naturalNumbers)<|fim_prefix|># repo: anishLearnsToCode/python-workshop-6 path: /day_2/li...
code_fim
medium
{ "lang": "python", "repo": "anishLearnsToCode/python-workshop-6", "path": "/day_2/list_comrehension.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danmoz/openduty path: /apps/policies/models.py from django.db import models from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import Group from schedule....
code_fim
hard
{ "lang": "python", "repo": "danmoz/openduty", "path": "/apps/policies/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SchedulePolicyRule(models.Model): """ Schedule rule """ schedule_policy = models.ForeignKey('SchedulePolicy', related_name='rules', on_delete=models.CASCADE) position = models.IntegerField() user_id = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE, re...
code_fim
medium
{ "lang": "python", "repo": "danmoz/openduty", "path": "/apps/policies/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class SchedulePolicyRule(models.Model): """ Schedule rule """ schedule_policy = models.ForeignKey('SchedulePolicy', related_name='rules', on_delete=models.CASCADE) position = models.IntegerField() user_id = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE, r...
code_fim
hard
{ "lang": "python", "repo": "danmoz/openduty", "path": "/apps/policies/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CalculateHash(JobHandler): method = 'calculate_hash' Options = CalculateHashOptions def run(self, job: Job): logging.debug(job.to_json()) step = job.get_current_step() if step.options.path is not None: path = step.options.path else: ...
code_fim
medium
{ "lang": "python", "repo": "eblade/images7", "path": "/images7/job/calculate_hash.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: eblade/images7 path: /images7/job/calculate_hash.py #!/usr/bin/env python3 import os import logging import uuid import datetime from jsonobject import PropertySet, Property, register_schema from images7.job import JobHandler, Job, StepStatus, register_job_handler from images7.localfile import...
code_fim
medium
{ "lang": "python", "repo": "eblade/images7", "path": "/images7/job/calculate_hash.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/benchmark path: /userbenchmark/cpu/run_config.py """ Run PyTorch cpu benchmarking. """ import argparse import os import numpy from typing import List, Dict, Optional from pathlib import Path from cpu_utils import add_path, REPO_PATH, validate, parse_str_to_list, list_metrics, get_outpu...
code_fim
hard
{ "lang": "python", "repo": "pytorch/benchmark", "path": "/userbenchmark/cpu/run_config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def dump_result_to_json(metrics, output_dir): result = get_output_json(BM_NAME, metrics) dump_output(BM_NAME, result, output_dir) def run_config(config: TorchBenchModelConfig, metrics: List[str], dryrun: bool=False) -> Optional[TorchBenchModelMetrics]: """This function onl...
code_fim
hard
{ "lang": "python", "repo": "pytorch/benchmark", "path": "/userbenchmark/cpu/run_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run(args: List[str], extra_args: List[str]): device = validate(args.device, list_devices()) test = validate(args.test, list_tests()) model = validate(args.model, list_models()) metrics = validate(parse_str_to_list(args.metrics), list_metrics()) config = Torc...
code_fim
hard
{ "lang": "python", "repo": "pytorch/benchmark", "path": "/userbenchmark/cpu/run_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def body(self, out): if self.form.get('flush'): import app; reload(app) import components; reload(components) #out.write(self.login()) out.write(self.interfaces()) def login(self): usercell = ['User name: ', input(type='text', name='username')] ...
code_fim
hard
{ "lang": "python", "repo": "ankitadhandha/wedgechanges", "path": "/flamenco-1.0/python/Main.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ankitadhandha/wedgechanges path: /flamenco-1.0/python/Main.py # Copyright (c) 2004-2006 The Regents of the University of California. from Page import Page from app import users, tasks from html import * def findorcreate(store, name): if name in store: return store.index(name) el...
code_fim
hard
{ "lang": "python", "repo": "ankitadhandha/wedgechanges", "path": "/flamenco-1.0/python/Main.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return 'name="robots" content="noindex,nofollow"' def title(self): return 'Welcome to the Longitudinal Browser study' def body(self, out): if self.form.get('flush'): import app; reload(app) import components; reload(components) #out.write(s...
code_fim
hard
{ "lang": "python", "repo": "ankitadhandha/wedgechanges", "path": "/flamenco-1.0/python/Main.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>9) self.spline_wl.setFont(font) self.spline_wl.setMinimum(0.1) self.spline_wl.setMaximum(2.0) self.spline_wl.setSingleStep(0.1) self.spline_wl.setProperty("value", 0.5) self.spline_wl.setObjectName("spline_wl") self.gridLayout.addWidget(self.spline_w...
code_fim
hard
{ "lang": "python", "repo": "3fon3fonov/exostriker", "path": "/exostriker/lib/tdt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 3fon3fonov/exostriker path: /exostriker/lib/tdt.py on(icon) Detrend.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedKingdom)) self.gridLayout_2 = QtWidgets.QGridLayout(Detrend) self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout = ...
code_fim
hard
{ "lang": "python", "repo": "3fon3fonov/exostriker", "path": "/exostriker/lib/tdt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.spline_wl.setMinimum(0.1) self.spline_wl.setMaximum(2.0) self.spline_wl.setSingleStep(0.1) self.spline_wl.setProperty("value", 0.5) self.spline_wl.setObjectName("spline_wl") self.gridLayout.addWidget(self.spline_wl, 5, 3, 1, 1) self.radio_GPs = QtW...
code_fim
hard
{ "lang": "python", "repo": "3fon3fonov/exostriker", "path": "/exostriker/lib/tdt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LYZhelloworld/Leetcode path: /palindrome-linked-list/solution.py # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def isPalindrome(self, head): <|fim_suffix|> last = slow.next ...
code_fim
hard
{ "lang": "python", "repo": "LYZhelloworld/Leetcode", "path": "/palindrome-linked-list/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Inspired by: https://leetcode.com/problems/palindrome-linked-list/discuss/160547/Java-Solution-beat-99 if not head or not head.next: return True fast = slow = head while fast.next and fast.next.next: slow, fast = slow.next, fast.next.next last...
code_fim
medium
{ "lang": "python", "repo": "LYZhelloworld/Leetcode", "path": "/palindrome-linked-list/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not node.next: return node prevNode, temp = self.reverse(node.next), node.next temp.next = node node.next = None return prevNode<|fim_prefix|># repo: LYZhelloworld/Leetcode path: /palindrome-linked-list/solution.py # Definition for singly-linked list...
code_fim
hard
{ "lang": "python", "repo": "LYZhelloworld/Leetcode", "path": "/palindrome-linked-list/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> time = [] for din in range(len(ds_taux)): ctaux = ds_taux[din] #ctime = datetime.datetime.strptime(ctaux[taux_var].valid_time,'%Y%m%d_%H%M%S') ctime = datetime.datetime.strptime(str(ctaux['time'][0].values)[0:10],'%Y-%m-%d') time.append(ctime.strftime('%Y-%m-%d'))...
code_fim
hard
{ "lang": "python", "repo": "dtcenter/METplus", "path": "/parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Read in the weights of the filters filtx1,filtx2,filty1,filty2 = read_filters(filtx1fil,filtx2fil,filtx2fil,filty2fil) # Get Number of Obs per day spd = os.environ.get('OBS_PER_DAY',1) # Check for an output plot directory oplot_dir = os.environ.get('PLOT_OUTPUT_DIR','') if n...
code_fim
hard
{ "lang": "python", "repo": "dtcenter/METplus", "path": "/parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dtcenter/METplus path: /parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py #!/usr/bin/env python3 import xarray as xr import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import datetime import warnings import metcalcpy.c...
code_fim
hard
{ "lang": "python", "repo": "dtcenter/METplus", "path": "/parm/use_cases/model_applications/s2s_mjo/UserScript_obsCFSR_obsOnly_MJO_ENSO/mjo_enso_driver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> { 'win': { 'src/third_party/python_26': '/trunk/tools/third_party/python_26@66685', } }<|fim_prefix|># repo: cha63506/chromium-44 path: /chrome/test/functional.DEPS/DEPS deps = { 'src/chrome/test/data': '/trunk/src/chrome/test/data', 'src/chrome/test/pyautolib': '/trunk/src/chrome/test/pya...
code_fim
medium
{ "lang": "python", "repo": "cha63506/chromium-44", "path": "/chrome/test/functional.DEPS/DEPS", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cha63506/chromium-44 path: /chrome/test/functional.DEPS/DEPS deps = { 'src/chrome/test/data': '/trunk/src/chrome/test/data', 'src/chrome/test/pyautoli<|fim_suffix|>/functional', 'src/third_party/simplejson': '/trunk/src/third_party/simplejson', } deps_os = { 'win': { 'src/third_par...
code_fim
medium
{ "lang": "python", "repo": "cha63506/chromium-44", "path": "/chrome/test/functional.DEPS/DEPS", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/functional', 'src/third_party/simplejson': '/trunk/src/third_party/simplejson', } deps_os = { 'win': { 'src/third_party/python_26': '/trunk/tools/third_party/python_26@66685', } }<|fim_prefix|># repo: cha63506/chromium-44 path: /chrome/test/functional.DEPS/DEPS deps = { 'src/chrome/test/d...
code_fim
medium
{ "lang": "python", "repo": "cha63506/chromium-44", "path": "/chrome/test/functional.DEPS/DEPS", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: joorgej/tytus path: /parser/fase2/team28/controllers/symbol_table.py from utils.decorators import singleton from models.symbol import Symbol @singleton class SymbolTable(object): def __init__(self): self._idSymbol = 0 self._symbols = [] self._useDatabase = None <|fi...
code_fim
hard
{ "lang": "python", "repo": "joorgej/tytus", "path": "/parser/fase2/team28/controllers/symbol_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._symbols.append(Symbol(self._idSymbol, name, value, dataType, environment, references, line, column)) def delete(self, obj): for symbol in self._symbols: if symbol.name is obj: self._symbols.remove(symbol)<|fim_prefi...
code_fim
medium
{ "lang": "python", "repo": "joorgej/tytus", "path": "/parser/fase2/team28/controllers/symbol_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> blob_reader = blobstore.BlobReader(blob_info.key()) blob_iterator = BlobIterator(blob_reader) reader = csv.reader(blob_iterator) count = 0 for row in reader: count += 1 if count != 1: logging.info(len(fields)) logging.info(len(row)) c...
code_fim
hard
{ "lang": "python", "repo": "DuaneNClark/crisiscleanup", "path": "/sandy-disaster-recovery/upload_handler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not self.buffer or len(self.lines) == self.line_num + 1: self.buffer = self.blob_reader.read(1048576) # 1MB buffer self.lines = self.buffer.splitlines() self.line_num = 0 # Handle special case where our block just happens to end on a new line ...
code_fim
hard
{ "lang": "python", "repo": "DuaneNClark/crisiscleanup", "path": "/sandy-disaster-recovery/upload_handler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DuaneNClark/crisiscleanup path: /sandy-disaster-recovery/upload_handler.py import csv import webapp2 from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers from google.appengine.ext import db import site_db import event_db from datetime import dateti...
code_fim
hard
{ "lang": "python", "repo": "DuaneNClark/crisiscleanup", "path": "/sandy-disaster-recovery/upload_handler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ankur-gupta/flicker path: /flicker/tests/test_from_columns.py # Copyright 2020 Flicker Contributors # # 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": "ankur-gupta/flicker", "path": "/flicker/tests/test_from_columns.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> df = FlickerDataFrame.from_columns(spark, columns, names) assert df.shape == (3, 2) assert list(df.names) == list(names) for i, name in enumerate(df.names): column = df[[name]].to_pandas()[name].to_numpy() expected_column = np.array(columns[i]) assert np.all(column...
code_fim
hard
{ "lang": "python", "repo": "ankur-gupta/flicker", "path": "/flicker/tests/test_from_columns.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SherbazHashmi/HackathonServer path: /arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/features/__init__.py """ The arcgis.features module contains types and functions for working with features and feature layers in the GIS. Entities located in space with a geometrical representation (suc...
code_fim
hard
{ "lang": "python", "repo": "SherbazHashmi/HackathonServer", "path": "/arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/features/__init__.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ['Feature', 'FeatureSet', 'FeatureCollection', 'FeatureLayer', 'Table', 'FeatureLayerCollection'] try: from .geo import GeoAccessor, GeoSeriesAccessor __all__.extend(['GeoAccessor', 'GeoSeriesAccessor']) except ImportError: pass<|fim_prefix|># repo: Sherb...
code_fim
hard
{ "lang": "python", "repo": "SherbazHashmi/HackathonServer", "path": "/arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/features/__init__.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Optional C extension module for speeding up Genshi # Not activated by default on: # - PyPy (where it harms performance) _speedup_enable_default = 0 if is_pypy else 1 try: _speedup_enabled = int(os.getenv('GENSHI_BUILD_SPEEDUP', _speedup_enable_default)) except ValueError: import warnings war...
code_fim
hard
{ "lang": "python", "repo": "edgewall/genshi", "path": "/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: edgewall/genshi path: /setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2006-2010 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also av...
code_fim
hard
{ "lang": "python", "repo": "edgewall/genshi", "path": "/setup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def build_extension(self, ext): try: build_ext.build_extension(self, ext) global _speedup_available _speedup_available = True except CCompilerError: _etype, e, _tb = sys.exc_info() self._unavailable(e) def _unavailable(se...
code_fim
hard
{ "lang": "python", "repo": "edgewall/genshi", "path": "/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>s=10, max_digits=12, null=True)), ('dv3_ns1', models.DecimalField(decimal_places=10, max_digits=12, null=True)), ('dv4_ns1', models.DecimalField(decimal_places=10, max_digits=12, null=True)), ('jev_ns1', models.DecimalField(decimal_places=10, max_digits=12, ...
code_fim
hard
{ "lang": "python", "repo": "tmaunier/sboucru", "path": "/sboapp/migrations/0003_auto_20180504_0828.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n.PROTECT, primary_key=True, serialize=False, to='sboapp.Elisa')), ('sample_absorbance', models.DecimalField(decimal_places=3, max_digits=5, null=True)), ('negative_absorbance', models.DecimalField(decimal_places=3, max_digits=5, null=True)), ('positive_abso...
code_fim
hard
{ "lang": "python", "repo": "tmaunier/sboucru", "path": "/sboapp/migrations/0003_auto_20180504_0828.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmaunier/sboucru path: /sboapp/migrations/0003_auto_20180504_0828.py # Generated by Django 2.0.3 on 2018-05-04 08:28 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sboapp', '0002_auto_20180504_070...
code_fim
hard
{ "lang": "python", "repo": "tmaunier/sboucru", "path": "/sboapp/migrations/0003_auto_20180504_0828.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Turn off media player.""" self._media_title = None self._state = self._player.turn_off() def turn_on(self) -> None: """Turn off media player.""" self._state = self._player.turn_on() def media_play(self) -> None: """Play media player.""" ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/dunehd/media_player.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/dunehd/media_player.py """Dune HD implementation of the media player.""" from __future__ import annotations from typing import Any, Final from pdunehd import DuneHDPlayer from homeassistant.components.media_player import ( MediaPlayerEnti...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/dunehd/media_player.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Return the volume level of the media player (0..1).""" return int(self._state.get("playback_volume", 0)) / 100 @property def is_volume_muted(self) -> bool: """Return a boolean if volume is currently muted.""" return int(self._state.get("playback_mute", 0)) == 1 ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/dunehd/media_player.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shreyanikkam/Analysis-of-Consumer-Complaints-Dataset-Using-FoundationDB path: /bulk.py import csv import sys csv.field_size_limit(sys.maxsize) try: risk = open('Consumer_Complaints.csv', 'r').read() #find the file <|fim_suffix|> data = [] for row in reader: #print...
code_fim
hard
{ "lang": "python", "repo": "shreyanikkam/Analysis-of-Consumer-Complaints-Dataset-Using-FoundationDB", "path": "/bulk.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data = [] for row in reader: #print(', '.join(row) print row[3] for col in (1,18): data.append(row) data.append(col) for item in data: print(item) #print the rows and columns<|fim_prefix|># repo: shrey...
code_fim
hard
{ "lang": "python", "repo": "shreyanikkam/Analysis-of-Consumer-Complaints-Dataset-Using-FoundationDB", "path": "/bulk.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if parent is None: parent = self.root if isinstance(state_value, str): state_node = parent.states.get(state_value, None) if state_node is None: raise ValueError(f"State node {state_value} is missing") return [state_node] ...
code_fim
hard
{ "lang": "python", "repo": "statelyai/xstate-python", "path": "/xstate/machine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if state_node is None: raise ValueError(f"State node {state_value} is missing") return [state_node] configuration = [] for key in state_value.keys(): state_node = parent.states.get(key) configuration.append(state_node) ...
code_fim
hard
{ "lang": "python", "repo": "statelyai/xstate-python", "path": "/xstate/machine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: statelyai/xstate-python path: /xstate/machine.py from typing import Dict, List from xstate.algorithm import ( enter_states, get_configuration_from_state, macrostep, main_event_loop, ) from xstate.event import Event from xstate.state import State from xstate.state_node import Stat...
code_fim
hard
{ "lang": "python", "repo": "statelyai/xstate-python", "path": "/xstate/machine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image = Image.open(os.path.join(root_path, img_name)) im = np.array(image) #设定高斯函数的偏移 means = 0 #设定高斯函数的标准差 sigma = 25 #r通道 r = im[:,:,0].flatten() #g通道 g = im[:,:,1].flatten() #b通道 b = im[:,:,2].flatten() #计算新的像素值 for i in range(i...
code_fim
hard
{ "lang": "python", "repo": "swordzxz/INSRNet", "path": "/codes/data/data_augmention.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: swordzxz/INSRNet path: /codes/data/data_augmention.py import skimage import io,os import matplotlib.pyplot as plt from PIL import Image,ImageEnhance,ImageChops import cv2 import numpy as np import random #root_path为图像根目录,img_name为图像名字 def move(root_path,img_name,off): #平移,平移尺度为off ...
code_fim
hard
{ "lang": "python", "repo": "swordzxz/INSRNet", "path": "/codes/data/data_augmention.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> im[:,:,1] = g.reshape([im.shape[0],im.shape[1]]) im[:,:,2] = b.reshape([im.shape[0],im.shape[1]]) gaussian_image = gaussian_image = Image.fromarray(np.uint8(im)) return gaussian_image def randomColor(root_path, img_name): #随机颜色 """ 对图像进行颜色抖动 :param image: PIL的图像image ...
code_fim
hard
{ "lang": "python", "repo": "swordzxz/INSRNet", "path": "/codes/data/data_augmention.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jun-harashima/msnc path: /tests/test_average_encoder.py import unittest from unittest.mock import patch import torch import torch.nn as nn from msnc.encoder import AverageEncoder class TestAverageEncoder(unittest.TestCase): def assertTorchEqual(self, x, y): self.assertTrue(torch.eq...
code_fim
hard
{ "lang": "python", "repo": "jun-harashima/msnc", "path": "/tests/test_average_encoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with patch.object(self.model.embedding, 'weight', self.embedding_weight): X5 = self.model._embed(self.X4) self.assertTorchEqual(X5, self.X5) def test_average(self): print(self.model(self.X1)) ground_truth = [] for data...
code_fim
hard
{ "lang": "python", "repo": "jun-harashima/msnc", "path": "/tests/test_average_encoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in xrange(-10, 10): for y in xrange(-10, 10): p = mth.square(x, y) self.failUnless(p == x ** 2 + y ** 2 + 1, 'int test failed.') def test_floats(self): for x in xrange(-10, 10): for y in xrange(-10, 10): x *...
code_fim
medium
{ "lang": "python", "repo": "incidunt/python-labs", "path": "/learning/test/mth_ut.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_ints(self): for x in xrange(-10, 10): for y in xrange(-10, 10): p = mth.square(x, y) self.failUnless(p == x ** 2 + y ** 2 + 1, 'int test failed.') def test_floats(self): for x in xrange(-10, 10): for y in xrange(-10,...
code_fim
medium
{ "lang": "python", "repo": "incidunt/python-labs", "path": "/learning/test/mth_ut.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: incidunt/python-labs path: /learning/test/mth_ut.py # -*- coding: UTF-8 -*- __author__ = 'mcxiaoke' import unittest import mth <|fim_suffix|> def test_ints(self): for x in xrange(-10, 10): for y in xrange(-10, 10): p = mth.square(x, y) sel...
code_fim
medium
{ "lang": "python", "repo": "incidunt/python-labs", "path": "/learning/test/mth_ut.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: landlab/landlab path: /tests/components/stream_power/test_smooth_thresh.py import numpy as np import pytest from numpy.testing import assert_array_almost_equal from landlab import RasterModelGrid from landlab.components import FlowAccumulator, StreamPowerSmoothThresholdEroder as Spst def test_...
code_fim
hard
{ "lang": "python", "repo": "landlab/landlab", "path": "/tests/components/stream_power/test_smooth_thresh.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> predicted_slopes = (U / (K * (actual_areas**m))) ** (1.0 / n) assert_array_almost_equal(actual_slopes, predicted_slopes) def test_with_thresh(): K = 0.001 U = 0.01 m = 0.5 n = 1.0 threshold = 1.0 dt = 1000 mg = RasterModelGrid((30, 3), xy_spacing=100.0) mg.set_c...
code_fim
hard
{ "lang": "python", "repo": "landlab/landlab", "path": "/tests/components/stream_power/test_smooth_thresh.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("NEW GAME") board = Board() view = Console() is_player1 = True view.display_board(board) while not board.is_finished(): if is_player1: move = self.p1.get_player_input(board) else: move = self.p2....
code_fim
hard
{ "lang": "python", "repo": "AlanCLo/play_ml", "path": "/aigames/aigames/games/ttt/game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlanCLo/play_ml path: /aigames/aigames/games/ttt/game.py from .board import Board from .player import PlayerFactory from .console import Console from .minmaxplayer import MinMaxPlayer <|fim_suffix|> board = Board() view = Console() is_player1 = True view.display_b...
code_fim
hard
{ "lang": "python", "repo": "AlanCLo/play_ml", "path": "/aigames/aigames/games/ttt/game.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return PlayerFactory().player_type_list() def get_default_ai_player(): return MinMaxPlayer.__name__ def __init__(self, p1, p2, save, save_file): self.p1 = PlayerFactory().CreatePlayer(p1, True) self.p2 = PlayerFactory().CreatePlayer(p2, False) self.save = ...
code_fim
medium
{ "lang": "python", "repo": "AlanCLo/play_ml", "path": "/aigames/aigames/games/ttt/game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r2rahul/thresholdOut-explorations path: /thresholdOut_mydemo_paramTuning.py import numpy as np import pandas as pd from scipy.stats import zscore from sklearn.linear_model import LogisticRegression, LassoLars from tqdm import tqdm import matplotlib.pyplot as plt import seaborn as sb def create...
code_fim
hard
{ "lang": "python", "repo": "r2rahul/thresholdOut-explorations", "path": "/thresholdOut_mydemo_paramTuning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fitModels_paramTuning(n, d, grid_size, no_signal=False, tho_scale=0.1, is_classification=True): dataset = createDataset(n, d=d, d_inf=10, is_classification=True, no_signal=no_signal) best_perf_std = [-np.inf, -np.inf, -np.inf] ...
code_fim
hard
{ "lang": "python", "repo": "r2rahul/thresholdOut-explorations", "path": "/thresholdOut_mydemo_paramTuning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> highdig1 = -1 pos1 = -1 ind1,ind2 = beg1,beg2 while N1-ind1+N2-beg2 >= k and ind1 < N1: if nums1[ind1] > highdig1: highdig1 = nums1[ind1] pos1 = ind1 ind1 += 1 highdig2 = -1 pos2 = -1 while N1-b...
code_fim
hard
{ "lang": "python", "repo": "yingcuhk/LeetCode", "path": "/Algorithms/#321 Create Maximum Number/PythonCode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yingcuhk/LeetCode path: /Algorithms/#321 Create Maximum Number/PythonCode.py """ Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the digits from the same array must be preser...
code_fim
hard
{ "lang": "python", "repo": "yingcuhk/LeetCode", "path": "/Algorithms/#321 Create Maximum Number/PythonCode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if k == 0: return [] highdig1 = -1 pos1 = -1 ind1,ind2 = beg1,beg2 while N1-ind1+N2-beg2 >= k and ind1 < N1: if nums1[ind1] > highdig1: highdig1 = nums1[ind1] pos1 = ind1 ind1 += 1 ...
code_fim
hard
{ "lang": "python", "repo": "yingcuhk/LeetCode", "path": "/Algorithms/#321 Create Maximum Number/PythonCode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pepkit/pephub path: /pephub/routers/eido/eido.py import eido import requests import tempfile import peppy import shutil import yaml from fastapi import UploadFile, Form, APIRouter from starlette.requests import Request from starlette.responses import JSONResponse from typing import List, Tuple f...
code_fim
hard
{ "lang": "python", "repo": "pepkit/pephub", "path": "/pephub/routers/eido/eido.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # save any other files the user might have supplied if other_files is not None: for upload_file in other_files: # open new file inside the tmpdir with open(f"{dirpath}/{upload_file.filename}", "wb") as local_tmpf: ...
code_fim
hard
{ "lang": "python", "repo": "pepkit/pephub", "path": "/pephub/routers/eido/eido.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # create temp dir that gets deleted when we're done with tempfile.TemporaryDirectory() as dirpath: # save init file with open(f"{dirpath}/{init_file.filename}", "wb") as cfg_fh: shutil.copyfileobj(init_file.file, cfg_fh) # save any other...
code_fim
hard
{ "lang": "python", "repo": "pepkit/pephub", "path": "/pephub/routers/eido/eido.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/model-analysis path: /tensorflow_model_analysis/metrics/calibration.py # Copyright 2019 Google LLC # # 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 # # ht...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/model-analysis", "path": "/tensorflow_model_analysis/metrics/calibration.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _calibration( name: str = CALIBRATION_NAME, eval_config: Optional[config_pb2.EvalConfig] = None, model_name: str = '', output_name: str = '', sub_key: Optional[metric_types.SubKey] = None, aggregation_type: Optional[metric_types.AggregationType] = None, class_weights: Opti...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/model-analysis", "path": "/tensorflow_model_analysis/metrics/calibration.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not hasattr(cls, '_instance'): org = super(singleton, cls) cls._instance = org.__new__(cls, *args, **kw) return cls._instance # test code if __name__ == '__main__': class MyClass(singleton): def __init__(self, name): self.name = name ...
code_fim
easy
{ "lang": "python", "repo": "pusidun/cicn2-py", "path": "/02_Singleton/singleton_01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pusidun/cicn2-py path: /02_Singleton/singleton_01.py # /usr/bin/env python3 # -*- coding: utf-8 -*- class singleton(object): <|fim_suffix|># test code if __name__ == '__main__': class MyClass(singleton): def __init__(self, name): self.name = name a = MyClass('a') ...
code_fim
hard
{ "lang": "python", "repo": "pusidun/cicn2-py", "path": "/02_Singleton/singleton_01.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a = MyClass('a') b = MyClass('b') print(a.name) print(b.name)<|fim_prefix|># repo: pusidun/cicn2-py path: /02_Singleton/singleton_01.py # /usr/bin/env python3 # -*- coding: utf-8 -*- class singleton(object): def __new__(cls, *args, **kw): if not hasattr(cls, '_instance'): ...
code_fim
medium
{ "lang": "python", "repo": "pusidun/cicn2-py", "path": "/02_Singleton/singleton_01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if options.get("loop"): while True: self.check_trustlines() time.sleep(60) else: self.check_trustlines() def check_trustlines(self): """ Create Stellar transaction for deposit transactions marked as pending trust,...
code_fim
hard
{ "lang": "python", "repo": "vcarl/django-polaris", "path": "/polaris/polaris/management/commands/check_trustlines.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vcarl/django-polaris path: /polaris/polaris/management/commands/check_trustlines.py import time import logging from polaris import settings from django.core.management.base import BaseCommand, CommandError from django.core.management import call_command from stellar_sdk.exceptions import BaseHor...
code_fim
hard
{ "lang": "python", "repo": "vcarl/django-polaris", "path": "/polaris/polaris/management/commands/check_trustlines.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # pixel weighting self.cbxPixelWeighting = QComboBox() self.cbxPixelWeighting.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.cbxPixelWeighting.addItems([str(pw.name) for pw in common.PixelWeighting]) boxPixelWeighting = QHBoxLayout() boxPixelWeighting....
code_fim
hard
{ "lang": "python", "repo": "spectralskylight/spectralskyviewer", "path": "/dialog_export.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: spectralskylight/spectralskyviewer path: /dialog_export.py #!/usr/bin/python # -*- coding: utf-8 -*- # ==================================================================== # @author: Joe Del Rocco # @since: 11/16/2017 # @summary: Dialog for exporting sky data. # ==================================...
code_fim
hard
{ "lang": "python", "repo": "spectralskylight/spectralskyviewer", "path": "/dialog_export.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @_is_available def body_info(self): return self._task_mgr.get_body_info(self._tid_list) @_is_available def pause(self): self._task_mgr.pause(self._tid_list) @_is_available def is_finished(self): return self._task_mgr.is_finished(self._tid_list) def wa...
code_fim
hard
{ "lang": "python", "repo": "625781186/Nbdler", "path": "/nbdler/manager/struct/task.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 625781186/Nbdler path: /nbdler/manager/struct/task.py # -*- coding: UTF-8 -*- from ...error import SubprocessUnavailableError from functools import wraps from threading import Event from time import time class TasksManagerForWorkers: """ 工作线程维护的一个任务管理器。""" __slots__ = '_id_tasks' d...
code_fim
hard
{ "lang": "python", "repo": "625781186/Nbdler", "path": "/nbdler/manager/struct/task.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._task_mgr.increment_done(self._tid_list, each) @_is_available def realtime_info(self, each=False): return self._task_mgr.get_realtime_info(self._tid_list, each) @_is_available def body_info(self): return self._task_mgr.get_body_info(self._tid_list) ...
code_fim
hard
{ "lang": "python", "repo": "625781186/Nbdler", "path": "/nbdler/manager/struct/task.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Summerotter/dawnofworlds path: /app/game/views.py active_world=world, form=form, players=players, avatars=avatars, cost = point_costs[world.age]['Create Avatar'], ...
code_fim
hard
{ "lang": "python", "repo": "Summerotter/dawnofworlds", "path": "/app/game/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Summerotter/dawnofworlds path: /app/game/views.py 'Sugar Glider', 'Possum', 'Ram', 'Dalmatian', 'Goat', 'Stallion', 'Horse', 'Sheep', 'Pig', 'Mouse', 'GuineaPig', 'Elephant', 'Gazelle', 'Gazebo', 'Boar', 'Deer', 'Caribou', 'Terrier', 'Boxer', 'Corgi', 'Golden Retriever', 'Reindeer', 'Great Dane'...
code_fim
hard
{ "lang": "python", "repo": "Summerotter/dawnofworlds", "path": "/app/game/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def single_location(location_id): world_check() world = World.query.get(session['active_world']) location = WorldMap.query.get(location_id) points = current_user.return_points_obj(world.id) terrain_form = ChangeTerrain(prefix="terrain") spawn_race = SpawnRace(prefix="spawnrace") ...
code_fim
hard
{ "lang": "python", "repo": "Summerotter/dawnofworlds", "path": "/app/game/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tatubola/xpto path: /ipaxi/ixbr_api/core/templatetags/core_filters.py from django import template <|fim_suffix|> @register.filter(name='lookup') def lookup(value, arg): return value[arg] # # # @register.filter(name='lookupIPv6') # def lookupIPv6(value, arg): # return value[arg]<|fim_midd...
code_fim
easy
{ "lang": "python", "repo": "tatubola/xpto", "path": "/ipaxi/ixbr_api/core/templatetags/core_filters.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return value[arg] # # # @register.filter(name='lookupIPv6') # def lookupIPv6(value, arg): # return value[arg]<|fim_prefix|># repo: tatubola/xpto path: /ipaxi/ixbr_api/core/templatetags/core_filters.py from django import template register = template.Library() <|fim_middle|> @register.filter(name...
code_fim
easy
{ "lang": "python", "repo": "tatubola/xpto", "path": "/ipaxi/ixbr_api/core/templatetags/core_filters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tune-andyp/android-play-billing path: /release/keygen.py #!/usr/bin/env python """ This script will generate the example application keys Example: Generate the keys $ python keygen.py <filename> """ import json import sys if len(sys.argv) == 1: # Print usage... print "Usage: " + sys...
code_fim
easy
{ "lang": "python", "repo": "tune-andyp/android-play-billing", "path": "/release/keygen.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>package = data["package"] key = package.encode('rot13').encode('base64') print "Key Alias: SampleKey" print "Key: " + key<|fim_prefix|># repo: tune-andyp/android-play-billing path: /release/keygen.py #!/usr/bin/env python """ This script will generate the example application keys <|fim_middle|>Example:...
code_fim
hard
{ "lang": "python", "repo": "tune-andyp/android-play-billing", "path": "/release/keygen.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with open(sys.argv[1], 'r') as my_file: data = json.load(my_file) package = data["package"] key = package.encode('rot13').encode('base64') print "Key Alias: SampleKey" print "Key: " + key<|fim_prefix|># repo: tune-andyp/android-play-billing path: /release/keygen.py #!/usr/bin/env python """ This scrip...
code_fim
medium
{ "lang": "python", "repo": "tune-andyp/android-play-billing", "path": "/release/keygen.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: okn-yu/Gasyori100knock path: /Question_01_10/my_answers/answer1.py import cv2 img = cv2.imread("imori.jpg") #print(img.shape) # (128, 128, 3) #print(img[0][0]) # [132 80 67] = (B, G ,R) <|fim_suffix|># 一言メモ # 各ピクセルの(x, y)座標に対して、RGBではなくてBGR毎に値を持っている # b, g, rを個別にもとめてもよいが直接値を交換したほうがシンプルに実装できる<|f...
code_fim
hard
{ "lang": "python", "repo": "okn-yu/Gasyori100knock", "path": "/Question_01_10/my_answers/answer1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows() # 一言メモ # 各ピクセルの(x, y)座標に対して、RGBではなくてBGR毎に値を持っている # b, g, rを個別にもとめてもよいが直接値を交換したほうがシンプルに実装できる<|fim_prefix|># repo: okn-yu/Gasyori100knock path: /Question_01_10/my_answers/answer1.py import cv2 img = cv2.imread("imori.jpg") #print(img.shape)...
code_fim
medium
{ "lang": "python", "repo": "okn-yu/Gasyori100knock", "path": "/Question_01_10/my_answers/answer1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if importlib.util.find_spec("psutil"): # psutil is optional and must only be imported if it is installed import psutil self.psutil = psutil else: self.psutil = None def is_supported(self) -> bool: return self.psutil is not None ...
code_fim
hard
{ "lang": "python", "repo": "michaelyaakoby/pyctuator", "path": "/pyctuator/health/diskspace_health_impl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaelyaakoby/pyctuator path: /pyctuator/health/diskspace_health_impl.py # pylint: disable=import-outside-toplevel import importlib.util from dataclasses import dataclass from pyctuator.health.health_provider import HealthProvider, HealthDetails, HealthStatus, Status <|fim_suffix|> class Disk...
code_fim
hard
{ "lang": "python", "repo": "michaelyaakoby/pyctuator", "path": "/pyctuator/health/diskspace_health_impl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sevazhidkov/greenland path: /maps/api/urls.py from django.conf.urls import url from . import views urlpatterns = [ url(r'^question_set_list/', views.<|fim_suffix|>ile), url(r'^map_area/', views.create_map_area), url(r'^question_set/', views.create_question_set), ]<|fim_middle|>questi...
code_fim
hard
{ "lang": "python", "repo": "sevazhidkov/greenland", "path": "/maps/api/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ile), url(r'^map_area/', views.create_map_area), url(r'^question_set/', views.create_question_set), ]<|fim_prefix|># repo: sevazhidkov/greenland path: /maps/api/urls.py from django.conf.urls import url from . import views urlpatterns = [ url(r'^question_set_list/', views.question_set_list), ...
code_fim
medium
{ "lang": "python", "repo": "sevazhidkov/greenland", "path": "/maps/api/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/built-in/nlp/Bert-CRF_for_PyTorch/examples/sentence_classfication/Tianchi_News_Classification/convert.py # -*- coding: utf-8 -*- # BSD 3-Clause License # # Copyright (c) 2017 # All rights reserved. # Copyright 2022 Huawei Technologies Co., Ltd # # Redistribu...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/nlp/Bert-CRF_for_PyTorch/examples/sentence_classfication/Tianchi_News_Classification/convert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>tf_path = 'E:/Github/天池新闻分类/top1/pre_models/bert_model.ckpt' torch_state_dict = {} mapping = { 'bert/embeddings/word_embeddings': 'bert.embeddings.word_embeddings.weight', 'bert/embeddings/token_type_embeddings': 'bert.embeddings.token_type_embeddings.weight', 'bert/embeddings/position_embedd...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/nlp/Bert-CRF_for_PyTorch/examples/sentence_classfication/Tianchi_News_Classification/convert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(12): prefix = 'bert/encoder/layer_%d/' % i prefix_i = f'bert.encoder.layer.%d.' % i mapping.update({ prefix + 'attention/self/query/kernel': prefix_i + 'attention.self.query.weight##T', prefix + 'attention/self/query/bias': prefix_i + 'attention.self.query.bias',...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/nlp/Bert-CRF_for_PyTorch/examples/sentence_classfication/Tianchi_News_Classification/convert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }