text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>res = {}
cdf = cdflib.CDF(cdfFile)
for k in cdf.cdf_info()['zVariables']:
var = cdf.varget(k)
if len(var.shape) == 0:
# When the shape is () we have a 0-d ndarray in cdf[k][...].
# The only way to get the single value is with .item()
res[k] = Val(var.item())
else:
... | code_fim | medium | {
"lang": "python",
"repo": "Goobley/radynpy",
"path": "/radynpy/cdf/RadynKeyFile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # optimizer = torch.optim.SGD(model.parameters(), lr=Config.LEARNING_RATE,
# weight_decay=Config.WEIGHT_DECAY)
trainer = Trainer(
optimizer,
model,
train_dataloader,
val_dataloader,
resume=Config.RESUME_FROM,
log_dir=... | code_fim | hard | {
"lang": "python",
"repo": "Blessinglrq/yuncong_new",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Net()
optimizer = torch.optim.Adam(model.parameters(), lr=Config.LEARNING_RATE,
weight_decay=Config.WEIGHT_DECAY) #maybe Adam is better
# optimizer = torch.optim.SGD(model.parameters(), lr=Config.LEARNING_RATE,
# wei... | code_fim | hard | {
"lang": "python",
"repo": "Blessinglrq/yuncong_new",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Blessinglrq/yuncong_new path: /main.py
import sys
import torch
from config import Config
#from dataset import create_wf_datasets, my_collate_fn
from model import Net
from trainer import Trainer
from voc_dataset import create_voc_datasets, my_collate_fn
def main():
<|fim_suffix|> model = Ne... | code_fim | hard | {
"lang": "python",
"repo": "Blessinglrq/yuncong_new",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yapengwu/group-based-policy path: /gbp/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py
get_group = echo
self.driver.apic_manager = mock.Mock(name_mapper=mock.Mock())
self.driver.apic_manager.apic.transaction = self.fake_transaction
def _get_object(self, type, id,... | code_fim | hard | {
"lang": "python",
"repo": "yapengwu/group-based-policy",
"path": "/gbp/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_policy_target_group_created_on_apic(self):
ptg = self.create_policy_target_group(
name="ptg1")['policy_target_group']
mgr = self.driver.apic_manager
mgr.ensure_epg_created.assert_called_once_with(
ptg['tenant_id'], ptg['id'], bd_name=ptg['l2_po... | code_fim | hard | {
"lang": "python",
"repo": "yapengwu/group-based-policy",
"path": "/gbp/neutron/tests/unit/services/grouppolicy/test_apic_mapping.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nbeney/superhub path: /superhub/utils/table.py
import operator
from superhub.settings import device_dict, Device
class Table:
def __init__(self, caption, headers, rows):
self.caption = caption
self.headers = headers
self.rows = rows
# TODO: Do th... | code_fim | hard | {
"lang": "python",
"repo": "nbeney/superhub",
"path": "/superhub/utils/table.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return any(len(str(_)) > 0 for _ in row)
return any(has(_) for _ in self.rows)
def pretty_print(self, caption=True):
n = len(self.headers)
widths = [max([len(str(_[idx])) for _ in [self.headers] + self.rows]) for idx in range(n)]
fmt1 = "+-" + "-+-"... | code_fim | hard | {
"lang": "python",
"repo": "nbeney/superhub",
"path": "/superhub/utils/table.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> n = len(self.headers)
widths = [max([len(str(_[idx])) for _ in [self.headers] + self.rows]) for idx in range(n)]
fmt1 = "+-" + "-+-".join(["{:-<%d}" % _ for _ in widths]) + "-+"
fmt2 = "| " + " | ".join(["{!s: <%d}" % _ for _ in widths]) + " |"
sep = fmt1.format... | code_fim | hard | {
"lang": "python",
"repo": "nbeney/superhub",
"path": "/superhub/utils/table.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uc-cdis/fence path: /fence/resources/audit/utils.py
import flask
from functools import wraps
import traceback
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
from cdislogging import get_logger
from fence.config import config
logger = get_logger(__name__)
def is_audit_ena... | code_fim | hard | {
"lang": "python",
"repo": "uc-cdis/fence",
"path": "/fence/resources/audit/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if is_audit_enabled():
# we can't add the `after_this_request` and
# `create_audit_log_for_request_decorator` decorators to the
# functions directly, because `is_audit_enabled` depends on
# the config being loaded
flask.after_this_request... | code_fim | hard | {
"lang": "python",
"repo": "uc-cdis/fence",
"path": "/fence/resources/audit/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def enable_audit_logging(f):
"""
This decorator should be added to any API endpoint for which we
record audit logs. It should not be added to non-audited endpoints,
so that performance is not impacted.
The `create_audit_log_for_request_decorator` decorator is only added
if auditin... | code_fim | hard | {
"lang": "python",
"repo": "uc-cdis/fence",
"path": "/fence/resources/audit/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kswaldemar/rupunktor path: /prepare_data.py
import os
import sys
import argparse
import numpy as np
from rupunktor import converter, corpus_build
from rupunktor.pos_tagger import PosTagger
from rupunktor.utils import pickle_load, pickle_save
CORPUS_TYPE = corpus_build.StemCorpus
def main(arg... | code_fim | hard | {
"lang": "python",
"repo": "kswaldemar/rupunktor",
"path": "/prepare_data.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
parser = argparse.ArgumentParser(description='Prepare data to suitable format for rupunktor')
parser.add_argument('dest_directory',
help='Directory to write all processed data')
parser.add_argument('--file', dest='input_file', metavar='FILENAME',
help='File with un... | code_fim | hard | {
"lang": "python",
"repo": "kswaldemar/rupunktor",
"path": "/prepare_data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def blinker(on, off):
while True:
light.on()
sleep(on)
light.off()
sleep(off)
blinker(on, off)<|fim_prefix|># repo: emrazik7366/Per3_evan_arcade path: /led.py
from gpiozero import LED
from time import sleep
<|fim_middle|>light = LED(17)
on = int(input("time on "))
o... | code_fim | medium | {
"lang": "python",
"repo": "emrazik7366/Per3_evan_arcade",
"path": "/led.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emrazik7366/Per3_evan_arcade path: /led.py
from gpiozero import LED
from time import sleep
light = LED(17)
<|fim_suffix|>def blinker(on, off):
while True:
light.on()
sleep(on)
light.off()
sleep(off)
blinker(on, off)<|fim_middle|>on = int(input("time on "))
o... | code_fim | easy | {
"lang": "python",
"repo": "emrazik7366/Per3_evan_arcade",
"path": "/led.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
light.on()
sleep(on)
light.off()
sleep(off)
blinker(on, off)<|fim_prefix|># repo: emrazik7366/Per3_evan_arcade path: /led.py
from gpiozero import LED
from time import sleep
light = LED(17)
<|fim_middle|>on = int(input("time on "))
off = int(input("time o... | code_fim | medium | {
"lang": "python",
"repo": "emrazik7366/Per3_evan_arcade",
"path": "/led.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: creachadair/curled path: /__init__.py
##
## Name: __init__.py
## Purpose: Interface to libcurl based on ctypes.
##
## Copyright (c) 2009-2010 Michael J. Fromberger, All Rights Reserved.
##
## Basic usage examples
##
## import curled, curled.constants as const
## curl = curled.Curl()
## ... | code_fim | medium | {
"lang": "python",
"repo": "creachadair/curled",
"path": "/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = (
'constants',
'util',
'CURLError',
'CURLVersionError',
'Curl',
)
# Here there be dragons<|fim_prefix|># repo: creachadair/curled path: /__init__.py
##
## Name: __init__.py
## Purpose: Interface to libcurl based on ctypes.
##
## Copyright (c) 2009-2010 Michael J. Fromb... | code_fim | medium | {
"lang": "python",
"repo": "creachadair/curled",
"path": "/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apolloclark/bootstrap-vz path: /bootstrapvz/providers/docker/tasks/image.py
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tools import log_check_call
class CreateDockerfileEntry(Task):
description = 'Creating the Dockerfile entry'
phase = phas... | code_fim | medium | {
"lang": "python",
"repo": "apolloclark/bootstrap-vz",
"path": "/bootstrapvz/providers/docker/tasks/image.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> import pyrfc3339
from datetime import datetime
import pytz
labels = {}
labels['name'] = info.manifest.name.format(**info.manifest_vars)
# Inspired by https://github.com/projectatomic/ContainerApplicationGenericLabels
# See here for the discussion on the debian-cloud mailing list
# https://... | code_fim | medium | {
"lang": "python",
"repo": "apolloclark/bootstrap-vz",
"path": "/bootstrapvz/providers/docker/tasks/image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def domainToPivot(malEntityData, domain):
urlLookup = {}
try:
jsonData = getJSON('/pivot/indicator/domain/'+domain,'','')
if 'message' in jsonData.keys():
jsonMessage = jsonData[u'message']
indicators = jsonMessage[u'publishedIndicators']
for jsonReport in ind... | code_fim | hard | {
"lang": "python",
"repo": "larrycameron80/maltego-transforms",
"path": "/iSight/iSightTransforms.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: larrycameron80/maltego-transforms path: /iSight/iSightTransforms.py
#!/usr/bin/python
'''
Copyright (c) 2015, Ryan Keyes
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redi... | code_fim | hard | {
"lang": "python",
"repo": "larrycameron80/maltego-transforms",
"path": "/iSight/iSightTransforms.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
jsonData = getJSON('/search/basic',query,queryVars)
if 'message' in jsonData.keys():
jsonMessage = jsonData[u'message']
for jsonReport in jsonMessage:
if 'title' in jsonReport.keys():
title = jsonReport[u'title']
if not title ... | code_fim | hard | {
"lang": "python",
"repo": "larrycameron80/maltego-transforms",
"path": "/iSight/iSightTransforms.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> filter_horizontal = ('tags', 'keywords') # add a box to the left and right for multiple selection
# Restrict user permissions and only see articles edited by you
def get_queryset (self, request):
qs = super (ArticleAdmin, self) .get_queryset (request)
if request.user.is_superu... | code_fim | hard | {
"lang": "python",
"repo": "aiegoo/django-blog",
"path": "/sandbox/apps/blog/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aiegoo/django-blog path: /sandbox/apps/blog/admin.py
from django.contrib import admin
from .models import Article, Tag, Category, Timeline, Carousel, Silian, Keyword, FriendLink
@ admin.register (Article)
class ArticleAdmin (admin.ModelAdmin):
# The purpose of this is to give a screening me... | code_fim | hard | {
"lang": "python",
"repo": "aiegoo/django-blog",
"path": "/sandbox/apps/blog/admin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: njyuhe/opyoid path: /opyoid/providers/providers_factories/type_provider_factory.py
from typing import Type
from opyoid.bindings import ClassBinding, FromInstanceProvider, SelfBinding
from opyoid.exceptions import NoBindingFound
from opyoid.injection_context import InjectionContext
from opyoid.pr... | code_fim | hard | {
"lang": "python",
"repo": "njyuhe/opyoid",
"path": "/opyoid/providers/providers_factories/type_provider_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create(self, context: InjectionContext[Type[InjectedT]]) -> Provider[Type[InjectedT]]:
new_target = Target(context.target.type.__args__[0], context.target.named)
new_context = context.get_child_context(new_target)
binding = new_context.get_binding()
if not binding o... | code_fim | hard | {
"lang": "python",
"repo": "njyuhe/opyoid",
"path": "/opyoid/providers/providers_factories/type_provider_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> db.child("DATA").child(id_).child("TASKS").child(task).remove()
def list_tasks(id_):
tasks = db.child("DATA").child(id_).child("TASKS").get().val()
if tasks == None:
return []
else:
return list(tasks.keys())
# add_note(id_=69420,title="t1",note="lalalala") # add note to... | code_fim | medium | {
"lang": "python",
"repo": "swasthikshetty10/EPAX-AI",
"path": "/to_do/database.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swasthikshetty10/EPAX-AI path: /to_do/database.py
import os
import json
import pyrebase
config = json.loads(open("Backend/firebase_config.json", "r").read())
# print(config)
firebase = pyrebase.initialize_app(config)
db = firebase.database()
###### FOR NOTES #########
def add_note(id_, title... | code_fim | medium | {
"lang": "python",
"repo": "swasthikshetty10/EPAX-AI",
"path": "/to_do/database.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
event_loop.run_until_complete(asyncio.wait(task_list))
# event_loop.run_forever()
except KeyboardInterrupt:
print('closing client')
ws_client.sync_close()
# event_loop.run_until_complete(ws_client.close())
shutdown(task_list)
event_loop... | code_fim | hard | {
"lang": "python",
"repo": "NOAA-PMEL/envDataSystem",
"path": "/daq_server/test_ws.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NOAA-PMEL/envDataSystem path: /daq_server/test_ws.py
import websockets
import asyncio
import json
import time
from client.client import WSClient
from shared.data.message import Message
from datetime import datetime
async def send_data(client):
while True:
body = 'fake message - {}'... | code_fim | hard | {
"lang": "python",
"repo": "NOAA-PMEL/envDataSystem",
"path": "/daq_server/test_ws.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /third_party/gsutil/third_party/pyu2f/pyu2f/hid/windows.py
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a co... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/third_party/gsutil/third_party/pyu2f/pyu2f/hid/windows.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Raises:
WindowsError when unable to obtain capabilitites.
"""
preparsed_data = PHIDP_PREPARSED_DATA(0)
ret = hid.HidD_GetPreparsedData(device, ctypes.byref(preparsed_data))
if not ret:
raise ctypes.WinError()
try:
caps = HidCapabilities()
ret = hid.HidP_GetCaps(preparsed_data,... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/third_party/gsutil/third_party/pyu2f/pyu2f/hid/windows.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# >HLA:HLA00001 A*01:01:01:01 3503 bp
# >HLA:HLA02169 A*01:01:01:02N 3291 bp
# >HLA:HLA14798 A*01:01:01:03 3503 bp
# >HLA:HLA15760 A*01:01:01:04 3087 bp
# >HLA:HLA16415 A*01:01:01:05 3321 bp
# >HLA:HLA16417 A*01:01:01:06 3097 bp
targets=[]
with open (targetlist) as tin:
for line in tin:
# str... | code_fim | hard | {
"lang": "python",
"repo": "jdurbin/sandbox",
"path": "/bin/seqsbyname.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdurbin/sandbox path: /bin/seqsbyname.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from Bio import SeqIO
if len(sys.argv) < 3:
print("seqsbyname fastaFile targetList seqout.fa")
sys.exit(1)
fasta_file = sys.argv[1] # Input fasta file
targetlist = sys.argv[2]
outfile = ... | code_fim | medium | {
"lang": "python",
"repo": "jdurbin/sandbox",
"path": "/bin/seqsbyname.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open(outfile,"w") as fout:
for target in targets:
targetseq=seqdict[target] # This is a SeqRecord
SeqIO.write(targetseq,fout,"fasta")<|fim_prefix|># repo: jdurbin/sandbox path: /bin/seqsbyname.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from Bio import SeqIO
if... | code_fim | hard | {
"lang": "python",
"repo": "jdurbin/sandbox",
"path": "/bin/seqsbyname.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def user_in_role(role):
if role == g.auth_role:
return True
return False
def role_has_privilege(role, privilege):
for _privilege in PRIVILEGES[role]:
if fnmatch.fnmatch(privilege, _privilege):
return True
return False
def set_xfo_header(response):
"""Add... | code_fim | hard | {
"lang": "python",
"repo": "lyft/osscla",
"path": "/osscla/authnz.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyft/osscla path: /osscla/authnz.py
from __future__ import absolute_import
import fnmatch
import random
import copy
from authomatic import Authomatic
from authomatic.providers import oauth2
from authomatic.adapters import WerkzeugAdapter
from flask import g, abort, session, request, make_respons... | code_fim | hard | {
"lang": "python",
"repo": "lyft/osscla",
"path": "/osscla/authnz.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def require_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
try:
email = get_logged_in_user_email()
is_admin = False
try:
orgs = get_logged_in_user_orgs()
for org in orgs:
if org.get('login') == app... | code_fim | hard | {
"lang": "python",
"repo": "lyft/osscla",
"path": "/osscla/authnz.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def session_end_pb(status, end_time_secs=None):
"""Creates a summary that contains status information for a completed
training session. Should be exported after the training session is completed.
One such summary per training session should be created. Each should have
a different run.
Arguments... | code_fim | hard | {
"lang": "python",
"repo": "NervanaSystems/tensorboard",
"path": "/tensorboard/plugins/hparams/summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_uri="",
monitor_url="",
group_name="",
start_time_secs=None):
"""Creates a summary that contains a training session metadata information.
One such summary per training session should be created. Each should have
... | code_fim | hard | {
"lang": "python",
"repo": "NervanaSystems/tensorboard",
"path": "/tensorboard/plugins/hparams/summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NervanaSystems/tensorboard path: /tensorboard/plugins/hparams/summary.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | code_fim | hard | {
"lang": "python",
"repo": "NervanaSystems/tensorboard",
"path": "/tensorboard/plugins/hparams/summary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zxy317/CIFAR-ZOO path: /utils.py
# -*-coding:utf-8-*-
import logging
import math
import os
import shutil
import tensorflow as tf
from scipy.stats import ttest_ind
import numpy as np
import torch
import torchvision
import torchvision.transforms as transforms
class Cutout(object):
def __init_... | code_fim | hard | {
"lang": "python",
"repo": "zxy317/CIFAR-ZOO",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
pairs_for_sstesting = []
# prepare pairs for concpet vs random.
for pair in pairs_to_test:
for concept in pair[1]:
pairs_for_sstesting.append([pair[0], [concept]])
return pairs_for_sstesting
def process_what_to_run_randoms(pairs_to_test, random_counterpart):
... | code_fim | hard | {
"lang": "python",
"repo": "zxy317/CIFAR-ZOO",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print 'Not quite right, try again!'
exit(1)<|fim_prefix|># repo: codio-content/Python_Maze-Decomposition_variables path: /.guides/tests/py-3.py
maze = False
def createEmptyMaze(w, h):
global maze
if w == 10 and h == 14:
maze = True
<|fim_middle|>try:
execfile('/home/codio/workspace/public... | code_fim | medium | {
"lang": "python",
"repo": "codio-content/Python_Maze-Decomposition_variables",
"path": "/.guides/tests/py-3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codio-content/Python_Maze-Decomposition_variables path: /.guides/tests/py-3.py
maze = False
def createEmptyMaze(w, h):
<|fim_suffix|> if w == 10 and h == 14:
maze = True
try:
execfile('/home/codio/workspace/public/py/py-3.py')
if maze == True:
print 'well done'
exit(0)
exce... | code_fim | easy | {
"lang": "python",
"repo": "codio-content/Python_Maze-Decomposition_variables",
"path": "/.guides/tests/py-3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif "/" in data["NOTICE_TIME_"]:
time_array = time.strptime(data["NOTICE_TIME_"], "%Y/%m/%d")
data["NOTICE_TIME_"] = time.strftime("%Y-%m-%d", time_array)
elif "\\" in data["NOTICE_TIME_"]:
time_array = time.strp... | code_fim | hard | {
"lang": "python",
"repo": "ILKKAI/dataETL",
"path": "/datashufflepy-zeus/src/scripts/CommonBidding/CommonBidding_500000CQSX.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ILKKAI/dataETL path: /datashufflepy-zeus/src/scripts/CommonBidding/CommonBidding_500000CQSX.py
# -*- coding: utf-8 -*-
# 重庆三峡银行网站 500000CQSX
# 3242 条 无 WIN_CANDIDATE_ 字段 2 条数据有有多个项目
# 时间 ['500000CQSX.CONTENT.NOTICE_TIME_', '2015-09-02'] 待清洗
import re
import time
from database._phoenix_hba... | code_fim | hard | {
"lang": "python",
"repo": "ILKKAI/dataETL",
"path": "/datashufflepy-zeus/src/scripts/CommonBidding/CommonBidding_500000CQSX.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: runngezhang/kaldi-enhan path: /scripts/sptk/visualize_beampattern.py
#!/usr/bin/env python
# wujian@2019
import argparse
import matplotlib.pyplot as plt
import numpy as np
from libs.beamformer import beam_pattern
def run(args):
# (B) x F x M
weight = np.load(args.weight)
multi_b... | code_fim | hard | {
"lang": "python",
"repo": "runngezhang/kaldi-enhan",
"path": "/scripts/sptk/visualize_beampattern.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Command to plot beam pattern of the fixed beamformer",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("weight",
type=str,
help="Wei... | code_fim | hard | {
"lang": "python",
"repo": "runngezhang/kaldi-enhan",
"path": "/scripts/sptk/visualize_beampattern.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def plot_traces(self, path):
print("%s. Plotting traces ... " % (self.name))
n = int(self.fs * t_block) # Number of data in a time block
m = int(self.N / n) # Number of block
if m == 0:
print("Time block (%.2f s) is too long... \... | code_fim | hard | {
"lang": "python",
"repo": "jmsung/trap_analysis",
"path": "/scripts/Analysis/HFS-Sine_Detect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def find_events(self):
t = self.t
QPD = self.QPDy
dQPD = self.dQPD
A = self.dQPD_A
PZT = self.PZT_fit
ib0 = self.ib0
iu0 = self.iu0
N_ub = self.T*2
if len(ib0) == 0:
print("No event.")
... | code_fim | hard | {
"lang": "python",
"repo": "jmsung/trap_analysis",
"path": "/scripts/Analysis/HFS-Sine_Detect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmsung/trap_analysis path: /scripts/Analysis/HFS-Sine_Detect.py
####################################
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import nptdms
import os
import scipy
from scipy.optimize import curve_... | code_fim | hard | {
"lang": "python",
"repo": "jmsung/trap_analysis",
"path": "/scripts/Analysis/HFS-Sine_Detect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dogancankilment/image-processing path: /plaka-uygulamasi.py
# coding: utf-8
import matplotlib.pyplot as plt
import numpy as np
img_1=plt.imread("test_1.jpg")
img_1.ndim
img_1.shape
img_2=img_1[1:1080:2,1:1920:2]
img_2.ndim,img_2.shape
plt.imshow(img_2)
plt.show()
img_2
plt.imshow(img_1,plt.cm.g... | code_fim | hard | {
"lang": "python",
"repo": "dogancankilment/image-processing",
"path": "/plaka-uygulamasi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>img_1=plt.imread("plaka.jpg")
img_1.ndim,img_1.shape
img_5=np.zeros((img_1.shape[0:2]))
img_2=img_1
img_2.shape,img_5.shape
threshold=100
for i in range(img_2.shape[0]):
for j in range(img_2.shape[1]):
n=img_2[i,j,0]/3 + img_2[i,j,1]/3 + img_2[i,j,2]/3
img_3[i,j]=n
if n > thres... | code_fim | medium | {
"lang": "python",
"repo": "dogancankilment/image-processing",
"path": "/plaka-uygulamasi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.imshow(img_4, plt.cm.binary)
plt.show()
img_1=plt.imread("plaka.jpg")
img_1.ndim,img_1.shape
img_5=np.zeros((img_1.shape[0:2]))
img_2=img_1
img_2.shape,img_5.shape
threshold=100
for i in range(img_2.shape[0]):
for j in range(img_2.shape[1]):
n=img_2[i,j,0]/3 + img_2[i,j,1]/3 + img_2[i,j,2... | code_fim | hard | {
"lang": "python",
"repo": "dogancankilment/image-processing",
"path": "/plaka-uygulamasi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
super(PrivateThreadDeleteApiTests, self).setUp()
self.thread = testutils.post_thread(self.category, poster=self.user)
self.api_link = self.thread.get_api_url()
ThreadParticipant.objects.add_participants(self.thread, [self.user])
def test_delete_t... | code_fim | hard | {
"lang": "python",
"repo": "HenryChenV/iJiangNan",
"path": "/misago/threads/tests/test_privatethreads_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HenryChenV/iJiangNan path: /misago/threads/tests/test_privatethreads_api.py
from django.urls import reverse
from misago.acl.testutils import override_acl
from misago.threads import testutils
from misago.threads.models import Thread, ThreadParticipant
from .test_privatethreads import PrivateThre... | code_fim | hard | {
"lang": "python",
"repo": "HenryChenV/iJiangNan",
"path": "/misago/threads/tests/test_privatethreads_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cjdekker/Tree_Exercises path: /compute_diameter.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# In[3]:
def compute_diameter(tree):
'''
This function computes a diameter path (i.e. a longest path between any two nodes) of a tree and its length
:param tree: the tree
:re... | code_fim | hard | {
"lang": "python",
"repo": "cjdekker/Tree_Exercises",
"path": "/compute_diameter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s())
ssl.reverse()
sl.extend(ssl)
dd = {**md[be], **md[i]}
dl = list(dd.values())
dl.remove(None)
if sum(dl) > mu:
mu = sum(dl)
fl = sl
ffl = []
for i in fl:
if i not in ffl:
ffl.append(i)
d_length = mu... | code_fim | hard | {
"lang": "python",
"repo": "cjdekker/Tree_Exercises",
"path": "/compute_diameter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndersonZhangyq/inpaint path: /pytorch-lightning-seed/research_seed/deep_image_prior/dip.py
"""
This file defines the core research contribution
"""
import os
import torch
from torch.nn import functional as F
from torch.utils.data import DataLoader
from argparse import ArgumentParser
import pyto... | code_fim | hard | {
"lang": "python",
"repo": "AndersonZhangyq/inpaint",
"path": "/pytorch-lightning-seed/research_seed/deep_image_prior/dip.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.model(x)
def training_step(self, batch, batch_idx):
# REQUIRED
noise, origin, mask, context_mask = batch
predicted = self.forward(noise)
self.predict_output = predicted.detach().cpu().numpy().squeeze()
self.saved_output = (
predi... | code_fim | hard | {
"lang": "python",
"repo": "AndersonZhangyq/inpaint",
"path": "/pytorch-lightning-seed/research_seed/deep_image_prior/dip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DaviYokogawa/PesquisaCovid path: /WS_data_url.py
from bs4 import BeautifulSoup as bs # Importando BeautifulSoup
import requests # Importando Requests
url = 'https://www.saude.pr.gov.br/Pagina/Coronavirus-COVID-19' # Definindo URL
r = requests.get(url, headers={'User-Agent':'MyAgent'}) # Fazendo ... | code_fim | hard | {
"lang": "python",
"repo": "DaviYokogawa/PesquisaCovid",
"path": "/WS_data_url.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('data/casos_geral.txt', 'w') as f: # Salvando os casos gerais
for i in link_geral:
f.write('%s\n' % i)<|fim_prefix|># repo: DaviYokogawa/PesquisaCovid path: /WS_data_url.py
from bs4 import BeautifulSoup as bs # Importando BeautifulSoup
import requests # Importando Requests
url = 'h... | code_fim | hard | {
"lang": "python",
"repo": "DaviYokogawa/PesquisaCovid",
"path": "/WS_data_url.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for column in raw_columns:
print(raw_data[0,column])
print(raw_data)
print(columns)<|fim_prefix|># repo: BoasWhip/Black path: /Code/Analysis.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 20 12:08:10 2017
@author: ozsanos
"""
<|fim_middle|>import pandas as pd
raw_data = pd.r... | code_fim | hard | {
"lang": "python",
"repo": "BoasWhip/Black",
"path": "/Code/Analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
Compile unique dates
"""
raw_columns = list(raw_data)
for column in raw_columns:
print(raw_data[0,column])
print(raw_data)
print(columns)<|fim_prefix|># repo: BoasWhip/Black path: /Code/Analysis.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 20 12:08:10 2017
@author: ... | code_fim | hard | {
"lang": "python",
"repo": "BoasWhip/Black",
"path": "/Code/Analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BoasWhip/Black path: /Code/Analysis.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 20 12:08:10 2017
@author: ozsanos
"""
<|fim_suffix|>"""
Delete raw columns
"""
for column in raw_columns:
if column[0:8] == "Unnamed:":
del raw_data[column]
else:
column... | code_fim | medium | {
"lang": "python",
"repo": "BoasWhip/Black",
"path": "/Code/Analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daisukelab/dl-cliche path: /test/test_torch_utils.py
"""
Torch utils tests.
"""
import unittest
from dlcliche.utils import *
from dlcliche.torch_utils import *
import torch
class TestTorchUtils(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def... | code_fim | hard | {
"lang": "python",
"repo": "daisukelab/dl-cliche",
"path": "/test/test_torch_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(np.all(calculated_mixed_targets.numpy() == mixed_targets.numpy()))
def test_label_smoothing(self):
logits = torch.Tensor([[0.3529, 0.8618, 0.8859, 0.9957, 0.5551, 0.8189],
[0.0897, 0.1646, 0.7691, 0.6098, 0.6384, 0.7858],
... | code_fim | hard | {
"lang": "python",
"repo": "daisukelab/dl-cliche",
"path": "/test/test_torch_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (len(textures), texture_w, texture_h,
s_textures_hs_flat, s_textures_ss_flat, s_textures_vs_flat)
def render_triangles_preprocessed(self, size, view_dist, draw_dist, camera,
triangles_pre, textures_pre,
... | code_fim | hard | {
"lang": "python",
"repo": "nqpz/futracer",
"path": "/futracer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(textures) > 0:
s_textures = numpy.array(textures)
s_textures_hs = s_textures[:,:,:,0]
s_textures_hs_flat = numpy.reshape(
s_textures_hs,
len(textures) * texture_h * texture_w)
s_textures_hs_flat = self.to_numpy(... | code_fim | hard | {
"lang": "python",
"repo": "nqpz/futracer",
"path": "/futracer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nqpz/futracer path: /futracer.py
import itertools
import colorsys
import numpy
import png
import futracerlib
render_approaches_map = {
'segmented': 1,
'chunked': 2,
'scatter_bbox': 3,
}
render_approaches = list(render_approaches_map.keys())
def next_elem(xs, y):
for i in rang... | code_fim | hard | {
"lang": "python",
"repo": "nqpz/futracer",
"path": "/futracer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gamIsoDepositTk = cms.EDProducer("CandIsoDepositProducer",
src = cms.InputTag("photons"),
trackType = cms.string('candidate'),
MultipleDepositsFlag = cms.bool(False),
ExtractorPSet = cms.PSet(GamIsoTrackExtractorBlock)
)<|fim_prefix|># repo: cms-sw/cmssw path: /RecoEgamma/EgammaIsolationA... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/RecoEgamma/EgammaIsolationAlgos/python/gamIsoDepositTk_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /RecoEgamma/EgammaIsolationAlgos/python/gamIsoDepositTk_cff.py
import FWCore.ParameterSet.Config as cms
<|fim_suffix|>gamIsoDepositTk = cms.EDProducer("CandIsoDepositProducer",
src = cms.InputTag("photons"),
trackType = cms.string('candidate'),
MultipleDepositsFlag... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/RecoEgamma/EgammaIsolationAlgos/python/gamIsoDepositTk_cff.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vasilcovsky/billy path: /billy/api/plan/views.py
from __future__ import unicode_literals
import transaction as db_transaction
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPNotFound
from pyramid.httpexceptions import HTTPForbidden
from pyramid.httpexceptions import H... | code_fim | hard | {
"lang": "python",
"repo": "vasilcovsky/billy",
"path": "/billy/api/plan/views.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>@view_config(route_name='plan_list',
request_method='POST',
renderer='json')
def plan_list_post(request):
"""Create a new plan
"""
company = auth_api_key(request)
form = validate_form(PlanCreateForm, request)
plan_type = form.data['plan_type']
amo... | code_fim | hard | {
"lang": "python",
"repo": "vasilcovsky/billy",
"path": "/billy/api/plan/views.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quinn-dougherty/DS-Unit-3-Sprint-1-Software-Engineering path: /SC/acme_test.py
#!/usr/bin/env python
'''
Add at least 2 more test methods to AcmeProductTests for the base Product class:
- at least 1 that tests default values (as shown), and one that builds an
object with different valu... | code_fim | hard | {
"lang": "python",
"repo": "quinn-dougherty/DS-Unit-3-Sprint-1-Software-Engineering",
"path": "/SC/acme_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AcmeReportTests(unittest.TestCase):
"""test report
- Write a new test class AcmeReportTests with at least 2 test methods:
test_default_num_products which checks that it really does receive a
list of length 30, and test_legal_names which checks that the
generated names ... | code_fim | hard | {
"lang": "python",
"repo": "quinn-dougherty/DS-Unit-3-Sprint-1-Software-Engineering",
"path": "/SC/acme_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_explode(self):
"""test the explode method"""
prod1 = Product('test prod 1', weight=400, flammability=400.0)
prod2 = Product("not explosive", weight=1, flammability=exp(-4.0))
#glove = BoxingGlove("adonis creed")
self.assertEqual(prod1.explode(), "...BAB... | code_fim | hard | {
"lang": "python",
"repo": "quinn-dougherty/DS-Unit-3-Sprint-1-Software-Engineering",
"path": "/SC/acme_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ynomial import fit_polynomial
from .fit_polynomial import fit_polynomial_findorder
from .fit_mixture import fit_mixture
from .fit_error import fit_error
from .fit_error import fit_mse
from .fit_error import fit_rmse
from .fit_error import fit_r2<|fim_prefix|># repo: purpl3F0x/NeuroKit path: /neurokit2/st... | code_fim | medium | {
"lang": "python",
"repo": "purpl3F0x/NeuroKit",
"path": "/neurokit2/stats/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: purpl3F0x/NeuroKit path: /neurokit2/stats/__init__.py
"""Submodule for NeuroKit."""
from .standardize import standardize
from .hdi import hdi
from .mad import mad
from .density import density
from .distance import distance
from .rescale import rescale
from .fit_loess import fit_loess
from .fit_p... | code_fim | medium | {
"lang": "python",
"repo": "purpl3F0x/NeuroKit",
"path": "/neurokit2/stats/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>om .fit_error import fit_error
from .fit_error import fit_mse
from .fit_error import fit_rmse
from .fit_error import fit_r2<|fim_prefix|># repo: purpl3F0x/NeuroKit path: /neurokit2/stats/__init__.py
"""Submodule for NeuroKit."""
from .standardize import standardize
from .hdi import hdi
from .mad import ... | code_fim | hard | {
"lang": "python",
"repo": "purpl3F0x/NeuroKit",
"path": "/neurokit2/stats/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for stage in stages:
name = stage.name
cfg = stage_descriptions.get(name, None)
if not cfg:
raise BadStagesDescription("Missing description for stage '{}'".format(name))
elif not isinstance(cfg, dict):
raise BadStagesDescription("Description for ... | code_fim | hard | {
"lang": "python",
"repo": "benkrikler/alphatwirl-interface",
"path": "/alphatwirl_interface/config/dict_config.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benkrikler/alphatwirl-interface path: /alphatwirl_interface/config/dict_config.py
from __future__ import absolute_import
import six
import collections
from .base_stage import BaseStage
from .config_exceptions import BadAlphaTwirlInterfaceConfig
import os
import logging
logger = logging.getLogger(... | code_fim | hard | {
"lang": "python",
"repo": "benkrikler/alphatwirl-interface",
"path": "/alphatwirl_interface/config/dict_config.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _configure_stages(stages, stage_descriptions):
for stage in stages:
name = stage.name
cfg = stage_descriptions.get(name, None)
if not cfg:
raise BadStagesDescription("Missing description for stage '{}'".format(name))
elif not isinstance(cfg, dict):
... | code_fim | medium | {
"lang": "python",
"repo": "benkrikler/alphatwirl-interface",
"path": "/alphatwirl_interface/config/dict_config.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reverse_compliment(self):
output = ""
for nucleobase in self.dna:
if nucleobase == "A":
output = "T" + output
elif nucleobase == "T":
output = "A" + output
elif nucleobase == "G":
output = "C" + out... | code_fim | hard | {
"lang": "python",
"repo": "CasBoom/django_dna",
"path": "/dna/dna_analysis/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rna = ""
for letter in self.dna:
if letter == "T":
rna = rna + "U"
else:
rna = rna + letter
return rna
def generate_protein(self):
rna = self.find_rna()
codon_table = {'UUU': 'F', 'CUU': 'L', 'AUU': 'I', '... | code_fim | hard | {
"lang": "python",
"repo": "CasBoom/django_dna",
"path": "/dna/dna_analysis/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CasBoom/django_dna path: /dna/dna_analysis/models.py
from django.db import models
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Create your models here.
class dna_profile(models.Model):
title = models.CharField(max_length=200)
dna = models.TextField()
... | code_fim | hard | {
"lang": "python",
"repo": "CasBoom/django_dna",
"path": "/dna/dna_analysis/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BearlyKoalafied/GGGGobbler path: /db/data_structs.py
class StaffPost:
"""
Class to encapsulate a post's contents with its author and parent thread
"""
def __init__(self, post_id, thread_id, author, md_text, date):
<|fim_suffix|> def __eq__(self, other):
return self.thr... | code_fim | medium | {
"lang": "python",
"repo": "BearlyKoalafied/GGGGobbler",
"path": "/db/data_structs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.thread_id == other.thread_id and \
self.post_id == other.post_id and \
self.author == other.author and \
self.md_text == other.md_text and \
self.date == other.date<|fim_prefix|># repo: BearlyKoalafied/GGGGobbler path: /db/data_structs.p... | code_fim | medium | {
"lang": "python",
"repo": "BearlyKoalafied/GGGGobbler",
"path": "/db/data_structs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
def __init__(
self,
sig_type: SignalType = SignalType.RESERVED,
header: Optional[SignalHeader] = None,
):
if header is None:
header = SignalHeader(sig_type, 0)
super().__init__(header)
@classmethod
def from_buffer(cls, buffer: b... | code_fim | hard | {
"lang": "python",
"repo": "Rohde-Schwarz/dlepard",
"path": "/src/rsb_dlep/signal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rohde-Schwarz/dlepard path: /src/rsb_dlep/signal.py
import logging
import struct
from enum import IntEnum
from typing import Optional
from ._interface import HeaderInterface, PduInterface
log = logging.getLogger(__name__)
class SignalType(IntEnum):
"""Defines all the DLEP signal types acc... | code_fim | hard | {
"lang": "python",
"repo": "Rohde-Schwarz/dlepard",
"path": "/src/rsb_dlep/signal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.Graph().as_default():
split = 'train'
image_bytes = tf.placeholder(tf.string, [None])
image = tf.map_fn(lambda frame: tf.image.decode_jpeg(frame, channels=3), image_bytes, dtype=tf.uint8)
#blah = tf.map_fn(lambda frame: preprocessing_factory.get_preprocessing('r... | code_fim | hard | {
"lang": "python",
"repo": "jmftrindade/miniplaces_challenge",
"path": "/model/slim/test_image_classifier_train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmftrindade/miniplaces_challenge path: /model/slim/test_image_classifier_train.py
import tensorflow as tf
from tensorflow.python.training import saver as tf_saver
from nets import nets_factory
import cv2
import numpy as np
import nets
import json
from preprocessing import preprocessing_factory
fr... | code_fim | hard | {
"lang": "python",
"repo": "jmftrindade/miniplaces_challenge",
"path": "/model/slim/test_image_classifier_train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> saver.restore(sess, checkpoint_path)
batch_size = 100
im_batch = []
im_filenames = []
f = open('/home/labuser/miniplaces/data/train.txt');
for line in f:
filename = line.split()[0]
im_filename = '/home... | code_fim | hard | {
"lang": "python",
"repo": "jmftrindade/miniplaces_challenge",
"path": "/model/slim/test_image_classifier_train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: decagondev/CS_41_long path: /arch/cpu.py
"""CPU functionality."""
import sys
LDI = 0b10000010
PRN = 0b01000111
HLT = 0b00000001
POP = 0b01000110
PUSH = 0b01000101
MUL = 0b10100010
SP = 7
class CPU:
"""Main CPU class."""
def __init__(self):
"""Construct a new CPU."""
... | code_fim | hard | {
"lang": "python",
"repo": "decagondev/CS_41_long",
"path": "/arch/cpu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def alu(self, op, reg_a, reg_b):
"""ALU operations."""
if op == "ADD":
self.reg[reg_a] += self.reg[reg_b]
elif op == "SUB":
self.reg[reg_a] -= self.reg[reg_b]
elif op == "MUL":
self.reg[reg_a] *= self.reg[reg_b]
elif op == "D... | code_fim | hard | {
"lang": "python",
"repo": "decagondev/CS_41_long",
"path": "/arch/cpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if num == '': # ignore blanks
continue
# turn the number string in to an integer
val = int(num, 2)
print(val)
self.ram_write(address, val)
address += 1
def alu(self, op, reg_a, reg_... | code_fim | hard | {
"lang": "python",
"repo": "decagondev/CS_41_long",
"path": "/arch/cpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spiricn/DevUtils path: /du/__init__.py
__version__ = "1.11.0"
__version_name__ = __version__
<|fim_suffix|> # Dynamic meta
versionMeta = versionName + "@" + buildTime
__version_name__ += " [%s]" % versionMeta if versionMeta else ""
except ImportError:
# Not generated ... | code_fim | medium | {
"lang": "python",
"repo": "spiricn/DevUtils",
"path": "/du/__init__.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.