text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> qtobj = self['qtobj']
if isinstance(qtobj, QtWidgets.QCheckBox):
if value:
value = QtCore.Qt.Checked
else:
value = QtCore.Qt.Unchecked
qtobj.setCheckState(value)
elif isinstance(qtobj, (QtWidgets.QComboBox, QtWidge... | code_fim | hard | {
"lang": "python",
"repo": "symerio/SiQt",
"path": "/SiQt/definitions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: symerio/SiQt path: /SiQt/definitions.py
from collections import OrderedDict
from functools import partial
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from .dep_resolv import dependency_graph, calculate_dependencies
try:
from qtpy.QtCore import QString
except I... | code_fim | hard | {
"lang": "python",
"repo": "symerio/SiQt",
"path": "/SiQt/definitions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jensl/critic path: /src/api/impl/comment_unittest.py
import sys
import datetime
def basic(arguments):
import api
critic = api.critic.startSession(for_testing=True)
repository = api.repository.fetch(critic, name="critic")
branch = api.branch.fetch(
critic, repository=repo... | code_fim | hard | {
"lang": "python",
"repo": "jensl/critic",
"path": "/src/api/impl/comment_unittest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(some_comments) == 3
assert some_comments[0].id == 3
assert some_comments[0] is api.comment.fetch(critic, 3)
assert some_comments[1].id == 2
assert some_comments[1] is api.comment.fetch(critic, 2)
assert some_comments[2].id == 1
assert some_comments[2] is api.comment.... | code_fim | hard | {
"lang": "python",
"repo": "jensl/critic",
"path": "/src/api/impl/comment_unittest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NoamRa/project_euler path: /008 - Largest product in a series.py
"""
Largest product in a series
The four adjacent digits in the 1000-digit number that have the greatest product are 9 x 9 x 8 x 9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801... | code_fim | hard | {
"lang": "python",
"repo": "NoamRa/project_euler",
"path": "/008 - Largest product in a series.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#print digit_product("9989")
def slicer(num, slice_size):
if len(num) < slice_size:
print "The number given is smaller than the slice size"
return None
max_product = 0
for i in xrange(len(num) - slice_size):
product = digit_product(num[i: i + slice_size])
if max_product <= product:
max_pr... | code_fim | hard | {
"lang": "python",
"repo": "NoamRa/project_euler",
"path": "/008 - Largest product in a series.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> value = object.__getattribute__(self, attr)
if attr == "_context_handle" and value is None:
raise ValueError("Context handle is none in context!!!")
return value
@property
def module_dict(self):
return self._module_dict
def get_module(self, cls_nam... | code_fim | hard | {
"lang": "python",
"repo": "hsiehpinghan/trident",
"path": "/trident/context.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hsiehpinghan/trident path: /trident/context.py
import inspect
import json
import os
import sys
import time
import threading
import platform
from collections import OrderedDict
import numpy as np
import locale
_trident_context=None
def sanitize_path(path):
"""
Args:
path (str)... | code_fim | hard | {
"lang": "python",
"repo": "hsiehpinghan/trident",
"path": "/trident/context.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>predict_x = 8
predict_y = (m*predict_x) + b
r_squared = coefficient_of_determination(ys, regression_line)
print ("r_squared=", r_squared)
plt.scatter(xs, ys)
plt.scatter(predict_x, predict_y, color = 'g', marker='s', s=50)
#plt.plot(xs, xs*m+b)
plt.plot(xs, regression_line)
plt.xlabel('xs')
plt.ylabel('... | code_fim | hard | {
"lang": "python",
"repo": "aspiringguru/sentexTuts",
"path": "/PracMachLrng/sentex_ML_demo8.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def squared_error(ys_orig, ys_line):
#error between the predicted y line and the actual points.
return sum((ys_line-ys_orig)**2)
def coefficient_of_determination(ys_orig, ys_line):
#
y_mean_line = [mean(ys_orig) for y in ys_orig]
#creat array filled with mean of original y values.
... | code_fim | hard | {
"lang": "python",
"repo": "aspiringguru/sentexTuts",
"path": "/PracMachLrng/sentex_ML_demo8.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aspiringguru/sentexTuts path: /PracMachLrng/sentex_ML_demo8.py
'''
working exercise from sentex tutorials. with mods for clarification + api doc references.
R Squared Theory - Practical Machine Learning Tutorial with Python p.10
https://youtu.be/-fgYp74SNtk?list=PLQVvvaa0QuDfKTOs3Keq_kaG2P55YRn5v... | code_fim | hard | {
"lang": "python",
"repo": "aspiringguru/sentexTuts",
"path": "/PracMachLrng/sentex_ML_demo8.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nuurek/HomeLibrary path: /libraries/views.py
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.db.models i... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/HomeLibrary",
"path": "/libraries/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class BookCopyKeeperView(LoginRequiredMixin, UserPassesTestMixin, View):
def __init__(self):
self.book_copy = None
self.reader = None
super(BookCopyKeeperView, self).__init__()
def test_func(self):
self.reader = self.request.user.userprofile
self.book_cop... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/HomeLibrary",
"path": "/libraries/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_success_url(self):
return reverse_lazy('library_details', kwargs={'library_pk': self.request.user.userprofile.home_library.pk})
class OutsideLendingCreateView(LibraryOwnerTemplateView):
template_name = 'libraries/outside_lending_create.html'
def get(self, request, *args, **k... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/HomeLibrary",
"path": "/libraries/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class WGCOwnedApplication():
def __init__(self, data):
self._data = data
self._instances = dict()
for instance_json in self._data['instances']:
instance_obj = WGCOwnedApplicationInstance(self._data, instance_json)
self._instances[instance_obj.get_appli... | code_fim | hard | {
"lang": "python",
"repo": "UncleGoogle/galaxy-integration-wargaming",
"path": "/wgc/wgc_application_owned.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_application_name(self) -> str:
return self._data['game_name']
def get_application_instances(self) -> Dict[str, WGCOwnedApplicationInstance]:
return self._instances<|fim_prefix|># repo: UncleGoogle/galaxy-integration-wargaming path: /wgc/wgc_application_owned.py
import log... | code_fim | hard | {
"lang": "python",
"repo": "UncleGoogle/galaxy-integration-wargaming",
"path": "/wgc/wgc_application_owned.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UncleGoogle/galaxy-integration-wargaming path: /wgc/wgc_application_owned.py
import logging
import subprocess
from typing import Dict
from .wgc_helper import DETACHED_PROCESS
from .wgc_location import WGCLocation
class WGCOwnedApplicationInstance(object):
def __init__(self, app_data, instan... | code_fim | hard | {
"lang": "python",
"repo": "UncleGoogle/galaxy-integration-wargaming",
"path": "/wgc/wgc_application_owned.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nga-27/SecuritiesAnalysisTools path: /libs/tools/trend_utils/analysis.py
""" Analysis Utilities """
import pandas as pd
from scipy.stats import linregress
from libs.utils import dates_convert_from_index
def generate_analysis(fund: pd.DataFrame,
x_list: list,
... | code_fim | hard | {
"lang": "python",
"repo": "nga-27/SecuritiesAnalysisTools",
"path": "/libs/tools/trend_utils/analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
b_stop_index = x_list[len(x_list)-1]
broken_spot = {'start': {}, 'end': {}}
broken_spot['start']['index'] = b_start_index
broken_spot['start']['date'] = fund.index[b_start_index].strftime("%Y-%m-%d")
broken_spot['end']['index'] = b_... | code_fim | hard | {
"lang": "python",
"repo": "nga-27/SecuritiesAnalysisTools",
"path": "/libs/tools/trend_utils/analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: capstone-2019/capstone path: /backend/scripts/plot.py
"""
plot.py - This script is a utility used by the circuit simulator
to plot the results of simulation.
Data is fed into this script via a pipe which is written into by
the circuit simulator.
"""
import sys
import numpy as np
import matplotl... | code_fim | hard | {
"lang": "python",
"repo": "capstone-2019/capstone",
"path": "/backend/scripts/plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def plot_freq_doman(self, fft):
k = np.arange(self.num_frames)
T = self.num_frames / self.sample_rate
frq = k / T
frq = frq[range(self.num_frames / 2)]
plt.plot(frq, fft)
def show(self):
plt.subplot(2, 2, 1)
self.plot_time_domain(self.vin)
... | code_fim | hard | {
"lang": "python",
"repo": "capstone-2019/capstone",
"path": "/backend/scripts/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # convert signals to np arrays
self.num_frames = len(times)
self.sample_rate = 1.0 / (float(times[1]) - float(times[0]))
self.t = np.array(times, dtype=np.float64)
self.vin = np.array(vins, dtype=np.float64)
self.vout = np.array(vouts, dtype=np.float64)
... | code_fim | hard | {
"lang": "python",
"repo": "capstone-2019/capstone",
"path": "/backend/scripts/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elements = {
self.DICT_LENGTH2TYPE[length]:
self.extract_elements(element_ids, element_data, lengths, length)
for length in unique_lengths}
return FEMElementalAttribute('ELEMENT', elements)
def extract_elements(self, element_ids, element_data, lengt... | code_fim | hard | {
"lang": "python",
"repo": "yas/femio",
"path": "/femio/formats/obj/obj.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_nodes(self, string_series):
node_data = string_series.find_match(r'v\s+').split_vertical(
0, r'\s+')[1].to_values(r'\s+')
node_ids = np.arange(len(node_data), dtype=int) + 1
return FEMAttribute('NODE', node_ids, node_data)
def read_elements(self, strin... | code_fim | hard | {
"lang": "python",
"repo": "yas/femio",
"path": "/femio/formats/obj/obj.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yas/femio path: /femio/formats/obj/obj.py
import re
import numpy as np
from ...fem_attribute import FEMAttribute
from ...fem_data import FEMData
from ...fem_elemental_attribute import FEMElementalAttribute
from ...util import string_parser as st
class ObjData(FEMData):
"""FEMEntity of Wav... | code_fim | hard | {
"lang": "python",
"repo": "yas/femio",
"path": "/femio/formats/obj/obj.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
A[closed], A[p] = A[p], A[closed]
return closed
if __name__=="__main__":
assert Solution().median([4, 5, 1, 2, 3])==3
assert Solution().median([7, 9, 4, 5])==5<|fim_prefix|># repo: shenbomo/LintCode path: /Median.py
"""
Given a unsorted array with integers, find the median of it... | code_fim | hard | {
"lang": "python",
"repo": "shenbomo/LintCode",
"path": "/Median.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shenbomo/LintCode path: /Median.py
"""
Given a unsorted array with integers, find the median of it.
A median is the middle number of the array after it is sorted.
If there are even numbers in the array, return the N/2-th number after sorted.
Example
Given [4, 5, 1, 2, 3], return 3
Given [7, 9... | code_fim | hard | {
"lang": "python",
"repo": "shenbomo/LintCode",
"path": "/Median.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agdturner/agdturner.github.io path: /resources/testing/test.py
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 14 16:47:21 2023
<|fim_suffix|> self.assertEqual(calculator.add(1, 2), 3)
self.assertEqual(calculator.add(0.1, 0.1, 0.1), 0.3)
if __name__ == '__main__':
unittest.mai... | code_fim | medium | {
"lang": "python",
"repo": "agdturner/agdturner.github.io",
"path": "/resources/testing/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: agdturner/agdturner.github.io path: /resources/testing/test.py
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 14 16:47:21 2023
@author: Andy Turner
"""
import unittest
import calculator
class TestDocs(unittest.TestCase):
<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "agdturner/agdturner.github.io",
"path": "/resources/testing/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_add(self):
self.assertEqual(calculator.add(1, 2), 3)
self.assertEqual(calculator.add(0.1, 0.1, 0.1), 0.3)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: agdturner/agdturner.github.io path: /resources/testing/test.py
# -*- coding: utf-8 -*-
"""
Created o... | code_fim | easy | {
"lang": "python",
"repo": "agdturner/agdturner.github.io",
"path": "/resources/testing/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def nogrid():
f = plt.gcf()
ax = plt.axes()
_final_setup(ax)
return ax, f
def zgrid(zetas=None, wns=None, ax=None):
"""Draws discrete damping and frequency grid"""
fig = plt.gcf()
if ax is None:
ax = fig.gca()
# Constant damping lines
if zetas is None:
... | code_fim | hard | {
"lang": "python",
"repo": "python-control/python-control",
"path": "/control/grid.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-control/python-control path: /control/grid.py
import numpy as np
from numpy import cos, sin, sqrt, linspace, pi, exp
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist import SubplotHost
from mpl_toolkits.axisartist.grid_helper_curvelinear \
import GridHelperCurveLinear
impor... | code_fim | hard | {
"lang": "python",
"repo": "python-control/python-control",
"path": "/control/grid.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Constant damping lines
if zetas is None:
zetas = linspace(0, 0.9, 10)
for zeta in zetas:
# Calculate in polar coordinates
factor = zeta/sqrt(1-zeta**2)
x = linspace(0, sqrt(1-zeta**2), 200)
ang = pi*x
mag = exp(-pi*factor*x)
# Draw uppe... | code_fim | hard | {
"lang": "python",
"repo": "python-control/python-control",
"path": "/control/grid.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Theme
fields = ('id', 'title', 'questions')
class QuestionnaireUpdateSerializer(serializers.ModelSerializer):
themes = ThemeUpdateSerializer(many=True, required=False)
class Meta:
model = Questionnaire
fields = ('id', 'title', 'sent_date', 'end_date', 'de... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/e-controle",
"path": "/control/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betagouv/e-controle path: /control/serializers.py
from django.contrib.auth import get_user_model
from rest_framework import serializers
from utils.serializers import DateTimeFieldWihTZ
from .models import Control, Question, QuestionFile, Questionnaire, ResponseFile, Theme
User = get_user_mod... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/e-controle",
"path": "/control/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fakedrake/banditry path: /banditry/experiment.py
or_effect_cov)
logger.info(f'True effects: {np.round(true_effects, 4)}')
# Generate design matrix
arm_contexts = self.rng.multivariate_normal(
self.prior_context_means, self.prior_context_cov, size=self.num_arms... | code_fim | hard | {
"lang": "python",
"repo": "fakedrake/banditry",
"path": "/banditry/experiment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fakedrake/banditry path: /banditry/experiment.py
banditry import serialize, versioning
logger = logging.getLogger(__name__)
ISO_8601_FMT = '%Y-%m-%dT%H:%M:%S.%f'
def plot_cum_regret(rewards, optimal_rewards, ax=None, **kwargs):
if ax is None:
fig, ax = plt.subplots(figsize=kwargs.... | code_fim | hard | {
"lang": "python",
"repo": "fakedrake/banditry",
"path": "/banditry/experiment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> index = {'metadata': self.metadata,
'replications': replication_metadata}
index_fpath = os.path.join(dirpath, 'index.json')
logger.info(f'writing index.json to {index_fpath}')
with open(index_fpath, 'w') as f:
json.dump(index, f, indent=4, cls=s... | code_fim | hard | {
"lang": "python",
"repo": "fakedrake/banditry",
"path": "/banditry/experiment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def conn(self):
"""
Opens a connection using the parameters passed on init. Stores as object variables the connection handle and the cursor handle.
Args:
None
Returns:
None
"""
self.cnx = psycopg2.connect(**s... | code_fim | hard | {
"lang": "python",
"repo": "pablo-miselu/MTP",
"path": "/MTP/sfcs/SQL.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pablo-miselu/MTP path: /MTP/sfcs/SQL.py
# Copyright 2013 Pablo De La Garza, Miselu Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | code_fim | hard | {
"lang": "python",
"repo": "pablo-miselu/MTP",
"path": "/MTP/sfcs/SQL.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vhrspvl/vhrs-custom path: /vhrs/vhrs_custom/report/employee_day_attendance/employee_day_attendance.py
# Copyright (c) 2013, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint, getdate, ... | code_fim | hard | {
"lang": "python",
"repo": "vhrspvl/vhrs-custom",
"path": "/vhrs/vhrs_custom/report/employee_day_attendance/employee_day_attendance.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # right armrest
x_min = -args.armWidth / 2
x_max = args.armWidth / 2
y_min = args.legHeight + args.seatHeight + args.armHeightLoc
y_max = args.legHeight + args.seatHeight + args.armHeightLoc + args.armHeight
z_min = 0
z_max = args.armDepth
out.append(create_axis_aligned_set... | code_fim | hard | {
"lang": "python",
"repo": "jeonghyunkeem/structedit",
"path": "/gen_synshapes/chair_armrests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # left armsupport
x_min = (args.armWidth - args.armSupportWidth) / 2 + args.seatWidth - args.armWidth / 2
x_max = (args.armWidth - args.armSupportWidth) / 2 + args.armSupportWidth + args.seatWidth - args.armWidth / 2
y_min = args.legHeight + args.seatHeight
y_max = args.legHeight + arg... | code_fim | hard | {
"lang": "python",
"repo": "jeonghyunkeem/structedit",
"path": "/gen_synshapes/chair_armrests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeonghyunkeem/structedit path: /gen_synshapes/chair_armrests.py
from utils import *
import random
def make_T_armrests(args, box_id):
out = []
right_arm = {'name': 'chair_arm', 'parts': []}
# right armrest
x_min = -args.armWidth / 2
x_max = args.armWidth / 2
y_min = args.... | code_fim | hard | {
"lang": "python",
"repo": "jeonghyunkeem/structedit",
"path": "/gen_synshapes/chair_armrests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karstenw/FileMaker-DDR-Splitter path: /ddrsplit.py
me = filename.replace(':', '_')
filename = filename.replace('\\', '_')
fullpath = os.path.join( catfolder, filename)
fullpath = makeunicode( fullpath, normalizer="NFD" )
return fullpath
def get_text_object(cfg, cur_fmpxml, cur_... | code_fim | hard | {
"lang": "python",
"repo": "karstenw/FileMaker-DDR-Splitter",
"path": "/ddrsplit.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karstenw/FileMaker-DDR-Splitter path: /ddrsplit.py
step_calc_text = None
for subnode in cur_node.iter():
if subnode.tag == "FileReference":
fref_id = subnode.attrib.get("id", -1)
fref_name = subnode.attrib.get("name", "NO FILEREFERENCE NAME")
elif su... | code_fim | hard | {
"lang": "python",
"repo": "karstenw/FileMaker-DDR-Splitter",
"path": "/ddrsplit.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for fmpreport in summary.iter("FMPReport"):
for xmlfile in fmpreport.iter("File"):
# print( xmlfile )
isSummary += 1
xml_fmpfilename = xmlfile.get("name", "NO FILE NAME")
xml_xmllink = xmlfile.get("link", "")
xml_fmppath = xmlfile.get... | code_fim | hard | {
"lang": "python",
"repo": "karstenw/FileMaker-DDR-Splitter",
"path": "/ddrsplit.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # try to maintain a fixed airspeed near trim point
K_vt = 0.25
airspeed_setpoint = 540
vt_des = model.xequil[0]
throttle = ah.p_cntrl(kp=K_vt, e=(vt_des - vt))
return Nz, 0, 0, throttle<|fim_prefix|># repo: ZikangXiong/csaf path: /examples/f16/components/autoaltitude.py
"""
CSAF ... | code_fim | hard | {
"lang": "python",
"repo": "ZikangXiong/csaf",
"path": "/examples/f16/components/autoaltitude.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZikangXiong/csaf path: /examples/f16/components/autoaltitude.py
"""
CSAF F-16 Model
taken from https://github.com/stanleybak/AeroBenchVVPython
"""
import autopilot_helper as ah
def model_output(model, time_t, state_x, input_f16):
vt = input_f16[0] # airspeed (ft/sec)
alph... | code_fim | medium | {
"lang": "python",
"repo": "ZikangXiong/csaf",
"path": "/examples/f16/components/autoaltitude.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Proportional Control
k_alt = 0.025
h_error = model.setpoint - h
Nz = k_alt * h_error # Allows stacking of cmds
# (Psuedo) Derivative control using path angle
k_gamma = 25
# k_gamma = self.p_gain
Nz = Nz - k_gamma*gamma
# try to maintain a fixed airspeed near trim po... | code_fim | hard | {
"lang": "python",
"repo": "ZikangXiong/csaf",
"path": "/examples/f16/components/autoaltitude.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_display = ('name', 'account',)
@admin.register(PageItem)
class PageItemAdmin(admin.ModelAdmin):
list_display = ('name', 'notes',)<|fim_prefix|># repo: noracami/fb-post-counts path: /mysite/pages/admin.py
from django.contrib import admin
from .models import User, PageItem
<|fim_middle|># Reg... | code_fim | medium | {
"lang": "python",
"repo": "noracami/fb-post-counts",
"path": "/mysite/pages/admin.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: noracami/fb-post-counts path: /mysite/pages/admin.py
from django.contrib import admin
from .models import User, PageItem
<|fim_suffix|> list_display = ('name', 'notes',)<|fim_middle|># Register your models here.
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ('nam... | code_fim | medium | {
"lang": "python",
"repo": "noracami/fb-post-counts",
"path": "/mysite/pages/admin.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: l0kix2/django-granular-access path: /granular_access/manager.py
# coding: utf-8
from __future__ import unicode_literals
from django.db.models import Manager
from .queryset import AccessQuerySet, check_superuser
from .access import filter_available
class AccessManager(Manager):
def get_quer... | code_fim | hard | {
"lang": "python",
"repo": "l0kix2/django-granular-access",
"path": "/granular_access/manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AccessManagerMixin(object):
def available(self, to, action):
queryset = self.get_query_set()
if check_superuser():
return queryset
return filter_available(to=to, action=action, queryset=queryset)<|fim_prefix|># repo: l0kix2/django-granular-access path: /granu... | code_fim | medium | {
"lang": "python",
"repo": "l0kix2/django-granular-access",
"path": "/granular_access/manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joelthe1/pigeon path: /messenger/common/utils.py
'''
Common utils for the Pigeon messenger service
'''
# Core python
import logging.config
import os
import typing
import time
import multiprocessing
from dataclasses import fields
import messenger.exceptions as pigeon_exceptions
from messenger.c... | code_fim | hard | {
"lang": "python",
"repo": "joelthe1/pigeon",
"path": "/messenger/common/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def reader(queue):
'''
*** Test method. Not intended for production. ***
Logs size of the queue every second
'''
logger = multiprocessing.get_logger()
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(name)s: %(message)s')
handler = logging.FileHandler('logs/rea... | code_fim | hard | {
"lang": "python",
"repo": "joelthe1/pigeon",
"path": "/messenger/common/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
*** Test method. Not intended for production. ***
Logs size of the queue every second
'''
logger = multiprocessing.get_logger()
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(name)s: %(message)s')
handler = logging.FileHandler('logs/reader.log')
handl... | code_fim | hard | {
"lang": "python",
"repo": "joelthe1/pigeon",
"path": "/messenger/common/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: att-comdev/valet path: /plugins/valet_plugins/plugins/heat/plugins.py
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014-2016 AT&T
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | code_fim | hard | {
"lang": "python",
"repo": "att-comdev/valet",
"path": "/plugins/valet_plugins/plugins/heat/plugins.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.api.plans_create(stack, plan, auth_token=cnxt.auth_token)
def do_post_op(self, cnxt, stack, current_stack=None, action=None, # pylint: disable=R0913
is_stack_failure=False):
''' Method to be run by heat after stack operations, including failures.
... | code_fim | hard | {
"lang": "python",
"repo": "att-comdev/valet",
"path": "/plugins/valet_plugins/plugins/heat/plugins.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># initialize variables and prepare for training
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
# run training
for step in range(total_iter+1):
indices = np.random.randint(low=0, high=len(expert_data['actions']), size=batch_size)
input_batch = expert_data['observations'][indi... | code_fim | hard | {
"lang": "python",
"repo": "rodolfomiranda/homework",
"path": "/hw1/train_bc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rodolfomiranda/homework path: /hw1/train_bc.py
import pickle
import tensorflow as tf
import numpy as np
from nn import *
datafile_path = "./hw1/expert_data/Ant-v2.pkl"
env_name = "Ant-v2"
batch_size = 100
total_iter = 100000
# load training data
f = open(datafile_path, 'rb')
expert_data = pick... | code_fim | medium | {
"lang": "python",
"repo": "rodolfomiranda/homework",
"path": "/hw1/train_bc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def build_runner(config):
"""Builds a runner with given configuration.
Args:
config: Configurations used to build the runner.
Raises:
ValueError: If the `config.runner_type` is not supported.
"""
if not isinstance(config, dict) or 'runner_type' not in config:
... | code_fim | medium | {
"lang": "python",
"repo": "bytedance/Hammer",
"path": "/runners/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bytedance/Hammer path: /runners/__init__.py
# python3.7
"""Collects all runners."""
from .stylegan_runner import StyleGANRunner
from .stylegan2_runner import StyleGAN2Runner
from .stylegan3_runner import StyleGAN3Runner
<|fim_suffix|> """Builds a runner with given configuration.
Args:
... | code_fim | medium | {
"lang": "python",
"repo": "bytedance/Hammer",
"path": "/runners/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: songroger/mars path: /mars/web/tests/test_api.py
'--log-level', 'debug',
'--log-format', 'WOR %(asctime)-15s %(message)s',
'--ignore-avail-mem'])
proc_scheduler = subprocess.Popen([sys.execut... | code_fim | hard | {
"lang": "python",
"repo": "songroger/mars",
"path": "/mars/web/tests/test_api.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with new_session(service_ep, verify_ssl=False) as sess:
self.assertEqual(sess._sess._serial_type, SerialType.PICKLE)
self.assertEqual(sess._sess._pickle_protocol, pickle_ver)
except ImportError:
pass
finally:
pickle.HIGHES... | code_fim | hard | {
"lang": "python",
"repo": "songroger/mars",
"path": "/mars/web/tests/test_api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = mt.ones((10, 10), chunk_size=30)
b = mt.ones((10, 10), chunk_size=30)
c = a.dot(b)
value = sess.run(c, timeout=timeout)
np.testing.assert_array_equal(value, np.ones((10, 10)) * 10)
raw = pd.DataFrame(np.ra... | code_fim | hard | {
"lang": "python",
"repo": "songroger/mars",
"path": "/mars/web/tests/test_api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while u != n-2:
# print(u)
u = prev_f[u]
path_f.append(u)
full_path =path_b[::-1]
full_path.append(meeting_point)
full_path.extend(path_f)
return full_path
# def get_connections_ND(points, radius=.1, pval=2):
# """
# Finds all the connections ... | code_fim | hard | {
"lang": "python",
"repo": "mwcotton/DAGmetrics",
"path": "/minkowskitools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwcotton/DAGmetrics path: /minkowskitools.py
1648, 0.0537579, 0.0596041, 0.0656865, 0.0719881, \
0.0784918, 0.0851809, 0.0920388, 0.0990496, 0.106198, 0.113468, \
0.120846, 0.128319, 0.135873, 0.143496, 0.151177, 0.158904, 0.166667, \
0.174456, 0.182263, 0.190079, 0.197896, 0.205707, 0.213505, 0.... | code_fim | hard | {
"lang": "python",
"repo": "mwcotton/DAGmetrics",
"path": "/minkowskitools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n = connection_mat.shape[0]
dist, prev = {}, {}
for i in range(n):
dist[i] = np.inf
dist[n-2] = 0
for u in topo_sort(connection_mat):
for v in np.nonzero(connection_mat[:, u])[0]:
alt = dist[u]+connection_mat[v, u]
... | code_fim | hard | {
"lang": "python",
"repo": "mwcotton/DAGmetrics",
"path": "/minkowskitools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # *left_image_trial* updates
if left_image_trial.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
left_image_trial.frameNStart = frameN # exact frame index
left_image_trial.tStart = t # local t and n... | code_fim | hard | {
"lang": "python",
"repo": "mzettersten/psychopy_tutorials",
"path": "/word_recognition/animal_words_2afc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mzettersten/psychopy_tutorials path: /word_recognition/animal_words_2afc.py
tThisFlip >= 0.3-frameTolerance:
# keep track of start time/frame for later
right_rectangle.frameNStart = frameN # exact frame index
right_rectangle.tStart = t # local t and not accou... | code_fim | hard | {
"lang": "python",
"repo": "mzettersten/psychopy_tutorials",
"path": "/word_recognition/animal_words_2afc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
... | code_fim | hard | {
"lang": "python",
"repo": "mzettersten/psychopy_tutorials",
"path": "/word_recognition/animal_words_2afc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yigitozgumus/Polimi_Thesis path: /base/base_train_keras.py
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
class BaseTrainKeras:
def __init__(self,sess, model,data, config):
self.model = model
self.config = config
self.data = data
... | code_fim | medium | {
"lang": "python",
"repo": "yigitozgumus/Polimi_Thesis",
"path": "/base/base_train_keras.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def train(self):
raise NotImplementedError
def save_generated_images(self,predictions, epoch):
# make sure the training parameter is set to False because we
# don't want to train the batchnorm layer when doing inference.
predictions = np.asarray(predictions)[0]
... | code_fim | hard | {
"lang": "python",
"repo": "yigitozgumus/Polimi_Thesis",
"path": "/base/base_train_keras.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def save_generated_images(self,predictions, epoch):
# make sure the training parameter is set to False because we
# don't want to train the batchnorm layer when doing inference.
predictions = np.asarray(predictions)[0]
fig = plt.figure(figsize=(self.rows, self.rows))
... | code_fim | hard | {
"lang": "python",
"repo": "yigitozgumus/Polimi_Thesis",
"path": "/base/base_train_keras.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asiaszmek/ca1_muscarinic_modulation path: /ca1_pyramidal.py
bound, (fold_PIP2 - 1)*kf_pip2, kf_pip2,
regions=[self.cyt])
self.kcnq_bind_pip2 = rxd.Reaction(self.pip2 + self.kcnq, self.pip2_kcnq, kf_kcnq,
kb... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/ca1_muscarinic_modulation",
"path": "/ca1_pyramidal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asiaszmek/ca1_muscarinic_modulation path: /ca1_pyramidal.py
exit(1)
def get_sec_by_name(self, sec_name):
"""
Returns a section if it has the given name
:param sec_name: name of section you desire with or without the cell name
:return: section
"""
... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/ca1_muscarinic_modulation",
"path": "/ca1_pyramidal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> color = color_dict['basal']
for i in range(int(h.n3d(sec=sec))):
pts.append([h.x3d(i, sec=sec), h.y3d(i, sec=sec), h.z3d(i, sec=sec)])
seg_dict[sname] = {'num': snum, 'color': color, 'pts': np.array(pts), 'diam': sec.diam}
# for sec in self.ax... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/ca1_muscarinic_modulation",
"path": "/ca1_pyramidal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aggarwalankush/awesome-scripts path: /mov.py
import datetime
import subprocess
import sys
from time import time
if len(sys.argv) < 2:
print("DUDE!! Give 'mov' file name to convert to 'mp4'")
exit()
<|fim_suffix|>inputFileName = str(sys.argv[1]).split(".")[0] + '.mov'
if len(sys.argv) >... | code_fim | hard | {
"lang": "python",
"repo": "aggarwalankush/awesome-scripts",
"path": "/mov.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>inputFileName = str(sys.argv[1]).split(".")[0] + '.mov'
if len(sys.argv) > 2:
outputFileName = str(sys.argv[2]).split(".")[0] + '.mp4'
else:
outputFileName = str(sys.argv[1]).split(".")[0] + '.mp4'
command = command.replace("$1", inputFileName).replace("$2", outputFileName)
print("running comma... | code_fim | hard | {
"lang": "python",
"repo": "aggarwalankush/awesome-scripts",
"path": "/mov.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if l2:
l1=l2
if carry:
while l1:
l1.val+=carry
l1.val,carry=l1.val%10,l1.val//10
l1=l1.next
return dummy.next<|fim_prefix|># repo: Fiona08/leetcode path: /Python/002 AddTwoNum.py
#2
# Time: O(n)
# ... | code_fim | hard | {
"lang": "python",
"repo": "Fiona08/leetcode",
"path": "/Python/002 AddTwoNum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fiona08/leetcode path: /Python/002 AddTwoNum.py
#2
# Time: O(n)
# Space: O(n)
# You are given two non-empty linked lists representing two non-negative integers.
# The digits are stored in reverse order and each of their nodes contain a single digit.
# Add the two numbers and return it as a... | code_fim | hard | {
"lang": "python",
"repo": "Fiona08/leetcode",
"path": "/Python/002 AddTwoNum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create_wordcloud(self, text):
"""
Generate word cloud or wordle.
:param text: list of content regarding each concept
:return: None
"""
text = ' '.join(f"{word}" for word in text)
mask = np.array(Image.open(os.path.join(CURRDIR, "cloud.png")))... | code_fim | hard | {
"lang": "python",
"repo": "burhandodhy/firebook.com",
"path": "/word_cloud_generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: burhandodhy/firebook.com path: /word_cloud_generator.py
from __future__ import absolute_import
import os
import nltk
import inspect
import wikipedia
import numpy as np
from PIL import Image
from wordcloud import WordCloud
from nltk.corpus import stopwords
CONCEPT_TAGS = ['NN', 'NNS', 'NNP', 'NN... | code_fim | hard | {
"lang": "python",
"repo": "burhandodhy/firebook.com",
"path": "/word_cloud_generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
GET: applications
get applications
"""
aps = ApplicationService()
apps = aps.get_applications()
return jsonify({'items': apps})<|fim_prefix|># repo: Danielhhs/Victory path: /application/handlers/application_handler.py
# flask
from flask import jsonify
# application
from ... | code_fim | easy | {
"lang": "python",
"repo": "Danielhhs/Victory",
"path": "/application/handlers/application_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Danielhhs/Victory path: /application/handlers/application_handler.py
# flask
from flask import jsonify
# application
from application.decorator.auth_decorator import *
from application.services.application_service import *
<|fim_suffix|> """
GET: applications
get applications
""... | code_fim | easy | {
"lang": "python",
"repo": "Danielhhs/Victory",
"path": "/application/handlers/application_handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ro-56/aimmspack path: /aimmspack/__main__.py
from aimmspack.api import debugCLI, aimmspackCLI, example
from argparse import ArgumentParser
def main():
parser = ArgumentParser()
subparsers = parser.add_subparsers(dest='mode')
parser_build = subparsers.add_parser('build', help... | code_fim | medium | {
"lang": "python",
"repo": "ro-56/aimmspack",
"path": "/aimmspack/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if args.mode == 'example':
example.print_example_file()
return
if args.mode == 'build':
if args.filepath:
if args.debug:
debugCLI.test(args.filepath)
return
aimmspackCLI.aimmspack(args.filepath)
print('ERRO... | code_fim | hard | {
"lang": "python",
"repo": "ro-56/aimmspack",
"path": "/aimmspack/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def receive_addresses(self, i=0, limit=None):
"""Returns an iterator deriving receive addresses for the wallet up to the provided limit"""
starting_index = i
while limit is None or i < starting_index + limit:
yield self.descriptor.derive(i, branch_index=0).address(
... | code_fim | hard | {
"lang": "python",
"repo": "kkdao/krux",
"path": "/src/krux/wallet.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kkdao/krux path: /src/krux/wallet.py
# The MIT License (MIT)
# Copyright (c) 2021-2022 Krux contributors
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... | code_fim | hard | {
"lang": "python",
"repo": "kkdao/krux",
"path": "/src/krux/wallet.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('--path', action='store', dest='path',help='folder to produce output into ',default = 'output')
return parser<|fim_prefix|># repo: volkancirik/chess-qa path: /utils.py
import argparse
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--seed',... | code_fim | medium | {
"lang": "python",
"repo": "volkancirik/chess-qa",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: volkancirik/chess-qa path: /utils.py
import argparse
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--seed', action='store', dest='seed',help='random seed, default = 0',type=int,default = 0)
parser.add_argument('--q-type', action='store', dest='q_type',he... | code_fim | hard | {
"lang": "python",
"repo": "volkancirik/chess-qa",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # fire internal reboot start message for Scalarizr
msg_service = bus.messaging_service
producer = msg_service.get_producer()
msg = msg_service.new_message(Messages.INT_SERVER_REBOOT)
producer.send(Queues.CONTROL, msg)
# fire RebootSt... | code_fim | hard | {
"lang": "python",
"repo": "ck1981/scalarizr",
"path": "/src/scalarizr/scripts/reboot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ck1981/scalarizr path: /src/scalarizr/scripts/reboot.py
'''
Created on Mar 3, 2010
@author: marat
'''
import os
import sys
from scalarizr.bus import bus
from scalarizr.messaging import Messages, Queues
from scalarizr.messaging.p2p.service import P2pMessageService
from scalarizr.app import init_... | code_fim | medium | {
"lang": "python",
"repo": "ck1981/scalarizr",
"path": "/src/scalarizr/scripts/reboot.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JohnAresHao/examination path: /account/urls.py
# -*- coding: utf-8 -*-
from django.conf.urls import url
<|fim_suffix|># 登录url
urlpatterns = [
url(r'^login_redirect$', login_views.login_redirect, name='login_redirect'),
url(r'^signup_redirect$', login_render.signup_redirect, name='signup... | code_fim | easy | {
"lang": "python",
"repo": "JohnAresHao/examination",
"path": "/account/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 登录url
urlpatterns = [
url(r'^login_redirect$', login_views.login_redirect, name='login_redirect'),
url(r'^signup_redirect$', login_render.signup_redirect, name='signup_redirect'),
url(r'^email_notify$', login_render.email_notify, name='email_notify'),
url(r'^reset_notify$', login_render.... | code_fim | easy | {
"lang": "python",
"repo": "JohnAresHao/examination",
"path": "/account/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if match["actual_time"] != datetime.datetime.fromtimestamp(0):
return "Invalid: Match Occurred"
else:
data = request.json
data_accessor.add_prediction(data["scout"], key, data["prediction"])
return "Valid"
@app.route("/")
def dashboard():
return render_templat... | code_fim | hard | {
"lang": "python",
"repo": "TeamCerbotics4400/scouting-data-ingest",
"path": "/src/DataDashboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TeamCerbotics4400/scouting-data-ingest path: /src/DataDashboard.py
import datetime
from flask import Flask, render_template
from flask.globals import request
import re
from DataInput import DataInput
from DataCalculator import DataCalculator
import pandas as pd
from sqlalchemy import (
create... | code_fim | hard | {
"lang": "python",
"repo": "TeamCerbotics4400/scouting-data-ingest",
"path": "/src/DataDashboard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route("/team/<teamid>")
def team(teamid):
if not teamid.startswith("frc"):
teamid = "frc" + teamid
return render_template("team.html", teamid=teamid)
@app.route("/team/<teamid>/data")
def team_data(teamid):
if not teamid.startswith("frc"):
teamid = "frc" + teamid
p... | code_fim | hard | {
"lang": "python",
"repo": "TeamCerbotics4400/scouting-data-ingest",
"path": "/src/DataDashboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chuckbnorris/Canivete path: /cfripper/tests/rules/test_CloudFormationAuthenticationRule.py
import pytest
from cfripper.rules.cloudformation_authentication import CloudFormationAuthenticationRule
from tests.utils import get_cfmodel_from
@pytest.fixture()
def good_template():
return get_cfmo... | code_fim | hard | {
"lang": "python",
"repo": "chuckbnorris/Canivete",
"path": "/cfripper/tests/rules/test_CloudFormationAuthenticationRule.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.