text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> name = "NISTSchema-SV-IV-list-date-pattern-4" namespace = "NISTSchema-SV-IV-list-date-pattern-4-NS" value: List[str] = field( default_factory=list, metadata={ "pattern": r"20\d\d-\d0-1\d \d\d75-\d5-2\d \d\d34-0\d-2\d 19\d\d-0\d-\d4 \d\d09-0\d-\d6 19\d\d-\d3...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/date/schema_instance/nistschema_sv_iv_list_date_pattern_4_xsd/nistschema_sv_iv_list_date_pattern_4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/date/schema_instance/nistschema_sv_iv_list_date_pattern_4_xsd/nistschema_sv_iv_list_date_pattern_4.py from dataclasses import dataclass, field from typing import List __NAMESPACE__ = "NISTSchema-SV-IV-list-date-pattern-4-NS" <|fim_s...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/date/schema_instance/nistschema_sv_iv_list_date_pattern_4_xsd/nistschema_sv_iv_list_date_pattern_4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # It is a valid link; follow it lnk.clicks += 1 lnk.last_click = timezone.now() lnk.save() # redirect return redirect(lnk.url)<|fim_prefix|># repo: ethanperez/t4k-rms path: /adminlinks/views.py from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from dja...
code_fim
hard
{ "lang": "python", "repo": "ethanperez/t4k-rms", "path": "/adminlinks/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ethanperez/t4k-rms path: /adminlinks/views.py from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.core.exceptions import ObjectDoesNotExist from django.utils import timezone from riders.models import T...
code_fim
medium
{ "lang": "python", "repo": "ethanperez/t4k-rms", "path": "/adminlinks/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # See if the link is available try: lnk = Link.objects.get(short_link = dalink) except ObjectDoesNotExist: return redirect(default) # It is a valid link; follow it lnk.clicks += 1 lnk.last_click = timezone.now() lnk.save() # redirect return redirect(lnk.url)<|fim_prefix|># rep...
code_fim
medium
{ "lang": "python", "repo": "ethanperez/t4k-rms", "path": "/adminlinks/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ehfeng/sentrycli path: /sentrycli/group.py from collections import Counter from datetime import datetime from itertools import izip_longest import json import logging from argh import arg, dispatching, CommandError from prettytable import PrettyTable from progressbar import ProgressBar from sent...
code_fim
hard
{ "lang": "python", "repo": "ehfeng/sentrycli", "path": "/sentrycli/group.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Group events by creation time. :param events: events to group :type: list :param mode: grouping mode (daily or monthly) :type: str """ counter = Counter() total = 0 for event in events: if mode == 'daily': day = event.ctime.day elif ...
code_fim
hard
{ "lang": "python", "repo": "ehfeng/sentrycli", "path": "/sentrycli/group.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if res is not None: meta[(T_VAR, var)] = res break value = tuple(meta.get(key) for key in keys) values[value] += 1 progress_bar.update(index) print_grouping([key[1] for key in keys], values) de...
code_fim
hard
{ "lang": "python", "repo": "ehfeng/sentrycli", "path": "/sentrycli/group.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def testRepr(self) -> None: self.assertEqual(str(self.constraint), self.constraint_repr) def testValidate(self) -> None: self.assertTrue(self.constraint.check({"x": 0, "y": 1})) self.assertTrue(self.constraint.check({"x": 1, "y": 1})) self.assertFalse(self.constrai...
code_fim
hard
{ "lang": "python", "repo": "facebook/Ax", "path": "/ax/core/tests/test_parameter_constraint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebook/Ax path: /ax/core/tests/test_parameter_constraint.py #!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from ax.core.parameter import ( ...
code_fim
hard
{ "lang": "python", "repo": "facebook/Ax", "path": "/ax/core/tests/test_parameter_constraint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output1 = 0 output2 = np.sqrt(4 / 55) assert output1 == theils_u2_error(y_true, y_pred1) assert output2 == theils_u2_error(y_true, y_pred2) with pytest.raises(ValueError): assert theils_u1_error(y_true, y_pred3)<|fim_prefix|># repo: zy82621239/wind_pow...
code_fim
hard
{ "lang": "python", "repo": "zy82621239/wind_power_forecasting", "path": "/wind_power_forecasting/metrics/tests/test_regression.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zy82621239/wind_power_forecasting path: /wind_power_forecasting/metrics/tests/test_regression.py import numpy as np import pytest from wind_power_forecasting.metrics.regression import theils_u1_error, theils_u2_error <|fim_suffix|> assert output1 == theils_u1_error(y_true, y_pred1) ...
code_fim
hard
{ "lang": "python", "repo": "zy82621239/wind_power_forecasting", "path": "/wind_power_forecasting/metrics/tests/test_regression.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: isakib/moztrap path: /tests/model/library/api/test_suite_resource.py """ Tests for SuiteResource api. """ import json from tests import case from tests.case.api.crud import ApiCrudCases class SuiteResourceTest(ApiCrudCases): """Please see the test cases implemented in tests.case.api.ApiCr...
code_fim
hard
{ "lang": "python", "repo": "isakib/moztrap", "path": "/tests/model/library/api/test_suite_resource.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """List of fields that are required for create but read-only for update.""" return ["product"] # additional test cases, if any class SuiteSelectionResourceTest(case.api.ApiTestCase): @property def factory(self): """The model factory for this object.""" retu...
code_fim
hard
{ "lang": "python", "repo": "isakib/moztrap", "path": "/tests/model/library/api/test_suite_resource.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheoryDivision/EvolutionarySteering path: /commutativity_test.py #==============================================================================# # Daniel Nichol - 08/06/2015. # # We generate 100 (in the paper this is 10^6, computed using a cluster) # pairs of markov chain transition matrices for...
code_fim
hard
{ "lang": "python", "repo": "TheoryDivision/EvolutionarySteering", "path": "/commutativity_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> K_1 = random.randint(0,N-1) K_2 = random.randint(0,N-1) l_1 = generateNKLandscape(N,K_1) l_2 = generateNKLandscape(N,K_2) limit_1 = markovModel.limitMatrix(markovModel.buildTransitionMatrix(l_1)) limit_2 = markovModel.limitMatrix(markovModel.buildTransitionMatrix(l_2)) if (limit_1*limit_2 == lim...
code_fim
medium
{ "lang": "python", "repo": "TheoryDivision/EvolutionarySteering", "path": "/commutativity_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: netbox-community/netbox path: /netbox/ipam/management/commands/rebuild_prefixes.py from django.core.management.base import BaseCommand from ipam.models import Prefix, VRF from ipam.utils import rebuild_prefixes class Command(BaseCommand): help = "Rebuild the prefix hierarchy (depth and chi...
code_fim
medium
{ "lang": "python", "repo": "netbox-community/netbox", "path": "/netbox/ipam/management/commands/rebuild_prefixes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.stdout.write(f'Rebuilding {Prefix.objects.count()} prefixes...') # Reset existing counts Prefix.objects.update(_depth=0, _children=0) # Rebuild the global table global_count = Prefix.objects.filter(vrf__isnull=True).count() self.stdout.write(f'Global:...
code_fim
medium
{ "lang": "python", "repo": "netbox-community/netbox", "path": "/netbox/ipam/management/commands/rebuild_prefixes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in branch[v]: if not check[i]: check[i] = True queue.appendleft(i) ans[i] = 1 if ans[v] == 0 else 0 for i in range(q): c, d = map(int, input().split()) if ans[c - 1] == ans[d - 1]: print('Town') else: print...
code_fim
medium
{ "lang": "python", "repo": "NULLCT/LOMC", "path": "/src/data/359.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NULLCT/LOMC path: /src/data/359.py from collections import deque n, q = map(int, input().split()) branch = [[] for i in range(n)] <|fim_suffix|> ans[i] = 1 if ans[v] == 0 else 0 for i in range(q): c, d = map(int, input().split()) if ans[c - 1] == ans[d - 1]: print('...
code_fim
hard
{ "lang": "python", "repo": "NULLCT/LOMC", "path": "/src/data/359.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""") test.not_up_to_date(arguments = arguments) test.up_to_date(arguments = arguments) test.write(['p', 'submodule2.d'], """\ module p.submodule2; int something_else; """) test.not_up_to_date(arguments = arguments) test.up_to_date(arguments = arguments) test.pass_test() # Local Variables: # tab-wi...
code_fim
hard
{ "lang": "python", "repo": "SCons/scons", "path": "/test/D/Scanner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SCons/scons path: /test/D/Scanner.py #!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without ...
code_fim
hard
{ "lang": "python", "repo": "SCons/scons", "path": "/test/D/Scanner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>test.up_to_date(arguments = arguments) test.write(['p', 'submodule2.d'], """\ module p.submodule2; int something_else; """) test.not_up_to_date(arguments = arguments) test.up_to_date(arguments = arguments) test.pass_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set exp...
code_fim
hard
{ "lang": "python", "repo": "SCons/scons", "path": "/test/D/Scanner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print_every = config.print_every eval_every = config.eval_every train_data_dir, dev_data_dir = [], [] # integrate the two tasks into one dataset using task_type = 'ab' if 'a' in task_type: for task in task_a: train_data_dir.append(data_dir + task + '/train.txt') ...
code_fim
hard
{ "lang": "python", "repo": "caofaxin/2021-Sohu-Text-Matching-TOP2", "path": "/sohu_matching/src/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: caofaxin/2021-Sohu-Text-Matching-TOP2 path: /sohu_matching/src/train.py from model import BertClassifierSingleModel, NezhaClassifierSingleModel, BertClassifierTextCNNSingleModel from data import SentencePairDataset, SentencePairDatasetWithType from utils import pad_to_maxlen, focal_loss, FGM from...
code_fim
hard
{ "lang": "python", "repo": "caofaxin/2021-Sohu-Text-Matching-TOP2", "path": "/sohu_matching/src/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> acc_b = metrics.accuracy_score(total_gt_b, total_preds_b) if len(total_gt_b)!=0 else 0 f1_b = metrics.f1_score(total_gt_b, total_preds_b, zero_division=0) if (f1_b == 0): print("F1_b = 0, checking precision, recall, fscore and support...") print(metrics.precision_recall_fscore_...
code_fim
hard
{ "lang": "python", "repo": "caofaxin/2021-Sohu-Text-Matching-TOP2", "path": "/sohu_matching/src/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return { "calibration": bool(data[1] & 0b01000000) if data else None, "battery": data[2] & 0b01111111 if data else None, "inMotion": _in_motion, "position": (100 - _position) if reverse else _position, "lightLevel": _light_level, "deviceChain": _device_c...
code_fim
hard
{ "lang": "python", "repo": "Danielhiversen/pySwitchbot", "path": "/switchbot/adv_parsers/curtain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Danielhiversen/pySwitchbot path: /switchbot/adv_parsers/curtain.py """Library to handle connection with Switchbot.""" from __future__ import annotations def process_wocurtain( data: bytes | None, mfr_data: bytes | None, reverse: bool = True ) -> dict[str, bool | int]: """Process woCurta...
code_fim
hard
{ "lang": "python", "repo": "Danielhiversen/pySwitchbot", "path": "/switchbot/adv_parsers/curtain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tedder/newsblur-hyperupdater path: /update.py #!/usr/bin/python import grequests for x in xrange(0,100000): print "%i - %i" % (x*100, (x+1)*100) reqs = (grequests.get("http://newsblur.com/reader/feed/%i" % y, headers={'User-Agent':<|fim_suffix|>rkaround-for-feeds-not-updating"}) for y in xr...
code_fim
medium
{ "lang": "python", "repo": "tedder/newsblur-hyperupdater", "path": "/update.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rkaround-for-feeds-not-updating"}) for y in xrange(x*100,(x+1)*100)) print grequests.map(reqs)<|fim_prefix|># repo: tedder/newsblur-hyperupdater path: /update.py #!/usr/bin/python import grequests for x in xrange(0,100000): print "%i - %i" % (x*100, (x+<|fim_middle|>1)*100) reqs = (grequests.get(...
code_fim
medium
{ "lang": "python", "repo": "tedder/newsblur-hyperupdater", "path": "/update.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eterevsky/goban path: /game.py from goban import run_game, GtpEngine # gnugo = GtpEngine(['gnugo-3.8/gnugo.exe', '--mode', 'gtp']) leela1 = GtpEngine(['leela-zero-0.17-win64/leelaz.exe', '-g', '--noponder', '-w', 'networks/57499cb9d2f90d5a0c2b1fbd2905a77093a02006bc3620cc69af78...
code_fim
hard
{ "lang": "python", "repo": "eterevsky/goban", "path": "/game.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>becc10a7e147d3cb9c5177a45d3659f95856cd7199d98d0f9ecaf156e.gz', '--precision', 'single', '-b', '0']) run_game(leela1, leela2)<|fim_prefix|># repo: eterevsky/goban path: /game.py from goban import run_game, GtpEngine # gnugo = GtpEngine(['gnugo-3.8/gnugo.exe', '--mode', 'gtp']) leela1 ...
code_fim
hard
{ "lang": "python", "repo": "eterevsky/goban", "path": "/game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hawwestin/MSR.APO path: /gui/operations/OperationsLinear/binary_operation.py """ Binaryzacja """ import logging import tkinter as tk import cv2 from cv2 import * from gui.operations.operation_template import OperationTemplate from gui.tabpicture import TabPicture class OperationLightThreshold...
code_fim
hard
{ "lang": "python", "repo": "hawwestin/MSR.APO", "path": "/gui/operations/OperationsLinear/binary_operation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tto_v = tk.StringVar() tto_v.set('Binary') type_label = tk.Label(self.plugins, text="Typ progowania") type_label.grid(column=0, row=0) thresh_options = tk.OptionMenu(self.plugins, tto_v, *OperationLightThreshold.thresholdTypeOptions.keys()) thresh_options....
code_fim
hard
{ "lang": "python", "repo": "hawwestin/MSR.APO", "path": "/gui/operations/OperationsLinear/binary_operation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def threshold(x): try: self.tab.vision.global_prog(float(x), OperationLightThreshold.thresholdTypeOptions[ tto_v.get()]) self.refresh() except Excepti...
code_fim
hard
{ "lang": "python", "repo": "hawwestin/MSR.APO", "path": "/gui/operations/OperationsLinear/binary_operation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lightning-Universe/lightning-bolts path: /src/pl_bolts/models/self_supervised/moco/moco_module.py """Adapted from: https://github.com/facebookresearch/moco. Original work is: Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved This implementation is: Copyright (c) PyTorch Lightn...
code_fim
hard
{ "lang": "python", "repo": "Lightning-Universe/lightning-bolts", "path": "/src/pl_bolts/models/self_supervised/moco/moco_module.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, query_images: Tensor, key_images: Tensor) -> Tuple[Tensor, Tensor]: """Computes the forward passes of both encoders and projection heads. Args: query_images: A mini-batch of query images in a ``[batch_size, num_channels, height, width]`` tensor. ...
code_fim
hard
{ "lang": "python", "repo": "Lightning-Universe/lightning-bolts", "path": "/src/pl_bolts/models/self_supervised/moco/moco_module.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Replaces representations in the queue, starting at the current queue pointer, and advances the pointer. Args: x: A mini-batch of representations. The queue size has to be a multiple of the total number of representations across all devices. """ ...
code_fim
hard
{ "lang": "python", "repo": "Lightning-Universe/lightning-bolts", "path": "/src/pl_bolts/models/self_supervised/moco/moco_module.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with open("numbers.txt", "w") as f: for d in data: f.write(str(d) + "\n")<|fim_prefix|># repo: seb-mueller/python-basic path: /solutions/pybasic_ex2_3_2.py # Script that writes the values of a list of numbers to a file, # with each number on a seperate line. <|fim_middle|>data = [2, 4, 6, 8,...
code_fim
easy
{ "lang": "python", "repo": "seb-mueller/python-basic", "path": "/solutions/pybasic_ex2_3_2.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: seb-mueller/python-basic path: /solutions/pybasic_ex2_3_2.py # Script that writes the values of a list of numbers to a file, # with each number on a seperate line. <|fim_suffix|>with open("numbers.txt", "w") as f: for d in data: f.write(str(d) + "\n")<|fim_middle|>data = [2, 4, 6, 8,...
code_fim
easy
{ "lang": "python", "repo": "seb-mueller/python-basic", "path": "/solutions/pybasic_ex2_3_2.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Qvineox/School148 path: /statistic/views.py from django.shortcuts import render from home.views import navbar_data <|fim_suffix|> return render(request, 'statistics/overall_statistics.html', {'navbar': navbar_data(request)})<|fim_middle|># страница главной статистики def overall_statistics(...
code_fim
medium
{ "lang": "python", "repo": "Qvineox/School148", "path": "/statistic/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # страница главной статистики def overall_statistics(request): return render(request, 'statistics/overall_statistics.html', {'navbar': navbar_data(request)})<|fim_prefix|># repo: Qvineox/School148 path: /statistic/views.py from django.shortcuts import render <|fim_middle|>from home.views import nav...
code_fim
easy
{ "lang": "python", "repo": "Qvineox/School148", "path": "/statistic/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: francoisgfx/plow path: /lib/python/plow/gui/common/widgets.py gui import constants class TableWidget(QtGui.QTableView): def __init__(self, *args, **kwargs): super(TableWidget, self).__init__(*args, **kwargs) self.setEditTriggers(self.NoEditTriggers) self.setSelecti...
code_fim
hard
{ "lang": "python", "repo": "francoisgfx/plow", "path": "/lib/python/plow/gui/common/widgets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: francoisgfx/plow path: /lib/python/plow/gui/common/widgets.py nBox(self) self.spin.setRange(minimum, maximum) self.spin.setValue(value) self.spin.valueChanged.connect(self.slider.setValue) self.slider.valueChanged.connect(self.spin.setValue) layout.addWid...
code_fim
hard
{ "lang": "python", "repo": "francoisgfx/plow", "path": "/lib/python/plow/gui/common/widgets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _selectionChanged(self): sel = self.getSelectedValues() self.selectionChanged.emit(sel) class CheckableComboBox(QtGui.QWidget): """ A combo box with selectable items. """ optionSelected = QtCore.Signal(str) def __init__(self, title, options, selected=Non...
code_fim
hard
{ "lang": "python", "repo": "francoisgfx/plow", "path": "/lib/python/plow/gui/common/widgets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Run ALCOVE on each SHJ problem list_trackers = np.zeros((36, num_epochs, 6)) # 36 = 6 perms * 6 types, 6 = number of columns list_idx = 0 # all permutations of stimulus dimensions start_time = time.time() for pidx, exemplars in enumerate(list_exemplars): print('Permutati...
code_fim
hard
{ "lang": "python", "repo": "alexatartaglini/alcove2", "path": "/alcove.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexatartaglini/alcove2 path: /alcove.py 0 or 1/-1, depending on loss) # # Output # mean probability of correct response # mean accuracy when picking most likely response net.eval() n_exemplars = exemplars.size(0) v_acc = np.zeros(n_exemplars) v_prob = np.zeros...
code_fim
hard
{ "lang": "python", "repo": "alexatartaglini/alcove2", "path": "/alcove.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results = df.groupby(args).apply(correlation).reset_index(name='corr') cols = args + ['Correct', 'Spearman Correlation', 'Spearman p-value', 'Kendall Correlation', 'Kendall p-value'] correlations = pd.DataFrame(index=range(0, results.shape[0]), ...
code_fim
hard
{ "lang": "python", "repo": "alexatartaglini/alcove2", "path": "/alcove.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andyzsf/django-shop path: /example/myshop/migrations/i18n_smartcard/0002_add_i18n.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import djangocms_text_ckeditor.fields def move_description(apps, schema...
code_fim
hard
{ "lang": "python", "repo": "andyzsf/django-shop", "path": "/example/myshop/migrations/i18n_smartcard/0002_add_i18n.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('myshop', '0001_initial'), ] operations = [ migrations.CreateModel( name='SmartCardTranslation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ...
code_fim
hard
{ "lang": "python", "repo": "andyzsf/django-shop", "path": "/example/myshop/migrations/i18n_smartcard/0002_add_i18n.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='SmartCardTranslation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('language_code', models.CharField(max_length=15, verbose_name...
code_fim
hard
{ "lang": "python", "repo": "andyzsf/django-shop", "path": "/example/myshop/migrations/i18n_smartcard/0002_add_i18n.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoogleCloudPlatform/python-docs-samples path: /functions/v2/label_gce_instance/main_test.py # Copyright 2021 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 ...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/python-docs-samples", "path": "/functions/v2/label_gce_instance/main_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>import main INSTANCE_PROJECT = os.getenv("GCLOUD_PROJECT") INSTANCE_ZONE = os.getenv("FUNCTIONS_COMPUTE_ZONE") INSTANCE_NAME = os.getenv("FUNCTIONS_COMPUTE_INSTANCE") instances_client = compute_v1.InstancesClient() # Avoid race conditions from parallel multi-Python-version CI builds PYTHON_VERSION = o...
code_fim
medium
{ "lang": "python", "repo": "GoogleCloudPlatform/python-docs-samples", "path": "/functions/v2/label_gce_instance/main_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheFrok/CheckersTournament path: /src/CheckersTournament/strategies/base_strategy.py import random from typing import List from collections import defaultdict from game_elements.board import Move, Board, Square class Strategy: <|fim_suffix|> def rank_move(self, board: Board, move: List[Move...
code_fim
hard
{ "lang": "python", "repo": "TheFrok/CheckersTournament", "path": "/src/CheckersTournament/strategies/base_strategy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d = defaultdict(list) board_data = self.analyze_board(board) or dict() for line in legal_moves: d[self.rank_move(board, line, **board_data)].append(line) best_rank = max(d.keys()) return random.choice(d[best_rank])<|fim_prefix|># repo: TheFrok/CheckersTo...
code_fim
medium
{ "lang": "python", "repo": "TheFrok/CheckersTournament", "path": "/src/CheckersTournament/strategies/base_strategy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Uer', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=20)), ('password', models....
code_fim
hard
{ "lang": "python", "repo": "luomantic/LoveFresh", "path": "/App/migrations/0006_uer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luomantic/LoveFresh path: /App/migrations/0006_uer.py # Generated by Django 2.1.7 on 2019-03-02 14:31 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.CreateModel( name='Uer', fields=[ ...
code_fim
hard
{ "lang": "python", "repo": "luomantic/LoveFresh", "path": "/App/migrations/0006_uer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeffreyDantas/Aprendizado path: /Exercícios Python Curso Em Vídeo/ex105.py #Faça um programa que tenha uma função notas() que pode receber várias notas de alunos #e vai retornar um dicionário com as seguintes informações: #– Quantidade de notas #– A maior nota #– A menor nota #–A média da turma #...
code_fim
hard
{ "lang": "python", "repo": "JeffreyDantas/Aprendizado", "path": "/Exercícios Python Curso Em Vídeo/ex105.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r['Situação'] = 'BOA' elif r['Média'] >=5: r['Situação'] = 'RAZOÁVEL' else: r['Situação'] = 'RUIM' return r resp = notas(5.5, 2.5, 1.5, sit=True) print(resp) #help(notas)<|fim_prefix|># repo: JeffreyDantas/Aprendizado path: /Exercícios Python Curso...
code_fim
hard
{ "lang": "python", "repo": "JeffreyDantas/Aprendizado", "path": "/Exercícios Python Curso Em Vídeo/ex105.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :return: retorna os valores pedidos em dicionário! ''' r = {} r ['Total'] = len(n) r ['Maior'] = max(n) r ['Menor'] = min(n) r ['Média'] = sum(n)/len(n) if sit == True: if r['Média'] >= 7: r['Situação'] = 'BOA' elif r['Média'] >=5: r['Si...
code_fim
hard
{ "lang": "python", "repo": "JeffreyDantas/Aprendizado", "path": "/Exercícios Python Curso Em Vídeo/ex105.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python-725/folioman path: /api/mutualfunds/migrations/0001_initial.py # Generated by Django 3.1.8 on 2021-04-18 14:20 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True depen...
code_fim
hard
{ "lang": "python", "repo": "Python-725/folioman", "path": "/api/mutualfunds/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "scheme", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="values", to="mutualfunds.folioscheme", ), ), ], options={ ...
code_fim
hard
{ "lang": "python", "repo": "Python-725/folioman", "path": "/api/mutualfunds/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xeyer/template path: /python/Client/Client.py import socket import time import cv2 import pickle import zlib import datetime HOST = '192.168.0.101' PORT = 13327 video = cv2.VideoCapture(0) <|fim_suffix|> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) for i in r...
code_fim
medium
{ "lang": "python", "repo": "Xeyer/template", "path": "/python/Client/Client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Echo = s.recv(1024) s.sendall(b'') s.close() video.release() cv2.destroyAllWindows()<|fim_prefix|># repo: Xeyer/template path: /python/Client/Client.py import socket import time import cv2 import pickle import zlib import datetime HOST = '192.168.0.101' PORT = 13327 video = cv2.VideoCapture(0) ...
code_fim
hard
{ "lang": "python", "repo": "Xeyer/template", "path": "/python/Client/Client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> today_picture = read_today()["imageLink"] return render_template("index.html", today_post = today_picture) #API @app.route('/api/by_id') def api_by_id() : id = request.args.get('id', None) return jsonify(get_by_id(id))<|fim_prefix|># repo: waterfox-dev/TopTweetBot path: /source/views.py ...
code_fim
easy
{ "lang": "python", "repo": "waterfox-dev/TopTweetBot", "path": "/source/views.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: waterfox-dev/TopTweetBot path: /source/views.py from flask import Flask, render_template, request, jsonify from source.api_reader import * <|fim_suffix|>#API @app.route('/api/by_id') def api_by_id() : id = request.args.get('id', None) return jsonify(get_by_id(id))<|fim_middle|> app = Fla...
code_fim
medium
{ "lang": "python", "repo": "waterfox-dev/TopTweetBot", "path": "/source/views.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>#API @app.route('/api/by_id') def api_by_id() : id = request.args.get('id', None) return jsonify(get_by_id(id))<|fim_prefix|># repo: waterfox-dev/TopTweetBot path: /source/views.py from flask import Flask, render_template, request, jsonify from source.api_reader import * <|fim_middle|>app = Fla...
code_fim
medium
{ "lang": "python", "repo": "waterfox-dev/TopTweetBot", "path": "/source/views.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> # return resp.content.decode('utf-8') def resp2dynamiclist(respcontent,end): dynamiclist = [] jsoncontent= json.loads(respcontent) print(jsoncontent) if 'data' not in jsoncontent: return -1 if 'cards' not in jsoncontent['data']: return -1 dynamiclist = jsoncon...
code_fim
hard
{ "lang": "python", "repo": "FelixLee1995/BiliUpDynamicCrawler", "path": "/access.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FelixLee1995/BiliUpDynamicCrawler path: /access.py import requests import json import service def accessDynamicByUp(bilimid, end): offset = '0' flag = True while flag: if offset == -1: break offset = accessDynamic(bilimid, offset, end) service.refresh...
code_fim
medium
{ "lang": "python", "repo": "FelixLee1995/BiliUpDynamicCrawler", "path": "/access.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def resp2dynamiclist(respcontent,end): dynamiclist = [] jsoncontent= json.loads(respcontent) print(jsoncontent) if 'data' not in jsoncontent: return -1 if 'cards' not in jsoncontent['data']: return -1 dynamiclist = jsoncontent['data']['cards'] offset = 0 pr...
code_fim
hard
{ "lang": "python", "repo": "FelixLee1995/BiliUpDynamicCrawler", "path": "/access.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DIAGONAL1 = 0 HORIZONTAL = 1 DIAGONAL2 = 2 VERTICAL = 3 SIZE = 4 RIGHT_UP = 0 RIGHT = 1 RIGHT_DOWN = 2 UP = 3 DOWN = 3 LEFT_UP = 2 LEFT = 1 LEFT_DOWN = 0<|fim_prefix|># repo: windfall-shogi/feature-annotation path: /annotation/direction.py #!/usr/bin/...
code_fim
medium
{ "lang": "python", "repo": "windfall-shogi/feature-annotation", "path": "/annotation/direction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_opposite_direction(direction): """ 逆方向を求める 順方向、逆方向と動いた時に元の位置に戻れる動きを逆方向と定める :param direction: :return: """ if direction < 8: return Direction(7 - direction) else: # 桂馬の動き return Direction(19 - direction) class PinDirection(enum.IntEnum): ...
code_fim
hard
{ "lang": "python", "repo": "windfall-shogi/feature-annotation", "path": "/annotation/direction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: windfall-shogi/feature-annotation path: /annotation/direction.py #!/usr/bin/env python # -*- coding: utf-8 -*- import enum __author__ = 'Yasuhiro' __date__ = '2018/1/28' class Direction(enum.IntEnum): RIGHT_UP = 0 RIGHT = 1 RIGHT_DOWN = 2 UP = 3 DOWN = 4 LEFT_UP = 5 ...
code_fim
hard
{ "lang": "python", "repo": "windfall-shogi/feature-annotation", "path": "/annotation/direction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wang153723482/HelloWorld_my path: /HelloWorld_python/http_spider/yuantong/getInforByYT.py __author__ = 'wangchao' import urllib2 import urllib import sys from bs4 import BeautifulSoup from pyquery import PyQuery as pq url = 'http://trace.yto.net.cn:8022/TraceSimple.aspx' waybillNo = 'xxxxxxxxx'...
code_fim
hard
{ "lang": "python", "repo": "wang153723482/HelloWorld_my", "path": "/HelloWorld_python/http_spider/yuantong/getInforByYT.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # urlItem = urllib2.urlopen(url) # htmlSource = urlItem.read() # urlItem.close() # print(htmlSource) # pass # html = """ <html><head><title>The Dormouse's story</title><contents>this is contents</contents></head> # <body> # <p>a</p><p>b</p> # <p>c</p> ...
code_fim
hard
{ "lang": "python", "repo": "wang153723482/HelloWorld_my", "path": "/HelloWorld_python/http_spider/yuantong/getInforByYT.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # urlItem = urllib2.urlopen(url) # htmlSource = urlItem.read() # urlItem.close() # print(htmlSource) # pass # html = """ <html><head><title>The Dormouse's story</title><contents>this is contents</contents></head> # <body> # <p>a</p><p>b</p> # <p>c</p> # </b...
code_fim
hard
{ "lang": "python", "repo": "wang153723482/HelloWorld_my", "path": "/HelloWorld_python/http_spider/yuantong/getInforByYT.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return df_result, '' def get_index_data(self, index): base_url = "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=HYZS_PageStock&token=70f12f2f4f091e459a279469fe49eca5&filter=(ID='%s')&st=DATADATE&js={\"pages\":(tp),\"data\":(x)}" index_url = base_url % se...
code_fim
hard
{ "lang": "python", "repo": "pacinolucifer/OpenData", "path": "/opendatatools/shippingindex/eastmoney_agent.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pacinolucifer/OpenData path: /opendatatools/shippingindex/eastmoney_agent.py # encoding: utf-8 import json import pandas as pd import datetime from opendatatools.common import RestAgent class EastMoneyAgent(RestAgent): def __init__(self): RestAgent.__init__(self) <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "pacinolucifer/OpenData", "path": "/opendatatools/shippingindex/eastmoney_agent.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: auburus/pert path: /tests/test_formatters.py import pert def test_layout_dimensions(): <|fim_suffix|> assert (10 + 12, 100 + 20) == pert.find_layout_dimensions([box1])<|fim_middle|> project = pert.Project() project.addTask(pert.Task("My least favourite task")) box1 = pert.Box(pert...
code_fim
medium
{ "lang": "python", "repo": "auburus/pert", "path": "/tests/test_formatters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert (10 + 12, 100 + 20) == pert.find_layout_dimensions([box1])<|fim_prefix|># repo: auburus/pert path: /tests/test_formatters.py import pert def test_layout_dimensions(): <|fim_middle|> project = pert.Project() project.addTask(pert.Task("My least favourite task")) box1 = pert.Box(pert...
code_fim
medium
{ "lang": "python", "repo": "auburus/pert", "path": "/tests/test_formatters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: github/codeql path: /python/ql/src/experimental/Security/CWE-287/examples/auth_bad_2.py from flask import request, Flask import ldap import ldap.filter import ldap.dn <|fim_suffix|> dn = "dc={}".format(ldap.dn.escape_dn_chars(request.args['dc'])) search_filter = "(user={})".format(ldap.f...
code_fim
easy
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/src/experimental/Security/CWE-287/examples/auth_bad_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dn = "dc={}".format(ldap.dn.escape_dn_chars(request.args['dc'])) search_filter = "(user={})".format(ldap.filter.escape_filter_chars(request.args['search'])) ldap_connection = ldap.initialize("ldap://127.0.0.1:1337") ldap_connection.bind('cn=root', "") user = ldap_connection.search_s(d...
code_fim
easy
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/src/experimental/Security/CWE-287/examples/auth_bad_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_columns = {"selector_id", "action_type"} new_indexes = {"idx_bulk_actions_action_type", "idx_bulk_actions_selector_id"} _reconstruct_from_file( hostname, conn_string, # use an old snapshot, it has the bulk actions table but not the new columns file_relative...
code_fim
hard
{ "lang": "python", "repo": "zkan/dagster", "path": "/python_modules/libraries/dagster-mysql/dagster_mysql_tests/compat_tests/test_back_compat.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_add_kvs_table(hostname, conn_string): _reconstruct_from_file( hostname, conn_string, # use an old snapshot file_relative_path(__file__, "snapshot_0_14_6_post_schema_pre_data_migration.sql"), ) with tempfile.TemporaryDirectory() as tempdir: wi...
code_fim
hard
{ "lang": "python", "repo": "zkan/dagster", "path": "/python_modules/libraries/dagster-mysql/dagster_mysql_tests/compat_tests/test_back_compat.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zkan/dagster path: /python_modules/libraries/dagster-mysql/dagster_mysql_tests/compat_tests/test_back_compat.py # pylint: disable=protected-access import os import subprocess import tempfile from sqlalchemy import create_engine, inspect from dagster import AssetKey, AssetObservation, Output, j...
code_fim
hard
{ "lang": "python", "repo": "zkan/dagster", "path": "/python_modules/libraries/dagster-mysql/dagster_mysql_tests/compat_tests/test_back_compat.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuansen/python-utils-class path: /App_Base_Common/AppBase_Example.py # -*- coding:utf-8 -*- # author:Anson from __future__ import unicode_literals import sys from AppBase import AppBase, try_except class Example(AppBase): app_name = 'for example' <|fim_suffix|> exampl...
code_fim
hard
{ "lang": "python", "repo": "liuansen/python-utils-class", "path": "/App_Base_Common/AppBase_Example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': op = Example() op.run(sys.argv) # cmd: python AppBase_Example -example 1<|fim_prefix|># repo: liuansen/python-utils-class path: /App_Base_Common/AppBase_Example.py # -*- coding:utf-8 -*- # author:Anson from __future__ import unicode_literals import sys ...
code_fim
hard
{ "lang": "python", "repo": "liuansen/python-utils-class", "path": "/App_Base_Common/AppBase_Example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>anual', sa.Boolean(), nullable=False), sa.Column('slice', sa.String(length=25), nullable=False), sa.Column('grain', sa.String(length=100), nullable=True), sa.Column('assigned_to', sa.String(length=75), nullable=True), sa.Column('status_id', sa.Integer(), nullable=False), sa.Column('act...
code_fim
hard
{ "lang": "python", "repo": "BambooHR/rapid", "path": "/rapid/master/data/migrations/versions/58ebb5ecef90_initial_schema.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BambooHR/rapid path: /rapid/master/data/migrations/versions/58ebb5ecef90_initial_schema.py """ Copyright (c) 2015 Michael Bright and Bamboo HR 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...
code_fim
hard
{ "lang": "python", "repo": "BambooHR/rapid", "path": "/rapid/master/data/migrations/versions/58ebb5ecef90_initial_schema.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: archivy/archivy path: /tests/integration/test_api.py from base64 import b64encode from os import remove import responses from flask import Flask from flask.testing import FlaskClient from tinydb import Query from archivy.data import create_dir, get_items, create_dir, get_item from archivy.models...
code_fim
hard
{ "lang": "python", "repo": "archivy/archivy", "path": "/tests/integration/test_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> open("video.mp4", "a").close() data = {"image": open("video.mp4", "r")} resp = client.post("/api/images", data=data, content_type="multipart/form-data") assert resp.status_code == 415 try: open(test_app.config["USER_DIR"] + "/images/video.mp4", "r") assert False exc...
code_fim
hard
{ "lang": "python", "repo": "archivy/archivy", "path": "/tests/integration/test_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # logout client.delete("/logout") # requires converting to base64 for http basic auth authorization = "Basic " + b64encode("halcyon:password".encode("ascii")).decode( "ascii" ) resp = client.post("/api/login", headers={"Authorization": authorization}) assert resp.statu...
code_fim
hard
{ "lang": "python", "repo": "archivy/archivy", "path": "/tests/integration/test_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: featuresets = [(find_features(rev,wordFeatures),category) for (rev,category) in documents] save_featuresets = open(featuresetsPath, "wb") pickle.dump(featuresets, save_featuresets) save_featuresets.close() print("featuresets saved...") r...
code_fim
hard
{ "lang": "python", "repo": "vaibhav0000patel/Topical-Sentiment-Analysis", "path": "/classify.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vaibhav0000patel/Topical-Sentiment-Analysis path: /classify.py from __future__ import division import warnings warnings.filterwarnings("ignore") import nltk from nltk.tokenize import TweetTokenizer from nltk.tokenize import TweetTokenizer from nltk.tokenize import word_tokenize from nltk.classif...
code_fim
hard
{ "lang": "python", "repo": "vaibhav0000patel/Topical-Sentiment-Analysis", "path": "/classify.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> classifier = naiveBayes.getClassifier(path.naiveBayesPicklePATH,training_set) MultinomialNB_classifier = multinomialNB.getClassifier(path.multinomialNBPicklePATH,training_set) BernoulliNB_classifier = bernoulliNB.getClassifier(path.bernoulliNBPicklePATH,tra...
code_fim
hard
{ "lang": "python", "repo": "vaibhav0000patel/Topical-Sentiment-Analysis", "path": "/classify.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Initialize audio stream = pyaudio.PyAudio().open(format=pyaudio.paInt16, channels=1, rate=FSAMP, input=True, frames_per_buffer=FRAME_SIZE) stream.start_stream() # Create Hann...
code_fim
hard
{ "lang": "python", "repo": "tastank/python-tuner", "path": "/controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tastank/python-tuner path: /controller.py #! /usr/bin/env python ###################################################################### # tuner.py - a minimal command-line guitar/ukulele tuner in Python. # Requires numpy and pyaudio. ###############################################################...
code_fim
hard
{ "lang": "python", "repo": "tastank/python-tuner", "path": "/controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> value += increment if value > max: value = max return value def release(value, increment): if value > 0: value -= increment if value < 0: value = 0 return value def center(value, increment, center): if value > center: value -= increment...
code_fim
hard
{ "lang": "python", "repo": "tastank/python-tuner", "path": "/controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def create_db(): r.connect(properties.get('RETHINK_HOST'), properties.get('RETHINK_PORT')).repl() r.db_create('relayr').run() r.db('relayr').table_create('requests').run()<|fim_prefix|># repo: keeb-zz/relayr path: /init/first.py from config import properties import rethinkdb as r <|fim_mid...
code_fim
medium
{ "lang": "python", "repo": "keeb-zz/relayr", "path": "/init/first.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: keeb-zz/relayr path: /init/first.py from config import properties import rethinkdb as r def check_db(): <|fim_suffix|> r.db_create('relayr').run() r.db('relayr').table_create('requests').run()<|fim_middle|> r.connect(properties.get('RETHINK_HOST'), properties.get('RETHINK_PORT')).repl...
code_fim
hard
{ "lang": "python", "repo": "keeb-zz/relayr", "path": "/init/first.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }