text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> X,y = build_data(args.data_path)
X_xgb = xgb.DMatrix(X, label=y)
print("\n=== mlflow.xgboost.load_model")
model = mlflow.xgboost.load_model(args.model_uri)
print("model:", model)
predictions = model.predict(X_xgb)
print("predictions.type:", type(predictions))
prin... | code_fim | hard | {
"lang": "python",
"repo": "Teora/mlflow-examples",
"path": "/python/xgboost/predict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = models.OneToOneField(User, on_delete=models.CASCADE)
type = models.BooleanField(default=True)
def __str__(self):
return self.user.username<|fim_prefix|># repo: bochra998/Quiz-web-application path: /quizapp/quiz/models.py
from django.contrib.auth.models import User
from django.... | code_fim | medium | {
"lang": "python",
"repo": "bochra998/Quiz-web-application",
"path": "/quizapp/quiz/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bochra998/Quiz-web-application path: /quizapp/quiz/models.py
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
<|fim_suffix|> user = models.OneToOneField(User, on_delete=models.CASCADE)
type = models.BooleanField(default=True)
def __... | code_fim | hard | {
"lang": "python",
"repo": "bochra998/Quiz-web-application",
"path": "/quizapp/quiz/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Users(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
type = models.BooleanField(default=True)
def __str__(self):
return self.user.username<|fim_prefix|># repo: bochra998/Quiz-web-application path: /quizapp/quiz/models.py
from django.contrib.auth.mode... | code_fim | medium | {
"lang": "python",
"repo": "bochra998/Quiz-web-application",
"path": "/quizapp/quiz/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def optim_state_to_sharding_state(optim_state_dict: StateDict, id_to_sharded_param_map: Dict[int, ShardedTensor]):
sharded_state = {}
for param_id, param_state in optim_state_dict['state'].items():
sharded_state[param_id] = {}
for state_key, param in param_state.items():
... | code_fim | hard | {
"lang": "python",
"repo": "mlcommons/training",
"path": "/large_language_model/megatron-lm/megatron/core/dist_checkpointing/optimizer.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlcommons/training path: /large_language_model/megatron-lm/megatron/core/dist_checkpointing/optimizer.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
""" Optimizer related helpers. """
from copy import deepcopy
from dataclasses import replace
from itertools import chain
from t... | code_fim | hard | {
"lang": "python",
"repo": "mlcommons/training",
"path": "/large_language_model/megatron-lm/megatron/core/dist_checkpointing/optimizer.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Spawn point of the player
valBool = False
for obj in self.tmxData.objects:
if obj.name == "InZone":
if obj.StartPoint == nameInZone:
self.spawmPointPlayerx = obj.x
self.spawmPointPlayery = obj.y
... | code_fim | hard | {
"lang": "python",
"repo": "Bobsleigh/LDEngine",
"path": "/app/mapData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.nameMap = mapName
self.tmxData = pytmx.util_pygame.load_pygame(self.reqImageName(self.nameMap))
self.tiledMapData = pyscroll.data.TiledMapData(self.tmxData)
self.cameraPlayer = pyscroll.BufferedRenderer(self.tiledMapData, screenSize, clamp_camera=True)
# self.... | code_fim | medium | {
"lang": "python",
"repo": "Bobsleigh/LDEngine",
"path": "/app/mapData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bobsleigh/LDEngine path: /app/mapData.py
import pygame
import pyscroll
import pytmx
import re
import pygame
from app.settings import *
from app.tools.functionTools import *
import os
from app.sprites.enemyFactory import EnemyFactory
from app.sprites.itemFactory import ItemFactory
import weakref
... | code_fim | hard | {
"lang": "python",
"repo": "Bobsleigh/LDEngine",
"path": "/app/mapData.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Update the UI for the image browse control"""
index = GK_SHAPE_TYPE.index("image")
if self.m_style_ctrl.GetSelection() == GK_SHAPE_TYPE.index("image"):
event.Enable(True)
else:
event.Enable(False)
def TransferDataToWindow(self):
if se... | code_fim | hard | {
"lang": "python",
"repo": "terranum-ch/GraphLink",
"path": "/graphlink/ui/gkui_node_dlg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: terranum-ch/GraphLink path: /graphlink/ui/gkui_node_dlg.py
#!/urs/bin/python
import wx
from ..core.gk_node import GKNode, GK_SHAPE_TYPE
class GKUINodeEditDialog(wx.Dialog):
def __init__(self, parent, node):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Edit Node", pos=wx.De... | code_fim | hard | {
"lang": "python",
"repo": "terranum-ch/GraphLink",
"path": "/graphlink/ui/gkui_node_dlg.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pronouns = gender_struct(player.gender)
intro = f"\tThere was smoke coming from over the hill...... That was strange to {player.name} because it wasn't time " \
f"for dinner and it was too hot to just have a fire going. {player.name}'s mind started to race thinking maybe the " \
f"... | code_fim | medium | {
"lang": "python",
"repo": "gitgamedev/WordRPG",
"path": "/script/Story.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gitgamedev/WordRPG path: /script/Story.py
from script import Screen
class gender_struct:
def __init__(self, gender):
is_female = gender == "female"
self.he_she = 'she' if is_female else 'he'
self.him_her = 'her' if is_female else 'him'
self.his_her = 'her' if... | code_fim | medium | {
"lang": "python",
"repo": "gitgamedev/WordRPG",
"path": "/script/Story.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> params=grid_search.best_params_
#clf=xgboost.XGBRFClassifier(**params,n_estimators=100,n_jobs=-1,random_state=42)
clf=xgboost.XGBClassifier(**params)
clf.fit(X_train_trans,y_train,early_stopping_rounds=10,eval_set=[(X_val_trans,y_val)])
y_test=test['bowties']
X_test=test.... | code_fim | hard | {
"lang": "python",
"repo": "Ohki-ki/bowtie-defect-identification",
"path": "/09_XGBC_img.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> y_test=test['bowties']
X_test=test.drop(columns='bowties')
X_test=pipeline.fit_transform(X_test)
y_preds=clf.predict(X_test)
F_CV=grid_search.best_score_
P,R,F=precision_score(y_test,y_preds),recall_score(y_test,y_preds),f1_score(y_test,y_preds)
print(P,R,F,F_CV,... | code_fim | hard | {
"lang": "python",
"repo": "Ohki-ki/bowtie-defect-identification",
"path": "/09_XGBC_img.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ohki-ki/bowtie-defect-identification path: /09_XGBC_img.py
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 19:17:34 2019
@author: Logan Rowe
"""
import numpy as np
import os
import sys
import pandas as pd
from pandas.plotting import scatter_matrix
from sklearn.ensemble import RandomForestCla... | code_fim | hard | {
"lang": "python",
"repo": "Ohki-ki/bowtie-defect-identification",
"path": "/09_XGBC_img.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>usernames = ['hannah', 'ty', 'margot'] #1
greet_users(usernames)<|fim_prefix|># repo: hahapang/py_tutor path: /greet_users.py
# ПЕРЕДАЧА СПИСКА.
# Функция greet_users() рассчитывает получить список имен,
# который сохраняется в парамете nemes. Функция перебирает
# полученный список и выводит приветсвие ... | code_fim | medium | {
"lang": "python",
"repo": "hahapang/py_tutor",
"path": "/greet_users.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hahapang/py_tutor path: /greet_users.py
# ПЕРЕДАЧА СПИСКА.
# Функция greet_users() рассчитывает получить список имен,
# который сохраняется в парамете nemes. Функция перебирает
# полученный список и выводит приветсвие для каждого пользователя.
# В (1) мы определяем список пользователей usernames... | code_fim | medium | {
"lang": "python",
"repo": "hahapang/py_tutor",
"path": "/greet_users.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get(self):
greeting = db.get(self.request.get("img_id"))
if greeting.avatar:
self.response.headers['Content-Type'] = "image/png"
self.response.out.write(greeting.avatar)
else:
self.response.out.write("No image")
class Guestbook(weba... | code_fim | hard | {
"lang": "python",
"repo": "nlake44/sample-apps",
"path": "/python/memcachebook/memcachebook.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nlake44/sample-apps path: /python/memcachebook/memcachebook.py
import cgi
import datetime
import logging
import StringIO
import time
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run... | code_fim | hard | {
"lang": "python",
"repo": "nlake44/sample-apps",
"path": "/python/memcachebook/memcachebook.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> greeting = Greeting()
if users.get_current_user():
greeting.author = users.get_current_user()
greeting.content = self.request.get('content')
if self.request.get("img"):
avatar = images.resize(self.request.get("img"), 32, 32)
greeting.avatar = db.Blob(avatar)
greetin... | code_fim | hard | {
"lang": "python",
"repo": "nlake44/sample-apps",
"path": "/python/memcachebook/memcachebook.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cjuanito797/groupProject path: /chinesseRestaurant/urls.py
from django.contrib.auth import views as auth_views
from django.urls import path, re_path
from . import views
<|fim_suffix|>urlpatterns = [
path('', views.covidWarning, name='covidWarning'),
re_path('home/', views.home, name='ho... | code_fim | medium | {
"lang": "python",
"repo": "cjuanito797/groupProject",
"path": "/chinesseRestaurant/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('', views.covidWarning, name='covidWarning'),
re_path('home/', views.home, name='home'),
path('customerView/', views.customerView, name='customerView'),
# path('signup/', views.signup, name='signup'),
path('register/', views.register, name='register'),
path('lo... | code_fim | medium | {
"lang": "python",
"repo": "cjuanito797/groupProject",
"path": "/chinesseRestaurant/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Madrox/Winston path: /winston_client/speech.py
import hashlib
from os import system, path
class Speech(object):
def __init__(self):
self.file_path = path.dirname(path.realpath(__file__)) + "/static/"
def hash_file(self, text):
return hashlib.sha224(text).hexdigest() + "... | code_fim | hard | {
"lang": "python",
"repo": "Madrox/Winston",
"path": "/winston_client/speech.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> chime = "mplayer -ao alsa -really-quiet -noconsolecontrols %schime.mp3"
system(chime % (self.file_path))
def say(self, text):
fn = self.make(text)
speech = "mplayer -ao alsa -really-quiet -noconsolecontrols %s%s"
system(speech % (self.file_path, fn))<|fim_prefi... | code_fim | hard | {
"lang": "python",
"repo": "Madrox/Winston",
"path": "/winston_client/speech.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn = self.make(text)
speech = "mplayer -ao alsa -really-quiet -noconsolecontrols %s%s"
system(speech % (self.file_path, fn))<|fim_prefix|># repo: Madrox/Winston path: /winston_client/speech.py
import hashlib
from os import system, path
class Speech(object):
def __init__(self... | code_fim | medium | {
"lang": "python",
"repo": "Madrox/Winston",
"path": "/winston_client/speech.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steveo404/py_projects path: /picturedatacheck.py
import os
import exifread
currentDirectory = "/home/dale/Projects/filetest"
for root, dirs, files in os.walk(currentDirectory):
for picFile in files:
if picFile.endswith(".jpg") or picFile.endswith(".JPG"):
picFileDirector... | code_fim | hard | {
"lang": "python",
"repo": "steveo404/py_projects",
"path": "/picturedatacheck.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(tags) > 10:
if tags['EXIF DateTimeDigitized']:
dateTakenexif = str(tags['EXIF DateTimeDigitized'])
yearTaken = dateTakenexif[0:4]
monthTaken = dateTakenexif[5:7]
print monthTaken<|fi... | code_fim | hard | {
"lang": "python",
"repo": "steveo404/py_projects",
"path": "/picturedatacheck.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def act(self,observation):
"""
Return the current learned max action for this layer. If there's a tie, pick randomly.
"""
maximum_actions = np.argwhere(self.q_table[observation] == np.amax(self.q_table[observation])).flatten()
return(np.random.choice(maximum_act... | code_fim | hard | {
"lang": "python",
"repo": "quinngroup/addf_pomdp",
"path": "/delayed_mcesp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Return the current learned max action for this layer. If there's a tie, pick randomly.
"""
maximum_actions = np.argwhere(self.q_table[observation] == np.amax(self.q_table[observation])).flatten()
return(np.random.choice(maximum_actions))<|fim_prefix|># repo: qui... | code_fim | hard | {
"lang": "python",
"repo": "quinngroup/addf_pomdp",
"path": "/delayed_mcesp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quinngroup/addf_pomdp path: /delayed_mcesp.py
import numpy as np
"""
MCESP for Game-Delayed Reinforcements
"""
class MCESP_D:
def __init__(self, observations, field = np.zeros((1,1))):
"""
Constructor for MCESP-D. Field integration currently stubbed.
Parameters
... | code_fim | medium | {
"lang": "python",
"repo": "quinngroup/addf_pomdp",
"path": "/delayed_mcesp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># For this next step, the private key with correct permissions must be in home dir
# And host checking should be turned off in ssh config
# And the image should auto-start port forwarding on 1080
print "Now opening windows!"
instance = 1
url = "http://whatsmyip.us"
window = "-n"
directory = "--user-data-d... | code_fim | hard | {
"lang": "python",
"repo": "rtsio/dropletlaunch",
"path": "/launch.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rtsio/dropletlaunch path: /launch.py
#!/usr/bin/python
import urllib2
import json
import sys
import time
import subprocess
import os
import binascii
# Launches specified number of Digital Ocean droplets and binds one Chrome instance to each droplet,
# resulting in any number of separate window... | code_fim | hard | {
"lang": "python",
"repo": "rtsio/dropletlaunch",
"path": "/launch.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eclipse-ib/Software-University-Fundamentals_Module path: /03-Lists_Basics/Exercises/5-Faro_Shuffle.py
cards = input().split()
number_of_decks = int(input())
middle_lenght = len(cards) // 2
<|fim_suffix|> res.append(first_card)
res.append(second_card)
cards = res
print(cards)
... | code_fim | hard | {
"lang": "python",
"repo": "eclipse-ib/Software-University-Fundamentals_Module",
"path": "/03-Lists_Basics/Exercises/5-Faro_Shuffle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_index_second_deck = index + middle_lenght
second_card = cards[current_index_second_deck]
res.append(first_card)
res.append(second_card)
cards = res
print(cards)
# index_one = 0
# index_two = len(string_list) // 2
#
#
# for deck in range(0,number_of_decks):
... | code_fim | medium | {
"lang": "python",
"repo": "eclipse-ib/Software-University-Fundamentals_Module",
"path": "/03-Lists_Basics/Exercises/5-Faro_Shuffle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ return the full denominator of the expression"""
l = len(expr)
den = ''
i=0
while i<l:
if expr[i:i+2] == '/(' or expr[i:i+3] == '/ (':
if den != '': den += '*'
den += expr[i+1]
par = 1
i... | code_fim | hard | {
"lang": "python",
"repo": "AdrienLauwers/SEP-oscareducation",
"path": "/algebra/engine/Inequation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdrienLauwers/SEP-oscareducation path: /algebra/engine/Inequation.py
from . import Expression
from sympy import Poly, solve_poly_inequality
# ============================================================================
# ================================ Inequation ==============================... | code_fim | hard | {
"lang": "python",
"repo": "AdrienLauwers/SEP-oscareducation",
"path": "/algebra/engine/Inequation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> majority_ans = torch.argmax(true_answer_ids, dim=-1)
loss = self.criterion(predicted_answers, majority_ans)
self.optimizer.zero_grad()
loss.backward()
self.optimizer.step()
# self._model.fc_ques.weight.data.clamp_(-1500, 1500)
# print(torch.min(sel... | code_fim | hard | {
"lang": "python",
"repo": "ztonege/vqa_pytorch",
"path": "/student_code/simple_baseline_experiment_runner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SandraEtoile/exadel-python-course-2021 path: /tasks/task05/user_factory.py
def create_user(first_name: str, last_name: str, age: int = 42, **kwargs):
return {
"name": first_name,
"surname": last_name,
"age": age,
"extra": kwargs
}
<|fim_suffix|>print(crea... | code_fim | easy | {
"lang": "python",
"repo": "SandraEtoile/exadel-python-course-2021",
"path": "/tasks/task05/user_factory.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print(create_user("John", "Doe"))
print(create_user("Bill", "Gates", age=65))
print(create_user("Marie", "Curie", age=66, occupation="physicist", won_nobel=True))<|fim_prefix|># repo: SandraEtoile/exadel-python-course-2021 path: /tasks/task05/user_factory.py
def create_user(first_name: str, last_name:... | code_fim | medium | {
"lang": "python",
"repo": "SandraEtoile/exadel-python-course-2021",
"path": "/tasks/task05/user_factory.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(create_user("Marie", "Curie", age=66, occupation="physicist", won_nobel=True))<|fim_prefix|># repo: SandraEtoile/exadel-python-course-2021 path: /tasks/task05/user_factory.py
def create_user(first_name: str, last_name: str, age: int = 42, **kwargs):
<|fim_middle|> return {
"name": first_... | code_fim | hard | {
"lang": "python",
"repo": "SandraEtoile/exadel-python-course-2021",
"path": "/tasks/task05/user_factory.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('attempt1', '0005_delete_twonums'),
]
operations = [
migrations.AlterField(
model_name='newnums',
name='numb1',
field=models.FloatField(null=True),
),
migrations.AlterField(
model_name='newnums',... | code_fim | medium | {
"lang": "python",
"repo": "Jinay01/Unicode-Task",
"path": "/try1/attempt1/migrations/0006_auto_20200721_1407.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='newnums',
name='numb1',
field=models.FloatField(null=True),
),
migrations.AlterField(
model_name='newnums',
name='numb2',
field=models.FloatField(null=True)... | code_fim | medium | {
"lang": "python",
"repo": "Jinay01/Unicode-Task",
"path": "/try1/attempt1/migrations/0006_auto_20200721_1407.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jinay01/Unicode-Task path: /try1/attempt1/migrations/0006_auto_20200721_1407.py
# Generated by Django 3.0.8 on 2020-07-21 08:37
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('attempt1', '0005_delete_twonums'),
]
operations = [
migrations.... | code_fim | medium | {
"lang": "python",
"repo": "Jinay01/Unicode-Task",
"path": "/try1/attempt1/migrations/0006_auto_20200721_1407.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pecata83/soft-uni-python-solutions path: /Programing Fundamentals Python/Text Processing/03.py
def replace_all(first, second):
<|fim_suffix|>print(replace_all(input(), input()))<|fim_middle|> if first in second:
second = second.replace(first, "", 1)
return replace_all(first, se... | code_fim | medium | {
"lang": "python",
"repo": "pecata83/soft-uni-python-solutions",
"path": "/Programing Fundamentals Python/Text Processing/03.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(replace_all(input(), input()))<|fim_prefix|># repo: pecata83/soft-uni-python-solutions path: /Programing Fundamentals Python/Text Processing/03.py
def replace_all(first, second):
<|fim_middle|> if first in second:
second = second.replace(first, "", 1)
return replace_all(first, se... | code_fim | medium | {
"lang": "python",
"repo": "pecata83/soft-uni-python-solutions",
"path": "/Programing Fundamentals Python/Text Processing/03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> relative_target = convertTargetPositions(robot)
if relative_target[1] > 0:
orientation = 1
else:
orientation = -1
error_angle = calculateErrorAngle(relative_target,orientation)
error_magnitude = calculateDistance(relative_target)
if len(i_error_distance[robot.id]... | code_fim | medium | {
"lang": "python",
"repo": "unball/system",
"path": "/control/position_control.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: unball/system path: /control/position_control.py
import rospy
from communication.msg import target_positions_msg
from communication.msg import robots_speeds_msg
from math import *
from control_utils import *
orientation = 1
i_error_distance = [[],[],[]]
i_error_angle = [[],[],[]]
integral_distan... | code_fim | hard | {
"lang": "python",
"repo": "unball/system",
"path": "/control/position_control.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def capture():
try:
res, frame = camera.read()
if res:
frame = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
img = PIL.ImageTk.PhotoImage(image=PIL.Image.fromarray(frame))
lbimage.imgtk = img
lbimage.configure(image=img)
root.after(1, ... | code_fim | medium | {
"lang": "python",
"repo": "adnankaya/gui",
"path": "/snippets/webcam_tkinter.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>camera = cv.VideoCapture(CAM_ADRESSES[0])
lbimage = tk.Label()
lbimage.pack(side="top", anchor="center",expand=True, fill="both")
def capture():
try:
res, frame = camera.read()
if res:
frame = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
img = PIL.ImageTk.PhotoImage(i... | code_fim | medium | {
"lang": "python",
"repo": "adnankaya/gui",
"path": "/snippets/webcam_tkinter.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adnankaya/gui path: /snippets/webcam_tkinter.py
# pip install Pillow opencv-python numpy
import tkinter as tk
import cv2 as cv
import PIL.Image
import PIL.ImageTk
root = tk.Tk()
<|fim_suffix|>def capture():
try:
res, frame = camera.read()
if res:
frame = cv.cvtC... | code_fim | medium | {
"lang": "python",
"repo": "adnankaya/gui",
"path": "/snippets/webcam_tkinter.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AtrCheema/AI4Water path: /ai4water/datasets/download_zenodo.py
# The code in this file is modified after
# https://github.com/dvolgyes/zenodo_get/blob/master/zenodo_get/zget.py
import sys
import json
import signal
import time
import hashlib
from contextlib import contextmanager
from .u... | code_fim | hard | {
"lang": "python",
"repo": "AtrCheema/AI4Water",
"path": "/ai4water/datasets/download_zenodo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> remote_hash, local_hash = check_hash(fname, checksum)
if remote_hash == local_hash and cont:
print(f'{fname} is already downloaded correctly.')
continue
for _ in range(retry + 1):
... | code_fim | hard | {
"lang": "python",
"repo": "AtrCheema/AI4Water",
"path": "/ai4water/datasets/download_zenodo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmds.connectAttr(wristIKmainCtrl[0]+'.Up_Stretch', stretchUpMD+'.input1X')
cmds.connectAttr(wristIKmainCtrl[0]+'.Low_Stretch', stretchLowMD+'.input1X')
cmds.connectAttr(distanceMD2+'.outputX', stretchUpMD+'.input2X')
cmds.connectAttr(distanceMD2+'.outputX', stretchLowMD+'.input2X')
... | code_fim | hard | {
"lang": "python",
"repo": "LordOfShrimp/undertheSea",
"path": "/autoRig/ikRibbon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LordOfShrimp/undertheSea path: /autoRig/ikRibbon.py
elecRollEnd = selectedName+rollNamingEnd
if cmds.objExists('spik_GRP') is False:
spikGRP = cmds.group(empty=True, w=True, n='spik_GRP')
else:
spikGRP = cmds.ls('spik_GRP')[0]
#!!!!!!!!!
... | code_fim | hard | {
"lang": "python",
"repo": "LordOfShrimp/undertheSea",
"path": "/autoRig/ikRibbon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LordOfShrimp/undertheSea path: /autoRig/ikRibbon.py
ctedName.split('_')[0] == 'thigh':
sideName = sideName.replace('thigh', 'leg')
elif selectedName.split('_')[0] == 'knee':
sideName = sideName.replace('knee', 'leg')
sideName = sideName.replace('_joint', '... | code_fim | hard | {
"lang": "python",
"repo": "LordOfShrimp/undertheSea",
"path": "/autoRig/ikRibbon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manuelborowski/infoboard path: /app/floating_menu.py
# -*- coding: utf-8 -*-
fmi_edit = {"menu_id": "edit_menu_item", "menu_text": "Pas aan", "route": "edit", "flags": ["id_required"]}
fmi_delete = {"menu_id": "delete_menu_item", "menu_text": "Verwijder", "route": "delete",
"messag... | code_fim | medium | {
"lang": "python",
"repo": "manuelborowski/infoboard",
"path": "/app/floating_menu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin_menu_config = [
fmi_edit,
fmi_copy,
fmi_add,
fmi_view,
fmi_delete,
fmi_change_pwd
]
offence_menu_config = [
fmi_delete
]
register_runner_menu_config = [
fmi_update_rfid,
fmi_delete_rfid,
fmi_delete_time_ran
]<|fim_prefix|># repo: manuelborowski/infoboard pa... | code_fim | medium | {
"lang": "python",
"repo": "manuelborowski/infoboard",
"path": "/app/floating_menu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> from numpy import genfromtxt,unique,where,zeros
import matplotlib.pyplot as plt
f=genfromtxt(rupt)
num=f[:,0]
all_ss=f[:,8]
all_ds=f[:,9]
#Now parse for multiple rupture speeds
unum=unique(num)
ss=zeros(len(unum))
ds=zeros(len(unum))
for k in range(len(unum... | code_fim | hard | {
"lang": "python",
"repo": "degoldbe/mudpyseg",
"path": "/src/python/mudpy/view_segs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f=genfromtxt(rupt)
num=f[:,0]
all_ss=f[:,8]
all_ds=f[:,9]
#Now parse for multiple rupture speeds
unum=unique(num)
ss=zeros(len(unum))
ds=zeros(len(unum))
for k in range(len(unum)):
i=where(unum[k]==num)
ss[k]=all_ss[i].sum()
ds[k]=all_ds[i].sum()... | code_fim | hard | {
"lang": "python",
"repo": "degoldbe/mudpyseg",
"path": "/src/python/mudpy/view_segs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: degoldbe/mudpyseg path: /src/python/mudpy/view_segs.py
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
cdict = {'red': ((0., 1, 1),
(0.05, 1, 1),
(0.11, 0, 0),
(0.66, 1, 1),
(0.89, 1, 1),
(1, 0.5, 0.5... | code_fim | hard | {
"lang": "python",
"repo": "degoldbe/mudpyseg",
"path": "/src/python/mudpy/view_segs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_start_address_too_high(self):
self.blser.send_verify(
start=0x1800, end=0x1000, crc=0x0,
response=ResponseCode.ADDR_OUT_OF_RANGE)
class TestEraseVerify(BootloaderTestCase):
def test_erase_verify_one_page(self):
# Erase a section of flash so that i... | code_fim | hard | {
"lang": "python",
"repo": "cfulljames/synth",
"path": "/scripts/test_bootloader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cfulljames/synth path: /scripts/test_bootloader.py
#!/usr/bin/env python3
import binascii
import os
import time
import struct
import unittest
import bootloader_utils
from bootloader_utils import MessageType, ResponseCode
def open_serial_port():
if not 'SYNTH_SERIAL_PORT' in os.environ:
... | code_fim | hard | {
"lang": "python",
"repo": "cfulljames/synth",
"path": "/scripts/test_bootloader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.blser.assert_response(ResponseCode.DATA_TOO_LONG)
def test_start_address_too_high(self):
data = b'\x00' * 512
self.blser.send_write_row(
start=0x15800, data=data, response=ResponseCode.ADDR_OUT_OF_RANGE)
def test_start_address_bad_alignment(self):
... | code_fim | hard | {
"lang": "python",
"repo": "cfulljames/synth",
"path": "/scripts/test_bootloader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oshea00/pythonscripts path: /fibo.py
def fibo(n):
if n <= 1:
return 1
return fibo(n-1)+fibo(n-2)
def fibotail(n):
def fibohelp(i,j,n):
return fibohelp(j,i+j,n-1) if n>0 else j
return fibohelp(0,1,n)
def fiboloop(n):
firstfibo = 1
secondfibo = 1
nextfi... | code_fim | medium | {
"lang": "python",
"repo": "oshea00/pythonscripts",
"path": "/fibo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def fibohelp(i,j,n):
return fibohelp(j,i+j,n-1) if n>0 else j
return fibohelp(0,1,n)
def fiboloop(n):
firstfibo = 1
secondfibo = 1
nextfibo = 1
for x in range(1,n-1):
nextfibo = firstfibo + secondfibo
firstfibo = secondfibo
secondfibo = nextfib... | code_fim | medium | {
"lang": "python",
"repo": "oshea00/pythonscripts",
"path": "/fibo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shlomielbaz/python-interpreter path: /lexer.py
from typing import NamedTuple
import re
class Token(NamedTuple):
type: str
value: str
line: int
paramaters: tuple
def tokenize(code):
keywords = {'LET', 'IF', 'JUMP', 'CALL', 'RETURN', 'PRINT', }
patterns = {
... | code_fim | hard | {
"lang": "python",
"repo": "shlomielbaz/python-interpreter",
"path": "/lexer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif kind == 'PRINT':
value = 'PrintStatement'
parameters = (match.group(1), line_num)
elif kind == 'RETURN':
value = 'ReturnStatement'
parameters = (line_num,)
yield T... | code_fim | hard | {
"lang": "python",
"repo": "shlomielbaz/python-interpreter",
"path": "/lexer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andy168chipz/OurMap path: /ourmap/handlers/base.py
__author__ = 'Andy'
#
import webapp2
from google.appengine.api import users
import jinja2
import os
import logging
template_dir = os.path.join(os.path.dirname(__file__), '../templates') #path to template_dir, __file__(dir of cur file)
#set up ... | code_fim | hard | {
"lang": "python",
"repo": "andy168chipz/OurMap",
"path": "/ourmap/handlers/base.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = users.get_current_user()
if user:
greeting = ('Welcome, %s! (<a href="%s">sign out</a>)' %
(user.nickname(), users.create_logout_url('/')))
else:
greeting = ('<a href="%s">Sign in or register</a>.' %
users.create_login_url('/'))
self.res... | code_fim | medium | {
"lang": "python",
"repo": "andy168chipz/OurMap",
"path": "/ourmap/handlers/base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in l1:
if(i%2==0):
leven.append(i)
elif (i%3==0):
lodd.append(i)
else:
pass
print('Even list',leven)
print('odd list',lodd)
# Merge two lists
l2=[1,2,3,4]
l3=[5,6,7,8]
l2=l2+l3
l2.sort()
print("L2 and L3 merged and sorted",l2)
# Sort using... | code_fim | medium | {
"lang": "python",
"repo": "akiran1234/referencedocs",
"path": "/Python/PythonPrograms/ListProgs/01_EvenOddList.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akiran1234/referencedocs path: /Python/PythonPrograms/ListProgs/01_EvenOddList.py
# This prog is to print 1 st max,2nd Max, min values and even and odd values in a different list
l1=[10,-5,2,3,10,20,100,9,22]
l1.sort()
print('1sr Max value',l1[-1])
print('2nd Max value',l1[-2])
print('Mi... | code_fim | hard | {
"lang": "python",
"repo": "akiran1234/referencedocs",
"path": "/Python/PythonPrograms/ListProgs/01_EvenOddList.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doonguk/algorithm path: /20200401/77.py
def solution(n, l, r):
reserve = set(r) - set(l)
lost = set(l) - set(r)
answer = n - len(reserve) - len(lost) # init
for v in reserve:
if v - 1 in lost:
<|fim_suffix|>r += 2
lost.remove(v + 1)
else:
... | code_fim | medium | {
"lang": "python",
"repo": "doonguk/algorithm",
"path": "/20200401/77.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r += 2
lost.remove(v + 1)
else:
answer += 1
return answer<|fim_prefix|># repo: doonguk/algorithm path: /20200401/77.py
def solution(n, l, r):
reserve = set(r) - set(l)
lost = set(l) - set(r)
answer = <|fim_middle|>n - len(reserve) - len(lost) # init
... | code_fim | medium | {
"lang": "python",
"repo": "doonguk/algorithm",
"path": "/20200401/77.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onlookerliu/AlgoReco path: /python/test/test_climb.py
import unittest
from python.nowcoder.climb import Solution
class TestClimb(unittest.TestCase):
def test_resolve_v1(self):
s = Solution()
self.assertEqual(s.resolve_v1(1), 1)
self.assertEqual(s.resolve_v1(2), 2)
... | code_fim | medium | {
"lang": "python",
"repo": "onlookerliu/AlgoReco",
"path": "/python/test/test_climb.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
s = Solution()
self.assertEqual(s.resolve_v4(1), 1)
self.assertEqual(s.resolve_v4(2), 2)
self.assertEqual(s.resolve_v4(3), 3)
self.assertEqual(s.resolve_v4(4), 5)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: onlookerliu/AlgoReco path: /pyt... | code_fim | hard | {
"lang": "python",
"repo": "onlookerliu/AlgoReco",
"path": "/python/test/test_climb.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acarvalh/generateHH path: /lhe_maker_VBF/copy_cards.py
#!/usr/bin/env python
# RUN: python copy_cards.py --channel bWbj_T
import os, sys, time,math
import subprocess
from random import randint
from optparse import OptionParser
parser = OptionParser()
parser.add_option("--channel", type="str", de... | code_fim | hard | {
"lang": "python",
"repo": "acarvalh/generateHH",
"path": "/lhe_maker_VBF/copy_cards.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #with open(filecust, 'r+') as fp:
# content = fp.read()
# fp.seek(0)
# fp.truncate()
# fp.write(content.replace('80.0', str(float(mass[m]*width[w]/100))))
####################################################################################
# make scripts to run
####... | code_fim | hard | {
"lang": "python",
"repo": "acarvalh/generateHH",
"path": "/lhe_maker_VBF/copy_cards.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dates_length = len(dates)
roads_length = len(roads_id)
dates = [str(date) for date in dates]
dates = list(np.repeat(dates, roads_length))
roads_id = roads_id * dates_length
assert len(dates) == len(roads_id)
data_output = pd.DataFrame({"datetime": dates, "segment_id": roads_i... | code_fim | hard | {
"lang": "python",
"repo": "BenoCharlo/sanral",
"path": "/src/preprocessing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BenoCharlo/sanral path: /src/preprocessing.py
import pandas as pd
import numpy as np
import datetime
from src import utils
def create_daily_hours(start_date, end_date):
"""
This function create then time range with a
step of an hour between start_date and end_date.
Returns a ... | code_fim | hard | {
"lang": "python",
"repo": "BenoCharlo/sanral",
"path": "/src/preprocessing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: macripcode/app-uvdomjudge path: /public/views.py
import json
from django.contrib import messages
from django.shortcuts import render
from .forms import RegistrationForm
from request.clients import client_public_get_courses
from request.clients import client_public_get_course
from request.clients ... | code_fim | hard | {
"lang": "python",
"repo": "macripcode/app-uvdomjudge",
"path": "/public/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> container_enc = client_public_get_container(id_course)
container_str = container_enc.decode('utf-8')
container = json.loads(container_str)
# ------- getting port 3306 from container ------------>
port_number_3306_container = client_professor_get_port_3306_containe... | code_fim | hard | {
"lang": "python",
"repo": "macripcode/app-uvdomjudge",
"path": "/public/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TylerFrance94/ARIMA path: /MakeCSV.py
import pandas as pd
import numpy as np
import json, requests
pd.set_option("display.max_rows", 1000)
def print_wrapped(data, ncols=3):
"""A helper function to wrap data columns for easier viewing."""
nrows = len(data)
labels = data.in... | code_fim | hard | {
"lang": "python",
"repo": "TylerFrance94/ARIMA",
"path": "/MakeCSV.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
data_set1 = getCityDailyData()
count = len(data_set1)
offset = count
# this is going to run through as many times as needed to get all the data from the api
while True:
data_set2 = getCityDailyData(count)
count = count + len(data_set2)
ildfs = pd.json_normalize(data_set1)
ildfs... | code_fim | hard | {
"lang": "python",
"repo": "TylerFrance94/ARIMA",
"path": "/MakeCSV.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pruh/backee path: /tests/parser/test_loggers_parser.py
import os
import json
import unittest
from unittest import mock
from unittest.mock import ANY
import logging
from logging import handlers, LogRecord
from typing import Tuple, Optional, Dict
from tests.util.config_mixin import ConfigMixin
fr... | code_fim | hard | {
"lang": "python",
"repo": "pruh/backee",
"path": "/tests/parser/test_loggers_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(
expected_web_logger,
parsed_web_logger,
msg="full web logger is parsed incorrectly",
)
def test_web_logger_default_values(self):
"""
Only required values are set and others are default.
"""
expected_... | code_fim | hard | {
"lang": "python",
"repo": "pruh/backee",
"path": "/tests/parser/test_loggers_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#im = im.resize((512,512), Image.BICUBIC)
im.save('test.png')<|fim_prefix|># repo: xblaster/scrutator path: /sandbox/image.py
from PIL import Image, ImageDraw
import glob, os
#this file is a short test for PIL programming
#@TODO remove that from the projects
<|fim_middle|>size = 1024, 1024
im ... | code_fim | hard | {
"lang": "python",
"repo": "xblaster/scrutator",
"path": "/sandbox/image.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xblaster/scrutator path: /sandbox/image.py
from PIL import Image, ImageDraw
import glob, os
#this file is a short test for PIL programming
#@TODO remove that from the projects
<|fim_suffix|>#im = im.resize((512,512), Image.BICUBIC)
im.save('test.png')<|fim_middle|>size = 1024, 1024
im ... | code_fim | hard | {
"lang": "python",
"repo": "xblaster/scrutator",
"path": "/sandbox/image.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jramaswami/Advent-Of-Code-2015 path: /puzzle22/python/test_puzzle22.py
"""Tests for Day 22 Puzzle"""
import unittest
import rpg
import strategy
class TestPuzzle22(unittest.TestCase):
"""Test for Day 22 Puzzle"""
def test_simulate_combat(self):
"""Tests for simulate_combat()"""
... | code_fim | hard | {
"lang": "python",
"repo": "jramaswami/Advent-Of-Code-2015",
"path": "/puzzle22/python/test_puzzle22.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Player casts Magic Missile
rpg.simulate_combat_round(player, boss, effects, 'Magic Missile')
# Player has 2 hit points, 0 armor, 24 mana
self.assertEquals(player.hit_points, 2)
self.assertEquals(player.armor, 0)
self.assertEquals(player.mana, 24)
... | code_fim | hard | {
"lang": "python",
"repo": "jramaswami/Advent-Of-Code-2015",
"path": "/puzzle22/python/test_puzzle22.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if rpg.VERBOSE:
print "*" * 30, 'Battle #2', "*" * 30
player = rpg.Character('Player', hit_points=10, mana=250)
boss = rpg.Character('Boss', hit_points=14, damage=8)
spell_list = strategy.SpellList(['Recharge', 'Shield', 'Drain',
... | code_fim | hard | {
"lang": "python",
"repo": "jramaswami/Advent-Of-Code-2015",
"path": "/puzzle22/python/test_puzzle22.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>obj=B()
obj.Data()
print('\n\n\n')
#solution:-
class A:
def Data(self):
print('class A member called')
class B(A):
def Data(self):
super(B,self).Data()
print('class B member called')
obj=B()
obj.Data()<|fim_prefix|># repo: KULDEEPMALIKM41/Practices path: /Python/Python Basics/109.methodoverr... | code_fim | medium | {
"lang": "python",
"repo": "KULDEEPMALIKM41/Practices",
"path": "/Python/Python Basics/109.methodoverriding.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KULDEEPMALIKM41/Practices path: /Python/Python Basics/109.methodoverriding.py
# Method overriding in inheritance:-
# in case of inheritance when one class acquires
# the property of another class and the property of will be same
# name the derived class will override the property of ... | code_fim | medium | {
"lang": "python",
"repo": "KULDEEPMALIKM41/Practices",
"path": "/Python/Python Basics/109.methodoverriding.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def Data(self):
super(B,self).Data()
print('class B member called')
obj=B()
obj.Data()<|fim_prefix|># repo: KULDEEPMALIKM41/Practices path: /Python/Python Basics/109.methodoverriding.py
# Method overriding in inheritance:-
# in case of inheritance when one class acquires
# the property of... | code_fim | medium | {
"lang": "python",
"repo": "KULDEEPMALIKM41/Practices",
"path": "/Python/Python Basics/109.methodoverriding.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate
Shangke.setWindowTitle(_translate("Shangke", "Shangke"))
self.Img_lable.setText(_translate("Shangke", "Img"))
self.label.setText(_translate("Shangke", "科 目:"))
self.label_2.setText(_translate("Shangke", "节 次:"))
... | code_fim | hard | {
"lang": "python",
"repo": "MC-Firework/Python-----------",
"path": "/Ui_Shangke.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def retranslateUi(self, Shangke):
_translate = QtCore.QCoreApplication.translate
Shangke.setWindowTitle(_translate("Shangke", "Shangke"))
self.Img_lable.setText(_translate("Shangke", "Img"))
self.label.setText(_translate("Shangke", "科 目:"))
self.label_2.setTe... | code_fim | hard | {
"lang": "python",
"repo": "MC-Firework/Python-----------",
"path": "/Ui_Shangke.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MC-Firework/Python----------- path: /Ui_Shangke.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\zhou\Desktop\Client\Shangke.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtC... | code_fim | hard | {
"lang": "python",
"repo": "MC-Firework/Python-----------",
"path": "/Ui_Shangke.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: basrieter/IKEA-Tradfri-plugin path: /generate-psk.py
#!/usr/bin/env python3
from pytradfri import Gateway
from pytradfri.api.libcoap_api import APIFactory
import uuid
import argparse
parser = argparse.ArgumentParser()
<|fim_suffix|>args = parser.parse_args()
api_factory = APIFactory(host=arg... | code_fim | hard | {
"lang": "python",
"repo": "basrieter/IKEA-Tradfri-plugin",
"path": "/generate-psk.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>identity = uuid.uuid4().hex
args = parser.parse_args()
api_factory = APIFactory(host=args.host, psk_id=identity)
try:
psk = api_factory.generate_psk(args.key)
print('Identity: ', identity)
print('Generated PSK: ', psk)
except AttributeError:
print("Failed")<|fim_prefix|># repo: basriete... | code_fim | medium | {
"lang": "python",
"repo": "basrieter/IKEA-Tradfri-plugin",
"path": "/generate-psk.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>api.add_resource(Tienda,"/api/V01/tienda")
api.add_resource(Productos,"/api/V01/productos")
api.add_resource(TiendaById,"/api/V01/tienda/<int:id>")
api.add_resource(ProductosById,"/api/V01/productos/<int:sku>")
api.add_resource(CantidadProductos,"/api/V01/productos/cantidad/<int:sku>")
if __name__ == "__... | code_fim | medium | {
"lang": "python",
"repo": "Tiburocin/Cargo",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.