text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate
addSignalDialog.setWindowTitle(_translate("addSignalDialog", "Load Signal"))
self.linkedSignal.setText(_translate("addSignalDialog", "Linked Filter?"))
self.filterSelectLabel.setText(_translate("addSignalDialog", "Copy Filter")... | code_fim | hard | {
"lang": "python",
"repo": "3ll3d00d/beqdesigner",
"path": "/src/main/python/ui/signal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zorun/django-simplesshkey path: /simplesshkey/models.py
# -*- coding: utf-8 -*-
# Copyright (c) 2017, 2022, Baptiste Jonglez
# Copyright (c) 2014-2016, Clemson University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... | code_fim | hard | {
"lang": "python",
"repo": "zorun/django-simplesshkey",
"path": "/simplesshkey/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
abstract = True
def __str__(self):
return '{}: {} [{}]'.format(self.user, self.name, self.keytype)
def clean_fields(self, exclude=None):
if not exclude or 'key' not in exclude:
self.key = self.key.strip()
if not self.key:
... | code_fim | hard | {
"lang": "python",
"repo": "zorun/django-simplesshkey",
"path": "/simplesshkey/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not exclude or 'key' not in exclude:
self.key = self.key.strip()
if not self.key:
raise ValidationError({'key': ["This field is required."]})
def clean(self):
self.key = self.key.strip()
if not self.key:
return
try... | code_fim | hard | {
"lang": "python",
"repo": "zorun/django-simplesshkey",
"path": "/simplesshkey/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: js2251/ASRbasic path: /Timit_train_and_eval.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 19 21:24:24 2019
@author: js2251
"""
import numpy as np
#import multiprocessing as mp
import pickle
from TimitData import savePhonemeInformation, getPhonemeDict, savePhonemeInformation39, sav... | code_fim | hard | {
"lang": "python",
"repo": "js2251/ASRbasic",
"path": "/Timit_train_and_eval.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> idx_valed = np.array(idx_val)[np.array(range(len(Y_now )))] + num_timesteps_NN_NonCausal - int(num_timesteps_NN_NonCausal/2)
start_idx = np.load('StartIndices_dev.npy')
start_idx = np.append(start_idx,len(idx)-1) # add the end -> not a start id, but the end of the last segment
return Pi... | code_fim | hard | {
"lang": "python",
"repo": "js2251/ASRbasic",
"path": "/Timit_train_and_eval.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nemde-dev/nemde path: /nemde/tests/test_io_casefile.py
"""
Test loading of casefiles
"""
import os
import pytest
import context
from nemde.io.casefile import load_xml_from_archive
<|fim_suffix|> year = int(os.environ['TEST_YEAR'])
month = int(os.environ['TEST_MONTH'])
casefile = l... | code_fim | medium | {
"lang": "python",
"repo": "nemde-dev/nemde",
"path": "/nemde/tests/test_io_casefile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> year = int(os.environ['TEST_YEAR'])
month = int(os.environ['TEST_MONTH'])
casefile = load_xml_from_archive(data_dir=os.environ['CASEFILE_DIR'],
year=year, month=month, day=1, interval=1)
assert isinstance(casefile, bytes)<|fim_prefix|># repo: nemde-de... | code_fim | hard | {
"lang": "python",
"repo": "nemde-dev/nemde",
"path": "/nemde/tests/test_io_casefile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kinvarbuilder/kinvarbuilder path: /kinvarbuilder/functions/PtOverMass.py
#!/usr/bin/env python
# kinvarbuilder - A library for searching kinematic variables in a systematic way
#
# Copyright 2014 University of California, San Diego
#
# Licensed under the Apache License, Version 2.0 (the "License... | code_fim | medium | {
"lang": "python",
"repo": "kinvarbuilder/kinvarbuilder",
"path": "/kinvarbuilder/functions/PtOverMass.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> vectorValues = [ vector.getValue() for vector in self.vectors ]
for value in vectorValues:
if value == None:
return None
mass = (vectorValues[0] + vectorValues[1]).M()
return vectorValues[0].Pt() / mass
def getParents(self):
retur... | code_fim | hard | {
"lang": "python",
"repo": "kinvarbuilder/kinvarbuilder",
"path": "/kinvarbuilder/functions/PtOverMass.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.vectors
@staticmethod
def getNumArguments(maxNumArguments):
return [ 2 ]
def __str__(self):
return "PtOverMass(" + ", ".join(str(v) for v in self.vectors) +")"<|fim_prefix|># repo: kinvarbuilder/kinvarbuilder path: /kinvarbuilder/functions/PtOverMass.py
#... | code_fim | hard | {
"lang": "python",
"repo": "kinvarbuilder/kinvarbuilder",
"path": "/kinvarbuilder/functions/PtOverMass.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
DEFAULT_CONFIG_FILE = os.path.join(os.getenv("HOME"),
".kanboard_task_search.conf")
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config",
default=DEFAULT_CONFIG_FILE,
help="Specify the config file")
parser.add_... | code_fim | hard | {
"lang": "python",
"repo": "ryot4/kanboard-task-search",
"path": "/kanboard-task-search",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryot4/kanboard-task-search path: /kanboard-task-search
#!/usr/bin/env python3
import argparse
import configparser
import json
import os
import sys
from datetime import datetime
from jinja2 import Environment
from kanboard import Client, ClientError
class Formatter:
def __init__(self, temp... | code_fim | hard | {
"lang": "python",
"repo": "ryot4/kanboard-task-search",
"path": "/kanboard-task-search",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dvalentina/2019-2-Track-Backend-V-Danilova path: /microservice/client.py
#!/usr/bin/env python3
import sys
import json
import socket
def parse_url(url):
<|fim_suffix|>if __name__ == "__main__":
if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <url>')
sys.exit(1)
url =... | code_fim | hard | {
"lang": "python",
"repo": "dvalentina/2019-2-Track-Backend-V-Danilova",
"path": "/microservice/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <url>')
sys.exit(1)
url = sys.argv[1]
parse_url(url)<|fim_prefix|># repo: dvalentina/2019-2-Track-Backend-V-Danilova path: /microservice/client.py
#!/usr/bin/env python3
import sys
import json
impo... | code_fim | hard | {
"lang": "python",
"repo": "dvalentina/2019-2-Track-Backend-V-Danilova",
"path": "/microservice/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = b''
tmp = client_socket.recv(1024)
while tmp:
print(f'Recieved data is [{tmp}]')
data += tmp
tmp = client_socket.recv(1024)
url_info = json.loads(data)
print(f"Recieved message is {url_info}")
client_socket.close()
if __name__ == "__main__":
if l... | code_fim | medium | {
"lang": "python",
"repo": "dvalentina/2019-2-Track-Backend-V-Danilova",
"path": "/microservice/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haiiliin/pyabaqus path: /src/abaqus/TableCollection/ActivateElements.py
class ActivateElements:
"""The ActivateElements object is used turn on progressive element activation within a step
definition.
Notes
-----
This object can be accessed by:
<|fim_suffix|> Raises
... | code_fim | hard | {
"lang": "python",
"repo": "haiiliin/pyabaqus",
"path": "/src/abaqus/TableCollection/ActivateElements.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setValues(self):
"""This method modifies the ActivateElements object.
Returns
-------
Raises
------
RangeError
"""
pass<|fim_prefix|># repo: haiiliin/pyabaqus path: /src/abaqus/TableCollection/ActivateElements.py
class ActivateElem... | code_fim | hard | {
"lang": "python",
"repo": "haiiliin/pyabaqus",
"path": "/src/abaqus/TableCollection/ActivateElements.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def bool_icon(value):
if value:
return "<i class='fa fa-check-circle text-success'></i>"
else:
return "<i class='fa fa-times-circle text-danger'></i>"
register.filter('sizify', sizify)
register.filter('bool_icon', bool_icon)<|fim_prefix|># repo: hasanasari/hujan_ui path: /hujan_... | code_fim | medium | {
"lang": "python",
"repo": "hasanasari/hujan_ui",
"path": "/hujan_ui/installers/templatetags/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hasanasari/hujan_ui path: /hujan_ui/installers/templatetags/utils.py
from django import template
register = template.Library()
def sizify(value, suffix=""):
"""
Simple kb/mb/gb size snippet for templates:
{{ product.file.size|sizify }}
"""
if value < 512000:
value ... | code_fim | medium | {
"lang": "python",
"repo": "hasanasari/hujan_ui",
"path": "/hujan_ui/installers/templatetags/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> while cls.clstestclient.getHaltOnFailure():
time.sleep(0.2)
super(cosmicTestCase, cls).tearDownClass()<|fim_prefix|># repo: MissionCriticalCloud/cosmic path: /cosmic-core/test/integration/tests/cosmic/cosmicTestCase.py
import unittest
import time
from .cosmicTestClient impor... | code_fim | medium | {
"lang": "python",
"repo": "MissionCriticalCloud/cosmic",
"path": "/cosmic-core/test/integration/tests/cosmic/cosmicTestCase.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def tearDown(self):
while self.clstestclient.getHaltOnFailure():
time.sleep(0.2)
super(cosmicTestCase, self).tearDown()
@classmethod
def tearDownClass(cls):
while cls.clstestclient.getHaltOnFailure():
time.sleep(0.2)
super(cosmicTestCase... | code_fim | medium | {
"lang": "python",
"repo": "MissionCriticalCloud/cosmic",
"path": "/cosmic-core/test/integration/tests/cosmic/cosmicTestCase.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MissionCriticalCloud/cosmic path: /cosmic-core/test/integration/tests/cosmic/cosmicTestCase.py
import unittest
import time
from .cosmicTestClient import CosmicTestClient
class cosmicTestCase(unittest.TestCase):
clstestclient = CosmicTestClient()
@classmethod
def getClsTestClient(... | code_fim | hard | {
"lang": "python",
"repo": "MissionCriticalCloud/cosmic",
"path": "/cosmic-core/test/integration/tests/cosmic/cosmicTestCase.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SShotaro/aisaac-strategy path: /aisaac/scripts/robot.py
#!/usr/bin/env python
# coding:utf-8
import math
import rospy
from consai_msgs.msg import Pose
from consai_msgs.msg import robot_commands
#from aisaac.srv import Kick
from aisaac.msg import Status, Ball_sub_params, Def_pos
from nav_msgs.msg... | code_fim | hard | {
"lang": "python",
"repo": "SShotaro/aisaac-strategy",
"path": "/aisaac/scripts/robot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(self.friend_num):
rospy.Subscriber("/" + self.robot_color + "/robot_" + str(i) + "/odom", Odometry, self.robot_params.friend_odom_callback, callback_args=i)
for j in range(self.enemy_num):
rospy.Subscriber("/" + self.robot_color + "/enemy_" + str(j) +... | code_fim | hard | {
"lang": "python",
"repo": "SShotaro/aisaac-strategy",
"path": "/aisaac/scripts/robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class STATUS_CODES(metaclass=Enum):
OUT_OF_SEQUENCE = 450
NOT_ALLOWED = 451
INVALID_ID = 452
NOT_RECOGNIZED = 453
INVALID_DATA = 454
COMPLIANCE_ERROR = 459
SIGNAL_NOT_SUPPORTED = 460
REPORT_NOT_SUPPORTED = 461
TARGET_MISMATCH = 462
NOT_REGISTERED_OR_AUTHORIZED = 463... | code_fim | hard | {
"lang": "python",
"repo": "greenactionstudio/openleadr-python",
"path": "/openleadr/enums.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greenactionstudio/openleadr-python path: /openleadr/enums.py
LOAD"
BID_ENERGY = "BID_ENERGY"
CHARGE_STATE = "CHARGE_STATE"
LOAD_DISPATCH = "LOAD_DISPATCH"
LOAD_CONTROL = "LOAD_CONTROL"
class SI_SCALE_CODE(metaclass=Enum):
p = "p"
n = "n"
micro = "micro"
m = "m"
... | code_fim | hard | {
"lang": "python",
"repo": "greenactionstudio/openleadr-python",
"path": "/openleadr/enums.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greenactionstudio/openleadr-python path: /openleadr/enums.py
d"
ESTIMATED = "Estimated"
SUMMED = "Summed"
DERIVED = "Derived"
MEAN = "Mean"
PEAK = "Peak"
HYBRID = "Hybrid"
CONTRACT = "Contract"
PROJECTED = "Projected"
X_RMS = "x-RMS"
X_NOT_APPLICABLE = "x-n... | code_fim | hard | {
"lang": "python",
"repo": "greenactionstudio/openleadr-python",
"path": "/openleadr/enums.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aschmied/keyzer path: /main.py
# Copyright (c) 2015, Anthony Schmieder
# Use of this source code is governed by the 2-clause BSD license that
# can be found in the LICENSE.txt file.
from __future__ import print_function
import argparse
import logging
import sys
import threading
from ui.assetma... | code_fim | hard | {
"lang": "python",
"repo": "aschmied/keyzer",
"path": "/main.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
args = parseArgs()
level = logging.DEBUG if args.debug else logging.WARNING
logging.basicConfig(level=level)
if args.list_ports:
probeMidiAndPrint()
sys.exit(0)
if args.list_tracks:
extractTracksAndPrint(args.song_path)
sys.exit(0)
midiin = mid... | code_fim | hard | {
"lang": "python",
"repo": "aschmied/keyzer",
"path": "/main.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ramthi/opentelemetry-python path: /opentelemetry-sdk/tests/test_configurator.py
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | code_fim | hard | {
"lang": "python",
"repo": "ramthi/opentelemetry-python",
"path": "/opentelemetry-sdk/tests/test_configurator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_no_exporters(self):
self.assertEqual(sorted(_get_exporter_names(None)), [])
def test_empty_exporters(self):
self.assertEqual(sorted(_get_exporter_names("")), [])
class TestImportExporters(TestCase):
def test_console_exporters(self):
trace_exporters, logs_exp... | code_fim | hard | {
"lang": "python",
"repo": "ramthi/opentelemetry-python",
"path": "/opentelemetry-sdk/tests/test_configurator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestExporterNames(TestCase):
def test_otlp_exporter_overwrite(self):
for exporter in [_EXPORTER_OTLP, _EXPORTER_OTLP_PROTO_GRPC]:
self.assertEqual(
_get_exporter_names(exporter), [_EXPORTER_OTLP_PROTO_GRPC]
)
def test_multiple_exporters(self)... | code_fim | hard | {
"lang": "python",
"repo": "ramthi/opentelemetry-python",
"path": "/opentelemetry-sdk/tests/test_configurator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global count
# remove HTML tags
nohtml_review = re.sub('<[^<]+?>', '', review)
# remove unicode characters
no_unicode = unidecode.unidecode(nohtml_review)
# convert words to lowercase
lowercase_review = no_unicode.lower()
# autocorrect sentence
speller = Spell... | code_fim | hard | {
"lang": "python",
"repo": "Chrisae9/youtube-trending-prediction",
"path": "/process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chrisae9/youtube-trending-prediction path: /process.py
from sklearn import tree
from matplotlib import pyplot as plt
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics imp... | code_fim | hard | {
"lang": "python",
"repo": "Chrisae9/youtube-trending-prediction",
"path": "/process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Average good score:")
print(good['clickbait_title_score'].mean())
print("Average bad score:")
print(bad['clickbait_title_score'].mean())
def averageClickbaitImageScore(df):
bad = df[df.label == 0]
good = df[df.label == 1]
print("Average good score:")
... | code_fim | hard | {
"lang": "python",
"repo": "Chrisae9/youtube-trending-prediction",
"path": "/process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnlwhiteman/CoCoScatS path: /Plugin/IO/XmlFile.py
from Plugin.Interface import Interface
import base64
class XmlFile(Interface):
def __init__(self, cfg, pluginParams, workflowPluginParams, frameworkParams):
super(XmlFile, self).__init__(cfg, pluginParams, workflowPluginParams, fra... | code_fim | medium | {
"lang": "python",
"repo": "johnlwhiteman/CoCoScatS",
"path": "/Plugin/IO/XmlFile.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def runOutput(self):
tc = self.getTranslatorContentAsJson()
if self.getPluginParamValueAsTrueOrFalse("EncodeWithBase64"):
tc["l1l2"] = str(base64.b64encode(bytes(tc["l1l2"], "utf-8")))
tc["l1"] = str(base64.b64encode(bytes(tc["l1"], "utf-8")))
tc["l2... | code_fim | medium | {
"lang": "python",
"repo": "johnlwhiteman/CoCoScatS",
"path": "/Plugin/IO/XmlFile.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.debug('API Request - {request}'.format(
request=pprint.pformat(request_data)
))
result.raise_for_status()
self.logoff()
try:
logger.debug('API Response - {data}'.format(
data=pprint.pformat(result.json())
... | code_fim | hard | {
"lang": "python",
"repo": "cesarandreslopez/rocket-python",
"path": "/rocketchat/calls/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cesarandreslopez/rocket-python path: /rocketchat/calls/base.py
import logging
import pprint
import requests
logger = logging.getLogger(__name__)
class RocketChatBase(object):
settings = None
endpoint = None
headers = {}
method = 'get'
auth_token = None
auth_user_id = N... | code_fim | hard | {
"lang": "python",
"repo": "cesarandreslopez/rocket-python",
"path": "/rocketchat/calls/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sudharkj/sudoku-solver path: /utils/status.py
# utils/status.py
from enum import Enum
<|fim_suffix|> def __gt__(self, other):
return self.value > other.value<|fim_middle|>
class Status(Enum):
"""
Allowed states of a puzzle in the increasing order of persistence.
"""
SO... | code_fim | medium | {
"lang": "python",
"repo": "sudharkj/sudoku-solver",
"path": "/utils/status.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __gt__(self, other):
return self.value > other.value<|fim_prefix|># repo: sudharkj/sudoku-solver path: /utils/status.py
# utils/status.py
from enum import Enum
<|fim_middle|>class Status(Enum):
"""
Allowed states of a puzzle in the increasing order of persistence.
"""
SO... | code_fim | medium | {
"lang": "python",
"repo": "sudharkj/sudoku-solver",
"path": "/utils/status.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nanato12/dt-range path: /tests/test_hourrange.py
from datetime import datetime
from dt_range import hourrange
class TestHourRange:
"""時間単位ジェネレータのテスト"""
def test_it(self) -> None:
"""通常"""
start = datetime(2000, 1, 1, 1)
end = datetime(2000, 1, 1, 6)
g... | code_fim | hard | {
"lang": "python",
"repo": "nanato12/dt-range",
"path": "/tests/test_hourrange.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> generator_object = hourrange(start, end)
assert next(generator_object) == start
assert next(generator_object) == datetime(2000, 12, 31, 22)
assert next(generator_object) == datetime(2000, 12, 31, 23)
assert next(generator_object) == datetime(2001, 1, 1, 0)
a... | code_fim | hard | {
"lang": "python",
"repo": "nanato12/dt-range",
"path": "/tests/test_hourrange.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adore2005/FSPBT-Image-Translation path: /litmodels.py
from typing import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
import pytorch_lightning as pl
from feature_model import FeaturesNet
from original_models import Discriminator, Generator
class LitModel(p... | code_fim | hard | {
"lang": "python",
"repo": "adore2005/FSPBT-Image-Translation",
"path": "/litmodels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch = {k: v
for k, v in batch.items() if isinstance(v, torch.Tensor)}
input = batch['input']
output = self.forward(input)
batch.update({'output': output})
val_loss_dict = self.compute_losses(**batch)
self.log_dict(val_loss_dict)
s... | code_fim | hard | {
"lang": "python",
"repo": "adore2005/FSPBT-Image-Translation",
"path": "/litmodels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rows = []
for row in data:
row['created_time'] = parse_time(row['created'])
rows.append(row)
rows.sort(key=lambda r: r['id'])
with OutputFormat(output):
print_table(['id', 'violation_severity', 'created_time', 'help_text'],
rows, titles={'creat... | code_fim | hard | {
"lang": "python",
"repo": "zalando-stups/fullstop-cli",
"path": "/fullstop/cli.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zalando-stups/fullstop-cli path: /fullstop/cli.py
import datetime
import json
import re
import time
import click
import fullstop
import stups_cli.config
import yaml
import zign.api
from clickclick import Action, AliasedGroup, OutputFormat, UrlType, print_table
from fullstop.api import request, s... | code_fim | hard | {
"lang": "python",
"repo": "zalando-stups/fullstop-cli",
"path": "/fullstop/cli.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def cleanup_orphans(self):
from services.vsg.models import VSGTenant
# ensure vOLT only has one vCPE
cur_vcpe = self.vcpe
for vcpe in list(self.get_subscribed_tenants(VSGTenant)):
if (not cur_vcpe) or (vcpe.id != cur_vcpe.id):
# print "XXX clean up orphaned vcpe", vcpe
... | code_fim | hard | {
"lang": "python",
"repo": "attrans/olt",
"path": "/xos/attic/volttenant_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a vCPE since it creates a slice
raise XOSProgrammingError("VOLTTenant's self.caller was not set")
self.creator = self.caller
if not self.creator:
ra... | code_fim | hard | {
"lang": "python",
"repo": "attrans/olt",
"path": "/xos/attic/volttenant_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: attrans/olt path: /xos/attic/volttenant_model.py
def __init__(self, *args, **kwargs):
volt_services = VOLTService.get_service_objects().all()
if volt_services:
self._meta.get_field("provider_service").default = volt_services[0].id
super(VOLTTenant, self).__init__(*args, **kwar... | code_fim | hard | {
"lang": "python",
"repo": "attrans/olt",
"path": "/xos/attic/volttenant_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kyuunex/Seija path: /seija/modules/first_run.py
async def add_admins(self):
async with await self.db.execute("SELECT user_id, permissions FROM admins") as cursor:
admin_list = await cursor.fetchall()
if not admin_list:
app_info = await self.application_info()
if a... | code_fim | hard | {
"lang": "python",
"repo": "Kyuunex/Seija",
"path": "/seija/modules/first_run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> await db.execute("""
CREATE TABLE IF NOT EXISTS "channels" (
"setting" TEXT NOT NULL,
"guild_id" INTEGER NOT NULL,
"channel_id" INTEGER NOT NULL
)
""")
await db.execute("""
CREATE TABLE IF NOT EXISTS "categories" (
"setting" TEXT NOT NULL... | code_fim | hard | {
"lang": "python",
"repo": "Kyuunex/Seija",
"path": "/seija/modules/first_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> await db.execute("""
CREATE TABLE IF NOT EXISTS "mapset_channels" (
"channel_id" INTEGER NOT NULL UNIQUE,
"role_id" INTEGER NOT NULL UNIQUE,
"user_id" INTEGER NOT NULL,
"mapset_id" INTEGER,
"guild_id" INTEGER NOT NULL
)
""")
await... | code_fim | hard | {
"lang": "python",
"repo": "Kyuunex/Seija",
"path": "/seija/modules/first_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if t % target_network_update_freq == 0:
# Update target network periodically.
model.update_target()
if t % checkpoint_freq == 0:
save_path = checkpoint_path
ckpt = tf.train.Checkpoint(model=model)
manager = tf.train.CheckpointMan... | code_fim | hard | {
"lang": "python",
"repo": "Kokkini/DQfD",
"path": "/dqfd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kokkini/DQfD path: /dqfd.py
# This code is based on code from OpenAI baselines. (https://github.com/openai/baselines)
import os.path as osp
from tqdm import tqdm
from time import time
from collections import deque
import pickle
import dill
import tensorflow as tf
import numpy as np
from common.s... | code_fim | hard | {
"lang": "python",
"repo": "Kokkini/DQfD",
"path": "/dqfd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = "%s: %s,%s%s,%s%s %s,%s%s,%s%s" % (tpe, count, prev_count_sigh, prev_diff[0], first_count_sigh, first_diff[0], size, prev_size_sigh, prev_diff[1], first_size_sigh, first_diff[1])
if prev_diff[0] != 0 or prev_diff[1] != 0 or first_diff[0] != 0 or first_diff[1] != 0:
if prev_diff[0] > 0... | code_fim | hard | {
"lang": "python",
"repo": "taroved/pol",
"path": "/mlm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for o in os:
refs = gc.get_referrers(o)
log.info('GC oldest %s ref cnt:%s %s(%s): %s' % ('*' * depth, len(refs), str(type(o)), id(o), str(o)[:500]))
if depth < OLDEST_OBJ_DEPTH:
print_obj_ref(depth+1, refs)
def get_obj_by_id(o_id):
return [o for o in gc.get_obj... | code_fim | hard | {
"lang": "python",
"repo": "taroved/pol",
"path": "/mlm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taroved/pol path: /mlm.py
import gc
import time, sys
from twisted.logger import Logger
log = Logger()
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = ... | code_fim | hard | {
"lang": "python",
"repo": "taroved/pol",
"path": "/mlm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeitaBV/timely-beliefs path: /timely_beliefs/tests/test_sensor_init.py
from datetime import datetime, timedelta
from pytz import utc
from timely_beliefs import DBSensor
def test_instantaneous_sensor(instantaneous_sensor: DBSensor):
assert instantaneous_sensor.event_resolution == timedelta... | code_fim | hard | {
"lang": "python",
"repo": "SeitaBV/timely-beliefs",
"path": "/timely_beliefs/tests/test_sensor_init.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> event_start = datetime(2018, 1, 1, 15, tzinfo=utc)
assert ex_ante_economics_sensor.knowledge_time(event_start) < event_start<|fim_prefix|># repo: SeitaBV/timely-beliefs path: /timely_beliefs/tests/test_sensor_init.py
from datetime import datetime, timedelta
from pytz import utc
from timely_beli... | code_fim | hard | {
"lang": "python",
"repo": "SeitaBV/timely-beliefs",
"path": "/timely_beliefs/tests/test_sensor_init.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hubmapconsortium/entity-api path: /src/schema/schema_neo4j_queries.py
abase connection pool
uuid : str
The uuid of target entity
Returns
-------
str: The sample organ name
str: The donor metadata (string representation of a Python dict)
"""
def get_dataset_organ_and_donor_info(neo4j_driver,... | code_fim | hard | {
"lang": "python",
"repo": "hubmapconsortium/entity-api",
"path": "/src/schema/schema_neo4j_queries.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if record and record[record_field_name]:
if property_key:
result = record[record_field_name]
else:
# Convert the entity node to dict
result = node_to_dict(record[record_field_name])
return result
"""
Update the propert... | code_fim | hard | {
"lang": "python",
"repo": "hubmapconsortium/entity-api",
"path": "/src/schema/schema_neo4j_queries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hubmapconsortium/entity-api path: /src/schema/schema_neo4j_queries.py
[:ACTIVITY_OUTPUT]->(child:Entity) "
# The target entity can't be a Lab
f"WHERE e.uuid='{uuid}' AND e.entity_type <> 'Lab' "
# COLLECT() returns a list
# apoc.... | code_fim | hard | {
"lang": "python",
"repo": "hubmapconsortium/entity-api",
"path": "/src/schema/schema_neo4j_queries.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kstulgys/coding-challenges path: /leetcode/20/index.py
def isValid(s):
stack = []
hashMap = {
'(': ')',
'[': ']',
'{': '}'
}
<|fim_suffix|> return len(stack) == 0
test = '{(){}[]}'
print(isValid(test))<|fim_middle|> for val in s:
if val in has... | code_fim | medium | {
"lang": "python",
"repo": "kstulgys/coding-challenges",
"path": "/leetcode/20/index.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>test = '{(){}[]}'
print(isValid(test))<|fim_prefix|># repo: kstulgys/coding-challenges path: /leetcode/20/index.py
def isValid(s):
stack = []
hashMap = {
'(': ')',
'[': ']',
'{': '}'
}
for val in s:
if val in hashMap:
stack.append(val)
... | code_fim | easy | {
"lang": "python",
"repo": "kstulgys/coding-challenges",
"path": "/leetcode/20/index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(stack) == 0
test = '{(){}[]}'
print(isValid(test))<|fim_prefix|># repo: kstulgys/coding-challenges path: /leetcode/20/index.py
def isValid(s):
stack = []
hashMap = {
'(': ')',
'[': ']',
'{': '}'
}
<|fim_middle|> for val in s:
if val in has... | code_fim | medium | {
"lang": "python",
"repo": "kstulgys/coding-challenges",
"path": "/leetcode/20/index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IEEERobotics/i2c_device path: /i2c_device/i2c_integer.py
import smbus
import yaml
from i2c_register import I2CRegister
# TODO: make into properties if we can still call write_val()
class IntegerReg(I2CRegister):
""" 8, 6, and 32 bit signed/unsigned ints """
def __init__(self, bus, addr,... | code_fim | hard | {
"lang": "python",
"repo": "IEEERobotics/i2c_device",
"path": "/i2c_device/i2c_integer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type(value) is str:
value = self.config['value_names'][value]
if self.signed:
value += (1<<self.bits) # two's copmliemnt
for i in range(self.bytes):
self.write_byte(byte=i, value=value & 0xff)
value >>= 8<|fim_prefix|># repo: IEEE... | code_fim | hard | {
"lang": "python",
"repo": "IEEERobotics/i2c_device",
"path": "/i2c_device/i2c_integer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read(self):
value = 0
# TODO: test block reads w/auto_inc for int32?
if self.device.multi and (self.bytes == 2):
value = self.device.read_word(self.address)
else:
for i in reversed(range(self.bytes)):
value <<= 8
... | code_fim | hard | {
"lang": "python",
"repo": "IEEERobotics/i2c_device",
"path": "/i2c_device/i2c_integer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>enh=xx[0,:,:,0].transpose().flatten(); enh_clim=xx[0,:,:,0].mean(axis=1)
anh=xx[0,:,:,1].transpose().flatten(); anh_clim=xx[0,:,:,1].mean(axis=1)
esh=xx[1,:,:,0].transpose().flatten(); esh_clim=xx[1,:,:,0].mean(axis=1)
ash=xx[1,:,:,1].transpose().flatten(); ash_clim=xx[1,:,:,1].mean(axis=1)<|fim_prefix|>#... | code_fim | medium | {
"lang": "python",
"repo": "geoschem/GMAO_Shared",
"path": "/GEOS_Util/coupled_diagnostics/verification/nsidc/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geoschem/GMAO_Shared path: /GEOS_Util/coupled_diagnostics/verification/nsidc/__init__.py
import os
import scipy as sp
__all__=['anh','ash','enh','esh','anh_clim','ash_clim','enh_clim','esh_clim']
<|fim_suffix|>enh=xx[0,:,:,0].transpose().flatten(); enh_clim=xx[0,:,:,0].mean(axis=1)
anh=xx[0,:,:... | code_fim | hard | {
"lang": "python",
"repo": "geoschem/GMAO_Shared",
"path": "/GEOS_Util/coupled_diagnostics/verification/nsidc/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>xx[xx==-9999.]=sp.ma.masked
enh=xx[0,:,:,0].transpose().flatten(); enh_clim=xx[0,:,:,0].mean(axis=1)
anh=xx[0,:,:,1].transpose().flatten(); anh_clim=xx[0,:,:,1].mean(axis=1)
esh=xx[1,:,:,0].transpose().flatten(); esh_clim=xx[1,:,:,0].mean(axis=1)
ash=xx[1,:,:,1].transpose().flatten(); ash_clim=xx[1,:,:,1... | code_fim | hard | {
"lang": "python",
"repo": "geoschem/GMAO_Shared",
"path": "/GEOS_Util/coupled_diagnostics/verification/nsidc/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kedron/python-number-to-string path: /app/run_unit_tests/run-unit-tests.py
import argparse
from NumberToString.tests.NumberToStringTests import NumberToStringTestCase, main, list_installed_locales<|fim_suffix|>.add_argument('-v', '--verbosity', action="store_true")
args = parser.parse_args()
if ... | code_fim | medium | {
"lang": "python",
"repo": "kedron/python-number-to-string",
"path": "/app/run_unit_tests/run-unit-tests.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>' ):
locales = [args.locale]
else:
locales = list_installed_locales()
for l in locales:
locale = l
main()<|fim_prefix|># repo: kedron/python-number-to-string path: /app/run_unit_tests/run-unit-tests.py
import argparse
from NumberToString.tests.NumberToStringTests import NumberToStringT... | code_fim | hard | {
"lang": "python",
"repo": "kedron/python-number-to-string",
"path": "/app/run_unit_tests/run-unit-tests.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjoyce0510/autonomous-shipping-vessel path: /src/main/python/BluetoothManagerMock.py
from BluetoothManager import BluetoothManager
class BluetoothManagerMock(BluetoothManager):
<|fim_suffix|> def startServer(self):
print("Starting BT server")
def connect(self):
self.data... | code_fim | easy | {
"lang": "python",
"repo": "jjoyce0510/autonomous-shipping-vessel",
"path": "/src/main/python/BluetoothManagerMock.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.data = "41.703054 -86.239018" #Hardcode the coordinates here.
self.hasData = True<|fim_prefix|># repo: jjoyce0510/autonomous-shipping-vessel path: /src/main/python/BluetoothManagerMock.py
from BluetoothManager import BluetoothManager
class BluetoothManagerMock(BluetoothManager):
<|f... | code_fim | medium | {
"lang": "python",
"repo": "jjoyce0510/autonomous-shipping-vessel",
"path": "/src/main/python/BluetoothManagerMock.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Starting BT server")
def connect(self):
self.data = "41.703054 -86.239018" #Hardcode the coordinates here.
self.hasData = True<|fim_prefix|># repo: jjoyce0510/autonomous-shipping-vessel path: /src/main/python/BluetoothManagerMock.py
from BluetoothManager import Blueto... | code_fim | medium | {
"lang": "python",
"repo": "jjoyce0510/autonomous-shipping-vessel",
"path": "/src/main/python/BluetoothManagerMock.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # easily translatable info
data['term'] = symbolreplace.strip_tags(symbolreplace.tags_to_unicode(datasheet['WORD']))
# parse biography, and add in extras and translations
data['content'] = htmlparser.parse(datasheet['CONTENTS'],
datasheet['FILENAME'],
... | code_fim | medium | {
"lang": "python",
"repo": "davidferguson/mactutor-converter",
"path": "/glossaryparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidferguson/mactutor-converter path: /glossaryparser.py
# -*- coding: utf-8 -*-
# main converter file, converts datasheet to Lektor format
<|fim_suffix|> data = {}
# metadata, the template and model
data['_model'] = 'glossary'
data['_template'] = 'glossary.html'
# easily ... | code_fim | medium | {
"lang": "python",
"repo": "davidferguson/mactutor-converter",
"path": "/glossaryparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # parse biography, and add in extras and translations
data['content'] = htmlparser.parse(datasheet['CONTENTS'],
datasheet['FILENAME'],
paragraphs=True,
url_context=url_context)
return data<|fim_pre... | code_fim | hard | {
"lang": "python",
"repo": "davidferguson/mactutor-converter",
"path": "/glossaryparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sitegui/quarto path: /quarto/tests/test_match.py
from quarto.environment import Environment
from quarto.player import RandomPlayer, DummyPlayer
from quarto.match import run_match
from collections import Counter
<|fim_suffix|> env = Environment()
p1 = RandomPlayer(False)
p2 = RandomP... | code_fim | medium | {
"lang": "python",
"repo": "sitegui/quarto",
"path": "/quarto/tests/test_match.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for _ in range(1000):
score_1 = run_match(env, p1, p2)
assert score_1 in [0, 100, -100]
scores_p1_p2[score_1] += 1
score_1 = -run_match(env, p2, p1)
assert score_1 in [0, 100, -100]
scores_p2_p1[score_1] += 1
print(sorted(scores_p1_p2.items()), sort... | code_fim | medium | {
"lang": "python",
"repo": "sitegui/quarto",
"path": "/quarto/tests/test_match.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(sorted(scores_p1_p2.items()), sorted(scores_p2_p1.items()))<|fim_prefix|># repo: sitegui/quarto path: /quarto/tests/test_match.py
from quarto.environment import Environment
from quarto.player import RandomPlayer, DummyPlayer
from quarto.match import run_match
from collections import Counter
d... | code_fim | hard | {
"lang": "python",
"repo": "sitegui/quarto",
"path": "/quarto/tests/test_match.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu_7_tests/test_alphabetize_by_nth_char.py
import unittest
from katas.kyu_7.alphabetize_by_nth_char import sort_it
class SortItTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(sort_it('bid, zag', 2), 'zag, bid')
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "mveselov/CodeWars",
"path": "/tests/kyu_7_tests/test_alphabetize_by_nth_char.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(sort_it('bill, bell, ball, bull', 2),
'ball, bell, bill, bull')
def test_equals_3(self):
self.assertEqual(sort_it('cat, dog, eel, bee', 3),
'bee, dog, eel, cat')<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu... | code_fim | easy | {
"lang": "python",
"repo": "mveselov/CodeWars",
"path": "/tests/kyu_7_tests/test_alphabetize_by_nth_char.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kbence/poker-player-pyrates path: /player.py
import logging
import math
import operator
from hand_value import get_deck_value
from player_card import PlayerCard, RANKS
logging.basicConfig(level=logging.DEBUG)
class GameStateLogger(object):
def __init__(self, game_state):
self.game... | code_fim | hard | {
"lang": "python",
"repo": "kbence/poker-player-pyrates",
"path": "/player.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if chen_sum >= when_to_raise:
self.log.info('CHEN value of hand is %s, raising' % chen_sum)
return min(int(player['stack'] * 0.3), current_buy_in - player['bet'] + minimum_raise)
else:
self.log.info('CHEN value of hand is %s, folding'... | code_fim | hard | {
"lang": "python",
"repo": "kbence/poker-player-pyrates",
"path": "/player.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def is_pair(c1, c2):
return c1.rank == c2.rank
@staticmethod
def is_suited(c1, c2):
return c1.suit == c2.suit
@staticmethod
def calc_gap(c1, c2):
return min(4, abs(c1.index - c2.index))
@staticmethod
def calc_extra_point(c1, c2, gap)... | code_fim | hard | {
"lang": "python",
"repo": "kbence/poker-player-pyrates",
"path": "/player.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def render ( self, context ):
try :
block = block_manager.get_block( self.block_name )
return str(block)
except:
return ""<|fim_prefix|># repo: airtonix/django-block-manager path: /django_block_manager/templatetags/blocks.py
from django import template
register = template.Library()
from ..l... | code_fim | medium | {
"lang": "python",
"repo": "airtonix/django-block-manager",
"path": "/django_block_manager/templatetags/blocks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__ ( self, block_name ):
self.block_name = block_name
def render ( self, context ):
try :
block = block_manager.get_block( self.block_name )
return str(block)
except:
return ""<|fim_prefix|># repo: airtonix/django-block-manager path: /django_block_manager/templatetags/blocks.p... | code_fim | hard | {
"lang": "python",
"repo": "airtonix/django-block-manager",
"path": "/django_block_manager/templatetags/blocks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: airtonix/django-block-manager path: /django_block_manager/templatetags/blocks.py
from django import template
register = template.Library()
from ..lib.manager import BlockManager
block_manager = BlockManager()
<|fim_suffix|> try :
block = block_manager.get_block( self.block_name )
return ... | code_fim | hard | {
"lang": "python",
"repo": "airtonix/django-block-manager",
"path": "/django_block_manager/templatetags/blocks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_ = sns.swarmplot(x='year', y='Beak length',
data=df)
# Label the axes
_ = plt.xlabel('Year')
_ = plt.ylabel('beak length (mm)')
# Show the plot
plt.show()
########## Compargin the mean between populations:
bd_1975 = df.loc[df['year'] == 1974, 'Beak length']
bd_2012 = df.loc[df['year'] == 2012, ... | code_fim | hard | {
"lang": "python",
"repo": "PhilipeRLeal/bootstrap_analyses",
"path": "/tests/example_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PhilipeRLeal/bootstrap_analyses path: /tests/example_1.py
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 26 17:23:54 2020
@author: Philipe_Leal
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
path = os.path.join(os.getcwd(), 'Data_example.csv')
df = pd.read... | code_fim | hard | {
"lang": "python",
"repo": "PhilipeRLeal/bootstrap_analyses",
"path": "/tests/example_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Shift the samples
bd_1975_shifted = bd_1975 - np.mean(bd_1975) + combined_mean
bd_2012_shifted = bd_2012 - np.mean(bd_2012) + combined_mean
n_reps = 10000
# Get bootstrap replicates of shifted data sets
bs_replicates_1975 = _draw_bs_reps(bd_1975_shifted, np.mean, n_reps)
bs_replicates_2012 = _draw_bs_... | code_fim | hard | {
"lang": "python",
"repo": "PhilipeRLeal/bootstrap_analyses",
"path": "/tests/example_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>csv_path = os.path.join(config.search_staging_dir, 'experiment_report.csv')
data = pd.DataFrame(records)
data.to_csv(csv_path, index = False)
print(f'[INFO] => experiment short summary is exported in {csv_path}')
print(f'[NOTE] => for more details on individual trial check files in "{path}"')<|fim_prefix... | code_fim | hard | {
"lang": "python",
"repo": "anbujoel/NLP-Neural_Architechture_Search",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anbujoel/NLP-Neural_Architechture_Search path: /main.py
import os
import sys
import json
import pandas as pd
from absl import app
from data import TsvData
from utils.Configuration import Config
from utils.text import TextProcessing
from model_search import single_trainer
sys.argv = sys.argv[:1]... | code_fim | hard | {
"lang": "python",
"repo": "anbujoel/NLP-Neural_Architechture_Search",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kozakusek/ipp-2020-testy path: /z2/part3/updated_part2_batch/jm/parser_errors_2/226171178.py
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_... | code_fim | hard | {
"lang": "python",
"repo": "kozakusek/ipp-2020-testy",
"path": "/z2/part3/updated_part2_batch/jm/parser_errors_2/226171178.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>board255575207 = gamma_board(board)
assert board255575207 is not None
assert board255575207 == ("112\n" "222\n" "12.\n")
del board255575207
board255575207 = None
assert gamma_move(board, 1, 0, 2) == 0
assert gamma_free_fields(board, 1) == 1
assert gamma_move(board, 2, 1, 1) == 0
assert gamma_move(board, 1... | code_fim | hard | {
"lang": "python",
"repo": "kozakusek/ipp-2020-testy",
"path": "/z2/part3/updated_part2_batch/jm/parser_errors_2/226171178.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
board255575207 = gamma_board(board)
assert board255575207 is not None
assert board255575207 == ("112\n" "222\n" "12.\n")
del board255575207
board255575207 = None
assert gamma_move(board, 1, 0, 2) == 0
assert gamma_free_fields(board, 1) == 1
assert gamma_move(board, 2, 1, 1) == 0
assert gamma_move(board, ... | code_fim | hard | {
"lang": "python",
"repo": "kozakusek/ipp-2020-testy",
"path": "/z2/part3/updated_part2_batch/jm/parser_errors_2/226171178.py",
"mode": "spm",
"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.