text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: epowers/arc path: /src/build/sync_arc_int.py #!src/build/run_python # # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # """Syncs our code in internal/ and the Android internal repos t...
code_fim
hard
{ "lang": "python", "repo": "epowers/arc", "path": "/src/build/sync_arc_int.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def sync_repo(target_revision): logging.info('Resetting %s to %s' % (_ARC_INTERNAL_DIR, target_revision)) git.reset_to_revision(target_revision, cwd=_ARC_INTERNAL_DIR) def run(): OPTIONS.parse_configure_file() # Check if internal/ exists. Run git-clone if not. if not os.path.isdir(_ARC_INTERN...
code_fim
hard
{ "lang": "python", "repo": "epowers/arc", "path": "/src/build/sync_arc_int.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TD22057/T-Home path: /python/tHome/eagle/messages/Base.py #=========================================================================== # # Base class for messages # #=========================================================================== import datetime from . import convert #===============...
code_fim
hard
{ "lang": "python", "repo": "TD22057/T-Home", "path": "/python/tHome/eagle/messages/Base.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> i = " "*indent s = "%s(\n" % self.name for key in dir( self ): if key[0] == "_": continue v = getattr( self, key ) if callable( v ): continue if hasattr( v, "_format" ): s += "%s%s : %s,\n" % ( i, key, v....
code_fim
hard
{ "lang": "python", "repo": "TD22057/T-Home", "path": "/python/tHome/eagle/messages/Base.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if os.path.getmtime(i_path) <= os.path.getmtime(o_path): exit(0) with open(i_path, 'r') as i: with open(o_path, 'w') as o: text = i.read() html = markdown.markdown(text) o.write(layout.format(html=html, style=style)) print("saved " + o_path)<|fim_prefix|># repo: PacketImpact/lvpngui path: /re...
code_fim
medium
{ "lang": "python", "repo": "PacketImpact/lvpngui", "path": "/render_changelog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open(i_path, 'r') as i: with open(o_path, 'w') as o: text = i.read() html = markdown.markdown(text) o.write(layout.format(html=html, style=style)) print("saved " + o_path)<|fim_prefix|># repo: PacketImpact/lvpngui path: /render_changelog.py #!/usr/bin/env python3 import os import markdown ...
code_fim
hard
{ "lang": "python", "repo": "PacketImpact/lvpngui", "path": "/render_changelog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacketImpact/lvpngui path: /render_changelog.py #!/usr/bin/env python3 import os import markdown layout = """<!DOCTYPE html> <html> <head> <title>Changelog</title> <style type="text/css">{style}</style> </head> <body>{html}</body> </html> """ style = """ body { background: #303030; color: #ff...
code_fim
hard
{ "lang": "python", "repo": "PacketImpact/lvpngui", "path": "/render_changelog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ppasc4l/memerbot path: /groupmebot/RedditBot.py """ Ian Dansereau GroupMeReddit RedditBot.py 5/5/16 """ import time from collections import OrderedDict from enum import Enum from urllib.request import urlopen from groupy import Group, Bot, config from praw import Reddit from gr...
code_fim
hard
{ "lang": "python", "repo": "ppasc4l/memerbot", "path": "/groupmebot/RedditBot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def getLatestMessage(self): return self.group.messages().newest def connectBot(self): try: bot = [bot for bot in Bot.list() if bot.bot_id == self.botID][0] group = [group for group in Group.list() if group.group_id == self.groupID][0] if bot is ...
code_fim
hard
{ "lang": "python", "repo": "ppasc4l/memerbot", "path": "/groupmebot/RedditBot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e contains N. The second line contains the value of the N integers separated by space(s). Output Format: The first line contains N integers separated by space. Example Input/Output 1: Input: 10 45 22 14 14 45 23 23 23 45 45 Output: 4 1 2 2 4 3 3 3 4 4 Example Input/Output 2: Input: 6 11 45 45 67 67 67 Out...
code_fim
hard
{ "lang": "python", "repo": "muhammad-masood-ur-rehman/Skillrack", "path": "/Python Programs/python-program-to-print-number-frequency.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>4 14 45 23 23 23 45 45 Output: 4 1 2 2 4 3 3 3 4 4 Example Input/Output 2: Input: 6 11 45 45 67 67 67 Output: 1 2 2 3 3 3 n=int(input()) l=list(map(int,input().split())) print(*[l.count(i) for i in l])<|fim_prefix|># repo: muhammad-masood-ur-rehman/Skillrack path: /Python Programs/python-program-to-print...
code_fim
hard
{ "lang": "python", "repo": "muhammad-masood-ur-rehman/Skillrack", "path": "/Python Programs/python-program-to-print-number-frequency.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: muhammad-masood-ur-rehman/Skillrack path: /Python Programs/python-program-to-print-number-frequency.py Python Program To Print Number Frequency An array of N integers is passed as the input to the program. The program must modify the array such that each element in the array is replaced by its f...
code_fim
hard
{ "lang": "python", "repo": "muhammad-masood-ur-rehman/Skillrack", "path": "/Python Programs/python-program-to-print-number-frequency.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lxn5321/-youku- path: /youku服务端/interface/login_user_data.py from youku服务端.db import models import os from youku服务端.lib import common def check_notic_by_count(count=None): """ 查看功能的方法,供内部调用 count为None查全部,为1查一条<|fim_suffix|> for notice in notice_list: back_notice_li...
code_fim
medium
{ "lang": "python", "repo": "lxn5321/-youku-", "path": "/youku服务端/interface/login_user_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> back_notice_list.append({notice_list[last_row].name:notice_list[last_row].content}) return back_notice_list else: return False<|fim_prefix|># repo: lxn5321/-youku- path: /youku服务端/interface/login_user_data.py from youku服务端.db import models import os from youku服务端.lib im...
code_fim
medium
{ "lang": "python", "repo": "lxn5321/-youku-", "path": "/youku服务端/interface/login_user_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: magdev/opds-proxy path: /catalog/views/api.py from django.core.paginator import Paginator from django.db.models import Q from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from catalog.models import Book, BookStats from ca...
code_fim
hard
{ "lang": "python", "repo": "magdev/opds-proxy", "path": "/catalog/views/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @api_view() def recent(request): limit = request.GET.get('limit', 10) entries = Book.objects.all().order_by('-updated_at')[:int(limit)] serializer = BookSerializer(entries, many = True, context = {'request': request}) result = { 'limit': limit, 'results': serialize...
code_fim
hard
{ "lang": "python", "repo": "magdev/opds-proxy", "path": "/catalog/views/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> query = request.GET.get('q', None) page = request.GET.get('page', 1) if query is not None: results = Book.objects.filter( Q(title__icontains = query) | Q(summary__icontains = query) | Q(description__icontains = query) ).order_by('-year', 'ti...
code_fim
hard
{ "lang": "python", "repo": "magdev/opds-proxy", "path": "/catalog/views/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaikiranKannaiah436/radip path: /UnitTests/test_sequenceWrangler.py from unittest import TestCase import SequenceWrangler import numpy as np import pandas as pd import parameters class TestSequenceWrangler(TestCase): #Test the function that creates all possible def test__rnn_data_np_tri...
code_fim
medium
{ "lang": "python", "repo": "SaikiranKannaiah436/radip", "path": "/UnitTests/test_sequenceWrangler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test__dis_from_ref_line(self): a = np.arange(-10,0) z = np.zeros(len(a)) data = np.array([a,z]).transpose() dataWrangler = SequenceWrangler.SequenceWrangler(parameters,data, training=1.0, test=0, val=0) dis = dataWrangler._dis_from_ref_line(data,4) s...
code_fim
hard
{ "lang": "python", "repo": "SaikiranKannaiah436/radip", "path": "/UnitTests/test_sequenceWrangler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> username = "john" user = {"username": username, "email": f"{username}@example.com"} mock_get_user.return_value = user apigatewayv2_proxy_event = { "rawPath": f"/users/{username}", "requestContext": { "http": { "met...
code_fim
hard
{ "lang": "python", "repo": "ego/usermanagement-backend", "path": "/tests/test_api_runtime_lambda_function.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ego/usermanagement-backend path: /tests/test_api_runtime_lambda_function.py import json import unittest from unittest import mock from api.runtime import lambda_function # type: ignore <|fim_suffix|> @mock.patch.dict( "helpers.os.environ", {"DATABASE_DYNAMODB_TABLE_NAME": "AppTestCa...
code_fim
medium
{ "lang": "python", "repo": "ego/usermanagement-backend", "path": "/tests/test_api_runtime_lambda_function.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ramyaa01-mlcraze/SIH-templates path: /LICENSE.md/SIH html/app.py from flask import Flask, render_template, request, redirect, url_for, flash from helper import load_records, assignAttendance, displayPresent, visitJson import os app = Flask(__name__) # <--- Main ---> att_list = [] BOOL =...
code_fim
hard
{ "lang": "python", "repo": "Ramyaa01-mlcraze/SIH-templates", "path": "/LICENSE.md/SIH html/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/schedule-visit/confirm', methods=['GET', 'POST']) def schedule_visit(): args = request.args.to_dict() visitJson(args) flash('Visit Scheduled') return redirect(url_for('index')) def main(): app.secret_key = os.urandom(24) app.run(port=5000, debug=True) if _...
code_fim
hard
{ "lang": "python", "repo": "Ramyaa01-mlcraze/SIH-templates", "path": "/LICENSE.md/SIH html/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linbo0518/CSE-5334-Data-Mining path: /Assignments/Homework 1/p1/kmeans.py import numpy as np class KMeans: def __init__(self, k, c=None, tol=1e-3, max_iter=10000): assert k > 1, f"k should be greater than 1, but now is {k}" self._k = k if c: assert k == ...
code_fim
hard
{ "lang": "python", "repo": "linbo0518/CSE-5334-Data-Mining", "path": "/Assignments/Homework 1/p1/kmeans.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> centers = list() indexes = list() indexes.append(np.random.randint(len(x))) center_1 = x[indexes[-1]] centers.append(center_1) dist_array = self._compute_dist(x, center_1).tolist() indexes.append(np.argmax(dist_array)) centers.append(x[indexe...
code_fim
hard
{ "lang": "python", "repo": "linbo0518/CSE-5334-Data-Mining", "path": "/Assignments/Homework 1/p1/kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Ad, AdAdmin)<|fim_prefix|># repo: nicksergeant/snipt-old path: /ad/admin.py from snipt.ad.models import Ad from django.contrib import admin class AdAdmin(admin.ModelAdmin): <|fim_middle|> list_display = ('title','tags','url','image',) ordering = ('title',)
code_fim
medium
{ "lang": "python", "repo": "nicksergeant/snipt-old", "path": "/ad/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicksergeant/snipt-old path: /ad/admin.py from snipt.ad.models import Ad from django.contrib import admin <|fim_suffix|> list_display = ('title','tags','url','image',) ordering = ('title',) admin.site.register(Ad, AdAdmin)<|fim_middle|>class AdAdmin(admin.ModelAdmin):
code_fim
easy
{ "lang": "python", "repo": "nicksergeant/snipt-old", "path": "/ad/admin.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, nin, nhid, nout, hebb='h,z,r', ln=True): self.rnn = GRU(nin, nhid, hebb=set(hebb.split(',')), ln=True) self.out = nn.Linear(nhid, nout) self.enc = vae.encoder() self.dec = vae.decoder() def forward(self, x, hid, hebb=None): x = s...
code_fim
hard
{ "lang": "python", "repo": "ajabri/differentiable-plasticity", "path": "/simple_vae.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return yout, hebb, out def initialZeroState(self): # Return an initialized, all-zero hidden state return Variable(torch.zeros(1, self.nhid).type(ttype)) def initialZeroHebb(self): # Return an initialized, all-zero Hebbian trace return Variable(torch.zeros(...
code_fim
hard
{ "lang": "python", "repo": "ajabri/differentiable-plasticity", "path": "/simple_vae.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajabri/differentiable-plasticity path: /simple_vae.py # For CPU ttype = torch.cuda.FloatTensor; # For GPU bce_loss = nn.BCELoss().type(ttype) class GRU(nn.Module): def __init__(self, nin, nout, hebb=set(), ln=True): super(GRU, self).__init__() self.h = Cell(nin,...
code_fim
hard
{ "lang": "python", "repo": "ajabri/differentiable-plasticity", "path": "/simple_vae.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Roboy/roboy_plexus path: /arm/usr/lib/python2.7/dist-packages/rospkg/common.py # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provide...
code_fim
medium
{ "lang": "python", "repo": "Roboy/roboy_plexus", "path": "/arm/usr/lib/python2.7/dist-packages/rospkg/common.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ A ROS filesystem resource was not found. """ def __init__(self, msg, ros_paths=None): super(ResourceNotFound, self).__init__(msg) self.ros_paths = ros_paths def __str__(self): s = self.args[0] # python 2.6 if self.ros_paths: for i, p i...
code_fim
medium
{ "lang": "python", "repo": "Roboy/roboy_plexus", "path": "/arm/usr/lib/python2.7/dist-packages/rospkg/common.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> except (IOError, OSError) as e: error = 'Failed to Load file: {0}'.format([e]) finally: if fh is not None: fh.close() if error is not None: return False, error self.__dirty = False return True, 'Loaded {0} movie Records from {1}'.format([len(self.__movies), QFileInfo(self.__fna...
code_fim
hard
{ "lang": "python", "repo": "MeNsaaH/movie-player-pyqt5", "path": "/qdatastream.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MeNsaaH/movie-player-pyqt5 path: /qdatastream.py from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * import container class ClassName(container.MovieContainer): """docstring for ClassName""" def __init__(self): pass def saveQDataStream(self): <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "MeNsaaH/movie-player-pyqt5", "path": "/qdatastream.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stonedestroyer/baiumbg-Cogs path: /mxl/dclasses.py import dataclasses from .constants import TRADE_POST_SETS_SECTION, TRADE_POST_SU_SECTION, TRADE_POST_SSU_SECTION,\ TRADE_POST_SSSU_SECTION, TRADE_POST_RUNEWORDS_SECTION, TRADE_POST_RAQMOJ_SECTION,\ TR...
code_fim
hard
{ "lang": "python", "repo": "Stonedestroyer/baiumbg-Cogs", "path": "/mxl/dclasses.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ssu_str = '' for item in sorted(self.ssu.values(), key=lambda k: k.name): ssu_str += f'[item]{item.name}[/item] x{item.amount}\n' if item.amount > 1 else f'[item]{item.name}[/item]\n' if ssu_str: items_section += TRADE_POST_SSU_SECTION.format(items = ssu_st...
code_fim
hard
{ "lang": "python", "repo": "Stonedestroyer/baiumbg-Cogs", "path": "/mxl/dclasses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shouqun/node-skia path: /gyp/opts.gyp { 'includes': [ 'common.gypi' ], 'targets': [ # Due to an unfortunate intersection of lameness between gcc and gyp, # we have to build the *_SSE2.cpp files in a separate target. The # gcc lameness is that, in order to compile SSE2 intri...
code_fim
hard
{ "lang": "python", "repo": "Shouqun/node-skia", "path": "/gyp/opts.gyp", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> }, }], [ 'skia_arch_type == "x86"', { 'sources': [ '../deps/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp', ], }], ], }, # NEON code must be compiled with -mfpu=neon which also affects scalar # code. To support dynamic NEON code...
code_fim
hard
{ "lang": "python", "repo": "Shouqun/node-skia", "path": "/gyp/opts.gyp", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def ProcessOutput(response, args): """Wait for operations to finish and return the resource.""" api_version = utils.GetApiVersionFromArgs(args) utils.WaitForOperation(response, api_version) project = utils.GetProject() location = utils.GetLocation(args) resource_ref = resources.REGISTRY.Creat...
code_fim
hard
{ "lang": "python", "repo": "google-cloud-sdk-unofficial/google-cloud-sdk", "path": "/lib/googlecloudsdk/command_lib/media/asset/transformers/hooks.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: google-cloud-sdk-unofficial/google-cloud-sdk path: /lib/googlecloudsdk/command_lib/media/asset/transformers/hooks.py # -*- coding: utf-8 -*- # # Copyright 2021 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
code_fim
medium
{ "lang": "python", "repo": "google-cloud-sdk-unofficial/google-cloud-sdk", "path": "/lib/googlecloudsdk/command_lib/media/asset/transformers/hooks.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Data4ITBV/Dryvo path: /migrations/versions/62c10b7111e4_.py """empty message Revision ID: 62c10b7111e4 Revises: c4734f6489df Create Date: 2019-04-01 19:52:11.577324 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '62c10b7111e4' down_revis...
code_fim
hard
{ "lang": "python", "repo": "Data4ITBV/Dryvo", "path": "/migrations/versions/62c10b7111e4_.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('students', 'creator_id', existing_type=sa.INTEGER(), nullable=False) op.add_column('users', sa.Column('image', sa.String(length=240), nullable=True)) # ### end Alemb...
code_fim
medium
{ "lang": "python", "repo": "Data4ITBV/Dryvo", "path": "/migrations/versions/62c10b7111e4_.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_column('users', 'image') op.alter_column('students', 'creator_id', existing_type=sa.INTEGER(), nullable=True) # ### end Alembic commands ###<|fim_prefix|># repo: Data4ITBV/Dryvo path: /migr...
code_fim
medium
{ "lang": "python", "repo": "Data4ITBV/Dryvo", "path": "/migrations/versions/62c10b7111e4_.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>m_height = height.query("sex=='M'").height f_height = height.query("sex=='F'").height a_height = height.height print(stats.f_oneway(m_height, a_height)) print(stats.f_oneway(f_height, a_height)) print(stats.f_oneway(m_height, f_height)) B = ols('height ~ C(sex)',data=height).fit() print(anova.a...
code_fim
medium
{ "lang": "python", "repo": "linxiaohui/CodeRepoPy", "path": "/StatisticsCode/ANOVA_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(stats.f_oneway(m_height, a_height)) print(stats.f_oneway(f_height, a_height)) print(stats.f_oneway(m_height, f_height)) B = ols('height ~ C(sex)',data=height).fit() print(anova.anova_lm(B))<|fim_prefix|># repo: linxiaohui/CodeRepoPy path: /StatisticsCode/ANOVA_example.py # -*- coding: utf-8 -...
code_fim
medium
{ "lang": "python", "repo": "linxiaohui/CodeRepoPy", "path": "/StatisticsCode/ANOVA_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linxiaohui/CodeRepoPy path: /StatisticsCode/ANOVA_example.py # -*- coding: utf-8 -*- import pandas as pd import scipy.stats as stats from statsmodels.formula.api import ols import statsmodels.stats.anova as anova galton = pd.read_csv("galton.csv") <|fim_suffix|>print(stats.f_oneway(m_...
code_fim
medium
{ "lang": "python", "repo": "linxiaohui/CodeRepoPy", "path": "/StatisticsCode/ANOVA_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tetris-hermetris/cathedral path: /cathedral/utils/utils.py def sgn(x): return ((x > 0) - (x < 0)) * 1 def normalize(poly_sequence): '''Returns flat sequence of polygons''' <|fim_suffix|> def declare(name, value): globals()[name] = value print('from utils', globals())<|fim_middle|> return p...
code_fim
easy
{ "lang": "python", "repo": "tetris-hermetris/cathedral", "path": "/cathedral/utils/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Returns flat sequence of polygons''' return poly_sequence def declare(name, value): globals()[name] = value print('from utils', globals())<|fim_prefix|># repo: tetris-hermetris/cathedral path: /cathedral/utils/utils.py def sgn(x): return ((x > 0) - (x < 0)) * 1 <|fim_middle|>def normalize(po...
code_fim
easy
{ "lang": "python", "repo": "tetris-hermetris/cathedral", "path": "/cathedral/utils/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Annamalaisaravanan/code-converter-app path: /code_converter.py # -*- coding: utf-8 -*- """ Created on Sat Jul 10 14:39:13 2021 @author: Annamalai """ import streamlit as st def binary_decimal(d): num=d sums=0 places=0 while num!=0: ...
code_fim
hard
{ "lang": "python", "repo": "Annamalaisaravanan/code-converter-app", "path": "/code_converter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: ans=octal_binary(ft) if submit: st.info('The binary equivalent is {}'.format(str(ans))) except ValueError: if submit: st.warning('Give a valid octal n...
code_fim
hard
{ "lang": "python", "repo": "Annamalaisaravanan/code-converter-app", "path": "/code_converter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alphagov-mirror/digitalmarketplace-runner path: /dmrunner/utils.py import colored import itertools import os import ruamel.yaml from typing import Dict, List, Tuple APP_COMMAND_RESTART = "run" APP_COMMAND_REBUILD = "rebuild" APP_COMMAND_FRONTEND = "frontend" EXITCODE_DOCKER_NOT_AVAILABLE = 1 EX...
code_fim
hard
{ "lang": "python", "repo": "alphagov-mirror/digitalmarketplace-runner", "path": "/dmrunner/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_app_info(repo_name, config, settings, container): """THIS NEEDS TO GO. BAD MOJO.""" container["name"] = settings["repositories"][repo_name]["name"] container["commands"] = settings["repositories"][repo_name].get("commands", {}).copy() container["repo_path"] = os.path.join(os.path....
code_fim
hard
{ "lang": "python", "repo": "alphagov-mirror/digitalmarketplace-runner", "path": "/dmrunner/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> numbers = [8402868, 2295738, 5938342, 7925426] start = time() threads = [] for number in numbers: thread = FactorizeThread(number) thread.start() threads.append(thread) # wait for all thread to finish for thread in threads: thread.join() end = time() print(f'Took {end - start:.3f} second...
code_fim
medium
{ "lang": "python", "repo": "zeroam/TIL", "path": "/python/gil/with_multithread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zeroam/TIL path: /python/gil/with_multithread.py from time import time from threading import Thread def factorize(number): for i in range(1, number + 1): if number % 1 == 0: yield i <|fim_suffix|> self.factors = list(factorize(self.number)) numbers = [8402868, ...
code_fim
medium
{ "lang": "python", "repo": "zeroam/TIL", "path": "/python/gil/with_multithread.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__() self.number = number def run(self): self.factors = list(factorize(self.number)) numbers = [8402868, 2295738, 5938342, 7925426] start = time() threads = [] for number in numbers: thread = FactorizeThread(number) thread.start() threads.append(thr...
code_fim
medium
{ "lang": "python", "repo": "zeroam/TIL", "path": "/python/gil/with_multithread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> important_topics = [k for k, v in sorted(enumerate(mdl.get_count_by_topics()), key=lambda x:x[1], reverse=True)] for k in important_topics: if not mdl.is_live_topic(k): continue print('Topic #{}'.format(k)) for word, prob in mdl.get_topic_words(k): print('\t', w...
code_fim
medium
{ "lang": "python", "repo": "bab2min/tomotopy", "path": "/examples/hdp_basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bab2min/tomotopy path: /examples/hdp_basic.py import sys import tomotopy as tp def hdp_example(input_file, save_path): mdl = tp.HDPModel(tw=tp.TermWeight.ONE, min_cf=3, rm_top=5) for n, line in enumerate(open(input_file, encoding='utf-8')): ch = line.strip().split() mdl.a...
code_fim
medium
{ "lang": "python", "repo": "bab2min/tomotopy", "path": "/examples/hdp_basic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: remon/pythonCodes path: /Modules/secreat-message.py from __future__ import print_function #This file contain examples for os module #What is os module? #is a module using for list files in folder, we can get name of current working directory #rename files , write on files import os <|fim_suff...
code_fim
medium
{ "lang": "python", "repo": "remon/pythonCodes", "path": "/Modules/secreat-message.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # (1) get file names from a folder file_list = os.listdir(r"C:\Users\user\Desktop\python\pythonCodes\Modules\images") # r (row path) mean take the string as it's and don't interpreter saved_path = os.getcwd() print(saved_path) saved_path = os.chdir(r"C:\Users\user\Desktop\python\pythonCodes\Module...
code_fim
medium
{ "lang": "python", "repo": "remon/pythonCodes", "path": "/Modules/secreat-message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/Mallet path: /mallet/common/SummaryBase.py s as returning default no-children responses. # # :return: return an SBValue to be presented as the value of the synthetic value under consideration. # :rtype: lldb.SBValue # """ def register_child_value(self, ...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/Mallet", "path": "/mallet/common/SummaryBase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_count_value(obj): """ Returns count of child objects from LLDB value. :param lldb.SBValue obj: LLDB value object. :return: Count of child objects from LLDB value. :rtype: int | None """ # Passed None value. if obj is None: return None # Return 0 if obj...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/Mallet", "path": "/mallet/common/SummaryBase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/Mallet path: /mallet/common/SummaryBase.py """:type: lldb.SBValue""" if value is not None: value = get_synthetic_value_copy(value) has_children = value.MightHaveChildren() """:type: bool""" return has_childre...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/Mallet", "path": "/mallet/common/SummaryBase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass # found by /home/rasmus/code/ql/python/ql/test/query-tests/Statements/asserts/AssertLiteralConstant.qlref<|fim_prefix|># repo: github/codeql path: /python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/mwe_failure.py import subprocess assert subprocess.call(['run-backup']) == 0 ...
code_fim
easy
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/mwe_failure.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: github/codeql path: /python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/mwe_failure.py import subprocess assert subprocess.call(['run-backup']) == 0 class TestCase: <|fim_suffix|> pass # found by /home/rasmus/code/ql/python/ql/test/query-tests/Statements/asserts/AssertLite...
code_fim
easy
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/test/3/library-tests/PointsTo/regressions/subprocess-assert/mwe_failure.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def reportExport(jdid_list): try: fileDir=config.report_download_path if not os.path.exists(fileDir): os.makedirs(fileDir) for i in os.listdir(fileDir): oldfile=os.path.join(fileDir, i) if(time.time()-os.path.getmtime(oldfile)>60*60): ...
code_fim
hard
{ "lang": "python", "repo": "LamCiuLoeng/jcp", "path": "/ordering/util/upc2excel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _upc2Excel(upc, data, copyTemplatePath, fileDir): xlsFileName = "%s_%s.xls" % (upc, datetime.now().strftime("%Y%m%d%H%M%S")) filename = os.path.join(fileDir, xlsFileName) #print 'filename',filename # print 'input data', time.ctime() rfid = RFIDExcel(templatePath=copyTemplatePath, d...
code_fim
hard
{ "lang": "python", "repo": "LamCiuLoeng/jcp", "path": "/ordering/util/upc2excel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LamCiuLoeng/jcp path: /ordering/util/upc2excel.py # -*- coding: utf-8 -*- import shutil, os, zipfile, traceback, random from datetime import datetime from ordering.util.excel_helper import * from common import serveFile, Date2Text from ordering.model import * from tg import request, config, flas...
code_fim
hard
{ "lang": "python", "repo": "LamCiuLoeng/jcp", "path": "/ordering/util/upc2excel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = point[0] / point[2] y = point[1] / point[2] if intrin.model == 0: r2 = x * x + y * y<|fim_prefix|># repo: yiyangd/SummerResearch2021 path: /rsutil.py point = [] intrin = {"model": 0} <|fim_middle|>def rs2_project_point_to_pixel(pixel[2], intrin, point[3]):
code_fim
medium
{ "lang": "python", "repo": "yiyangd/SummerResearch2021", "path": "/rsutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yiyangd/SummerResearch2021 path: /rsutil.py point = [] intrin = {"model": 0} <|fim_suffix|> x = point[0] / point[2] y = point[1] / point[2] if intrin.model == 0: r2 = x * x + y * y<|fim_middle|>def rs2_project_point_to_pixel(pixel[2], intrin, point[3]):
code_fim
medium
{ "lang": "python", "repo": "yiyangd/SummerResearch2021", "path": "/rsutil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def show_dist(self): plt.xlim([0, self.distance_bins[-1]]) for charge_dist, _idx in zip(self.charge_dists, self.band_idxs): for dist, spin in zip(charge_dist, ["up", "down"]): plt.plot(self.bins_middle_points[:-1], dist.radial_dist[:...
code_fim
hard
{ "lang": "python", "repo": "Xcodemachine/pydefect", "path": "/pydefect/analyzer/defect_charge_info.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xcodemachine/pydefect path: /pydefect/analyzer/defect_charge_info.py # -*- coding: utf-8 -*- # Copyright (c) 2020 Kumagai group. from dataclasses import dataclass from typing import List import numpy as np from matplotlib import pyplot as plt from monty.json import MSONable from pydefect.defaul...
code_fim
hard
{ "lang": "python", "repo": "Xcodemachine/pydefect", "path": "/pydefect/analyzer/defect_charge_info.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _add_band_info(self, band_idx, c_dist, lines, spin): try: radius = f"{self.half_charge_radius(band_idx, spin):6.3f}" except ValueError: radius = "None" spin_idx = 0 if spin == Spin.up else 1 spin_str = "up" if spin == Spin.up else "down" ...
code_fim
hard
{ "lang": "python", "repo": "Xcodemachine/pydefect", "path": "/pydefect/analyzer/defect_charge_info.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": test_cls_in_locals()<|fim_prefix|># repo: plasma-umass/scalene path: /test/issues/test-issue193.py import time def test_cls_in_locals(): <|fim_middle|> cls = "This value is not a class" time.sleep(0.5)
code_fim
medium
{ "lang": "python", "repo": "plasma-umass/scalene", "path": "/test/issues/test-issue193.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: plasma-umass/scalene path: /test/issues/test-issue193.py import time def test_cls_in_locals(): <|fim_suffix|>if __name__ == "__main__": test_cls_in_locals()<|fim_middle|> cls = "This value is not a class" time.sleep(0.5)
code_fim
medium
{ "lang": "python", "repo": "plasma-umass/scalene", "path": "/test/issues/test-issue193.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuoyenlo/unsupervised-learning-intrinsic-images path: /train.py import time import torch import sys import numpy as np import random import os from options.train_options import TrainOptions from data.data_loader import CreateDataLoader from data.data_loader import CreateDataLoaderIIWTest from mo...
code_fim
hard
{ "lang": "python", "repo": "kuoyenlo/unsupervised-learning-intrinsic-images", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> total_count +=count model.switch_to_train() return total_loss/(total_count) def validation_SAW(model): # parameters for SAW pixel_labels_dir = saw_root + 'saw/saw_pixel_labels/saw_data-filter_size_0-ignore_border_0.05-normal_gradmag_thres_1.5-depth_gradmag_thres_2.0' s...
code_fim
hard
{ "lang": "python", "repo": "kuoyenlo/unsupervised-learning-intrinsic-images", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: googleapis/python-firestore path: /google/cloud/firestore_admin_v1/types/__init__.py # -*- coding: utf-8 -*- # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy o...
code_fim
hard
{ "lang": "python", "repo": "googleapis/python-firestore", "path": "/google/cloud/firestore_admin_v1/types/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> "GetFieldRequest", "GetIndexRequest", "ImportDocumentsRequest", "ListDatabasesRequest", "ListDatabasesResponse", "ListFieldsRequest", "ListFieldsResponse", "ListIndexesRequest", "ListIndexesResponse", "UpdateDatabaseMetadata", "UpdateDatabaseRequest", "Upda...
code_fim
hard
{ "lang": "python", "repo": "googleapis/python-firestore", "path": "/google/cloud/firestore_admin_v1/types/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> utils.check_sanity(adata, batch, hvg) split, categories = utils.split_batches(adata, batch, return_categories=True) corrected, _, _ = mnnpy.mnn_correct( *split, var_subset=hvg, batch_key=batch, batch_categories=categories, index_unique=None, **k...
code_fim
hard
{ "lang": "python", "repo": "YosefLab/scib", "path": "/scib/integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YosefLab/scib path: /scib/integration.py """ This module provides a toolkit for running a large range of single cell data integration methods as well as tools and metrics to benchmark them. """ import logging import os import tempfile import anndata import numpy as np import rpy2.rinterface_lib...
code_fim
hard
{ "lang": "python", "repo": "YosefLab/scib", "path": "/scib/integration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return txhash(tx,hashcode).decode('hex') def ecdsa_tx_sign(tx,priv,hashcode=SIGHASH_ALL): rawsig = ecdsa_raw_sign(bin_txhash(tx,hashcode),priv) return der_encode_sig(*rawsig)+encode(hashcode,16,2) def ecdsa_tx_verify(tx,sig,pub,hashcode=SIGHASH_ALL): return ecdsa_raw_verify(bin_txhash(tx...
code_fim
hard
{ "lang": "python", "repo": "JPeroutek/mycoin", "path": "/pt/transaction.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: JPeroutek/mycoin path: /pt/transaction.py #!/usr/bin/python import re, json, copy from main import * ### Hex to bin converter and vice versa for objects def json_is_base(obj,base): alpha = get_code_string(base) if isinstance(obj,(str,unicode)): for i in range(len(obj)): ...
code_fim
hard
{ "lang": "python", "repo": "JPeroutek/mycoin", "path": "/pt/transaction.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if re.match('^[0-9a-fA-F]*$',tx): tx = tx.decode('hex') if re.match('^[0-9a-fA-F]*$',script): script = script.decode('hex') if not re.match('^[0-9a-fA-F]*$',sig): sig = sig.encode('hex') hashcode = ord(sig[-1]) modtx = signature_form(tx,int(i),script) return ecdsa_tx_verify(modtx,s...
code_fim
hard
{ "lang": "python", "repo": "JPeroutek/mycoin", "path": "/pt/transaction.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shohzod-Abdusamatov/learn_python path: /time.py # -*- coding: utf-8 -*- """ Created on Mon Nov 23 19:59:20 2020 <|fim_suffix|>from datetime import datetime hozir=datetime.now() print(hozir.strftime("%Y-%m-%d:hour %H-%M-%S")) print("salom soat")<|fim_middle|>@author: Shohzod """
code_fim
easy
{ "lang": "python", "repo": "Shohzod-Abdusamatov/learn_python", "path": "/time.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from datetime import datetime hozir=datetime.now() print(hozir.strftime("%Y-%m-%d:hour %H-%M-%S")) print("salom soat")<|fim_prefix|># repo: Shohzod-Abdusamatov/learn_python path: /time.py # -*- coding: utf-8 -*- """ Created on Mon Nov 23 19:59:20 2020 <|fim_middle|>@author: Shohzod """
code_fim
easy
{ "lang": "python", "repo": "Shohzod-Abdusamatov/learn_python", "path": "/time.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sashanksilwal/CRSLR path: /Ngoc/Week 4/cv.py """ cv.py Defines methods for conducting cross validation on a Bayesian Model. Author: Ngoc Hoang Last modified: June 15, 2021 Dependencies: the following packages and/or libraries are assumed to have been imported prior to using the methods - pandas ...
code_fim
hard
{ "lang": "python", "repo": "sashanksilwal/CRSLR", "path": "/Ngoc/Week 4/cv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def cross_val(model, data, n, target): """n-fold cross validation for a model Args: model: the estimator to train and validate data: pandasDataFrame object, the complete dataset it is assumed that the dataset contains the labels n: number of folds to conduct ...
code_fim
hard
{ "lang": "python", "repo": "sashanksilwal/CRSLR", "path": "/Ngoc/Week 4/cv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: data: pandasDataFrame object, the dataset to partition n: number of equal parts to split the data Returns: splits: list of n parts of the data, each one is a pandasDataFrame """ splits = [] remaining = data.copy(deep=True) for i in range(n): s...
code_fim
medium
{ "lang": "python", "repo": "sashanksilwal/CRSLR", "path": "/Ngoc/Week 4/cv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mugoh/audioConvertor path: /convertor/formats.py """ This module holds the class that makes subprocess calls to ffmpeg with the received CLI commands. """ import subprocess import os import platform from click import echo, style from convertor.utils.file_types import require_ffmepg, ...
code_fim
hard
{ "lang": "python", "repo": "mugoh/audioConvertor", "path": "/convertor/formats.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Invokes subprocess with commands required to process a user input call. """ try: subprocess.check_output(cmds) except subprocess.CalledProcessError as er: print("Unable to complete conversion\n", er) else: ...
code_fim
hard
{ "lang": "python", "repo": "mugoh/audioConvertor", "path": "/convertor/formats.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Converts all files specified in directory. """ for video in video_files: self.to_audio(os.path.abspath(video), out, brate, _format) def load_player(self, playitems, preferred_player): """ Opens up audio...
code_fim
hard
{ "lang": "python", "repo": "mugoh/audioConvertor", "path": "/convertor/formats.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _parse_timedelta_composite(raw_value, unit): if unit != 'seconds': raise ValueError("Cannot specify units with composite delta") values = raw_value.split(':') units = 'hours', 'minutes', 'seconds' composed = ' '.join(f'{value} {unit}' for value, unit in zip(values, units)) ...
code_fim
hard
{ "lang": "python", "repo": "jaraco/tempora", "path": "/tempora/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TODO: Should this be 14 hours or 14 minutes? >>> parse_timedelta('14:00') datetime.timedelta(seconds=50400) >>> parse_timedelta('14:00 minutes') Traceback (most recent call last): ... ValueError: Cannot specify units with composite delta Nanoseconds get rounded to the ne...
code_fim
hard
{ "lang": "python", "repo": "jaraco/tempora", "path": "/tempora/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaraco/tempora path: /tempora/__init__.py nds_per_minute = 60 minutes_per_hour = 60 hours_per_day = 24 seconds_per_hour = seconds_per_minute * minutes_per_hour seconds_per_day = seconds_per_hour * hours_per_day days_per_year = seconds_per_year / seconds_per_day thirty_days = datetime.timedelta(da...
code_fim
hard
{ "lang": "python", "repo": "jaraco/tempora", "path": "/tempora/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SR-Sunny-Raj/Hacktoberfest2021-DSA path: /33. Python Programs/Square of n numbers.py ''' Problem Statement : To find square of given N numbers using Recursion and iterative approach''' n=int(input("Enter Number : ")) def squareIterative(n): for i in range(n,0,-1): print(i**2,end=" ")...
code_fim
easy
{ "lang": "python", "repo": "SR-Sunny-Raj/Hacktoberfest2021-DSA", "path": "/33. Python Programs/Square of n numbers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print() def squareRecursive(n): if n>0: print(n**2,end=" ") squareRecursive(n-1) squareRecursive(n)<|fim_prefix|># repo: SR-Sunny-Raj/Hacktoberfest2021-DSA path: /33. Python Programs/Square of n numbers.py ''' Problem Statement : To find square of given N numbers using Recursion and ...
code_fim
medium
{ "lang": "python", "repo": "SR-Sunny-Raj/Hacktoberfest2021-DSA", "path": "/33. Python Programs/Square of n numbers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Insert article and summary into DB. dao.article.insert( session=session, text=vb_article.get('content', article.text), url=normalize_url(url), title=vb_article.get('title', article.title), keywords=keywords, sentence...
code_fim
hard
{ "lang": "python", "repo": "jamo95/Newsy", "path": "/dl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamo95/Newsy path: /dl.py #!/usr/bin/env python # Downloads files from the archive pages of supported sites. import datetime import hashlib import newspaper import re import requests import sys from bs4 import BeautifulSoup from newspaper import Article from nltk.stem.snowball import Snowbal...
code_fim
hard
{ "lang": "python", "repo": "jamo95/Newsy", "path": "/dl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bingwen-Hu/hackaway path: /books/learnScrapy/twisted/twisted_coordiate.py """ limit the resource the program may consume """ from twisted.internet import reactor from twisted.internet import defer from twisted.internet import task <|fim_suffix|> def twisted_developer_day(customers): print("C...
code_fim
hard
{ "lang": "python", "repo": "Bingwen-Hu/hackaway", "path": "/books/learnScrapy/twisted/twisted_coordiate.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def twisted_developer_day(customers): print("Cood morning from twisted developer") work = (inline_install(customer) for customer in customers) coop = task.Cooperator() # every time get 5 jobs as a batch join = defer.DeferredList([coop.coiterate(work) for i in range(5)]) join.addC...
code_fim
hard
{ "lang": "python", "repo": "Bingwen-Hu/hackaway", "path": "/books/learnScrapy/twisted/twisted_coordiate.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }