text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ Notify all clients once the socket.io is connected """ payload = dict(data='Connected') emit('log', payload, broadcast=True) if __name__ == '__main__': socket_io.run(app)<|fim_prefix|># repo: riderSide/Flask-SocketIo-Examples path: /basic_framework/flask_app/example_app.py f...
code_fim
hard
{ "lang": "python", "repo": "riderSide/Flask-SocketIo-Examples", "path": "/basic_framework/flask_app/example_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: riderSide/Flask-SocketIo-Examples path: /basic_framework/flask_app/example_app.py from flask import Flask, render_template, request, jsonify from flask_socketio import SocketIO, emit from flask_cors import CORS app = Flask(__name__) app.config['SECRET_KEY'] = 'justasecretkeythatishouldputhere' ...
code_fim
hard
{ "lang": "python", "repo": "riderSide/Flask-SocketIo-Examples", "path": "/basic_framework/flask_app/example_app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_mounted_no_files( self, mock_execute, mock_mount, mock_copy, mock_find_device, mock_check_vmedia, mock_booted_from_vmedia): mock_booted_from_vmedia.return_value = True mock_execute.return_value = '/some/path', '' mock_find_device.return_value =...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-python-agent", "path": "/ironic_python_agent/tests/unit/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/ironic-python-agent path: /ironic_python_agent/tests/unit/test_utils.py k_boot_mode.assert_has_calls([]) @mock.patch.object(utils, 'get_node_boot_mode', return_value='bios', autospec=True) def test_specified_partition_table_type_with_instance_disk_label( ...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-python-agent", "path": "/ironic_python_agent/tests/unit/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/ironic-python-agent path: /ironic_python_agent/tests/unit/test_utils.py t_device_extractor(self): self.assertEqual( 'md0', utils.extract_device('md0p1') ) self.assertEqual( '/dev/md0', utils.extract_device('/dev/md0...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic-python-agent", "path": "/ironic_python_agent/tests/unit/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if counters == 20: div = 1 print(i)<|fim_prefix|># repo: adamkells/project_euler path: /problem_5.py i = 38 div = 0 while div == 0: i += <|fim_middle|>19 counters = 0 for j in range(1, 21): if i % j == 0: counters += 1
code_fim
medium
{ "lang": "python", "repo": "adamkells/project_euler", "path": "/problem_5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamkells/project_euler path: /problem_5.py i = 38 div = 0 while div == 0: i += 19 counters = 0 for j in range(1, 21<|fim_suffix|> if counters == 20: div = 1 print(i)<|fim_middle|>): if i % j == 0: counters += 1
code_fim
easy
{ "lang": "python", "repo": "adamkells/project_euler", "path": "/problem_5.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> copy = originalImage.copy() _, contours, _ = cv2.findContours(morphMask, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) cntsSorted = sorted(contours, key=lambda x: cv2.contourArea(x)) cnt = sorted(contours, key=cv2.contourArea, reverse=True) cv2.drawContours(copy,cnt[1],-1,(255,0,0),6) if...
code_fim
hard
{ "lang": "python", "repo": "Ciaran-OBrien/Image-Processing", "path": "/Final Class Test/Final Exam - Boundary Detection .py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ciaran-OBrien/Image-Processing path: /Final Class Test/Final Exam - Boundary Detection .py # coding: utf-8 # In[2]: # Author: Ciarán O'Brien # Lecture: Jane Courtney # Submitted: 13/12/18 # This code is in response to CA Class Test: Boundary Detection # N.B. This code orignated as a Jupyter ...
code_fim
hard
{ "lang": "python", "repo": "Ciaran-OBrien/Image-Processing", "path": "/Final Class Test/Final Exam - Boundary Detection .py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mitsuhiko/raven path: /raven/handlers/logbook.py """ raven.handlers.logbook ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ <|fim_suffix|>import logbook import sys class SentryHandler(logbook.Handler...
code_fim
medium
{ "lang": "python", "repo": "mitsuhiko/raven", "path": "/raven/handlers/logbook.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.client = client super(SentryHandler, self).__init__() def emit(self, record): self.format(record) # Avoid typical config issues by overriding loggers behavior if record.name.startswith('sentry.errors'): print >> sys.stderr, "Recursive log mess...
code_fim
medium
{ "lang": "python", "repo": "mitsuhiko/raven", "path": "/raven/handlers/logbook.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ml6team/connexion path: /tests/api/test_unordered_definition.py import json def test_app(unordered_definition_app): app_client = unordered_definition_app.app.test_cl<|fim_suffix|>ce')) assert response_data['detail'] == 'Wrong type, expected \'integer\' for query parameter \'first\''<|fi...
code_fim
hard
{ "lang": "python", "repo": "ml6team/connexion", "path": "/tests/api/test_unordered_definition.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>e assert response.status_code == 400 response_data = json.loads(response.data.decode('utf-8', 'replace')) assert response_data['detail'] == 'Wrong type, expected \'integer\' for query parameter \'first\''<|fim_prefix|># repo: ml6team/connexion path: /tests/api/test_unordered_definition.py imp...
code_fim
medium
{ "lang": "python", "repo": "ml6team/connexion", "path": "/tests/api/test_unordered_definition.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ce')) assert response_data['detail'] == 'Wrong type, expected \'integer\' for query parameter \'first\''<|fim_prefix|># repo: ml6team/connexion path: /tests/api/test_unordered_definition.py import json def test_app(unordered_definition_app): app_client = unordered_definition_app.app.test_client...
code_fim
medium
{ "lang": "python", "repo": "ml6team/connexion", "path": "/tests/api/test_unordered_definition.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>### reconstitution de l'image � partir des fragments def reconstituerImage(nomFichierImage, xMax, yMax, largeurFragment, hauteurFragment): #commandeAssembler = (os.path.join(cheminDossierImageMagick, "montage.exe") # + " " + os.path.join(cheminDossierFragments, "fragment_[...
code_fim
hard
{ "lang": "python", "repo": "akoel/GAPDownloader", "path": "/extractionGoogleArtProject_Unix.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: akoel/GAPDownloader path: /extractionGoogleArtProject_Unix.py # -*- coding: utf-8 -*- import re, urllib2, time, os, json, unicodedata, base64, subprocess from xml.dom import minidom from core import * ### configuration cheminDossierFragments = "fragments" cheminDossierImages = "imag...
code_fim
hard
{ "lang": "python", "repo": "akoel/GAPDownloader", "path": "/extractionGoogleArtProject_Unix.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(svm_clf)): # calc auc prob = svm_clf[i].predict_proba(X_test_scaled[i])[:,1] fpr, tpr, thresholds = roc_curve(y_test, prob, pos_label=1) roc_auc_area = auc(fpr, tpr) pred_tmp.append(predict_data.calc_metrics(y_test, svm_clf[i].predict(X_test_s...
code_fim
hard
{ "lang": "python", "repo": "baibai25/MNDO-NC", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in tqdm(range(100), desc="Preprocessing", leave=False): # Apply over-sampling sm_reg = over_sampling.SMOTE(kind='regular', random_state=RANDOM_STATE, k_neighbors=5) sm_b1 = over_sampling.SMOTE(kind='borderline1', random_state=RANDOM_STATE, k_neighbors=5) sm_b2 = ...
code_fim
hard
{ "lang": "python", "repo": "baibai25/MNDO-NC", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: baibai25/MNDO-NC path: /train.py import sys import os from tqdm import tqdm import numpy as np import pandas as pd import argparse from src import predict_data, preprocessing from collections import Counter from sklearn.model_selection import train_test_split from imblearn import over_sampling fr...
code_fim
hard
{ "lang": "python", "repo": "baibai25/MNDO-NC", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jgust/SublimeCscope path: /sublime_cscope/commands/query.py import linecache as lc import functools import math import os import sublime import sublime_plugin from ...SublimeCscope import DEBUG, PACKAGE_NAME from ..cscope_runner import CscopeQueryCommand from ..cscope_results import CscopeResul...
code_fim
hard
{ "lang": "python", "repo": "jgust/SublimeCscope", "path": "/sublime_cscope/commands/query.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @ScQueryCommand.action.getter def action(self): return 'find_callees' class ScFindCallersCommand(ScQueryCommand): @ScQueryCommand.action.getter def action(self): return 'find_callers' class ScFindStringCommand(ScQueryCommand): @ScQueryCommand.action.getter def...
code_fim
hard
{ "lang": "python", "repo": "jgust/SublimeCscope", "path": "/sublime_cscope/commands/query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> start_line, num_ctx_lines = RTB_CONTEXT_LINES): if num_ctx_lines > 0: for line_num in range(start_line, start_line + num_ctx_lines): line = lc.getline(file_name, line_num) if line: pos += self.view.insert(e...
code_fim
hard
{ "lang": "python", "repo": "jgust/SublimeCscope", "path": "/sublime_cscope/commands/query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># registration Jpg.register( 'jpg', Jpg )<|fim_prefix|># repo: ramgopal99/centipede path: /src/lib/centipede/Crawler/Fs/Image/Jpg.py from .Oiio import Oiio class Jpg(Oiio): <|fim_middle|> """ Jpg crawler. """ @classmethod def test(cls, pathHolder, parentCrawler): """ ...
code_fim
hard
{ "lang": "python", "repo": "ramgopal99/centipede", "path": "/src/lib/centipede/Crawler/Fs/Image/Jpg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ramgopal99/centipede path: /src/lib/centipede/Crawler/Fs/Image/Jpg.py from .Oiio import Oiio class Jpg(Oiio): <|fim_suffix|> """ Test if the path holder contains an jpg file. """ if not super(Jpg, cls).test(pathHolder, parentCrawler): return False ...
code_fim
medium
{ "lang": "python", "repo": "ramgopal99/centipede", "path": "/src/lib/centipede/Crawler/Fs/Image/Jpg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaelscales88/python-reporting-app path: /app/report/views/sla_summary_report_view.py from flask import Markup from pandas import DataFrame from app.base_view import BaseView from flask_security import current_user class SLASummaryReportView(BaseView): column_searchable_list = ("start_tim...
code_fim
medium
{ "lang": "python", "repo": "michaelscales88/python-reporting-app", "path": "/app/report/views/sla_summary_report_view.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def is_accessible(self): if super().is_accessible(): return True if current_user.has_role('_permissions | manager'): self.can_create = False self.can_edit = True self.can_delete = False return True return False<|fim_...
code_fim
hard
{ "lang": "python", "repo": "michaelscales88/python-reporting-app", "path": "/app/report/views/sla_summary_report_view.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Create firebase_credentials = credentials.Certificate('../../keys/ahs-cms-firebase-adminsdk-eob2s-4d3bff0472.json') firebase_app = firebase_admin.initialize_app(firebase_credentials)<|fim_prefix|># repo: gdmgent-1718-wot/NFC-TimeClock path: /nfc-examples/nfc_person-vertification_firebase.py # NFC Perso...
code_fim
medium
{ "lang": "python", "repo": "gdmgent-1718-wot/NFC-TimeClock", "path": "/nfc-examples/nfc_person-vertification_firebase.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdmgent-1718-wot/NFC-TimeClock path: /nfc-examples/nfc_person-vertification_firebase.py # NFC Persons Verification via Firebase # Developed by Philippe De Pauw - Waterschoot <|fim_suffix|># Create firebase_credentials = credentials.Certificate('../../keys/ahs-cms-firebase-adminsdk-eob2s-4d3bff04...
code_fim
medium
{ "lang": "python", "repo": "gdmgent-1718-wot/NFC-TimeClock", "path": "/nfc-examples/nfc_person-vertification_firebase.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>import logging import time from datetime import timezone import sys, pygame # Firebase Namespaces import firebase_admin from firebase_admin import credentials # Create firebase_credentials = credentials.Certificate('../../keys/ahs-cms-firebase-adminsdk-eob2s-4d3bff0472.json') firebase_app = firebase_adm...
code_fim
easy
{ "lang": "python", "repo": "gdmgent-1718-wot/NFC-TimeClock", "path": "/nfc-examples/nfc_person-vertification_firebase.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ghost9023/DeepLearningPythonStudy path: /DeepLearning/DeepLearning/09_Deep_SongJW/ch4/gradient_method.py ''' 4.4.1 경사법(경사 하강법) gradient method 손실함수의 값이 최솟값이 되는 가중치와 편향을 찾는것이 목표. 기울기를 이용해 손실함수의 최솟값을 찾는 방법이 경사법. 다만 기울기가 가리키는 방향이 항상 손실함수의 최솟값이 존재하는 방향은 아니다. 최솟값에 도달할수도, 극솟값(특정 범위내에서의 최솟값)에 도달할수도, 안...
code_fim
hard
{ "lang": "python", "repo": "ghost9023/DeepLearningPythonStudy", "path": "/DeepLearning/DeepLearning/09_Deep_SongJW/ch4/gradient_method.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>에타 eta 를 학습률 learning rate 이라고 한다. 한번의 학습으로 가중치, 편향의 값을 얼마만큼 갱신할지를 결정하게된다. ''' import numpy as np from ch4.numerical_differentiation import numerical_gradient def gradient_descent(f, init_x, lr = 0.01, step_num = 100): x = init_x.copy() for i in range(step_num): grad = numerical_gradien...
code_fim
medium
{ "lang": "python", "repo": "ghost9023/DeepLearningPythonStudy", "path": "/DeepLearning/DeepLearning/09_Deep_SongJW/ch4/gradient_method.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save_html(html): with open('login.html', 'w', encoding='utf8')as f: f.write(html) def post_github(url): data = {'commit': 'Sign in', 'authenticity_token': 'sj5fa1Cqr9JuurCfiJxCmmJLyD9rpv7iTK1bpVCVJ6GdcOltKQ8P999XOdy1jpN1mILSMKCRN4NKUzmm' '+FGqOw==', 'login'...
code_fim
medium
{ "lang": "python", "repo": "Lemon-cc-hang/spiderProjects", "path": "/project/github模拟登陆/github.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lemon-cc-hang/spiderProjects path: /project/github模拟登陆/github.py import requests import time from bs4 import BeautifulSoup headers = { 'Cookie': '_octo=GH1.1.721453151.1586831679; _ga=GA1.2.561782820.1586831682; ' 'experiment:homepage_signup_flow' '=eyJ2ZXJzaW9uIjoiMSIsInJ...
code_fim
hard
{ "lang": "python", "repo": "Lemon-cc-hang/spiderProjects", "path": "/project/github模拟登陆/github.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() keys = pygame.key.get_pressed() if keys[K_ESCAPE]: pygame.quit() sys.exit() pygame.display.update()<|fim_prefix|># repo: Michael8968/skulpt path: /example/te...
code_fim
hard
{ "lang": "python", "repo": "Michael8968/skulpt", "path": "/example/test/L22_ex1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Michael8968/skulpt path: /example/test/L22_ex1.py import pygame,random,sys from pygame.locals import * ##### 任务1 人原地跑 + 地面 pygame.init() screen = pygame.display.set_mode((800, 600)) pygame.display.set_caption("No One Die") times = pygame.time.Clock() <|fim_suffix|> for event in pygame.eve...
code_fim
hard
{ "lang": "python", "repo": "Michael8968/skulpt", "path": "/example/test/L22_ex1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tectronics/myami-3.2-freeHand path: /bin/start-leginon.py #!/bin/python # # Normal users should start Leginon with this script. # <|fim_suffix|>## this starts Leginon user interface from leginon import start start.start(legoptparse.options)<|fim_middle|>from leginon import legoptparse
code_fim
easy
{ "lang": "python", "repo": "tectronics/myami-3.2-freeHand", "path": "/bin/start-leginon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>## this starts Leginon user interface from leginon import start start.start(legoptparse.options)<|fim_prefix|># repo: tectronics/myami-3.2-freeHand path: /bin/start-leginon.py #!/bin/python # # Normal users should start Leginon with this script. # <|fim_middle|>from leginon import legoptparse
code_fim
easy
{ "lang": "python", "repo": "tectronics/myami-3.2-freeHand", "path": "/bin/start-leginon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for user in users: results[user] = GroupSubscriptionReason.implicit for user, reason in participants.items(): results[user] = reason return results class GroupSubscription(Model): """ Identifies a subscription relationship between a user and an i...
code_fim
hard
{ "lang": "python", "repo": "atlassian/sentry", "path": "/src/sentry/models/groupsubscription.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: atlassian/sentry path: /src/sentry/models/groupsubscription.py from __future__ import absolute_import from django.conf import settings from django.db import IntegrityError, models, transaction from django.db.models import Q from django.utils import timezone from sentry.db.models import ( Ba...
code_fim
hard
{ "lang": "python", "repo": "atlassian/sentry", "path": "/src/sentry/models/groupsubscription.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> results = {} for user in users: results[user] = GroupSubscriptionReason.implicit for user, reason in participants.items(): results[user] = reason return results class GroupSubscription(Model): """ Identifies a subscription relationship b...
code_fim
hard
{ "lang": "python", "repo": "atlassian/sentry", "path": "/src/sentry/models/groupsubscription.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/PyWldap path: /wldap/future.py # Copyright 2013 Arnaud Porterie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/PyWldap", "path": "/wldap/future.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>class Future(object): """The Future holds an asynchronous operation result. Its design is loosely inspired by PEP-3148: it should comply as described for the cancel(), cancelled(), exception(), done() and result() operations. """ def __init__(self, ldap, msgid): self._cancell...
code_fim
medium
{ "lang": "python", "repo": "Python3pkg/PyWldap", "path": "/wldap/future.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: EggplantElf/IMSurReal path: /IMSurReal/dynet_modules.py import dynet as dy import numpy as np def orthonormal_initializer(output_size, input_size): """ adopted from Timothy Dozat https://github.com/tdozat/Parser/blob/master/lib/linalg.py """ # print (output_size, input_size) ...
code_fim
hard
{ "lang": "python", "repo": "EggplantElf/IMSurReal", "path": "/IMSurReal/dynet_modules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, model, token_dim, query_dim=None): self.model = model query_dim = query_dim or token_dim self.att_q = self.model.add_parameters((token_dim, query_dim), init=orthonormal_initializer(token_dim, query_dim)) self.att_q2 = self.model.add_p...
code_fim
hard
{ "lang": "python", "repo": "EggplantElf/IMSurReal", "path": "/IMSurReal/dynet_modules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> write_log(log_file_name='find_verified_user.log', log_file_path=os.getcwd(), information='###################program start#####################.') path_data = 'D:/LiuQL/eHealth/twitter/data/data_origin/' path_save_to = 'D:/LiuQL/eHealth/twitter/data/data_origin/' # path_data ...
code_fim
medium
{ "lang": "python", "repo": "LiuQL2/twitter", "path": "/process/network/find_verified_user.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LiuQL2/twitter path: /process/network/find_verified_user.py #!/usr/bin/python env # -*- coding: utf-8 -*- import json import csv import os import numpy as np import time import pandas as pd from collections import OrderedDict from utility.functions import get_dirlist from utility.functions impor...
code_fim
medium
{ "lang": "python", "repo": "LiuQL2/twitter", "path": "/process/network/find_verified_user.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: swami701/image-category-classifier path: /utils.py import mixins import importlib import inspect import os import pkgutil <|fim_suffix|> path = os.path.join(os.path.dirname(__file__), 'scripts') module_path = 'scripts' for _, name, _ in pkgutil.walk_packages(path=[path]): modu...
code_fim
medium
{ "lang": "python", "repo": "swami701/image-category-classifier", "path": "/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> path = os.path.join(os.path.dirname(__file__), 'scripts') module_path = 'scripts' for _, name, _ in pkgutil.walk_packages(path=[path]): module = importlib.import_module( '%s.%s' % (module_path, name)) for _, obj in inspect.getmembers(module): if (inspect...
code_fim
medium
{ "lang": "python", "repo": "swami701/image-category-classifier", "path": "/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lchen-wyze/retinanet-tensorflow2.x path: /retinanet/evaluate_saved_model.py import os from time import time import numpy as np import tensorflow as tf from absl import app, flags, logging from retinanet.dataset_utils.coco_parser import CocoParser from retinanet.eval import COCOEvaluator from re...
code_fim
hard
{ "lang": "python", "repo": "lchen-wyze/retinanet-tensorflow2.x", "path": "/retinanet/evaluate_saved_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if gpus: logging.info('Found {} GPU(s)'.format(len(gpus))) [tf.config.experimental.set_memory_growth(device, True) for device in gpus] try: # Attempt to load tensorrt, only used if the saved_model contains # TensorRT engines. import tensorrt ...
code_fim
hard
{ "lang": "python", "repo": "lchen-wyze/retinanet-tensorflow2.x", "path": "/retinanet/evaluate_saved_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1sapientia/python-tools path: /coinmetrics/bitsql/applications/export.py import argparse import logging from coinmetrics.bitsql import runExport, dbObjectsFactory, postgresFactory from coinmetrics.bitsql.constants import SUPPORTED_ASSETS from coinmetrics.utils.arguments import postgres_connection...
code_fim
hard
{ "lang": "python", "repo": "1sapientia/python-tools", "path": "/coinmetrics/bitsql/applications/export.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logging.basicConfig(format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s') appLog = logging.getLogger("bitsql:{0}".format(args.asset)) appLog.setLevel(logging.DEBUG) runExport(args.asset, args.nodes, args.database, appLog, loop=args.loop, rpcThreads=args.rpcthreads)<|fim_prefix|># repo: 1sapienti...
code_fim
hard
{ "lang": "python", "repo": "1sapientia/python-tools", "path": "/coinmetrics/bitsql/applications/export.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rustychris/stompy path: /stompy/nanpsd.py import numpy as np try: from numpy import nanmean except ImportError: # obsolete location from scipy.stats import nanmean # initial implementation 90ms for 1132 sample window, # compared to 0.258ms for holey_psd # changing to nanmean -> 6ms. ...
code_fim
hard
{ "lang": "python", "repo": "rustychris/stompy", "path": "/stompy/nanpsd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return r def correlogrampsd(X, lag, NFFT=None): """ PSD estimate using correlogram method. taken from spectrum, simplified for real-valued autocorrelation """ N = len(X) assert lag<N, 'lag must be < size of input data' if NFFT == None: NFFT = N psd = np.zeros(...
code_fim
hard
{ "lang": "python", "repo": "rustychris/stompy", "path": "/stompy/nanpsd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def ufo2glyphs(options): """Convert one designspace file or one or more UFOs to a Glyphs.app source file.""" import fontTools.designspaceLib from glyphsLib.util import open_ufo ufo_module = __import__(options.ufo_module) sources = options.designspace_file_or_UFOs designspace_file...
code_fim
hard
{ "lang": "python", "repo": "googlefonts/glyphsLib", "path": "/Lib/glyphsLib/cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _glyphs2ufo_entry_point(): """Provides entry point for a script to keep argparsing in main().""" args = sys.argv[1:] args.insert(0, "glyphs2ufo") return main(args) def ufo2glyphs(options): """Convert one designspace file or one or more UFOs to a Glyphs.app source file.""" im...
code_fim
hard
{ "lang": "python", "repo": "googlefonts/glyphsLib", "path": "/Lib/glyphsLib/cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: googlefonts/glyphsLib path: /Lib/glyphsLib/cli.py # Copyright 2015 Google Inc. 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. # You may obtain a copy of the License at # # http://www.a...
code_fim
hard
{ "lang": "python", "repo": "googlefonts/glyphsLib", "path": "/Lib/glyphsLib/cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> buffer_a = '1c0111001f010100061a024b53535009181c' buffer_b = '686974207468652062756c6c277320657965' expected = '746865206b696420646f6e277420706c6179' assert fixed_xor(buffer_a, buffer_b) == expected<|fim_prefix|># repo: kevinlondon/cryptopals-solutions path: /sets/1/2_fixed_xor.py import ...
code_fim
easy
{ "lang": "python", "repo": "kevinlondon/cryptopals-solutions", "path": "/sets/1/2_fixed_xor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinlondon/cryptopals-solutions path: /sets/1/2_fixed_xor.py import binascii from itertools import izip def fixed_xor(buffer_a, buffer_b): <|fim_suffix|> buffer_a = '1c0111001f010100061a024b53535009181c' buffer_b = '686974207468652062756c6c277320657965' expected = '746865206b6964206...
code_fim
medium
{ "lang": "python", "repo": "kevinlondon/cryptopals-solutions", "path": "/sets/1/2_fixed_xor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('accounts', '0004_auto_20160310_2019'), ] operations = [ migrations.AddField( model_name='userprofile', name='jobtitle', field=models.CharField(max_length=140, null=True, verbose_name=b'Job Title', blank=True), ), ...
code_fim
easy
{ "lang": "python", "repo": "oiclid/Newspade", "path": "/analyst/accounts/migrations/0005_userprofile_jobtitle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('accounts', '0004_auto_20160310_2019'), ] operations = [ migrations.AddField( model_name='userprofile', name='jobtitle', field=models.CharField(max_length=140, null=True, verbose_name=b'Job Title', blank=True), ), ...
code_fim
medium
{ "lang": "python", "repo": "oiclid/Newspade", "path": "/analyst/accounts/migrations/0005_userprofile_jobtitle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oiclid/Newspade path: /analyst/accounts/migrations/0005_userprofile_jobtitle.py # -*- coding: utf-8 -*- from __future__ import unicode_literals <|fim_suffix|> operations = [ migrations.AddField( model_name='userprofile', name='jobtitle', field=model...
code_fim
medium
{ "lang": "python", "repo": "oiclid/Newspade", "path": "/analyst/accounts/migrations/0005_userprofile_jobtitle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mongodb_client = MongoClient(MONGODB_HOST, MONGODB_PORT) db = mongodb_client.VmDataBase collection = db[uuid] if start is not None and end is not None: match = { '$match': { 'time': { '$gt': start, '$lt': end ...
code_fim
hard
{ "lang": "python", "repo": "zouyapeng/instance_monitor_agent", "path": "/VMAgent/mongo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zouyapeng/instance_monitor_agent path: /VMAgent/mongo.py #!/usr/bin/env python import logging from pymongo import MongoClient from config import CONF LOGGING = logging.getLogger('') MONGODB_HOST = CONF.mongodb_host MONGODB_PORT = CONF.mongodb_port MONGODB_EXPIRE = CONF.mongodb_expire def mo...
code_fim
hard
{ "lang": "python", "repo": "zouyapeng/instance_monitor_agent", "path": "/VMAgent/mongo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>LOGGING = { "version": 1, "disable_existing_loggers": False, "root": {"level": "WARNING", "handlers": ["sentry"]}, "formatters": { "heroku": { "format": ( "%(asctime)s [%(process)d] [%(levelname)s] " + "pathname=%(pathname)s lineno=%(line...
code_fim
hard
{ "lang": "python", "repo": "MisterRios/will-of-the-prophets", "path": "/will_of_the_prophets/settings/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MisterRios/will-of-the-prophets path: /will_of_the_prophets/settings/__init__.py """Settings.""" import os import re import dj_database_url import django_heroku # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__...
code_fim
hard
{ "lang": "python", "repo": "MisterRios/will-of-the-prophets", "path": "/will_of_the_prophets/settings/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: westernesque/a-history-of-birds path: /data/entities/player.py import data.entities.entity as e import pygame, numpy class player(e.entity): RUN_SPEED = 20 TURN_SPEED = 160 GRAVITY = -50 JUMP_POWER = 30 current_speed = 0 current_turn_speed = 0 upward_speed = 0 <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "westernesque/a-history-of-birds", "path": "/data/entities/player.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.check_input() super(player, self).increase_rotation(0, self.current_turn_speed * display.get_frame_time(), 0) distance = self.current_speed * display.get_frame_time() distance_x = float(distance * numpy.cos(numpy.radians(super(player, self).get_rotation_y()))) distance_z = float(dista...
code_fim
medium
{ "lang": "python", "repo": "westernesque/a-history-of-birds", "path": "/data/entities/player.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: reputage/didery.py path: /tests/help/test_helping.py # import pytest # import falcon # import asyncio # import aiohttp # from asyncio import ensure_future # import arrow # # try: # import simplejson as json # except ImportError: # import json # # from ioflo.aio.http import httping # from ...
code_fim
hard
{ "lang": "python", "repo": "reputage/didery.py", "path": "/tests/help/test_helping.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>tories # response = patronHelper() # # while True: # try: # next(response) # except StopIteration as si: # # print("Final: " + si.value) # break # # # create a history # history, vk, sk, pvk, psk = gen.historyGen() # history['changed'...
code_fim
hard
{ "lang": "python", "repo": "reputage/didery.py", "path": "/tests/help/test_helping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ry['changed'] = str(arrow.utcnow()) # history['signer'] = 1 # history['signers'].append(ppvk) # body = json.dumps(history, ensure_ascii=False, separators=(',', ':')).encode('utf-8') # # headers = { # "Signature": 'signer="{0}"; rotation="{1}"'.format( # gen.signResource...
code_fim
hard
{ "lang": "python", "repo": "reputage/didery.py", "path": "/tests/help/test_helping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brahimbellahcen/face-swap path: /face_swap/gan.py from keras.layers import Input, Dense, Flatten, Reshape from keras.layers.advanced_activations import LeakyReLU from keras.layers.convolutional import Conv2D from keras.initializers import RandomNormal from keras.models import Model from keras.opt...
code_fim
hard
{ "lang": "python", "repo": "brahimbellahcen/face-swap", "path": "/face_swap/gan.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> distorted_A, fake_A, mask_A, path_A, fun_mask_A, fun_abgr = gan_utils.cycle_variables_masked(netGA) distorted_B, fake_B, mask_B, path_B, fun_mask_B, fun_abgr = gan_utils.cycle_variables_masked(netGB) real_A = Input(shape=img_shape) real_B = Input(shape=img_shape) vggface_feat = gan_ut...
code_fim
hard
{ "lang": "python", "repo": "brahimbellahcen/face-swap", "path": "/face_swap/gan.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> encoder = Encoder(img_shape, encoder_dim, num_conv_blocks=encoder_nb_conv_blocks) decoder_a = Decoder(decoder_input_shape, include_alpha=include_alpha, num_deconv_blocks=decoder_nb_deconv_blocks) decoder_b = Decoder(decoder_input_shape, include_alpha=include_alpha, num_deconv_blocks=decoder_nb...
code_fim
hard
{ "lang": "python", "repo": "brahimbellahcen/face-swap", "path": "/face_swap/gan.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 475763610/Darily path: /notes/demo/apps/jd_shop/migrations/0001_initial.py # Generated by Django 2.1.4 on 2019-03-29 11:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] opera...
code_fim
hard
{ "lang": "python", "repo": "475763610/Darily", "path": "/notes/demo/apps/jd_shop/migrations/0001_initial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ('category_main', models.IntegerField(default=0, help_text='主营类目ID', verbose_name='主营类目ID')), ('category_main_name', models.CharField(default='', help_text='主营类目名称', max_length=64, verbose_name='主营类目名称')), ], options={ 'verbose_name': '店铺基础信息', ...
code_fim
hard
{ "lang": "python", "repo": "475763610/Darily", "path": "/notes/demo/apps/jd_shop/migrations/0001_initial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pighui/dushu path: /dushu/spiders/book.py # -*- coding: utf-8 -*- from redis import Redis from scrapy import Request from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from dushu.settings import HOST, PORT <|fim_suffix|> item = {} item['n...
code_fim
hard
{ "lang": "python", "repo": "pighui/dushu", "path": "/dushu/spiders/book.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> item = {} item['name'] = response.css('.book-title').xpath('./h1/text()').get() price = response.css('.num').xpath('./text()').get() if '¥' in price: price = price[1:] else: price = price item['price'] = price item['author'] =...
code_fim
hard
{ "lang": "python", "repo": "pighui/dushu", "path": "/dushu/spiders/book.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shftan/tree_ensemble_distance path: /augmented_gb.py #!/usr/bin/python3 # This file extends sklearn's BinomialDeviance and GradientBoostingClassifier # classes to keep track of the scaling gammas in gradient boosting trees. # Additionally, the default GradientBoostingClassifier uses independent ...
code_fim
hard
{ "lang": "python", "repo": "shftan/tree_ensemble_distance", "path": "/augmented_gb.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # induce regression tree on residuals tree = _gb.DecisionTreeRegressor( criterion=self.criterion, splitter='best', max_depth=self.max_depth, min_samples_split=self.min_samples_split, min_samples_leaf=se...
code_fim
hard
{ "lang": "python", "repo": "shftan/tree_ensemble_distance", "path": "/augmented_gb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(pubkey, secp256k1.PublicKey): self._pubkey = pubkey elif pubkey: self._pubkey = secp256k1.PublicKey(pubkey, True) @property def public_key(self) -> bytes: return self._pubkey.serialize() def _verify(self, message: bytes, signature...
code_fim
hard
{ "lang": "python", "repo": "andrewwhitehead/didauth", "path": "/didauth/algo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> algorithm = 'secp256k1' def __init__(self, _key_type, pubkey): if isinstance(pubkey, secp256k1.PublicKey): self._pubkey = pubkey elif pubkey: self._pubkey = secp256k1.PublicKey(pubkey, True) @property def public_key(self) -> bytes: return s...
code_fim
hard
{ "lang": "python", "repo": "andrewwhitehead/didauth", "path": "/didauth/algo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewwhitehead/didauth path: /didauth/algo.py import nacl.signing import rsa import secp256k1 from .base import SignerBase, VerifierBase class Ed25519Signer(SignerBase): algorithm = 'ed25519' seed_length = 32 def __init__(self, _key_type, secret=None): if secret: ...
code_fim
hard
{ "lang": "python", "repo": "andrewwhitehead/didauth", "path": "/didauth/algo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcelotokarnia/mountain-catalog path: /mountains/models.py from django.contrib.gis.db import models from utils.models_utils import BaseModel from django.contrib.auth.models import User <|fim_suffix|> return "%s: %s(%sm)-%s (%s, %s)" % (self.pk, self.name, self.elevation, self.country, se...
code_fim
hard
{ "lang": "python", "repo": "marcelotokarnia/mountain-catalog", "path": "/mountains/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> id = models.AutoField(primary_key=True) spot = models.PointField() curiosities = models.TextField(blank=True, null=True) province = models.CharField(max_length=128, blank=True, null=True) difficulty = models.CharField(max_length=128, blank=True, null=True) elevation = models.Intege...
code_fim
medium
{ "lang": "python", "repo": "marcelotokarnia/mountain-catalog", "path": "/mountains/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yns88/myanimefigures-core path: /anime/anime_figures.py """ Core logic utilities for connecting figures to anime series. """ from collections import defaultdict import datetime import logging from xml.etree import ElementTree import dateutil.parser import requests from .models import AnimeSerie...
code_fim
hard
{ "lang": "python", "repo": "yns88/myanimefigures-core", "path": "/anime/anime_figures.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> def get_anime_list(user_id, recently_completed_count=RECENTLY_COMPLETED_COUNT): watching_xml, completed_xml, series_lookup_ids, all_mal_ids = get_mal_xml(user_id, recently_completed_count) mal_id_to_series, series_id_to_figures = get_bulk_lookups(series_lookup_ids) watching, watching_nofigs =...
code_fim
hard
{ "lang": "python", "repo": "yns88/myanimefigures-core", "path": "/anime/anime_figures.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: random-python/nspawn path: /tool/install_local.py #!/usr/bin/env python <|fim_suffix|>shell("sudo python setup.py install") shell("sudo rm -rf build")<|fim_middle|>""" Use local install for manual testing """ from devrepo import base_dir from devrepo import shell project_dir = base_dir()
code_fim
medium
{ "lang": "python", "repo": "random-python/nspawn", "path": "/tool/install_local.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>project_dir = base_dir() shell("sudo python setup.py install") shell("sudo rm -rf build")<|fim_prefix|># repo: random-python/nspawn path: /tool/install_local.py #!/usr/bin/env python <|fim_middle|>""" Use local install for manual testing """ from devrepo import base_dir from devrepo import shell
code_fim
medium
{ "lang": "python", "repo": "random-python/nspawn", "path": "/tool/install_local.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: random-python/nspawn path: /tool/install_local.py #!/usr/bin/env python """ Use local install for manual testing """ <|fim_suffix|>shell("sudo python setup.py install") shell("sudo rm -rf build")<|fim_middle|>from devrepo import base_dir from devrepo import shell project_dir = base_dir()
code_fim
medium
{ "lang": "python", "repo": "random-python/nspawn", "path": "/tool/install_local.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> date_count = 0 for date in range(0, len(dates)): for key in c_grade_dict: c_grade_dict[key].append(0) for climb in range(0, len(climbs)): if climbs[climb][0] == dates[date_count]: for key in c_grade_dict: ...
code_fim
hard
{ "lang": "python", "repo": "IveKileff/UKC_Logbook", "path": "/logbook_5_build_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''create a dictionary of lists, each filled with number of climbs climbed at each grade for each date''' c_grade_dict = {} for item in range(0, len(grades)): c_grade_dict[grades[item]] = [] date_count = 0 for date in range(0, len(dates)): ...
code_fim
hard
{ "lang": "python", "repo": "IveKileff/UKC_Logbook", "path": "/logbook_5_build_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IveKileff/UKC_Logbook path: /logbook_5_build_data.py import csv from datetime import datetime import plotly.graph_objects as go from plotly.subplots import make_subplots class BuildData: '''A class that visualises the grades of the User's Lead Climbs''' def __init__(self, filename): ...
code_fim
hard
{ "lang": "python", "repo": "IveKileff/UKC_Logbook", "path": "/logbook_5_build_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dizcza/sparse-representation path: /edX/midproj/omp.py from sparse.greedy_pursuit import orthogonal_matching_pursuit def omp(A, b, k): <|fim_suffix|> solution = orthogonal_matching_pursuit(A, b=b, n_nonzero_coefs=k, least_squares=False) x = solu...
code_fim
medium
{ "lang": "python", "repo": "dizcza/sparse-representation", "path": "/edX/midproj/omp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> solution = orthogonal_matching_pursuit(A, b=b, n_nonzero_coefs=k, least_squares=False) x = solution.x # return the obtained x return x<|fim_prefix|># repo: dizcza/sparse-representation path: /edX/midproj/omp.py from sparse.greedy_pursuit import ...
code_fim
medium
{ "lang": "python", "repo": "dizcza/sparse-representation", "path": "/edX/midproj/omp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KurozumiGH/modo-kits-kz-lissajous-curve path: /Kz_LissajousCurve/Scripts/KZLC_DrawCurve.py # python # -*- coding: utf-8 -*- import lx import math import KZLC_Math as kzm # Note: V-Ray curve settings # item.channel vray_curve_max_segments 5000 (points * 2..3) # Get parameters. points...
code_fim
hard
{ "lang": "python", "repo": "KurozumiGH/modo-kits-kz-lissajous-curve", "path": "/Kz_LissajousCurve/Scripts/KZLC_DrawCurve.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Generate angles. angles = kzm.linspace(0.0, kzm.PI2, points) # Start curve. lx.eval('tool.set prim.curve on') lx.eval('tool.setAttr prim.curve mode add') # Set curve points. pointIdx = 0 for a in angles: pointIdx = pointIdx + 1 # Calc point location. x = center_x + scale_x * ...
code_fim
hard
{ "lang": "python", "repo": "KurozumiGH/modo-kits-kz-lissajous-curve", "path": "/Kz_LissajousCurve/Scripts/KZLC_DrawCurve.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># We can also fill in these extra nice things year_day = json["day_of_year"] week_day = json["day_of_week"] is_dst = json["dst"] now = time.struct_time( (year, month, mday, hours, minutes, seconds, week_day, year_day, is_dst) ) print(now) the_rtc.datetime = now while True: print(time.localtime()...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_ESP32SPI", "path": "/examples/esp32spi_localtime.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_CircuitPython_ESP32SPI path: /examples/esp32spi_localtime.py # SPDX-FileCopyrightText: 2019 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import time import board import busio from digitalio import DigitalInOut import neopixel import rtc from adafruit_esp32spi ...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_ESP32SPI", "path": "/examples/esp32spi_localtime.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Raniac/NEURO-LEARN path: /env/lib/python3.6/site-packages/dipy/core/tests/test_sphere.py from __future__ import division, print_function, absolute_import import numpy as np import numpy.testing as nt import warnings from dipy.utils.six.moves import xrange from dipy.core.sphere import (Sphere, ...
code_fim
hard
{ "lang": "python", "repo": "Raniac/NEURO-LEARN", "path": "/env/lib/python3.6/site-packages/dipy/core/tests/test_sphere.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }