text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> config = ConfigManager(config_file_path).get_config()
api_build.build(
source_dir=config.sagify_module_dir,
requirements_dir=config.requirements_dir,
docker_tag=obj['docker_tag'],
image_name=config.image_name,
python_version=confi... | code_fim | hard | {
"lang": "python",
"repo": "Kenza-AI/sagify",
"path": "/sagify/commands/build.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kenza-AI/sagify path: /sagify/commands/build.py
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import sys
import click
from sagify.api import build as api_build
from sagify.commands import ASCII_LOGO
from sagify.log import logger
from future.moves import subpro... | code_fim | hard | {
"lang": "python",
"repo": "Kenza-AI/sagify",
"path": "/sagify/commands/build.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isaacanthony/yaml-pipeline path: /yaml_pipeline/nodes/mkdirs.py
"""os.mkdir"""
from os import mkdir, path
def run(dfs: dict, settings: dict) -> dict:
<|fim_suffix|> prefix = settings['local_path_prefix'] if 'local_path_prefix' in settings else ''
for new_dir in settings['dirs']:
... | code_fim | medium | {
"lang": "python",
"repo": "isaacanthony/yaml-pipeline",
"path": "/yaml_pipeline/nodes/mkdirs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for new_dir in settings['dirs']:
if path.exists(prefix + new_dir):
if 'logger' in settings:
settings['logger'].info("Directory already exists (%s)", new_dir)
else:
mkdir(prefix + new_dir)
return dfs<|fim_prefix|># repo: isaacanthony/yaml-pip... | code_fim | medium | {
"lang": "python",
"repo": "isaacanthony/yaml-pipeline",
"path": "/yaml_pipeline/nodes/mkdirs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: H-E-L-P/simstack_HELP path: /simple_stacking_bot.py
import numpy as np
from utils import clean_args
from utils import clean_nans
from lmfit import Parameters, minimize #, fit_report
from astropy.io import fits
import time
t0 = time.time()
def simultaneous_stack_array_oned(p, layers_1d, data1d,... | code_fim | hard | {
"lang": "python",
"repo": "H-E-L-P/simstack_HELP",
"path": "/simple_stacking_bot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'helo'
t2 = time.time()
nlayers = len(cfits_flat)/len_model
chi_best = 1e9
cfits_flat_use = np.zeros(np.size(cfits_flat))
bs_sample = np.random.randint(0, len_model,len_model)
fit_params = Parameters()
for iarg in range(nlayers):
arg = 'name'+str(iarg)+'good'
fit_params.add(arg,val... | code_fim | hard | {
"lang": "python",
"repo": "H-E-L-P/simstack_HELP",
"path": "/simple_stacking_bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #name = 'pm_'+wave+'_beth_'+name2+'_MY.fits'
name = 'pm_'+wave+'_beth_'+name2+'.fits'
hdu = fits.open(loc+name)
img = hdu[1].data
cfits_flat = np.ndarray.flatten(img['a'])
len_model = len(imap)
print 'helo'
t2 = time.time()
nlayers = len(cfits_flat)/len_model
chi_best = 1e9
cfits_flat_use ... | code_fim | hard | {
"lang": "python",
"repo": "H-E-L-P/simstack_HELP",
"path": "/simple_stacking_bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_portion_barcode(barcode):
b = parse_barcode(barcode)
return '-'.join([b['project'], b['tss'], b['participant'],
b['sample'] + b['vial'], b['portion'] + b['analyte']])
def get_barcode_df(x):
if isinstance(x, pd.DataFrame):
barcodes = x.index
else:
... | code_fim | hard | {
"lang": "python",
"repo": "idc9/mvmm_sim",
"path": "/mvmm_sim/tcga/process_raw_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_barcode_df(x):
if isinstance(x, pd.DataFrame):
barcodes = x.index
else:
barcodes = x
info = pd.DataFrame([parse_barcode(i, delim='-')
for i in barcodes]).set_index('barcode')
info = add_patient_barcode(info)
return info
def filter_o... | code_fim | hard | {
"lang": "python",
"repo": "idc9/mvmm_sim",
"path": "/mvmm_sim/tcga/process_raw_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: idc9/mvmm_sim path: /mvmm_sim/tcga/process_raw_data.py
import pandas as pd
from collections import Counter
import numpy as np
def parse_barcode(x, delim='-'):
# https://docs.gdc.cancer.gov/Encyclopedia/pages/TCGA_Barcode/#:~:text=A%20TCGA%20barcode%20is%20composed,the%20highest%20number%20o... | code_fim | hard | {
"lang": "python",
"repo": "idc9/mvmm_sim",
"path": "/mvmm_sim/tcga/process_raw_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snowdj/UCF-MSDA-workshop path: /Year19-20/2020-02-07_web_scraping/01_quotes.py
import scrapy
class QuotesSpider(scrapy.Spider):
# name for spider -- important in larger projects
name = 'quotes'
# all urls for which scrapy should initiate this spider
start_urls = [
'... | code_fim | medium | {
"lang": "python",
"repo": "snowdj/UCF-MSDA-workshop",
"path": "/Year19-20/2020-02-07_web_scraping/01_quotes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # remember that quotes are in a `div` element with class `quote`?
for quote in response.css('div.quote'):
yield {
# ... and that inside that div we have `span` with `.text`?
'text': quote.css('span.text::text').get(),
... | code_fim | medium | {
"lang": "python",
"repo": "snowdj/UCF-MSDA-workshop",
"path": "/Year19-20/2020-02-07_web_scraping/01_quotes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iChoake/pyfractal path: /dirty/quickfractaltrial.py
import math
import tkinter as tk
import random
def rotation_scale(x, y, theta, gen, scale):
return [(x + (i - x) * math.cos(theta) * scale - (j - y) * math.sin(theta) * scale, y +
(i - x) * math.sin(theta) * scale + (j ... | code_fim | hard | {
"lang": "python",
"repo": "iChoake/pyfractal",
"path": "/dirty/quickfractaltrial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_base(rules, base_length, startpoint):
result = [startpoint]
for theta, fac, _, _ in rules:
x, y = result[-1]
result.append([x + base_length * math.cos(theta) * fac,
y + base_length * math.sin(theta) * fac])
return result
def fractal(n, r... | code_fim | hard | {
"lang": "python",
"repo": "iChoake/pyfractal",
"path": "/dirty/quickfractaltrial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> clustered = lcl.AdaptiveKMeans(HBN_Embedded)
clustered.cluster()
with open(os.path.join(root, 'km_clust_dm.pkl'), 'wb') as pkl_loc:
pkl.dump(clustered, pkl_loc)<|fim_prefix|># repo: NeuroDataDesign/lemur path: /app/pheno.py
# Outside imports
import pandas as pd
import numpy as np
impo... | code_fim | hard | {
"lang": "python",
"repo": "NeuroDataDesign/lemur",
"path": "/app/pheno.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeuroDataDesign/lemur path: /app/pheno.py
# Outside imports
import pandas as pd
import numpy as np
import os
import pickle as pkl
# Load the lemur library
import sys
sys.path.append("..")
import lemur.datasets as lds
import lemur.metrics as lms
import lemur.plotters as lpl
import lemur.clusteri... | code_fim | hard | {
"lang": "python",
"repo": "NeuroDataDesign/lemur",
"path": "/app/pheno.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ", ".join(value)
#
#<|fim_prefix|># repo: jkpubsrc/Thaniya path: /thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py
from .AbstractFlaskTemplateFilter import AbstractFlaskTemplateFilter
<|fim_middle|>
#
# Creates a canonical string represetation of data.
#
class FlaskFilt... | code_fim | medium | {
"lang": "python",
"repo": "jkpubsrc/Thaniya",
"path": "/thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __call__(self, value:list):
return ", ".join(value)
#
#<|fim_prefix|># repo: jkpubsrc/Thaniya path: /thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py
from .AbstractFlaskTemplateFilter import AbstractFlaskTemplateFilter
<|fim_middle|>
#
# Creates a canonical string repres... | code_fim | medium | {
"lang": "python",
"repo": "jkpubsrc/Thaniya",
"path": "/thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jkpubsrc/Thaniya path: /thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py
from .AbstractFlaskTemplateFilter import AbstractFlaskTemplateFilter
<|fim_suffix|> return ", ".join(value)
#
#<|fim_middle|>
#
# Creates a canonical string represetation of data.
#
class FlaskFilt... | code_fim | medium | {
"lang": "python",
"repo": "jkpubsrc/Thaniya",
"path": "/thaniya_server/src/thaniya_server/flask/FlaskFilter_listToStr.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (s.start + s.stop)*0.5
if isinstance(roi, slice):
return slice_center(roi)
return tuple(slice_center(s) for s in roi)
def roi_from_points(xy, shape, padding=0, align=None):
"""
Compute envelope around a bunch of points and return it as roi (tuple of
row/col s... | code_fim | hard | {
"lang": "python",
"repo": "opendatacube/datacube-core",
"path": "/datacube/utils/geometry/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opendatacube/datacube-core path: /datacube/utils/geometry/tools.py
turn np.vstack([
np.vstack([x, np.full_like(x, y[0])]).T,
np.vstack([np.full_like(y, x[-1]), y]).T[1:],
np.vstack([x, np.full_like(x, y[-1])]).T[::-1][1:],
np.vstack([np.full_like(y, x[0]), y]).T[::... | code_fim | hard | {
"lang": "python",
"repo": "opendatacube/datacube-core",
"path": "/datacube/utils/geometry/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opendatacube/datacube-core path: /datacube/utils/geometry/tools.py
bc.Sequence) or len(roi) != 2:
raise ValueError("Need 2d roi")
row, col = roi
return ((0 if row.start is None else row.start, row.stop),
(0 if col.start is None else col.start, col.stop... | code_fim | hard | {
"lang": "python",
"repo": "opendatacube/datacube-core",
"path": "/datacube/utils/geometry/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gilo-agilo/learning-tdd path: /tests/test_hackerrank_07.py
from hackerrank.challenges import find_runner_up_score
def test_n_and_a():
import pytest
wrong_ns = [-1, 0, 1, 11]
wrong_as = [[-101, 0, 1], [0, 1, 101], [0, 0, 200]]
for a_n in wrong_ns:
with pytest.raises(Value... | code_fim | medium | {
"lang": "python",
"repo": "gilo-agilo/learning-tdd",
"path": "/tests/test_hackerrank_07.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dim = 5
arr = [2, 3, 6, 6, 5]
assert find_runner_up_score(dim, arr) == 5
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
print(find_runner_up_score(n, list(arr)))<|fim_prefix|># repo: gilo-agilo/learning-tdd path: /tests/test_hackerrank_07.py
from hac... | code_fim | hard | {
"lang": "python",
"repo": "gilo-agilo/learning-tdd",
"path": "/tests/test_hackerrank_07.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TylerGubala/anki-vector-news-anchor path: /anki_vector_news_anchor/story.py
#!/usr/bin/env python3
#coding: utf-8
#STD LIB imports
from datetime import datetime
from typing import Iterator
#PYPI imports
from sumy.parsers.html import HtmlParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.n... | code_fim | medium | {
"lang": "python",
"repo": "TylerGubala/anki-vector-news-anchor",
"path": "/anki_vector_news_anchor/story.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = HtmlParser.from_url(self.link, Tokenizer(LANGUAGE))
stemmer = Stemmer(LANGUAGE)
summarizer = Summarizer(stemmer)
summarizer.stop_words = get_stop_words(LANGUAGE)
for sentence in summarizer(parser.document, summary_length):
yield sentence<|fim_pr... | code_fim | hard | {
"lang": "python",
"repo": "TylerGubala/anki-vector-news-anchor",
"path": "/anki_vector_news_anchor/story.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Instantiate a dictionary to hold filename and corresponding preprocessed caption tokens
image_caption_dict = collections.defaultdict(list)
# This is a dict that initialises a new key with an empty list value: {a: {}, b:[] ...}
for file, caption in zip(img_name_vector, cap... | code_fim | hard | {
"lang": "python",
"repo": "animit-kulkarni/image-captioning-tensorflow",
"path": "/experimentation/tokenize_captions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: animit-kulkarni/image-captioning-tensorflow path: /experimentation/tokenize_captions.py
import tensorflow as tf
import pickle
import utils
import os
import collections
import random
from tqdm import tqdm
import numpy as np
import logging
from config import CONFIG
from tools.timer import timer
C... | code_fim | hard | {
"lang": "python",
"repo": "animit-kulkarni/image-captioning-tensorflow",
"path": "/experimentation/tokenize_captions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(img_names_list) == len(caption_vector), 'Something went wrong in the img_name_vector reformatting'
return img_names_list
def save_caption_file_tuples(self, train_captions, val_captions):
caption_cache_dir = os.path.join(CONFIG.CACHE_DIR_ROOT, f'{CONFIG.CNN_BACKBONE... | code_fim | hard | {
"lang": "python",
"repo": "animit-kulkarni/image-captioning-tensorflow",
"path": "/experimentation/tokenize_captions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def getMeetingTimes(self):
'''getMeetingTimes
Returns an XML payload containing a listing of all active meeting times/time ranges.
Sample Request URL: http://.../?do=cnt.getservice&service=getMeetingTimes
'''
url = "%s/?do=cnt.getservice&service=getMeetingTimes... | code_fim | hard | {
"lang": "python",
"repo": "vsoch/ohbm",
"path": "/ohbm/system.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vsoch/ohbm path: /ohbm/system.py
'''
system: part of the ohbm-api
'''
from ohbm.utils import get_url, ordered_to_dict, parse_item, parse_items
class System():
def __init__(self,api=None):
if api == None:
print("Please use this module from ohbm.api")
else:
... | code_fim | hard | {
"lang": "python",
"repo": "vsoch/ohbm",
"path": "/ohbm/system.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pixmap = self._makePixmap(self.widthSpinBox.value(), self.heightSpinBox.value())
return QPixmap.toImage(pixmap)
def _makePixmap(self, width, height):
pixmap =QPixmap(width, height)
style = self.brushComboBox.itemData(self.brushComboBox.currentIndex())
brush = QBrush(self.color, Qt.BrushStyle(s... | code_fim | hard | {
"lang": "python",
"repo": "MeNsaaH/image-editor-pyqt5",
"path": "/newImageDlg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MeNsaaH/image-editor-pyqt5 path: /newImageDlg.py
# -*- coding: utf-8 -*-
"""
@author: Manasseh Madu
A simple Image Manipulation application
"""
import os
import sys
import time
import platform
from PyQt5.QtGui import (QBrush, QPixmap, QPainter)
from PyQt5.QtWidgets import (QColorDialog, QDialog,... | code_fim | hard | {
"lang": "python",
"repo": "MeNsaaH/image-editor-pyqt5",
"path": "/newImageDlg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pixmap = self._makePixmap(60, 30)
self.colorMap.setPixmap(pixmap)
def image(self):
pixmap = self._makePixmap(self.widthSpinBox.value(), self.heightSpinBox.value())
return QPixmap.toImage(pixmap)
def _makePixmap(self, width, height):
pixmap =QPixmap(width, height)
style = self.brushComboBox... | code_fim | hard | {
"lang": "python",
"repo": "MeNsaaH/image-editor-pyqt5",
"path": "/newImageDlg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # pylint: disable=protected-access
def test_api_version_4_manual(self):
path = os.path.join(self.tempdir, 'file_4_manual.ini')
dns_test_common.write({"linode_key": TOKEN_V3, "linode_version": 4}, path)
config = mock.MagicMock(linode_credentials=path,
... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-dns-linode/certbot_dns_linode/_internal/tests/dns_linode_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: certbot/certbot path: /certbot-dns-linode/certbot_dns_linode/_internal/tests/dns_linode_test.py
"""Tests for certbot_dns_linode._internal.dns_linode."""
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import os
from certbot.plug... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-dns-linode/certbot_dns_linode/_internal/tests/dns_linode_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.provider_mock = mock.MagicMock()
self.client.provider = self.provider_mock
class Linode4LexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest):
DOMAIN_NOT_FOUND = Exception('Domain not found')
def setUp(self):
from certbot_dns_linode._i... | code_fim | hard | {
"lang": "python",
"repo": "certbot/certbot",
"path": "/certbot-dns-linode/certbot_dns_linode/_internal/tests/dns_linode_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bz2/tableschema-py path: /tableschema/types/boolean.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
from ..config import ERROR
<|fim_suffix|># Internal
_TR... | code_fim | hard | {
"lang": "python",
"repo": "bz2/tableschema-py",
"path": "/tableschema/types/boolean.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Module API
def cast_boolean(format, value):
if not isinstance(value, bool):
if not isinstance(value, six.string_types):
return ERROR
value = value.strip().lower()
if value in _TRUE_VALUES:
value = True
elif value in _FALSE_VALUES:
... | code_fim | medium | {
"lang": "python",
"repo": "bz2/tableschema-py",
"path": "/tableschema/types/boolean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def insert_hashtag(self, hashtag, mid):
"""
Inserts a new hashtag to the database
:param hashtag: str
:param mid: int
"""
cursor = self.get_cursor()
query = 'INSERT INTO hashtags_messages (hashtag, mid) values (%s, %s)'
cursor.execute(que... | code_fim | hard | {
"lang": "python",
"repo": "borkinc/Bork",
"path": "/dao/message_dao.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_num_replies_daily(self, date):
"""
Gets daily number of replies
:param date: datetime
:return: RealDictCursor
"""
cursor = self.get_cursor()
end_date = date + relativedelta(days=1)
query = 'SELECT count(*) AS num ' \
... | code_fim | hard | {
"lang": "python",
"repo": "borkinc/Bork",
"path": "/dao/message_dao.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: borkinc/Bork path: /dao/message_dao.py
from dateutil.relativedelta import relativedelta
from dao.dao import DAO
class MessageDAO(DAO):
def get_all_messages(self):
"""
Gets all messages from DB.
:return: RealDictCursor
"""
cursor = self.get_cursor()
... | code_fim | hard | {
"lang": "python",
"repo": "borkinc/Bork",
"path": "/dao/message_dao.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AStepanov/aio-request path: /aio_request/utils.py
import abc
import asyncio
import contextlib
import sys
from typing import Any, Callable, Collection, Optional, TypeVar
class Closable(abc.ABC):
__slots__ = ()
@abc.abstractmethod
async def close(self) -> None:
...
TClosabl... | code_fim | medium | {
"lang": "python",
"repo": "AStepanov/aio-request",
"path": "/aio_request/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def close(items: Collection[TClosable]) -> None:
for item in items:
await close_single(item)
def try_parse_float(value: Optional[str]) -> Optional[float]:
if value is None:
return None
try:
return float(value)
except ValueError:
return None<|fim_pre... | code_fim | hard | {
"lang": "python",
"repo": "AStepanov/aio-request",
"path": "/aio_request/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> close_futures = _close_futures_py38
cancel_futures = _cancel_futures_py38
async def close(items: Collection[TClosable]) -> None:
for item in items:
await close_single(item)
def try_parse_float(value: Optional[str]) -> Optional[float]:
if value is None:
return None
... | code_fim | hard | {
"lang": "python",
"repo": "AStepanov/aio-request",
"path": "/aio_request/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timp21337/JenkinsApiScripts path: /deleteWorkspaces.py
from jenkinsapi.jenkins import Jenkins
from jenkinsapi.jenkins import UnknownJob
J = Jenkins('http://hades:8081', 'timp', '94bff6285f22db83e8de27b27cf69263')
old_jobs = [
'api.develop.build-ant.core',
'api.develop.build-gradle.core',
... | code_fim | hard | {
"lang": "python",
"repo": "timp21337/JenkinsApiScripts",
"path": "/deleteWorkspaces.py",
"mode": "psm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>-core.develop.sonar.det',
'radio-site.develop.build-ant.web',
'radio-site.develop.build-ant.web2',
'radio-site.develop.sonar.det',
'radio-site._pr_.build-ant.web',
'recommendations.develop.build-ant.radio',
'recommendations.develop.sonar.det',
'report.12467',
'report.29184',
'result.1246... | code_fim | hard | {
"lang": "python",
"repo": "timp21337/JenkinsApiScripts",
"path": "/deleteWorkspaces.py",
"mode": "spm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
text: paddle.Tensor,
feats: Optional[paddle.Tensor]=None,
sids: Optional[paddle.Tensor]=None,
spembs: Optional[paddle.Tensor]=None,
lids: Optional[paddle.Tensor]=None,
durations: Optional[paddle.Tensor]=None,
... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/DeepSpeech-1",
"path": "/paddlespeech/t2s/models/vits/vits.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anniyanvr/DeepSpeech-1 path: /paddlespeech/t2s/models/vits/vits.py
ncoder": True,
"flow_flows": 4,
"flow_kernel_size": 5,
"flow_base_dilation": 1,
"flow_layers": 4,
"flow_dropout_rate": 0.0,
"use_weigh... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/DeepSpeech-1",
"path": "/paddlespeech/t2s/models/vits/vits.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
text: paddle.Tensor,
text_lengths: paddle.Tensor,
feats: paddle.Tensor,
feats_lengths: paddle.Tensor,
sids: Optional[paddle.Tensor]=None,
spembs: Optional[paddle.Tensor]=None,
lids: Optional[paddle.Tensor... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/DeepSpeech-1",
"path": "/paddlespeech/t2s/models/vits/vits.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RedHatInsights/insights-core path: /insights/tests/parsers/test_avc_cache_threshold.py
import doctest
import pytest
from insights.core.exceptions import ParseException
from insights.parsers import avc_cache_threshold
from insights.parsers.avc_cache_threshold import AvcCacheThreshold
from insight... | code_fim | medium | {
"lang": "python",
"repo": "RedHatInsights/insights-core",
"path": "/insights/tests/parsers/test_avc_cache_threshold.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_avc_cache_threshold():
cache_threshold = avc_cache_threshold.AvcCacheThreshold(context_wrap(AVC_CACHE_THRESHOLD))
assert cache_threshold.cache_threshold == 512
def test_invalid():
with pytest.raises(ParseException) as e:
avc_cache_threshold.AvcCacheThreshold(context_wrap(AV... | code_fim | medium | {
"lang": "python",
"repo": "RedHatInsights/insights-core",
"path": "/insights/tests/parsers/test_avc_cache_threshold.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for j in range(int(input())):
print('Case #{0}: {1}'.format(j+1, (lambda s: int_to_base(base_to_int(s[0], s[1]), s[2]))(input().split())))<|fim_prefix|># repo: swopnilnep/kattis path: /python3/aliennumbers/aliennumbers.py
def base_to_int(code, lang):
l = len(lang)
s = 0
n = 0
m = {lan... | code_fim | medium | {
"lang": "python",
"repo": "swopnilnep/kattis",
"path": "/python3/aliennumbers/aliennumbers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swopnilnep/kattis path: /python3/aliennumbers/aliennumbers.py
def base_to_int(code, lang):
l = len(lang)
s = 0
n = 0
m = {lang[i]: i for i in range(l)}
for i in reversed(code):
s += m[i] * l ** n
n += 1
return s
<|fim_suffix|>for j in range(int(input())):... | code_fim | medium | {
"lang": "python",
"repo": "swopnilnep/kattis",
"path": "/python3/aliennumbers/aliennumbers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeattleCentral/ITC110 path: /awesomeness/krege_face.py
from graphics import *
win = GraphWin("Meh face", 1500, 1000)
top_left = Point(0, 0)
bottom_right = Point(1500, 1000)
rectangle = Rectangle(top_left, bottom_right)
rectangle.setFill('Black')
rectangle.draw(win)
center = Point(750... | code_fim | hard | {
"lang": "python",
"repo": "SeattleCentral/ITC110",
"path": "/awesomeness/krege_face.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lined = linea.clone()
lined.move(480,0)
lined.draw(win)
point_a = Point(1055, 635)
point_b = Point(1100, 435)
linee = Line(point_a, point_b)
linee.setFill('White')
linee.setWidth(9)
linee.draw(win)
point_a = Point(1215, 400)
point_b = Point(1115, 420)
linef = Line(point_a, point_b)
linef.s... | code_fim | hard | {
"lang": "python",
"repo": "SeattleCentral/ITC110",
"path": "/awesomeness/krege_face.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Support
def l1_support(x, eps=1e-6):
return (np.abs(x) > eps).flatten()
def linf_support(x, eps=1e-6):
max_value = np.max(np.abs(x))
return (np.abs(np.abs(x) - max_value) < eps).flatten()
def l1_l2_support(blocks, x, eps=1e-6):
support = np.zeros(x.shape, dtype=bool)
for i in ran... | code_fim | hard | {
"lang": "python",
"repo": "svaiter/LoCoRe",
"path": "/locore/operators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: svaiter/LoCoRe path: /locore/operators.py
from __future__ import division
import numpy as np
# Thresholding
def soft_thresholding(x, gamma):
return np.maximum(0, 1 - gamma / np.maximum(np.abs(x), 1E-10)) * x
def dual_prox(prox):
<|fim_suffix|># Dictionaries
def finite_diff_1d(n, bound='sy... | code_fim | hard | {
"lang": "python",
"repo": "svaiter/LoCoRe",
"path": "/locore/operators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nsarlin/courserapredictprices path: /src/models/xgb.py
import xgboost as xgb
import joblib
import os
from src import common
xgb_params = {'eta': 0.1, 'seed': common.RANDOM_SEED, 'subsample': 1, 'colsample_bytree': 0.7,
'objective': 'reg:linear', 'max_depth': 13,
'min... | code_fim | hard | {
"lang": "python",
"repo": "nsarlin/courserapredictprices",
"path": "/src/models/xgb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def predict(bst, X_test):
X_test_xgb = xgb.DMatrix(X_test)
return bst.predict(X_test_xgb)<|fim_prefix|># repo: nsarlin/courserapredictprices path: /src/models/xgb.py
import xgboost as xgb
import joblib
import os
from src import common
xgb_params = {'eta': 0.1, 'seed': common.RANDOM_SEED, 'subsa... | code_fim | medium | {
"lang": "python",
"repo": "nsarlin/courserapredictprices",
"path": "/src/models/xgb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: playfulMIT/kimchi path: /accounts/models.py
from django.contrib.auth.models import AbstractUser, UserManager
from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(UserManager):
def get_by_natura... | code_fim | medium | {
"lang": "python",
"repo": "playfulMIT/kimchi",
"path": "/accounts/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CustomUser(AbstractUser):
objects = CustomUserManager()
name = CharField(_("Name of User"), blank=True, max_length=255)
def get_absolute_url(self):
return reverse("users:detail", kwargs={"username": self.username})<|fim_prefix|># repo: playfulMIT/kimchi path: /accounts/models.p... | code_fim | medium | {
"lang": "python",
"repo": "playfulMIT/kimchi",
"path": "/accounts/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anishpatelwork/colour-palette-calculator path: /colour_palette/pen.py
from .colour import Colour
class Pen:
def __init__(self, brand, name, colour=None, rgb=None):
self.brand = brand
self.name = name
if colour is not None:
self.colour = colour
... | code_fim | medium | {
"lang": "python",
"repo": "anishpatelwork/colour-palette-calculator",
"path": "/colour_palette/pen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
'brand': self.brand,
'name': self.name,
'colour': self.colour.serialize()
}
def __eq__(self, o):
if isinstance(o, Pen):
return self.brand == o.brand and self.name == o.name and self.colour == o.colour
return Fals... | code_fim | medium | {
"lang": "python",
"repo": "anishpatelwork/colour-palette-calculator",
"path": "/colour_palette/pen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TencentCloud/tencentcloud-sdk-python path: /tencentcloud/thpc/v20220401/thpc_client.py
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | code_fim | hard | {
"lang": "python",
"repo": "TencentCloud/tencentcloud-sdk-python",
"path": "/tencentcloud/thpc/v20220401/thpc_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def DescribeClusters(self, request):
"""本接口(DescribeClusters)用于查询集群列表。
:param request: Request instance for DescribeClusters.
:type request: :class:`tencentcloud.thpc.v20220401.models.DescribeClustersRequest`
:rtype: :class:`tencentcloud.thpc.v20220401.models.Describe... | code_fim | hard | {
"lang": "python",
"repo": "TencentCloud/tencentcloud-sdk-python",
"path": "/tencentcloud/thpc/v20220401/thpc_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pgThiago/learning-python path: /python-exercises-for-beginners/094.py
# Crie um programa que leia nome, sexo e idade de várias pessoas, guardando os dados de
# cada pessoa em um dicionário e todos os dicionários em uma lista. No final, mostre:
# A) Quantas pessoas foram cadastradas
# B) A média ... | code_fim | hard | {
"lang": "python",
"repo": "pgThiago/learning-python",
"path": "/python-exercises-for-beginners/094.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(acima_da_media) == 0:
acima = 'ninguém está acima da média!'
else:
for old in acima_da_media:
acima += f'{old}, '
print(f'A) Ao todo temos {len(cadastro)} pessoas cadastradas.')
print(f'B) A média de idade é de {media} anos.')
print(f'C) As mulheres cadastradas foram {molieres}')
p... | code_fim | hard | {
"lang": "python",
"repo": "pgThiago/learning-python",
"path": "/python-exercises-for-beginners/094.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for module in sorted(self.__module_map.iterkeys()):
print("module %s" % module)
print("\n".join(sorted(self.__module_map[module])))
print("")
config_header_linker = HeaderLinker
def main():
logging.basicConfig(stream=sys.stderr,level=logging.DEBUG)... | code_fim | hard | {
"lang": "python",
"repo": "btc-ag/revengtools",
"path": "/cpp/link_headers_to_modules_run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: btc-ag/revengtools path: /cpp/link_headers_to_modules_run.py
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from commons.configurator import Configurator
from cpp.cpp_if import VirtualModuleTypes
from cpp.header_linker_if import BaseOutput, HeaderLinker
from cpp.incl_deps.file_include_deps impor... | code_fim | medium | {
"lang": "python",
"repo": "btc-ag/revengtools",
"path": "/cpp/link_headers_to_modules_run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexdong/mort path: /fabfile.py
# pylint: skip-file
import os
<|fim_suffix|> local('pylint mort')
local('mypy --strict-optional --ignore-missing-imports --python-version 3.6 mort tests')<|fim_middle|>from fabric.api import local
CURRENT_PATH = os.path.dirname(__file__)
def coverage()... | code_fim | medium | {
"lang": "python",
"repo": "alexdong/mort",
"path": "/fabfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexdong/mort path: /fabfile.py
# pylint: skip-file
import os
from fabric.api import local
<|fim_suffix|>def lint():
local('pylint mort')
local('mypy --strict-optional --ignore-missing-imports --python-version 3.6 mort tests')<|fim_middle|>CURRENT_PATH = os.path.dirname(__file__)
de... | code_fim | medium | {
"lang": "python",
"repo": "alexdong/mort",
"path": "/fabfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> local('pylint mort')
local('mypy --strict-optional --ignore-missing-imports --python-version 3.6 mort tests')<|fim_prefix|># repo: alexdong/mort path: /fabfile.py
# pylint: skip-file
import os
from fabric.api import local
<|fim_middle|>CURRENT_PATH = os.path.dirname(__file__)
def coverage()... | code_fim | medium | {
"lang": "python",
"repo": "alexdong/mort",
"path": "/fabfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hegxiten/decawave-1001-rjg path: /decawave_1001_rjg/messages/dwm_response.py
from .tlv_message import TlvMessage
class DwmResponse(TlvMessage):
def __init__(self, message: bytes):
super().__init__(message)
self.expected_type = 0x40
def error_code(self):
... | code_fim | medium | {
"lang": "python",
"repo": "hegxiten/decawave-1001-rjg",
"path": "/decawave_1001_rjg/messages/dwm_response.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.error_code() == 0x02
def error_invalid_parameter(self):
return self.error_code() == 0x03
def error_busy(self):
return self.error_code() == 0x04
def error_invalid_response(self):
"""The device may return a message consisting of all zeros o... | code_fim | hard | {
"lang": "python",
"repo": "hegxiten/decawave-1001-rjg",
"path": "/decawave_1001_rjg/messages/dwm_response.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hendrikTpl/GAN_models path: /AAE/Chainer implementation/adversarial-autoencoder-master/supervised/learn_style/train.py
import numpy as np
import os, sys, time
from chainer import cuda
from chainer import functions as F
from model import aae
from progress import Progress
from args import args
impo... | code_fim | hard | {
"lang": "python",
"repo": "hendrikTpl/GAN_models",
"path": "/AAE/Chainer implementation/adversarial-autoencoder-master/supervised/learn_style/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # reconstruction phase
z_l = aae.encode_x_z(images_l)
reconstruction_l = aae.decode_yz_x(label_onehot_l, z_l)
loss_reconstruction = F.mean_squared_error(aae.to_variable(images_l), reconstruction_l)
aae.backprop_generator(loss_reconstruction)
aae.backprop_decoder(loss_reconstruction)
... | code_fim | hard | {
"lang": "python",
"repo": "hendrikTpl/GAN_models",
"path": "/AAE/Chainer implementation/adversarial-autoencoder-master/supervised/learn_style/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # classification
# 0 -> true sample
# 1 -> generated sample
class_true = aae.to_variable(np.zeros(batchsize, dtype=np.int32))
class_fake = aae.to_variable(np.ones(batchsize, dtype=np.int32))
# training
progress = Progress()
for epoch in xrange(1, max_epoch):
progress.start_epoch(epoch, max_epoc... | code_fim | hard | {
"lang": "python",
"repo": "hendrikTpl/GAN_models",
"path": "/AAE/Chainer implementation/adversarial-autoencoder-master/supervised/learn_style/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: morganstanley/testplan path: /examples/Multitest/Ordering/Multi-level Ordering/test_plan.py
#!/usr/bin/env python
"""
This example shows how different sorting logic can be applied
on different testing levels (e.g. plan, multitest)
"""
import sys
from testplan.testing.multitest import MultiTest, ... | code_fim | hard | {
"lang": "python",
"repo": "morganstanley/testplan",
"path": "/examples/Multitest/Ordering/Multi-level Ordering/test_plan.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# We have a plan level test sorter that will sort the tests alphabetically
# However on Multitest('Primary') we have an explicit `test_sorter` argument
# which will take precedence and shuffle the tests instead.
@test_plan(
name="Multi-level Test ordering",
test_sorter=AlphanumericSorter("all"),
... | code_fim | hard | {
"lang": "python",
"repo": "morganstanley/testplan",
"path": "/examples/Multitest/Ordering/Multi-level Ordering/test_plan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.on_memory_dataset:
data = dataset.load_data_to_memory()
else:
data = None
train_dataset = DrawQuick(data=data, mode='train')
test_dataset = DrawQuick(data=data, mode='test')
train_dataloader = DataLoader(train_dataset, batch_size=args.batch_size, num_workers=1, ... | code_fim | hard | {
"lang": "python",
"repo": "hologerry/sketch-transformer",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hologerry/sketch-transformer path: /train.py
"""Training script."""
import random
import tempfile
import time
from argparse import ArgumentParser
from collections import deque
from functools import partial
import torch
from torch.nn.functional import cross_entropy
from torch.optim.lr_scheduler ... | code_fim | hard | {
"lang": "python",
"repo": "hologerry/sketch-transformer",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Co-ordinates are Python style zero-based.
"""
# TODO - Refactor to use a generator function (in start order)
# rather than making a list and sorting?
answer = []
full_len = len(nuc_seq)
if options.strand != "reverse":
for frame in range(0, 3):
for offset, n,... | code_fim | hard | {
"lang": "python",
"repo": "peterjc/pico_galaxy",
"path": "/tools/get_orfs_or_cdss/get_orfs_or_cdss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if options.out_prot_file == "-":
out_prot = sys.stdout
elif options.out_prot_file:
out_prot = open(options.out_prot_file, "w")
else:
out_prot = None
if options.out_bed_file == "-":
out_bed = sys.stdout
elif options.out_bed_file:
out_bed = open(options.out_bed_file, "w")
else:
out_... | code_fim | hard | {
"lang": "python",
"repo": "peterjc/pico_galaxy",
"path": "/tools/get_orfs_or_cdss/get_orfs_or_cdss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peterjc/pico_galaxy path: /tools/get_orfs_or_cdss/get_orfs_or_cdss.py
#!/usr/bin/env python
"""Find ORFs in a nucleotide sequence file.
For more details, see the help text and argument descriptions in the
accompanying get_orfs_or_cdss.xml file which defines a Galaxy interface.
This tool is a sh... | code_fim | hard | {
"lang": "python",
"repo": "peterjc/pico_galaxy",
"path": "/tools/get_orfs_or_cdss/get_orfs_or_cdss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rayjustinhuang/BitesofPy path: /streak.py
from datetime import datetime, timedelta, date
TODAY = date(2018, 11, 12)
def extract_dates(data):
"""Extract unique dates from DB table representation as shown in Bite"""
dates = []
for line in data.splitlines():
if line[6:8] ... | code_fim | hard | {
"lang": "python",
"repo": "rayjustinhuang/BitesofPy",
"path": "/streak.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if TODAY not in sorted_dates and TODAY != (sorted_dates[-1] + timedelta(days=1)):
return max_streak
for i in range(1, len(sorted_dates)):
if (sorted_dates[i] - sorted_dates[i-1]).days == 1:
streak_counter += 1
else:
max_streak = streak_counter
... | code_fim | hard | {
"lang": "python",
"repo": "rayjustinhuang/BitesofPy",
"path": "/streak.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>": "REPEATED"
},
{
"mode": "NULLABLE",
"type": "STRING",
"description": "ALL, ASSIGNED, NONE",
"name": "status"
},
{
"mode": "NULLABLE",
"type": "STRING",
"description": "",
"name": "kind"
}
],
{
"mode": "NULLABLE",
... | code_fim | hard | {
"lang": "python",
"repo": "dvandra/starthinker",
"path": "/starthinker/task/dcm_api/schema/accountUserProfile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dvandra/starthinker path: /starthinker/task/dcm_api/schema/accountUserProfile.py
###########################################################################
#
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | code_fim | hard | {
"lang": "python",
"repo": "dvandra/starthinker",
"path": "/starthinker/task/dcm_api/schema/accountUserProfile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--self-node', dest='self_node', required=True,
help='IP address of this node')
args = parser.parse_args()
# Create local devices
profile = middleware.NodeProfile()
# pr... | code_fim | hard | {
"lang": "python",
"repo": "keiichishima/echonetlite",
"path": "/examples/server-temp.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keiichishima/echonetlite path: /examples/server-temp.py
import argparse
import struct
from echonetlite.interfaces import monitor
from echonetlite import middleware
from echonetlite.protocol import *
class MyTemperature(middleware.NodeSuperObject):
<|fim_suffix|> # Start the Echonet Lite mess... | code_fim | hard | {
"lang": "python",
"repo": "keiichishima/echonetlite",
"path": "/examples/server-temp.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create local devices
profile = middleware.NodeProfile()
# profile.property[EPC_MANUFACTURE_CODE] = ...
# profile.property[EPC_IDENTIFICATION_NUMBER] = ...
temperature = MyTemperature(eoj=EOJ(clsgrp=CLSGRP_CODE['SENSOR'],
cls=CLS_SE_CODE['TEMPER... | code_fim | hard | {
"lang": "python",
"repo": "keiichishima/echonetlite",
"path": "/examples/server-temp.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
import os
import re
last_code_point = '06FF'
src = open('DerivedCoreProperties.txt')
out = open(os.path.join(os.path.dirname(os.getcwd()),
'src', 'identifiers_re.js'), 'w')
state = None
elts = {}
props = ['XID_Start', 'XID_Continue']
prop_pattern = re.compile("# Derived Property... | code_fim | hard | {
"lang": "python",
"repo": "brython-dev/brython",
"path": "/scripts/make_identifiers_regexp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brython-dev/brython path: /scripts/make_identifiers_regexp.py
# -*- coding: utf-8 -*-
"""This scripts builds the Javascript file identifiers_re.js in folder "src"
This scripts holds the regular expressions used to detect Unicode variable
names in the source code, allowing names that include no... | code_fim | hard | {
"lang": "python",
"repo": "brython-dev/brython",
"path": "/scripts/make_identifiers_regexp.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AhmadSherief/disaster-response path: /models/train_classifier.py
# import libraries
import sys
import numpy as np
import pandas as pd
import nltk
nltk.download(["punkt", "wordnet", "averaged_perceptron_tagger"])
from sqlalchemy import create_engine
from nltk import word_tokenize
from nltk.ste... | code_fim | hard | {
"lang": "python",
"repo": "AhmadSherief/disaster-response",
"path": "/models/train_classifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> clean_tokens = []
for tok in tokens:
clean_tok = lemmatizer.lemmatize(tok).lower().strip()
clean_tokens.append(clean_tok)
return clean_tokens
def build_model():
""" Build pipeline that transforms a count matrix to a normalized tf or tf-idf representation
and use ... | code_fim | hard | {
"lang": "python",
"repo": "AhmadSherief/disaster-response",
"path": "/models/train_classifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jinheeson1008/tensorflow-lstm-regression path: /traceml/traceml/processors/events_processors/__init__.py
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... | code_fim | hard | {
"lang": "python",
"repo": "jinheeson1008/tensorflow-lstm-regression",
"path": "/traceml/traceml/processors/events_processors/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def video_path(
from_path: str, asset_path: str, content_type=None, asset_rel_path: str = None
) -> V1EventVideo:
copy_file_path(from_path, asset_path)
return V1EventVideo(path=asset_rel_path or asset_path, content_type=content_type)
def audio_path(
from_path: str, asset_path: str, cont... | code_fim | hard | {
"lang": "python",
"repo": "jinheeson1008/tensorflow-lstm-regression",
"path": "/traceml/traceml/processors/events_processors/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>A(None, JmpIfPush(2, Reg("x0"), Reg("x0"))),
A(None, Label(label=1)),
A(None, Push(Reg("x1"))),
A(None, Label(label=2)),
A("c", Pop()),
A(None, Return(Reg("c")))
]
instrs = list(main(instrs))
show_instrs(instrs)<|fim_prefix|># repo: lvyitian1/restrain-jit path: /tests/becy/phi.py
fro... | code_fim | medium | {
"lang": "python",
"repo": "lvyitian1/restrain-jit",
"path": "/tests/becy/phi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lvyitian1/restrain-jit path: /tests/becy/phi.py
from restrain_jit.becython.phi_elim import main
from restrain_jit.becython.stack_vm_instructions import *
from restrain_jit.becython.tools import show_instrs
instrs = [
A(None, Label(label=0)),
A(None, Push(Reg("x0"))),
<|fim_suffix|>Lab... | code_fim | medium | {
"lang": "python",
"repo": "lvyitian1/restrain-jit",
"path": "/tests/becy/phi.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.