text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>im1 = imageio.imread(im1_path)
im2 = imageio.imread(im2_path)
print("each image shape: ",im1.shape)
ims = np.concatenate([im1,im2],axis=2)
print("concatenate shape: ",ims.shape)
ims = torch.from_numpy(ims)
ims = ims.unsqueeze(0)
ims = ims.permute(0,3,1,2)
ims = ims.float()
print(ims.size())
input = Variab... | code_fim | medium | {
"lang": "python",
"repo": "lxtGH/flownet_pytorch",
"path": "/test/testFlowNetS.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Randomly select an animal to leave out.
index = random.randint(1,12);
# Select the features corresponding to one animal.
def get_single_animal_features(df, index) :
return df.loc[df['AnimalId'] == index]
# Delete the rows corresponding to the animal left out.
def get_loo_features(df, index):
df... | code_fim | hard | {
"lang": "python",
"repo": "senane/ADELPHI",
"path": "/.ipynb_checkpoints/mlp_gridsearch-checkpoint.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: senane/ADELPHI path: /.ipynb_checkpoints/mlp_gridsearch-checkpoint.py
from __future__ import absolute_import, division, print_function
from matplotlib.font_manager import _rebuild; _rebuild()
import tensorflow as tf
import re
#Helper libraries
import numpy as np
import matplotlib.pyplot as plt
im... | code_fim | hard | {
"lang": "python",
"repo": "senane/ADELPHI",
"path": "/.ipynb_checkpoints/mlp_gridsearch-checkpoint.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> start = '\'';
end = '\'';
return((s.split(start))[1].split(end)[0])
cols = [];
c_names = col_names.values.ravel();
for x in range(len(c_names)):
name = str (c_names[x]);
cols.append(find_between(name))
# Create a DataFrame of features with columns named & rows labeled.
feat_data = pd... | code_fim | hard | {
"lang": "python",
"repo": "senane/ADELPHI",
"path": "/.ipynb_checkpoints/mlp_gridsearch-checkpoint.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nuyptcy/Python_LookupFunction path: /tk_test.py
# -*- coding: utf-8 -*-
#Step1匯入自備餐具優惠餐廳csv檔
import csv
import matplotlib.pyplot as plt
import tkinter as tk
from tkinter import ttk
print("""
全台各地自備餐具與飲料袋享優惠之餐廳統計表
輸入0離開程式
輸入1查看餐廳優惠方式比例
輸入2查看優惠方式為集點之餐廳
輸入3查看優惠方式為折價之餐廳
輸入4查看優惠方式為贈送餐飲之餐廳
輸入5查看... | code_fim | hard | {
"lang": "python",
"repo": "Nuyptcy/Python_LookupFunction",
"path": "/tk_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("New Element Selected")
app = tk.Tk()
app.geometry('200x200')
labelTop = tk.Label(app,text = "查看餐廳優惠方式")
labelTop.grid(column=0, row=0)
comboExample = ttk.Combobox(app,
values=GBType)
comboExample.grid(column=0... | code_fim | hard | {
"lang": "python",
"repo": "Nuyptcy/Python_LookupFunction",
"path": "/tk_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #print('hello {0}'.format('world'))
elif keyin ==3:
print('優惠方式為折價之餐廳')
for i in range(1,len(cutleryData)):
if '折價' in cutleryData[i][7]:
print(cutleryData[i][1])
elif keyin ==4:
print('優惠方式為贈送餐飲之餐廳')
for i in range(1,len(... | code_fim | hard | {
"lang": "python",
"repo": "Nuyptcy/Python_LookupFunction",
"path": "/tk_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oscarbranson/latools path: /latools/processes/signal_id.py
"""
Functions for automatically distinguishing between signal and background
in LA-ICPMS data.
(c) Oscar Branson : https://github.com/oscarbranson
"""
import warnings
import numpy as np
from scipy.stats import gaussian_kde
from scipy.opt... | code_fim | hard | {
"lang": "python",
"repo": "oscarbranson/latools",
"path": "/latools/processes/signal_id.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for z in zeros: # for each approximate transition
# isolate the data around the transition
if z - win < 0:
lo = gwin // 2
hi = int(z + win)
elif z + win > (len(sig) - gwin // 2):
lo = int(z - win)
... | code_fim | hard | {
"lang": "python",
"repo": "oscarbranson/latools",
"path": "/latools/processes/signal_id.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aspc/mainsite path: /aspc/generic.py
from django.views.generic.dates import MonthArchiveView
from django.http import Http404
import datetime
class FilteredMonthArchiveView(MonthArchiveView):
"""
Prevent the month archives from going back past the first post, even
when `allow_empty` i... | code_fim | medium | {
"lang": "python",
"repo": "aspc/mainsite",
"path": "/aspc/generic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_exists = context[self.get_context_object_name(self.model)].exists()
previous_exists = self._previous_posts().exists()
if (not current_exists) and (not previous_exists):
raise Http404 # Nothing in this month, nothing prior to it,
... | code_fim | hard | {
"lang": "python",
"repo": "aspc/mainsite",
"path": "/aspc/generic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (not current_exists) and (not previous_exists):
raise Http404 # Nothing in this month, nothing prior to it,
# better bail
elif not previous_exists:
context['previous_posts_exist'] = False
else:
context['previous_posts... | code_fim | hard | {
"lang": "python",
"repo": "aspc/mainsite",
"path": "/aspc/generic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TDL77/PyRFF path: /Example.py
from PyRFF import get_features_sequential, get_features
import numpy as np
# List of variable size vectors
sequential = [np.random.normal(size=(np.random.randint(1, 12), 4))
for i in range(4)]
# Get Sequential Features
feat = get_features_sequential(
... | code_fim | medium | {
"lang": "python",
"repo": "TDL77/PyRFF",
"path": "/Example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Array of Fixed size vectors
non_sequential = np.random.normal(size=(4, 5))
feat = get_features(
non_sequential,
123,
"rff",
10,
0.1
)
print(feat.shape) # (4, 20)<|fim_prefix|># repo: TDL77/PyRFF path: /Example.py
from PyRFF import get_features_sequential, get_features
import numpy... | code_fim | medium | {
"lang": "python",
"repo": "TDL77/PyRFF",
"path": "/Example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'action' not in content or not content['action'] == 'login':
raise AuthError()
if 'username' not in content or 'password' not in content:
raise AuthError()
return User.check_password(content['username'], content['password'])
def check_auth(username, atoken):
if atoken i... | code_fim | medium | {
"lang": "python",
"repo": "buckbaskin/notary",
"path": "/users/authenticate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: buckbaskin/notary path: /users/authenticate.py
from db import User, LoginToken
# pylint: disable=superfluous-parens
def check_login(content):
<|fim_suffix|>def check_auth(username, atoken):
if atoken is None or username is None:
raise AuthError()
elif not LoginToken.check_token(... | code_fim | hard | {
"lang": "python",
"repo": "buckbaskin/notary",
"path": "/users/authenticate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = Column(Integer, primary_key=True)
ts_code = Column(Unicode(20))
symbol = Column(Unicode(10))
name = Column(Unicode(255))
fullname = Column(Unicode(255))
enname = Column(Unicode(255))
exchange_id = Column(Unicode(50))
curr_type = Column(Unicode(10))
list_status = Co... | code_fim | medium | {
"lang": "python",
"repo": "LambertW/EchartsInAspnet",
"path": "/python_scripts/models/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LambertW/EchartsInAspnet path: /python_scripts/models/models.py
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, Unicode
from sqlalchemy.ext.declarative import declarative_base
<|fim_suffix|> id = Column(Integer, primary_key=True)
ts_code = Column(Unicode(20))
symbol ... | code_fim | medium | {
"lang": "python",
"repo": "LambertW/EchartsInAspnet",
"path": "/python_scripts/models/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = []
for arg in sys.argv:
a.append(arg)
if 6 == len(a):
move_hand_client(a[1], float(a[2]), float(a[3]), float(a[4]), float(a[5]))
else:
print "Usage: %s prefix f1 f2 f3 spread"%a[0]
except rospy.ROSInterruptException:
print "pro... | code_fim | hard | {
"lang": "python",
"repo": "RCPRG-ros-pkg/control_subsystem",
"path": "/common/set_pos2.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RCPRG-ros-pkg/control_subsystem path: /common/set_pos2.py
#! /usr/bin/env python
# Copyright (c) 2014, Robot Control and Pattern Recognition Group, Warsaw University of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are p... | code_fim | medium | {
"lang": "python",
"repo": "RCPRG-ros-pkg/control_subsystem",
"path": "/common/set_pos2.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
try:
# Initializes a rospy node so that the SimpleActionClient can
# publish and subscribe over ROS.
rospy.init_node('move_hand_py', anonymous=True)
a = []
for arg in sys.argv:
a.append(arg)
if 6 == len(a):
m... | code_fim | hard | {
"lang": "python",
"repo": "RCPRG-ros-pkg/control_subsystem",
"path": "/common/set_pos2.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SurendraTamang/Web-Scrapping-1 path: /fiverrProjects/project-9/italyPhoto.py
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from scrapy import Selec... | code_fim | hard | {
"lang": "python",
"repo": "SurendraTamang/Web-Scrapping-1",
"path": "/fiverrProjects/project-9/italyPhoto.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> FIELD_NAMES = [
'Name',
'Type',
'Address',
'Zip Code',
'Phone',
'Lvl 1 Category',
'Lvl 2 Category',
'Lvl 3 Category',
'Prezzo',
'Servizi',
'Pack matrimonio',
'Trasferte',
'Con quanto anticipo mi devo mettere in contatto con ... | code_fim | hard | {
"lang": "python",
"repo": "SurendraTamang/Web-Scrapping-1",
"path": "/fiverrProjects/project-9/italyPhoto.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('alumnos', '0008_auto_20181112_0118'),
]
operations = [
migrations.AlterModelOptions(
name='responsable',
options={'verbose_name': 'responsable', 'verbose_name_plural': 'responsables'},
),
]<|fim_prefix|># repo: AlanSanche... | code_fim | medium | {
"lang": "python",
"repo": "AlanSanchezP/ElectivappServer",
"path": "/electivapp/apps/alumnos/migrations/0009_auto_20181112_0137.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlanSanchezP/ElectivappServer path: /electivapp/apps/alumnos/migrations/0009_auto_20181112_0137.py
# Generated by Django 2.0.9 on 2018-11-12 01:37
from django.db import migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
... | code_fim | medium | {
"lang": "python",
"repo": "AlanSanchezP/ElectivappServer",
"path": "/electivapp/apps/alumnos/migrations/0009_auto_20181112_0137.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Representation of a job that executes on a backend that can generate random numbers."""
def __init__(
self,
initial_wsr: List[int],
wsr: List[List],
job: Union[BaseJob, ManagedJobSet],
shots: int,
saved_fn: Optional[str] =... | code_fim | hard | {
"lang": "python",
"repo": "qiskit-community/qiskit_rng",
"path": "/qiskit_rng/generator_job.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qiskit-community/qiskit_rng path: /qiskit_rng/generator_job.py
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory... | code_fim | hard | {
"lang": "python",
"repo": "qiskit-community/qiskit_rng",
"path": "/qiskit_rng/generator_job.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.raw_bits_list = None
self.formatted_wsr = None
self.saved_fn = saved_fn
def block_until_ready(self) -> GeneratorResult:
"""Block until result data is ready.
Returns:
A :class:`GeneratorResult` instance that contains information
nee... | code_fim | hard | {
"lang": "python",
"repo": "qiskit-community/qiskit_rng",
"path": "/qiskit_rng/generator_job.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gauravsingh58/algo path: /codeEval/easy/max_range_sum.py
import sys
with open(sys.argv[1], 'rb') as test_cases:
for test in test_c<|fim_suffix|> s += (e - ls[i - n])
m = max(m, s)
print(max(m, 0))<|fim_middle|>ases:
n, ls = test.split(';')
n, ls = ... | code_fim | medium | {
"lang": "python",
"repo": "gauravsingh58/algo",
"path": "/codeEval/easy/max_range_sum.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> s += (e - ls[i - n])
m = max(m, s)
print(max(m, 0))<|fim_prefix|># repo: gauravsingh58/algo path: /codeEval/easy/max_range_sum.py
import sys
with open(sys.argv[1], 'rb') as test_cases:
for test in test_cases:
n, ls = test.split(';')
n, ls = int(n), map(in... | code_fim | medium | {
"lang": "python",
"repo": "gauravsingh58/algo",
"path": "/codeEval/easy/max_range_sum.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markbrockettrobson/SplendorBots path: /splendor_sim/test/action/test_discard_coins_action.py
import unittest
import unittest.mock as mock
import splendor_sim.interfaces.coin.i_coin_reserve as i_coin_reserve
import splendor_sim.interfaces.coin.i_coin_type as i_coin_type
import splendor_sim.interf... | code_fim | hard | {
"lang": "python",
"repo": "markbrockettrobson/SplendorBots",
"path": "/splendor_sim/test/action/test_discard_coins_action.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_discard_coins_action_execute_coins_added_to_reserve(self):
# Arrange
test_action = discard_coins_action.DiscardCoinsAction(
self._mock_valid_coin_type_set, self._mock_player, self._mock_coins
)
# Act
test_action.execute(self._mock_game_state... | code_fim | hard | {
"lang": "python",
"repo": "markbrockettrobson/SplendorBots",
"path": "/splendor_sim/test/action/test_discard_coins_action.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif shortcut == 'paste':
if editor.cuts:
editor.alter()
if cy == len(editor.buffer): editor.buffer.append('')
editor.buffer = editor.buffer[:cy] + editor.cuts + editor.buffer[c... | code_fim | hard | {
"lang": "python",
"repo": "hourchallenge/nanote",
"path": "/nanote.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hourchallenge/nanote path: /nanote.py
import curses
import re
from editor import Editor
nonwords = ' .,;-_'
def main():
running = True
import settings
default_note = settings.args['default_note']
editor = Editor(default_note)
end_state = None
while running:
... | code_fim | hard | {
"lang": "python",
"repo": "hourchallenge/nanote",
"path": "/nanote.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_pd_write_pickle(self):
d=pd_read_pickle("data/test.pd")#create_fake_pupildata(ntrials=10)
fpath=tempfile.mkdtemp()
fname=os.path.join(fpath, "test2.pd")
pd_write_pickle(d, fname)
x=pd_read_pickle(fname)
self.assertEqual(x.size_bytes(), d.size_by... | code_fim | medium | {
"lang": "python",
"repo": "ihrke/pypillometry",
"path": "/pypillometry/tests/test_io.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ihrke/pypillometry path: /pypillometry/tests/test_io.py
import unittest
import tempfile
import os, pickle, hashlib
import sys
#sys.path.insert(0,"..")
#import pypillometry as pp
from .. import *
<|fim_suffix|> def test_pd_write_pickle(self):
d=pd_read_pickle("data/test.pd")#create_fak... | code_fim | hard | {
"lang": "python",
"repo": "ihrke/pypillometry",
"path": "/pypillometry/tests/test_io.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
-------
dict
Dictionary containing information for this stack item.
"""
children = [] if children is None else children
viewers = [] if viewers is None else viewers
return {
'id': str(uuid.uuid4()),
'conta... | code_fim | hard | {
"lang": "python",
"repo": "nmearl/jdaviz",
"path": "/jdaviz/app.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_data(self, data, data_label):
"""
Add data to the Glue ``DataCollection``.
Parameters
----------
data : any
Data to be stored in the ``DataCollection``. This must either be
a `~glue.core.data.Data` instance, or an arbitrary data ... | code_fim | hard | {
"lang": "python",
"repo": "nmearl/jdaviz",
"path": "/jdaviz/app.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nmearl/jdaviz path: /jdaviz/app.py
configuration file.
data_label : str, optional
Optionally provide a label to retrieve a specific data set from the
viewer instance.
Returns
-------
data : dict
A dict of the transformed Glue su... | code_fim | hard | {
"lang": "python",
"repo": "nmearl/jdaviz",
"path": "/jdaviz/app.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> testbench.write(' clk = !clk;\n')
testbench.write(' top->clk = clk;\n')
testbench.write(' top->eval();\n')
testbench.write('\n')
testbench.write(' clk = !clk;\n')
testbench.write(' top->clk = clk;\n')
testbench.write(' top->eval();\n')
testbench.write('\n')... | code_fim | hard | {
"lang": "python",
"repo": "YikeZhou/Coppelia",
"path": "/script/multi/genRst.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> testbench.write(' rst = 1;\n')
testbench.write(' clk = 1;\n')
testbench.write(' top->rst = rst;\n')
testbench.write('\n')
testbench.write(' clk = !clk;\n')
testbench.write(' top->clk = clk;\n')
testbench.write(' top->eval();\n')
testbench.write('\n')
testb... | code_fim | hard | {
"lang": "python",
"repo": "YikeZhou/Coppelia",
"path": "/script/multi/genRst.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YikeZhou/Coppelia path: /script/multi/genRst.py
import os
import sys
import argparse
signals_except_1 = [
'top->__VlSymsp->TOP__or1200_cpu__or1200_except.__PVT__delayed1_ex_dslot',
'top->__VlSymsp->TOP__or1200_cpu__or1200_except.ex_dslot'
]
signals_except_2 = [
'... | code_fim | hard | {
"lang": "python",
"repo": "YikeZhou/Coppelia",
"path": "/script/multi/genRst.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> stopwords = []
f = open(os.path.join(path, file_name), "rb")
for word in f:
stopwords.append(word.strip().decode("utf-8"))
return stopwords
if __name__ == '__main__':
warnings.filterwarnings("ignore")
# lsi.index_to_db()
try:
engine = create_engine('mysql://root... | code_fim | hard | {
"lang": "python",
"repo": "assulthoni/cms_lsi",
"path": "/cms-laravel-python/app/lsi-script/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: assulthoni/cms_lsi path: /cms-laravel-python/app/lsi-script/main.py
from lsi import LSI
import warnings
import PyPDF2
import os
import sys
import json
from sqlalchemy import create_engine
def extract_pdf_to_list(path, file_name):
"""
input : path of file
output : list of pages conta... | code_fim | hard | {
"lang": "python",
"repo": "assulthoni/cms_lsi",
"path": "/cms-laravel-python/app/lsi-script/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vincent-lg/bui path: /bui/specific/wx4/context.py
"""The wxPython implementation of a BUI context menu widget."""
<|fim_suffix|>class WX4Context(SpecificContext):
def _init(self):
"""Initialize the context menu."""
self.wx_menu = wx.Menu()<|fim_middle|>import wx
from bui.sp... | code_fim | medium | {
"lang": "python",
"repo": "vincent-lg/bui",
"path": "/bui/specific/wx4/context.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _init(self):
"""Initialize the context menu."""
self.wx_menu = wx.Menu()<|fim_prefix|># repo: vincent-lg/bui path: /bui/specific/wx4/context.py
"""The wxPython implementation of a BUI context menu widget."""
<|fim_middle|>import wx
from bui.specific.base import *
from bui.specif... | code_fim | medium | {
"lang": "python",
"repo": "vincent-lg/bui",
"path": "/bui/specific/wx4/context.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if options.chrom and options.gtf and options.feature:
chromsizefile = open(options.chrom, 'r')
chrom_sizes = {}
for line in chromsizefile:
line = line.split('\t')
chrom_sizes[line[0]] = line[1].rstrip("\n")
feature = options.feature
if ... | code_fim | hard | {
"lang": "python",
"repo": "lorde-collab/BAM2GFF",
"path": "/bin/BAM2GFF_gtftogenes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lorde-collab/BAM2GFF path: /bin/BAM2GFF_gtftogenes.py
#!/usr/bin/env python3
'''
Generate genomic coordinates of all promoters, 5'UTR, 3'UTR, CDS
'''
import os
import argparse
if not os.path.exists('annotation'):
os.makedirs('annotation')
#initialize outputfiles
PSEUDOGFF = open('annot... | code_fim | hard | {
"lang": "python",
"repo": "lorde-collab/BAM2GFF",
"path": "/bin/BAM2GFF_gtftogenes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if options.gtf.split('.')[-1] == 'gff':
gff_file = open(options.gtf, 'r')
for line in gff_file:
if not line.startswith('#'):
lines = line.split("\t")
if lines[2] == feature:
results = ("chr{0}\t{1}".for... | code_fim | hard | {
"lang": "python",
"repo": "lorde-collab/BAM2GFF",
"path": "/bin/BAM2GFF_gtftogenes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app = Dash(
__name__,
external_stylesheets=[
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css",
],
external_scripts=[
"https://code.jquery.com/jquery-3.5.1.slim.min.js",
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.m... | code_fim | hard | {
"lang": "python",
"repo": "elben10/dash-data-table",
"path": "/examples/remote_pagination.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
app = Dash(
__name__,
external_stylesheets=[
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css",
],
external_scripts=[
"https://code.jquery.com/jquery-3.5.1.slim.min.js",
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.... | code_fim | hard | {
"lang": "python",
"repo": "elben10/dash-data-table",
"path": "/examples/remote_pagination.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elben10/dash-data-table path: /examples/remote_pagination.py
import random
import time
import dash_html_components as html
from dash import Dash
from dash.dependencies import Input, Output
from dash_data_table import DashDataTable
TITLE = "Remote Pagination"
DESCRIPTION = "Enable pagination usi... | code_fim | hard | {
"lang": "python",
"repo": "elben10/dash-data-table",
"path": "/examples/remote_pagination.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.size_average:
loss = batch_loss.mean()
else:
loss = batch_loss.sum()
return loss
def accuracy(pred, target, topk=1):
if isinstance(topk, int):
topk = (topk, )
return_single = True
maxk = max(topk)
_, pred_label = pred.t... | code_fim | hard | {
"lang": "python",
"repo": "SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019",
"path": "/losses.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(TalyorCrossEntroyLoss, self).__init__()
def forward(self, logits, labels):
#batch_size, num_classes = logits.size()
# labels = labels.view(-1,1)
# logits = logits.view(-1,num_classes)
talyor_exp = 1 + logits + logits**2
loss = talyor_exp.gather(... | code_fim | hard | {
"lang": "python",
"repo": "SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019",
"path": "/losses.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019 path: /losses.py
# TODO merge naive and weighted loss.
import torch
import torch.nn.functional as F
from torch import nn
import torch
import torch.nn.functional as F
from torch.autograd import Variable
class FocalLoss... | code_fim | hard | {
"lang": "python",
"repo": "SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019",
"path": "/losses.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
A simple endpoint that allows to retrieve geo-location information for a specific IP address.
"""
def get(self, *args, **kwargs):
ip_address = kwargs.get('ip_address')
# If the app is running behind a proxy we have to check for the X-Forwarded-For header
if not ... | code_fim | medium | {
"lang": "python",
"repo": "chpmrc/django-easygeoip",
"path": "/easygeoip/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chpmrc/django-easygeoip path: /easygeoip/views.py
import json
import logging
from django.contrib.gis.geoip import GeoIP, GeoIPException
from django.http import HttpResponse
from django.views.generic import View
from easygeoip.settings import get_geoip_path
<|fim_suffix|>
logger = logging.getLogg... | code_fim | hard | {
"lang": "python",
"repo": "chpmrc/django-easygeoip",
"path": "/easygeoip/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: inferno-pytorch/neurofire path: /neurofire/models/unet_multiscale/unet_3d_multiscale.py
import torch.nn as nn
from ..unet.base import XcoderResidual
from ..unet.unet_3d import Output, CONV_TYPES, Encoder, Decoder, get_sampler, get_pooler
from .base import UNetSkeletonMultiscale
from inferno.exten... | code_fim | hard | {
"lang": "python",
"repo": "inferno-pytorch/neurofire",
"path": "/neurofire/models/unet_multiscale/unet_3d_multiscale.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Build decoders (same number of feature maps as MALA)
f2d = initial_num_fmaps * fmap_growth**2
f1d = initial_num_fmaps * fmap_growth
f0d = initial_num_fmaps
# NOTE we need seperate samplers for consistent multi-scale
decoders = [
decoder_type(f0... | code_fim | hard | {
"lang": "python",
"repo": "inferno-pytorch/neurofire",
"path": "/neurofire/models/unet_multiscale/unet_3d_multiscale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkady-gonoskov/pyHiChi path: /example-tests/example_ensemble.py
import pyHiChi as pfc
# Ensemble
Ensemble = pfc.ensemble()
for i in range(11) :
pos = pfc.vector3d(1.2*i, 1.3*i, 1.6*i)
mo = pfc.vector3d(1.1*i, 1.4*i, 1.5*i)
newP = pfc.particle(pos, mo, 0.5, pfc.Electron)
Ensemble.add(newP)
... | code_fim | hard | {
"lang": "python",
"repo": "arkady-gonoskov/pyHiChi",
"path": "/example-tests/example_ensemble.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('Positions Electron: ')
for elem in Ensemble[pfc.Electron] :
print(elem.getPosition())
positronArray = Ensemble[pfc.Positron]
print('Position second Positron')
print(positronArray[1].getPosition())<|fim_prefix|># repo: arkady-gonoskov/pyHiChi path: /example-tests/example_ensemble.py
import pyHi... | code_fim | hard | {
"lang": "python",
"repo": "arkady-gonoskov/pyHiChi",
"path": "/example-tests/example_ensemble.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
newTeamMember = SiteSubscribers()
newTeamMember.email = request.POST.get('email')
newTeamMember.status = True if request.POST.get('active') else False
newTeamMember.save()
return redirect(reverse('eLearn:elearn.home'))
elif reque... | code_fim | medium | {
"lang": "python",
"repo": "Shehab-Magdy/Ayrid_E-Learn-master",
"path": "/eLearn/views/subscribers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shehab-Magdy/Ayrid_E-Learn-master path: /eLearn/views/subscribers.py
from eLearn.models import SiteSubscribers
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
from django.urls import revers... | code_fim | medium | {
"lang": "python",
"repo": "Shehab-Magdy/Ayrid_E-Learn-master",
"path": "/eLearn/views/subscribers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for method in ['state-of-the-art','race-aware','race-unaware']:
print(f'============ {method} ============')
if method == 'state-of-the-art':
# will likely result in lowest cost but highest racial disparity
ofv, opt_gap, sol, time = stoch.optimally_schedule(show_probs, wtc, otc + i... | code_fim | hard | {
"lang": "python",
"repo": "samorani/Social-Justice-Appointment-Scheduling",
"path": "/src/tutorial.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samorani/Social-Justice-Appointment-Scheduling path: /src/tutorial.py
from sklearn.cluster import KMeans
import cplex as cp
import stochastic as stoch
import stochastic2 as stoch2
import race_unaware_stochastic as race_unaware_stoch
import pandas as pd
import numpy as np
np.random.seed(0)
####... | code_fim | hard | {
"lang": "python",
"repo": "samorani/Social-Justice-Appointment-Scheduling",
"path": "/src/tutorial.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(4,n+1):
if not i%2: #if i is even
j = i//2
if not (j)%2: #if i/2 is even
a = c[j-1]*2
else:
a = c[j-1]
s = s%M + a%M
else: #if i is odd
if i in P:
a = (1... | code_fim | hard | {
"lang": "python",
"repo": "rexfordcode/codeFights-1",
"path": "/determinantOne.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rexfordcode/codeFights-1 path: /determinantOne.py
from functools import reduce
def determinantOne(n):
M = 10**9+7
c = [20,32,64] #first three answers used to seed subsequent values
o = 0
l = 64
a = 0
s = sum(c)
#find all primes between 3 and n - this is a... | code_fim | hard | {
"lang": "python",
"repo": "rexfordcode/codeFights-1",
"path": "/determinantOne.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evidawei/Hacktoberfest2021-2 path: /Python/bubblesort.py
def bubbleSort( theSeq ):
n = len( theSeq )
for i in range( n - 1 ) :
flag = 0
for j in range(n - 1) :
if theSeq[j] > theSeq[j + 1] :
tmp = theSeq[j]
theSeq... | code_fim | medium | {
"lang": "python",
"repo": "evidawei/Hacktoberfest2021-2",
"path": "/Python/bubblesort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return theSeq
el = [21,6,9,33,3]
result = bubbleSort(el)
print (result)<|fim_prefix|># repo: evidawei/Hacktoberfest2021-2 path: /Python/bubblesort.py
def bubbleSort( theSeq ):
n = len( theSeq )
for i in range( n - 1 ) :
flag = 0
for j in range(n - 1) :
... | code_fim | easy | {
"lang": "python",
"repo": "evidawei/Hacktoberfest2021-2",
"path": "/Python/bubblesort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Christophe-Foyer/maui63_postprocessing path: /maui63_postprocessing/data/uav_import.py
from __future__ import annotations
from typing import Union
import time
import pandas as pd
from moviepy.video.VideoClip import VideoClip
from moviepy.editor import VideoFileClip
import datetime
from tqdm impo... | code_fim | hard | {
"lang": "python",
"repo": "Christophe-Foyer/maui63_postprocessing",
"path": "/maui63_postprocessing/data/uav_import.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert isinstance(video, VideoClip) or isinstance(video, str), \
"'video' must be of type VideoClip or the path to a video file"
if isinstance(video, VideoClip):
self.video = video
elif isinstance(video, str):
self.video = VideoFileC... | code_fim | hard | {
"lang": "python",
"repo": "Christophe-Foyer/maui63_postprocessing",
"path": "/maui63_postprocessing/data/uav_import.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(video, VideoClip):
self.video = video
elif isinstance(video, str):
self.video = VideoFileClip(video)
super().__init__(logfile, **kwargs,)
if __name__ == '__main__':
log = '../../../drone_Xavier_log_27.01.2021.... | code_fim | hard | {
"lang": "python",
"repo": "Christophe-Foyer/maui63_postprocessing",
"path": "/maui63_postprocessing/data/uav_import.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohammad-yazdani/gatekeeper path: /application/analytics/Controller.py
import sys
from Functions.Catalog import Catalog
from Engine.DataEngine import DataEngine
from Services.Export import Export
class Controller:
def __init__(self, destination: str, procedures: list=None):
Catalog()
sel... | code_fim | hard | {
"lang": "python",
"repo": "mohammad-yazdani/gatekeeper",
"path": "/application/analytics/Controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def update(json: str, options: str):
return DataEngine.update_excel(json, options)
def export(self):
export = Export(self.output, sys.argv[len(sys.argv) - 1], self.coordinates)
return export<|fim_prefix|># repo: mohammad-yazdani/gatekeeper path: /application/analytics/Controller.p... | code_fim | medium | {
"lang": "python",
"repo": "mohammad-yazdani/gatekeeper",
"path": "/application/analytics/Controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig = plt.figure(figsize=(9, 4))
for i, hrf_model in enumerate(hrf_models):
# obtain the signal of interest by convolution
signal, name = hemodynamic_models.compute_regressor(
exp_condition, hrf_model, frame_times, con_id='main',
oversampling=16)
# plot this
plt.subplot(1,... | code_fim | hard | {
"lang": "python",
"repo": "mwegrzyn/nistats",
"path": "/examples/04_low_level_functions/plot_hrf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwegrzyn/nistats path: /examples/04_low_level_functions/plot_hrf.py
"""Example of hemodynamic reponse functions.
=========================================
Within this example we are going to plot the hemodynamic reponse function (hrf) model in SPM together with
the hrf shape proposed by G.Glover... | code_fim | hard | {
"lang": "python",
"repo": "mwegrzyn/nistats",
"path": "/examples/04_low_level_functions/plot_hrf.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jenniferdebor/leo_segmentation path: /leo_segmentation/run.py
# Entry point for the project
import torch
<|fim_suffix|>def main():
model_path = "model_path"
train_model(model_path)
if __name__ == "__main__":
main()<|fim_middle|>def train_model(saved_model_path:str):
print(f"I am... | code_fim | medium | {
"lang": "python",
"repo": "jenniferdebor/leo_segmentation",
"path": "/leo_segmentation/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_prefix|># repo: jenniferdebor/leo_segmentation path: /leo_segmentation/run.py
# Entry point for the project
import torch
<|fim_middle|>def train_model(saved_model_path:str):
print(f"I am training a model saved at {saved_model_path}")
return
def main():... | code_fim | medium | {
"lang": "python",
"repo": "jenniferdebor/leo_segmentation",
"path": "/leo_segmentation/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mfthomps/RESim path: /simics/bin/dataDiff.py
#!/usr/bin/env python3
#
#
'''
Compare trackio data recorded for a set of AFL sessions. Compare each file to every other file
and note differences.
'''
import sys
import os
import glob
import json
from collections import OrderedDict
import argparse
im... | code_fim | hard | {
"lang": "python",
"repo": "mfthomps/RESim",
"path": "/simics/bin/dataDiff.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if retval is None and len(items2) > len(items1):
hit2, cycle2 = items2[len(items1)]
hit2 = int(hit1)
cksum = hashval.hexdigest()
addSplit(index, None, None, cksum)
addSplit(index, hit2, cycle2, cksum)
retval = cycle2
return retval, cksum
def getTra... | code_fim | hard | {
"lang": "python",
"repo": "mfthomps/RESim",
"path": "/simics/bin/dataDiff.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FowlPS/lpot path: /lpot/pipelines/sklearn_wrappers/sklearn_classifier_wrapper.py
from typing import Tuple
from lpot.pipelines.sklearn_wrappers import sklearn_transformer_wrapper
from lpot.pipelines.layers.layer_element import ClassifierElement
class SklearnClassifierWrapper(sklearn_transformer... | code_fim | medium | {
"lang": "python",
"repo": "FowlPS/lpot",
"path": "/lpot/pipelines/sklearn_wrappers/sklearn_classifier_wrapper.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.sklearn_object.predict_proba(x)
def get_complexity(self, x: Tuple) -> Tuple[int, Tuple]:
return x[0] * x[1], (x[0], 2)
def get_classes(self):
return list(self.sklearn_object.classes_)<|fim_prefix|># repo: FowlPS/lpot path: /lpot/pipelines/sklearn_wrappers/skl... | code_fim | medium | {
"lang": "python",
"repo": "FowlPS/lpot",
"path": "/lpot/pipelines/sklearn_wrappers/sklearn_classifier_wrapper.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_complexity(self, x: Tuple) -> Tuple[int, Tuple]:
return x[0] * x[1], (x[0], 2)
def get_classes(self):
return list(self.sklearn_object.classes_)<|fim_prefix|># repo: FowlPS/lpot path: /lpot/pipelines/sklearn_wrappers/sklearn_classifier_wrapper.py
from typing import Tuple
... | code_fim | medium | {
"lang": "python",
"repo": "FowlPS/lpot",
"path": "/lpot/pipelines/sklearn_wrappers/sklearn_classifier_wrapper.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Move(models.Model):
x = models.IntegerField(
validators=[MinValueValidator(0), MaxValueValidator(BOARD_SIZE - 1)])
y = models.IntegerField(
validators=[MinValueValidator(0), MaxValueValidator(BOARD_SIZE - 1)])
comment = models.CharField(max_length=300)
game = models.... | code_fim | hard | {
"lang": "python",
"repo": "t7y/django-fundamentals",
"path": "/tictactoe/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: t7y/django-fundamentals path: /tictactoe/models.py
from django.db import models
from django.contrib.auth.models import User
from django.db.models import Q
from django.core.urlresolvers import reverse
from django.core.validators import MinValueValidator, MaxValueValidator
GAME_STATUS_CHOICES = (
... | code_fim | hard | {
"lang": "python",
"repo": "t7y/django-fundamentals",
"path": "/tictactoe/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Gravitational shear
ellip_gal = ellip_gal.shear(g1=g1, g2=g2)
return (ellip_gal, e1, e2, g1, g2)
def __generateRandomShift(self, ud):
rsq = 2 * self.galData.shiftRadiusSQ
dx = 1
dy = 1
while (rsq > self.galData.shiftRadiusSQ):
dx... | code_fim | hard | {
"lang": "python",
"repo": "Brent-rb/lens_net",
"path": "/generate_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subprocess.check_call(["stiff", psfFitsPath])
os.rename("stiff.tif", psfTifPath)
subprocess.check_call(["stiff", galFitsPath])
os.rename("stiff.tif", galTifPath)
except:
pass
jsonFile = open(os.path.join(outputFo... | code_fim | hard | {
"lang": "python",
"repo": "Brent-rb/lens_net",
"path": "/generate_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Brent-rb/lens_net path: /generate_data.py
import sys
import os
import math
import numpy
import logging
import time
import galsim
import struct
import random
import json
import subprocess
import argparse
import pathlib
class PSF:
def __init__(self, beta = 3, fwhm = 2.85, e1 = -0.019, e2 = -0.... | code_fim | hard | {
"lang": "python",
"repo": "Brent-rb/lens_net",
"path": "/generate_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HPCC-Cloud-Computing/bioinformatics-dashboard path: /bioinformatics/gojs_parser/parser.py
# 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/l... | code_fim | hard | {
"lang": "python",
"repo": "HPCC-Cloud-Computing/bioinformatics-dashboard",
"path": "/bioinformatics/gojs_parser/parser.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> json_path=constants.JSON_PATH):
with open(json_path) as data_file:
data = json.load(data_file)
return ast.literal_eval(data)
def get_node_data(self):
node_datas = self.read_json()["nodeDataArray"]
for i in range(0, len(node_datas)):
... | code_fim | hard | {
"lang": "python",
"repo": "HPCC-Cloud-Computing/bioinformatics-dashboard",
"path": "/bioinformatics/gojs_parser/parser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gadventures/gapipy path: /gapipy/models/room.py
from .addon import AddOn
from .price_band import PriceBand, SeasonalPriceBand
from .base import BaseModel
from ..utils import enforce_string_type
class Room(BaseModel):
_as_is_fields = ['availability', 'code', 'name']
@property
def _m... | code_fim | medium | {
"lang": "python",
"repo": "gadventures/gapipy",
"path": "/gapipy/models/room.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class DepartureRoom(Room):
@property
def _as_is_fields(self):
return super(DepartureRoom, self)._as_is_fields + [
'flags',
]
@property
def _model_collection_fields(self):
return super(DepartureRoom, self)._model_collection_fields + [
('addo... | code_fim | hard | {
"lang": "python",
"repo": "gadventures/gapipy",
"path": "/gapipy/models/room.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: controversial/ui2 path: /ui2/view_classes/TableView.py
"""A high-level wrapper around the whole ui.TableView system."""
import ui
import collections
class Cell():
"""A single cell in a ui.TableView.
This class "subclasses" ui.TableViewCell by wrapping it.
"""
def __init__(self... | code_fim | hard | {
"lang": "python",
"repo": "controversial/ui2",
"path": "/ui2/view_classes/TableView.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add(self, cell):
self.cells.add(key)
def discard(self, cell):
self.cells.discard(cell)
class TableView(collections.Container):
"""A view to display a list of items in a single column."""
def __init__(self):
self.sections = [Section(self)]
def __contains_... | code_fim | hard | {
"lang": "python",
"repo": "controversial/ui2",
"path": "/ui2/view_classes/TableView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LolloCappo/Thermoelasticity-Interactive-Analysis path: /pytsa.py
hermal video
in the sets area, close to the set frequency (fr).
Input:
- (xi,yi,xf,yf) --> coordinates of the edges of rettangle [pixel]
- fr --> the set frequency for reference si... | code_fim | hard | {
"lang": "python",
"repo": "LolloCappo/Thermoelasticity-Interactive-Analysis",
"path": "/pytsa.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LolloCappo/Thermoelasticity-Interactive-Analysis path: /pytsa.py
,xf,yf,ni = 0,view = False):
'''
Function that sets the Region Of Interest (ROI) in which to perform the analysis.
Input:
- (xi,yi,xf,yf) --> coordinates of the edges of rettangle [pixel]
... | code_fim | hard | {
"lang": "python",
"repo": "LolloCappo/Thermoelasticity-Interactive-Analysis",
"path": "/pytsa.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_cmap_lim(self,lim_inf=None,lim_sup=None,reset=False,interactive=False):
t_lim_inf_temp,t_lim_sup_temp = set_clim(self.__map_amplitude)
if not(reset):
if lim_sup is None:
self.__t_lim_sup = t_lim_sup_temp
if lim_inf is None:
... | code_fim | hard | {
"lang": "python",
"repo": "LolloCappo/Thermoelasticity-Interactive-Analysis",
"path": "/pytsa.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.info("start preprocess..")
try:
caller.call_vba_macro(os.path.abspath(preprocess_xl), macro_name)
logging.info("preprocess finished")
try:
logging.info("start Python -> SQL..")
d.start()
except:
logging.info("Pytho... | code_fim | hard | {
"lang": "python",
"repo": "AuroraBoreas/pypj_sonic_pc",
"path": "/20220107 WW_Pmod_SMLD_Control_System/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AuroraBoreas/pypj_sonic_pc path: /20220107 WW_Pmod_SMLD_Control_System/main.py
import sys
sys.path.append('.')
from lib.core import Director, Smld, Builder
from lib.utility.types import logging, os
from lib.vba import caller
from lib.query import query
from lib.config.config import (
... | code_fim | medium | {
"lang": "python",
"repo": "AuroraBoreas/pypj_sonic_pc",
"path": "/20220107 WW_Pmod_SMLD_Control_System/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zommiommy/soap_incident_client path: /soap_incident_client/utils/logger.py
import os
import sys
import logging
logger = logging.getLogger(__name__)
logging.addLevelName(logging.WARNING, 'WARN')
def setup_logger(log_level=logging.INFO):
<|fim_suffix|> formatter = logging.Formatter("%(levelnam... | code_fim | easy | {
"lang": "python",
"repo": "zommiommy/soap_incident_client",
"path": "/soap_incident_client/utils/logger.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.