text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: sagarnikam123/learnNPractice path: /hackerRank/tracks/languages/python/4_sets/9_set.symmetricDifferenceOperation.py # Set .symmetric_difference() Operation ####################################################################################################################### # # .symmetric_dif...
code_fim
hard
{ "lang": "python", "repo": "sagarnikam123/learnNPractice", "path": "/hackerRank/tracks/languages/python/4_sets/9_set.symmetricDifferenceOperation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p.cast(DrawBotPen).draw_with_filters(rect, filters) return p return _draw_call def page_rect() -> Rect: return Rect(db.width(), db.height()) @contextlib.contextmanager def new_page(r:Rect=Rect(1000, 1000)): _r = Rect(r) db.newPage(*_r.wh()) yield _r @contextlib.conte...
code_fim
hard
{ "lang": "python", "repo": "econchick/coldtype", "path": "/coldtype/drawbot.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: econchick/coldtype path: /coldtype/drawbot.py import contextlib import drawBot as db from coldtype.geometry import Point, Line, Rect from coldtype.pens.drawbotpen import DrawBotPen from coldtype.pens.draftingpen import DraftingPen from coldtype.pens.draftingpens import DraftingPens from coldtype....
code_fim
hard
{ "lang": "python", "repo": "econchick/coldtype", "path": "/coldtype/drawbot.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _draw_call(p:DraftingPen): p.cast(DrawBotPen).draw_with_filters(rect, filters) return p return _draw_call def page_rect() -> Rect: return Rect(db.width(), db.height()) @contextlib.contextmanager def new_page(r:Rect=Rect(1000, 1000)): _r = Rect(r) db.newPage(*_r.wh...
code_fim
hard
{ "lang": "python", "repo": "econchick/coldtype", "path": "/coldtype/drawbot.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return _p.createFunction( function,_p.PLATFORM.GLES2,'GLES2_EXT_texture_norm16',error_checker=_errors._error_checker) GL_R16_EXT=_C('GL_R16_EXT',0x822A) GL_R16_SNORM_EXT=_C('GL_R16_SNORM_EXT',0x8F98) GL_RG16_EXT=_C('GL_RG16_EXT',0x822C) GL_RG16_SNORM_EXT=_C('GL_RG16_SNORM_EXT',0x8F99) GL_RGB16_EXT=_C(...
code_fim
medium
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/raw/GLES2/EXT/texture_norm16.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juso40/bl2sdk_Mods path: /blimgui/dist/OpenGL/raw/GLES2/EXT/texture_norm16.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GLES2 import _types as _cs # End users want this... from OpenGL.raw.GLES2._t...
code_fim
medium
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/raw/GLES2/EXT/texture_norm16.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emjelde/pytiles path: /components.py #!/usr/bin/python # Copyright (C) 2014 - Evan Mjelde # # 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 # # http://www.apache.org/lic...
code_fim
hard
{ "lang": "python", "repo": "emjelde/pytiles", "path": "/components.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, name, items=None, inherit=True, **kwargs): """Keyword arguments: items -- Array of initial items. inherit -- Lets you know if it should inherit items on merge. (Default: True) """ self.items = items if items is not None else [] ...
code_fim
hard
{ "lang": "python", "repo": "emjelde/pytiles", "path": "/components.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lecklis/python_auto_office path: /B站/Python自动化办公 · 一课通(适合小白)/Chapter1/S1-1-1/LessonCode/1.1read.py import xlrd xlsx = xlrd.open_workbook('d:/7月下旬入库表.xlsx') <|fim_suffix|># table.cell_value(1, 2) # print(table.cell(1, 2).value) # print(table.row(1)[2].value) for i in range(0, xlsx.nsheets): ...
code_fim
medium
{ "lang": "python", "repo": "lecklis/python_auto_office", "path": "/B站/Python自动化办公 · 一课通(适合小白)/Chapter1/S1-1-1/LessonCode/1.1read.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in xlsx.sheet_names(): table = xlsx.sheet_by_name(i) print(table.cell_value(3, 3))<|fim_prefix|># repo: lecklis/python_auto_office path: /B站/Python自动化办公 · 一课通(适合小白)/Chapter1/S1-1-1/LessonCode/1.1read.py import xlrd xlsx = xlrd.open_workbook('d:/7月下旬入库表.xlsx') table = xlsx.sheet_by_index(0...
code_fim
medium
{ "lang": "python", "repo": "lecklis/python_auto_office", "path": "/B站/Python自动化办公 · 一课通(适合小白)/Chapter1/S1-1-1/LessonCode/1.1read.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: claudemp/iem path: /scripts/climodat/check_database.py """ Check over the database and make sure we have what we need there to make the climodat reports happy... """ from __future__ import print_function import sys import mx.DateTime from pyiem.network import Table as NetworkTable from pyiem.u...
code_fim
hard
{ "lang": "python", "repo": "claudemp/iem", "path": "/scripts/climodat/check_database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): """Go Main""" for station in nt.sts: sts = mx.DateTime.DateTime(constants.startyear(station), 1, 1) ets = constants._ENDTS # Check for obs total now = sts interval = mx.DateTime.RelativeDateTime(years=1) while now < (ets - interval): ...
code_fim
hard
{ "lang": "python", "repo": "claudemp/iem", "path": "/scripts/climodat/check_database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check records database... sts = mx.DateTime.DateTime(2000, 1, 1) ets = mx.DateTime.DateTime(2001, 1, 1) interval = mx.DateTime.RelativeDateTime(days=1) for table in ['climate', 'climate51', 'climate71', 'climate81']: ccursor.execute("""SELECT count(*) ...
code_fim
hard
{ "lang": "python", "repo": "claudemp/iem", "path": "/scripts/climodat/check_database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saeeddhqan/natural-language-processing-for-osint path: /m3/document similarity/ds.py import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer import nltk from nltk.corpus import stopwords import re def rstopwords(...
code_fim
hard
{ "lang": "python", "repo": "saeeddhqan/natural-language-processing-for-osint", "path": "/m3/document similarity/ds.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def punc(doc): replace = re.sub(r"[\W]+", " ", doc) return " ".join(replace.split()) def euclidean_distance(x, y): return np.sqrt(np.sum((x - y) ** 2)) def cosine_similarity(x,y): return np.dot(x, y) / (np.sqrt(np.dot(x, x)) * np.sqrt(np.dot(y, y))) doc1 = open('ML.txt').read() doc2 = open('DL.txt'...
code_fim
hard
{ "lang": "python", "repo": "saeeddhqan/natural-language-processing-for-osint", "path": "/m3/document similarity/ds.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>data = np.array(data) print('ML - DL', cosine_similarity(data[0], data[1])) print('ML - MJ', cosine_similarity(data[0], data[2])) print('ML - AI', cosine_similarity(data[0], data[3])) print('DL - MJ', cosine_similarity(data[1], data[2])) print('DL - AI', cosine_similarity(data[1], data[3])) print('AI - ...
code_fim
hard
{ "lang": "python", "repo": "saeeddhqan/natural-language-processing-for-osint", "path": "/m3/document similarity/ds.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarlonIC/demo-clean-architecture-projects-tasks path: /tests/test_main.py import os import sys import taskit.__main__ from subprocess import run from pytest import fixture from unittest.mock import Mock, patch from taskit.__main__ import main, build_state @fixture(scope='module') def taskit_dir...
code_fim
medium
{ "lang": "python", "repo": "MarlonIC/demo-clean-architecture-projects-tasks", "path": "/tests/test_main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_main_db_file_not_empty(taskit_dir) -> None: sandbox = patch.dict(os.environ, {'TASKIT_DIR': taskit_dir}) sandbox.start() db_path = os.sep.join([taskit_dir, 'db.json']) with open(db_path, 'w+') as f: f.write('{"projects": {}}') python_bin = sys.executable result = r...
code_fim
hard
{ "lang": "python", "repo": "MarlonIC/demo-clean-architecture-projects-tasks", "path": "/tests/test_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jschultz/Gooey path: /gooey/gui/windows/base_window.py ''' Created on Jan 19, 2014 @author: Chris ''' import sys import wx from gooey.gui import image_repository, events from gooey.gui.lang.i18n import _ from gooey.gui.pubsub import pub from gooey.gui.util import wx_util from gooe...
code_fim
hard
{ "lang": "python", "repo": "jschultz/Gooey", "path": "/gooey/gui/windows/base_window.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def onResize(self, evt): evt.Skip() def onClose(self, evt): if evt.CanVeto(): evt.Veto() pub.send_message(str(events.WINDOW_CLOSE)) def UpdateProgressBar(self, value, disable_animation=False): pb = self.foot_panel.progress_bar if value < 0: pb.Pulse() ...
code_fim
hard
{ "lang": "python", "repo": "jschultz/Gooey", "path": "/gooey/gui/windows/base_window.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>assert number_of_keys_with_foo_in_name(test_2) == 0 print("it works, congrats!")<|fim_prefix|># repo: toumorokoshi/python-code-challenges path: /07/23.py def number_of_keys_with_foo_in_name(my_dict): """ return an integer, with the number of keys with the string "foo" in them. """ z = [] for...
code_fim
hard
{ "lang": "python", "repo": "toumorokoshi/python-code-challenges", "path": "/07/23.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: toumorokoshi/python-code-challenges path: /07/23.py def number_of_keys_with_foo_in_name(my_dict): """ return an integer, with the number of keys with the string "foo" in them. """ z = [] for x in my_dict: b = x.find("foo", 0) if b is not -1: z.append(b) ...
code_fim
medium
{ "lang": "python", "repo": "toumorokoshi/python-code-challenges", "path": "/07/23.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>bytes = s.send(msg) begin = time.time() print "Bytes sent %d" % bytes c = s.recv(5000) end = time.time() print "RECEIVE: '%s'" % c print "TIMEOUT PERIOD: %d" % (end - begin)<|fim_prefix|># repo: kongyew/gpdb path: /gpMgmt/test/behave_utils/gpfdist_utils/gpfdist_client.py #!/usr/bin/env python import ...
code_fim
medium
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/gpMgmt/test/behave_utils/gpfdist_utils/gpfdist_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kongyew/gpdb path: /gpMgmt/test/behave_utils/gpfdist_utils/gpfdist_client.py #!/usr/bin/env python import socket, time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if not s: raise Exception("socket not created") s.connect(("localhost", 8088)) print "connected" msg = """GET /data...
code_fim
easy
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/gpMgmt/test/behave_utils/gpfdist_utils/gpfdist_client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>msg = """GET /data.txt HTTP/1.1 Host: localhost""" bytes = s.send(msg) begin = time.time() print "Bytes sent %d" % bytes c = s.recv(5000) end = time.time() print "RECEIVE: '%s'" % c print "TIMEOUT PERIOD: %d" % (end - begin)<|fim_prefix|># repo: kongyew/gpdb path: /gpMgmt/test/behave_utils/gpfdist_ut...
code_fim
medium
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/gpMgmt/test/behave_utils/gpfdist_utils/gpfdist_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('course', '0001_initial'), ] operations = [ migrations.AlterField( model_name='coursesmodel', name='duration', field=models.CharField(max_length=255), ), ]<|fim_prefix|># repo: dewale005/whitefieldcoursesite p...
code_fim
easy
{ "lang": "python", "repo": "dewale005/whitefieldcoursesite", "path": "/course/migrations/0002_alter_coursesmodel_duration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dewale005/whitefieldcoursesite path: /course/migrations/0002_alter_coursesmodel_duration.py # Generated by Django 3.2.6 on 2021-08-25 14:57 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('course', '0001_initial'), ] operations = [ migration...
code_fim
easy
{ "lang": "python", "repo": "dewale005/whitefieldcoursesite", "path": "/course/migrations/0002_alter_coursesmodel_duration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='coursesmodel', name='duration', field=models.CharField(max_length=255), ), ]<|fim_prefix|># repo: dewale005/whitefieldcoursesite path: /course/migrations/0002_alter_coursesmodel_duration.py # Gen...
code_fim
medium
{ "lang": "python", "repo": "dewale005/whitefieldcoursesite", "path": "/course/migrations/0002_alter_coursesmodel_duration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ccsValidator('Cold-Measurement')<|fim_prefix|># repo: lsst-camera-dh/harnessed-jobs path: /BNL_T05/Cold_Measurement/v0/validator_Cold-Measurement.py #!/usr/bin/env python from ccsTools import ccsValidator import glob import os <|fim_middle|>datfile = glob.glob("*.csv")[0] os.system("grep \"^#\" %s > tem...
code_fim
medium
{ "lang": "python", "repo": "lsst-camera-dh/harnessed-jobs", "path": "/BNL_T05/Cold_Measurement/v0/validator_Cold-Measurement.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsst-camera-dh/harnessed-jobs path: /BNL_T05/Cold_Measurement/v0/validator_Cold-Measurement.py #!/usr/bin/env python from ccsTools import ccsValidator import glob import os <|fim_suffix|>ccsValidator('Cold-Measurement')<|fim_middle|>datfile = glob.glob("*.csv")[0] os.system("grep \"^#\" %s > tem...
code_fim
medium
{ "lang": "python", "repo": "lsst-camera-dh/harnessed-jobs", "path": "/BNL_T05/Cold_Measurement/v0/validator_Cold-Measurement.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Runs the API and gets the statis def get_max_core_usage(self, sdate, edate, limit): metrics_api = "/analytics/metrics/controller" params = { 'metric_id': 'controller_stats.max_num_se_cores', 'step': 86400, 'start': sdate, 'stop': ed...
code_fim
hard
{ "lang": "python", "repo": "sjafferali/devops", "path": "/python/core_useage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sjafferali/devops path: /python/core_useage.py ##################################################################################### # Script to get max CPU usage by Avi SEs over given time period # usage: python core_useage.py [-h] [-v AVI_VERSION] [-s STARTDATE] [-e ENDDATE] # ...
code_fim
hard
{ "lang": "python", "repo": "sjafferali/devops", "path": "/python/core_useage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # add list item # find out which list was asked for lists,contents in rmds.items(): if lists in self.query: # add list item data = {} data["name"] = ' '.join( self.query[ self.query.index("add")+1:self.query.index("to") ] ) rmds[lists].app...
code_fim
hard
{ "lang": "python", "repo": "1egoman/qlists", "path": "/rmd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1egoman/qlists path: /rmd.py from base import * import os import datetime import json # to-do list words todo_words = ["todo", "to do", "to-do", "reminder", "remind", "list"] remove_words = ["check", "remove", "cross", "crossout", "checkoff", "delete"] remove_preps = ["on", "from", "at"] """ M...
code_fim
hard
{ "lang": "python", "repo": "1egoman/qlists", "path": "/rmd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: albertmas/Image-Filters path: /Exercises/MorphologicalFilters.py import numpy as np import cv2 def ErosionFilter(img, times=1): rows, cols = img.shape paddedimg = np.ones((rows + 2, cols + 2)) paddedimg[:, :] = 255 paddedimg[1:-1, 1:-1] = img.copy() newimg = img.copy() f...
code_fim
hard
{ "lang": "python", "repo": "albertmas/Image-Filters", "path": "/Exercises/MorphologicalFilters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": image = cv2.imread("binary.png", cv2.IMREAD_GRAYSCALE) filteredImg = DilationFilter(image, 1) filteredImg = ErosionFilter(filteredImg, 6) # cv2.imshow('Image', np.hstack((image, filteredImg))) cv2.imshow('Original', image) cv2.imshow('Filtered', filtered...
code_fim
hard
{ "lang": "python", "repo": "albertmas/Image-Filters", "path": "/Exercises/MorphologicalFilters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Finds the flow table entry that matches the given packet. Returns the highest priority flow table entry that matches the given packet on the given in_port, or None if no matching entry is found. """ packet_match = ofp_match.from_packet(packet, in_port, spec_frags = True) ...
code_fim
hard
{ "lang": "python", "repo": "noxrepo/pox", "path": "/pox/openflow/flow_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._table def __len__ (self): return len(self._table) def add_entry (self, entry): assert isinstance(entry, TableEntry) #self._table.append(entry) #self._table.sort(key=lambda e: e.effective_priority, reverse=True) # Use binary search to insert at correct place ...
code_fim
hard
{ "lang": "python", "repo": "noxrepo/pox", "path": "/pox/openflow/flow_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: noxrepo/pox path: /pox/openflow/flow_table.py # Copyright 2011,2012,2013 Colin Scott # # 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: # # http://www.apache.org/lice...
code_fim
hard
{ "lang": "python", "repo": "noxrepo/pox", "path": "/pox/openflow/flow_table.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: easyopsapis/easyops-api-python path: /scheduler_sdk/model/cmdb_extend/subsystem_dependency_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: subsystem_dependency.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('la...
code_fim
hard
{ "lang": "python", "repo": "easyopsapis/easyops-api-python", "path": "/scheduler_sdk/model/cmdb_extend/subsystem_dependency_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>_SUBSYSTEMDEPENDENCY_CONNECTSUBSYSTEMS.containing_type = _SUBSYSTEMDEPENDENCY _SUBSYSTEMDEPENDENCY.fields_by_name['components'].message_type = scheduler__sdk_dot_model_dot_cmdb__extend_dot_app__dependency__pb2._APPDEPENDENCY _SUBSYSTEMDEPENDENCY.fields_by_name['connect_subsystems'].message_type = _SUBSYST...
code_fim
hard
{ "lang": "python", "repo": "easyopsapis/easyops-api-python", "path": "/scheduler_sdk/model/cmdb_extend/subsystem_dependency_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.scale = facette_to_json(GRAPH_GROUP_SCALE, js, self.group) def set(self, name=None, type=None, stack_id=None, series=None, scale=None): self.name = facette_set(name, GRAPH_GROUP_NAME, self.group) self.type = facette_set(type, GRAPH_GROUP_TYPE, ...
code_fim
hard
{ "lang": "python", "repo": "OpenTouch/python-facette", "path": "/src/facette/v1/graphgroup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenTouch/python-facette path: /src/facette/v1/graphgroup.py from facette.utils import * from facette.v1.graphgroupserie import GraphGroupSerie import json GRAPH_GROUP_NAME = "name" GRAPH_GROUP_TYPE = "type" GRAPH_GROUP_STACK_ID = "stack_id" GRAPH_GROUP_SERIES = "series" GRAPH_GROUP_SC...
code_fim
hard
{ "lang": "python", "repo": "OpenTouch/python-facette", "path": "/src/facette/v1/graphgroup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print(not ()) print(not (1,)) print(not []) print(not [1,]) print(not {}) print(not {1:1})<|fim_prefix|># repo: jiapei100/Stereo path: /micropython/tests/basics/unary_op.py print(not None) print(not False) print(not Tr<|fim_middle|>ue) print(not 0) print(not 1) print(not -1)
code_fim
easy
{ "lang": "python", "repo": "jiapei100/Stereo", "path": "/micropython/tests/basics/unary_op.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiapei100/Stereo path: /micropython/tests/basics/unary_op.py print(not None) print(not False) print(not True) print(not 0) print(not 1) print(not -1) <|fim_suffix|>print(not [1,]) print(not {}) print(not {1:1})<|fim_middle|>print(not ()) print(not (1,)) print(not [])
code_fim
easy
{ "lang": "python", "repo": "jiapei100/Stereo", "path": "/micropython/tests/basics/unary_op.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def val_loss(): net.eval() result = [] for item in data['val']: item = {key: value.to(_device) for key, value in item.items()} result.append(net.cost(item).item()) net.train() return torch.tensor(result).mean() net.to(_device) ...
code_fim
hard
{ "lang": "python", "repo": "gchrupala/platalea", "path": "/platalea/basic.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stepsize = n_batches * 4 logging.info("Setting stepsize of {}".format(stepsize)) lr_lambda = lambda iteration: (max_lr - min_lr)*(0.5 * (np.cos(np.pi * (1 + (3 - 1) / stepsize * iteration)) + 1))+min_lr scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda, last_epoch=-1) # lambda fun...
code_fim
hard
{ "lang": "python", "repo": "gchrupala/platalea", "path": "/platalea/basic.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gchrupala/platalea path: /platalea/basic.py from collections import Counter import logging import json import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from platalea.encoders import SpeechEncoder, ImageEncoder import platalea....
code_fim
hard
{ "lang": "python", "repo": "gchrupala/platalea", "path": "/platalea/basic.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def test_pre_refresh_token_callback__raises_key_error(self): authorizer = DummyAuthorizer(None) with pytest.raises(KeyError): await self.manager.pre_refresh_callback(authorizer) await self.manager.close() async def test_register(self): assert awa...
code_fim
hard
{ "lang": "python", "repo": "LilSpazJoekp/asyncpraw", "path": "/tests/unit/util/test_token_manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LilSpazJoekp/asyncpraw path: /tests/unit/util/test_token_manager.py """Test asyncpraw.util.refresh_token_manager.""" import sys from tempfile import NamedTemporaryFile import aiofiles import pytest from asynctest import mock from asyncpraw.util.token_manager import ( BaseTokenManager, F...
code_fim
hard
{ "lang": "python", "repo": "LilSpazJoekp/asyncpraw", "path": "/tests/unit/util/test_token_manager.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> await self.manager.post_refresh_callback(authorizer) assert authorizer.refresh_token is None assert await self.manager._get() == "dummy_value_updated" await self.manager.close() async def test_pre_refresh_token_callback(self): authorizer = DummyAuthorizer(None)...
code_fim
hard
{ "lang": "python", "repo": "LilSpazJoekp/asyncpraw", "path": "/tests/unit/util/test_token_manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> test_preds += preds.numpy() score = calculate_overall_lwlrap_sklearn(oof_preds, transformed_y).numpy()[0] print("Saving out-of-fold predictions...") all_oof_preds = pd.DataFrame(np.hstack((filenames, oof_preds)), columns = test.columns) all_oof_preds.to_csv('../kfolds/{}__{}.csv'.format(MODEL_NAME, ...
code_fim
hard
{ "lang": "python", "repo": "JoshVarty/AudioTagging", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mskf = MultilabelStratifiedKFold(n_splits=5, random_state=4, shuffle=True) for train_index, val_index in mskf.split(X, transformed_y): #Our clasifier stuff src = (ImageList.from_csv('../'/WORK/'image', Path('../../')/CSV_TRN_CURATED, folder='trn_curated', suffix='.jpg') .split_by_idx(v...
code_fim
hard
{ "lang": "python", "repo": "JoshVarty/AudioTagging", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoshVarty/AudioTagging path: /src/main.py import os import shutil import pandas as pd import numpy as np from sklearn.preprocessing import MultiLabelBinarizer from iterstrat.ml_stratifiers import MultilabelStratifiedKFold from fastai.vision import * import sklearn.metrics # Make required folders...
code_fim
hard
{ "lang": "python", "repo": "JoshVarty/AudioTagging", "path": "/src/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pgjones/quart path: /src/quart/debug.py from __future__ import annotations import inspect import sys from jinja2 import Template from .wrappers import Response TEMPLATE = """ <style> pre { margin: 0; } .traceback, .locals { display: table; width: 100%; margin: 5px; } .traceback>div,...
code_fim
hard
{ "lang": "python", "repo": "pgjones/quart", "path": "/src/quart/debug.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|><h1>{{ name }} <span>{{ value }}</span></h1> <ul> {% for frame in frames %} <li> <div class="header"> File <span class="info">{{ frame.file }}</span>, line <span class="info">{{ frame.line }}</span>, in </div> <div class="traceback"> {% for line in frame.cod...
code_fim
hard
{ "lang": "python", "repo": "pgjones/quart", "path": "/src/quart/debug.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jatin69/du-result-fetcher path: /development/2018/merge-restructured/config.py VIEWSTATE = '/wEPDwUKMTU1ODI4OTc2Mw8WAh4JSXBBZGRyZXNzBQwxMDMuNzguMTQ4LjgWAgIDD2QWCgIBD2QWAgIFDw8WAh4EVGV4dAU0UmVzdWx0cyAoMy1ZZWFyIFNlbWVzdGVyIEV4YW1pbmF0aW9uIE1heS1KdW5lIDIwMTggKWRkAgcPDxYCHwEFECAoTWF5LUp1bmUgMjAxOClkZ...
code_fim
hard
{ "lang": "python", "repo": "jatin69/du-result-fetcher", "path": "/development/2018/merge-restructured/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>yMzMDMjM3AzIyMwMwMTkDMDEwAzMxNAMwMjEDMDIyAzEwOQMwMjQDMDI1AzAyNgMwMjkDMDI4AzAzMAMwMzEDMDMyAzMwNgMwMzMDMDM0AzAzNQMwMzYDMDM4AzAzOQMwNDADMzEwAzMxMQMwNDEDMzE1AzA0MwMwNDQDMDQ3AzA0OAMwNDkDMDUzAzA1NAMwNTUDMDU4AzAyMAMwNTYDMDY4AzA2MgMwNjMDU09MAzA2NAMwNjUDMDY2AzA2NwMwNzEDMDczAzA3NAMwNzUEU09MUwMwNzYDMDc3AzA3OAMwNjkDM...
code_fim
hard
{ "lang": "python", "repo": "jatin69/du-result-fetcher", "path": "/development/2018/merge-restructured/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vicb1/python-reference path: /code/algorithms/bst-master/tests/test_bst_base.py import unittest from bst import BST, Node class TestBSTBase(unittest.TestCase): def setUp(self): <|fim_suffix|> self.subject.root = Node(25) self.subject.root.left = Node(15) self.subject....
code_fim
medium
{ "lang": "python", "repo": "vicb1/python-reference", "path": "/code/algorithms/bst-master/tests/test_bst_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.subject.root = Node(25) self.subject.root.left = Node(15) self.subject.root.right = Node(50) self.subject.root.left.left = Node(10) self.subject.root.left.right = Node(22) self.subject.root.left.left.left = Node(4) self.subject.root.left.left.ri...
code_fim
medium
{ "lang": "python", "repo": "vicb1/python-reference", "path": "/code/algorithms/bst-master/tests/test_bst_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: beneduzi/METEO path: /ecmwf_inmet/py/ecmwf_csv.py #!/usr/bin/python # coding: utf-8 import numpy as np import netCDF4 import math import sys import time import calendar import datetime from math import pi from numpy import cos, sin, arccos, power, sqrt, exp,arctan2 ## Entrada filename = (sys.ar...
code_fim
hard
{ "lang": "python", "repo": "beneduzi/METEO", "path": "/ecmwf_inmet/py/ecmwf_csv.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> d1 = date0 + datetime.timedelta(hours = i*12 + utc0) hora = d1.strftime('%Y%m%d %H:%M') tempc = tempk[i,ix,iy] - 273.15 # tempc_min = tempk_min[i,ix,iy] - 273.15 # tempc_max = tempk_max[i,ix,iy] - 273.15 # chuva_co = chuva_c[i,ix,iy] * 1000 chuva_to = chuva_t[i,ix,iy] * 1000 # if chuva_co < 0: # chuv...
code_fim
hard
{ "lang": "python", "repo": "beneduzi/METEO", "path": "/ecmwf_inmet/py/ecmwf_csv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>########################################################################################## #indices das coordenandas #iz,ix,iy = tunnel_fast(latvar, lonvar, lat0, lon0) ix,iy = tunnel_fast(latvar, lonvar, lat0, lon0) max_i = len(time) ####################################################################...
code_fim
hard
{ "lang": "python", "repo": "beneduzi/METEO", "path": "/ecmwf_inmet/py/ecmwf_csv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from pylightnix import PYLIGHTNIX_ROOT, PYLIGHTNIX_STORE, PYLIGHTNIX_TMP if not isdir(PYLIGHTNIX_ROOT): print( f"Warning: PYLIGHTNIX_ROOT directory ('{PYLIGHTNIX_ROOT}') doesn`t exist. " f"Please create either direcotry or a symlink with this name.") assert isdir(PYLIGHTNIX_STORE), \ (f"PYL...
code_fim
hard
{ "lang": "python", "repo": "stagedml/stagedml", "path": "/src/stagedml/devenv.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert isfile(join(STAGEDML_ROOT,'3rdparty','tensorflow_models','README.md')), \ (f"Git submodule {join(STAGEDML_ROOT,'3rdparty','tensorflow_models')} looks uninitialized. " f"Did you run `git submodule update --init`?") else: print(f"STAGEDML_ROOT env var is not set. We assume that you d...
code_fim
hard
{ "lang": "python", "repo": "stagedml/stagedml", "path": "/src/stagedml/devenv.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: stagedml/stagedml path: /src/stagedml/devenv.py from os import environ from os.path import join, islink, isdir, isfile from stagedml.utils.files import assert_link import tensorflow as tf assert tf.version.VERSION.startswith('2.1') or \ tf.version.VERSION.startswith('2.2'), \ (f"Stage...
code_fim
hard
{ "lang": "python", "repo": "stagedml/stagedml", "path": "/src/stagedml/devenv.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SentientHome/SentientHome path: /feed/feed.home.nest.py #!/usr/local/bin/python3 -u """ Author: Oliver Ratzesberger <https://github.com/fxstein> Copyright: Copyright (C) 2016 Oliver Ratzesberger License: Apache License, Version 2.0 """ # Make sure we have access to SentientHo...
code_fim
hard
{ "lang": "python", "repo": "SentientHome/SentientHome", "path": "/feed/feed.home.nest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: retries = 0 # app.log.info(json.dumps(nest._status, sort_keys=True)) # exit(1) # Retry loop for Nest communications while True: try: # Loop through Nest structures aka homes for structure in nest.structur...
code_fim
hard
{ "lang": "python", "repo": "SentientHome/SentientHome", "path": "/feed/feed.home.nest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tms1337/crypto-trader path: /bot/strategy/deciders/simple/offer/tests/test_percentbased.py import unittest from bot.strategy.deciders.simple.offer.percentbased import PercentBasedOfferDecider from bot.strategy.decision import OfferType from bot.strategy.pipeline.data.statsmatrix import StatsMatr...
code_fim
hard
{ "lang": "python", "repo": "tms1337/crypto-trader", "path": "/bot/strategy/deciders/simple/offer/tests/test_percentbased.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.decider = PercentBasedOfferDecider(buy_threshold=0, sell_threshold=0.1, currencies=self.currencies, trading_currency="BTC", ...
code_fim
hard
{ "lang": "python", "repo": "tms1337/crypto-trader", "path": "/bot/strategy/deciders/simple/offer/tests/test_percentbased.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.informer = InformerMock([1, 1, 1, 1.11, 1.11], self.exchanges, self.currencies) self._assert_buy() self._assert_none() self._assert_none() self._assert_sell() self._assert_buy() ...
code_fim
hard
{ "lang": "python", "repo": "tms1337/crypto-trader", "path": "/bot/strategy/deciders/simple/offer/tests/test_percentbased.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Trainer(BaseTrainer): def data(self): (x_train, y_train), (x_eval, y_eval) = datasets.boston_housing.load_data() x_train, x_eval = preprocess.standardize(x_train, x_eval) train_data, eval_data = (x_train, y_train), (x_eval, y_eval) return train_data, eval_dat...
code_fim
medium
{ "lang": "python", "repo": "daodaoliang/ModelZoo", "path": "/examples/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daodaoliang/ModelZoo path: /examples/train.py from model_zoo import flags, datasets, preprocess from model_zoo.trainer import BaseTrainer <|fim_suffix|>class Trainer(BaseTrainer): def data(self): (x_train, y_train), (x_eval, y_eval) = datasets.boston_housing.load_data() ...
code_fim
medium
{ "lang": "python", "repo": "daodaoliang/ModelZoo", "path": "/examples/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return len(s1) == len(s2) str2lower_if_samelength = \ FunctionTool.funcs_cond2compiled([cls.str2lower], f_cond) def str2lower_eachchar(s): return "".join(lmap(str2lower_if_samelength, s)) funcs = [cls.str2lower, str2lower_each...
code_fim
hard
{ "lang": "python", "repo": "yerihyo/foxylib", "path": "/foxylib/tools/string/string_tool.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yerihyo/foxylib path: /foxylib/tools/string/string_tool.py import ast import random import re from functools import reduce from operator import itemgetter as ig from typing import List from future.utils import lmap, lfilter from nose.tools import assert_false from foxylib.tools.collections.iter...
code_fim
hard
{ "lang": "python", "repo": "yerihyo/foxylib", "path": "/foxylib/tools/string/string_tool.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GabriellBP/mlclass path: /03_Validation/mlp.py # testing attributes for MLP import pandas as pd from sklearn.neural_network import MLPClassifier from sklearn.preprocessing import MinMaxScaler # different learning rate schedules and momentum parameters params = [{'solver': 'sgd', 'learning_rate':...
code_fim
hard
{ "lang": "python", "repo": "GabriellBP/mlclass", "path": "/03_Validation/mlp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def transform_sex_column(df): for idx, cell in enumerate(df['sex']): if cell == 'I': df.at[idx, 'sex'] = 0 elif cell == 'M': df.at[idx, 'sex'] = 1 else: df.at[idx, 'sex'] = -1 # load dataset data = pd.read_csv('abalone_dataset.csv') featur...
code_fim
hard
{ "lang": "python", "repo": "GabriellBP/mlclass", "path": "/03_Validation/mlp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # for each dataset, plot learning for each learning strategy print("\nlearning on dataset %s" % name) # Normalizing X = MinMaxScaler().fit_transform(X) for label, param in zip(labels, params): print("training: %s" % label) mlp = MLPClassifier(verbose=0, random_state=0,...
code_fim
hard
{ "lang": "python", "repo": "GabriellBP/mlclass", "path": "/03_Validation/mlp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_df = test_df[:7] return CausalManager(train_df, test_df, target_feature, ModelTask.REGRESSION, ['CHAS']) class TestCausalManagerTreatmentCosts: def test_zero_cost(self, cost_manager): with patch.object(cost_manager, '_create_policy', return_value=None)\ ...
code_fim
hard
{ "lang": "python", "repo": "ShabadVaswani/responsible-ai-widgets", "path": "/responsibleai/tests/test_causal/test_causal_manager.py", "mode": "spm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_suffix|> class TestCausalManagerTreatmentCosts: def test_zero_cost(self, cost_manager): with patch.object(cost_manager, '_create_policy', return_value=None)\ as mock_create: cost_manager.add(['ZN', 'RM', 'B'], treatment_cost=0) mock_create.assert_any_call(ANY, A...
code_fim
hard
{ "lang": "python", "repo": "ShabadVaswani/responsible-ai-widgets", "path": "/responsibleai/tests/test_causal/test_causal_manager.py", "mode": "spm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShabadVaswani/responsible-ai-widgets path: /responsibleai/tests/test_causal/test_causal_manager.py # Copyright (c) Microsoft Corporation # Licensed under the MIT License. import numpy as np import pytest from unittest.mock import patch, ANY from responsibleai import ModelAnalysis, ModelTask fro...
code_fim
hard
{ "lang": "python", "repo": "ShabadVaswani/responsible-ai-widgets", "path": "/responsibleai/tests/test_causal/test_causal_manager.py", "mode": "psm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: vegitron/spotseeker-server path: /spotseeker_server/test/hours/put.py from django.test import TestCase from django.conf import settings from django.test.client import Client from spotseeker_server.models import Spot, SpotAvailableHours import simplejson as json <|fim_suffix|> def test_hours...
code_fim
hard
{ "lang": "python", "repo": "vegitron/spotseeker-server", "path": "/spotseeker_server/test/hours/put.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with self.settings(SPOTSEEKER_AUTH_MODULE='spotseeker_server.auth.all_ok', SPOTSEEKER_SPOT_FORM='spotseeker_server.default_forms.spot.DefaultSpotForm'): spot = Spot.objects.create(name="This spot has available hours") etag = spot.etag put...
code_fim
hard
{ "lang": "python", "repo": "vegitron/spotseeker-server", "path": "/spotseeker_server/test/hours/put.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.maxDiff = None self.assertEquals(spot_dict["available_hours"], put_obj["available_hours"], "Data from the web service matches the data for the spot")<|fim_prefix|># repo: vegitron/spotseeker-server path: /spotseeker_server/test/hours/put.py from django.test import TestCase fr...
code_fim
hard
{ "lang": "python", "repo": "vegitron/spotseeker-server", "path": "/spotseeker_server/test/hours/put.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def setReminder(reminder): global DONE_reminder reminderList = ["-PT10M", "-PT30M", "-PT1H", "-PT2H", "-P1D"] if (reminder == "1"): DONE_reminder = reminderList[0] elif (reminder == "2"): DONE_reminder = reminderList[1] elif (reminder == "3"): DONE_reminder = re...
code_fim
hard
{ "lang": "python", "repo": "NagaruZ/CCZU-iCal", "path": "/script_zh.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save(string): f = open("class.ics", 'wb') f.write(string.encode("utf-8")) f.close() def icsCreateAndSave(): icsString = "BEGIN:VCALENDAR\nMETHOD:PUBLISH\nVERSION:2.0\nX-WR-CALNAME:课程表\nPRODID:-//Apple Inc.//Mac OS X 10.12//EN\nX-APPLE-CALENDAR-COLOR:#FC4208\nX-WR-TIMEZONE:Asia/Shang...
code_fim
hard
{ "lang": "python", "repo": "NagaruZ/CCZU-iCal", "path": "/script_zh.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NagaruZ/CCZU-iCal path: /script_zh.py import requests import json import sys import copy import datetime import time from random import Random from lxml import etree def LoginCookie(user: str, passwd: str) -> dict: session = requests.session() url = "http://jwcas.cczu.edu.cn/login" ...
code_fim
hard
{ "lang": "python", "repo": "NagaruZ/CCZU-iCal", "path": "/script_zh.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloudlet001/repo1 path: /try/dict.py # -*- coding:utf8 -*- ''' Created on 2018年4月11日 @author: bhlin ''' #Python函数 dict() #https://www.cnblogs.com/guyuyuan/p/6952442.html d1=dict() # 创建空字典 {} d2=dict(a='1', b='2', t='t') # 传入关键字 {'a': '1', 'b': '2', 't': 't'} d3 = dict(zip(['one', 'two',...
code_fim
medium
{ "lang": "python", "repo": "cloudlet001/repo1", "path": "/try/dict.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #list of keys keys=[k for k in d4] print "keys = %s" % (keys) # check if key k existed print "# check if key k existed" k="one" if k in d4: print "Has key : %s" % (k) if d4.has_key(k): print "Has key : %s" % (k) else: print "Has no key : %s" % (k) #li...
code_fim
hard
{ "lang": "python", "repo": "cloudlet001/repo1", "path": "/try/dict.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RT-Thread/rt-thread path: /bsp/stm32/libraries/STM32L4xx_HAL/SConscript import rtconfig from building import * # get current directory cwd = GetCurrentDir() # The set of source files associated with this SConscript file. src = Split(''' CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4...
code_fim
hard
{ "lang": "python", "repo": "RT-Thread/rt-thread", "path": "/bsp/stm32/libraries/STM32L4xx_HAL/SConscript", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if GetDepend(['BSP_USING_FMC']): src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_fmc.c'] if GetDepend(['BSP_USING_GFXMMU']): src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gfxmmu.c'] if GetDepend(['BSP_USING_DSI']): src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dsi.c'] src += ['STM32L4...
code_fim
hard
{ "lang": "python", "repo": "RT-Thread/rt-thread", "path": "/bsp/stm32/libraries/STM32L4xx_HAL/SConscript", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if GetDepend(['RT_USING_PM']): src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_lptim.c'] if GetDepend(['BSP_USING_ON_CHIP_FLASH']): src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c'] src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c'] src += ['STM32L4xx_HAL_Driver/Src/stm3...
code_fim
hard
{ "lang": "python", "repo": "RT-Thread/rt-thread", "path": "/bsp/stm32/libraries/STM32L4xx_HAL/SConscript", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>img = img[125:157, 10:img.shape[1] - 70] for i in range(4): image = img[:,i*int(img.shape[1]/4):(i+1)*int(img.shape[1]/4)] image = image.astype('uint8') image = Image.fromarray(image) image.show() image.save('type1_train_1_code_{}.jpg'.format(i))<|fim_prefix|># repo: lvyufeng/Captcha_r...
code_fim
hard
{ "lang": "python", "repo": "lvyufeng/Captcha_recognition", "path": "/type1_split.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lvyufeng/Captcha_recognition path: /type1_split.py import numpy as np from PIL import Image path = '/Users/lvyufeng/Documents/captcha_train_set/type1_train/type1_train_1.jpg' img = np.array(Image.open(path).convert('L'), 'f') img[img >= 200] = 255 img[img < 200] = 0 <|fim_suffix|>img = img[125:1...
code_fim
hard
{ "lang": "python", "repo": "lvyufeng/Captcha_recognition", "path": "/type1_split.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>eplace=False)) print(arr) DF = pd.DataFrame(arr) DF.to_csv("temp.csv")<|fim_prefix|># repo: sriharikapu/RandomSequenceGenerator path: /rand.py import sys; import numpy as np; import pandas as pd; np.set_printopti<|fim_middle|>ons(threshold=sys.maxsize) # replace the range, sample size with your custom ...
code_fim
medium
{ "lang": "python", "repo": "sriharikapu/RandomSequenceGenerator", "path": "/rand.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>custom numbers arr = np.array(np.random.choice(range(10000), 10000, replace=False)) print(arr) DF = pd.DataFrame(arr) DF.to_csv("temp.csv")<|fim_prefix|># repo: sriharikapu/RandomSequenceGenerator path: /rand.py import sys; import numpy as np; import pandas as pd; np.set_printopti<|fim_middle|>ons(thr...
code_fim
medium
{ "lang": "python", "repo": "sriharikapu/RandomSequenceGenerator", "path": "/rand.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sriharikapu/RandomSequenceGenerator path: /rand.py import sys; import numpy as np; import pandas as pd; np.set_printopti<|fim_suffix|>eplace=False)) print(arr) DF = pd.DataFrame(arr) DF.to_csv("temp.csv")<|fim_middle|>ons(threshold=sys.maxsize) # replace the range, sample size with your custom ...
code_fim
medium
{ "lang": "python", "repo": "sriharikapu/RandomSequenceGenerator", "path": "/rand.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def count_tokens(self, request: Request, completions: List[Sequence]) -> int: """ Counts the number of generated tokens. TODO: Cohere simply counts the number of generations, but we currently only support counting tokens. """ return sum(len(sequence.tokens) for ...
code_fim
easy
{ "lang": "python", "repo": "closerforever/helm", "path": "/src/helm/proxy/token_counters/cohere_token_counter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: closerforever/helm path: /src/helm/proxy/token_counters/cohere_token_counter.py from typing import List from helm.common.request import Request, Sequence from .token_counter import TokenCounter class CohereTokenCounter(TokenCounter): <|fim_suffix|> """ Counts the number of gener...
code_fim
medium
{ "lang": "python", "repo": "closerforever/helm", "path": "/src/helm/proxy/token_counters/cohere_token_counter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> plt.imshow( self, *args, cmap=plt.get_cmap(cmap_name), extent=self.extent, **kwargs ) if if_show: plt.colorbar(orientation='horizontal') plt.show() def show(self, *args, **kwargs): """A shortcut of :meth:`self.plot`. Jus...
code_fim
hard
{ "lang": "python", "repo": "TitorX/gkit", "path": "/gkit/core/raster.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }