text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> rows = [] for s, o, data in self.graph.edges(data=True): row = self.build_export_row(data.copy()) row['subject'] = s row['object'] = o rows.append(row) df = pd.DataFrame.from_dict(rows) cols = df.columns.tolist() cols ...
code_fim
hard
{ "lang": "python", "repo": "justaddcoffee/kgx", "path": "/kgx/pandas_transformer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: justaddcoffee/kgx path: /kgx/pandas_transformer.py import pandas as pd import numpy as np import logging import os import tarfile from tempfile import TemporaryFile from kgx.utils import make_path from .transformer import Transformer from typing import Dict, List, Optional LIST_DELIMITER = '|...
code_fim
hard
{ "lang": "python", "repo": "justaddcoffee/kgx", "path": "/kgx/pandas_transformer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> logging.info('Test Dice Coeff: {}'.format(test_score_dice)) print('Test Dice Coeff: {}'.format(test_score_dice)) writer.add_scalar(f'Phase_{phase}_Dice_{dropout_flag}/test', test_score_dice, epoch) logging.info('Test IOU : {}'.format(test_score_iou)) print('Test IO...
code_fim
hard
{ "lang": "python", "repo": "ConstantSun/active_learning_1", "path": "/trainer/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ConstantSun/active_learning_1 path: /trainer/train.py from tqdm import tqdm import torch import torch.nn as nn from trainer.eval import eval_net from pathlib import Path import os # trong mỗi phase, lưu lại best model để làm training cho phase tiếp theo. def train(net: torch.nn, data_train, tra...
code_fim
hard
{ "lang": "python", "repo": "ConstantSun/active_learning_1", "path": "/trainer/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # writer.add_scalar('Loss/train', loss.item(), global_step) pbar.set_postfix(**{'loss (batch)': loss.item()}) optimizer.zero_grad() loss.backward() nn.utils.clip_grad_value_(net.parameters(), 0.1) optimizer.ste...
code_fim
hard
{ "lang": "python", "repo": "ConstantSun/active_learning_1", "path": "/trainer/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: productiveware-xhacks/productiveware path: /py-app/launch.py import sys from PySide6 import QtWidgets <|fim_suffix|>if __name__ == '__main__': app = QtWidgets.QApplication() main_window = MainWidget() sys.exit(app.exec())<|fim_middle|>from productiveware.widgets.main_window import Ma...
code_fim
medium
{ "lang": "python", "repo": "productiveware-xhacks/productiveware", "path": "/py-app/launch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': app = QtWidgets.QApplication() main_window = MainWidget() sys.exit(app.exec())<|fim_prefix|># repo: productiveware-xhacks/productiveware path: /py-app/launch.py import sys from PySide6 import QtWidgets <|fim_middle|>from productiveware.widgets.main_window import Ma...
code_fim
medium
{ "lang": "python", "repo": "productiveware-xhacks/productiveware", "path": "/py-app/launch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gcfyouthlive/youthlive_web path: /api/models.py from django.db import models from django.contrib.auth.models import AbstractUser from django.utils.translation import ugettext_lazy as _ from django.conf import settings import datetime, uuid # Create your models here. #Custom User class User(Abst...
code_fim
hard
{ "lang": "python", "repo": "gcfyouthlive/youthlive_web", "path": "/api/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Events System class Events(models.Model): eventname = models.CharField(max_length=60, blank=False) datetime = models.DateTimeField() attendees = models.ManyToManyField('User',blank=True) def __str__(self): return self.eventname # Reimbursment System class Transaction(models.Mod...
code_fim
medium
{ "lang": "python", "repo": "gcfyouthlive/youthlive_web", "path": "/api/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jayhebe/w3resource_exercises path: /Basic - Part1/ex123.py import sys print("Float value informati<|fim_suffix|>aximum size of an integer: ", sys.maxsize)<|fim_middle|>on: ", sys.float_info) print("Integer value information: ", sys.int_info) print("M
code_fim
medium
{ "lang": "python", "repo": "jayhebe/w3resource_exercises", "path": "/Basic - Part1/ex123.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>aximum size of an integer: ", sys.maxsize)<|fim_prefix|># repo: jayhebe/w3resource_exercises path: /Basic - Part1/ex123.py import sys print("Float value information: ", sys.float_info) print("Integer val<|fim_middle|>ue information: ", sys.int_info) print("M
code_fim
easy
{ "lang": "python", "repo": "jayhebe/w3resource_exercises", "path": "/Basic - Part1/ex123.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 131250208/IPGeolocation path: /Experiments/data_preprocessor.py import requests from Tools import requests_tools as rt, geoloc_commercial_db, web_mapping_services, network_measurer, geo_distance_calculator import re from bs4 import BeautifulSoup import socket import pyprind import settings,...
code_fim
hard
{ "lang": "python", "repo": "131250208/IPGeolocation", "path": "/Experiments/data_preprocessor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: ip = socket.gethostbyname(name) lm["ip"] = ip # print(("getaddrinfo succeed, domain_name: %s, org: %s" % (name, lm["university_name"]))) except Exception as e: count_fail += 1 # print("getaddrinfo failed, domain_name: %...
code_fim
hard
{ "lang": "python", "repo": "131250208/IPGeolocation", "path": "/Experiments/data_preprocessor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Return list of HTML theme paths.""" cur_dir = path.abspath(path.dirname(path.dirname(__file__))) return cur_dir # See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package def setup(app): app.add_html_theme( "pt_lightning_sphinx_theme", pat...
code_fim
medium
{ "lang": "python", "repo": "FedML-AI/FedML", "path": "/doc/theme/lightning_sphinx_theme/pt_lightning_sphinx_theme/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Book', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('title', models.CharField(max_length=64, unique=True)), ], ...
code_fim
hard
{ "lang": "python", "repo": "bagaki/Python", "path": "/Full Stack/day63Django/day63Mysite/MyApp/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bagaki/Python path: /Full Stack/day63Django/day63Mysite/MyApp/migrations/0001_initial.py # Generated by Django 2.1 on 2018-09-04 08:02 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.CreateModel( ...
code_fim
hard
{ "lang": "python", "repo": "bagaki/Python", "path": "/Full Stack/day63Django/day63Mysite/MyApp/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Book', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('title', models.CharField(max_length=64, unique=True)), ], ), migrations.Create...
code_fim
hard
{ "lang": "python", "repo": "bagaki/Python", "path": "/Full Stack/day63Django/day63Mysite/MyApp/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': # Log http requests logging.basicConfig(filename= cwd + '/logs/webapp.log', level=logging.DEBUG) # Run the webserver app.run(host='0.0.0.0', port=8080, debug=True)<|fim_prefix|># repo: paib/docker_apps path: /file_vault/app/vault_app.py import os from flask import Flas...
code_fim
medium
{ "lang": "python", "repo": "paib/docker_apps", "path": "/file_vault/app/vault_app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: paib/docker_apps path: /file_vault/app/vault_app.py import os from flask import Flask, render_template import logging from logging.handlers import RotatingFileHandler app = Flask(__name__) app.debug = True <|fim_suffix|>if __name__ == '__main__': # Log http requests logging.basicConfig(file...
code_fim
medium
{ "lang": "python", "repo": "paib/docker_apps", "path": "/file_vault/app/vault_app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cartoonist/poodledo path: /poodledo/toodledodata.py import six import time from datetime import datetime, timedelta def _local_date(string): dt = datetime.strptime(string[0:25], '%a, %d %b %Y %H:%M:%S') return dt + timedelta(hours=6) + timedelta(seconds=_local_time_offset()) def _local_...
code_fim
hard
{ "lang": "python", "repo": "cartoonist/poodledo", "path": "/poodledo/toodledodata.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> _typemap = { 'server': { 'unixtime': int, 'date': _local_date, 'tokenexpires': float }, 'folder': { 'id': int, 'name': str, 'archived': _boolstr, 'pri...
code_fim
hard
{ "lang": "python", "repo": "cartoonist/poodledo", "path": "/poodledo/toodledodata.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: reefsource/core path: /test/integration_tests/python/test_rules.py import json import logging log = logging.getLogger(__name__) sh = logging.StreamHandler() log.addHandler(sh) <|fim_suffix|> r = as_user.get('/rules') assert r.status_code == 403 r = as_user.post('/rules', json={'tes...
code_fim
easy
{ "lang": "python", "repo": "reefsource/core", "path": "/test/integration_tests/python/test_rules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r = as_user.post('/rules', json={'test': 'rule'}) assert r.status_code == 403<|fim_prefix|># repo: reefsource/core path: /test/integration_tests/python/test_rules.py import json import logging log = logging.getLogger(__name__) sh = logging.StreamHandler() log.addHandler(sh) def test_rule_acces...
code_fim
medium
{ "lang": "python", "repo": "reefsource/core", "path": "/test/integration_tests/python/test_rules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # get_state(): Accepts an array of actions and performs the action on the Dino # Returns the new state, the reward, and if the game ended def get_state(self, actions): score = self._game.get_score() reward = 0.1 * score / 10 is_over = False if actio...
code_fim
medium
{ "lang": "python", "repo": "ajmadrid3/DinoRun_ML", "path": "/Game_state.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajmadrid3/DinoRun_ML path: /Game_state.py # Used by the network to perform actions and getting new states from Grab_screen import grab_screen class Game_state: def __init__(self, agent, game): self._agent = agent self._game = game <|fim_suffix|> if self._agent.is_cras...
code_fim
hard
{ "lang": "python", "repo": "ajmadrid3/DinoRun_ML", "path": "/Game_state.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self._agent = agent self._game = game # get_state(): Accepts an array of actions and performs the action on the Dino # Returns the new state, the reward, and if the game ended def get_state(self, actions): score = self._game.get_score() reward = 0....
code_fim
medium
{ "lang": "python", "repo": "ajmadrid3/DinoRun_ML", "path": "/Game_state.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: smallstateinstitute/ssi-site path: /tools/mnis/__init__.py from mnis.mnislib import \ getCurrentCommonsMembers, \ getCommonsMembersOn, \ getCommonsMembersBetwe<|fim_suffix|>getServiceDataForMember, \ getSummaryDataForMembers, \ saveSummaryDataForMembers, \ downloadMembers \<|fim_middle|>en,...
code_fim
hard
{ "lang": "python", "repo": "smallstateinstitute/ssi-site", "path": "/tools/mnis/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> getGenderForMember, \ getDateOfBirthForMember, \ getConstituencyForMember, \ getPartyForMember, \ getServiceDataForMember, \ getSummaryDataForMembers, \ saveSummaryDataForMembers, \ downloadMembers \<|fim_prefix|># repo: smallstateinstitute/ssi-site path: /tools/mnis/__init__.py from mnis.mnislib...
code_fim
medium
{ "lang": "python", "repo": "smallstateinstitute/ssi-site", "path": "/tools/mnis/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>getServiceDataForMember, \ getSummaryDataForMembers, \ saveSummaryDataForMembers, \ downloadMembers \<|fim_prefix|># repo: smallstateinstitute/ssi-site path: /tools/mnis/__init__.py from mnis.mnislib import \ getCurrentCommonsMembers, \ getCommonsMembersOn, \ getCommonsMembersBetween, \ getCommons...
code_fim
medium
{ "lang": "python", "repo": "smallstateinstitute/ssi-site", "path": "/tools/mnis/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print("downloading " + entry + "...") # Login to Kaggle and retrieve the data. r = requests.post(r.url, data = kaggle_info) # Writes the data to a local file one chunk at a time. f = open(data_path + files[entry], 'w') for chunk in r.iter_content(ch...
code_fim
hard
{ "lang": "python", "repo": "jakewalker56/ml-lab", "path": "/kaggle/dstl_satellite/download.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakewalker56/ml-lab path: /kaggle/dstl_satellite/download.py import requests import zipfile import os data_url = 'https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/download/' data_path = "/Volumes/external/data/" files = { "sample_submission.csv.zip" : "sample_submission.csv....
code_fim
hard
{ "lang": "python", "repo": "jakewalker56/ml-lab", "path": "/kaggle/dstl_satellite/download.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #delte the zip file #print("deleting zip file...") #os.remove(data_path + files[entry]) else: print("already unzipped") for folder in delete_folders: print("removing " + folder + "...") try: os.rmdir(data_path + folder) except (OSError): pr...
code_fim
hard
{ "lang": "python", "repo": "jakewalker56/ml-lab", "path": "/kaggle/dstl_satellite/download.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: milvus-io/pymilvus path: /pymilvus/client/types.py t as ok :attribute message: str (optional) current status message """ SUCCESS = common_pb2.Success UNEXPECTED_ERROR = common_pb2.UnexpectedError CONNECT_FAILED = 2 PERMISSION_DENIED = 3 COLLECTION_NOT_EXISTS = 4 ...
code_fim
hard
{ "lang": "python", "repo": "milvus-io/pymilvus", "path": "/pymilvus/client/types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: milvus-io/pymilvus path: /pymilvus/client/types.py HNSW = 11 ANNOY = 12 # alternative name IVF_FLAT = IVFLAT IVF_SQ8_H = IVF_SQ8H def __repr__(self) -> str: return f"<{self.__class__.__name__}: {self._name_}>" def __str__(self) -> str: return self._name...
code_fim
hard
{ "lang": "python", "repo": "milvus-io/pymilvus", "path": "/pymilvus/client/types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self) -> str: s = "Replica groups:" for g in self.groups: s += f"\n- {g}" return s @property def groups(self): return self._groups class BulkInsertState: """enum states of bulk insert task""" ImportPending = 0 ImportFaile...
code_fim
hard
{ "lang": "python", "repo": "milvus-io/pymilvus", "path": "/pymilvus/client/types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for slot,v in t.items(): v=str(v) for n,x in enumerate(sys.argv): if x=="-" + slot[0] or x=="--" + slot: if v == "false": v = "true" elif v == "true": v = "false" else: ...
code_fim
hard
{ "lang": "python", "repo": "Mansimran7/ASE_Group12_Hws", "path": "/src/Hw1-script/misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mansimran7/ASE_Group12_Hws path: /src/Hw1-script/misc.py from help import * import math import re import sys def settings(str): return dict(re.findall("\n[\s]+[-][\S]+[\s]+[-][-]([\S]+)[^\n]+= ([\S]+)",str)) def coerce(s1): """ Converts value to Boolean, if value is not a boolea...
code_fim
hard
{ "lang": "python", "repo": "Mansimran7/ASE_Group12_Hws", "path": "/src/Hw1-script/misc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def commandResult(self) -> global___SendCommandResult: ... def __init__(self, *, sendError : typing.Optional[global___SendError.Enum.V] = ..., handlerReturnStatus : typing.Optional[global___HandlerReturnStatus.Enum.V] = ..., handlerReturnStatusDatas : ...
code_fim
hard
{ "lang": "python", "repo": "cchampignon/pyatv", "path": "/pyatv/protocols/mrp/protobuf/SendCommandResultMessage_pb2.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cchampignon/pyatv path: /pyatv/protocols/mrp/protobuf/SendCommandResultMessage_pb2.pyi """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file """ import builtins import google.protobuf.descriptor import google.protobuf.internal.containers import google.protobuf.internal.enum_type...
code_fim
hard
{ "lang": "python", "repo": "cchampignon/pyatv", "path": "/pyatv/protocols/mrp/protobuf/SendCommandResultMessage_pb2.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mayi/start path: /WebStarter/main.py # coding: utf-8 import sys import web import url <|fim_suffix|>if __name__ == "__main__": app = web.application(urls, globals()) app.run()<|fim_middle|>sys.path.append('./controllers') urls = url.urls
code_fim
easy
{ "lang": "python", "repo": "mayi/start", "path": "/WebStarter/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": app = web.application(urls, globals()) app.run()<|fim_prefix|># repo: mayi/start path: /WebStarter/main.py # coding: utf-8 import sys import web import url <|fim_middle|>sys.path.append('./controllers') urls = url.urls
code_fim
easy
{ "lang": "python", "repo": "mayi/start", "path": "/WebStarter/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevesan/dero path: /play.py #!/usr/bin/env python3 """ Given a WAD, it'll detect if it's for DOOM1 or 2 (based on map names) and run GZDoom with the right iwad arg """ import argparse import os import wad import subprocess import dero_config <|fim_suffix|> # Find all WADs and PK3's in this f...
code_fim
hard
{ "lang": "python", "repo": "stevesan/dero", "path": "/play.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Find all WADs and PK3's in this folder and load them. wadpaths = [] for file in os.listdir(pwad_dir): if file.lower().endswith('.wad') or file.lower().endswith('.pk3'): wadpaths.append(os.path.join(pwad_dir, file)) if args.voxels: wadpaths.append('/Users/stevenan/dooming/wads/chee...
code_fim
hard
{ "lang": "python", "repo": "stevesan/dero", "path": "/play.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: thisgirlangie/Tipsy path: /tipsy.py """ tipsy.py -- This is a Flask-based to-do list """ from flask import Flask, render_template, request import model <|fim_suffix|>@app.route("/add-task") def add_task(): return render_template("add_task.html", user_id="user_id") @app.route("/add-task-crea...
code_fim
medium
{ "lang": "python", "repo": "thisgirlangie/Tipsy", "path": "/tipsy.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model.connect_to_db() title = request.args.get("title") user_id = request.args.get("user_id") created_at = request.args.get("datestamp") row = model.new_task(title, created_at, user_id) html = render_template("added_task.html") return html if __name__ == "__main__": app.ru...
code_fim
hard
{ "lang": "python", "repo": "thisgirlangie/Tipsy", "path": "/tipsy.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ A subscriber to the ``pyramid.events.BeforeRender`` events. Updates the :term:`renderer globals` with values that are familiar to Pylons users.""" request = event.get('request') if request is None: request = get_current_request() globs = { 'url': route_url, ...
code_fim
medium
{ "lang": "python", "repo": "SEL-Columbia/gateway", "path": "/gateway/subscribers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SEL-Columbia/gateway path: /gateway/subscribers.py from pyramid.threadlocal import get_current_request from pyramid.exceptions import ConfigurationError from pyramid.security import authenticated_userid from pyramid.url import route_url from git import Repo <|fim_suffix|> """ A subscriber to ...
code_fim
medium
{ "lang": "python", "repo": "SEL-Columbia/gateway", "path": "/gateway/subscribers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def visit_arguments(self, node): if type(self.current_node) is not FunctionNode: ast_error("Argument should be found in a function", node) for arg in node.args: var_type = ast_to_call_graph_type(self.stack, arg.annotation) var_node = VariableNode(arg...
code_fim
hard
{ "lang": "python", "repo": "prg-titech/Sanajeh", "path": "/new-src/call_graph.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prg-titech/Sanajeh path: /new-src/call_graph.py return self.name + "*" def to_field_type(self): return self.name + "*" def declared_functions(self): return self.class_node.declared_functions class RefTypeNode(TypeNode): def __init__(self, type_node): ...
code_fim
hard
{ "lang": "python", "repo": "prg-titech/Sanajeh", "path": "/new-src/call_graph.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prg-titech/Sanajeh path: /new-src/call_graph.py names = set() self.has_device_data = False def get_ClassNode(self, class_name): for class_node in self.declared_classes: if class_node.name == class_name: return class_node return None ...
code_fim
hard
{ "lang": "python", "repo": "prg-titech/Sanajeh", "path": "/new-src/call_graph.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PayamDiba/CycleGAN path: /generator.py """ @author: Payam Dibaeinia """ import torch import torch.nn as nn from collections import OrderedDict from ResidualBlock import ResNetBlock class generator(nn.Module): """ According to the cycleGAN paper, reflection padding and instance normaliz...
code_fim
hard
{ "lang": "python", "repo": "PayamDiba/CycleGAN", "path": "/generator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> layers += [nn.ReflectionPad2d(3)] layers += [nn.Conv2d(in_channels = nChanFirstConv, out_channels = out_channels, kernel_size = 7)] layers += [nn.Tanh()] self.all_layers_ = nn.Sequential(*layers) def forward(self,x): return self.all_layers_(x)<|fim_prefix|># r...
code_fim
hard
{ "lang": "python", "repo": "PayamDiba/CycleGAN", "path": "/generator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: johnclarke96/6867-final-project path: /scripts/useful_constants.py atomic_weights = { 'C': 12, 'O': 16, 'H': 1, 'N': 14, 'S': 32, } <|fim_suffix|>amino_acids_index = { 'A': 0, 'R': 1, 'N': 2, 'D': 3, 'Y': 4, 'C': 5, 'E': 6, 'Q': 7, 'V': 8, 'G': 9, 'H': 10, 'I': ...
code_fim
hard
{ "lang": "python", "repo": "johnclarke96/6867-final-project", "path": "/scripts/useful_constants.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>amino_acids_index = { 'A': 0, 'R': 1, 'N': 2, 'D': 3, 'Y': 4, 'C': 5, 'E': 6, 'Q': 7, 'V': 8, 'G': 9, 'H': 10, 'I': 11, 'L': 12, 'K': 13, 'M': 14, 'F': 15, 'P': 16, 'S': 17, 'T': 18, 'W': 19, } atom_codes = { 'H': 1, 'C': 2, 'O': 3, 'N': 4, 'S': 5, }<|fim...
code_fim
hard
{ "lang": "python", "repo": "johnclarke96/6867-final-project", "path": "/scripts/useful_constants.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> context = super(HomeView, self).get_context_data(**kwargs) context['featured_products'] = Product.objects \ .prefetch_related('photos').featured() return context<|fim_prefix|># repo: ular/toko path: /toko/apps/pages/views.py from django.views.generic import TemplateVie...
code_fim
medium
{ "lang": "python", "repo": "ular/toko", "path": "/toko/apps/pages/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ular/toko path: /toko/apps/pages/views.py from django.views.generic import TemplateView from toko.apps.products.models import Product <|fim_suffix|> def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) context['featured_products'] = ...
code_fim
medium
{ "lang": "python", "repo": "ular/toko", "path": "/toko/apps/pages/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rhinstaller/kickstart-tests path: /scripts/weekly-summary hen using pycurl.NOSIGNAL - see # the libcurl tutorial for more info. try: import signal from signal import SIGPIPE, SIG_IGN except ImportError: pass else: signal.signal(SIGPIPE, SIG_IGN) def get_artifacts(token, artifact...
code_fim
hard
{ "lang": "python", "repo": "rhinstaller/kickstart-tests", "path": "/scripts/weekly-summary", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for n in flakes: top_flakes[n] = top_flakes.get(n, 0) + 1 # Summary of tests per scenario print("Weekly summary", file=buf) print("==============", file=buf) for scenario in sorted(all_days.keys()): success = all_days[scenario]["success"] missi...
code_fim
hard
{ "lang": "python", "repo": "rhinstaller/kickstart-tests", "path": "/scripts/weekly-summary", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rhinstaller/kickstart-tests path: /scripts/weekly-summary int(f"Fetching {filename}") ok = run_curl(token, a["archive_download_url"], filename) if not ok: continue zipfiles.append((a["name"], datename, filename)) return zipfiles def extract_logs(f): ...
code_fim
hard
{ "lang": "python", "repo": "rhinstaller/kickstart-tests", "path": "/scripts/weekly-summary", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif method=="XGBOOST": print("Training model Xgboost ...") output_path = "model_output/saved_xgboost_model.joblib" xgboost = train_model_xgboost(X_train, y_train, output_path) return xgboost if __name__ == "__main__": df = pd.read_csv("NSE-TATA.csv") feature...
code_fim
hard
{ "lang": "python", "repo": "minhtrihcmus/stock-price-prediction", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: minhtrihcmus/stock-price-prediction path: /train.py # Base on stock_pred.py from datetime import time import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.pylab import rcParams from sklearn.model_selection import train_test_split from sklearn.preprocessing imp...
code_fim
hard
{ "lang": "python", "repo": "minhtrihcmus/stock-price-prediction", "path": "/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jonny-Riggs/Studio-Manager-API path: /studio_app/views/user_view.py from django.contrib.auth.models import User from rest_framework import viewsets from django.core import serializers from studio_app.models import * from studio_app.serializers import * <|fim_suffix|> queryset = User.objects...
code_fim
easy
{ "lang": "python", "repo": "Jonny-Riggs/Studio-Manager-API", "path": "/studio_app/views/user_view.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class UserViewSet(viewsets.ModelViewSet): queryset = User.objects.all() serializer_class = UserSerializer<|fim_prefix|># repo: Jonny-Riggs/Studio-Manager-API path: /studio_app/views/user_view.py from django.contrib.auth.models import User from rest_framework import viewsets from django.core impo...
code_fim
medium
{ "lang": "python", "repo": "Jonny-Riggs/Studio-Manager-API", "path": "/studio_app/views/user_view.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif si+1 == ei: # If we searched the entire array and can't find the target print(f"{target} could not be found") searching = False # Else continue searching else: if arr[mi] > target: # What we're searching for is a smaller number ...
code_fim
hard
{ "lang": "python", "repo": "Victorli888/Python-Tutorial-Workbook", "path": "/Algorithms/LinearBinarySearch.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Victorli888/Python-Tutorial-Workbook path: /Algorithms/LinearBinarySearch.py # Linear Search - going through each and every element in a list. # Binary Search - splitting the list in half and searching through the half before moving on print("Example 1: Linear Search") # find if 0 is present in...
code_fim
hard
{ "lang": "python", "repo": "Victorli888/Python-Tutorial-Workbook", "path": "/Algorithms/LinearBinarySearch.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> total = sum(nums) if total % 4: return False nums.sort(reverse=True) return self.dfs(nums, [0]*4, 0, total//4) def dfs(self, nums: List[int], sums: List[int], pos: int, target: int) -> bool: if pos == len(nums): ...
code_fim
medium
{ "lang": "python", "repo": "eric496/leetcode.py", "path": "/backtracking/473.matchsticks_to_square.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if total % 4: return False nums.sort(reverse=True) return self.dfs(nums, [0]*4, 0, total//4) def dfs(self, nums: List[int], sums: List[int], pos: int, target: int) -> bool: if pos == len(nums): return True ...
code_fim
hard
{ "lang": "python", "repo": "eric496/leetcode.py", "path": "/backtracking/473.matchsticks_to_square.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eric496/leetcode.py path: /backtracking/473.matchsticks_to_square.py """ Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all those matchsticks. You should not break any stick, b...
code_fim
hard
{ "lang": "python", "repo": "eric496/leetcode.py", "path": "/backtracking/473.matchsticks_to_square.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JackNeus/lampPost path: /app/mod_api/views.py from datetime import datetime from flask import jsonify, make_response, request, render_template from flask_httpauth import HTTPTokenAuth from flask_login import login_required import json from app.mod_user.models import AuthorizationError, User, User...
code_fim
hard
{ "lang": "python", "repo": "JackNeus/lampPost", "path": "/app/mod_api/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if updated_event is None: return gen_error_response(event_dne_text) return gen_data_response(get_raw_event(updated_event)) @mod_api.route("/event/delete/<id>", methods=["DELETE"]) @auth.login_required def delete_event(id): try: event = controller.get_event(id) if event is None: return gen_er...
code_fim
hard
{ "lang": "python", "repo": "JackNeus/lampPost", "path": "/app/mod_api/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make sure creator matches authorized user. try: event = controller.get_event(id) if event is None: return gen_error_response(event_dne_text) user = User.get_user_in_token(request) if user is None: return gen_error_response("Invalid authorization.") if user.netid != event.creator: r...
code_fim
hard
{ "lang": "python", "repo": "JackNeus/lampPost", "path": "/app/mod_api/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: claudiasofiaC/Facial_Recognition_Attendance path: /basics.py import cv2 import numpy as np import face_recognition # Load and encode images imgElon = face_recognition.load_image_file('ImageBasic/Elon Musk.jpg') imgElon = cv2.cvtColor(imgElon, cv2.COLOR_BGR2RGB) imgTest = face_recognition.load_im...
code_fim
hard
{ "lang": "python", "repo": "claudiasofiaC/Facial_Recognition_Attendance", "path": "/basics.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># compare results = face_recognition.compare_faces([encodeElon], encodeTest) faceDis = face_recognition.face_distance([encodeElon], encodeTest) print(results, faceDis) cv2.putText(imgTest, f'{results} {round(faceDis[0], 2)}', (50, 50), cv2.FONT_HERSHEY_DUPLEX, 1, (0, 0, 255), 2) cv2.imshow('Elon Muskrat'...
code_fim
hard
{ "lang": "python", "repo": "claudiasofiaC/Facial_Recognition_Attendance", "path": "/basics.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rcrowther/dancer path: /pdf/modern.py #!/usr/bin/python3 from dancerPDF import DancerPDF class Modern(DancerPDF): def __init__(self): DancerPDF.__init__(self) self.titleFontFamily = "Helvetica-Bold" self.titleFontSize = 32 self.sectionFontFamily = "Helvetica-Bold" self...
code_fim
medium
{ "lang": "python", "repo": "rcrowther/dancer", "path": "/pdf/modern.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.c.setFont(self.creditsFontFamily, self.creditsFontSize) #48 self.c.drawRightString(self.rightStockAbs, self.rawToAbsY(self._titleHeightRaw + self.creditsTopSkip), performers) self._titleHeightRaw += self.creditsTopSkip + self.creditsFontSize #68 self.c.drawRightString(self.rig...
code_fim
medium
{ "lang": "python", "repo": "rcrowther/dancer", "path": "/pdf/modern.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vladimir-efimov/text-classification path: /term_stat_labeled.py # Copyright (c) 2020, Vladimir Efimov # All rights reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys import modules.text_processor_norm...
code_fim
hard
{ "lang": "python", "repo": "vladimir-efimov/text-classification", "path": "/term_stat_labeled.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sorted_items = sorted(term_score.items(), reverse=True, key=lambda key_value: (key_value[1], key_value[0])) topic_list = topics_words.keys() header = ["Term", "Score", "Count", "Document count", "Labeled ratio"] header.extend(topic_list) print("\t".join(header)) for (term, score)...
code_fim
hard
{ "lang": "python", "repo": "vladimir-efimov/text-classification", "path": "/term_stat_labeled.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Elbadri0/mundiapolis-math path: /math/0x00-linear_algebra/7-gettin_cozy.py #!/usr/bin/env python3 """ concatenating of two matrices with specific axis """ <|fim_suffix|> """ enter a matrix and Returns a list of concatenated matrices """ if (len(mat1[0]) == len(mat2[0])) and (...
code_fim
medium
{ "lang": "python", "repo": "Elbadri0/mundiapolis-math", "path": "/math/0x00-linear_algebra/7-gettin_cozy.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ enter a matrix and Returns a list of concatenated matrices """ if (len(mat1[0]) == len(mat2[0])) and (axis == 0): concat = [ele.copy() for ele in mat1] concat += [ele.copy() for ele in mat2] return concat elif (len(mat1) == len(mat2)) and (axis == 1): ...
code_fim
medium
{ "lang": "python", "repo": "Elbadri0/mundiapolis-math", "path": "/math/0x00-linear_algebra/7-gettin_cozy.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarauwu/summerimmersion path: /menu.py import random desserts = ["red velvet cake", "souffle", "ice cream", "macaron", "sundae", "flan", "tarimisu"] desertaa = random.choice(desserts) <|fim_suffix|> #2 months on SL! Thank ya'll! import random first = ("Super", "Retarded", "Great", "Sexy",...
code_fim
medium
{ "lang": "python", "repo": "sarauwu/summerimmersion", "path": "/menu.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#2 months on SL! Thank ya'll! import random first = ("Super", "Retarded", "Great", "Sexy", "Vegan", "Brave", "Shy", "Cool", "Poor", "Rich", "Fast", "Gummy", "Yummy", "Masked", "Unusual", "American", "Bisexual", "MLG", "Mlg", "lil", "Lil") second = ("Coder", "Vegan", "Man", "Hacker", "Horse", "Bear", "G...
code_fim
medium
{ "lang": "python", "repo": "sarauwu/summerimmersion", "path": "/menu.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> n = 10000 exponential_samples = np.random.exponential(1,n) plt.hist(exponential_samples) plt.show() uniform_samples = np.random.uniform(0,1,n) plt.hist(uniform_samples) plt.show() transformed_exponential_samples = quantile_exponential_distribution(lambda_param=1, y=unifor...
code_fim
medium
{ "lang": "python", "repo": "agdenadel/agdenadel.github.io", "path": "/_posts/code/inverse-transform-sampling/inverse-transform-sampling.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ToHanwei/Bioinformatics path: /3-Which_DNA_Ptterns_Serve_as_molecular/task3/ProfileMostProbable.py import sys infile = sys.argv[1] with open(infile) as inputf: lines = inputf.readlines() dna = lines[0].strip() k = int(lines[1].strip()) matrix = [] for line in lines[2:]: values = line.str...
code_fim
medium
{ "lang": "python", "repo": "ToHanwei/Bioinformatics", "path": "/3-Which_DNA_Ptterns_Serve_as_molecular/task3/ProfileMostProbable.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mostPr = float('-inf') mostKmer = '' for i in range(len(dna)-k): kmer = dna[i:i+k] Pr = 1 for jj, w in enumerate(kmer): ii = trans[w] Pr *= matrix[ii][jj] if Pr > mostPr: mostPr = Pr mostKmer = kmer print(mostKmer)<|fim_prefix|># repo: ToHanwei/Bioinformatics path: /3-Which_DNA_Ptterns_Serve...
code_fim
medium
{ "lang": "python", "repo": "ToHanwei/Bioinformatics", "path": "/3-Which_DNA_Ptterns_Serve_as_molecular/task3/ProfileMostProbable.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> transformed_data = pca.transform(X) print transformed_data for ii,jj in zip(transformed_data,X): print (first_pc[0]*ii[0],first_pc[1]*ii[0]) plt.scatter(first_pc[0]*ii[0],first_pc[1]*ii[0],color='r') # 第一主成分上映射的点 (主成分与需要映射的点的点积) plt.scatter(second_pc[0]*ii[1],second_p...
code_fim
hard
{ "lang": "python", "repo": "lj72808up/Mechine_Learning", "path": "/PCA/TestPCA.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lj72808up/Mechine_Learning path: /PCA/TestPCA.py # encoding:utf-8 import matplotlib.pyplot as plt import numpy as np from sklearn.decomposition import PCA def doPCA(data): <|fim_suffix|> transformed_data = pca.transform(X) print transformed_data for ii,jj in zip(transformed_data,X): ...
code_fim
hard
{ "lang": "python", "repo": "lj72808up/Mechine_Learning", "path": "/PCA/TestPCA.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def write_meat(input, output): with open(input, 'r', encoding='utf-8') as f: for line in f: if line[0] == '>': line = '//' + line output.write('\t' + line) def write_opener(file): opener = '"lang"\n{\n\t"Language"\t"English"\n\t"Tokens"\n\t{\n' ...
code_fim
hard
{ "lang": "python", "repo": "operation-waifu-omelette/pathfinders", "path": "/game/dota_addons/pathfinder/scripts/compile_localization.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: operation-waifu-omelette/pathfinders path: /game/dota_addons/pathfinder/scripts/compile_localization.py import glob def doTheThing(lang): path = 'D:\\SteamLibrary\\steamapps\\common\\dota 2 beta\\game\\dota_addons\\pathfinder\\pf_localizations\\' + lang output = open( 'D:\\Ste...
code_fim
hard
{ "lang": "python", "repo": "operation-waifu-omelette/pathfinders", "path": "/game/dota_addons/pathfinder/scripts/compile_localization.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # enable primary network and wpa2 and disable wpa network_page = NetworkPage(self.firefox) network_page.enable(network_page.get_primary_network()) network_page.enable(network_page.get_wpa2()) network_page.disable(network_page.get_wpa()) network_page.apply_c...
code_fim
hard
{ "lang": "python", "repo": "JulioMagnani/autobot-files", "path": "/autobot/autobot/tests/wifi24/test_wpa2_to_wpa.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Preview the resulting DataFrame dumping_df = dumping_df[ ['service_request_id', 'original_lang', 'translated_desc']] dumping_df.head() ######################################################################<|fim_prefix|># repo: patsess/aws-practice path: /awspractice/example_cod...
code_fim
hard
{ "lang": "python", "repo": "patsess/aws-practice", "path": "/awspractice/example_code_translate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ###################################################################### translated_text = translate.translate_text( Text='Hello, how are you?', SourceLanguageCode='auto', # note: should conclude English ('en') TargetLanguageCode='es')['TranslatedText'] ################...
code_fim
hard
{ "lang": "python", "repo": "patsess/aws-practice", "path": "/awspractice/example_code_translate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: patsess/aws-practice path: /awspractice/example_code_translate.py import boto3 """ Note: code is for reference only (taken from an online course) """ if __name__ == '__main__': # Generate the boto3 client for interacting with translate (for # translation of text into another language)...
code_fim
hard
{ "lang": "python", "repo": "patsess/aws-practice", "path": "/awspractice/example_code_translate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', level=logging.DEBUG) main()<|fim_prefix|># repo: FredWe/touch_project path: /data/open_image_by_uttid.py import io_helper import logging import sys import subprocess import os <|fim_middle|>IMAGEDIR = ...
code_fim
hard
{ "lang": "python", "repo": "FredWe/touch_project", "path": "/data/open_image_by_uttid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FredWe/touch_project path: /data/open_image_by_uttid.py import io_helper import logging import sys import subprocess import os <|fim_suffix|>if __name__ == '__main__': logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', level=logging.DEBUG) main()<|fim_middle|>IMAGEDIR = ...
code_fim
hard
{ "lang": "python", "repo": "FredWe/touch_project", "path": "/data/open_image_by_uttid.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> utt2recpath = io_helper.parse_dictfile(SCPPATH) recpath = utt2recpath[UTTID] imagename = io_helper.path2uttid(recpath) imagepath = os.path.join(IMAGEDIR, '%s.png' % imagename) subprocess.run('eog %s' % imagepath, shell=True) if __name__ == '__main__': logging.basicConfig(format='[...
code_fim
medium
{ "lang": "python", "repo": "FredWe/touch_project", "path": "/data/open_image_by_uttid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeeVeeVee/SnackBar path: /python_parts/database_setup/database.py import sqlite3 conn = sqlite3.connect("SnackBar.db") def initiate_leiding_table(conn): cursor = conn.cursor() cursor.execute("""CREATE TABLE leiding ( first text, last text, schuld fl...
code_fim
hard
{ "lang": "python", "repo": "JeeVeeVee/SnackBar", "path": "/python_parts/database_setup/database.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cursor = connection.cursor() statement = "INSERT INTO leiding VALUES ('{}', '{}', {})".format(leider[0], leider[1], leider[2]) cursor.execute(statement) connection.commit() def fill_leiding_table(): file = open("src/python_parts/database_setup/leiding.csv", "r") for line in file: ...
code_fim
hard
{ "lang": "python", "repo": "JeeVeeVee/SnackBar", "path": "/python_parts/database_setup/database.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ckt22/coach-ai path: /backend/main.py from flask import Flask, request, jsonify import tensorflow as tf app = Flask(__name__) available_fps = [3, 4, 5] models = {fps: tf.keras.models.load_model(f'model/fps_{fps}') for fps in available_fps} class_labels = ['push-up-arms-not-bent-enough', 'push-u...
code_fim
hard
{ "lang": "python", "repo": "ckt22/coach-ai", "path": "/backend/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return 'Exercise classifier running' @app.route('/classify', methods=['POST']) def classify(): data = request.json timeseries = tf.convert_to_tensor(data['timeseries']) fps = data['fps'] model = models[fps] probabilities = model.predict(timeseries) print(probabilities) ind...
code_fim
medium
{ "lang": "python", "repo": "ckt22/coach-ai", "path": "/backend/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': # This is used when running locally only. app.run(host='0.0.0.0', port=8080, debug=True)<|fim_prefix|># repo: ckt22/coach-ai path: /backend/main.py from flask import Flask, request, jsonify import tensorflow as tf app = Flask(__name__) available_fps = [3, 4, 5] models...
code_fim
hard
{ "lang": "python", "repo": "ckt22/coach-ai", "path": "/backend/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }