text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: mashagua/DeepLearningNotes path: /Note-6 A3CNet/Note-6.2 A3C与HS300指数择时/util.py
import tensorflow as tf
from sonnet.python.modules.basic import Linear as sntLinear
from sonnet.python.modules.conv import Conv2D as sntConv2D
def swich(input):
return input * tf.nn.sigmoid(input)
<|fim_suffix|>... | code_fim | hard | {
"lang": "python",
"repo": "mashagua/DeepLearningNotes",
"path": "/Note-6 A3CNet/Note-6.2 A3C与HS300指数择时/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> initializers = {"w": tf.truncated_normal_initializer(stddev=0.1),
"b": tf.constant_initializer(value=0.1)}
regularizers = {"w": tf.contrib.layers.l2_regularizer(scale=0.1),
"b": tf.contrib.layers.l2_regularizer(scale=0.1)}
return sntConv2D(output_channel... | code_fim | hard | {
"lang": "python",
"repo": "mashagua/DeepLearningNotes",
"path": "/Note-6 A3CNet/Note-6.2 A3C与HS300指数择时/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_dict(cmd, cwd=None):
"""
Execute the powershell command and return the data as a dictionary
Args:
cmd (str): The powershell command to run
cwd (str): The current working directory
Returns:
dict: A dictionary containing the output of the powershell comma... | code_fim | medium | {
"lang": "python",
"repo": "saltstack/salt",
"path": "/salt/utils/win_pwsh.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saltstack/salt path: /salt/utils/win_pwsh.py
import salt.modules.cmdmod
import salt.utils.json
import salt.utils.platform
from salt.exceptions import CommandExecutionError
__virtualname__ = "win_pwsh"
def __virtual__():
"""
Only load if windows
"""
if not salt.utils.platform.is... | code_fim | hard | {
"lang": "python",
"repo": "saltstack/salt",
"path": "/salt/utils/win_pwsh.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
ret = salt.utils.json.loads(ret["stdout"], strict=False)
except ValueError:
raise CommandExecutionError("No JSON results from PowerShell", info=ret)
return ret<|fim_prefix|># repo: saltstack/salt path: /salt/utils/win_pwsh.py
import salt.modules.cmdmod
import salt.utils.... | code_fim | hard | {
"lang": "python",
"repo": "saltstack/salt",
"path": "/salt/utils/win_pwsh.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>parameters["analyses_parameters"]["runs"].append(dict({"type" : "dynamic_analysis",
"settings": {
"solver_type": "Linear",
"run_in_modal_coordinates": False,
"time":{
"integration_scheme": "GenAlpha",
... | code_fim | hard | {
"lang": "python",
"repo": "mpentek/ParOptBeam",
"path": "/run_generic_models_from_python.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mpentek/ParOptBeam path: /run_generic_models_from_python.py
from os.path import join as os_join
import json
from source.model.structure_model import StraightBeam
from source.analysis.analysis_controller import AnalysisController
# inputs
parameters = {}
parameters["model_parameters"] ... | code_fim | hard | {
"lang": "python",
"repo": "mpentek/ParOptBeam",
"path": "/run_generic_models_from_python.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stemid/passwordfrank path: /api.py
from datetime import datetime, timedelta
from uuid import uuid4
import json
import web
import settings, model
from settings import generate_password, base36encode, base36decode
# Helper function for formatting datetime objects to json
def dateHandler(obj):
... | code_fim | hard | {
"lang": "python",
"repo": "stemid/passwordfrank",
"path": "/api.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Receive the passphrase through query params
query = web.input(
password = None,
maxdays = 10,
maxviews = 10
)
# Change output to JSON
web.header('Content-type', 'application/json')
# Generate unique code for phrase
... | code_fim | hard | {
"lang": "python",
"repo": "stemid/passwordfrank",
"path": "/api.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esr2587758/mmdeeplearning path: /src/mpandas/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/22 10:41
# @Author : ganliang
# @File : __init__.py.py
# @Desc : pandas测试
import numpy as np
import pandas as pd
<|fim_suffix|>
def pd_serise():
series = pd.Serie... | code_fim | medium | {
"lang": "python",
"repo": "esr2587758/mmdeeplearning",
"path": "/src/mpandas/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def pd_dataframe():
pd_frame = pd.DataFrame(np.random.rand(6, 4), index=["R1", "R2", "R3", "R4", "R5", "R6"],
columns=["A", "B", "C", "D"])
logger.info("pd_frame:\n{0}".format(pd_frame))
logger.info("pd_frame.head(1):\n{0}".format(pd_frame.head(1)))
logger.info... | code_fim | hard | {
"lang": "python",
"repo": "esr2587758/mmdeeplearning",
"path": "/src/mpandas/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pd_frame = pd.DataFrame(np.random.rand(6, 4), index=["R1", "R2", "R3", "R4", "R5", "R6"],
columns=["A", "B", "C", "D"])
logger.info("pd_frame:\n{0}".format(pd_frame))
logger.info("pd_frame.head(1):\n{0}".format(pd_frame.head(1)))
logger.info("pd_frame.tail(1):\n... | code_fim | hard | {
"lang": "python",
"repo": "esr2587758/mmdeeplearning",
"path": "/src/mpandas/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: milkmeat/thomas path: /project euler/q41_2.py
import math
# [False,False,True,True,False,...]
def countallnumber(max):
prime=[True]*(max+1)
prime[0]=False
prime[1]=False
for x in range(2,int(math.sqrt(max))+1):
if prime[x]==False:
continue
mu... | code_fim | hard | {
"lang": "python",
"repo": "milkmeat/thomas",
"path": "/project euler/q41_2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>upper=987654321
isprime=countAllPrimes(upper)
#if isprime[3]:
# print 'ok'
#print isprime(1001)
# print primes
v=0
for x in range(upper,1,-1):
print x
if isprime[x]:
if pandigital(x):
print x
break
'''<|fim_prefix|># repo: milkmeat/thomas... | code_fim | hard | {
"lang": "python",
"repo": "milkmeat/thomas",
"path": "/project euler/q41_2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __import_export_resource_enum(export_dict: dict):
text = 'from enum import Enum\n\n\n'
text = text + 'class CommonResource(object):\n\n'
text = text + ' class OutputName(Enum):\n'
for key, _ in export_dict.items():
text = text + " {} = '{}'\n".format(camel_to_snake(... | code_fim | hard | {
"lang": "python",
"repo": "suzuxander/samples",
"path": "/python/python-000/template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suzuxander/samples path: /python/python-000/template.py
from troposphere import Template, GetAtt
from troposphere.cloudformation import Stack
from sample000.bucket import create_bucket_template
from sample000.common import camel_to_snake
from sample000.role import create_service_role
from sample... | code_fim | hard | {
"lang": "python",
"repo": "suzuxander/samples",
"path": "/python/python-000/template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open('./' + template_path, mode='w') as file:
file.write(template.to_yaml())
def __import_export_resource_enum(export_dict: dict):
text = 'from enum import Enum\n\n\n'
text = text + 'class CommonResource(object):\n\n'
text = text + ' class OutputName(Enum):\n'
for ke... | code_fim | hard | {
"lang": "python",
"repo": "suzuxander/samples",
"path": "/python/python-000/template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XRyu/hass_shutterbox path: /cover.py
import json
import logging
from enum import Enum
import async_timeout
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.components.cover ... | code_fim | hard | {
"lang": "python",
"repo": "XRyu/hass_shutterbox",
"path": "/cover.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def async_set_cover_tilt_position(self, **kwargs):
position = self._invert_position(kwargs['tilt_position'])
await self._send_shutter_command("t", position)
def _get_supported_features(self):
supported_features = super()._get_supported_features()
supported_fe... | code_fim | hard | {
"lang": "python",
"repo": "XRyu/hass_shutterbox",
"path": "/cover.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 13301338176/ml-from-scratch path: /utils/activations.py
import numpy as np
def softmax(x):
'''
http://cs231n.github.io/linear-classify/#softmax
https://stackoverflow.com/questions/34968722/how-to-implement-the-softmax-function-in-python
f = np.array([123, 456, 789]) # example wi... | code_fim | hard | {
"lang": "python",
"repo": "13301338176/ml-from-scratch",
"path": "/utils/activations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # instead: first shift the values of f so that the highest number is 0:
f -= np.max(f) # f becomes [-666, -333, 0]
p = np.exp(f) / np.sum(np.exp(f)) # safe to do, gives the correct answer
'''
e = np.exp(x - np.amax(x, axis=1, keepdims=True))
return e / np.sum(e, axis=1, keepdims=T... | code_fim | medium | {
"lang": "python",
"repo": "13301338176/ml-from-scratch",
"path": "/utils/activations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
e = np.exp(x - np.amax(x, axis=1, keepdims=True))
return e / np.sum(e, axis=1, keepdims=True)<|fim_prefix|># repo: 13301338176/ml-from-scratch path: /utils/activations.py
import numpy as np
def softmax(x):
'''
http://cs231n.github.io/linear-classify/#softmax
https://stackover... | code_fim | hard | {
"lang": "python",
"repo": "13301338176/ml-from-scratch",
"path": "/utils/activations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minikie/mxfbook path: /server/app.py
from flask import Flask, request, jsonify
import json
import numpy
app = Flask(__name__)
<|fim_suffix|>
if __name__ == '__main__':
app.run()<|fim_middle|>@app.route("/")
def index():
return 'hello world!'
@app.route("/getmhdata", methods=['POST'])
d... | code_fim | hard | {
"lang": "python",
"repo": "minikie/mxfbook",
"path": "/server/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/getmhdata", methods=['POST'])
def get_data():
str = '''1|2|3|4|5
6|7|8|9|10'''
return str
#return json.dumps({'test': [1,2,3]})
if __name__ == '__main__':
app.run()<|fim_prefix|># repo: minikie/mxfbook path: /server/app.py
from flask import Flask, request, jsoni... | code_fim | easy | {
"lang": "python",
"repo": "minikie/mxfbook",
"path": "/server/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/")
def index():
return 'hello world!'
@app.route("/getmhdata", methods=['POST'])
def get_data():
str = '''1|2|3|4|5
6|7|8|9|10'''
return str
#return json.dumps({'test': [1,2,3]})
if __name__ == '__main__':
app.run()<|fim_prefix|># repo: minikie/mxfbook path... | code_fim | easy | {
"lang": "python",
"repo": "minikie/mxfbook",
"path": "/server/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>HASH_BUCKET_SIZES = {
"document_id": 300000,
"ad_id": 250000,
"document_id_promo": 100000,
"source_id_promo": 4000,
"source_id": 4000,
"geo_location": 2500,
"advertiser_id": 2500,
"geo_location_state": 2000,
"publisher_id_promo": 1000,
"publisher_id": 1000,
"geo... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/DeepLearningExamples",
"path": "/TensorFlow2/Recommendation/WideAndDeep/data/outbrain/features.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NVIDIA/DeepLearningExamples path: /TensorFlow2/Recommendation/WideAndDeep/data/outbrain/features.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/DeepLearningExamples",
"path": "/TensorFlow2/Recommendation/WideAndDeep/data/outbrain/features.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set the fqdn
fqdn = device.facts["hostname"]
if fqdn is not None and domain is not None:
fqdn = fqdn + "." + domain
return {
"domain": domain,
"fqdn": fqdn,
}<|fim_prefix|># repo: Juniper/py-junos-eznc path: /lib/jnpr/junos/facts/domain.py
from lxml import e... | code_fim | hard | {
"lang": "python",
"repo": "Juniper/py-junos-eznc",
"path": "/lib/jnpr/junos/facts/domain.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Juniper/py-junos-eznc path: /lib/jnpr/junos/facts/domain.py
from lxml import etree
from jnpr.junos.exception import PermissionError
from jnpr.junos.utils.fs import FS
def provides_facts():
"""
Returns a dictionary keyed on the facts provided by this module. The value
of each key is ... | code_fim | hard | {
"lang": "python",
"repo": "Juniper/py-junos-eznc",
"path": "/lib/jnpr/junos/facts/domain.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Validate configurations."""
from .validate import get_configuration_errors, iterate_config_paths
has_error = False
for _directory_name, _config_name, path in iterate_config_paths():
path = path.resolve()
errors = get_configuration_errors(path=path)
if errors:
... | code_fim | hard | {
"lang": "python",
"repo": "pykeen/pykeen",
"path": "/src/pykeen/experiments/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pykeen/pykeen path: /src/pykeen/experiments/cli.py
# -*- coding: utf-8 -*-
"""Run landmark experiments."""
import logging
import os
import pathlib
import shutil
import sys
import time
from typing import Iterable, Optional, Union
from uuid import uuid4
import click
import tabulate
from more_cli... | code_fim | hard | {
"lang": "python",
"repo": "pykeen/pykeen",
"path": "/src/pykeen/experiments/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _run_ablation_experiments(
directories=directories,
best_replicates=best_replicates,
dry_run=dry_run,
move_to_cpu=move_to_cpu,
discard_replicates=discard_replicates,
)
@experiments.command()
def validate():
"""Validate configurations."""
from .vali... | code_fim | hard | {
"lang": "python",
"repo": "pykeen/pykeen",
"path": "/src/pykeen/experiments/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sli1989/book-python path: /date-and-time/src/datetime-current-local.py
from datetime import datetime
<|fim_suffix|>now.year # 2018
now.month # 12
now.day # 6
now.hour # 15
now.minute # 43
now.second # 46
now.microsecond # 547414<|fim_middle|>
n... | code_fim | medium | {
"lang": "python",
"repo": "sli1989/book-python",
"path": "/date-and-time/src/datetime-current-local.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>now.year # 2018
now.month # 12
now.day # 6
now.hour # 15
now.minute # 43
now.second # 46
now.microsecond # 547414<|fim_prefix|># repo: sli1989/book-python path: /date-and-time/src/datetime-current-local.py
from datetime import datetime
<|fim_middle|>n... | code_fim | medium | {
"lang": "python",
"repo": "sli1989/book-python",
"path": "/date-and-time/src/datetime-current-local.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ArchanGhosh/Indic-Translator path: /ENG-BENGALI/prediction.py
import tensorflow as tf
from preprocessing import *
from Encoder import *
from Decoder import *
def evaluate(sentence):
attention_plot = np.zeros((max_length_targ, max_length_inp))
sentence = preprocess_sentence(sen... | code_fim | hard | {
"lang": "python",
"repo": "ArchanGhosh/Indic-Translator",
"path": "/ENG-BENGALI/prediction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from google.colab import files
uploaded = files.upload()
# img_path='/content/won.png'
for n in uploaded.keys():
img_path = '/content/{}'.format(n)
im = Image.open(img_path)
display(im)
info = pytesseract.image_to_string(Image.open(img_path))
print("\n\n")
... | code_fim | hard | {
"lang": "python",
"repo": "ArchanGhosh/Indic-Translator",
"path": "/ENG-BENGALI/prediction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AustinTSchaffer/DailyProgrammer path: /AdventOfCode/2021/day_04/sln.py
#%%
import common
import dataclasses
from typing import List
class BingoBoard:
def __init__(self, data: str):
self.data = [
[
value.strip()
for value in row.split()
... | code_fim | hard | {
"lang": "python",
"repo": "AustinTSchaffer/DailyProgrammer",
"path": "/AdventOfCode/2021/day_04/sln.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sum(
int(value)
for row_index, row in enumerate(self.data)
for col_index, value in enumerate(row)
if not self.marks[row_index][col_index]
)
bingo_numbers = common.get_input(__file__, filename='bingo_numbers.txt')[0].strip().split(',')... | code_fim | hard | {
"lang": "python",
"repo": "AustinTSchaffer/DailyProgrammer",
"path": "/AdventOfCode/2021/day_04/sln.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bingo_boards_current = bingo_boards
bingo_boards_next = list(bingo_boards)
for number in bingo_numbers:
for bingo_board in bingo_boards_current:
bingo_board.mark_number(number)
if bingo_board.is_complete():
if len(bingo_boards_current) == 1:
... | code_fim | hard | {
"lang": "python",
"repo": "AustinTSchaffer/DailyProgrammer",
"path": "/AdventOfCode/2021/day_04/sln.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path(
'add_list/',
views.add_list,
name="add_list"),
path(
'task/<int:task_id>/',
views.task_detail,
name='task_detail'),
]
if HAS_TASK_MERGE:
# ensure autocomplete is optional
from todo.views.task_autocomplete import TaskAutocomplete
u... | code_fim | hard | {
"lang": "python",
"repo": "sweetlearn/django-todo",
"path": "/todo/urls.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns.extend([
path(
'toggle_done/<int:task_id>/',
views.toggle_done,
name='task_toggle_done'),
path(
'delete/<int:task_id>/',
views.delete_task,
name='delete_task'),
path(
'search/',
views.search,
name="search"),
... | code_fim | hard | {
"lang": "python",
"repo": "sweetlearn/django-todo",
"path": "/todo/urls.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sweetlearn/django-todo path: /todo/urls.py
from django.urls import path
from todo import views
from todo.features import HAS_TASK_MERGE
app_name = 'todo'
from django.conf import settings
urlpatterns = [
path(
'',
views.list_lists,
name="lists"),
# View reorder_... | code_fim | hard | {
"lang": "python",
"repo": "sweetlearn/django-todo",
"path": "/todo/urls.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Adriana618-Love/IHC_Proyecto path: /OPENPOSE/Rejected/main.py
import argparse
import cv2
import numpy as np
import torch
from models.with_mobilenet import PoseEstimationWithMobileNet
from modules.keypoints import extract_keypoints, group_keypoints
from modules.load_state import load_state
from ... | code_fim | hard | {
"lang": "python",
"repo": "Adriana618-Love/IHC_Proyecto",
"path": "/OPENPOSE/Rejected/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> scaled_img = cv2.resize(img, (0, 0), fx=scale, fy=scale, interpolation=cv2.INTER_CUBIC)
scaled_img = normalize(scaled_img, img_mean, img_scale)
min_dims = [net_input_height_size, max(scaled_img.shape[1], net_input_height_size)]
padded_img, pad = pad_width(scaled_img, stride, pad_value, min... | code_fim | hard | {
"lang": "python",
"repo": "Adriana618-Love/IHC_Proyecto",
"path": "/OPENPOSE/Rejected/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> stage2_pafs = stages_output[-1]
pafs = np.transpose(stage2_pafs.squeeze().cpu().data.numpy(), (1, 2, 0))
pafs = cv2.resize(pafs, (0, 0), fx=upsample_ratio, fy=upsample_ratio, interpolation=cv2.INTER_CUBIC)
return heatmaps, pafs, scale, pad
def run_detector(net, img, height_size, cpu, tr... | code_fim | hard | {
"lang": "python",
"repo": "Adriana618-Love/IHC_Proyecto",
"path": "/OPENPOSE/Rejected/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cerebex/Penrose-Steps-Turtle-Animation path: /Turtle_Penrose_Steps_Drawing.py
import turtle
# initiate turtle instance
penrose_steps = turtle.Turtle()
# draw it all
penrose_steps.screen.bgcolor("black")
penrose_steps.penup()
penrose_steps.pen(shown=False)
penrose_steps.screen.setup(width=.7, he... | code_fim | hard | {
"lang": "python",
"repo": "Cerebex/Penrose-Steps-Turtle-Animation",
"path": "/Turtle_Penrose_Steps_Drawing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>penrose_steps.penup()
penrose_steps.setposition(step_11_bottom_front_left_position)
penrose_steps.pendown()
penrose_steps.seth(205)
penrose_steps.forward(61)
step_11_top_front_right_position = penrose_steps.position()
penrose_steps.begin_fill()
penrose_steps.seth(270)
penrose_steps.forward(17)
step_11_bot... | code_fim | hard | {
"lang": "python",
"repo": "Cerebex/Penrose-Steps-Turtle-Animation",
"path": "/Turtle_Penrose_Steps_Drawing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TtsTestViewSet(viewsets.ReadOnlyModelViewSet):
queryset = TtsTest.objects.all()
serializer_class = TtsTestSerializer
permission_classes = [IsVerified]<|fim_prefix|># repo: michaldomino/Voice-interface-optimization-server path: /apps/tts_tests/views/tts_test_view_set.py
from rest_framew... | code_fim | medium | {
"lang": "python",
"repo": "michaldomino/Voice-interface-optimization-server",
"path": "/apps/tts_tests/views/tts_test_view_set.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = TtsTest.objects.all()
serializer_class = TtsTestSerializer
permission_classes = [IsVerified]<|fim_prefix|># repo: michaldomino/Voice-interface-optimization-server path: /apps/tts_tests/views/tts_test_view_set.py
from rest_framework import viewsets
<|fim_middle|>from apps.tts_tests... | code_fim | medium | {
"lang": "python",
"repo": "michaldomino/Voice-interface-optimization-server",
"path": "/apps/tts_tests/views/tts_test_view_set.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaldomino/Voice-interface-optimization-server path: /apps/tts_tests/views/tts_test_view_set.py
from rest_framework import viewsets
from apps.tts_tests.models import TtsTest
from apps.tts_tests.serializers import TtsTestSerializer
from apps.users.permissions import IsVerified
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "michaldomino/Voice-interface-optimization-server",
"path": "/apps/tts_tests/views/tts_test_view_set.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rnaimehaom/VAE path: /vae_keras.py
#! -*- coding: utf-8 -*-
'''
VAE implemented by using keras (TensorFlow as backend)
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from keras.layers import Input, Dense, Lambda
from keras.models import Model
from keras i... | code_fim | hard | {
"lang": "python",
"repo": "rnaimehaom/VAE",
"path": "/vae_keras.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># reparameter layer, equals to add noise to input data
z = Lambda(sampling, output_shape=(latent_dim,))([z_mean, z_log_var]) # (?, 2)
# decoder
decoder_h = Dense(intermediate_dim, activation='relu')
decoder_mean = Dense(original_dim, activation='sigmoid')
h_decoded = decoder_h(z)
x_decoded_mean = decoder... | code_fim | hard | {
"lang": "python",
"repo": "rnaimehaom/VAE",
"path": "/vae_keras.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> z_mean, z_log_var = args
epsilon = K.random_normal(shape=(K.shape(z_mean)[0], latent_dim), mean=0.,
stddev=epsilon_std) # (?, 2)
print('epsilon_shape is {}, {}'.format(epsilon.shape, epsilon))
return z_mean + K.exp(z_log_var / 2) * epsilon
# reparameter laye... | code_fim | hard | {
"lang": "python",
"repo": "rnaimehaom/VAE",
"path": "/vae_keras.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: historygraphio/historygraph path: /historygraph/fields/textedit.py
th = len(new_split_frag.text)
fragment.has_been_split = True
fragment.text = fragment.text[:start - fragment_start_pos]
fragment.length = len(fragment.text)
... | code_fim | hard | {
"lang": "python",
"repo": "historygraphio/historygraph",
"path": "/historygraph/fields/textedit.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Two lists are the same if they have the same set of ListNodes and Tombstones
ret = List.FieldListImpl(self.theclass, owner, name)
ret._listfragments = [f.clone() for f in self._listfragments]
return ret
def clean(self):
self._listfragm... | code_fim | hard | {
"lang": "python",
"repo": "historygraphio/historygraph",
"path": "/historygraph/fields/textedit.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif index == fragment_start_pos + len(fragment.text) and \
fragment.sessionid != sessionid:
# We are inserting at the end of another sessions's fragment so create a new fragment and insert it
inserted_fragment_id = str(uuid.uuid4())
... | code_fim | hard | {
"lang": "python",
"repo": "historygraphio/historygraph",
"path": "/historygraph/fields/textedit.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anapaulagomes/looong path: /looong/method.py
class Method(object):
def __init__(self, name, filename, parameters):
self._name = name
self._filename = filename
self._parameters = parameters
<|fim_suffix|> @property
def name(self):
return self._name
... | code_fim | medium | {
"lang": "python",
"repo": "anapaulagomes/looong",
"path": "/looong/method.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def filename(self):
return self._filename
@property
def parameters_list(self):
return self._parameters<|fim_prefix|># repo: anapaulagomes/looong path: /looong/method.py
class Method(object):
def __init__(self, name, filename, parameters):
self._name... | code_fim | medium | {
"lang": "python",
"repo": "anapaulagomes/looong",
"path": "/looong/method.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._name
@property
def filename(self):
return self._filename
@property
def parameters_list(self):
return self._parameters<|fim_prefix|># repo: anapaulagomes/looong path: /looong/method.py
class Method(object):
def __init__(self, name, filename, para... | code_fim | easy | {
"lang": "python",
"repo": "anapaulagomes/looong",
"path": "/looong/method.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add images
for image in images:
res = cloudinary.uploader.upload(image,
folder="yelpCamp",
allowed_formats=['jpeg', 'jpg', 'png'])
campground.images.append(CampgroundImage(url=res['url'], public_id=... | code_fim | hard | {
"lang": "python",
"repo": "mkmenta/yelp-camp-python",
"path": "/routes/campgrounds.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@blueprint.route('/<campground_id>', methods=['GET'])
def show_campground(campground_id):
try:
campground = Campground.objects.get(id=ObjectId(campground_id))
except:
flash('Cannot find that campground!', 'error')
return redirect('/campgrounds')
return render_template('... | code_fim | hard | {
"lang": "python",
"repo": "mkmenta/yelp-camp-python",
"path": "/routes/campgrounds.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkmenta/yelp-camp-python path: /routes/campgrounds.py
import functools
import cloudinary
import cloudinary.uploader
import cloudinary.api
from bson import ObjectId
from flask import Blueprint, render_template, request, redirect, flash
from flask_login import login_required, current_user
from mo... | code_fim | hard | {
"lang": "python",
"repo": "mkmenta/yelp-camp-python",
"path": "/routes/campgrounds.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(ime_datoteke, encoding='UTF-8') as datoteka:
slovar_iz_json = json.load(datoteka)
return cls.nalozi_iz_jsona(slovar_iz_json)
class Album:
def __init__(self, naslov, izvajalec, datum, leto_izdaje, zvrst, ocena, opis, dnevnik, st_vnosov):
self.naslo... | code_fim | hard | {
"lang": "python",
"repo": "tajapezdir/Glasbeni-dnevnik",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tajapezdir/Glasbeni-dnevnik path: /model.py
import json
seznam_zvrsti = []
with open('glasbene-zvrsti.txt', encoding='UTF-8') as datoteka:
for zvrst in datoteka:
seznam_zvrsti.append(zvrst.strip())
seznam_ocen = list(range(1, 11))
class Uporabnik:
def __init__(self, uporabnisko... | code_fim | hard | {
"lang": "python",
"repo": "tajapezdir/Glasbeni-dnevnik",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdywcd/RedTorch-Python-Client path: /xyz/redtorch/client/python/strategys/StrategyDemo.py
# encoding: UTF-8
from xyz.redtorch.client.python.base.StrategyTemplate import StrategyTemplate
from xyz.redtorch.client.python.base.Config import *
from xyz.redtorch.client.python.base.RtObject import *
fr... | code_fim | hard | {
"lang": "python",
"repo": "sdywcd/RedTorch-Python-Client",
"path": "/xyz/redtorch/client/python/strategys/StrategyDemo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def onEventTick(self, tick):
log.info("TICK")
if tick['rtTickID'] in self.tickIDSet:
log.info(tick)
self.count += 1
print self.count
if self.count % 20 == 0:
orderReq = OrderReq()
orderReq.rtAccountID = '0... | code_fim | hard | {
"lang": "python",
"repo": "sdywcd/RedTorch-Python-Client",
"path": "/xyz/redtorch/client/python/strategys/StrategyDemo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log.info("TRADE")
log.info(trade)
# if 'originalOrderID' in order and trade['originalOrderID'] in self.originalOrderIDSet:
# log.info(trade)
def main():
sd = StrategyDemo()
# 订阅合约
subscribeReq = SubscribeReq()
subscribeReq.gatewayID = '614313ef70b442e9... | code_fim | hard | {
"lang": "python",
"repo": "sdywcd/RedTorch-Python-Client",
"path": "/xyz/redtorch/client/python/strategys/StrategyDemo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> get_short_path_name = ctypes.windll.kernel32.GetShortPathNameW
size = max(len(home_dir) + 1, 256)
buf = ctypes.create_unicode_buffer(size)
try:
# noinspection PyUnresolvedReferences
u = unicode
except NameError:
... | code_fim | hard | {
"lang": "python",
"repo": "heni/virtualenv-make-relocatable",
"path": "/virtualenv_relocator/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
home_dir = os.path.abspath(home_dir)
lib_dir, inc_dir, bin_dir = None, None, None
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.pyth... | code_fim | medium | {
"lang": "python",
"repo": "heni/virtualenv-make-relocatable",
"path": "/virtualenv_relocator/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heni/virtualenv-make-relocatable path: /virtualenv_relocator/utils.py
import os
import sys
from .common import PY_VERSION, IS_PYPY, IS_WIN, ABI_FLAGS
from .logger import LoggerInstance as _LoggerInstance
def mkdir(at_path):
if not os.path.exists(at_path):
_LoggerInstance.info("Crea... | code_fim | hard | {
"lang": "python",
"repo": "heni/virtualenv-make-relocatable",
"path": "/virtualenv_relocator/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn = key.replace('/', '_').replace(' ', '_')
print('writing file %s' % fn, file=sys.stderr)
with open(fn, 'w') as f:
f.write(doc['text'])<|fim_prefix|># repo: koute/massif path: /backend/util/get_random_docs.py
import os
import sys
import argparse
import json
import ha... | code_fim | hard | {
"lang": "python",
"repo": "koute/massif",
"path": "/backend/util/get_random_docs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('writing file %s' % fn, file=sys.stderr)
with open(fn, 'w') as f:
f.write(doc['text'])<|fim_prefix|># repo: koute/massif path: /backend/util/get_random_docs.py
import os
import sys
import argparse
import json
import hashlib
import random
import srt
import boto3
if __na... | code_fim | hard | {
"lang": "python",
"repo": "koute/massif",
"path": "/backend/util/get_random_docs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: koute/massif path: /backend/util/get_random_docs.py
import os
import sys
import argparse
import json
import hashlib
import random
import srt
import boto3
if __name__ == '__main__':
random.seed('massif')
parser = argparse.ArgumentParser()
parser.add_argument('--count', type=int, def... | code_fim | hard | {
"lang": "python",
"repo": "koute/massif",
"path": "/backend/util/get_random_docs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DarioSucic/TDT4265-StarterCode path: /SSD/ssd/modeling/backbone/basic.py
import torch
import torch.nn as nn
import torchvision.models as models
class BasicModel(nn.Module):
def __init__(self, cfg):
super().__init__()
output_channels = cfg.MODEL.BACKBONE.OUT_CHANNE... | code_fim | hard | {
"lang": "python",
"repo": "DarioSucic/TDT4265-StarterCode",
"path": "/SSD/ssd/modeling/backbone/basic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._init_weights()
def _build_additional_features(self, input_size):
self.additional_blocks = []
for i, (input_size, output_size, channels) in enumerate(zip(input_size[:-1], input_size[1:], [1024, 1024, 512, 512, 512])):
self.additional_blocks.append(nn.Sequentia... | code_fim | hard | {
"lang": "python",
"repo": "DarioSucic/TDT4265-StarterCode",
"path": "/SSD/ssd/modeling/backbone/basic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def package_info(self):
libfile = "libsbml"
if not self.settings.os == "Windows":
if self.options.shared:
if self.settings.os == "Linux":
libfile += ".so"
if self.settings.os == "Macos":
libfile += ".... | code_fim | hard | {
"lang": "python",
"repo": "fbergmann/conan-libsbml",
"path": "/conanfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fbergmann/conan-libsbml path: /conanfile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, tools, CMake
class LibSBMLConan(ConanFile):
name = "libsbml"
version = "5.18.3"
url = "http://github.com/fbergmann/conan-libsbml"
homepage = "https://sbml.org... | code_fim | hard | {
"lang": "python",
"repo": "fbergmann/conan-libsbml",
"path": "/conanfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # We already tested the parts of this separately, just check that we
# get a dictionary out.
data = self.arch.get_raw("XPP:USR:MMS:01", dt.datetime(2016, 11, 10), dt.datetime(2016, 11, 11))
self.assertIsInstance(data, dict, "get_raw returns type {0} instead of dict".format(... | code_fim | hard | {
"lang": "python",
"repo": "ZryletTC/archapp",
"path": "/test/test_data.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZryletTC/archapp path: /test/test_data.py
import unittest
import datetime as dt
import re
import xarray as xr
from archapp.appliance import data
from archapp.util.dates import utc_delta
class ArchiveDataFuncTestCase(unittest.TestCase):
def test_date_spec(self):
regex = re.compile("[0... | code_fim | hard | {
"lang": "python",
"repo": "ZryletTC/archapp",
"path": "/test/test_data.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: safooray/DreamChallenge path: /evaluation.py
def c_index(risk, T, C):
"""Calculate concordance index to evaluate model prediction.
C-index calulates the fraction of all pairs of subjects whose predicted
survival times are correctly ordered among all subjects that can actually
be ... | code_fim | hard | {
"lang": "python",
"repo": "safooray/DreamChallenge",
"path": "/evaluation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
-------
A value between 0 and 1 indicating concordance index.
"""
n_orderable = 0.0
score = 0.0
for i in range(len(T)):
for j in range(i+1, len(T)):
if(C[i] == 0 and C[j] == 0):
n_orderable = n_orderable + 1
if(T[i] > ... | code_fim | hard | {
"lang": "python",
"repo": "safooray/DreamChallenge",
"path": "/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drecali/pymodi path: /modi/task/conn_task.py
import os
import serial.tools.list_ports as stl
from serial.tools.list_ports_common import ListPortInfo
from abc import ABC
from abc import abstractmethod
from typing import List
class ConnTask(ABC):
def __init__(self, recv_q, send_q):
... | code_fim | hard | {
"lang": "python",
"repo": "drecali/pymodi",
"path": "/modi/task/conn_task.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns whether network module is connected
:return: true if connected
:rtype: bool
"""
return bool(ConnTask._list_modi_ports())
#
# Abstract Methods
#
@abstractmethod
def _close_conn(self):
pass
@abstractmethod
def _recv_da... | code_fim | medium | {
"lang": "python",
"repo": "drecali/pymodi",
"path": "/modi/task/conn_task.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qscientific/qsc_food path: /qsc_food/migrations/0006_auto_20171116_0024.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-11-16 00:24
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> operations = [
migrations.RenameModel(
... | code_fim | medium | {
"lang": "python",
"repo": "qscientific/qsc_food",
"path": "/qsc_food/migrations/0006_auto_20171116_0024.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameModel(
old_name='Portion',
new_name='Partition',
),
]<|fim_prefix|># repo: qscientific/qsc_food path: /qsc_food/migrations/0006_auto_20171116_0024.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-11-16 00:24
fr... | code_fim | medium | {
"lang": "python",
"repo": "qscientific/qsc_food",
"path": "/qsc_food/migrations/0006_auto_20171116_0024.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markshao/pagrant path: /test/pkg_test/pkg.py
__author__ = 'root'
from pkg_resources import load_entry_point
<|fim_suffix|>print load_entry_point("lxc", "PAGRANT", "VMPROVIDER_INFO")()<|fim_middle|># the working set itself is the iter for the package list
# for entry in working_set:
# print ... | code_fim | medium | {
"lang": "python",
"repo": "markshao/pagrant",
"path": "/test/pkg_test/pkg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print load_entry_point("lxc", "PAGRANT", "VMPROVIDER_INFO")()<|fim_prefix|># repo: markshao/pagrant path: /test/pkg_test/pkg.py
__author__ = 'root'
from pkg_resources import load_entry_point
<|fim_middle|># the working set itself is the iter for the package list
# for entry in working_set:
# print ... | code_fim | medium | {
"lang": "python",
"repo": "markshao/pagrant",
"path": "/test/pkg_test/pkg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> l = reste
#fill the array with (the rest of) the file
for i in range(init, quotient + init):
for j in range(0, 4):
for k in range(0, 4):
tabMess[i][j][k] = byteArr[l]
l = l + 1
#return the file formated as n*4*4 array of bytes
return ... | code_fim | hard | {
"lang": "python",
"repo": "TheCyberGeek/aes-el-gamal",
"path": "/segmess.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> #fills the first array with enough 0s to make the final array a 16 factor
for i in range(bourrage, 16):
tabMess[0][floor(i/4)][i%4] = byteArr[j]
j = j + 1
init=1
else:
#If it is already a 16 factor creates a quotient*4*4 array
tabMess = [... | code_fim | hard | {
"lang": "python",
"repo": "TheCyberGeek/aes-el-gamal",
"path": "/segmess.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheCyberGeek/aes-el-gamal path: /segmess.py
import sys
import os
from math import floor
#function to segment the message in n 4*4 matrix (each containing 128 bits)
def segmess(message):
#test if the file exists and, if not, exits
if not os.path.isfile(str(message)):
raise Valu... | code_fim | hard | {
"lang": "python",
"repo": "TheCyberGeek/aes-el-gamal",
"path": "/segmess.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betagouv/peps path: /data/migrations/0079_auto_20200511_1155.py
# Generated by Django 3.0.3 on 2020-05-11 11:55
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='experiment',
... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/peps",
"path": "/data/migrations/0079_auto_20200511_1155.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='experiment',
name='additional_details',
),
migrations.RemoveField(
model_name='experiment',
name='execution',
),
migrations.RemoveField(
model_name='ex... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/peps",
"path": "/data/migrations/0079_auto_20200511_1155.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, name in enumerate(classification.class_names):
locus_data.set_property('rapid_class_probability_{}'.format(name), predictions[0][-1][i])
# classification.plot_light_curves_and_classifications()
# classification.plot_classification_animation()
# alert_id, mjd, ras, decs, pass... | code_fim | hard | {
"lang": "python",
"repo": "tahumada/astrorapid",
"path": "/rapid_antares_stage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tahumada/astrorapid path: /rapid_antares_stage.py
import numpy as np
from astrorapid.classify import Classify
def delete_indexes(deleteindexes, *args):
newarrs = []
for arr in args:
newarr = np.delete(arr, deleteindexes)
newarrs.append(newarr)
return newarrs
def r... | code_fim | hard | {
"lang": "python",
"repo": "tahumada/astrorapid",
"path": "/rapid_antares_stage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set photflag detections when S/N > 5
photflag = np.zeros(len(flux))
photflag[flux / fluxerr > 5] = 4096
photflag[np.where(mjd == min(mjd[photflag == 4096]))] = 6144
deleteindexes = np.where((passband == 3) | (passband == '3.0') | (np.isnan(mag)))
mjd, passband, flux, fluxerr, ze... | code_fim | hard | {
"lang": "python",
"repo": "tahumada/astrorapid",
"path": "/rapid_antares_stage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> remote = rpc.connect(RPC_HOST, RPC_PORT)
remote.upload(lib_path)
lib = remote.load_module(os.path.basename(lib_path))
ctx = remote.cpu()
# Create a runtime executor module
module = graph_runtime.GraphModule(lib["default"](ctx))
# Feed input data
module.set_input(tfmodel.in... | code_fim | hard | {
"lang": "python",
"repo": "lileiigithub/tvm",
"path": "/tests/python/contrib/test_vsi_npu/test_tflite_models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> m = SUPPORTED_MODELS[model_name]
DTYPE = "uint8" if m.is_quant else "float32"
model = get_tflite_model(model_name)
# Parse TFLite model and convert it to a Relay module
mod, params = relay.frontend.from_tflite(
model, shape_dict={m.inputs: shape}, dtype_dict={m.inputs: DTYPE}... | code_fim | hard | {
"lang": "python",
"repo": "lileiigithub/tvm",
"path": "/tests/python/contrib/test_vsi_npu/test_tflite_models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lileiigithub/tvm path: /tests/python/contrib/test_vsi_npu/test_tflite_models.py
he Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this fil... | code_fim | hard | {
"lang": "python",
"repo": "lileiigithub/tvm",
"path": "/tests/python/contrib/test_vsi_npu/test_tflite_models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("kilometers\tMiles")
print( str( Kilometer1)+ "\t"+calcMiles( kilometers1),
(str(Kilometer2) + "\t" + calcMiles(kilometers2),
(str(Kilometer3 + "\t" + calcMiles(kilometers3),
(str(Kilometer4 + "\t" + calcMiles(kilometers4),
(str(Kilometer5 + "\t" + calcMiles(kilometers5),
(s... | code_fim | medium | {
"lang": "python",
"repo": "cblac105/Miles-convertor-",
"path": "/miles-convertor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cblac105/Miles-convertor- path: /miles-convertor.py
def calcMiles (kilometers1, kilometers2, kilometers3, kilometers4, kilometers5,\
kilometers6, kilometers7, kilometers8, kilometers9, kilometers10):
mile1 = kilometers1 * 0.6214
mile2 = kilometers2 * 0.6214
mile3 = kilometers3 *... | code_fim | hard | {
"lang": "python",
"repo": "cblac105/Miles-convertor-",
"path": "/miles-convertor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.