text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: tnc-ca-geo/animl-base path: /temp-monitor.py import os from gpiozero import CPUTemperature from time import sleep, strftime, time TEMP_LOG = os.path.abspath( os.path.join(os.path.dirname(__file__), "cpu_temp_log.csv")) PAUSE_INTERVAL = 300 # wait 5 minutes cpu = CPUTemperature() <|fim_suffix...
code_fim
easy
{ "lang": "python", "repo": "tnc-ca-geo/animl-base", "path": "/temp-monitor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while True: temp = cpu.temperature write_temp(temp) sleep(PAUSE_INTERVAL)<|fim_prefix|># repo: tnc-ca-geo/animl-base path: /temp-monitor.py import os from gpiozero import CPUTemperature from time import sleep, strftime, time TEMP_LOG = os.path.abspath( os.path.join(os.path.dirname(__file_...
code_fim
medium
{ "lang": "python", "repo": "tnc-ca-geo/animl-base", "path": "/temp-monitor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def execute(self): messagebox.showinfo('Az-Log-Viewer', 'Text display system for log analysis\n\n'+ 'Based on the Python TKinter library')<|fim_prefix|># repo: amauri-bz/az_log_viewer path: /Operations/about.py from tkinter import messagebox from Operations.operation...
code_fim
medium
{ "lang": "python", "repo": "amauri-bz/az_log_viewer", "path": "/Operations/about.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def execute(self): messagebox.showinfo('Az-Log-Viewer', 'Text display system for log analysis\n\n'+ 'Based on the Python TKinter library')<|fim_prefix|># repo: amauri-bz/az_log_viewer path: /Operations/about.py from tkinter import messagebox from Operations.operation import Operat...
code_fim
easy
{ "lang": "python", "repo": "amauri-bz/az_log_viewer", "path": "/Operations/about.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amauri-bz/az_log_viewer path: /Operations/about.py from tkinter import messagebox from Operations.operation import Operation class About(Operation): <|fim_suffix|> pass def execute(self): messagebox.showinfo('Az-Log-Viewer', 'Text display system for log analysis\n\n'+ ...
code_fim
easy
{ "lang": "python", "repo": "amauri-bz/az_log_viewer", "path": "/Operations/about.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>\begin{center} \uppercase{{\large\textbf{List of Publications}}}\\ \vspace{0.3cm} \textsc{-- FIRSTNAME LASTNAME --}\\ \end{center} \begin{etaremune}[topsep=0pt,itemsep=0.5ex,partopsep=1ex,parsep=1ex] """ HEAD = HEAD.replace('FIRSTNAME', AUTHOR_F + '.' * (len(AUTHOR_F) == 1)) HEAD = HEAD.replace('LASTNAME'...
code_fim
hard
{ "lang": "python", "repo": "birnstiel/get_publications", "path": "/get_publications.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: birnstiel/get_publications path: /get_publications.py #!/usr/bin/env python r""" ------------------------------------------------------------------------------- This script retrieves publication data from NASA ADS and writes out each publication as \item to a latex file. Open access information ...
code_fim
hard
{ "lang": "python", "repo": "birnstiel/get_publications", "path": "/get_publications.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> chiffre = self.data["Chiffre d'affaires"] if chiffre[0] > chiffre[1]: analyse = "Chiffre d'affaire en croissance." else: analyse = "Chiffre d'affaire en décroissance." self.analyse["Chiffre d'affaires"] = analyse def b_graham_function(self): ...
code_fim
hard
{ "lang": "python", "repo": "CryptoCoinsWorks/TradeFinance", "path": "/app/libs/analysies/analyse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> per, index = utl.get_last_value(self.data["PER"]) analyse = "" if per <= 0: analyse = "PER %s NégatifG" % per elif per >= 17: analyse = "PER %s Eleve , Entreprise SUR-COTE." % per elif 10 <= per < 17: analyse = "PER %s Normal , En...
code_fim
hard
{ "lang": "python", "repo": "CryptoCoinsWorks/TradeFinance", "path": "/app/libs/analysies/analyse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CryptoCoinsWorks/TradeFinance path: /app/libs/analysies/analyse.py from utils import utils as utl from pprint import pprint class AnalyseData(object): def __init__(self, data): self.data = data self.analyse = {} # pprint(self.data) self.bvps_analyse() ...
code_fim
hard
{ "lang": "python", "repo": "CryptoCoinsWorks/TradeFinance", "path": "/app/libs/analysies/analyse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestAggregate(unittest.TestCase): def test_00__roa_missing(self): pass def test_15_verbose(self): stub_stdin(self, '10.0.0.0/24 10.0.1.0/24 172.16.0.0/24 10.0.0.0/32\n') stub_stdouts(self) with patch.object(sys, 'argv', ["prog.py", "-v"]): agg_ma...
code_fim
hard
{ "lang": "python", "repo": "job/rpki-vrp-checker", "path": "/tests/test_regression.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: job/rpki-vrp-checker path: /tests/test_regression.py #!/usr/bin/env python from vrp_checker import checker from mock import patch import io import sys import unittest def stub_stdin(testcase_inst, inputs): stdin = sys.stdin def cleanup(): sys.stdin = stdin testcase_inst....
code_fim
hard
{ "lang": "python", "repo": "job/rpki-vrp-checker", "path": "/tests/test_regression.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> name = "oauth2_provider" verbose_name = _("Django OAuth Toolkit")<|fim_prefix|># repo: gikoluo/django-oauth-toolkit path: /oauth2_provider/apps.py from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_middle|>class DOTConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "gikoluo/django-oauth-toolkit", "path": "/oauth2_provider/apps.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: gikoluo/django-oauth-toolkit path: /oauth2_provider/apps.py from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_suffix|> name = "oauth2_provider" verbose_name = _("Django OAuth Toolkit")<|fim_middle|>class DOTConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "gikoluo/django-oauth-toolkit", "path": "/oauth2_provider/apps.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> c[0] = 20 # 没有修改全局变量c(修改的的是列表的元素) print(c) # [20] func03() print(c) # [10]<|fim_prefix|># repo: why1679158278/python-stu path: /python资料/day8.10/day08/demo07.py """ 全局变量与局部变量 """ a = 10 def func01(): # 在函数内部,只能读取全局变量 a = 20 # 创建局部变量,没有修改全局变量 print(a) # 20 func01() prin...
code_fim
easy
{ "lang": "python", "repo": "why1679158278/python-stu", "path": "/python资料/day8.10/day08/demo07.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: why1679158278/python-stu path: /python资料/day8.10/day08/demo07.py """ 全局变量与局部变量 """ a = 10 def func01(): # 在函数内部,只能读取全局变量 a = 20 # 创建局部变量,没有修改全局变量 print(a) # 20 <|fim_suffix|>def func02(): global a # 如果在局部变量修改全局变量,必须通过global声明 a = 20 print(a) func02() print(a)...
code_fim
easy
{ "lang": "python", "repo": "why1679158278/python-stu", "path": "/python资料/day8.10/day08/demo07.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wisesky/LeetCode-Practice path: /src/65. Valid Number.py import string class Solution: def isNumber(self, s: str) -> bool: s = ''.join(s.strip()) if 'e' in s: newS = s.split('e') if len(newS) != 2: return False # newS = [x ...
code_fim
hard
{ "lang": "python", "repo": "wisesky/LeetCode-Practice", "path": "/src/65. Valid Number.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if part.startswith('-') or part.startswith('+'): part = part[1: ] if len(part) == 0: return False for char in part: if char not in string.digits: return False return True def isFloat(self, part): if part.start...
code_fim
hard
{ "lang": "python", "repo": "wisesky/LeetCode-Practice", "path": "/src/65. Valid Number.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if part.startswith('-') or part.startswith('+'): part = part[1: ] if '.' in part: dots_parts = part.split('.') if len(dots_parts) != 2 : return False dots_parts = [x for x in dots_parts if x] if len(dots_parts) ==...
code_fim
hard
{ "lang": "python", "repo": "wisesky/LeetCode-Practice", "path": "/src/65. Valid Number.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .constants import * from .error import * from .message import * from .context import * from .socket import * from ._poll import * from .utils import * from ._proxy_steerable import * from ._device import * from ._version import *<|fim_prefix|># repo: catboost/catboost path: /contrib/python/pyzmq/py2...
code_fim
medium
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/pyzmq/py2/zmq/backend/cython/__init__.py", "mode": "spm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/pyzmq/py2/zmq/backend/cython/__init__.py """Python bindings for core 0MQ objects.""" # Copyright (C) PyZMQ Developers # Distributed under the terms of the Lesser GNU Public License (LGPL). <|fim_suffix|>from .constants import * from .error import * from ....
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/pyzmq/py2/zmq/backend/cython/__init__.py", "mode": "psm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_suffix|> # attachment = forms.FileField(required=False, # label=_('Attach File'), # help_text=_('You can attach a file such as a document or screenshot to this ticket.'), # ) # def clean_user(self): return user # def save(self, user): # fi...
code_fim
hard
{ "lang": "python", "repo": "grengojbo/django-knowledge", "path": "/knowledge/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: grengojbo/django-knowledge path: /knowledge/forms.py # -*- mode: python; coding: utf-8; -*- from django import forms from django.utils.translation import ugettext_lazy as _ from captcha.fields import ReCaptchaField from knowledge import settings from knowledge.models import Question, Response, Ca...
code_fim
hard
{ "lang": "python", "repo": "grengojbo/django-knowledge", "path": "/knowledge/forms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return user class Meta: model = Question fields = selected_fields return _OfficesAskForm(*args, **kwargs) def ResponseForm(user, question, *args, **kwargs): """ Build and return the appropriate form depending on the status of the passed in use...
code_fim
hard
{ "lang": "python", "repo": "grengojbo/django-knowledge", "path": "/knowledge/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> trainer = Trainer(config=config, model=model, criterion=criterion, train_loader=train_loader, val_loader=eval_loader, converter=converter) trainer.train() if __name__ == '__main__': ...
code_fim
hard
{ "lang": "python", "repo": "yanhongyu111/crnn.pytorch", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanhongyu111/crnn.pytorch path: /train.py # -*- coding: utf-8 -*- # @Time : 2018/8/23 22:20 # @Author : zhoujun from __future__ import print_function import os from utils import strLabelConverter, read_json config = read_json('config.json') os.environ['CUDA_VISIBLE_DEVICES'] = ','.join([str...
code_fim
medium
{ "lang": "python", "repo": "yanhongyu111/crnn.pytorch", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _metadata = MetaData() with isolated_nullpool_engine(database_url) as engine: try: _metadata.reflect(bind=engine) table_count = len(_metadata.tables) url = engine.url return url, table_count except Exception as e: return F...
code_fim
hard
{ "lang": "python", "repo": "dpays/dpds", "path": "/dpds/storages/db/tables/__init__.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpays/dpds path: /dpds/storages/db/tables/__init__.py # -*- coding: utf-8 -*- from sqlalchemy import MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy.dialects.postgresql import ENUM <|fim_suffix|> def test_connection(dat...
code_fim
hard
{ "lang": "python", "repo": "dpays/dpds", "path": "/dpds/storages/db/tables/__init__.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>def test_connection(database_url): _metadata = MetaData() with isolated_nullpool_engine(database_url) as engine: try: _metadata.reflect(bind=engine) table_count = len(_metadata.tables) url = engine.url return url, table_count except E...
code_fim
hard
{ "lang": "python", "repo": "dpays/dpds", "path": "/dpds/storages/db/tables/__init__.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: manuelamercado/structures-algorithms-nanodegree-projects path: /P2/task1.py ''' Finding the Square Root of an Integer Find the square root of the integer without using any Python library. You have to find the floor value of the square root. For example if the given number is 16, then the answer ...
code_fim
hard
{ "lang": "python", "repo": "manuelamercado/structures-algorithms-nanodegree-projects", "path": "/P2/task1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Calculate the floored square root of a number Args: number(int): Number to find the floored squared root Returns: int: Floored Square Root """ if number < 0 or number is None: return None elif number == 0: return 0 elif number == 1: ...
code_fim
hard
{ "lang": "python", "repo": "manuelamercado/structures-algorithms-nanodegree-projects", "path": "/P2/task1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: number(int): Number to find the floored squared root Returns: int: Floored Square Root """ if number < 0 or number is None: return None elif number == 0: return 0 elif number == 1: return 1 previous = 0 n = number // 2 whi...
code_fim
medium
{ "lang": "python", "repo": "manuelamercado/structures-algorithms-nanodegree-projects", "path": "/P2/task1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> m.static_files[''] = 'index.html' check_path('/static/test/', '200 OK', 'text/html', '<html></html>\n') m.static_files[''] = {'filename': 'index.html'} check_path('/static/test/', '200 OK', 'text/html', '<html></html>\n') m.static_files[''] = { 'filena...
code_fim
hard
{ "lang": "python", "repo": "miguelgrinberg/python-engineio", "path": "/tests/common/test_middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: miguelgrinberg/python-engineio path: /tests/common/test_middleware.py import os import unittest from unittest import mock import engineio class TestWSGIApp(unittest.TestCase): def test_wsgi_routing(self): mock_wsgi_app = mock.MagicMock() mock_eio_app = 'foo' m = eng...
code_fim
hard
{ "lang": "python", "repo": "miguelgrinberg/python-engineio", "path": "/tests/common/test_middleware.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> m.static_files[''] = {'filename': 'index.html'} check_path('/static/test/', '200 OK', 'text/html', '<html></html>\n') m.static_files[''] = { 'filename': 'index.html', 'content_type': 'image/gif', } check_path('/static/test/', '200 OK', 'imag...
code_fim
hard
{ "lang": "python", "repo": "miguelgrinberg/python-engineio", "path": "/tests/common/test_middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ts = time() client_id = os.environ.get('IMGUR_CLIENT_ID') if not client_id: raise Exception("Couldn't find IMGUR_CLIENT_ID environment variable!") download_dir = setup_download_dir() logger.info('new dir: {}'.format(download_dir)) links = [l for l in get_links(client_id) if...
code_fim
hard
{ "lang": "python", "repo": "mbichoffe/imgur-top-images-downloader", "path": "/single.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mbichoffe/imgur-top-images-downloader path: /single.py #!/usr/bin/env python3 import logging import os from dotenv import load_dotenv, find_dotenv from os.path import join, dirname from time import time from download import setup_download_dir, get_links, download_link <|fim_suffix|>def main(): ...
code_fim
hard
{ "lang": "python", "repo": "mbichoffe/imgur-top-images-downloader", "path": "/single.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rockgh/Meeko path: /scripts/mk_copy_coords.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # import argparse import os import sys from openbabel import openbabel as ob from meeko import PDBQTMolecule from meeko import obutils def cmd_lineparser(): parser = argparse.ArgumentParser(desc...
code_fim
medium
{ "lang": "python", "repo": "rockgh/Meeko", "path": "/scripts/mk_copy_coords.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> args = cmd_lineparser() input_filename = args.input_filename coords_filename = args.coords_filename output_filename = args.output_filename output_string = "" obmol = obutils.load_molecule_from_file(input_filename) is_dlg = coords_filename.endswith('.dlg') pdbqt_mol = PDBQ...
code_fim
medium
{ "lang": "python", "repo": "rockgh/Meeko", "path": "/scripts/mk_copy_coords.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bikramdas165/Hactoberfest2021 path: /python project/GIF_Creator.py from moviepy.editor import * from moviepy.editor impo<|fim_suffix|>clip((2.25),(6.25)) .resize(0.3)) clip.write_gif("output.gif") #This program is created by Harsh Sharma<|fim_middle|>rt * clip = (VideoFileClip("Gif...
code_fim
easy
{ "lang": "python", "repo": "Bikramdas165/Hactoberfest2021", "path": "/python project/GIF_Creator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>f("output.gif") #This program is created by Harsh Sharma<|fim_prefix|># repo: Bikramdas165/Hactoberfest2021 path: /python project/GIF_Creator.py from moviepy.editor import * from moviepy.editor import * clip = (VideoFileClip("Gif-Creator/video.webm").sub<|fim_middle|>clip((2.25),(6.25)) .re...
code_fim
easy
{ "lang": "python", "repo": "Bikramdas165/Hactoberfest2021", "path": "/python project/GIF_Creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Convert tuple of LSTMCellStateTuples to CudnnLSTM format.""" h = tf.stack([s.h for s in lstm_cell_state]) c = tf.stack([s.c for s in lstm_cell_state]) return (h, c) def get_final(time_major_sequence, sequence_length): """Get the final item in a time-major sequence.""" final_index = tf.sta...
code_fim
hard
{ "lang": "python", "repo": "jesuscast/magenta", "path": "/magenta/models/music_vae/lstm_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jesuscast/magenta path: /magenta/models/music_vae/lstm_utils.py # Copyright 2017 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 # # ...
code_fim
hard
{ "lang": "python", "repo": "jesuscast/magenta", "path": "/magenta/models/music_vae/lstm_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class LstmDecodeResults( collections.namedtuple('LstmDecodeResults', ('rnn_input', 'rnn_output', 'samples', 'final_state', 'final_sequence_lengths'))): pass class Seq2SeqLstmDecoderOutput( collections.namedtuple('BasicDecoderOutput', ...
code_fim
hard
{ "lang": "python", "repo": "jesuscast/magenta", "path": "/magenta/models/music_vae/lstm_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.on_IEslider_sliderReleased() @QtCore.pyqtSlot() def on_IEslider_sliderReleased(self): value = self.ui.IEslider.value() self.ui.lbIEValue.setText("%3i kcal/mol" % (value)) if self.data is not None: self.c.set_data(self.data.toSquareMap()) ...
code_fim
hard
{ "lang": "python", "repo": "cstein/fmo-ie-analyzer", "path": "/src/fiewindow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cstein/fmo-ie-analyzer path: /src/fiewindow.py from PyQt4 import QtGui, QtCore from fie_ui import Ui_main from fiecanvas import FIECanvas from fie import FIE class MainForm(QtGui.QMainWindow): """ The main window. All events are taken care of here. """ def __init__(self, par...
code_fim
hard
{ "lang": "python", "repo": "cstein/fmo-ie-analyzer", "path": "/src/fiewindow.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if user: # user_groups = [group.name for group in user.groups.all()] # business_area_code = details.get("business_area_code", 'defaultBA1235') # Update username with email and unusable password user.username = user.email user.first_name = details["first_name"] ...
code_fim
hard
{ "lang": "python", "repo": "unicef/unicef-security", "path": "/src/unicef_security/pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def user_details(strategy, details, backend, user=None, *args, **kwargs): """This is where we update the user see what the property to map by is here updates_available = False""" if user: # user_groups = [group.name for group in user.groups.all()] # business_area_code = details.ge...
code_fim
hard
{ "lang": "python", "repo": "unicef/unicef-security", "path": "/src/unicef_security/pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: unicef/unicef-security path: /src/unicef_security/pipeline.py from urllib.parse import quote from django.contrib.auth import get_user_model from django.http import HttpResponseRedirect from django.urls import reverse from social_core.pipeline import social_auth, user as social_core_user from so...
code_fim
hard
{ "lang": "python", "repo": "unicef/unicef-security", "path": "/src/unicef_security/pipeline.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rambasnet/django2.1projects path: /helloworld/hello/views.py from django.shortcuts import render from django.http import HttpResponse import datetime # Create your views here. def index(request): return HttpResponse('Hello there wonderful world...') def bye(request): return HttpResponse...
code_fim
hard
{ "lang": "python", "repo": "rambasnet/django2.1projects", "path": "/helloworld/hello/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> html = ''' <!DOCTYPE html> <html> <head> <title>Page Title</title> <style> body {{ background-color: lightblue; }} h1 {{ color: white; text-align: center; }} p {{ font-family: verdana; ...
code_fim
hard
{ "lang": "python", "repo": "rambasnet/django2.1projects", "path": "/helloworld/hello/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bpbpublications/Natural-Computing-with--Python path: /Chapter_06/fern.py from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt # Main body of program points = 10000 # The number of points to use. <|fim_suffix|>def new_point(p): r = np.random...
code_fim
medium
{ "lang": "python", "repo": "bpbpublications/Natural-Computing-with--Python", "path": "/Chapter_06/fern.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return p # Generate a large number of points for i in range(points): point = new_point(point) X.append(point[0]) Y.append(point[1]) # Plot the results plt.scatter(X, Y, c='g', s=.05) plt.axis('Off') plt.axes().set_aspect('equal') plt.title("Barnsley Fern") plt.savefig("barnsley_fern.pn...
code_fim
hard
{ "lang": "python", "repo": "bpbpublications/Natural-Computing-with--Python", "path": "/Chapter_06/fern.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>TR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE) imgray = cv.cvtColor(imgray, cv.COLOR_GRAY2BGR) cv.drawContours(imgray, contours, -1, (255, 0, 0), 2) cv.imshow('Contours', imgray) cv.waitKey() cv.destroyAllWindows()<|fim_prefix|># repo: TristanB22/AzimuthInternship path: /MrCrutcherProjects/OpenCVProject1/ImageProc...
code_fim
hard
{ "lang": "python", "repo": "TristanB22/AzimuthInternship", "path": "/MrCrutcherProjects/OpenCVProject1/ImageProcessing2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TristanB22/AzimuthInternship path: /MrCrutcherProjects/OpenCVProject1/ImageProcessing2.py #!/usr/bin/env python # coding: utf-8 # In[13]: import cv2 as cv import matplotlib.pyplot as plt import matplotlib.image as mping import numpy as np from subprocess import run output = run("pwd", capt<|fi...
code_fim
hard
{ "lang": "python", "repo": "TristanB22/AzimuthInternship", "path": "/MrCrutcherProjects/OpenCVProject1/ImageProcessing2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def test_parameters_lowlevel(): # test empty input xs = np.array([]) xs.shape = (0, 0) # we can assume in input that xs.ndim == 2 fvals = np.array([]) pypesto.visualize.parameters_lowlevel(xs, fvals) fvals = [0.01, 0.02, 1.01, 2.02, 2...
code_fim
hard
{ "lang": "python", "repo": "ahfa02/pyPESTO", "path": "/test/test_visualize.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahfa02/pyPESTO path: /test/test_visualize.py import pypesto import pypesto.visualize import numpy as np import scipy as sp import unittest objective = pypesto.Objective(fun=sp.optimize.rosen, grad=sp.optimize.rosen_der, hess=sp.optimiz...
code_fim
hard
{ "lang": "python", "repo": "ahfa02/pyPESTO", "path": "/test/test_visualize.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: arnaldorusso/python-oceans path: /oceans/datasets/datasets.py # -*- coding: utf-8 -*- # # datasets.py # # purpose: Functions to handle datasets. # author: Filipe P. A. Fernandes # e-mail: ocefpaf@gmail # web: http://ocefpaf.tiddlyspot.com/ # created: 09-Sep-2011 # modified: Fri 27 Feb ...
code_fim
hard
{ "lang": "python", "repo": "arnaldorusso/python-oceans", "path": "/oceans/datasets/datasets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_isobath(llcrnrlon=None, urcrnrlon=None, llcrnrlat=None, urcrnrlat=None, iso=-200., tfile='dap'): """Finds an isobath on the etopo2 database and returns its lon,lat coordinates for plotting.""" plt.ioff() lon, lat, topo = etopo_subset(llcrnrlon=llcrnrlon, urcrnrlon=u...
code_fim
hard
{ "lang": "python", "repo": "arnaldorusso/python-oceans", "path": "/oceans/datasets/datasets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> distances1.sort() distances2.sort() indices.append(distances1[0]) indices.append(distances2[0]) # max_lat_indices, min_lat_indices, max_lon_indices, min_lon_indices. res = np.zeros((4), dtype=np.float64) res[0] = indices[3][2] res[1] = indices[2][2] res[2] = indices[1]...
code_fim
hard
{ "lang": "python", "repo": "arnaldorusso/python-oceans", "path": "/oceans/datasets/datasets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esi-neuroscience/syncopy path: /syncopy/shared/dask_helpers.py # -*- coding: utf-8 -*- # # Basic checkers to facilitate direct Dask interface # import subprocess from time import sleep # Syncopy imports from syncopy.shared.errors import SPYWarning, SPYInfo from .log import get_logger <|fim_suf...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/shared/dask_helpers.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> logger = get_logger() totalWorkers = len(client.cluster.requested) # dictionary of workers workers = client.cluster.scheduler_info['workers'] # some small initial wait sleep(.25) if len(workers) < n_workers: logger.important(f"waiting for at least {n_workers}/{totalW...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/shared/dask_helpers.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: uk-gov-mirror/LandRegistry.maintain-frontend path: /unit_tests/view_modify_land_charge/test_update_location_confirmation.py from maintain_frontend import main from flask_testing import TestCase from flask import url_for from unit_tests.utilities import Utilities from unittest.mock import patch fr...
code_fim
hard
{ "lang": "python", "repo": "uk-gov-mirror/LandRegistry.maintain-frontend", "path": "/unit_tests/view_modify_land_charge/test_update_location_confirmation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.client.set_cookie('localhost', Session.session_cookie_name, 'cookie_value') self.mock_session.return_value.user.permissions = [Permissions.vary_llc] self.mock_session.return_value.add_charge_state = None response = self.client.post(url_for('modify_land_charge.post_up...
code_fim
hard
{ "lang": "python", "repo": "uk-gov-mirror/LandRegistry.maintain-frontend", "path": "/unit_tests/view_modify_land_charge/test_update_location_confirmation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.mock_session.return_value.add_charge_state = None response = self.client.post(url_for('modify_land_charge.post_update_location_confirmation')) self.assert_status(response, 302) self.assertRedirects(response, '/error') @patch('maintain_frontend.view_modify_land_ch...
code_fim
hard
{ "lang": "python", "repo": "uk-gov-mirror/LandRegistry.maintain-frontend", "path": "/unit_tests/view_modify_land_charge/test_update_location_confirmation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qu0ta/Aki-DiscordBot path: /Aki-DiscordBot/core/cogs.py import discord from discord.ext import commands from core.bot import bot, is_owner, avatar from core.logger import logger from scripts.parsers.imgs import imgs from scripts.parsers.settings import settings from data.colors import colors de...
code_fim
hard
{ "lang": "python", "repo": "qu0ta/Aki-DiscordBot", "path": "/Aki-DiscordBot/core/cogs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @bot.command(aliases = ['перезагрузить_ког', 'reload_cog', 'перезагрузить_дополнение', 'reload_extention']) async def reload_extension(ctx, extensions=None): if is_owner(ctx.author.id): if extensions is None: emb = discord.Embed(title = 'Помощник - Перезагрузить...
code_fim
hard
{ "lang": "python", "repo": "qu0ta/Aki-DiscordBot", "path": "/Aki-DiscordBot/core/cogs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhongerqiandan/OpenDialog path: /models/seq2seq_trs.py from .header import * ''' Transformer seq2seq model ''' class Transformer(nn.Module): def __init__(self, n_vocab, d_model=512, n_head=8, num_encoder_layers=6, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, max_len=512, share_w...
code_fim
hard
{ "lang": "python", "repo": "zhongerqiandan/OpenDialog", "path": "/models/seq2seq_trs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> recoder.add_scalar(f'train-epoch-{idx_}/Loss-{self.args["local_rank"]}', total_loss/batch_num, idx) recoder.add_scalar(f'train-epoch-{idx_}/RunLoss-{self.args["local_rank"]}', loss.item(), idx) recoder.add_scalar(f'train-epoch-{idx_}/RunTokenAcc-{self.args["local_rank"]...
code_fim
hard
{ "lang": "python", "repo": "zhongerqiandan/OpenDialog", "path": "/models/seq2seq_trs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: evenmarbles/rlpy path: /rlpy/stats/models/mixture.py below this threshold. Default is 1e-4. verbose : bool, optional Controls if debug information is printed to the console. Default is False. Attributes ---------- ncomponents : int Number of mixture compo...
code_fim
hard
{ "lang": "python", "repo": "evenmarbles/rlpy", "path": "/rlpy/stats/models/mixture.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- float : The weighted mixture priors. """ if np.all(self.mix_prior == 1): return 0 return np.dot(np.log(self.mix_weight).T, (self.mix_prior - 1)) def _estep(self, x): mix_weight, ll = self.score_samples(x)...
code_fim
hard
{ "lang": "python", "repo": "evenmarbles/rlpy", "path": "/rlpy/stats/models/mixture.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> n_iter=None, thresh=None, verbose=None): super(GMM, self).__init__(ncomponents, prior, mix_prior, mix_weight, n_iter, thresh, verbose) if mean is not None and cov is not None: self.cond_proba = conditional_normal(mean, cov, self.prior) def sample(self, si...
code_fim
hard
{ "lang": "python", "repo": "evenmarbles/rlpy", "path": "/rlpy/stats/models/mixture.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> pass def task_failed(self, job_id, task_name, output): pass<|fim_prefix|># repo: jtracker-io/jt-cli path: /jtracker/execution/scheduler/base.py from abc import ABCMeta, abstractproperty class Scheduler(object): __metaclass__ = ABCMeta def __init__(self, mode=None): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "jtracker-io/jt-cli", "path": "/jtracker/execution/scheduler/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass def task_completed(self, job_id, task_name, output): pass def task_failed(self, job_id, task_name, output): pass<|fim_prefix|># repo: jtracker-io/jt-cli path: /jtracker/execution/scheduler/base.py from abc import ABCMeta, abstractproperty class Scheduler(object): ...
code_fim
easy
{ "lang": "python", "repo": "jtracker-io/jt-cli", "path": "/jtracker/execution/scheduler/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jtracker-io/jt-cli path: /jtracker/execution/scheduler/base.py from abc import ABCMeta, abstractproperty class Scheduler(object): __metaclass__ = ABCMeta def __init__(self, mode=None): self._mode = mode <|fim_suffix|> pass def task_failed(self, job_id, task_name, o...
code_fim
hard
{ "lang": "python", "repo": "jtracker-io/jt-cli", "path": "/jtracker/execution/scheduler/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> graphql = ( "fragment CoreVideoFields on Video {\n id\n guid\n slug\n title\n subtitle\n page\n" " projectSlug\n posterCloudinaryPath\n source {\n url\n credits\n duration\n" " name\n __typename\n }\n __typename\n}\n\nqu...
code_fim
hard
{ "lang": "python", "repo": "spaam/svtplay-dl", "path": "/lib/svtplay_dl/service/angelstudios.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spaam/svtplay-dl path: /lib/svtplay_dl/service/angelstudios.py import json import re from svtplay_dl.error import ServiceError from svtplay_dl.fetcher.hls import hlsparse from svtplay_dl.service import Service class Angelstudios(Service): supported_domains = ["watch.angelstudios.com"] ...
code_fim
hard
{ "lang": "python", "repo": "spaam/svtplay-dl", "path": "/lib/svtplay_dl/service/angelstudios.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codefordurham/Traffic-Stops path: /traffic_stops/routers.py import logging from django.conf import settings logger = logging.getLogger(__name__) class StateDatasetRouter(object): """Read/write from speciic State databases""" def _db_name(self, model): return 'traffic_stops_{}...
code_fim
hard
{ "lang": "python", "repo": "codefordurham/Traffic-Stops", "path": "/traffic_stops/routers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def db_for_read(self, model, **hints): """Return state DB if model's app name is a database""" state_db = self._db_name(model) if state_db in settings.DATABASES: name = state_db else: name = 'default' logger.debug('db_for_read({}): {}'.fo...
code_fim
hard
{ "lang": "python", "repo": "codefordurham/Traffic-Stops", "path": "/traffic_stops/routers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return p a = np.array([[3, 2, -1], [2, -1, 1], [-1, 1, -1]]) # 3X3 symmetric matrix b = (np.array([1, -2, 0])[np.newaxis]).T # 3X1 matrix x = (np.array([0, 1, 2])[np.newaxis]).T val = ConjGrad(a, b, x); print(val)<|fim_prefix|># repo: rohitj559/HPC-Fall-2018-project path: /ConjugateGardient_Py...
code_fim
hard
{ "lang": "python", "repo": "rohitj559/HPC-Fall-2018-project", "path": "/ConjugateGardient_Python.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rohitj559/HPC-Fall-2018-project path: /ConjugateGardient_Python.py # -*- coding: utf-8 -*- """ Created on Thu Dec 6 20:36:02 2018 @author: Rohit """ # ============================================================================= # import numpy as np # a = np.array([5,4])[np.newaxis] # print(a)...
code_fim
hard
{ "lang": "python", "repo": "rohitj559/HPC-Fall-2018-project", "path": "/ConjugateGardient_Python.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/3. Python Fundamentals/3. Python Control Flow/3. Challenge (Advanced)/2. same name.py # Write your same_name function here: <|fim_suffix|># Uncomment these function calls to test your same_name function: print(same_name("Co...
code_fim
medium
{ "lang": "python", "repo": "DincerDogan/Data-Science-Learning-Path", "path": "/Data Scientist Career Path/3. Python Fundamentals/3. Python Control Flow/3. Challenge (Advanced)/2. same name.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Uncomment these function calls to test your same_name function: print(same_name("Colby", "Colby")) # should print True print(same_name("Tina", "Amber")) # should print False<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/3. Python Fundamentals/3. Python Co...
code_fim
medium
{ "lang": "python", "repo": "DincerDogan/Data-Science-Learning-Path", "path": "/Data Scientist Career Path/3. Python Fundamentals/3. Python Control Flow/3. Challenge (Advanced)/2. same name.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _test_resize_from_two_devs_to_one_dev(self, num_pci_on_dest): # The fake libvirt will emulate on the host: # * two type-PCI in slot 0, 1 compute1_pci_info = fakelibvirt.HostPCIDevicesInfo(num_pci=2) # the config matches the PCI dev compute1_device_spec = [ ...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/functional/regressions/test_bug_1983753.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/nova path: /nova/tests/functional/regressions/test_bug_1983753.py # 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.ap...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/functional/regressions/test_bug_1983753.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> bot.reply_to(message, "Welcome to the Weather Station telegram bot!!\n\n" + help()) @bot.message_handler(commands=['status']) def send_station_status(message): keys = ['station.py'] output = commands.getoutput('ps -A') m = "" for key in keys: m = m + '-' + key + ': ' if key in output: m += ...
code_fim
medium
{ "lang": "python", "repo": "jordivilaseca/ardupi-weather", "path": "/RaspberryPi/ardupi_weather/weatherBot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jordivilaseca/ardupi-weather path: /RaspberryPi/ardupi_weather/weatherBot.py import telebot import commands from config import LOG_PATH from os import listdir from os.path import isfile, join API_TOKEN = "api_key" bot = telebot.TeleBot(API_TOKEN) print (bot.get_me()) def help(): return ''' A...
code_fim
hard
{ "lang": "python", "repo": "jordivilaseca/ardupi-weather", "path": "/RaspberryPi/ardupi_weather/weatherBot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> listfiles = [f for f in listdir(LOG_PATH) if isfile(join(LOG_PATH,f))] command = message.text.split(' ') index = -1; if len(command) == 2: try: index = long(command[1]) except: bot.reply_to(message,log_usage('Not number')) else: if index >= 0 and index < len(listfiles): data = "" ...
code_fim
hard
{ "lang": "python", "repo": "jordivilaseca/ardupi-weather", "path": "/RaspberryPi/ardupi_weather/weatherBot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestAuthorize(object): def test_raises_exception_if_not_authorized(self, ability, view_action): with pytest.raises(Exception): ability.authorize(view_action, project_id=1) def test_does_nothing_if_allowed(self, ability, list_action): ability.authorize(list_action...
code_fim
medium
{ "lang": "python", "repo": "Clustaar/clustaar.authorize", "path": "/tests/authorize/test_ability.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Clustaar/clustaar.authorize path: /tests/authorize/test_ability.py from clustaar.authorize import Ability, Authorizations, Action import pytest @pytest.fixture def ability(list_action): class AuthorizationsMock(Authorizations): def can(self, action, *args, **kwargs): ret...
code_fim
hard
{ "lang": "python", "repo": "Clustaar/clustaar.authorize", "path": "/tests/authorize/test_ability.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sampoder/SwagLyrics-For-Spotify path: /tests/test_tab.py """ Contains unit tests for tab.py """ import flask_testing from mock import patch from SwSpotify import SpotifyNotRunning from swaglyrics.tab import app class Tests(flask_testing.TestCase): """ Unit tests """ def setup(s...
code_fim
hard
{ "lang": "python", "repo": "sampoder/SwagLyrics-For-Spotify", "path": "/tests/test_tab.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @patch('SwSpotify.spotify.current', side_effect=SpotifyNotRunning) def test_no_lyrics_are_shown_in_tab(self, mock_song): """ that that tab.py is working when no song playing """ with self.app.test_client() as c: response = c.get('/') self.ass...
code_fim
hard
{ "lang": "python", "repo": "sampoder/SwagLyrics-For-Spotify", "path": "/tests/test_tab.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # get tail text for formatting if len(ipdict) > 0: maintail = ipdict.text lasttail = ipdict[-1].tail else: maintail = '\n\t' lasttail = '\n' # create a list of new elements newelements = [] for (key, [ignore, val]) in filterkeys.iteritems(): ...
code_fim
hard
{ "lang": "python", "repo": "vintagexav/JSONedit", "path": "/app/jsonedit.app/Contents/Resources/Scripts/infoplist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # now we're only interested in the new value curval = curval[1] # we're deleting this key if len(curval) == 0: root.remove(root[i]) if (i < len(root)) and (root[i].tag != 'key'): root.remove(ro...
code_fim
hard
{ "lang": "python", "repo": "vintagexav/JSONedit", "path": "/app/jsonedit.app/Contents/Resources/Scripts/infoplist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vintagexav/JSONedit path: /app/jsonedit.app/Contents/Resources/Scripts/infoplist.py #!/usr/bin/python # # infoplist.py: edit Chrome Info.plist for an SSB # Copyright (C) 2016 David Marmor # # https://github.com/dmarmor/epichrome # # Full license at: http://www.gnu.org/licenses/ (V3,6/29/2007...
code_fim
hard
{ "lang": "python", "repo": "vintagexav/JSONedit", "path": "/app/jsonedit.app/Contents/Resources/Scripts/infoplist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tickleliu/rnn-tf2 path: /tf_rnn.py from itertools import chain from time import time from typing import * import numpy as np import tensorflow as tf import tensorflow.compat.v1 as tfc from dataclasses import dataclass from models.rnn import RNN, StaticLSTM @dataclass class BenchmarkSequences:...
code_fim
hard
{ "lang": "python", "repo": "tickleliu/rnn-tf2", "path": "/tf_rnn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Not padded data with different sequence lengths""" return Data._create_dataset(seq, pad=False) @staticmethod def static(seq: List[int]): """Padded data with different sequence lengths""" return Data._create_dataset(seq, pad=True) def run_rnn_compat(model_cls: ...
code_fim
hard
{ "lang": "python", "repo": "tickleliu/rnn-tf2", "path": "/tf_rnn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ultimatecoder/funnel path: /funnel/views/profile.py # -*- coding: utf-8 -*- from flask import g, Markup, request, flash, url_for, redirect from coaster.views import load_models from baseframe import _ from baseframe.forms import render_message, render_redirect, render_form from ..models import d...
code_fim
hard
{ "lang": "python", "repo": "ultimatecoder/funnel", "path": "/funnel/views/profile.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Step 3: Ask user to select organization form = NewProfileForm() form.profile.choices = eligible_profiles if request.method == 'GET': form.profile.data = new_profiles[0][0] if form.validate_on_submit(): # Step 4: Make a profile org = [org for org in g.user.orga...
code_fim
hard
{ "lang": "python", "repo": "ultimatecoder/funnel", "path": "/funnel/views/profile.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def process(self, data): for metric in data.split('\n'): match = re.match('\A([^:]+):([^|]+)\|(.+)', metric) if match == None: continue key = match.group(1) value = match.group(2) rest = match.group(3).split('|') mtype = rest.pop(0) if (mtype ==...
code_fim
medium
{ "lang": "python", "repo": "johndpope/bondster-bco", "path": "/bbtest/helpers/statsd.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }