text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
@pytest.fixture(autouse=True)
def add_standard_imports(doctest_namespace):
"""Add py3dep namespace for doctest."""
import py3dep
doctest_namespace["py3dep"] = py3dep<|fim_prefix|># repo: hyriver/py3dep path: /conftest.py
"""Configuration for pytest."""
import pytest
from click.testing impo... | code_fim | easy | {
"lang": "python",
"repo": "hyriver/py3dep",
"path": "/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cuulee/sar2watermask path: /polygonize.py
import os
import subprocess
import glob
import datetime
from modules.getPaths import *
t0=datetime.datetime.now()
print("First polygonize SAR\n")
items=os.listdir(sarOut)
newlist = []
for names in items:
if names.endswith("watermask.tif"):
... | code_fim | hard | {
"lang": "python",
"repo": "cuulee/sar2watermask",
"path": "/polygonize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>items=os.listdir(s2aOut)
for scene in items:
print("\n polygonizing " + scene + "\n")
out_gml = scene[:-4] + "_watermask.gml"
subprocess.call([pyt,gdalPol,s2aOut + "/" + scene,"-f","GML",polOut + "/" + out_gml])
os.remove(s2aOut + "/" + scene)
print("\n********** sentinel-2 polygonize co... | code_fim | hard | {
"lang": "python",
"repo": "cuulee/sar2watermask",
"path": "/polygonize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("... now polygonize S2A\n")
items=os.listdir(s2aOut)
for scene in items:
print("\n polygonizing " + scene + "\n")
out_gml = scene[:-4] + "_watermask.gml"
subprocess.call([pyt,gdalPol,s2aOut + "/" + scene,"-f","GML",polOut + "/" + out_gml])
os.remove(s2aOut + "/" + scene)
print("\n... | code_fim | medium | {
"lang": "python",
"repo": "cuulee/sar2watermask",
"path": "/polygonize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print(patient_age_quantile, leukocytes)
print(type(patient_age_quantile), type(leukocytes))
prediction = Predict(patient_age_quantile, leukocytes, platelets,
monocytes, hematocrit, eosinophils, red_blood_cells,
hemoglobin, lymphocytes, mean_platelet_volume)
... | code_fim | hard | {
"lang": "python",
"repo": "gthompsonku/predicting_covid_with_bloodtest",
"path": "/Deployment-flask/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gthompsonku/predicting_covid_with_bloodtest path: /Deployment-flask/app.py
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os
import joblib
import numpy as np
from flask import Flask, request, jsonify, render_templ... | code_fim | hard | {
"lang": "python",
"repo": "gthompsonku/predicting_covid_with_bloodtest",
"path": "/Deployment-flask/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> final_features = [np.array(features)]
prediction = model.predict(final_features)
predicted_value = prediction[0]
if int(predicted_value)== 1:
prediction_resp ='Positive'
else:
prediction_resp ='Negative'
return render_template('index.html', pre... | code_fim | hard | {
"lang": "python",
"repo": "gthompsonku/predicting_covid_with_bloodtest",
"path": "/Deployment-flask/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class State(object):
def __new__(cls, key=None, is_global=False):
if is_global:
states_dict, key_counts = _get_global_state()
else:
states_dict, key_counts = _get_session_state()
if key is None:
key = _figure_out_key(key_counts)
if... | code_fim | hard | {
"lang": "python",
"repo": "nthmost/st-13thfloor",
"path": "/st_state_patch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nthmost/st-13thfloor path: /st_state_patch.py
"""Another prototype of the State implementation.
Usage
-----
How to import this:
import streamlit as st
import st_state_patch
When you do that, you will get 3 new commands in the "st" module:
* st.State
* st.SessionState
* st... | code_fim | hard | {
"lang": "python",
"repo": "nthmost/st-13thfloor",
"path": "/st_state_patch.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return session._session_state, curr_thread._key_counts
def _get_session_object():
# Hack to get the session object from Streamlit.
ctx = ReportThread.get_report_ctx()
session = None
session_infos = Server.get_current()._session_infos.values()
for session_info in session_infos:... | code_fim | hard | {
"lang": "python",
"repo": "nthmost/st-13thfloor",
"path": "/st_state_patch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name=name,
description=desc,
version=version,
packages=find_packages(),
entry_points=entry_points
)<|fim_prefix|># repo: ntg28/recall path: /setup.py
from setuptools import (setup, find_packages)
<|fim_middle|>name: str = "recall"
desc: str = "Python scripts for Active Rec... | code_fim | hard | {
"lang": "python",
"repo": "ntg28/recall",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntg28/recall path: /setup.py
from setuptools import (setup, find_packages)
<|fim_suffix|>setup(
name=name,
description=desc,
version=version,
packages=find_packages(),
entry_points=entry_points
)<|fim_middle|>name: str = "recall"
desc: str = "Python scripts for Active Rec... | code_fim | hard | {
"lang": "python",
"repo": "ntg28/recall",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 解析页面的步骤写这里
return getJSONStr([{'version':"0.0.1",'time':"2019-09-09",'content':["Create project Changelogger."]}])
if __name__ == '__main__':
# 此处main方法用于测试
testSample = Sample()
testSample.start()
testSample.join()
print(testSample)<|fim_prefix|># repo: duyinda/Chan... | code_fim | easy | {
"lang": "python",
"repo": "duyinda/ChangeLogger-1",
"path": "/Parsers/Sample.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duyinda/ChangeLogger-1 path: /Parsers/Sample.py
from Parsers.Parser import *
# 复制本示例来创建一个新的Parser
class Sample(Parser):
<|fim_suffix|> # 解析页面的步骤写这里
return getJSONStr([{'version':"0.0.1",'time':"2019-09-09",'content':["Create project Changelogger."]}])
if __name__ == '__main__':
... | code_fim | easy | {
"lang": "python",
"repo": "duyinda/ChangeLogger-1",
"path": "/Parsers/Sample.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# 此处main方法用于测试
testSample = Sample()
testSample.start()
testSample.join()
print(testSample)<|fim_prefix|># repo: duyinda/ChangeLogger-1 path: /Parsers/Sample.py
from Parsers.Parser import *
# 复制本示例来创建一个新的Parser
class Sample(Parser):
<|fim_middle|> def par... | code_fim | medium | {
"lang": "python",
"repo": "duyinda/ChangeLogger-1",
"path": "/Parsers/Sample.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> None:
dp[idx] = dp[negative_idx] + 1
else:
dp[idx] = 1
elif diff < 0:
negative_idx = idx
if positive_idx is not None:
dp[idx] = dp[positive_idx] + 1
else:
... | code_fim | hard | {
"lang": "python",
"repo": "xiaosean/leetcode_python",
"path": "/Q376_Wiggle-Subsequence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaosean/leetcode_python path: /Q376_Wiggle-Subsequence.py
class Solution:
def wiggleMaxLength(self, nums: List[int]) -> int:
diff_list = []
dp = [0] * (len(nums)-1)
positive_idx, negative_idx = None, None
longest = 0
for idx, (x, y) in enumerate(zip(nu... | code_fim | hard | {
"lang": "python",
"repo": "xiaosean/leetcode_python",
"path": "/Q376_Wiggle-Subsequence.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def mul(num1, num2):
"""
Multiplies two numbers
>>> mul(2,4)
8
"""
return num1 * num2
def div(num1, num2):
"""
Divides two numbers
>>> div(4,2)
2.0
Raises zero division error
>>> div(4,0)
Traceback (most recent call last):
...
ZeroDivision... | code_fim | medium | {
"lang": "python",
"repo": "lmerchant/ucsd-ext-put-final",
"path": "/src/calculator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lmerchant/ucsd-ext-put-final path: /src/calculator.py
"""
Calculator.py
Calculates addition, subtraction, multiplication and division of two numbers
"""
def add(num1, num2):
""" Adds two numbers
>>> add(2,4)
6
"""
return num1 + num2
def sub(num1, num2):
<|fim_suffix|>def ... | code_fim | medium | {
"lang": "python",
"repo": "lmerchant/ucsd-ext-put-final",
"path": "/src/calculator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bodu93/netmodel path: /test/bufsize.py
import socket
if __name__ == "__main__":
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
snd_buflen = udp_socket.getsockopt(socket.SOL_SOCKET, socket.SO_SN<|fim_suffix|>'s default send buf length is:", snd_buflen)
rcv_buflen = tcp_... | code_fim | hard | {
"lang": "python",
"repo": "bodu93/netmodel",
"path": "/test/bufsize.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>'s default send buf length is:", snd_buflen)
rcv_buflen = tcp_socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
print("tcp's default recv buf length is:", rcv_buflen)<|fim_prefix|># repo: bodu93/netmodel path: /test/bufsize.py
import socket
if __name__ == "__main__":
udp_socket = socket... | code_fim | hard | {
"lang": "python",
"repo": "bodu93/netmodel",
"path": "/test/bufsize.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(outside_entities) == 0
def test_load_conll():
X, y = load_conll(dataset="test_conll")
assert isinstance(X, tuple)
assert isinstance(y, tuple)
assert len(X) == 4
assert len(y) == 4
def test_load_conll_raises_KeyError():
with pytest.raises(KeyError):
load_... | code_fim | hard | {
"lang": "python",
"repo": "Bhavyashu/WellcomeML",
"path": "/tests/datasets/test_conll.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bhavyashu/WellcomeML path: /tests/datasets/test_conll.py
from wellcomeml.datasets.conll import _load_data_spacy, load_conll
import pytest
def test_length():
X, Y = _load_data_spacy("tests/test_data/test_conll", inc_outside=True)
assert len(X) == len(Y) and len(X) == 4
def test_entity... | code_fim | medium | {
"lang": "python",
"repo": "Bhavyashu/WellcomeML",
"path": "/tests/datasets/test_conll.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> outside_entities = [
entity for entities in Y for entity in entities if entity["label"] == "O"
]
assert len(outside_entities) == 0
def test_load_conll():
X, y = load_conll(dataset="test_conll")
assert isinstance(X, tuple)
assert isinstance(y, tuple)
assert len(X) ==... | code_fim | hard | {
"lang": "python",
"repo": "Bhavyashu/WellcomeML",
"path": "/tests/datasets/test_conll.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swsnu/swpp2019-team1 path: /back/matchmaker/views.py
'''
matchmaker views
Handle requests.
'''
import json
from django.http import HttpResponse, HttpResponseBadRequest, \
HttpResponseNotAllowed, HttpResponseForbidden, JsonResponse
from django.shortcuts import get_object_or_404
from django.con... | code_fim | hard | {
"lang": "python",
"repo": "swsnu/swpp2019-team1",
"path": "/back/matchmaker/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def match_recommend(request):
'''Returns recommend three matches.'''
if request.method == 'GET':
if request.user.is_authenticated:
interest_list = USER.objects.get(
id=request.user.id).interest_user.values()
match_list = []
for interest i... | code_fim | hard | {
"lang": "python",
"repo": "swsnu/swpp2019-team1",
"path": "/back/matchmaker/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find if the input genes are in this master list
genes_sub = cancer_genes_df[cancer_genes_df['Gene Symbol'].isin(genes)]
# Add status to the Y matrix depending on if the gene is a tumor suppressor
# or an oncogene. An oncogene can be activated with copy number gains, but
# a tumor su... | code_fim | hard | {
"lang": "python",
"repo": "inambioinfo/pancancer",
"path": "/scripts/util/tcga_util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: inambioinfo/pancancer path: /scripts/util/tcga_util.py
"""
Gregory Way 2017
PanCancer Classifier
tcga_util.py
Usage: For import only
"""
def get_threshold_metrics(y_true, y_pred, drop_intermediate=False,
disease='all'):
"""
Retrieve true/false positive rates a... | code_fim | hard | {
"lang": "python",
"repo": "inambioinfo/pancancer",
"path": "/scripts/util/tcga_util.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> create(self._mesos())
def _readf(self, path):
f = self.resolve(path)
if os.path.exists(f):
with open(f) as h:
return h.read().strip()
def _writef(self, path, value):
f = self.resolve(path)
with open(f, "w+") as h:
h.... | code_fim | hard | {
"lang": "python",
"repo": "mesosphere-backup/deimos",
"path": "/deimos/state.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mesosphere-backup/deimos path: /deimos/state.py
import errno
from fcntl import LOCK_EX, LOCK_NB, LOCK_SH, LOCK_UN
import itertools
import os
import random
import signal
import time
import deimos.docker
from deimos.err import *
from deimos.logger import log
from deimos._struct import _Struct
from... | code_fim | hard | {
"lang": "python",
"repo": "mesosphere-backup/deimos",
"path": "/deimos/state.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fmt_time = "indefinite" if seconds is None else "%ds" % seconds
fmt_flags = deimos.flock.format_lock_flags(flags)
flags, seconds = deimos.flock.nb_seconds(flags, seconds)
log.info("request // %s %s (%s)", name, fmt_flags, fmt_time)
p = self.resolve(os.path.join("loc... | code_fim | hard | {
"lang": "python",
"repo": "mesosphere-backup/deimos",
"path": "/deimos/state.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s=test_class(1,increase_factor=1.0)
li=[4,6,77,8,0]
for i in li:
self.assertTrue(s.add(i))
for i in li:
self.assertTrue(i in s)
def template_minimal_min_factor(self, test_class):
s=test_class(1,min_factor=1.0)
li=[4,6,77,... | code_fim | hard | {
"lang": "python",
"repo": "realead/tighthash",
"path": "/tests/unittests/test_TightHashSet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEquals(len(s), 50)
for x in xrange(50):
self.assertTrue(x in s)
def template_iterate_with_zero(self, test_class):
s=test_class(10)
for x in xrange(50):
s.add(x)
self.assertTrue(x in s)
... | code_fim | hard | {
"lang": "python",
"repo": "realead/tighthash",
"path": "/tests/unittests/test_TightHashSet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: realead/tighthash path: /tests/unittests/test_TightHashSet.py
import unittest
import sys
sys.path.append('..')#tighthash
sys.path.append('../uttemplate/uttemplate')
import uttemplate
from tighthash import pset, cset
@uttemplate.from_templates([pset, cset])
class TesterTemplate(unittest.T... | code_fim | hard | {
"lang": "python",
"repo": "realead/tighthash",
"path": "/tests/unittests/test_TightHashSet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def generate_cover(
requested_by, title, views_or_artist, duration, thumbnail, chat_id
):
async with session.get(thumbnail) as resp:
if resp.status == 200:
f = await aiofiles.open(f"background{chat_id}.png", mode="wb")
await f.write(await resp.read())
... | code_fim | hard | {
"lang": "python",
"repo": "BabuBot1/Telegram_VC_Bot",
"path": "/functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BabuBot1/Telegram_VC_Bot path: /functions.py
import asyncio
import functools
import os
import aiofiles
import ffmpeg
import youtube_dl
from aiohttp import ClientSession
from PIL import Image, ImageDraw, ImageFont
from pyrogram import Client
from pyrogram.types import Message
from pyrogram.raw.ty... | code_fim | hard | {
"lang": "python",
"repo": "BabuBot1/Telegram_VC_Bot",
"path": "/functions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fields = ['username', 'eventname', 'eventdate', 'predtime', 'emerge', 'iscomplete', 'costtime']
class DailyfreetimeAdmin(admin.ModelAdmin):
list_display = ('username', 'timedate', 'freetime', 'busytime')
fields = ['username', 'timedate', 'freetime', 'busytime']
admin.site.register(EventList, Even... | code_fim | hard | {
"lang": "python",
"repo": "alex112401/black-dashboard-django",
"path": "/apps/home/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alex112401/black-dashboard-django path: /apps/home/admin.py
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.contrib import admin
from .models import EventList, Dailyfreetime
# Register your models here.
<|fim_suffix|>class DailyfreetimeAdmin(admin.ModelAdm... | code_fim | hard | {
"lang": "python",
"repo": "alex112401/black-dashboard-django",
"path": "/apps/home/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def voronoi_labelling(self, seed):
""" Performs a voronoi labelling of the graph
Parameters
----------
seed: array of shape (nseeds), type (np.int_),
vertices from which the cells are built
Returns
-------
labels: array of shape (... | code_fim | hard | {
"lang": "python",
"repo": "nipy/nipy",
"path": "/nipy/algorithms/graph/graph.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nipy/nipy path: /nipy/algorithms/graph/graph.py
d), seed))
heapq.heapify(dg)
for j in range(self.V):
end = False
while True:
if len(dg) == 0:
end = True
break
node = heapq.heappop(dg)
... | code_fim | hard | {
"lang": "python",
"repo": "nipy/nipy",
"path": "/nipy/algorithms/graph/graph.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(weights, None.__class__):
new_weights = []
else:
new_weights = weights
self.set_weights(new_weights)
def set_weights(self, weights):
""" Set edge weights
Parameters
----------
weights: array
arr... | code_fim | hard | {
"lang": "python",
"repo": "nipy/nipy",
"path": "/nipy/algorithms/graph/graph.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asafm-lb/aioswitcher path: /tests/asserters.py
"""Common assertion tools for use with the Switcher integration test cases."""
from typing import Any, List, Optional
from aioswitcher.api.messages import (ResponseMessageType,
SwitcherV2BaseResponseMSG)
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "asafm-lb/aioswitcher",
"path": "/tests/asserters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def assert_seconds_to_iso_time(total_seconds: int,
iso_time: str) -> None:
"""Use as assertion tool for comaring seconds to iso time %H:%M:%S."""
time_split = iso_time.split(':')
calc_seconds = (int(time_split[0]) * 3600
+ int(time... | code_fim | medium | {
"lang": "python",
"repo": "asafm-lb/aioswitcher",
"path": "/tests/asserters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanPopa46/neo3-boa path: /boa3_test/tests/compiler_tests/test_range.py
+ Opcode.NEWARRAY0
+ Opcode.REVERSE4
+ Opcode.SWAP
+ Opcode.JMP
+ Integer(8).to_byte_array(signed=True, min_length=1)
+ Opcode.PUSH3
+ Opcode.PICK
... | code_fim | hard | {
"lang": "python",
"repo": "DanPopa46/neo3-boa",
"path": "/boa3_test/tests/compiler_tests/test_range.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> engine = TestEngine()
result = self.run_smart_contract(engine, path, 'Main', [1, 2, 3, 4])
self.assertEqual(1, result)
result = self.run_smart_contract(engine, path, 'Main', [5, 3, 2])
self.assertEqual(5, result)
with self.assertRaises(TestExecutionExceptio... | code_fim | hard | {
"lang": "python",
"repo": "DanPopa46/neo3-boa",
"path": "/boa3_test/tests/compiler_tests/test_range.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanPopa46/neo3-boa path: /boa3_test/tests/compiler_tests/test_range.py
t_range_too_many_parameters(self):
path = self.get_contract_path('RangeTooManyParameters.py')
self.assertCompilerLogs(UnexpectedArgument, path)
def test_range_get_value(self):
expected_output = (
... | code_fim | hard | {
"lang": "python",
"repo": "DanPopa46/neo3-boa",
"path": "/boa3_test/tests/compiler_tests/test_range.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hostname:
s.removeHost(hostname,cluster_user)
item.delete()
except boto.dynamodb2.exceptions.ItemNotFound:
log.error("Did not find %s in the metadb\n" % instance... | code_fim | hard | {
"lang": "python",
"repo": "etiennebourgeois/cfncluster-node",
"path": "/sqswatcher/sqswatcher.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: etiennebourgeois/cfncluster-node path: /sqswatcher/sqswatcher.py
#!/usr/bin/env python
# Copyright 2013-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# Licen... | code_fim | hard | {
"lang": "python",
"repo": "etiennebourgeois/cfncluster-node",
"path": "/sqswatcher/sqswatcher.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @use_profile('postgres')
def test_postgres_severity_warnings_strict(self):
self.run_dbt_with_vars(['seed'], 'false', strict=False)
self.run_dbt_with_vars(['run'], 'false', strict=False)
results = self.run_dbt_with_vars(['test', '--schema'], 'false', expect_pass=False)
... | code_fim | hard | {
"lang": "python",
"repo": "better/dbt",
"path": "/test/integration/045_test_severity_tests/test_severity.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.run_dbt_with_vars(['seed'], 'false', strict=False)
self.run_dbt_with_vars(['run'], 'false', strict=False)
results = self.run_dbt_with_vars(['test', '--schema'], 'false', expect_pass=False)
self.assertEqual(len(results), 2)
self.assertTrue(results[0].fail)
... | code_fim | hard | {
"lang": "python",
"repo": "better/dbt",
"path": "/test/integration/045_test_severity_tests/test_severity.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: better/dbt path: /test/integration/045_test_severity_tests/test_severity.py
from test.integration.base import DBTIntegrationTest, use_profile
class TestSeverity(DBTIntegrationTest):
@property
def schema(self):
return "severity_045"
@property
def models(self):
ret... | code_fim | hard | {
"lang": "python",
"repo": "better/dbt",
"path": "/test/integration/045_test_severity_tests/test_severity.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/functions/reset_password.py
from ..utils import Object
class ResetPassword(Object):
"""
Removes 2-step verification password without previous password and access to recovery email address. The password can't be reset immediately and the request need... | code_fim | medium | {
"lang": "python",
"repo": "iTeam-co/pytglib",
"path": "/pytglib/api/functions/reset_password.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, extra=None, **kwargs):
self.extra = extra
pass
@staticmethod
def read(q: dict, *args) -> "ResetPassword":
return ResetPassword()<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/functions/reset_password.py
from ..utils import Obje... | code_fim | medium | {
"lang": "python",
"repo": "iTeam-co/pytglib",
"path": "/pytglib/api/functions/reset_password.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ai-adams/AVOCADO path: /vocabulary.py
import nltk
import pickle
import os.path
from collections import Counter
class Vocabulary(object):
def __init__(self,
<|fim_suffix|> def get_vocab(self):
"""Load the vocabulary from file OR build the vocabulary from scratch."""
if os.... | code_fim | hard | {
"lang": "python",
"repo": "ai-adams/AVOCADO",
"path": "/vocabulary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Load the vocabulary from file OR build the vocabulary from scratch."""
if os.path.exists(self.vocab_file) & self.vocab_from_file:
f = open(self.vocab_file, "rb")
vocab = pickle.load(f)
self.word2idx = vocab.word2idx
self.idx2word = vocab.i... | code_fim | hard | {
"lang": "python",
"repo": "ai-adams/AVOCADO",
"path": "/vocabulary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikalcallahan/NearBeach path: /templatetags/nearbeach_extras.py
import datetime, pytz
from django.utils import timezone
from django.conf import settings
from django.template import Library
register = Library()
<|fim_suffix|> """
:param value: this is the python object being passed through... | code_fim | hard | {
"lang": "python",
"repo": "mikalcallahan/NearBeach",
"path": "/templatetags/nearbeach_extras.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:param value: this is the python object being passed through
:param arg: these are the co-ordinates [column,level]
:return: the filtered python object
"""
return value.filter(kanban_level=arg)
@register.filter(name='filter_column_cards')
def filter_column_cards(value, arg):
... | code_fim | medium | {
"lang": "python",
"repo": "mikalcallahan/NearBeach",
"path": "/templatetags/nearbeach_extras.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _show_cf_matrix(self, preds, y):
classes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
cf_matrix = tf.math.confusion_matrix(y, preds).numpy()
cf_matrix_norm = np.around(cf_matrix.astype('float') / cf_matrix.sum(axis=1)[:, np.newaxis], decimals=2)
cf_matrix_d... | code_fim | hard | {
"lang": "python",
"repo": "HazardDede/machine-learning",
"path": "/ml/classification/digits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HazardDede/machine-learning path: /ml/classification/digits.py
"""Mnist digits classification tasks."""
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import tensorflow as tf
from ml import Context
from ml.repository.ar... | code_fim | hard | {
"lang": "python",
"repo": "HazardDede/machine-learning",
"path": "/ml/classification/digits.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> preds = model.predict(x_test)
self._show_cf_matrix(np.array([np.argmax(probas) for probas in preds]), y_test)
def _show_cf_matrix(self, preds, y):
classes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
cf_matrix = tf.math.confusion_matrix(y, preds).numpy()
... | code_fim | hard | {
"lang": "python",
"repo": "HazardDede/machine-learning",
"path": "/ml/classification/digits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeffvswanson/DataStructuresAndAlgorithms path: /Stanford/02_MergeSort/mergeSort.py
# mergeSort.py
# An example program of the merge sort algorithm.
def main():
# Define the example input array
A = [5, 4, 1, 8, 7, 2, 6, 3, 9]
print("The original list is", A)
A = divide_and_... | code_fim | medium | {
"lang": "python",
"repo": "jeffvswanson/DataStructuresAndAlgorithms",
"path": "/Stanford/02_MergeSort/mergeSort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = divide_and_conquer(input_list[0:len(input_list)//2])
b = divide_and_conquer(input_list[len(input_list)//2:])
sorted_list = merge_sort(a, b)
return sorted_list
def merge_sort(a, b):
sorted_list = []
sorted_list_length = len(a) + len(b)
# Initialize indexes for s... | code_fim | medium | {
"lang": "python",
"repo": "jeffvswanson/DataStructuresAndAlgorithms",
"path": "/Stanford/02_MergeSort/mergeSort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agostodev/substrate path: /app/lib/substrate/agar/django/templatetags.py
"""
The ``agar.templatetags.webapp2`` module contains `django template tags`_.
"""
from django.template import Library, Node, TemplateSyntaxError
register = Library()
class URLNode(Node):
def __init__(self, route_nam... | code_fim | hard | {
"lang": "python",
"repo": "agostodev/substrate",
"path": "/app/lib/substrate/agar/django/templatetags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class LoginURLNode(Node):
def __init__(self, login_url):
self.login_url = login_url
def render(self, context):
from google.appengine.api.users import create_login_url
return create_login_url(self.login_url)
@register.tag(name='create_login_url')
def create_login_url(pars... | code_fim | hard | {
"lang": "python",
"repo": "agostodev/substrate",
"path": "/app/lib/substrate/agar/django/templatetags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def render(self, context):
from google.appengine.api.users import create_logout_url
return create_logout_url(self.logout_url)
@register.tag(name='create_logout_url')
def create_logout_url(parser, token):
"""
Creates a Google Account logout url and callback to a route_name.
... | code_fim | hard | {
"lang": "python",
"repo": "agostodev/substrate",
"path": "/app/lib/substrate/agar/django/templatetags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='opportunity',
name='skills',
field=models.ManyToManyField(blank=True, to='person.Skill'),
),
]<|fim_prefix|># repo: sahil-punchhi/Student-Peer-Mentor-and-Professional-Network--full-stack-project pa... | code_fim | medium | {
"lang": "python",
"repo": "sahil-punchhi/Student-Peer-Mentor-and-Professional-Network--full-stack-project",
"path": "/forastudent/person/migrations/0010_opportunity_skills.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sahil-punchhi/Student-Peer-Mentor-and-Professional-Network--full-stack-project path: /forastudent/person/migrations/0010_opportunity_skills.py
# Generated by Django 3.0.8 on 2020-07-26 08:01
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('person', '0009_au... | code_fim | easy | {
"lang": "python",
"repo": "sahil-punchhi/Student-Peer-Mentor-and-Professional-Network--full-stack-project",
"path": "/forastudent/person/migrations/0010_opportunity_skills.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crixspine/PSR path: /bin/MultiProcessSimulation.py
from bin.TrainingData import TrainingData
from bin.Agent import Agent
from bin.Util import writeMemoryintodisk, readDataintoDisk, group2test
from numpy.random import choice, seed, normal
import os
import numpy as np
from bin import Parameter
max... | code_fim | hard | {
"lang": "python",
"repo": "crixspine/PSR",
"path": "/bin/MultiProcessSimulation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if tid == -1:
return THMat, HistMat
tidVector = generateRandomVector(ids=tid, ishistory=False)
hidVector = generateRandomVector(ids=hid, ishistory=True)
##############################################################
# Counting HistVectors
HistMat = HistMat + hidVector
#... | code_fim | hard | {
"lang": "python",
"repo": "crixspine/PSR",
"path": "/bin/MultiProcessSimulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if mysql:
db_test_cls_name = "{}_MySQLEnabled".format(cls_name)
db_test_cls = compatibility.MakeType(
name=db_test_cls_name,
base_classes=(RelationalDBEnabledMixin,
db_test_mixin.GlobalDatabaseTestMixin,
mysql_test.MySQLDa... | code_fim | hard | {
"lang": "python",
"repo": "Codehardt/grr",
"path": "/grr/test_lib/db_test_lib.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Codehardt/grr path: /grr/test_lib/db_test_lib.py
#!/usr/bin/env python
"""Test utilities for RELDB-related testing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import functools
import sys
import mock
from grr_response_core.l... | code_fim | hard | {
"lang": "python",
"repo": "Codehardt/grr",
"path": "/grr/test_lib/db_test_lib.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> file.write(str(self.number_of_combinations) + "\n")
file.write(str(self.set_length) + "\n")
file.write(str(self.number_of_games_of_one_player) + "\n\n")
for player in sorted(self.wins, key=self.wins.get, reverse=True):
score = self.wins[player]
game... | code_fim | hard | {
"lang": "python",
"repo": "xxdavid/dostihy",
"path": "/src/tournament.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Tournament(3, 10, [
[ThresholdStrategy(0), "Threshold0"],
[ThresholdStrategy(500), "Threshold500"],
[ThresholdStrategy(1000), "Threshold1000"],
[ThresholdStrategy(2000), "Threshold2000"],
[ThresholdStrategy(3000), "Threshold3000"],
[ThresholdStrategy(4000), "Threshold4000"],
[T... | code_fim | hard | {
"lang": "python",
"repo": "xxdavid/dostihy",
"path": "/src/tournament.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xxdavid/dostihy path: /src/tournament.py
#!/usr/bin/env python3
from game import Game
from player import Player
from strategies import ThresholdStrategy, NoCheapHorsesStrategy, ScoreStrategy
import itertools
import logger
import math
class Tournament:
"""
A tournament runner.
It run... | code_fim | hard | {
"lang": "python",
"repo": "xxdavid/dostihy",
"path": "/src/tournament.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = data_json[u'text']
log.debug(text)
self.producer.send("hashtag", data_json)
self.producer.flush()
def on_error(self, status_code):
log.error(status_code)
if status_code == 420:
return False<|fim_prefix|># repo: bikashsharmabks/flux-ml path: /twitter-stream/twitter/service.py
#... | code_fim | hard | {
"lang": "python",
"repo": "bikashsharmabks/flux-ml",
"path": "/twitter-stream/twitter/service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bikashsharmabks/flux-ml path: /twitter-stream/twitter/service.py
#external export
import tweepy
import json
from kafka import KafkaProducer
from kafka.errors import KafkaError
from kafka.client import KafkaClient
#internal imports
import framework.logger as logger
log = logger.get_module_logger... | code_fim | hard | {
"lang": "python",
"repo": "bikashsharmabks/flux-ml",
"path": "/twitter-stream/twitter/service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mixed_precision.set_global_policy('mixed_float16')
layer_multi_io_test(
Decoder,
kwargs={'pool_scales': (1, 2, 3, 6)},
input_shapes=[(2, 128, 128, 4), (2, 64, 64, 6), (2, 32, 32, 8), (2, 256, 256, 3), (2, 256, 256, 2)],
input_dtypes=['float16... | code_fim | hard | {
"lang": "python",
"repo": "templeblock/segme",
"path": "/segme/model/fba_matting/tests/test_decoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: templeblock/segme path: /segme/model/fba_matting/tests/test_decoder.py
import tensorflow as tf
from keras import keras_parameterized
from keras.mixed_precision import policy as mixed_precision
from ..decoder import Decoder
from ....testing_utils import layer_multi_io_test
<|fim_suffix|> def ... | code_fim | hard | {
"lang": "python",
"repo": "templeblock/segme",
"path": "/segme/model/fba_matting/tests/test_decoder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> layer_multi_io_test(
Decoder,
kwargs={'pool_scales': (1, 2, 3, 6)},
input_shapes=[(2, 128, 128, 4), (2, 64, 64, 6), (2, 32, 32, 8), (2, 256, 256, 3), (2, 256, 256, 2)],
input_dtypes=['float32'] * 5,
expected_output_shapes=[(None, 256, 256... | code_fim | medium | {
"lang": "python",
"repo": "templeblock/segme",
"path": "/segme/model/fba_matting/tests/test_decoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hawtre/stacki path: /common/src/stack/ludicrous-speed/ludicrous-server.py
#!/opt/stack/bin/python3
from flask import Flask, request, jsonify, send_from_directory, render_template, redirect
from urllib.request import unquote
from random import shuffle
import stack.api
import os
app = Flask(__nam... | code_fim | hard | {
"lang": "python",
"repo": "hawtre/stacki",
"path": "/common/src/stack/ludicrous-speed/ludicrous-server.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># return a directory listing
@app.route('/<path:path>/<filename>/')
def get_repodata(path, filename):
path = path.replace('//', '/')
file_location = '%s/%s' % (ROOT_DIR, path)
response_file = '%s/%s' % (file_location, filename)
items = [ f for f in os.listdir(response_file) if f[0] != '.' ]
return re... | code_fim | hard | {
"lang": "python",
"repo": "hawtre/stacki",
"path": "/common/src/stack/ludicrous-speed/ludicrous-server.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def function_word_pattern():
return next_word('the') + Pattern.word_pattern()
def notion_pattern():
return Pattern._var() + next_word('is') + lit('a') + Pattern.word_pattern()
def adjective_pattern():
return Pattern._var() + next_word('is') + next_word('calle... | code_fim | hard | {
"lang": "python",
"repo": "formalabstracts/CNL-CIC",
"path": "/python-parser/production_rules.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: formalabstracts/CNL-CIC path: /python-parser/production_rules.py
The parser output is a single token that is one of those types."""
return var_or_atomic() | next_value('_')
def hierarchical_identifier():
"""parser for hierarchical identifiers.
Parser output is a single token."""
... | code_fim | hard | {
"lang": "python",
"repo": "formalabstracts/CNL-CIC",
"path": "/python-parser/production_rules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: formalabstracts/CNL-CIC path: /python-parser/production_rules.py
t copy
import msg
import word_lists
import lib
import lexer
import parser_combinator as c
from parser_combinator import (Parse, ParseError,
first_word,
first_phrase, ne... | code_fim | hard | {
"lang": "python",
"repo": "formalabstracts/CNL-CIC",
"path": "/python-parser/production_rules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tadasant/strand-slack path: /src/models/slack/elements/SlackUser.py
import json
from copy import deepcopy
from marshmallow import Schema, fields, post_load
<|fim_suffix|> @post_load
def make_slack_user(self, data):
return SlackUser(**data)
class Meta:
strict = True<|... | code_fim | hard | {
"lang": "python",
"repo": "tadasant/strand-slack",
"path": "/src/models/slack/elements/SlackUser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = fields.String(required=True)
profile = fields.Nested(SlackProfileSchema)
@post_load
def make_slack_user(self, data):
return SlackUser(**data)
class Meta:
strict = True<|fim_prefix|># repo: tadasant/strand-slack path: /src/models/slack/elements/SlackUser.py
impor... | code_fim | medium | {
"lang": "python",
"repo": "tadasant/strand-slack",
"path": "/src/models/slack/elements/SlackUser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShabadVaswani/responsible-ai-widgets path: /raiwidgets/raiwidgets/error_analysis_constants.py
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Defines the Constant strings related to Error Analysis."""
class ErrorAnalysisDashboardInterface(object):
"""Dictionary p... | code_fim | easy | {
"lang": "python",
"repo": "ShabadVaswani/responsible-ai-widgets",
"path": "/raiwidgets/raiwidgets/error_analysis_constants.py",
"mode": "psm",
"license": "LGPL-3.0-only",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class MethodConstants(object):
REGRESSION = 'regression'
MULTICLASS = 'multiclass'
BINARY = 'binary'<|fim_prefix|># repo: ShabadVaswani/responsible-ai-widgets path: /raiwidgets/raiwidgets/error_analysis_constants.py
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""... | code_fim | hard | {
"lang": "python",
"repo": "ShabadVaswani/responsible-ai-widgets",
"path": "/raiwidgets/raiwidgets/error_analysis_constants.py",
"mode": "spm",
"license": "LGPL-3.0-only",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_cache(self):
cache_dir = 'test_cache'
if os.path.exists(cache_dir):
shutil.rmtree(cache_dir)
foo = asn1tools.compile_files('tests/files/foo.asn',
cache_dir=cache_dir)
foo_cached = asn1tools.compile_files('test... | code_fim | hard | {
"lang": "python",
"repo": "eerimoq/asn1tools",
"path": "/tests/test_compile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eerimoq/asn1tools path: /tests/test_compile.py
import sys
import unittest
import asn1tools
from copy import deepcopy
import shutil
import os
sys.path.append('tests/files')
sys.path.append('tests/files/ietf')
sys.path.append('tests/files/3gpp')
from extensibility_implied import EXPECTED as EXTEN... | code_fim | hard | {
"lang": "python",
"repo": "eerimoq/asn1tools",
"path": "/tests/test_compile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimactor/Open3D-ML path: /ml3d/tf/dataloaders/tf_dataloader.py
from abc import abstractmethod
from tqdm import tqdm
from os.path import exists, join, isfile, dirname, abspath, split
from pathlib import Path
import random
import tensorflow as tf
import numpy as np
from ...utils import Cache, get_... | code_fim | hard | {
"lang": "python",
"repo": "kimactor/Open3D-ML",
"path": "/ml3d/tf/dataloaders/tf_dataloader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_loader(self, batch_size=1, num_threads=3):
"""
Construct the origianl tensorflow dataloader.
Args:
batch_size: batch size.
num_threads: number of threads for data loading.
kwargs:
Returns:
the tensorflow dataloade... | code_fim | hard | {
"lang": "python",
"repo": "kimactor/Open3D-ML",
"path": "/ml3d/tf/dataloaders/tf_dataloader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_dict = my_dict.copy()
new_dict["username"] = "XXXXX"
new_dict["password"] = "XXXXX"
return new_dict<|fim_prefix|># repo: andy12838729/tb-houston-service path: /tb_houston_service/tools.py
import json
from datetime import datetime
class ModelTools:
@staticmethod
... | code_fim | medium | {
"lang": "python",
"repo": "andy12838729/tb-houston-service",
"path": "/tb_houston_service/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andy12838729/tb-houston-service path: /tb_houston_service/tools.py
import json
from datetime import datetime
class ModelTools:
@staticmethod
def get_utc_epoch():
return datetime.utcnow().strftime("%s")
@staticmethod
def get_utc_timestamp():
return datetime.utcno... | code_fim | medium | {
"lang": "python",
"repo": "andy12838729/tb-houston-service",
"path": "/tb_houston_service/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def json_dump(obj):
# return json.dumps(obj, indent=2, sort_keys=True)
return json.dumps(obj)
# simple redact function, used prior to logging
@staticmethod
def redact_dict(my_dict):
new_dict = my_dict.copy()
new_dict["username"] = "XXXXX"
... | code_fim | hard | {
"lang": "python",
"repo": "andy12838729/tb-houston-service",
"path": "/tb_houston_service/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zmatlik117/CTU-FEE path: /semestr_01/IAP/odeint_harmonic_03.py
"""
Example s numerickym resenim harmonicke funkce - tentokrat s buzenim
"""
from matplotlib import pyplot as plt
import numpy as np
from scipy.integrate import odeint
# konstanty rovnice
damp = 5
# docela zajimavy vysledky dava nad... | code_fim | hard | {
"lang": "python",
"repo": "zmatlik117/CTU-FEE",
"path": "/semestr_01/IAP/odeint_harmonic_03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># U0[0] = pocatecni poloha
# U0[1] = pocatecni rychlost
U0 = [0, 0]
xs = np.linspace(0, 2, 200000)
# co je extra sympaticky - nemusim resit iterovani - staci do toho nacpat casovou osu!!
# Takze pokud uz ji nekde mam pouzitou nemusim pocitat krok metody tak aby mi to sedelo
Us = odeint(dU_dx, U0, xs)
ys =... | code_fim | hard | {
"lang": "python",
"repo": "zmatlik117/CTU-FEE",
"path": "/semestr_01/IAP/odeint_harmonic_03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ehmatthes/legs_of_steel path: /point_puller.py
lats = []
lons = []
filename="tracks.gpx"
import re
lat_pattern = '.*lat="(\d\d\.\d\d\d\d\d).*'
lon_pattern = '.*lon="(-\d\d\d\.\d\d\d\d\d).*'
<|fim_suffix|> matchObj = re.match(lon_pattern, line)
if matchObj:
#print(mat... | code_fim | hard | {
"lang": "python",
"repo": "ehmatthes/legs_of_steel",
"path": "/point_puller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> matchObj = re.match(lon_pattern, line)
if matchObj:
#print(matchObj.group(1))
lon = float(matchObj.group(1))
lons.append(lon)
#print(lats)
#print(lons)
print(len(lats), len(lons))<|fim_prefix|># repo: ehmatthes/legs_of_steel path: /point_pull... | code_fim | hard | {
"lang": "python",
"repo": "ehmatthes/legs_of_steel",
"path": "/point_puller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sut = FileMap()
assert 1 == sut.file_id('a.py')
assert 2 == sut.file_id('b.py')
assert 3 == sut.file_id('c.py')
assert 1 == sut.file_id('a.py')
assert 2 == sut.file_id('b.py')
assert 3 == sut.file_id('c.py')
def test_a():
from pycrunch_trace.client.networking.client_trace_... | code_fim | medium | {
"lang": "python",
"repo": "lixinli123/pycrunch-trace",
"path": "/pycrunch_trace/tracing/tests/test_file_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.