text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: alldatacenter/alldata path: /govern/data-meta/amundsen/databuilder/databuilder/extractor/teradata_metadata_extractor.py # Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 from typing import ( # noqa: F401 Any, Dict, Iterator, Union, ) from pyhocon impor...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/govern/data-meta/amundsen/databuilder/databuilder/extractor/teradata_metadata_extractor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def all_conv_ops(self): return self._conv_to_gamma.keys() def _dfs(op, visited=None): """Perform DFS on a graph. Args: op: A tf.Operation, the root node for the DFS. visited: A set, used in the recursion. Returns: A list of the tf.Operations of type Conv2D that were...
code_fim
hard
{ "lang": "python", "repo": "UpCoder/ISBI_LiverLesionDetection", "path": "/models/research/morph_net/op_regularizers/gamma_mapper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._conv_to_gamma.keys() class ConvGammaMapperByConnectivity(GenericConvGammaMapper): """Maps a convolution to its BatchNorm gammas based on graph connectivity. Given a batch-norm gamma, propagates along the graph to find the convolutions that are batch-nomalized by this gamma. It ca...
code_fim
hard
{ "lang": "python", "repo": "UpCoder/ISBI_LiverLesionDetection", "path": "/models/research/morph_net/op_regularizers/gamma_mapper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UpCoder/ISBI_LiverLesionDetection path: /models/research/morph_net/op_regularizers/gamma_mapper.py # Copyright 2018 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
code_fim
hard
{ "lang": "python", "repo": "UpCoder/ISBI_LiverLesionDetection", "path": "/models/research/morph_net/op_regularizers/gamma_mapper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> event['message_type'] = 'alert-info' event['message'] = '' @view_config(context=Exception) def unknown_failure(request, exc): #import traceback logger.exception('unknown failure') #msg = exc.args[0] if exc.args else "" #response = Response('Ooops, something went wrong: %s' % (tra...
code_fim
hard
{ "lang": "python", "repo": "KatiRG/pyramid-phoenix", "path": "/phoenix/views/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return [dict(route_path=self.request.route_path("home"), title="Home")] from pyramid.view import ( view_config, notfound_view_config ) from pyramid.response import Response from pyramid.events import subscriber, BeforeRender @notfound_view_config(renderer='phoenix:templates/404.pt') ...
code_fim
hard
{ "lang": "python", "repo": "KatiRG/pyramid-phoenix", "path": "/phoenix/views/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KatiRG/pyramid-phoenix path: /phoenix/views/__init__.py from phoenix import models import logging logger = logging.getLogger(__name__) class MyView(object): def __init__(self, request, name, title, description=None): self.request = request self.session = self.request.session...
code_fim
hard
{ "lang": "python", "repo": "KatiRG/pyramid-phoenix", "path": "/phoenix/views/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dallariva93/TelegramSpesaBot path: /newspesabot/data_handler.py import time import pymongo TIMEOUT = 604800 # one week class DataHandler: @classmethod def insert_element(cls, user_id: str, obj: str, collection): last_update = time.time() key = {"user_id": user_id} ...
code_fim
medium
{ "lang": "python", "repo": "dallariva93/TelegramSpesaBot", "path": "/newspesabot/data_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> document = collection.find_one({"user_id": user_id}) elements = "" for element in document['list']: elements = elements + '\n' + element["name"] return elements @classmethod def delete_all(cls, user_id: str, collection): collection.update( {"use...
code_fim
medium
{ "lang": "python", "repo": "dallariva93/TelegramSpesaBot", "path": "/newspesabot/data_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LH3525/github path: /socket客户端.py from socket import * HOST = '127.0.0.1' SERVER_PORT = 21567 BUFSIZ = 1024 SERVER_ADDR = (HOST,SERVER_PORT) <|fim_suffix|> data = tcpclisock.recv(BUFSIZ) if not data: break print(data.decode()) tcpclisock.close()<|fim_middle|>#指明协议 tcpclisock = s...
code_fim
hard
{ "lang": "python", "repo": "LH3525/github", "path": "/socket客户端.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ADDR) while True: data = input('>>') if not data: break tcpclisock.send(data.encode()) data = tcpclisock.recv(BUFSIZ) if not data: break print(data.decode()) tcpclisock.close()<|fim_prefix|># repo: LH3525/github path: /socket客户端.py from socket import * HOST = '127....
code_fim
medium
{ "lang": "python", "repo": "LH3525/github", "path": "/socket客户端.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/modelscope/modelscope/models/audio/aec/layers/deep_fsmn.py # Copyright (c) Alibaba, Inc. and its affiliates. import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F from .layer_base import (LayerBase, expect_kaldi_matrix, expec...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/modelscope/modelscope/models/audio/aec/layers/deep_fsmn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output = expect_token_number( instr, '<LStride>', ) if output is None: raise Exception('UniDeepFsmn format error for <LStride>') instr, lstride = output self.lstride = lstride output = expect_token_number( ins...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/modelscope/modelscope/models/audio/aec/layers/deep_fsmn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class _C: def f(self) -> None: ... @classmethod def h(cls) -> None: ... def set_loky_pickler(loky_pickler: Optional[Any] = ...) -> None: ... def loads(buf: Any): ... def dump(obj: Any, file: Any, reducers: Optional[Any] = ..., protocol: Optional[Any] = ...) -> None: ... def dumps(obj: Any, re...
code_fim
medium
{ "lang": "python", "repo": "jdtzmn/kindle-news-assistant", "path": "/stubs/joblib/externals/loky/backend/reduction.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def dumps(obj: Any, reducers: Optional[Any] = ..., protocol: Optional[Any] = ...): ...<|fim_prefix|># repo: jdtzmn/kindle-news-assistant path: /stubs/joblib/externals/loky/backend/reduction.pyi from typing import Any, Optional class _ReducerRegistry: dispatch_table: Any = ... @classmethod de...
code_fim
medium
{ "lang": "python", "repo": "jdtzmn/kindle-news-assistant", "path": "/stubs/joblib/externals/loky/backend/reduction.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdtzmn/kindle-news-assistant path: /stubs/joblib/externals/loky/backend/reduction.pyi from typing import Any, Optional class _ReducerRegistry: dispatch_table: Any = ... @classmethod def register(cls, type: Any, reduce_func: Any) -> None: ... register: Any <|fim_suffix|>def set_loky...
code_fim
medium
{ "lang": "python", "repo": "jdtzmn/kindle-news-assistant", "path": "/stubs/joblib/externals/loky/backend/reduction.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return data, data_ids def save_data(data, data_ids, outdir, split): print ('Saving {} data...'.format(split)) saver = DataSaver(os.path.join(outdir, split), cfg, train=(split!='test')) for item,id in zip(data,data_ids): saver.write_image(id, item) saver.write_index() if...
code_fim
hard
{ "lang": "python", "repo": "LvHang/waldo", "path": "/egs/icdar2015/v1/local/process_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LvHang/waldo path: /egs/icdar2015/v1/local/process_data.py #!/usr/bin/env python3 # Copyright 2018 Johns Hopkins University (author: Yiwen Shao, Desh Raj) # Apache 2.0 """ This script prepares the training, validation and test data for ICDAR2015 in a pytorch fashion """ import os import argpar...
code_fim
hard
{ "lang": "python", "repo": "LvHang/waldo", "path": "/egs/icdar2015/v1/local/process_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Index01/GSL-vts path: /flask/helpfulDecorators.py from functools import wraps import json from jsonschema import validate, FormatChecker, ValidationError from datetime import datetime def json_attribs_check(func): """ Decorator for validating json, a thing we might do often. ...
code_fim
hard
{ "lang": "python", "repo": "Index01/GSL-vts", "path": "/flask/helpfulDecorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gslvtsSchema = {"type":"object", "properties":{ "tagID": {"type":"number"}, "UTC": {"type":"string", "format":"date-time"} }, "required":["tagID","UTC"] ...
code_fim
hard
{ "lang": "python", "repo": "Index01/GSL-vts", "path": "/flask/helpfulDecorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: znuxor/adventofcode2017 path: /12b.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from pprint import pprint with open('12a_data.txt', 'r') as problem_input: data_input = problem_input.read().split('\n') del(data_input[-1]) <|fim_suffix|>for node_number in range(len(data_input)): ...
code_fim
hard
{ "lang": "python", "repo": "znuxor/adventofcode2017", "path": "/12b.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> graph_nodes.add(current_node_number) new_nodes = [int(x.rstrip(',')) for x in data_input[current_node_number].split(' ')[2:]] for a_new_node in new_nodes: if a_new_node not in graph_nodes: build_graph(a_new_node) for node_number in range(len(data_input)): if node_numbe...
code_fim
hard
{ "lang": "python", "repo": "znuxor/adventofcode2017", "path": "/12b.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sardok/aiogear path: /examples/admin.py import sys import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import pprint import asyncio import argparse from aiogear import Admin def parse_args(): args = sys.argv[1:] parser = argparse.ArgumentParse...
code_fim
hard
{ "lang": "python", "repo": "sardok/aiogear", "path": "/examples/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Version result = await admin.version() pprint.pprint(result) # Verbose result = await admin.verbose() pprint.pprint(result) loop.stop() if __name__ == '__main__': args = parse_args() loop = asyncio.get_event_loop() loop.run_until_complete(main(loop, args.addr, ...
code_fim
hard
{ "lang": "python", "repo": "sardok/aiogear", "path": "/examples/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AdamSwenson/TwitterProject path: /DataAnalysis/ProcessingTools/Queues/AsyncQueues.py """ Created by adam on 5/4/18 """ __author__ = 'adam' import environment import asyncio from collections import deque from Server.ClientSide.Clients import Client # instrumenting to determine if running async f...
code_fim
hard
{ "lang": "python", "repo": "AdamSwenson/TwitterProject", "path": "/DataAnalysis/ProcessingTools/Queues/AsyncQueues.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # mark future as done # (we aren't waiting for the result, just the sending) future.set_result(True) return future async def flush_queue( self, future ): """Sends everything in queue to server""" b = [ self.store.pop() for _ in range( 0, len(self.store ...
code_fim
hard
{ "lang": "python", "repo": "AdamSwenson/TwitterProject", "path": "/DataAnalysis/ProcessingTools/Queues/AsyncQueues.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cedricxie/apollo-r3.0.0 path: /modules/drivers/lidar_velodyne/tools/extend/pose_tf_sender.py #!/usr/bin/env python import rospy # Because of transformations import tf import tf2_ros import geometry_msgs.msg import time import velodyne_msgs.msg import sensor_msgs.msg <|fim_suffix|>if __name...
code_fim
hard
{ "lang": "python", "repo": "cedricxie/apollo-r3.0.0", "path": "/modules/drivers/lidar_velodyne/tools/extend/pose_tf_sender.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> br = tf2_ros.TransformBroadcaster() t = geometry_msgs.msg.TransformStamped() if ctime: t.header.stamp = rospy.Time(ctime) else: t.header.stamp = rospy.Time.now() t.header.frame_id = "world" t.child_frame_id = "localization" t.transform.translation.x = 439917.45...
code_fim
medium
{ "lang": "python", "repo": "cedricxie/apollo-r3.0.0", "path": "/modules/drivers/lidar_velodyne/tools/extend/pose_tf_sender.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': rospy.init_node('tf_pose_sender') raw_topic_name = "/apollo/sensor/velodyne16/VelodyneScanUnified" pointcloud_topic_name = "/apollo/sensor/velodyne16/PointCloud2" rospy.Subscriber(pointcloud_topic_name, sensor_msgs.msg.PointCloud2, point_cloud_handler); rospy...
code_fim
medium
{ "lang": "python", "repo": "cedricxie/apollo-r3.0.0", "path": "/modules/drivers/lidar_velodyne/tools/extend/pose_tf_sender.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vs_name = vs['name'] vs_partition = vs['partition'] policy_partition = 'Common' v = bigip.tm.ltm.virtuals.virtual obj = v.load(name=vs_name, partition=vs_partition) p = obj.policies_s policies = p.get_collection() # see...
code_fim
hard
{ "lang": "python", "repo": "sapcc/f5-openstack-agent", "path": "/f5_openstack_agent/lbaasv2/drivers/bigip/listener_service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sapcc/f5-openstack-agent path: /f5_openstack_agent/lbaasv2/drivers/bigip/listener_service.py r definition. :param bigips: Array of BigIP class instances to delete Listener. """ vip = self.service_adapter.get_virtual_name(service) tls = self.service_adapter.get_tls(...
code_fim
hard
{ "lang": "python", "repo": "sapcc/f5-openstack-agent", "path": "/f5_openstack_agent/lbaasv2/drivers/bigip/listener_service.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _remove_ssl_profile(self, name, bigip): """Delete profile. :param name: Name of profile to delete. :param bigip: Single BigIP instances to update. """ try: ssl_client_profile = bigip.tm.ltm.profile.client_ssls.client_ssl if ssl_clien...
code_fim
hard
{ "lang": "python", "repo": "sapcc/f5-openstack-agent", "path": "/f5_openstack_agent/lbaasv2/drivers/bigip/listener_service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: x4nth055/pythoncode-tutorials path: /web-programming/news_project/news_app/urls.py from django.urls import path from .views import JournalistView, ArticleView, ArticleDetailView <|fim_suffix|>urlpatterns=[ path('journalist/', JournalistView.as_view() ), path('article/', ArticleView.as_vi...
code_fim
easy
{ "lang": "python", "repo": "x4nth055/pythoncode-tutorials", "path": "/web-programming/news_project/news_app/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns=[ path('journalist/', JournalistView.as_view() ), path('article/', ArticleView.as_view() ), path('article/<int:pk>/', ArticleDetailView.as_view()), ]<|fim_prefix|># repo: x4nth055/pythoncode-tutorials path: /web-programming/news_project/news_app/urls.py from django.urls import pat...
code_fim
easy
{ "lang": "python", "repo": "x4nth055/pythoncode-tutorials", "path": "/web-programming/news_project/news_app/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: goutomroy/django_channel2_watching_hollywood path: /watching_hollywood/celery.py from __future__ import absolute_import, unicode_literals from celery import Celery from celery.schedules import crontab import os from kombu import Exchange, Queue # set the default Django settings module for the '...
code_fim
hard
{ "lang": "python", "repo": "goutomroy/django_channel2_watching_hollywood", "path": "/watching_hollywood/celery.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'main.tasks.data_builder': 'high', 'main.tasks.pull_page': 'metered', } celery_app = Celery('watching_hollywood') celery_app.config_from_object(Config) celery_app.autodiscover_tasks()<|fim_prefix|># repo: goutomroy/django_channel2_watching_hollywood path: /watching_hollywood/celery....
code_fim
medium
{ "lang": "python", "repo": "goutomroy/django_channel2_watching_hollywood", "path": "/watching_hollywood/celery.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> task_routes = { 'main.tasks.data_builder': 'high', 'main.tasks.pull_page': 'metered', } celery_app = Celery('watching_hollywood') celery_app.config_from_object(Config) celery_app.autodiscover_tasks()<|fim_prefix|># repo: goutomroy/django_channel2_watching_hollywood path: /watch...
code_fim
hard
{ "lang": "python", "repo": "goutomroy/django_channel2_watching_hollywood", "path": "/watching_hollywood/celery.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mozilla-Games/OpenWebGamesTestDrive path: /run.py import subprocess, sys def run_process(cmd): <|fim_suffix|>cmd = ['python', 'emrun.py'] + sys.argv[1:] + ['--safe_firefox_profile', 'index.html', 'autorun'] run_process(cmd)<|fim_middle|> try: subprocess.check_call(cmd) except KeyboardInterrup...
code_fim
medium
{ "lang": "python", "repo": "Mozilla-Games/OpenWebGamesTestDrive", "path": "/run.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>cmd = ['python', 'emrun.py'] + sys.argv[1:] + ['--safe_firefox_profile', 'index.html', 'autorun'] run_process(cmd)<|fim_prefix|># repo: Mozilla-Games/OpenWebGamesTestDrive path: /run.py import subprocess, sys def run_process(cmd): <|fim_middle|> try: subprocess.check_call(cmd) except KeyboardInterrup...
code_fim
medium
{ "lang": "python", "repo": "Mozilla-Games/OpenWebGamesTestDrive", "path": "/run.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NYU-CI/RCCustomers path: /federated_fulltext_searches.py #### parsing functions from collections import OrderedDict from richcontext import scholapi as rc_scholapi import sys import datetime import json import re def get_xml_node_value (root, name): """ return the named value fro...
code_fim
hard
{ "lang": "python", "repo": "NYU-CI/RCCustomers", "path": "/federated_fulltext_searches.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def export(meta_list): file_name = "{}_{}_linkages.json".format(datetime.date.today().strftime("%Y%m%d"),re.sub(" ","_",search_term)) print('Writing {} results from 2 APIs to {}'.format(len(meta_list),file_name)) with open(file_name, 'w') as outfile: json.dump(meta_list, outfile,indent...
code_fim
hard
{ "lang": "python", "repo": "NYU-CI/RCCustomers", "path": "/federated_fulltext_searches.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> article_meta = result["MedlineCitation"]["Article"] meta = OrderedDict() meta["title"] = article_meta["ArticleTitle"] meta["journal"] = article_meta["Journal"]["Title"] meta["api"] = "pubmed" try: pid_list = article_meta["ELocationID"] if isinstance(pid_list,lis...
code_fim
hard
{ "lang": "python", "repo": "NYU-CI/RCCustomers", "path": "/federated_fulltext_searches.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for info in infoList: if(len(re.compile(r'Download').findall(info.text.strip()))): response = urlopen('https://muse.jhu.edu' + info['href']) filename = info['href'] + '.pdf' filename = filename.replace('/','') file =response.read() # 文件存储 with ope...
code_fim
medium
{ "lang": "python", "repo": "realhsq/Python-crawler", "path": "/1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: realhsq/Python-crawler path: /1.py from urllib.request import urlopen from urllib.request import Request from urllib import parse from bs4 import BeautifulSoup import os import re import ssl url = 'https://muse.jhu.edu/issue/938' req = Request(url) req.add_header("User-Agent","Mozilla/5....
code_fim
medium
{ "lang": "python", "repo": "realhsq/Python-crawler", "path": "/1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arita37/d-script path: /demo_pipeline/nnclass.py import h5py import numpy as np import matplotlib.pylab as plt import networkx ''' Analyzing the features extracted by Pat to create an adjacency matrix ''' datapath = '/fileserver' datapath = '/data/fs4/datasets' featfile = datapath+'/icdar13/be...
code_fim
medium
{ "lang": "python", "repo": "arita37/d-script", "path": "/demo_pipeline/nnclass.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> A = np.load(model) imfeat = imfeat / np.linalg.norm(imfeat) confidence = A.dot( imfeat.T ).squeeze() arglist = confidence.argsort()[::-1] confidence.sort() confidence = confidence[::-1] return arglist, confidence<|fim_prefix|># repo: arita37/d-script path: /demo_pipeline/nnc...
code_fim
medium
{ "lang": "python", "repo": "arita37/d-script", "path": "/demo_pipeline/nnclass.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdnavarrom/Numerical-Analytics-App path: /Guide.py from gi.repository import Gtk import gi gi.require_version('Gtk', '3.0') class Guide(Gtk.Grid): def __init__(self): self.grid = Gtk.Grid() self.grid = self.create_ui() def create_ui(self): grid = Gtk.Grid() ...
code_fim
hard
{ "lang": "python", "repo": "tdnavarrom/Numerical-Analytics-App", "path": "/Guide.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "El metodo de <b>Regla Falsa</b> funciona mediante un intervalo inicial [xi,xu], se encuentra el punto de interseccion del eje x con la recta secante que une los puntos (xi,f(xi) y (xu,f(xu) y se evalúa en la funcion f(x).\n" "La funcion f debe estar definida en el intervalo [xi,xu...
code_fim
hard
{ "lang": "python", "repo": "tdnavarrom/Numerical-Analytics-App", "path": "/Guide.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryanjung94/fastaiv2_study path: /04_SGD_example.py from fastai.vision.all import * from fastbook import * from matplotlib import pyplot as plt time = torch.arange(0, 20).float() print(time) speed = torch.randn(20) * 3 + 0.75*(time-9.5)**2 + 1 #plt.scatter(time, speed) #plt.show() def f(t, para...
code_fim
hard
{ "lang": "python", "repo": "ryanjung94/fastaiv2_study", "path": "/04_SGD_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>loss.backward() print(params.grad) print(params.grad * 1e-5) print(params) lr = 1e-5 params.data -= lr * params.grad.data params.grad = None preds = f(time, params) print(mse(preds, speed)) show_preds(preds) #plt.show() def apply_step(params, prn=True): preds = f(time, params) loss = mse(preds...
code_fim
hard
{ "lang": "python", "repo": "ryanjung94/fastaiv2_study", "path": "/04_SGD_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> form = ResetPasswordForm(data={}) assert not form.is_valid() assert form.errors == { 'password1': [_('This field is required.')], 'password2': [_('This field is required.')], }<|fim_prefix|># repo: jimialex/django-wise path: /apps/accounts/tests/uni...
code_fim
hard
{ "lang": "python", "repo": "jimialex/django-wise", "path": "/apps/accounts/tests/unit/forms/test_reset_password.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def test_blank_data(): form = ResetPasswordForm(data={}) assert not form.is_valid() assert form.errors == { 'password1': [_('This field is required.')], 'password2': [_('This field is required.')], }<|fim_prefix|># repo: jimiale...
code_fim
hard
{ "lang": "python", "repo": "jimialex/django-wise", "path": "/apps/accounts/tests/unit/forms/test_reset_password.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimialex/django-wise path: /apps/accounts/tests/unit/forms/test_reset_password.py # -*- coding: utf-8 -*- from apps.accounts.forms import ResetPasswordForm from django.utils.translation import ugettext_lazy as _ <|fim_suffix|> form = ResetPasswordForm(data={}) assert not form.i...
code_fim
hard
{ "lang": "python", "repo": "jimialex/django-wise", "path": "/apps/accounts/tests/unit/forms/test_reset_password.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k in minimal_set: value = unknown_summary[next(iter(unknown_summary[k]))] if isinstance(value['value'], dict): # print(k,value['value']['varDisplay']) minimal_set[k] = value['value']['varDisplay'] else: # print(k,value['symbol_context']['...
code_fim
hard
{ "lang": "python", "repo": "OpenDSA/OpenDSA", "path": "/tools/deforms_feedback.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenDSA/OpenDSA path: /tools/deforms_feedback.py f nodes in MET.subtree, # try to find leaf nodes in AET.subtree that they match with. # mark/unmark these as per match (possibly using dg_node_match or similar) # UPDATE: We're going to do this later when we only have leaf...
code_fim
hard
{ "lang": "python", "repo": "OpenDSA/OpenDSA", "path": "/tools/deforms_feedback.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenDSA/OpenDSA path: /tools/deforms_feedback.py operand = \ l_children[0] if "NegativeOne" in l_children[1] \ else l_children[1] if not "Symbol" in operand: continue ...
code_fim
hard
{ "lang": "python", "repo": "OpenDSA/OpenDSA", "path": "/tools/deforms_feedback.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> install_requires=[ 'tar-progress', 'click', 'tqdm' ], entry_points=''' [console_scripts] shadow=shadow.cli:main ''' )<|fim_prefix|># repo: jimimvp/shadow path: /setup.py from setuptools import setup from setuptools import setup setup( name...
code_fim
medium
{ "lang": "python", "repo": "jimimvp/shadow", "path": "/setup.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimimvp/shadow path: /setup.py from setuptools import setup from setuptools import setup setup( name='shadow', <|fim_suffix|> entry_points=''' [console_scripts] shadow=shadow.cli:main ''' )<|fim_middle|> version='0.1', keywords='Easy commandline encryption', ...
code_fim
medium
{ "lang": "python", "repo": "jimimvp/shadow", "path": "/setup.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: thonny/thonny path: /thonny/plugins/cells.py # -*- coding: utf-8 -*- import re from thonny import get_runner, get_workbench, ui_utils from thonny.codeview import CodeViewText cell_regex = re.compile(r"(^|\n)(# ?%%|##|# In\[\d+\]:)[^\n]*", re.MULTILINE) # @UndefinedVariable def update_editor...
code_fim
hard
{ "lang": "python", "repo": "thonny/thonny", "path": "/thonny/plugins/cells.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Looks like this solution is safe, but I don't dare to include it in the main code. UPDATE: not safe. Select and delete a block of lines. Write a new line and do Ctrl-Z""" original_intercept_mark = CodeViewText.intercept_mark def _patched_intercept_mark(self, *args): if a...
code_fim
hard
{ "lang": "python", "repo": "thonny/thonny", "path": "/thonny/plugins/cells.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkuennen/globus-cli path: /globus_cli/parsing/__init__.py from globus_cli.parsing.custom_group import globus_group from globus_cli.parsing.main_command_decorator import globus_main_func from globus_cli.parsing.case_insensitive_choice import CaseInsensitiveChoice from globus_cli.parsing.task_path...
code_fim
hard
{ "lang": "python", "repo": "tkuennen/globus-cli", "path": "/globus_cli/parsing/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 'CaseInsensitiveChoice', 'ENDPOINT_PLUS_OPTPATH', 'ENDPOINT_PLUS_REQPATH', 'TaskPath', 'one_use_option', 'HiddenOption', 'ISOTimeType', 'EXPLICIT_NULL', 'common_options', # Transfer options 'endpoint_id_arg', 'task_id_arg', 'task_submission_options', 'delete...
code_fim
hard
{ "lang": "python", "repo": "tkuennen/globus-cli", "path": "/globus_cli/parsing/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theseana/apondaone path: /Term 3/5/main-trace.py import tkinter as tk from tkinter import ttk from tkcalendar import DateEntry def register_btn(): f = first_name.get() l = last_name.get() b = birth_date.get() g = gender.get() template = f'{f},{l},{b},{g}\n' file = open(...
code_fim
hard
{ "lang": "python", "repo": "theseana/apondaone", "path": "/Term 3/5/main-trace.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tk.Label(register, text='Gender').grid(row=3, column=0) gender = tk.StringVar() gender.set('-select-') choices = ['F', 'M', 'Others', 'Not to Say'] tk.OptionMenu(register, gender, *choices).grid(row=3, column=1, sticky=tk.W+tk.E) tk.Button( register, text='Register', command=register_btn ...
code_fim
hard
{ "lang": "python", "repo": "theseana/apondaone", "path": "/Term 3/5/main-trace.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def max_pool(input, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME'): return tf.nn.max_pool(input, ksize=ksize, strides=strides, padding=padding) # Initial with tf.name_scope('input'): x = tf.placeholder(tf.float32, shape=[None, 784],name='x-input') y_label = tf.placeholder(tf.float...
code_fim
hard
{ "lang": "python", "repo": "Liang813/GRIST", "path": "/scripts/study_case/ID_24/Mnist.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Liang813/GRIST path: /scripts/study_case/ID_24/Mnist.py #-*-coding=utf-8-*- import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from datetime import datetime import numpy as np import sys import sys sys.path.append("/data") mnist = input_data.read_data_sets('MNIST_...
code_fim
hard
{ "lang": "python", "repo": "Liang813/GRIST", "path": "/scripts/study_case/ID_24/Mnist.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": unittest.main()<|fim_prefix|># repo: jschmer/MiniCheese path: /AllTests.py import unittest <|fim_middle|>from MoveTest import MoveTest from BoardTest import BoardTest from NegamaxPlayerTest import NegamaxPlayerTest
code_fim
medium
{ "lang": "python", "repo": "jschmer/MiniCheese", "path": "/AllTests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jschmer/MiniCheese path: /AllTests.py import unittest <|fim_suffix|>if __name__ == "__main__": unittest.main()<|fim_middle|>from MoveTest import MoveTest from BoardTest import BoardTest from NegamaxPlayerTest import NegamaxPlayerTest
code_fim
medium
{ "lang": "python", "repo": "jschmer/MiniCheese", "path": "/AllTests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: odai1990/data-structures-and-algorithms path: /challenges/QueueWithStacks/queuewithstacks/queue_with_stacks.py from queuewithstacks.stack import Stack class PseudoQueue: def __init__(self): ''' Create tow stacks ''' self.first_stack=Stack() self.seco...
code_fim
hard
{ "lang": "python", "repo": "odai1990/data-structures-and-algorithms", "path": "/challenges/QueueWithStacks/queuewithstacks/queue_with_stacks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' enqueue is method to add element ot queue ''' while self.second_stack.top: self.first_stack.push(self.second_stack.pop()) self.first_stack.push(value) def dequeue(self): ''' dequeue is method to return and delete element in queu...
code_fim
medium
{ "lang": "python", "repo": "odai1990/data-structures-and-algorithms", "path": "/challenges/QueueWithStacks/queuewithstacks/queue_with_stacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return render( request, "magplan/ideas/show.html", { "idea": idea, "form": form, "issues_suggesions": issues_suggesions, "comment_form": CommentModelForm(), "AUTHOR_TYPE_CHOICES": Idea.AUTHOR_TYPE_CHOICES, ...
code_fim
hard
{ "lang": "python", "repo": "f1nnix/magplan", "path": "/src/magplan/views/ideas.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == "POST": score = request.POST.get("score", DEFAULT_VOTE_SCORE) else: score = request.GET.get("score", DEFAULT_VOTE_SCORE) score = safe_cast(score, to=int, on_error=DEFAULT_VOTE_SCORE) allowed_scored: List[int] = [score_choice[0] for score_choice in Vot...
code_fim
hard
{ "lang": "python", "repo": "f1nnix/magplan", "path": "/src/magplan/views/ideas.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: f1nnix/magplan path: /src/magplan/views/ideas.py import datetime import os from typing import List, Tuple, Optional import django_filters import html2text from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.mail import EmailMultiAlternat...
code_fim
hard
{ "lang": "python", "repo": "f1nnix/magplan", "path": "/src/magplan/views/ideas.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: kokimoribe/subsample-seq path: /tests/test_cli.py """ Module for testing CLI See http://click.pocoo.org/6/testing/ """ import pytest from click.testing import CliRunner from subsample_seq import cli from subsample_seq.constants import FASTA, FASTQ @pytest.fixture(name='runner') def fixture_ru...
code_fim
hard
{ "lang": "python", "repo": "kokimoribe/subsample-seq", "path": "/tests/test_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = runner.invoke(cli.main, args, input=stdin) expected_output = r"""@test_record_0 ACCATTCCCCATAATCAGGGCTAGACCTCCACGGTAAACGGGAAATGCGCTTACGCTATTGTTCCATTACACAAC + VPz#iu16@J9f@Dx)J4f,}7Jt$;=+r7r^"}s6u950Hq+0'LX^C*%v9p8R/JY5N[2SA7XEe%mB`tm @test_record_3 AGACACAGATCAGCCCAAAGATTGATACTACAGTGTGAT...
code_fim
hard
{ "lang": "python", "repo": "kokimoribe/subsample-seq", "path": "/tests/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Test subsampling fastq file""" sample_size = 3 seed = 1 args = [ '--file-format', FASTQ, '--sample-size', sample_size, '--seed', seed, '-', '-' ] stdin = r"""@test_record_0 ACCATTCCCCATAATCAGGGCTAGACCTCCACGGTAAACGGGAAATGCGCTTACGCTATTGTTC...
code_fim
hard
{ "lang": "python", "repo": "kokimoribe/subsample-seq", "path": "/tests/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Logs progress using G loss, D loss, G(x), D(G(x)), visualizations of Generator output. Inputs: num_epochs: int, number of epochs to train for G_lr: float, learning rate for generator's Adam optimizer D_lr: float, learning rate for discri...
code_fim
hard
{ "lang": "python", "repo": "Wiki-fan/generative-models", "path": "/src/ns_gan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wiki-fan/generative-models path: /src/ns_gan.py """ (NS GAN) https://arxiv.org/abs/1406.2661 Non-saturating GAN. From the abstract: 'We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models: a generative model G that capt...
code_fim
hard
{ "lang": "python", "repo": "Wiki-fan/generative-models", "path": "/src/ns_gan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Compute the non-saturating loss for how D did versus the generations # of G using sigmoid cross entropy G_loss = -torch.mean(torch.log(DG_score + 1e-8)) return G_loss if __name__ == "__main__": from src.mnist_utils import * # Load in binarized MNIST data, sepa...
code_fim
hard
{ "lang": "python", "repo": "Wiki-fan/generative-models", "path": "/src/ns_gan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" __version__ = "0.1.dev0"<|fim_prefix|># repo: jangocheng/pytorch-lightning path: /src/pytorch-lightning/__init__.py """ ================= pytorch-lightning ================= <|fim_middle|>The Keras for ML researchers using PyTorch. More control. Less boilerplate.
code_fim
medium
{ "lang": "python", "repo": "jangocheng/pytorch-lightning", "path": "/src/pytorch-lightning/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__version__ = "0.1.dev0"<|fim_prefix|># repo: jangocheng/pytorch-lightning path: /src/pytorch-lightning/__init__.py """ ================= pytorch-lightning ================= <|fim_middle|>The Keras for ML researchers using PyTorch. More control. Less boilerplate. """
code_fim
medium
{ "lang": "python", "repo": "jangocheng/pytorch-lightning", "path": "/src/pytorch-lightning/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jangocheng/pytorch-lightning path: /src/pytorch-lightning/__init__.py """ ================= pytorch-lightning ================= <|fim_suffix|>__version__ = "0.1.dev0"<|fim_middle|>The Keras for ML researchers using PyTorch. More control. Less boilerplate. """
code_fim
medium
{ "lang": "python", "repo": "jangocheng/pytorch-lightning", "path": "/src/pytorch-lightning/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def format_time_str_to_timestamp(time_str, time_format='%Y-%m-%d'): return int(time.mktime(time.strptime(time_str, time_format))) def datetime_to_timestamp(dt, is_utc=False): """ :param dt: datetime or date instance :param is_utc: bool """ if not isinstance(dt, datetime.datetime...
code_fim
hard
{ "lang": "python", "repo": "kaka19ace/kkutil", "path": "/kkutil/type_util/time_tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :param dt: datetime or date instance :param is_utc: bool """ if not isinstance(dt, datetime.datetime): # it is date dt = datetime.datetime.combine(dt, datetime.time.min) return time.mktime(dt.timetuple()) if not is_utc else calendar.timegm(dt.utctimetuple())<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "kaka19ace/kkutil", "path": "/kkutil/type_util/time_tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaka19ace/kkutil path: /kkutil/type_util/time_tool.py #!/usr/bin/env python # -*- coding: utf-8 -*- # import sys import time import datetime import calendar from decimal import Decimal PY2 = (int(sys.version[0]) == 2) def seconds_to_duration_format(seconds=0, with_hour_output=False): <|fim_...
code_fim
hard
{ "lang": "python", "repo": "kaka19ace/kkutil", "path": "/kkutil/type_util/time_tool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ale, Sequence, Translation, ) __all__ = [ "BaseTransformation", "Identity", "MapAxis", "Translation", "Scale", "Affine", "Sequence", "get_transformation", "set_transformation", "remove_transformation", "get_transformation_between_coordinate_systems", ...
code_fim
medium
{ "lang": "python", "repo": "scverse/spatialdata", "path": "/src/spatialdata/transformations/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scverse/spatialdata path: /src/spatialdata/transformations/__init__.py from spatialdata.transformations.operations import ( align_elements_using_landmarks, get_transformation, get_transformation_between_coordinate_systems, get_transformation_betwee<|fim_suffix|>ale, Sequence, ...
code_fim
medium
{ "lang": "python", "repo": "scverse/spatialdata", "path": "/src/spatialdata/transformations/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iTsluku/codenames-pysimplegui path: /codenamesGUI.py mport * from collections import deque initModel = False stack = deque() ''' state 0 : no active game state 1 : team1 enter codename state 2 : team1 guess names state 3 : team2 enter codename state 4 : team2 guess names ''' state = 0 # default...
code_fim
hard
{ "lang": "python", "repo": "iTsluku/codenames-pysimplegui", "path": "/codenamesGUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if gamesLeft <= 3: window['games-counter'].update(text_color=colorGold) else: window['games-counter'].update(text_color="white") # init gui window = sg.Window('codenames', layout, finalize=True) toggle = True while True: event, values = window.read() if event == 'exit'...
code_fim
hard
{ "lang": "python", "repo": "iTsluku/codenames-pysimplegui", "path": "/codenamesGUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iTsluku/codenames-pysimplegui path: /codenamesGUI.py ont=( "Helvetica", fs), k='out-text12'), sg.Button('', size=(tsh, tsv), font=( "Helvetica", fs), k='out-text13'), sg.Button('', size=(tsh, tsv), font=( "Helvetica", fs), k='out-text14'), sg.Button('', s...
code_fim
hard
{ "lang": "python", "repo": "iTsluku/codenames-pysimplegui", "path": "/codenamesGUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arfaghif/Python-Compiler-CNF path: /a/Foldertubes/Test Case/TC05.py import sys class Car: def __init__(self): self.engine = None self.price = 0 self.brand = '' self.gas = 0 def set_engine(self, engine): self.engine = engine def set_price(self, price): self.price = price de...
code_fim
medium
{ "lang": "python", "repo": "arfaghif/Python-Compiler-CNF", "path": "/a/Foldertubes/Test Case/TC05.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(10): print('TBFO matkul favoritku') continue if __name__ == '__main__': car = Car() car.do_nothing() for i in range(10): car.fill_gas(4) car.go() if i == 5: break print(car is Car)<|fim_prefix|># repo: arfaghif/Python-Compiler-CNF path: /a/Foldertubes/Test Case/TC...
code_fim
hard
{ "lang": "python", "repo": "arfaghif/Python-Compiler-CNF", "path": "/a/Foldertubes/Test Case/TC05.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save_car_model(self): with open('car.model', 'r') as f_out: f_out.writelines(self.engine) f_out.writelines(self.price) f_out.writelines(self.brand) f_out.writelines(self.gas) def do_nothing(self): pass def go(self): km = 0 tired = False while not tired and self.gas > 0:...
code_fim
hard
{ "lang": "python", "repo": "arfaghif/Python-Compiler-CNF", "path": "/a/Foldertubes/Test Case/TC05.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ptr-yudai/ptrlib path: /examples/pwn/ex_sock.py #!/usr/bin/env python from ptrlib import * # establish connection sock = Socket("www.example.com", 80) <|fim_suffix|># receive request until Content-Length sock.recvuntil("Content-Length: ") # receive a line l = int(sock.recvline()) print("Conten...
code_fim
medium
{ "lang": "python", "repo": "ptr-yudai/ptrlib", "path": "/examples/pwn/ex_sock.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># close connection sock.close() # establish connection sock = Socket("www.example.com", 80) # send request request = b'GET / HTTP/1.1\r\n' request += b'Host: www.example.com\r\n\r\n' sock.send(request) print("Content-Length = {}".format(sock.recvlineafter('Content-Length: '))) # close connection sock....
code_fim
medium
{ "lang": "python", "repo": "ptr-yudai/ptrlib", "path": "/examples/pwn/ex_sock.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1ayham1/Autonomous_Systems-semantic_segmentation path: /main.py import os.path import tensorflow as tf import helper import warnings from distutils.version import LooseVersion import project_tests as tests # Check TensorFlow Version assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'P...
code_fim
hard
{ "lang": "python", "repo": "1ayham1/Autonomous_Systems-semantic_segmentation", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> training_loss = my_loss/ num_examples train_loss_List.append(training_loss) print("EPOCH {} ...".format(epoch+1)) print("Train loss = {:.3f}".format(training_loss)) print("Time: %.3f seconds" % (time.time() - start_time)) print() # Visualize Results for...
code_fim
hard
{ "lang": "python", "repo": "1ayham1/Autonomous_Systems-semantic_segmentation", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MinaProtocol/mina path: /automation/scripts/github_branch_autosync/github_autosync/__main__.py """ Cli & Debug entrypoint """ import json import argparse import os import sys from gcloud_entrypoint import handle_incoming_commit_push_json,config,verify_signature <|fim_suffix|>with open(args.payl...
code_fim
hard
{ "lang": "python", "repo": "MinaProtocol/mina", "path": "/automation/scripts/github_branch_autosync/github_autosync/__main__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if not os.path.isfile(args.payload): sys.exit('cannot find test file :',args.payload) with open(args.payload,encoding="utf-8") as file: data = json.load(file) json_payload = json.dumps(data) verify_signature(json_payload, args.secret, "sha=" + args.incoming_signature)<|fim_prefix|># repo:...
code_fim
hard
{ "lang": "python", "repo": "MinaProtocol/mina", "path": "/automation/scripts/github_branch_autosync/github_autosync/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nigelmathes/GAME path: /world/character/views.py from django.contrib.auth.models import User from rest_framework import permissions from rest_framework import viewsets from character.models import Character, Abilities, AbilityEffects, AbilityEnhancements, PlayerClasses from character.serializers...
code_fim
hard
{ "lang": "python", "repo": "nigelmathes/GAME", "path": "/world/character/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }