text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> #write stats in markdown format
headerfile.write('\n')
headerfile.write('### Cookie Stats\n\r')
headerfile.write('#### Min\n')
headerfile.write('* ' + str(minCookie) + '\n\r')
headerfile.write('#### Max\n')
headerfile.write('* ' + str(maxCookie) + '\n\r')
headerfile.write('... | code_fim | hard | {
"lang": "python",
"repo": "mball002/cs595-s21",
"path": "/assignments/McLain/3/scripts/results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knowmetools/km-api path: /km_api/know_me/profile/tests/permissions/test_has_profile_topic_list_permissions.py
from unittest import mock
from django.http import Http404
import pytest
from rest_framework.permissions import SAFE_METHODS
from know_me.profile import permissions
UNSAFE_METHODS = ... | code_fim | hard | {
"lang": "python",
"repo": "knowmetools/km-api",
"path": "/km_api/know_me/profile/tests/permissions/test_has_profile_topic_list_permissions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_has_permission_nonexistent_profile(api_rf, db):
"""
If there is no profile with the given ID, the permission check
should raise an Http404 error.
"""
request = api_rf.get("/")
view = mock.Mock(name="Mock View")
view.kwargs = {"pk": 1}
permission = permissions.Has... | code_fim | hard | {
"lang": "python",
"repo": "knowmetools/km-api",
"path": "/km_api/know_me/profile/tests/permissions/test_has_profile_topic_list_permissions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LINBIT/openstack-cinder path: /cinder/tests/unit/targets/test_tgt_driver.py
, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | code_fim | hard | {
"lang": "python",
"repo": "LINBIT/openstack-cinder",
"path": "/cinder/tests/unit/targets/test_tgt_driver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_unlink,
mock_exec,
mock_pathexists,
mock_isfile):
def _fake_execute(*args, **kwargs):
raise putils.ProcessExecutionEr... | code_fim | hard | {
"lang": "python",
"repo": "LINBIT/openstack-cinder",
"path": "/cinder/tests/unit/targets/test_tgt_driver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LINBIT/openstack-cinder path: /cinder/tests/unit/targets/test_tgt_driver.py
lume.targets import tgt
from cinder.volume import volume_utils
class TestTgtAdmDriver(tf.TargetDriverFixture):
def setUp(self):
super(TestTgtAdmDriver, self).setUp()
self.configuration.get = mock.Mo... | code_fim | hard | {
"lang": "python",
"repo": "LINBIT/openstack-cinder",
"path": "/cinder/tests/unit/targets/test_tgt_driver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing.basicConfig(level=level, format=format, datefmt=datefmt)<|fim_prefix|># repo: mahatmaWM/NCRFpp path: /utils/utils.py
import logging
def configure_logging(level=logging.INFO):
format = '%(asctime)s %(filename)s:%(lineno)d %(levelnam<|fim_middle|>e)s] %(message)s'
datefmt = '%Y-%m-%d %H:%M:%S... | code_fim | medium | {
"lang": "python",
"repo": "mahatmaWM/NCRFpp",
"path": "/utils/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahatmaWM/NCRFpp path: /utils/utils.py
import logging
def configure_logging(level=logging.INFO):
<|fim_suffix|>e)s] %(message)s'
datefmt = '%Y-%m-%d %H:%M:%S'
logging.basicConfig(level=level, format=format, datefmt=datefmt)<|fim_middle|> format = '%(asctime)s %(filename)s:%(lineno)d ... | code_fim | medium | {
"lang": "python",
"repo": "mahatmaWM/NCRFpp",
"path": "/utils/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alltheplaces/alltheplaces path: /locations/spiders/the_good_guys_au.py
import chompjs
import scrapy
from locations.hours import DAYS_FULL
from locations.structured_data_spider import StructuredDataSpider
class TheGoodGuysAUSpider(StructuredDataSpider):
name = "the_good_guys_au"
item_at... | code_fim | medium | {
"lang": "python",
"repo": "alltheplaces/alltheplaces",
"path": "/locations/spiders/the_good_guys_au.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_json = chompjs.parse_js_object(response.xpath('//div[@id="allStoreJson"]/text()').extract_first())
for store in data_json["locations"]:
yield scrapy.Request(store["url"], self.parse_sd)
def pre_process_data(self, ld_data, **kwargs):
# Linked data on the page d... | code_fim | medium | {
"lang": "python",
"repo": "alltheplaces/alltheplaces",
"path": "/locations/spiders/the_good_guys_au.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoooopeeee/grover_sudoku path: /src/check.py
import numpy as np
import math
import matplotlib.ticker as tick
template_answer_filled = np.array([[4, 1, 2, 1], [2, 1, 3, 4], [1, 2, 4, 3], [3, 4, 1, 2]])
template = np.array([[4, 0, 2, 0], [0, 1, 0, 4], [1, 0, 4, 0], [0, 4, 0, 2]])
correct_templat... | code_fim | hard | {
"lang": "python",
"repo": "yoooopeeee/grover_sudoku",
"path": "/src/check.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #the number of rows of the sudoku matrix
rows = template_answer_filled.shape[0]
#the number of columns of the sudoku matrix
columns = template_answer_filled.shape[1]
#the correct sum of each row, column or box
correct_sum = np.sum([k for k in range(1, rows+1)])
#sudoku matrix c... | code_fim | hard | {
"lang": "python",
"repo": "yoooopeeee/grover_sudoku",
"path": "/src/check.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#checks that a given sudoku matrix has the correct sum for each row, column and box.
#returns the template
def check(template, template_answer_filled):
#the number of rows of the sudoku matrix
rows = template_answer_filled.shape[0]
#the number of columns of the sudoku matrix
columns = temp... | code_fim | hard | {
"lang": "python",
"repo": "yoooopeeee/grover_sudoku",
"path": "/src/check.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def encrypt(translation_matrix):
ciphertext = ''
for k in KEY:
for i in range(ROWS):
if k > 0:
ciphertext += translation_matrix[i][abs(k) - 1] + ' '
elif k < 0:
ciphertext += translation_matrix[-(i + 1)][abs(k) - 1] + ' '
return ... | code_fim | hard | {
"lang": "python",
"repo": "rrodero83-python-projects/decoding-american-civil-war-ciphers",
"path": "/route_cipher_encrypt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Run program and print encrypted ciphertext."""
print("\nPlaintext = {}".format(plaintext))
textlist = list(plaintext.replace('.', '').split())
textlist = replace_code_words(textlist)
fill_dummy_words(textlist)
translation_matrix = build_matrix(textlist)
ciphertext = encrypt... | code_fim | hard | {
"lang": "python",
"repo": "rrodero83-python-projects/decoding-american-civil-war-ciphers",
"path": "/route_cipher_encrypt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rrodero83-python-projects/decoding-american-civil-war-ciphers path: /route_cipher_encrypt.py
"""Encrypt a path through a Union Route Cipher.
Designed for wholeword transposition ciphers with variable rows & columns.
Assumes encryption began at either top or bottom of a column.
Key indicates the... | code_fim | hard | {
"lang": "python",
"repo": "rrodero83-python-projects/decoding-american-civil-war-ciphers",
"path": "/route_cipher_encrypt.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
except:
print "ERROR: ",sys.argv[1], "no existe"
exit(1)<|fim_prefix|># repo: cristopherarenas/iaa-2016 path: /UTRP-MO2/plotter/plot2.py
import sys
import matplotlib.pyplot as plt
if len(sys.argv)!=2:
print "Ingrese un parametro"
else:
try:
puntos = []
archivo = open(sys.argv[1])
for lin... | code_fim | medium | {
"lang": "python",
"repo": "cristopherarenas/iaa-2016",
"path": "/UTRP-MO2/plotter/plot2.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cristopherarenas/iaa-2016 path: /UTRP-MO2/plotter/plot2.py
import sys
import matplotlib.pyplot as plt
<|fim_suffix|> archivo.close()
plt.plot(puntos)
plt.xlabel("Iteraciones")
plt.ylabel("Hipervolumen")
plt.grid()
plt.show()
except:
print "ERROR: ",sys.argv[1], "no existe"
... | code_fim | medium | {
"lang": "python",
"repo": "cristopherarenas/iaa-2016",
"path": "/UTRP-MO2/plotter/plot2.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qualidan/cloudshell-email path: /package/test/test_email_config.py
import unittest
from unittest.mock import patch, mock_open
from mock import Mock, ANY
from cloudshell.orch.email_service.email_config import EmailConfig
<|fim_suffix|> pass
def test_initialize_default_port(self):
... | code_fim | medium | {
"lang": "python",
"repo": "qualidan/cloudshell-email",
"path": "/package/test/test_email_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.email_config = EmailConfig('SMTP Host', 'user', 'pass', 'from address', 9000)
self.assertEqual(self.email_config.smtp_server, 'SMTP Host')
self.assertEqual(self.email_config.user, 'user')
self.assertEqual(self.email_config.password, 'pass')
self.assertEqual(se... | code_fim | hard | {
"lang": "python",
"repo": "qualidan/cloudshell-email",
"path": "/package/test/test_email_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skyskys00/hornet-model path: /src/run_sims.py
import pandas as pd
import numpy as np
import logging
from src.simulate import simulate
__author__ = 'Rusty Gentile'
logger = logging.getLogger(__name__)
def run_conservative_sim():
df = pd.read_csv('./data/train_2019.csv')
d... | code_fim | hard | {
"lang": "python",
"repo": "skyskys00/hornet-model",
"path": "/src/run_sims.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pd.concat([df1, df2])
lats = df['Latitude']
longs = df['Longitude']
coords = [(lats.iloc[i], longs.iloc[i]) for i in range(len(longs))]
n_sim = 10
aggressive_parameters = {
'p_survival': 0.6,
'p_queen_survival': 0.15,
'new_queens': 30,
... | code_fim | medium | {
"lang": "python",
"repo": "skyskys00/hornet-model",
"path": "/src/run_sims.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(n_sim):
logger.info(f'Starting aggressive simulation: {i}')
results = simulate(coords, 2019, 5,
hive_parameters=aggressive_parameters,
shape_file='./data/states_reduced/states_reduced.shp')
results.to_c... | code_fim | hard | {
"lang": "python",
"repo": "skyskys00/hornet-model",
"path": "/src/run_sims.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openvinotoolkit/training_extensions path: /src/otx/algorithms/common/utils/ir.py
"""Collections of IR-related utils for common OTX algorithms."""
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from pathlib import Path
from typing import Any, Dict, Tuple
from ope... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/training_extensions",
"path": "/src/otx/algorithms/common/utils/ir.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> core = Core()
model = core.read_model(xml_file)
for k, data in data_items.items():
model.set_rt_info(data, list(k))
# workaround for CVS-110054
tmp_xml_path = Path(Path(xml_file).parent) / "tmp.xml"
serialize(model, str(tmp_xml_path))
tmp_xml_path.rename(xml_file)
... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/training_extensions",
"path": "/src/otx/algorithms/common/utils/ir.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cheesinglee/python path: /tests/features/create_dataset-steps.py
import os
import time
from datetime import datetime, timedelta
from lettuce import *
from bigml.api import HTTP_CREATED
from bigml.api import HTTP_ACCEPTED
from bigml.api import FINISHED
from bigml.api import FAULTY
from bigml.api i... | code_fim | hard | {
"lang": "python",
"repo": "cheesinglee/python",
"path": "/tests/features/create_dataset-steps.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> world.origin_dataset = world.dataset
resource = world.api.create_dataset(world.dataset['resource'], {'sample_rate': float(rate)})
world.status = resource['code']
assert world.status == HTTP_CREATED
world.location = resource['location']
world.dataset = resource['object']
world.d... | code_fim | hard | {
"lang": "python",
"repo": "cheesinglee/python",
"path": "/tests/features/create_dataset-steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Your code starts here.
bs = self.tetris_window.block_size
if self.state == 0:
x,y = self.coordinates[0]
temp = [ (x-bs,y),(x,y),(x,y+bs),(x+bs,y+bs) ]
if self.state == 1:
x,y = self.coordinates[1]
temp = [ (x,y),(x,y+bs),(x-... | code_fim | hard | {
"lang": "python",
"repo": "amcw7777/python-exercises",
"path": "/cs177/project4/tetrimino_Z.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amcw7777/python-exercises path: /cs177/project4/tetrimino_Z.py
from tetrimino import *
class Tetrimino_Z( Tetrimino ):
# TASK 5:
#
# Constructor function of Tetrimino_Z.
# This function sets self.coordinates with the initial values.
#
# If self.tetris_window.num_blocks_x ... | code_fim | hard | {
"lang": "python",
"repo": "amcw7777/python-exercises",
"path": "/cs177/project4/tetrimino_Z.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Stanbroek/BakkesModSDK-Python path: /Scripts/out/python-interface/bakkesmod/wrappers/kismet/SequenceOpWrapper.pyi
from typing import Callable, List, Tuple, Dict, Any
from enum import Enum
<|fim_suffix|>
# Private:
# SequenceOpWrapper::Impl [class declaration]
# SequenceOpWrapper::pi... | code_fim | hard | {
"lang": "python",
"repo": "Stanbroek/BakkesModSDK-Python",
"path": "/Scripts/out/python-interface/bakkesmod/wrappers/kismet/SequenceOpWrapper.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Private:
# SequenceOpWrapper::Impl [class declaration]
# SequenceOpWrapper::pimpl [variable]
@property
def pimpl(self) -> Any: ...<|fim_prefix|># repo: Stanbroek/BakkesModSDK-Python path: /Scripts/out/python-interface/bakkesmod/wrappers/kismet/SequenceOpWrapper.pyi
from typing impo... | code_fim | hard | {
"lang": "python",
"repo": "Stanbroek/BakkesModSDK-Python",
"path": "/Scripts/out/python-interface/bakkesmod/wrappers/kismet/SequenceOpWrapper.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_reduce_shape():
"Empty larry test"
msg = 'larry.%s failed for shape %s and axis %s'
for method in reduce_methods():
for shape in get_shapes():
axeslist = [None] + list(range(len(shape)))
for axis in axeslist:
arr = np.zeros(shape)
... | code_fim | hard | {
"lang": "python",
"repo": "kwgoodman/la",
"path": "/la/tests/empty_larry_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwgoodman/la path: /la/tests/empty_larry_test.py
"Test larry methods for proper handling of empty larrys"
import numpy as np
from numpy.testing import assert_, assert_equal
import la
from la import larry, nan
from la.util.testing import assert_larry_equal as ale
def lar():
return larry([])... | code_fim | hard | {
"lang": "python",
"repo": "kwgoodman/la",
"path": "/la/tests/empty_larry_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Called when an Entity node is encountered (e.g. may or may not be a full XML document entity).
Work on DTDecl details, if any, and then to the children.
"""
self.printer.start_document()
if node.xml_system_id:
for child in node.xml_children:
... | code_fim | hard | {
"lang": "python",
"repo": "bmackattack/amara",
"path": "/lib/writers/node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bmackattack/amara path: /lib/writers/node.py
"""amara.writers.node
Internal module containing the logic for traversing an Amara tree in order to
serialize it.
"""
from amara import tree
from amara.namespaces import XML_NAMESPACE, XMLNS_NAMESPACE
class _Visitor:
"""
Provides functions ... | code_fim | hard | {
"lang": "python",
"repo": "bmackattack/amara",
"path": "/lib/writers/node.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.printer.end_element(node.xml_namespace, node.xml_qname)
del self._namespaces[-1]
_dispatch[tree.element.xml_type] = visit_element
def visit_text(self, node):
"""
Called when a Text node is encountered. Generates a text event
for the printer.
"... | code_fim | hard | {
"lang": "python",
"repo": "bmackattack/amara",
"path": "/lib/writers/node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print ("Training new iteration on " + str(X_train_fold.shape[0]) + " training samples, " + str(X_val_fold.shape[0]) + " validation samples...")
X_train_aug = [X_train_fold, X_aug_train_fold]
X_val_aug = [X_val_fold, X_aug_val_fold]
X_test_aug = [X_test, X_aug_test]
model, test_acc = ... | code_fim | hard | {
"lang": "python",
"repo": "lelange/cu-ssp",
"path": "/model_neu/cv_mod_3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lelange/cu-ssp path: /model_neu/cv_mod_3.py
import sys
import os
import argparse
import time
import numpy as np
import dill as pickle
import pandas as pd
import tensorflow as tf
sys.path.append('keras-tcn')
from tcn import tcn
import h5py
from sklearn.model_selection import KFold
from sklearn.mo... | code_fim | hard | {
"lang": "python",
"repo": "lelange/cu-ssp",
"path": "/model_neu/cv_mod_3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model, test_acc = train_model(X_train_aug, y_train, X_val_aug, y_val, X_test_aug, y_test)
print('>%.3f' % test_acc)
cv_scores.append(test_acc)
model_history.append(model)
print('Estimated accuracy %.3f (%.3f)' % (np.mean(cv_scores), np.std(cv_scores)))<|fim_prefix|># repo: lelange/cu-ssp ... | code_fim | hard | {
"lang": "python",
"repo": "lelange/cu-ssp",
"path": "/model_neu/cv_mod_3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_dataset_schema_invalid(self):
with self.assertRaises(DartValidationException) as context:
columns = [Column('c1', DataType.VARCHAR, 50), Column('c2', DataType.BIGINT)]
df = DataFormat(FileFormat.PARQUET, RowFormat.NONE)
location = None
d... | code_fim | hard | {
"lang": "python",
"repo": "dannymcpherson/dart",
"path": "/src/python/dart/test/schema/test_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dannymcpherson/dart path: /src/python/dart/test/schema/test_dataset.py
import unittest
from dart.model.dataset import Column, DataFormat, Dataset, DatasetData, DataType, RowFormat, FileFormat
from dart.model.exception import DartValidationException
from dart.schema.base import default_and_valida... | code_fim | hard | {
"lang": "python",
"repo": "dannymcpherson/dart",
"path": "/src/python/dart/test/schema/test_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # @param a list of ListNode
# @return a ListNode
def mergeKLists(self, lists):
pq = []
for node in lists:
if node is not None:
heapq.heappush(pq, (node.val, node))
dummy = ListNode(0)
cur = dummy
while len(pq) > 0:
... | code_fim | medium | {
"lang": "python",
"repo": "harrifeng/Python-Study",
"path": "/Leetcode/Merge_k_Sorted_Lists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harrifeng/Python-Study path: /Leetcode/Merge_k_Sorted_Lists.py
"""
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
"""
<|fim_suffix|>class Solution:
# @param a list of ListNode
# @return a ListNode
def mergeKLists(self, lists):
... | code_fim | medium | {
"lang": "python",
"repo": "harrifeng/Python-Study",
"path": "/Leetcode/Merge_k_Sorted_Lists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pq = []
for node in lists:
if node is not None:
heapq.heappush(pq, (node.val, node))
dummy = ListNode(0)
cur = dummy
while len(pq) > 0:
val, node = heapq.heappop(pq)
cur.next = node
cur = cur.next
... | code_fim | medium | {
"lang": "python",
"repo": "harrifeng/Python-Study",
"path": "/Leetcode/Merge_k_Sorted_Lists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spzala/tosca-parser path: /parser/common/exception.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "spzala/tosca-parser",
"path": "/parser/common/exception.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class InvalidSchemaError(TOSCAException):
msg_fmt = _("%(message)s")
class ValidationError(TOSCAException):
msg_fmt = _("%(message)s")
class UnknownInputError(TOSCAException):
msg_fmt = _('Unknown input: %(input_name)s')
class InvalidPropertyValueError(TOSCAException):
msg_fmt = _('V... | code_fim | hard | {
"lang": "python",
"repo": "spzala/tosca-parser",
"path": "/parser/common/exception.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0000duck/scott-eu path: /simulation-ros/src/turtlebot2i/turtlebot2i_safety/tools/ScreenShot/screenshoot_remotAPI.py
#!/usr/bin/env python
'''
Not sure whether we really need it.
Prepare useful code segements here.
'''
# Make sure to have the server side running in V-REP:
# in a child scr... | code_fim | hard | {
"lang": "python",
"repo": "0000duck/scott-eu",
"path": "/simulation-ros/src/turtlebot2i/turtlebot2i_safety/tools/ScreenShot/screenshoot_remotAPI.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>objectName = "screenshotSensor"
screenshotFunctionName="screenshotRemoteAPI"
inputBuffer=bytearray()
result,retInts,retFloats,retStrings,retBuffer=vrep.simxCallScriptFunction(clientID,objectName,vrep.sim_scripttype_customizationscript,screenshotFunctionName,[],[],[],inputBuffer,vrep.simx_opmode_blocking)... | code_fim | hard | {
"lang": "python",
"repo": "0000duck/scott-eu",
"path": "/simulation-ros/src/turtlebot2i/turtlebot2i_safety/tools/ScreenShot/screenshoot_remotAPI.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def proper_modifier_is_pressed(self, event: tk.Event) -> bool:
if running_on_mac_os():
return command_is_pressed(event)
else:
return control_is_pressed(event)
def handle_definitions_response(self, msg):
defs = msg.definitions
if len(defs) !=... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/plugins/goto_definition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thonny/thonny path: /thonny/plugins/goto_definition.py
import os.path
import tkinter as tk
from logging import getLogger
from tkinter import messagebox
from typing import Set, cast
from thonny import get_runner, get_workbench
from thonny.codeview import CodeViewText, SyntaxText
from thonny.commo... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/plugins/goto_definition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle_definitions_response(self, msg):
defs = msg.definitions
if len(defs) != 1:
messagebox.showerror(
tr("Problem"), tr("Could not find definition"), master=get_workbench()
)
return
# TODO: handle multiple results like ... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/plugins/goto_definition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EnergyModels/estorage path: /examples/0D_sizing/run_monte_carlo.py
import pandas as pd
import time
import numpy as np
import multiprocessing
from joblib import Parallel, delayed, parallel_backend
from estorage import ACAES_IDEALGAS_0D
# =====================
# Function to enable parameter sweep... | code_fim | hard | {
"lang": "python",
"repo": "EnergyModels/estorage",
"path": "/examples/0D_sizing/run_monte_carlo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Perform Simulations (Run all plant variations in parallel)
with parallel_backend('multiprocessing', n_jobs=num_cores):
output = Parallel(verbose=10)(delayed(parameterSweep)(inputs.loc[index]) for index in range(iterations))
# Combine outputs into single dataframe and save
df = p... | code_fim | medium | {
"lang": "python",
"repo": "EnergyModels/estorage",
"path": "/examples/0D_sizing/run_monte_carlo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Fixed Inputs
cmp_eff = [0.8, 0.8] # fraction
trb_eff = [0.88, 0.88] # fraction
pwr = [10, 10] # MW
# Number of cores to use
num_cores = multiprocessing.cpu_count() - 1 # Consider saving one for other processes
# ==============
# Prepare Monte Carlo Distributions
... | code_fim | hard | {
"lang": "python",
"repo": "EnergyModels/estorage",
"path": "/examples/0D_sizing/run_monte_carlo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shipupi/IngeSoft path: /3. Development/PetVet/catalog/tests/test_product.py
import os
from django.core.files.uploadedfile import SimpleUploadedFile
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
import datetime
from decimal import Decimal
from p... | code_fim | hard | {
"lang": "python",
"repo": "shipupi/IngeSoft",
"path": "/3. Development/PetVet/catalog/tests/test_product.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Incorrect id
response = self.client.get(reverse('products:product_detail', kwargs={'id':0, 'slug':self.product1.slug}))
self.assertEqual(response.status_code, 404)
# Incorrect slug
response = self.client.get(reverse('products:product_detail', kwargs={'id'... | code_fim | hard | {
"lang": "python",
"repo": "shipupi/IngeSoft",
"path": "/3. Development/PetVet/catalog/tests/test_product.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = {
'price_min': Decimal("50"),
'price_max': Decimal("550"),
}
response = self.client.get(reverse('products:product_list_by_category', kwargs={'slug': self.category.slug}), data)
self.assertEqual(response.status_code, 200)
self.assertEqu... | code_fim | hard | {
"lang": "python",
"repo": "shipupi/IngeSoft",
"path": "/3. Development/PetVet/catalog/tests/test_product.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: susnata1981/lendingclub path: /application/util/constants.py
from flask import current_app
PHONE_VERIFICATION_MSG = 'Ziplly: your verification code is {0}'
ACCOUNT_NOT_VERIFIED = 'You must verify your phone number first'
INVALID_CREDENTIALS = 'Username or password is invalid'
MISSING_ACCOUNT = '... | code_fim | medium | {
"lang": "python",
"repo": "susnata1981/lendingclub",
"path": "/application/util/constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>SIGNUP_EMAIL_SUBJECT = 'Thanks for expressing interest'
SIGNUP_EMAIL_BODY = '''
<p>
Thanks for expressing interest in Ziplly. We are working on creating the first
membership based lending program that is also affordable. We will contact you as soon
as we are ready to launch.
</p>
<p>
Thanks,<br/>
Admin
</... | code_fim | medium | {
"lang": "python",
"repo": "susnata1981/lendingclub",
"path": "/application/util/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taunusflieger/CarND-Behavioral-Cloning-P3 path: /model.py
import os
import csv
import cv2
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from keras.models import Model, Sequential
from keras.layers import BatchNormalization, ... | code_fim | hard | {
"lang": "python",
"repo": "taunusflieger/CarND-Behavioral-Cloning-P3",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = Conv2D(36, kernel_size = (5, 5), padding='valid', subsample=(2, 2), use_bias=False)(x)
x = BatchNormalization()(x)
x = Activation("relu")(x)
x = Conv2D(48, kernel_size = (5, 5), padding='valid', subsample=(2, 2), use_bias=False)(x)
x = BatchNormalization()(x)
x = Activation("r... | code_fim | hard | {
"lang": "python",
"repo": "taunusflieger/CarND-Behavioral-Cloning-P3",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'BARE_DEPENDENT_KEY2': '$STRING_KEY/$PRODUCT_NAME',
'BARE_DEPENDENT_KEY1': 'D:$BARE_DEPENDENT_KEY2',
'BARE_DEPENDENT_KEY3': '$PRODUCT_TYPE:$BARE_DEPENDENT_KEY1',
'MIXED_DEPENDENT_KEY': '${STRING_KEY}:$(PRODUCT_NAME):$MACH_O_TYPE',
},
# Env vars in rules. The $F... | code_fim | hard | {
"lang": "python",
"repo": "tmikov/jscomp",
"path": "/runtime/deps/gyp/test/mac/xcode-env-order/test.gyp",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'PAREN_DEPENDENT_KEY2': '$(STRING_KEY)/$(PRODUCT_NAME)',
'PAREN_DEPENDENT_KEY1': 'D:$(PAREN_DEPENDENT_KEY2)',
'PAREN_DEPENDENT_KEY3': '$(PRODUCT_TYPE):$(PAREN_DEPENDENT_KEY1)',
'BARE_DEPENDENT_KEY2': '$STRING_KEY/$PRODUCT_NAME',
'BARE_DEPENDENT_KEY1': 'D:$BARE_DEPE... | code_fim | hard | {
"lang": "python",
"repo": "tmikov/jscomp",
"path": "/runtime/deps/gyp/test/mac/xcode-env-order/test.gyp",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmikov/jscomp path: /runtime/deps/gyp/test/mac/xcode-env-order/test.gyp
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'test_app',
'produc... | code_fim | hard | {
"lang": "python",
"repo": "tmikov/jscomp",
"path": "/runtime/deps/gyp/test/mac/xcode-env-order/test.gyp",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = CategoryInfo
fields = '__all__'<|fim_prefix|># repo: lovebirdegg/nnms-server path: /apps/cms/serializers/category_serializers.py
# @Time : 2020-08-18 10:24:22
# @Author : code_generator
from rest_framework import serializers
from ..models import CategoryInfo
from rest_framewo... | code_fim | medium | {
"lang": "python",
"repo": "lovebirdegg/nnms-server",
"path": "/apps/cms/serializers/category_serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lovebirdegg/nnms-server path: /apps/cms/serializers/category_serializers.py
# @Time : 2020-08-18 10:24:22
# @Author : code_generator
from rest_framework import serializers
from ..models import CategoryInfo
from rest_framework_recursive.fields import RecursiveField
<|fim_suffix|> mode... | code_fim | medium | {
"lang": "python",
"repo": "lovebirdegg/nnms-server",
"path": "/apps/cms/serializers/category_serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> times = random.randint(0, spectrogram_shape[-1], size=self.rect_masks)
freqs = random.randint(0, spectrogram_shape[-2], size=self.rect_masks)
times_lower = clip(times - self.rect_time // 2, 0, spectrogram_shape[-1])
time_upper = clip(times + self.rect_time // 2, 0, spectrog... | code_fim | medium | {
"lang": "python",
"repo": "alexdrydew/asr_project_template",
"path": "/hw_asr/augmentations/spectrogram_augmentations/cutout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> holes = self.get_holes(data.shape)
for hole in zip(*holes):
data[:, hole[0]:hole[1], hole[2]:hole[3]] = 0.
return data<|fim_prefix|># repo: alexdrydew/asr_project_template path: /hw_asr/augmentations/spectrogram_augmentations/cutout.py
from torch import Tensor
from nu... | code_fim | hard | {
"lang": "python",
"repo": "alexdrydew/asr_project_template",
"path": "/hw_asr/augmentations/spectrogram_augmentations/cutout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexdrydew/asr_project_template path: /hw_asr/augmentations/spectrogram_augmentations/cutout.py
from torch import Tensor
from numpy import random, clip
from hw_asr.augmentations.base import AugmentationBase
class CutOut(AugmentationBase):
def __init__(self, rect_freq, rect_masks, rect_time... | code_fim | medium | {
"lang": "python",
"repo": "alexdrydew/asr_project_template",
"path": "/hw_asr/augmentations/spectrogram_augmentations/cutout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guoweikuang/weibo_project path: /app/utils.py
# -*- coding: utf-8 -*-
"""
~~~~~~~~~~~~~~~~~~~
handle something module
@author guoweikuang
"""
import re
import arrow
from collections import defaultdict
from pyecharts import Bar
from flask_admin import BaseView
from flask_admin import expose
fro... | code_fim | hard | {
"lang": "python",
"repo": "guoweikuang/weibo_project",
"path": "/app/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return results
def get_max_hot_keyword_chart(db=1):
category, hot_value = get_max_hot_topic(db=db)
keywords, index = get_hot_keyword(db=db)
img_name = "%s%s" % (category, str(index)) + '.png'
results = get_max_text(category, index)
return keywords, img_name, results, category
d... | code_fim | hard | {
"lang": "python",
"repo": "guoweikuang/weibo_project",
"path": "/app/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ResetNetwork/apply-app path: /hypha/apply/funds/urls.py
from django.urls import include, path
from hypha.apply.projects import urls as projects_urls
from .views import (
AwaitingReviewSubmissionsListView,
GroupingApplicationsListView,
ReminderDeleteView,
ReviewerLeaderboard,
... | code_fim | hard | {
"lang": "python",
"repo": "ResetNetwork/apply-app",
"path": "/hypha/apply/funds/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>submission_urls = ([
path('', SubmissionOverviewView.as_view(), name="overview"),
path('all/', SubmissionListView.as_view(), name="list"),
path('summary/', GroupingApplicationsListView.as_view(), name="summary"),
path('result/', SubmissionResultView.as_view(), name="result"),
path('fla... | code_fim | hard | {
"lang": "python",
"repo": "ResetNetwork/apply-app",
"path": "/hypha/apply/funds/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
app_name = 'funds'
submission_urls = ([
path('', SubmissionOverviewView.as_view(), name="overview"),
path('all/', SubmissionListView.as_view(), name="list"),
path('summary/', GroupingApplicationsListView.as_view(), name="summary"),
path('result/', SubmissionResultView.as_view(), name="re... | code_fim | hard | {
"lang": "python",
"repo": "ResetNetwork/apply-app",
"path": "/hypha/apply/funds/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> filtered_results = list()
saturated_dfs = list()
for (control_col, treated_col), df in zip(self.file_name_pairs, input_df_list):
passing = df[
(df[control_col] < self.expression_max) |
(df[treated_col] < self.expression_max)
... | code_fim | hard | {
"lang": "python",
"repo": "paulegradie/SeqPyPlot",
"path": "/main_app/seqpyplot/analyzer/paired_sample_filter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulegradie/SeqPyPlot path: /main_app/seqpyplot/analyzer/paired_sample_filter.py
import os
import numpy as np
import pandas as pd
try:
from functools import reduce
except ImportError:
pass
class PairedSampleFilter(object):
"""
This class handles filtering paired normalized samp... | code_fim | hard | {
"lang": "python",
"repo": "paulegradie/SeqPyPlot",
"path": "/main_app/seqpyplot/analyzer/paired_sample_filter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>f = open('dict.txt', 'wt', encoding='utf-8')
f.writelines(OrderedDict.fromkeys(result))
f.close()
print('Complete')<|fim_prefix|># repo: khjkr/stdict-py path: /stdict.py
import requests, re
from bs4 import BeautifulSoup
from collections import OrderedDict
headers = {
'Referer': 'http://stdweb2.korean.... | code_fim | hard | {
"lang": "python",
"repo": "khjkr/stdict-py",
"path": "/stdict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khjkr/stdict-py path: /stdict.py
import requests, re
from bs4 import BeautifulSoup
from collections import OrderedDict
headers = {
'Referer': 'http://stdweb2.korean.go.kr/search/List_dic.jsp',
'Content-Type': 'application/x-www-form-urlencoded'
}
<|fim_suffix|>html = BeautifulSoup(r.text, '... | code_fim | hard | {
"lang": "python",
"repo": "khjkr/stdict-py",
"path": "/stdict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .views import DjangoPage
urlpatterns = [
url(r'^django$', DjangoPage.as_view(), name='django'),
]<|fim_prefix|># repo: mokorolev/pythondigest path: /landings/urls.py
# -*- encoding: utf-8 -*-
<|fim_middle|>from django.conf.urls import url
| code_fim | easy | {
"lang": "python",
"repo": "mokorolev/pythondigest",
"path": "/landings/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mokorolev/pythondigest path: /landings/urls.py
# -*- encoding: utf-8 -*-
from django.conf.urls import url
from .views import DjangoPage
<|fim_suffix|> url(r'^django$', DjangoPage.as_view(), name='django'),
]<|fim_middle|>urlpatterns = [
| code_fim | easy | {
"lang": "python",
"repo": "mokorolev/pythondigest",
"path": "/landings/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: micanzhang/focus path: /app/helper/baseAction.py
__author__ = 'micanzhang'
import web
import os
from app.constants import Roles
from jinja2 import Environment,FileSystemLoader
from app.helper import filter
from app.constants import ResponseStatus, Response
class BaseAction:
access_role = Ro... | code_fim | hard | {
"lang": "python",
"repo": "micanzhang/focus",
"path": "/app/helper/baseAction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def access_filter(self):
if self.access_role > self.role:
return web.seeother('/signin')
def render(self, template_name, **context):
extensions = context.pop('extensions', [])
globals = context.pop('globals', {})
globals['ctx'] = web.ctx
globals... | code_fim | medium | {
"lang": "python",
"repo": "micanzhang/focus",
"path": "/app/helper/baseAction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: djaodjin/djaodjin-saas path: /saas/urls/views/subscriber/billing/payment.py
# Copyright (c) 2022, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redist... | code_fim | hard | {
"lang": "python",
"repo": "djaodjin/djaodjin-saas",
"path": "/saas/urls/views/subscriber/billing/payment.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
urlpatterns = [
path('billing/<slug:%s>/checkout/' %
settings.PROFILE_URL_KWARG,
CheckoutView.as_view(), name='saas_checkout'),
path('billing/<slug:%s>/cart-seats/' %
settings.PROFILE_URL_KWARG,
CartSeatsView.as_view(), name='saas_cart_seats'),
path('billing/<s... | code_fim | hard | {
"lang": "python",
"repo": "djaodjin/djaodjin-saas",
"path": "/saas/urls/views/subscriber/billing/payment.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangzhezhe/TPST path: /tests/exp_dataSize/PatternEvent/ana.py
# watch key info in metaserver
# get metadata
# fetch the real data
# record the time
from mpi4py import MPI
import numpy as np
import dataspaces.dataspaceClient as dataspaces
import ctypes
import os
import time
import math
import tim... | code_fim | hard | {
"lang": "python",
"repo": "wangzhezhe/TPST",
"path": "/tests/exp_dataSize/PatternEvent/ana.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>getdata_p1,rcode = ds.get(var_name, ts, lb, ub)
endpull = timeit.default_timer()
print("pull data ",endpull-startpull)
print("do real analytics")
# time it
# addrList=metaclient.getServerAddr()
# addr = addrList[0]
# metaclient.Recordtime(addr, anakey)
# do real analytics<|fim_prefix|># repo: wangzhezh... | code_fim | medium | {
"lang": "python",
"repo": "wangzhezhe/TPST",
"path": "/tests/exp_dataSize/PatternEvent/ana.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
name = 'quickstart'
options = GHAdminTemplateCommand.base_options + [
Option('project_name', help='The project name', positional=True,
required=True),
Option('package_name', help='The project name', short_name='p',
required=False),
Option('... | code_fim | hard | {
"lang": "python",
"repo": "passy/glashammer-rdrei",
"path": "/bin/gh-admin",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: passy/glashammer-rdrei path: /bin/gh-admin
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Control script for Glashammer."""
from sanescript import Command, Option, register
from glashammer.version import glashammer_version
from glashammer.utils import run_very_simple, sibpath
from glasha... | code_fim | medium | {
"lang": "python",
"repo": "passy/glashammer-rdrei",
"path": "/bin/gh-admin",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns: state (str) : final state
"""
state = 'UNSUBMITTED'
while not (state == 'COMPLETED' or state =='FAILED'):
output.add_live_msg(ms.STATUS.format(state))
time.sleep(5)
#search for the task in task_list
for task in task_description:... | code_fim | hard | {
"lang": "python",
"repo": "jdilger/accuracy-assessment",
"path": "/clip-time-series/utils/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdilger/accuracy-assessment path: /clip-time-series/utils/utils.py
from sepal_ui.scripts import gee as gs
from utils import messages as ms
import time
def custom_wait_for_completion(task_description, output):
"""Wait until the selected process are finished. Display some output information
<... | code_fim | hard | {
"lang": "python",
"repo": "jdilger/accuracy-assessment",
"path": "/clip-time-series/utils/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SkyFishMoon/riemannian-nlp path: /riemann/config/config_specs/general_config.py
from ..config import ConfigDict
from ..manifold_config import ManifoldConfig
CONFIG_NAME = "general"
<|fim_suffix|> """
General Configuration
"""
n_epochs: int = 4000
eval_every: int = 5
gpu: ... | code_fim | easy | {
"lang": "python",
"repo": "SkyFishMoon/riemannian-nlp",
"path": "/riemann/config/config_specs/general_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
General Configuration
"""
n_epochs: int = 4000
eval_every: int = 5
gpu: int = 0<|fim_prefix|># repo: SkyFishMoon/riemannian-nlp path: /riemann/config/config_specs/general_config.py
from ..config import ConfigDict
from ..manifold_config import ManifoldConfig
CONFIG_NAME = "gen... | code_fim | easy | {
"lang": "python",
"repo": "SkyFishMoon/riemannian-nlp",
"path": "/riemann/config/config_specs/general_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return max(top_k, key = list(top_k).count)
def predict(self, X):
preds = list()
X = np.asarray(X)
for x in X:
distances = self._euclidien_distance(x)
# Zip the distances and y values together
distances = zip(*(distances, self.y))
... | code_fim | medium | {
"lang": "python",
"repo": "samyakjain3001/Build-ML-Algos-From-Scratch",
"path": "/Supervised/Classification/knn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samyakjain3001/Build-ML-Algos-From-Scratch path: /Supervised/Classification/knn.py
import pandas as pd
import numpy as np
import math
from sklearn.datasets import load_digits, load_iris, load_boston, load_breast_cancer
from sklearn.model_selection import train_test_split
class KNeighbours():
... | code_fim | hard | {
"lang": "python",
"repo": "samyakjain3001/Build-ML-Algos-From-Scratch",
"path": "/Supervised/Classification/knn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
r: the CRUDRequest instance
widget: the widget as a tuple: (label, type, icon)
attr: controller attributes for the request
"""
widget_get = widget.get
# Parse context
context = widget_get("context", None)
... | code_fim | hard | {
"lang": "python",
"repo": "nursix/drkcm",
"path": "/modules/core/methods/profile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nursix/drkcm path: /modules/core/methods/profile.py
ltForm
sqlform = S3SQLDefaultForm()
get_config = current.s3db.get_config
if record_id:
# Update form
onvalidation = get_config(tablename, "create_onvalidation") or \
... | code_fim | hard | {
"lang": "python",
"repo": "nursix/drkcm",
"path": "/modules/core/methods/profile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nursix/drkcm path: /modules/core/methods/profile.py
# Default page-load
# Page Title
title = get_config(tablename, "profile_title")
if not title:
try:
title = r.record.name
except:
... | code_fim | hard | {
"lang": "python",
"repo": "nursix/drkcm",
"path": "/modules/core/methods/profile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # scores_mape_train=scores_train[2]
# scores_mape_val=scores_val[2]
# scores_mape_test=scores_test[2]
#fitness = (scores_mape_train + scores_mape_val + scores_mape_test )/3
# print('fitness=',fitness)
y_train_hat = model.predict(x_train)
y_val_hat ... | code_fim | hard | {
"lang": "python",
"repo": "chtien18/chtien18.github.io",
"path": "/ML workshop/code/ex3_4 layers_PSO_DNN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #fitness = (scores_mape_train + scores_mape_val + scores_mape_test )/3
# print('fitness=',fitness)
y_train_hat = model.predict(x_train)
y_val_hat = model.predict(x_val)
y_test_hat = model.predict(x_test)
y_train_hat_denorm = dataset_preprocess.denorm(y_tra... | code_fim | hard | {
"lang": "python",
"repo": "chtien18/chtien18.github.io",
"path": "/ML workshop/code/ex3_4 layers_PSO_DNN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chtien18/chtien18.github.io path: /ML workshop/code/ex3_4 layers_PSO_DNN.py
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 19:36:39 2023
@author: chtie
"""
from tensorflow import keras
from tensorflow.keras import layers, callbacks
from sklearn.model_selection import train_test_split
from skl... | code_fim | hard | {
"lang": "python",
"repo": "chtien18/chtien18.github.io",
"path": "/ML workshop/code/ex3_4 layers_PSO_DNN.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.