text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: jhqthai/atari-game-ai path: /A3C/utils.py
import numpy as np
import torch
import time
import math
USE_CUDA = torch.cuda.is_available()
FloatTensor = torch.cuda.FloatTensor if USE_CUDA else torch.FloatTensor
g_start_time = time.time()
# ==========================================================... | code_fim | hard | {
"lang": "python",
"repo": "jhqthai/atari-game-ai",
"path": "/A3C/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exp_avg, exp_avg_sq = state['exp_avg'], state['exp_avg_sq']
beta1, beta2 = group['betas']
state['step'] += 1
if group['weight_decay'] != 0:
grad = grad.add(group['weight_decay'], p.data)
# Decay the firs... | code_fim | hard | {
"lang": "python",
"repo": "jhqthai/atari-game-ai",
"path": "/A3C/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def string_m():
return str(datetime.now())
# x = some_method(1)
# print(x)<|fim_prefix|># repo: lixinli123/pycrunch-trace path: /pycrunch_trace/samples/module_b.py
from datetime import datetime
def some_method(some_number):
a = 2
b = 3
b = 3*4
b = 3*4
b = 1*4
result = a + b ... | code_fim | medium | {
"lang": "python",
"repo": "lixinli123/pycrunch-trace",
"path": "/pycrunch_trace/samples/module_b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lixinli123/pycrunch-trace path: /pycrunch_trace/samples/module_b.py
from datetime import datetime
def some_method(some_number):
<|fim_suffix|> x = 2
for i in range(some_new_var):
if i % 2 == 0:
x = 3 + i
else:
x = 2 * i
def string_m():
return ... | code_fim | medium | {
"lang": "python",
"repo": "lixinli123/pycrunch-trace",
"path": "/pycrunch_trace/samples/module_b.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: winterchaufr/Sitchensis path: /sitchensis/TreeCalcs.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 13 12:46:48 2017
@author: rdk10
"""
import numpy as np
import pandas as pd #For storing data as a data.frame
#import os, sys
##import numpy as np
#os.chdir('... | code_fim | hard | {
"lang": "python",
"repo": "winterchaufr/Sitchensis",
"path": "/sitchensis/TreeCalcs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.print2Log(logFileName, '\n############## Branch bases referenced to segments #################\n')
f.print2Log(logFileName, '####################################################################\n')
if mapType == 'full map' :
f.print2Log(logF... | code_fim | hard | {
"lang": "python",
"repo": "winterchaufr/Sitchensis",
"path": "/sitchensis/TreeCalcs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> last_events = []
for lineup, events in groupby(
dataset_with_state.events, lambda event: event.state["lineup"]
):
events = list(events)
# inspect last event which changed the lineup
last_events.append((events[-1].event_type, len(lineu... | code_fim | hard | {
"lang": "python",
"repo": "TK5-Tim/kloppy",
"path": "/kloppy/tests/test_state_builder.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 0
def reduce(self, state: int, event: Event) -> int:
return state + 1
dataset = self._load_dataset("statsbomb_15986")
with performance_logging("add_state"):
dataset_with_state = add_state(dataset, ["custom"])
assert... | code_fim | hard | {
"lang": "python",
"repo": "TK5-Tim/kloppy",
"path": "/kloppy/tests/test_state_builder.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TK5-Tim/kloppy path: /kloppy/tests/test_state_builder.py
import os
from itertools import groupby
from kloppy import StatsBombSerializer, add_state, to_pandas
from kloppy.domain import EventType, Event, EventDataset
from kloppy.domain.services.state_builder.builder import StateBuilder, T
from klo... | code_fim | hard | {
"lang": "python",
"repo": "TK5-Tim/kloppy",
"path": "/kloppy/tests/test_state_builder.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.handler is not None:
self.handler(call)
class TxnSenderTest(unittest.TestCase):
# Verify that response txn timestamp is always upgraded on successive requests.
def test_txn_timestamp(self):
# expected request timestamp, response timestamp
test_cases = ... | code_fim | hard | {
"lang": "python",
"repo": "abhishekgahlot/cockroach-python",
"path": "/cockroach/test_txn_sender.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhishekgahlot/cockroach-python path: /cockroach/test_txn_sender.py
import unittest
import uuid
from cockroach.call import Call
from cockroach.interface import KVSender, TransactionOptions
from cockroach.methods import Methods
from cockroach.proto import data_pb2, errors_pb2
from cockroach.txn_s... | code_fim | hard | {
"lang": "python",
"repo": "abhishekgahlot/cockroach-python",
"path": "/cockroach/test_txn_sender.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TxnSenderTest(unittest.TestCase):
# Verify that response txn timestamp is always upgraded on successive requests.
def test_txn_timestamp(self):
# expected request timestamp, response timestamp
test_cases = [
(make_ts(0, 0), make_ts(10, 0)),
(make_ts(1... | code_fim | hard | {
"lang": "python",
"repo": "abhishekgahlot/cockroach-python",
"path": "/cockroach/test_txn_sender.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def revision(self):
return api.snippet_revision(self.slug, self.rev)<|fim_prefix|># repo: snswa/swsites path: /wakacmsplugin/models.py
from django.db import models
from cms.models import CMSPlugin
from teams.models import Team
from wakawaka.models import Revision
from wakacmsplugin import ap... | code_fim | hard | {
"lang": "python",
"repo": "snswa/swsites",
"path": "/wakacmsplugin/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snswa/swsites path: /wakacmsplugin/models.py
from django.db import models
from cms.models import CMSPlugin
from teams.models import Team
from wakawaka.models import Revision
from wakacmsplugin import api
from wakacmsplugin.settings import TEAM_SLUG
<|fim_suffix|> if self.content() != u''... | code_fim | medium | {
"lang": "python",
"repo": "snswa/swsites",
"path": "/wakacmsplugin/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luisriq/proyectofingeso path: /DjangoWebProject2/app/migrations/0013_solicitud.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "luisriq/proyectofingeso",
"path": "/DjangoWebProject2/app/migrations/0013_solicitud.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='solicitud',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('direccion', models.CharField(max_length=3)),
('guid', m... | code_fim | hard | {
"lang": "python",
"repo": "luisriq/proyectofingeso",
"path": "/DjangoWebProject2/app/migrations/0013_solicitud.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reingart/web2conf path: /controllers/pycontech.py
# coding: utf8
# try something like
import os
raise RuntimeError("remove this line to use!")
# connect to pycon-tech (django) database
pg=DAL('postgres://postgres:saraza@localhost/pycon2010')
# configure path to common/talkdata
PATH = "C:\\PuT... | code_fim | hard | {
"lang": "python",
"repo": "reingart/web2conf",
"path": "/controllers/pycontech.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def sponsors():
# import sponsorship_websitelogo into sponsors
sql = """
select s.id, s.name, s.level, s.index, s.logo,
s.url, s.alt
from sponsorship_websitelogo s
where s.visible=True
order by s.level, s.index
"""
rows = pg.executesql(sql)
... | code_fim | hard | {
"lang": "python",
"repo": "reingart/web2conf",
"path": "/controllers/pycontech.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pennycxl/BearSki path: /build/lib/BearSki/testproject_template/driver/d_requests.py
import requests
def get(url, params=None, **kwargs):
<|fim_suffix|> return requests.post(url, data, json, **kwargs)<|fim_middle|> return requests.get(url,params,**kwargs)
def post(url, data=None, json=None, **... | code_fim | medium | {
"lang": "python",
"repo": "pennycxl/BearSki",
"path": "/build/lib/BearSki/testproject_template/driver/d_requests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return requests.post(url, data, json, **kwargs)<|fim_prefix|># repo: pennycxl/BearSki path: /build/lib/BearSki/testproject_template/driver/d_requests.py
import requests
def get(url, params=None, **kwargs):
<|fim_middle|> return requests.get(url,params,**kwargs)
def post(url, data=None, json=None, **... | code_fim | medium | {
"lang": "python",
"repo": "pennycxl/BearSki",
"path": "/build/lib/BearSki/testproject_template/driver/d_requests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # no build command, but there's a package
elif config.project.package:
layer_zip = config.project.package
# nothing - we'll handle it
else:
layer_zip = config.project.data_dir / "python_layer.zip"
make_python_layer_zip(config, layer_zip)
return layer_zip
def... | code_fim | hard | {
"lang": "python",
"repo": "ib250/teal-lang",
"path": "/src/hark_lang/cli/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_session_id(args, cfg: Config, required=True):
session_id = args["SESSION_ID"]
if session_id is None:
session_id = load_last_session_id(cfg)
if required and session_id is None:
raise UserResolvableError(
"No session ID specified, and no previous session foun... | code_fim | hard | {
"lang": "python",
"repo": "ib250/teal-lang",
"path": "/src/hark_lang/cli/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ib250/teal-lang path: /src/hark_lang/cli/utils.py
"""CLI related utilities"""
import logging
import os
import shutil
import subprocess
import zipfile
from pathlib import Path
from typing import Union
import deterministic_zip as dz
from ..config import Config, load
from ..exceptions import UserR... | code_fim | hard | {
"lang": "python",
"repo": "ib250/teal-lang",
"path": "/src/hark_lang/cli/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate(self, data):
""" Check that description and title are different """
if data["title"] == data["description"]:
raise srs.ValidationError(
"Title and Description must be different ")
return data
def validate_title(self, value):
... | code_fim | hard | {
"lang": "python",
"repo": "Kayofpimentel/django_course",
"path": "/src/section3/newsapi/news/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class JournalistSerializer(srs.ModelSerializer):
articles = srs.HyperlinkedRelatedField(
many=True, read_only=True, view_name="article-detail")
# articles = ArticleSerializer(many=True, read_only=True)
class Meta:
model = Journalist
fields = '__all__'
# class Arti... | code_fim | hard | {
"lang": "python",
"repo": "Kayofpimentel/django_course",
"path": "/src/section3/newsapi/news/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kayofpimentel/django_course path: /src/section3/newsapi/news/api/serializers.py
from datetime import datetime
from django.utils.timesince import timesince
from rest_framework import serializers as srs
from news.models import Article, Journalist
# from django.db.models import fields
class Articl... | code_fim | hard | {
"lang": "python",
"repo": "Kayofpimentel/django_course",
"path": "/src/section3/newsapi/news/api/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># test for integer validating
#hvac.set_blight(60)
#hvac.set_blight(-1)
#hvac.set_blight(1.1)
#hvac.set_blight("fgfjg")
# test for on off validating
#hvac.set_cfghumid("off")
#hvac.set_cfghumid("fhfjg")
#hvac.set_cfghumid(13)
#hvac.set_cfghumid("on")
# set zone(0)'s sleep(2) heat temp to 68
#hvac.set_zo... | code_fim | medium | {
"lang": "python",
"repo": "7ooL/api_infinitude",
"path": "/test_hvacapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#for day in range(0,6):
# for period in range(0,5):
# if hvac.get_zone_program_day_period_enabled(zone, day, period) == 'on':
# print ('day'+str(day)+', period:'+str(period))
#print hvac.get_zone_activity_fan(0, 0)
#print hvac.get_zone_activity_clsp(0, 1)
# get the back light setting
#hvac.get... | code_fim | medium | {
"lang": "python",
"repo": "7ooL/api_infinitude",
"path": "/test_hvacapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 7ooL/api_infinitude path: /test_hvacapi.py
import pyInfinitude
ip = '192.168.1.20'
port = '5000'
jsonFile = 'infinitude.json'
statusFile = 'status'
hvac = pyInfinitude.infinitude(ip,port,jsonFile,statusFile)
# get the current system configuations
hvac.pull_config()
# get mode
print (hvac.get... | code_fim | medium | {
"lang": "python",
"repo": "7ooL/api_infinitude",
"path": "/test_hvacapi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: excaliburnan/SolutionsOnLeetcodeForZZW path: /1030_MatrixCellsinDistanceOrder/allCellsDistOrder.py
class Solution:
def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
if C <= 0 or R <= 0:
<|fim_suffix|>stance].append([i, j])
output = []
... | code_fim | hard | {
"lang": "python",
"repo": "excaliburnan/SolutionsOnLeetcodeForZZW",
"path": "/1030_MatrixCellsinDistanceOrder/allCellsDistOrder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>stance].append([i, j])
output = []
for dist in sorted(d.keys()):
output.extend(d[dist])
return output<|fim_prefix|># repo: excaliburnan/SolutionsOnLeetcodeForZZW path: /1030_MatrixCellsinDistanceOrder/allCellsDistOrder.py
class Solution:
def allCellsDistOrder(self,... | code_fim | hard | {
"lang": "python",
"repo": "excaliburnan/SolutionsOnLeetcodeForZZW",
"path": "/1030_MatrixCellsinDistanceOrder/allCellsDistOrder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frenchrb/2019_ed_leave path: /date_cleanup/check_dates_combined.py
import re
from asnake.aspace import ASpace
<|fim_suffix|>for collection in repo.resources:
for date in collection.dates:
if '(' in date.expression or 'bulk' in date.expression:
print('===================='... | code_fim | easy | {
"lang": "python",
"repo": "frenchrb/2019_ed_leave",
"path": "/date_cleanup/check_dates_combined.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>for collection in repo.resources:
for date in collection.dates:
if '(' in date.expression or 'bulk' in date.expression:
print('====================')
print(collection.id_0 + '\t' + collection.title + '\t' + collection.uri)
print(date.expression + '\t' + date... | code_fim | easy | {
"lang": "python",
"repo": "frenchrb/2019_ed_leave",
"path": "/date_cleanup/check_dates_combined.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.hexCursor += 0.5
# Adjust for off screen
if self.hexOffset < 0:
self.hexOffset = 0
elif self.hexOffset > self.hexScreen.getmaxyx()[0]-3:
self.hexOffset = self.hexScreen.getmaxyx()[0]-3
if self.bnc.pos< self.bnc.bv.start:
self.bnc.pos= self.bnc.bv.start
... | code_fim | hard | {
"lang": "python",
"repo": "binaryflesh/nehebn2",
"path": "/components/views/HexView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: binaryflesh/nehebn2 path: /components/views/HexView.py
from components.utils import drawMultiLineText
from binaryninja import BinaryReader
import curses
class HexView():
def __init__(self, bnc):
self.bnc = bnc
self.br = BinaryReader(bnc.bv)
self.hexScreen = curses.newpad(curses... | code_fim | hard | {
"lang": "python",
"repo": "binaryflesh/nehebn2",
"path": "/components/views/HexView.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parseInput(self, key):
# Scroll
if key == self.bnc.program.settings["hexViewRight"]:
self.hexCursor += 0.5
if self.hexCursor%1.0 == 0:
self.bnc.pos+= 1
if self.bnc.pos% self.bnc.program.settings["hexLineLength"] == 0:
self.hexOffset += 1
elif key =... | code_fim | hard | {
"lang": "python",
"repo": "binaryflesh/nehebn2",
"path": "/components/views/HexView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>db = connect_db(app=app,
username='stevula',
password='default',
host='159.203.245.190',
port=5432,
database='slackbot')
slack_client = SlackClient(SLACKBOT_TOKEN)
synapse_client = Client(
client_id=CLIENT_ID,
client... | code_fim | hard | {
"lang": "python",
"repo": "SynapseFI/demo.slackbot",
"path": "/app/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SynapseFI/demo.slackbot path: /app/config.py
"""General settings and database initialization."""
import os
from flask import Flask
from slackclient import SlackClient
from synapse_pay_rest import Client
from db import connect_db
CLIENT_ID = os.environ['CLIENT_ID']
CLIENT_SECRET = os.environ['CLI... | code_fim | hard | {
"lang": "python",
"repo": "SynapseFI/demo.slackbot",
"path": "/app/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Uniquode/uniquode2 path: /app/core/middleware.py
# -*- coding: utf-8 -*-
"""
This extends django.contrib.site.middleware.CurrentSiteMiddleware to
also saves the site_id in an async local
"""
from django.contrib.sites.middleware import CurrentSiteMiddleware
from components.site_info import site_i... | code_fim | easy | {
"lang": "python",
"repo": "Uniquode/uniquode2",
"path": "/app/core/middleware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().process_request(request)
setattr(site_info, 'site_id', request.site.id)<|fim_prefix|># repo: Uniquode/uniquode2 path: /app/core/middleware.py
# -*- coding: utf-8 -*-
"""
This extends django.contrib.site.middleware.CurrentSiteMiddleware to
also saves the site_id in an async local
"... | code_fim | easy | {
"lang": "python",
"repo": "Uniquode/uniquode2",
"path": "/app/core/middleware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dmat = torch.sqrt(2 - 2 * torch.clamp(dmat, min=-1, max=1))
_, idx = torch.sort(dmat, dim=1)
# Compute triplet loss and recall
for pyramid in range(len(relax_field_size)):
candidates = idx.t()
match_k_x = tar_points_raw[0, candidates]
... | code_fim | hard | {
"lang": "python",
"repo": "wangch-g/lanet",
"path": "/loss_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangch-g/lanet path: /loss_function.py
import torch
def build_descriptor_loss(source_des, target_des, tar_points_un, top_kk=None, relax_field=4, eval_only=False):
"""
Desc Head Loss, per-pixel level triplet loss from https://arxiv.org/pdf/1902.11046.pdf.
Parameters
------... | code_fim | hard | {
"lang": "python",
"repo": "wangch-g/lanet",
"path": "/loss_function.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return loss, recall
class KeypointLoss(object):
"""
Loss function class encapsulating the location loss, the descriptor loss, and the score loss.
"""
def __init__(self, config):
self.score_weight = config.score_weight
self.loc_weight = config.loc_weight
... | code_fim | hard | {
"lang": "python",
"repo": "wangch-g/lanet",
"path": "/loss_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1048727525/fnm_pytorch path: /data_loader.py
import os
import scipy
import numpy as np
from util import *
from PIL import Image
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
class sample_dataset(Dataset):
def __init__(self, list_path, img_root_path, crop... | code_fim | medium | {
"lang": "python",
"repo": "1048727525/fnm_pytorch",
"path": "/data_loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self.img_name_list)
def __getitem__(self, idx):
img_path = os.path.join(self.img_root_path, self.img_name_list[idx])
img = Image.open(img_path).convert('RGB')
return self.transform(img), self.transform_112(img)
def get_loader(list_path, img_root_path, crop_... | code_fim | medium | {
"lang": "python",
"repo": "1048727525/fnm_pytorch",
"path": "/data_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
import cv2
profile_list_path = "../fnm/mpie/casia_gt.txt"
front_list_path = "../fnm/mpie/session01_front_demo.txt"
profile_path = "../../datasets/casia_aligned_250_250_jpg"
front_path = "../../datasets/session01_align"
crop_size = 224
im... | code_fim | hard | {
"lang": "python",
"repo": "1048727525/fnm_pytorch",
"path": "/data_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/flatbuffers path: /tests/py_test.py
0,
0, # offset for start of vtable (int32)
0x78,
0x56,
0x34,
0x12, # value 2
0,
0, # padding
0x34,
0x12, # value 1
0,
... | code_fim | hard | {
"lang": "python",
"repo": "google/flatbuffers",
"path": "/tests/py_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/flatbuffers path: /tests/py_test.py
rT = _MONSTER.MonsterT()
monsterT.InitFromObj(monster)
return monsterT
def test_mutate_pos(self):
posT = _VEC3.Vec3T()
posT.x = 4.0
posT.y = 5.0
posT.z = 6.0
posT.test1 = 6.0
posT.test2 = 7
test3T = _TEST.TestT()
... | code_fim | hard | {
"lang": "python",
"repo": "google/flatbuffers",
"path": "/tests/py_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_nested_monster_testnestedflatbuffer(self):
b = flatbuffers.Builder(0)
# build another monster to nest inside testnestedflatbuffer
nestedB = flatbuffers.Builder(0)
nameStr = nestedB.CreateString('Nested Monster')
_MONSTER.MonsterStart(nestedB)
_MONSTER.MonsterAddHp(neste... | code_fim | hard | {
"lang": "python",
"repo": "google/flatbuffers",
"path": "/tests/py_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richardqa/django-ex path: /phr/ubigeo/migrations/0008_auto_20170411_1444.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-11 14:44
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> operations = [
migrations.RenameField(
... | code_fim | medium | {
"lang": "python",
"repo": "richardqa/django-ex",
"path": "/phr/ubigeo/migrations/0008_auto_20170411_1444.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='ubigeopais',
old_name='id_pais',
new_name='alpha3',
),
]<|fim_prefix|># repo: richardqa/django-ex path: /phr/ubigeo/migrations/0008_auto_20170411_1444.py
# -*- coding: utf-8 -*-
# Generated by D... | code_fim | medium | {
"lang": "python",
"repo": "richardqa/django-ex",
"path": "/phr/ubigeo/migrations/0008_auto_20170411_1444.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> t = t or Vector3()
return np.array([
[1, 0, 0, t.x],
[0, 1, 0, t.y],
[0, 0, 1, t.z],
[0, 0, 0, 1]
], dtype=np.float64)<|fim_prefix|># repo: jsheedy/punyty path: /punyty/transformations.py
from math import sin, cos
import numpy as np
from .vector import Vector3... | code_fim | hard | {
"lang": "python",
"repo": "jsheedy/punyty",
"path": "/punyty/transformations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsheedy/punyty path: /punyty/transformations.py
from math import sin, cos
import numpy as np
from .vector import Vector3
def rotation_matrix(rotation=None):
r = rotation or Vector3()
rot_x = np.array([
[1, 0, 0, 0],
[0, cos(r.x), -sin(r.x), 0],
[0, sin(r.x), cos... | code_fim | hard | {
"lang": "python",
"repo": "jsheedy/punyty",
"path": "/punyty/transformations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hours_search = re.search(pm,times)
if hours_search:
hours = hours_search.group(1)
mins = hours_search.group(2)
if hours_search.group(3)=='AM':
data_hours.append(int(hours))
else:
data_hours.append(int(hours)+12)
data_mins.append(int(mins))
print "page "+str(x)+" done... | code_fim | hard | {
"lang": "python",
"repo": "Alafazam/Codechef-analytics-tool",
"path": "/time_hours_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alafazam/Codechef-analytics-tool path: /time_hours_plot.py
import __main__
import numpy as np
from scipy.stats import kendalltau
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="ticks")
from bs4 import BeautifulSoup
import requests
import os, datetime
import time,json
import ... | code_fim | hard | {
"lang": "python",
"repo": "Alafazam/Codechef-analytics-tool",
"path": "/time_hours_plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_mins.append(int(mins))
print "page "+str(x)+" done"
except :
print "error occured saving data recieved uptill now"
# plt.xlabel('Purchase amount', fontsize=18)
x = np.asarray(data_hours)
y = np.asarray(data_mins)
sns.jointplot(x, y, kind="hex", color="#4CB391")
sns.plt.xticks([x for x in range... | code_fim | hard | {
"lang": "python",
"repo": "Alafazam/Codechef-analytics-tool",
"path": "/time_hours_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 1
if tag not in alltag_dict:
alltag_dict[tag] = 1
print(len(ent_dict))
print(len(wordnet_dict))
print(len(alltag_dict))<|fim_prefix|># repo: Nelsonvon/transformers path: /qihui/data_processing/yago_stat.py
from tqdm import tqdm
ent_dict = {}
wordnet_dict = {}
alltag_dict... | code_fim | medium | {
"lang": "python",
"repo": "Nelsonvon/transformers",
"path": "/qihui/data_processing/yago_stat.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nelsonvon/transformers path: /qihui/data_processing/yago_stat.py
from tqdm import tqdm
ent_dict = {}
wordnet_dict = {}
alltag_dict = {}
with open('/work/smt3/wwang/TAC2019/qihui_data/yago/yagoTypes.tsv', 'r') as fin:<|fim_suffix|>in ent_dict:
ent_dict[entity] = 1
if (not tag.... | code_fim | medium | {
"lang": "python",
"repo": "Nelsonvon/transformers",
"path": "/qihui/data_processing/yago_stat.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>in ent_dict:
ent_dict[entity] = 1
if (not tag.startswith('<wikicat_')) and tag not in wordnet_dict:
wordnet_dict[tag] = 1
if tag not in alltag_dict:
alltag_dict[tag] = 1
print(len(ent_dict))
print(len(wordnet_dict))
print(len(alltag_dict))<|... | code_fim | medium | {
"lang": "python",
"repo": "Nelsonvon/transformers",
"path": "/qihui/data_processing/yago_stat.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wooings/ViT-pytorch-1 path: /utils/path_util.py
from os.path import join
from os.path import normpath
import platform
<|fim_suffix|> p = join(path, *paths)
if platform.system() == "Windows":
return normpath(p).replace('\\','/')
else:
return p<|fim_middle|>def pjoin(pat... | code_fim | easy | {
"lang": "python",
"repo": "wooings/ViT-pytorch-1",
"path": "/utils/path_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> p = join(path, *paths)
if platform.system() == "Windows":
return normpath(p).replace('\\','/')
else:
return p<|fim_prefix|># repo: wooings/ViT-pytorch-1 path: /utils/path_util.py
from os.path import join
from os.path import normpath
import platform
<|fim_middle|>def pjoin(pat... | code_fim | easy | {
"lang": "python",
"repo": "wooings/ViT-pytorch-1",
"path": "/utils/path_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dstFS == None :
# get actual stuff from live
#Vol=VS.getVolume(v["name"],cached=False)
minNestingLevel=-1 # NestingLevel should be "spezifizitaet"
for p in PS.getProjectsByVolumeName(RWVolName) :
if p.Nestin... | code_fim | hard | {
"lang": "python",
"repo": "openafs-contrib/afspy",
"path": "/examples/emptyServer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openafs-contrib/afspy path: /examples/emptyServer.py
#!/usr/bin/python
import re
import time,logging
import argparse, string,datetime,sys
import afs
from afs.util.AfsConfig import parseDefaultConfig
from afs.util.afsutil import parseHumanWriteableSize
from afs.service.OSDVolService import OSDVol... | code_fim | hard | {
"lang": "python",
"repo": "openafs-contrib/afspy",
"path": "/examples/emptyServer.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # remove osd-attributes from dict, create Obj
v.pop("filequota")
v.pop("osdPolicy")
v["serv_uuid"]=afs.LookupUtil[afs.defaultConfig.CELL_NAME].getFSUUID(v["servername"])
VolObj.setByDict(v)
if dstFS == None :
minNestin... | code_fim | hard | {
"lang": "python",
"repo": "openafs-contrib/afspy",
"path": "/examples/emptyServer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CenterForOpenScience/osf.io path: /api/providers/serializers.py
from guardian.shortcuts import get_perms
from rest_framework import serializers as ser
from rest_framework.exceptions import ValidationError
from api.actions.serializers import ReviewableCountsRelationshipField
from api.base.utils i... | code_fim | hard | {
"lang": "python",
"repo": "CenterForOpenScience/osf.io",
"path": "/api/providers/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> type_ = 'moderators'
def create(self, validated_data):
auth = get_user_auth(self.context['request'])
user_id = validated_data.pop('_id', '')
address = validated_data.pop('email', '')
provider = self.context['provider']
context = {
'referrer'... | code_fim | hard | {
"lang": "python",
"repo": "CenterForOpenScience/osf.io",
"path": "/api/providers/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _genNewM(w,h):
return 4. * ( np.random.rand(w,h) - 0.5 ) / w
def _genNewB(h):
return ( np.random.rand(h) - 0.5 ) / 5.0
class Phenotype :
def __init__(self, clone=None, shape=[4,5,5,1], data=None) :
if clone :
self.ms = [ np.copy(clone.ms[i]) for i in range(len(clone... | code_fim | hard | {
"lang": "python",
"repo": "Sanyam07/opengym",
"path": "/geneticalgorithm.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sanyam07/opengym path: /geneticalgorithm.py
import numpy as np
from random import choice, random, shuffle
def defaultMutation(phenotype) : return phenotype
def defaultCrossover(a,b) : return a
def defaultFitness(phenotype) : return 0
class GeneticAlgorithm:
def __init__(self,mutationFunc... | code_fim | hard | {
"lang": "python",
"repo": "Sanyam07/opengym",
"path": "/geneticalgorithm.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Phenotype(self)
def compute(self,input) :
result = np.array(input)
for i in range(len(self.ms)) :
result = _sigmoid( np.matmul( result , self.ms[i] ) + self.bs[i] )
return result
def mutate(self) :
rand_pheno = Phenotype(shape=self.sha... | code_fim | hard | {
"lang": "python",
"repo": "Sanyam07/opengym",
"path": "/geneticalgorithm.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertIsInstance(MediaLibrary.MLMediaLoadIncludeSourcesKey, str)
self.assertIsInstance(MediaLibrary.MLMediaLoadExcludeSourcesKey, str)
self.assertIsInstance(MediaLibrary.MLMediaLoadFoldersKey, str)
self.assertIsInstance(MediaLibrary.MLMediaLoadAppleLoops, str)
... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-MediaLibrary/PyObjCTest/test_mlmedialibrary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-MediaLibrary/PyObjCTest/test_mlmedialibrary.py
from PyObjCTools.TestSupport import TestCase, min_os_level
import objc
import MediaLibrary
class TestMLMediaLibrary(TestCase):
@min_os_level("10.9")
def testClasses(self):
self.assertIsI... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-MediaLibrary/PyObjCTest/test_mlmedialibrary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: divi9626/RANSAC path: /Trajectory_Estimation.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 22:54:14 2021
@author: divyam
"""
""" #### To Run the code #####
1. To change the video comment line 22 and uncomment line 21
2. The output would give both ransac and least ... | code_fim | hard | {
"lang": "python",
"repo": "divi9626/RANSAC",
"path": "/Trajectory_Estimation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> coordinates.append(coordinate_list_all[30])
if ret == True:
cv.imshow('Frame',gray)
if cv.waitKey(1) == 27:
break
else:
break
plt.scatter(*zip(*coordinates))
plt.show()
def curve_fit(coordinates):
x = []
sum_x = 0
sum_... | code_fim | hard | {
"lang": "python",
"repo": "divi9626/RANSAC",
"path": "/Trajectory_Estimation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = ransac()
#model = tls(coordinates)
ret = curve_fit(coordinates)
model1 = ret[0]
x = np.array(range(500))
print(model)
y = model[0] + model[1]*x + model[2]*x**2
#y = (model[0] + model[1]*x + model[2]*x**2)
y1 = model1[0] + model1[1]*x + model1[2]*x**2
... | code_fim | hard | {
"lang": "python",
"repo": "divi9626/RANSAC",
"path": "/Trajectory_Estimation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Arguments:
item : Tuple(str,str) : The video name (desired base filename) and
video id (used for downloading) associted with a given video.
"""
vid_name, vid_id = item
vid = Video(vid_name, vid_id, resolution='224p')
vid.download()
if __name__ == '__main__':
vi... | code_fim | hard | {
"lang": "python",
"repo": "jason-weilink/Wistia-video-fetcher",
"path": "/download.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jason-weilink/Wistia-video-fetcher path: /download.py
import json
from multiprocessing.pool import ThreadPool
import re
import shutil
import time
import pandas as pd
import requests
class AssetNotFoundError(Exception):
""" Exception for when asset information is not found on a page. """
... | code_fim | hard | {
"lang": "python",
"repo": "jason-weilink/Wistia-video-fetcher",
"path": "/download.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: foss2cyber/Incident-Playbook path: /Incident-Response/Tools/cyphon/cyphon/engines/elasticsearch/tests/test_mapper.py
# -*- coding: utf-8 -*-
# Copyright 2017-2019 ControlScan, Inc.
#
# This file is part of Cyphon Engine.
#
# Cyphon Engine is free software: you can redistribute it and/or modify
# ... | code_fim | hard | {
"lang": "python",
"repo": "foss2cyber/Incident-Playbook",
"path": "/Incident-Response/Tools/cyphon/cyphon/engines/elasticsearch/tests/test_mapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Tests a recusive case for the _map_field function.
"""
field = 'content.title'
mapping = {
'type': 'text',
'index': True
}
actual = mapper._map_field(mapping, field)
expected = {
'properties': {
... | code_fim | hard | {
"lang": "python",
"repo": "foss2cyber/Incident-Playbook",
"path": "/Incident-Response/Tools/cyphon/cyphon/engines/elasticsearch/tests/test_mapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def find_all(cls, **kwargs):
""" find records that match given params in dict
return array of instants
ex.
User.find_all({ 'name': 'John' }) # [<User #John Doe>, <User #John Die>
"""
return cls.query.filter_by(**kwargs).all()... | code_fim | hard | {
"lang": "python",
"repo": "jingz/Flask-Boost",
"path": "/flask_turbo_boost/api_project/application/extensions/active_record_mixin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jingz/Flask-Boost path: /flask_turbo_boost/api_project/application/extensions/active_record_mixin.py
from datetime import datetime
class ActiveRecordMixin(object):
@classmethod
def columns(cls):
"""
all columns of this models
"""
return { col.key: { ... | code_fim | hard | {
"lang": "python",
"repo": "jingz/Flask-Boost",
"path": "/flask_turbo_boost/api_project/application/extensions/active_record_mixin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitchm69/django-rest-framework path: /tests/test_metadata.py
import pytest
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.test import TestCase
from rest_framework import (
exceptions, metadata, serializers, status, versioning,... | code_fim | hard | {
"lang": "python",
"repo": "mitchm69/django-rest-framework",
"path": "/tests/test_metadata.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_serializer(self):
assert hasattr(self.request, 'versioning_scheme')
return serializers.Serializer()
scheme = versioning.QueryParameterVersioning
view = ExampleView.as_view(versioning_class=scheme)
view(request=request)
def t... | code_fim | hard | {
"lang": "python",
"repo": "mitchm69/django-rest-framework",
"path": "/tests/test_metadata.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "------> Sarted reload of workFile"
for sub_module in modules:
reload(sub_module)
print "---> Reloading : " +str(sub_module.__name__)
print "------> Ended reload of workFile"<|fim_prefix|># repo: mmallmann/masterreload path: /master_ui/workFile/reload_work_file.py
from ... | code_fim | medium | {
"lang": "python",
"repo": "mmallmann/masterreload",
"path": "/master_ui/workFile/reload_work_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def reload_it():
print "------> Sarted reload of workFile"
for sub_module in modules:
reload(sub_module)
print "---> Reloading : " +str(sub_module.__name__)
print "------> Ended reload of workFile"<|fim_prefix|># repo: mmallmann/masterreload path: /master_ui/workFile/reload_w... | code_fim | medium | {
"lang": "python",
"repo": "mmallmann/masterreload",
"path": "/master_ui/workFile/reload_work_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmallmann/masterreload path: /master_ui/workFile/reload_work_file.py
from master_ui.workFile import action_form
from master_ui.workFile import masterReload_rc
from master_ui.workFile import path_form
from master_ui.workFile import session_form
<|fim_suffix|>def reload_it():
print "------> S... | code_fim | medium | {
"lang": "python",
"repo": "mmallmann/masterreload",
"path": "/master_ui/workFile/reload_work_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count1 = 0
for j in range(5):
a = 0
count = 0
user_pwd = input("") # password you remember
for i in range(len(pwd)):
if user_pwd[i] == pwd[a]: # comparing remembered pwd with fixed pwd
a += 1
count += 1
if count ... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/_RESOURCES/my-gists/__CONTAINER/TESTING/Aakanksha.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /_RESOURCES/my-gists/__CONTAINER/TESTING/Aakanksha.py
import time
pwd = "AKS2608" # any password u want to set
<|fim_suffix|> count1 = 0
for j in range(5):
a = 0
count = 0
user_pwd = input("") # password you remember
f... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/_RESOURCES/my-gists/__CONTAINER/TESTING/Aakanksha.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = self.client.get(
reverse('ticket-list'), {
'filter[requester]': 'none'
}
)
self.assertEqual(response.status_code, 200)
body = json.loads(response.content)
self.assertEqual(body['meta']['filters'], {})
def tes... | code_fim | hard | {
"lang": "python",
"repo": "occrp/id-backend",
"path": "/api_v3/tests/views/test_tickets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: occrp/id-backend path: /api_v3/tests/views/test_tickets.py
# -*- coding: utf-8 -*-
import json
import random
from django.conf import settings
from django.template.loader import render_to_string
from api_v3.models import Ticket, Action
from api_v3.factories import (
ProfileFactory,
Respo... | code_fim | hard | {
"lang": "python",
"repo": "occrp/id-backend",
"path": "/api_v3/tests/views/test_tickets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vidhiJain/lab path: /lab/internal/logger/destinations/factory.py
from lab.internal.logger.destinations import Destination
from lab.internal.util import is_ipynb
<|fim_suffix|> if is_ipynb():
from lab.internal.logger.destinations.ipynb import IpynbDestination
return IpynbDesti... | code_fim | easy | {
"lang": "python",
"repo": "vidhiJain/lab",
"path": "/lab/internal/logger/destinations/factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if is_ipynb():
from lab.internal.logger.destinations.ipynb import IpynbDestination
return IpynbDestination()
else:
from lab.internal.logger.destinations.console import ConsoleDestination
return ConsoleDestination()<|fim_prefix|># repo: vidhiJain/lab path: /lab/inte... | code_fim | easy | {
"lang": "python",
"repo": "vidhiJain/lab",
"path": "/lab/internal/logger/destinations/factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Tag, TagModelAdmin)<|fim_prefix|># repo: chiragk156/CodeArea path: /backend/src/tags/admin.py
from django.contrib import admin
<|fim_middle|># Register your models here.
from .models import Tag
class TagModelAdmin(admin.ModelAdmin):
""" Problem Admin Model """
# Display Fields
... | code_fim | hard | {
"lang": "python",
"repo": "chiragk156/CodeArea",
"path": "/backend/src/tags/admin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chiragk156/CodeArea path: /backend/src/tags/admin.py
from django.contrib import admin
# Register your models here.
<|fim_suffix|> class Meta:
model = Tag
admin.site.register(Tag, TagModelAdmin)<|fim_middle|>from .models import Tag
class TagModelAdmin(admin.ModelAdmin):
""" Problem Admin Mo... | code_fim | medium | {
"lang": "python",
"repo": "chiragk156/CodeArea",
"path": "/backend/src/tags/admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chiragk156/CodeArea path: /backend/src/tags/admin.py
from django.contrib import admin
<|fim_suffix|>from .models import Tag
class TagModelAdmin(admin.ModelAdmin):
""" Problem Admin Model """
# Display Fields
list_display = ["name", "description"]
# Search Fields
search_fields = ["name"]... | code_fim | easy | {
"lang": "python",
"repo": "chiragk156/CodeArea",
"path": "/backend/src/tags/admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: masich/queueing-theory path: /models/client.py
from abc import ABCMeta, abstractmethod
from collections import deque
from dataclasses import dataclass
from threading import Lock
from typing import Deque, Optional, Iterator
from common import Printable, Identifiable
@dataclass
class Client(Iden... | code_fim | medium | {
"lang": "python",
"repo": "masich/queueing-theory",
"path": "/models/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @abstractmethod
def on_queued(self, client: Client) -> None:
pass
@abstractmethod
def on_popped_from_queue(self, client: Client) -> None:
pass
@abstractmethod
def on_processing_finished(self, client: Client) -> None:
pass
@abstractmethod
def on_pr... | code_fim | hard | {
"lang": "python",
"repo": "masich/queueing-theory",
"path": "/models/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kntrinoue/biomass path: /biomass/analysis/reaction/reaction.py
# Num. of Rate Equations (len(v) in model/differential_equations.py)
num_reaction = 64
def get_reaction_module():
n_module = 16
reaction_module = [None]*n_module
# ERK_activation
reaction_module[0] = [i for i in range... | code_fim | hard | {
"lang": "python",
"repo": "kntrinoue/biomass",
"path": "/biomass/analysis/reaction/reaction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> i in range(31,35)]
# cFos_transport
reaction_module[12] = [40,41]
# cFos_stabilization
reaction_module[13] = [35,36,37,42,43,44]
# cFos_degradation
reaction_module[14] = [38,39,45,46]
# Feedback_from_F
reaction_module[15] = [i for i in range(57,64)]
return reaction_mo... | code_fim | hard | {
"lang": "python",
"repo": "kntrinoue/biomass",
"path": "/biomass/analysis/reaction/reaction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = "bar"
return result
x = fizzbuzzfoobar(60)
print(x)<|fim_prefix|># repo: Maurya232Abhishek/Python-repository-for-basics path: /fizz.py
def fizzbuzzfoobar(n):
result = ""
if n % 2 == 0:
<|fim_middle|> result = "fizz"
if n % 3 == 0:
result += "buzz"
if n % 5 =... | code_fim | medium | {
"lang": "python",
"repo": "Maurya232Abhishek/Python-repository-for-basics",
"path": "/fizz.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maurya232Abhishek/Python-repository-for-basics path: /fizz.py
def fizzbuzzfoobar(n):
result = ""
if n % 2 == 0:
<|fim_suffix|>if n % 5 == 0:
result += "foo"
if result == "":
result = "bar"
return result
x = fizzbuzzfoobar(60)
print(x)<|fim_middle|> result =... | code_fim | medium | {
"lang": "python",
"repo": "Maurya232Abhishek/Python-repository-for-basics",
"path": "/fizz.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.