text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> set_step(0,1,0,1,delay)
def step_4(delay):
set_step(1,0,0,1,delay)
def set_step(a1,a2,b1,b2,delay):
GPIO.output(input1,a1)
GPIO.output(input2,a2)
GPIO.output(input3,b1)
GPIO.output(input4,b2)
time.sleep(delay)
if __name__ == "__main__":
main... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Raspberry-Pi-Zero-Cookbook",
"path": "/Chapter07/movestepper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joecai6/lib-search path: /parse/gen_authorfiles.py
"""
The file groups the dataframe by the first letter of the author's last name.
This functionality is for querying excel sheets were the author is on the row.
Since the program querys by author, I grouped the dataframe so that it ... | code_fim | medium | {
"lang": "python",
"repo": "joecai6/lib-search",
"path": "/parse/gen_authorfiles.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("Grouping files by author...")
list_author = []
print("Rows ", len(df))
# Sets all author values as string and capitalizes the first letter
df['Author'] = df['Author'].astype(str)
df['Author'] = df['Author'].apply(lambda name: name[0].upper() + name[1:])
df ... | code_fim | medium | {
"lang": "python",
"repo": "joecai6/lib-search",
"path": "/parse/gen_authorfiles.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bystroushaak/normalize_cz_unicode path: /tests/test_normalize.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from __future__ import unicode_literals
from normalize_cz_unicode ... | code_fim | medium | {
"lang": "python",
"repo": "Bystroushaak/normalize_cz_unicode",
"path": "/tests/test_normalize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # unbreakable and small space
assert normalize(" ") == " "
assert normalize(" ") == " "
def test_strange_dashes():
assert normalize("spojovník — a ― další") == "spojovník - a - další"<|fim_prefix|># repo: Bystroushaak/normalize_cz_unicode path: /tests/test_normalize.py
#! /usr/bin/env p... | code_fim | medium | {
"lang": "python",
"repo": "Bystroushaak/normalize_cz_unicode",
"path": "/tests/test_normalize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kura-Lee/meiduo-mall path: /meiduo_mall/utils/FastDFS/test.py
# fsastdfs测试
from fdfs_client.client import Fdfs<|fim_suffix|>us/Pictures/Saved Pictures/wallhaven-dp3yg3.jpg")<|fim_middle|>_client
client = Fdfs_client('utils/FastDFS/client.conf')
client.upload_by_filename(r"/mnt/d/as | code_fim | medium | {
"lang": "python",
"repo": "kura-Lee/meiduo-mall",
"path": "/meiduo_mall/utils/FastDFS/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt.conf')
client.upload_by_filename(r"/mnt/d/asus/Pictures/Saved Pictures/wallhaven-dp3yg3.jpg")<|fim_prefix|># repo: kura-Lee/meiduo-mall path: /meiduo_mall/utils/FastDFS/test.py
# fsastdfs测试
from fdfs_client.client import Fdfs<|fim_middle|>_client
client = Fdfs_client('utils/FastDFS/clie | code_fim | easy | {
"lang": "python",
"repo": "kura-Lee/meiduo-mall",
"path": "/meiduo_mall/utils/FastDFS/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>us/Pictures/Saved Pictures/wallhaven-dp3yg3.jpg")<|fim_prefix|># repo: kura-Lee/meiduo-mall path: /meiduo_mall/utils/FastDFS/test.py
# fsastdfs测试
from fdfs_client.client import Fdfs_client
client = Fdfs_client('utils/FastDFS/clie<|fim_middle|>nt.conf')
client.upload_by_filename(r"/mnt/d/as | code_fim | easy | {
"lang": "python",
"repo": "kura-Lee/meiduo-mall",
"path": "/meiduo_mall/utils/FastDFS/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Transformer(tf.keras.layers.Layer):
"""A multi-layer Transformer."""
def __init__(
self,
autoregressive: bool,
max_len: int,
n_layers: int,
d_model: int,
n_heads: int,
d_feedforward: int,
):
super().__init__()
self... | code_fim | hard | {
"lang": "python",
"repo": "salu133445/arranger",
"path": "/arranger/transformer/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: salu133445/arranger path: /arranger/transformer/model.py
"""Transformer model."""
import numpy as np
import tensorflow as tf
# pylint:disable=arguments-differ
def get_angles(pos, i, d_model):
"""Copied from https://www.tensorflow.org/tutorials/text/transformer ."""
angle_rates = 1 / np... | code_fim | hard | {
"lang": "python",
"repo": "salu133445/arranger",
"path": "/arranger/transformer/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdd36/350-tools-mk2 path: /tools350/assembler/instruction/InstructionType.py
BASE_JSON_PATH = '/home/mdd36/tools350/tools350/assembler/base_jsn'
BASE_JSON_LOCAL = '/Users/matthew/Documents/SchoolWork/TA/ECE350/2019s/350_tools_mk2/tools350/assembler/base_jsn'
<|fim_suffix|>
def __init__(self,... | code_fim | medium | {
"lang": "python",
"repo": "mdd36/350-tools-mk2",
"path": "/tools350/assembler/instruction/InstructionType.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> NOP = {"opcode": 5, "rd": 5, "rs": 5, "rt": 5, "shamt": 5, "aluop": 5, "zeroes": 2}
ERROR = {"err": 32}<|fim_prefix|># repo: mdd36/350-tools-mk2 path: /tools350/assembler/instruction/InstructionType.py
BASE_JSON_PATH = '/home/mdd36/tools350/tools350/assembler/base_jsn'
BASE_JSON_LOCAL = '/Users/m... | code_fim | hard | {
"lang": "python",
"repo": "mdd36/350-tools-mk2",
"path": "/tools350/assembler/instruction/InstructionType.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return instr in self._instruction_types["branches"]
NOP = {"opcode": 5, "rd": 5, "rs": 5, "rt": 5, "shamt": 5, "aluop": 5, "zeroes": 2}
ERROR = {"err": 32}<|fim_prefix|># repo: mdd36/350-tools-mk2 path: /tools350/assembler/instruction/InstructionType.py
BASE_JSON_PATH = '/home/mdd36/tool... | code_fim | medium | {
"lang": "python",
"repo": "mdd36/350-tools-mk2",
"path": "/tools350/assembler/instruction/InstructionType.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _error(msg, **kwargs):
print >> sys.stderr, "ERROR: {0}!".format(msg)
if "panic" in kwargs:
sys.exit(1)
_msg = {
INFO: _info,
WARNING: _warning,
ERROR: _error,
}
def cli_msg(level, msg, **kwargs):
"""
Print CLI message.
:param level:
:param msg:
:r... | code_fim | medium | {
"lang": "python",
"repo": "SUSE/infaketure",
"path": "/src/infaketure/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SUSE/infaketure path: /src/infaketure/__init__.py
import sys
INFO = 0
WARNING = 1
ERROR = 2
def _info(msg, **kwargs):
print >> sys.stdout, "INFO:", msg
def _warning(msg, **kwargs):
print >> sys.stderr, "WARNING:", msg
<|fim_suffix|> print >> sys.stderr, "ERROR: {0}!".format(msg... | code_fim | medium | {
"lang": "python",
"repo": "SUSE/infaketure",
"path": "/src/infaketure/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdkx/sewer path: /sewer/auth.py
from .lib import create_logger
from typing import Any, Dict, Sequence, Tuple, Union
ErrataItemType = Tuple[str, str, Dict[str, str]]
class ProviderBase:
"""
New-model driver documentation is in docs/UnifiedProvider.md
"""
def __init__(self, **kw... | code_fim | hard | {
"lang": "python",
"repo": "jdkx/sewer",
"path": "/sewer/auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if "chal_types" not in kwargs:
kwargs["chal_types"] = ["http-01"]
super().__init__(**kwargs)
class DNSProviderBase(ProviderBase):
"""
Base class for new-model DNS drivers - legacy drivers use the one in common.py
This is a placeholder for now, implementing only t... | code_fim | hard | {
"lang": "python",
"repo": "jdkx/sewer",
"path": "/sewer/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DNSProviderBase(ProviderBase):
"""
Base class for new-model DNS drivers - legacy drivers use the one in common.py
This is a placeholder for now, implementing only the initialization where it
captures the upcoming alias parameter. Implementation details for alias are TBD.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "jdkx/sewer",
"path": "/sewer/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manyanxingchen/news path: /new/modules/admin/__init__.py
#1,导入烂熟扩展
from flask import Blueprint, request, session, redirect
#2.创建揽入对象
admin_blue = Blueprint('admin',__name__,url_prefix='/admin1')
#3.导入views装饰视图函数
from . import views
<|fim_suffix|>#5.捕获admin1装饰的路路径添加请求钩子
@admin_blue.before_reques... | code_fim | medium | {
"lang": "python",
"repo": "manyanxingchen/news",
"path": "/new/modules/admin/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#5.捕获admin1装饰的路路径添加请求钩子
@admin_blue.before_request
def before_request():
"""
if request.url.endswith('/admin1/login'):
pass
else:
if session.get('is_admin'):
pass
else:
return redirect('/')
"""
if not request.url.endswith('/admin1/login')... | code_fim | medium | {
"lang": "python",
"repo": "manyanxingchen/news",
"path": "/new/modules/admin/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Initialize a fresh, new post/page file. """
buildingfor = "posts"
if (page):
buildingfor = "pages"
def _remove_temporary_entries(entries):
result = {}
for key, value in processed_entries.items():
if (not "_" in key):
result[key] = v... | code_fim | hard | {
"lang": "python",
"repo": "hlef/juliet",
"path": "/juliet/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return result
def _get_new_entry_path(args, user_config, processed_entries, page=False):
""" Return path for the new entry. Built with the post/page naming pattern
and passed arguments. """
entry_filename = ""
if (not page):
if (args.file_name):
entry_filename... | code_fim | hard | {
"lang": "python",
"repo": "hlef/juliet",
"path": "/juliet/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hlef/juliet path: /juliet/__init__.py
import shutil, zipfile, argparse, yaml, logging, os, slugify, datetime, dateutil.parser, sys
from juliet import configurator, loader, paths, defaults, version
from juliet.builder import Builder
from pkg_resources import resource_filename
from string import Te... | code_fim | hard | {
"lang": "python",
"repo": "hlef/juliet",
"path": "/juliet/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for app_name in app_settings.FOLLOWED_APPS:
nb_app_messages = 0
for message in data["messages"]:
if message["location"]["path"].startswith(app_name):
nb_app_messages += 1
models.Prospector.objects.create(
nb_m... | code_fim | hard | {
"lang": "python",
"repo": "bsvetchine/django-soundcheck",
"path": "/soundcheck/instruments/prospector/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bsvetchine/django-soundcheck path: /soundcheck/instruments/prospector/tools.py
import json
import subprocess
from django.utils import timezone
from . import settings
from ... import models
from ... import app_settings
class ProspectorDataRetriever(object):
<|fim_suffix|> models.Pr... | code_fim | hard | {
"lang": "python",
"repo": "bsvetchine/django-soundcheck",
"path": "/soundcheck/instruments/prospector/tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
load data from a json file
'''
f = open(filename, 'r', encoding="utf-8")
return json.load(f)
x='25000.0-(1500.0*8.0)=money'
res=re.match(r'([a-zA-Z]+)',x)
datas=read_json_data('dataset/mawps-single/mawps_source.json')
new_datas=[]
for data in datas:
if len(data['lEquations'])... | code_fim | medium | {
"lang": "python",
"repo": "TalhaAbid/MWPToolkit",
"path": "/dataset/mawps-single/get_single.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TalhaAbid/MWPToolkit path: /dataset/mawps-single/get_single.py
import re
import json
def write_json_data(data, filename):
"""
write data to a json file
"""
with open(filename, 'w+', encoding='utf-8') as f:
json.dump(data, f, indent=4, ensure_ascii=False)
f.close()
<... | code_fim | medium | {
"lang": "python",
"repo": "TalhaAbid/MWPToolkit",
"path": "/dataset/mawps-single/get_single.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x='25000.0-(1500.0*8.0)=money'
res=re.match(r'([a-zA-Z]+)',x)
datas=read_json_data('dataset/mawps-single/mawps_source.json')
new_datas=[]
for data in datas:
if len(data['lEquations']) != 1:
print('**',data['lEquations'])
continue
data['lEquations'][0]=''.join(data['lEquations'][0]... | code_fim | medium | {
"lang": "python",
"repo": "TalhaAbid/MWPToolkit",
"path": "/dataset/mawps-single/get_single.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/event_handler', methods=['GET', 'POST', 'HEAD', 'OPTIONS'])
def event_handler_wrapper():
return event_handler(request)
@app.route('/event_collector', methods=['GET', 'POST', 'HEAD', 'OPTIONS'])
def event_collector_wrapper():
return event_collector(request)
if __name__ == '__main__... | code_fim | easy | {
"lang": "python",
"repo": "DrMatters/cloud-video-reidentification-background-subtraction",
"path": "/cloud_reid_functions/http.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/event_collector', methods=['GET', 'POST', 'HEAD', 'OPTIONS'])
def event_collector_wrapper():
return event_collector(request)
if __name__ == '__main__':
app.run()<|fim_prefix|># repo: DrMatters/cloud-video-reidentification-background-subtraction path: /cloud_reid_functions/http.py
... | code_fim | medium | {
"lang": "python",
"repo": "DrMatters/cloud-video-reidentification-background-subtraction",
"path": "/cloud_reid_functions/http.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DrMatters/cloud-video-reidentification-background-subtraction path: /cloud_reid_functions/http.py
from flask import request, Flask
from event_collector.main import event_collector
from event_handler.main import event_handler
app = Flask(__name__)
@app.route('/event_handler', methods=['GET', 'P... | code_fim | medium | {
"lang": "python",
"repo": "DrMatters/cloud-video-reidentification-background-subtraction",
"path": "/cloud_reid_functions/http.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kif/freesas path: /freesas/test/test_cormap.py
#!/usr/bin/python
# coding: utf-8
from __future__ import print_function
__author__ = "Jerome"
__license__ = "MIT"
__copyright__ = "2017, ESRF"
import numpy
import unittest
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.get... | code_fim | hard | {
"lang": "python",
"repo": "kif/freesas",
"path": "/freesas/test/test_cormap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertAlmostEqual(cormap.LROH(200, 0), 1)
self.assertAlmostEqual(cormap.LROH(200, 4), 0.97, 2)
self.assertAlmostEqual(cormap.LROH(200, 5), 0.80, 2)
self.assertAlmostEqual(cormap.LROH(200, 6), 0.54, 2)
self.assertAlmostEqual(cormap.LROH(200, 7), 0.32, 2)
... | code_fim | hard | {
"lang": "python",
"repo": "kif/freesas",
"path": "/freesas/test/test_cormap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tfm2 = tbFullMappingTool()
tfm2_files, tfm2_meta = tfm2.run(files, [], metadata) # pylint: disable=unused-variable
map_frag = resource_path + "tb.Human.SRR1658573_2_frag.map"
map_full = resource_path + "tb.Human.SRR1658573_2_full.map"
assert os.path.isfile(map_frag) is True
asse... | code_fim | hard | {
"lang": "python",
"repo": "Multiscale-Genomics/mg-process-fastq",
"path": "/tests/test_tb_full_mapping.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(input_files, output_files)
gem_it = gemIndexerTool({"execution": resource_path})
gem_it.run(input_files, metadata, output_files)
@pytest.mark.hic
def test_tb_extract_fastq():
"""
Extract the compressed FASTQ files
"""
resource_path = os.path.join(os.path.dirname(__file... | code_fim | hard | {
"lang": "python",
"repo": "Multiscale-Genomics/mg-process-fastq",
"path": "/tests/test_tb_full_mapping.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Multiscale-Genomics/mg-process-fastq path: /tests/test_tb_full_mapping.py
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in c... | code_fim | hard | {
"lang": "python",
"repo": "Multiscale-Genomics/mg-process-fastq",
"path": "/tests/test_tb_full_mapping.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steinelu/PythonWebCrawler path: /crwlr.py
# -*- coding: utf-8 -*-
"""
Created on Mon May 29 21:05:49 2017
@author: Lukas
"""
from prsr import Prsr
from data import Data
import urllib2, sys, signal
<|fim_suffix|>if __name__ == "__main__":
c = Crwlr()
c.data.pos[0] = (0, "http... | code_fim | hard | {
"lang": "python",
"repo": "steinelu/PythonWebCrawler",
"path": "/crwlr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.data = Data()
self.prsr = Prsr(self.data)
def loop(self):
while True:
self.next()
self.prsr.reset()
#break
def next(self):
link = self.data.nextLink()
print link
try... | code_fim | medium | {
"lang": "python",
"repo": "steinelu/PythonWebCrawler",
"path": "/crwlr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(input_path):
raise IOError("Could not find File: ", input_path)
else:
table = []
data = self._raw_read_trajectory(input_path=input_path, stride=stride, skip=skip)
header = data["header"]
body = data["body"]
... | code_fim | hard | {
"lang": "python",
"repo": "rinikerlab/PyGromosTools",
"path": "/pygromos/files/trajectory/_general_trajectory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.add_traj(traj)
def __copy__(self):
traj = type(self)(input_value=None)
for attr in vars(self):
setattr(traj, attr, getattr(self, attr))
traj.database = self.database.copy(deep=False)
return traj
def __deepcopy__(self, memo):
... | code_fim | hard | {
"lang": "python",
"repo": "rinikerlab/PyGromosTools",
"path": "/pygromos/files/trajectory/_general_trajectory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rinikerlab/PyGromosTools path: /pygromos/files/trajectory/_general_trajectory.py
"""
FUNCTIONLIB: trajectory template with pandas
Description:
in this parent class for all trajectories the general parsing to a pandas database is handeled.
This class is intended as quick data ev... | code_fim | hard | {
"lang": "python",
"repo": "rinikerlab/PyGromosTools",
"path": "/pygromos/files/trajectory/_general_trajectory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("--weight_db_path",
help="name of weight db in data folder",
default="data/dbs/TW_Brain-Anteriorcingulatecortex-BA24_0.5.db")
parser.add_argument("--covariance",
help="name of folder containing covariance ... | code_fim | hard | {
"lang": "python",
"repo": "hakyimlab/MetaXcan-Postprocess",
"path": "/source/deprecated/GeneForensics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hakyimlab/MetaXcan-Postprocess path: /source/deprecated/GeneForensics.py
#! /usr/bin/env python
__author__ = 'heroico'
########################################################################################################################
# Gathers some figures that go into MEtaXcan's calculati... | code_fim | hard | {
"lang": "python",
"repo": "hakyimlab/MetaXcan-Postprocess",
"path": "/source/deprecated/GeneForensics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: berleon/rgkit path: /test/valid_test.py
import ast
import pkg_resources
import unittest
from rgkit.settings import settings
from rgkit.gamestate import GameState
map_data = ast.literal_eval(
open(pkg_resources.resource_filename('rgkit', 'maps/default.py')).read())
settings.init_map(map_data... | code_fim | hard | {
"lang": "python",
"repo": "berleon/rgkit",
"path": "/test/valid_test.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_move_to_obstacle(self):
state = GameState()
state.add_robot((2, 5), 0)
self.assertFalse(state.is_valid_action((2, 5), ['move', (2, 4)]))
def test_attack_self(self):
state = GameState()
state.add_robot((9, 9), 0)
self.assertFalse(state.is_va... | code_fim | hard | {
"lang": "python",
"repo": "berleon/rgkit",
"path": "/test/valid_test.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarketSquare/robotframework-requests path: /src/RequestsLibrary/compat.py
import copy
import sys
from requests.packages.urllib3.util import Retry
PY3 = sys.version_info > (3,)
if PY3:
import http.client as httplib # noqa
from urllib.parse import urlencode # noqa
from urllib.parse ... | code_fim | hard | {
"lang": "python",
"repo": "MarketSquare/robotframework-requests",
"path": "/src/RequestsLibrary/compat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
super(RetryAdapter, self).__init__(**kwargs)
# FIXME more specific except
except TypeError:
value = kwargs.pop('allowed_methods', None)
kwargs['method_whitelist'] = value
super(RetryAdapter, self).__init__(**kwargs)<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "MarketSquare/robotframework-requests",
"path": "/src/RequestsLibrary/compat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: systems-explained/geb-simulations path: /models/system_model_v3/model/parts/moneymarket_agents.py
import math
import numpy as np
import time
import logging
import pandas as pd
import statistics
from decimal import *
from .utils import approx_greater_equal_zero, assert_log, approx_eq
from .debt_... | code_fim | hard | {
"lang": "python",
"repo": "systems-explained/geb-simulations",
"path": "/models/system_model_v3/model/parts/moneymarket_agents.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> update = moneyMarketStateChange(params, state, state['rai_lender_state'], share, state['rai_lender_max_balance'])
update['rai_lender_state'] = update['state']
return {**update}
def s_store_rai_lender_state(params, substep, state_history, state, policy_input):
return 'rai_lender_state', po... | code_fim | hard | {
"lang": "python",
"repo": "systems-explained/geb-simulations",
"path": "/models/system_model_v3/model/parts/moneymarket_agents.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>having_1 = [
{
'condition': 'id = 1',
'expected': {
'cond_str': ' HAVING id = 1',
'cond_args': [],
}
},
{
'condition': ('id', 1),
'expected': {
'cond_str': ' HAVING (id = %s)',
'cond_args': [1],
}
... | code_fim | hard | {
"lang": "python",
"repo": "xkuga/sqlrocks",
"path": "/test_data/sql.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xkuga/sqlrocks path: /test_data/sql.py
d': {
'cond_str': 'name NOT IN (%s,%s)',
'cond_arg': ('Jay Chou', 'Mayday'),
},
},
{
'cond': ('name', '=', Sql('(subquery)', [5])),
'expected': {
'cond_str': 'name = (subquery)',
... | code_fim | hard | {
"lang": "python",
"repo": "xkuga/sqlrocks",
"path": "/test_data/sql.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>alias = [
{
'name': 'foo',
'expected': ' AS `foo`',
},
]
as_subquery = [
{
'alias': 'foo',
'expected': '() AS `foo`',
},
]
chain = [
{
'methods': [
{
'name': 'select',
'args': ['*'],
},
... | code_fim | hard | {
"lang": "python",
"repo": "xkuga/sqlrocks",
"path": "/test_data/sql.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def init(self):
self.add_model_property('meta', MetaModel)
self.add_model_property('header', HeaderModel)
self.add_array_property('content')
self.add_model_property('footer', FooterModel)<|fim_prefix|># repo: nhardy/py-js-web-scaffold path: /src/api/models/page.py
from .base import Base... | code_fim | easy | {
"lang": "python",
"repo": "nhardy/py-js-web-scaffold",
"path": "/src/api/models/page.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nhardy/py-js-web-scaffold path: /src/api/models/page.py
from .base import BaseModel
from .meta import MetaModel
from .header import HeaderModel
from .footer import FooterModel
<|fim_suffix|> self.add_model_property('meta', MetaModel)
self.add_model_property('header', HeaderModel)
self... | code_fim | easy | {
"lang": "python",
"repo": "nhardy/py-js-web-scaffold",
"path": "/src/api/models/page.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.add_model_property('meta', MetaModel)
self.add_model_property('header', HeaderModel)
self.add_array_property('content')
self.add_model_property('footer', FooterModel)<|fim_prefix|># repo: nhardy/py-js-web-scaffold path: /src/api/models/page.py
from .base import BaseModel
from .meta i... | code_fim | easy | {
"lang": "python",
"repo": "nhardy/py-js-web-scaffold",
"path": "/src/api/models/page.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>, os.path.join(til_dirpath, modulename + ".til"))
#til_fp = modulename + ".til"
#shutil.copy(til_fp, til_fp[:-4]+".exported.til")
idc.Exit(0)<|fim_prefix|># repo: ZIllR0/Driver-Security-Analyzer path: /batch/exportTil.py
# Copyright (C) 2020 Alibaba Group Holding Limited
import idaapi
import idc
import ... | code_fim | hard | {
"lang": "python",
"repo": "ZIllR0/Driver-Security-Analyzer",
"path": "/batch/exportTil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>l_dirpath):
os.makedirs(til_dirpath)
self_til = idaapi.get_idati()
ida_typeinf.compact_til(self_til)
ida_typeinf.store_til(self_til, None, os.path.join(til_dirpath, modulename + ".til"))
#til_fp = modulename + ".til"
#shutil.copy(til_fp, til_fp[:-4]+".exported.til")
idc.Exit(0)<|fim_prefix|># repo: ZI... | code_fim | medium | {
"lang": "python",
"repo": "ZIllR0/Driver-Security-Analyzer",
"path": "/batch/exportTil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZIllR0/Driver-Security-Analyzer path: /batch/exportTil.py
# Copyright (C) 2020 Alibaba Group Holding Limited
import idaapi
import idc
import shutil
import os
idb_fp = idc.get_idb_path()
modulename <|fim_suffix|>l_dirpath):
os.makedirs(til_dirpath)
self_til = idaapi.get_idati()
ida_typeinf.c... | code_fim | medium | {
"lang": "python",
"repo": "ZIllR0/Driver-Security-Analyzer",
"path": "/batch/exportTil.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from ifg.calculator import _make_mesh
# GIVEN: simple (non-theta) volumes and temperatures
volumes = [1.0, 2.0]
temperatures = [10.0, 20.0, 30.0]
# WHEN: mesh grid is created
vv, tt = _make_mesh(volumes, temperatures)
# THEN: correct simple mesh is created
npt.assert_allcl... | code_fim | hard | {
"lang": "python",
"repo": "alekseik1/ifg-py",
"path": "/tests/unit/test_theta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alekseik1/ifg-py path: /tests/unit/test_theta.py
import numpy as np
import pytest
from numpy import testing as npt
from ifg.calculator import IfgCalculator
from ifg.units_converter import convert_theta_to_temperature
COMPLICATED_MESH = (
[3.0, 5.0],
[5.0, 10.0, 15.0],
np.array(
... | code_fim | hard | {
"lang": "python",
"repo": "alekseik1/ifg-py",
"path": "/tests/unit/test_theta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # GIVEN: freshly created IfgCalculator()
# WHEN: `with_theta` is called before volume input
# THEN: exception is raised
with pytest.raises(ValueError) as e:
IfgCalculator().with_theta([1.0, 2.0])
assert e.match(
"specific volume should be defined before using th... | code_fim | hard | {
"lang": "python",
"repo": "alekseik1/ifg-py",
"path": "/tests/unit/test_theta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ScSteffen/neuralEntropyComparison path: /ext/steffensCode/ext/sphericalquadpy/ldfeLinDisc/ldfe.py
from time import time
from numpy import sqrt, linspace, array, ones, \
zeros, eye, transpose
from numpy.linalg import solve, norm
from numpy.random import rand
from scipy.integrate import dblqua... | code_fim | hard | {
"lang": "python",
"repo": "ScSteffen/neuralEntropyComparison",
"path": "/ext/steffensCode/ext/sphericalquadpy/ldfeLinDisc/ldfe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # initial position of each quadpoint is at the center
# of the edge connecting the midpoint and a corner point
rhos = 0.5 * ones(4)
a = 1 / sqrt(3)
deltarhos = 0.25 * ones(4) # delta for finite differences
while True: # while method has not converged
# print("###########... | code_fim | hard | {
"lang": "python",
"repo": "ScSteffen/neuralEntropyComparison",
"path": "/ext/steffensCode/ext/sphericalquadpy/ldfeLinDisc/ldfe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def omega1(rho): return rho * array([x1, a, z0]) + (1 - rho) * mid
def omega2(rho): return rho * array([x0, a, z0]) + (1 - rho) * mid
def omega3(rho): return rho * array([x0, a, z1]) + (1 - rho) * mid
return [omega0, omega1, omega2, omega3]
# @jit
def computeareas(omegas, x0, x1, z0,... | code_fim | hard | {
"lang": "python",
"repo": "ScSteffen/neuralEntropyComparison",
"path": "/ext/steffensCode/ext/sphericalquadpy/ldfeLinDisc/ldfe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Represent primary attribute of the radist node.
Attributs:
* server
* dir,
* [temp]
"""
def __init__(self, value):
triplet = value.split(':')
assert len(triplet) in [2, 3]
self.server, self.dir = [x.strip() for x in triplet[0:2]]
if len(tr... | code_fim | hard | {
"lang": "python",
"repo": "pharmacolog/radist",
"path": "/radist/attrs.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pharmacolog/radist path: /radist/attrs.py
import errors
find_map = {'server': 'primary.server',
'dir': 'primary.dir',
'space': 'spacelimit.limit',
'spacelimit': 'spacelimit.limit',
'name': 'name',
'tmp': 'primary.temp',
... | code_fim | hard | {
"lang": "python",
"repo": "pharmacolog/radist",
"path": "/radist/attrs.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_radist_value(line):
"""Returns instance of class, which represents value of radist node."""
assert line.startswith(' ')
key, value = line.split('=')
key = key.strip()
return key, attr_map[key](value)<|fim_prefix|># repo: pharmacolog/radist path: /radist/attrs.py
import errors... | code_fim | hard | {
"lang": "python",
"repo": "pharmacolog/radist",
"path": "/radist/attrs.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BDALab/handwriting-features path: /src/handwriting_features/data/utils/iteration.py
from itertools import islice
from collections import deque
def sliding_window(iterable, size, step, padding=None):
<|fim_suffix|> # Prepare the queue
i = iter(iterable)
q = deque(islice(i, size), maxl... | code_fim | hard | {
"lang": "python",
"repo": "BDALab/handwriting-features",
"path": "/src/handwriting_features/data/utils/iteration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Apply the window
q.extend(padding for _ in range(size - len(q)))
while True:
yield iter(q)
try:
q.append(next(i))
except StopIteration:
return
q.extend(next(i, padding) for _ in range(step - 1))<|fim_prefix|># repo: BDALab/handwriting-f... | code_fim | hard | {
"lang": "python",
"repo": "BDALab/handwriting-features",
"path": "/src/handwriting_features/data/utils/iteration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Prepare the queue
i = iter(iterable)
q = deque(islice(i, size), maxlen=size)
if not q:
return
# Apply the window
q.extend(padding for _ in range(size - len(q)))
while True:
yield iter(q)
try:
q.append(next(i))
except StopIteration:... | code_fim | hard | {
"lang": "python",
"repo": "BDALab/handwriting-features",
"path": "/src/handwriting_features/data/utils/iteration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tso/avalon path: /app/avalon.py
from enum import Enum as PyEnum
from enum import auto
from random import shuffle
from enumfields import Enum
class Role(Enum):
# Good
VANILLA_GOOD = 'vanilla_good'
MERLIN = 'merlin'
PERCIVAL = 'percival'
# Bad
VANILLA_BAD = 'vanilla_bad'
... | code_fim | hard | {
"lang": "python",
"repo": "tso/avalon",
"path": "/app/avalon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gen_default(n):
if n == 5:
# 3 good 2 bad
return [Role.MERLIN, Role.PERCIVAL, Role.VANILLA_GOOD, Role.MORGANA, Role.ASSASSIN]
if n == 6:
# 4 good 2 bad
return gen_default(5) + [Role.VANILLA_GOOD]
if n == 7:
# 4 good 3 bad
return gen_default(6... | code_fim | hard | {
"lang": "python",
"repo": "tso/avalon",
"path": "/app/avalon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HSIYJND/mangadap path: /mangadap/tests/test_spatiallybinnedspectradef.py
import pytest
from mangadap.proc.spatiallybinnedspectra import available_spatial_binning_methods
<|fim_suffix|> methods_list = available_spatial_binning_methods()
assert len(methods_list) > 0, 'No binning methods a... | code_fim | easy | {
"lang": "python",
"repo": "HSIYJND/mangadap",
"path": "/mangadap/tests/test_spatiallybinnedspectradef.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> methods_list = available_spatial_binning_methods()
assert len(methods_list) > 0, 'No binning methods available'<|fim_prefix|># repo: HSIYJND/mangadap path: /mangadap/tests/test_spatiallybinnedspectradef.py
import pytest
from mangadap.proc.spatiallybinnedspectra import available_spatial_binning_... | code_fim | easy | {
"lang": "python",
"repo": "HSIYJND/mangadap",
"path": "/mangadap/tests/test_spatiallybinnedspectradef.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: furcb/python_scripts path: /scripts/jot
#!/bin/env python
# TODO: search dates correctly for open and new
# TODO: add automatic journal directory creation using .local/jot/<name_of_journal> as default
"""jot
Simple interfaces for creating journal entries using markdown with a basic template.
... | code_fim | hard | {
"lang": "python",
"repo": "furcb/python_scripts",
"path": "/scripts/jot",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Opens a new file and appends the file using the template provided
def create_entry(path, template):
try:
with open(path, "x") as f:
f.write(textwrap.dedent(template))
os.fchmod(f.fileno(), 0o660)
f.close()
except Exception as e:
print(f"Failed ... | code_fim | hard | {
"lang": "python",
"repo": "furcb/python_scripts",
"path": "/scripts/jot",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zhengjun-Du/pymatting path: /pymatting_aot/cc.py
def compile_modules():
import os
import pkgutil
from numba.pycc import CC
cc = CC("aot")
<|fim_suffix|># Test if modules need to be compiled
try:
import pymatting_aot.aot
except ImportError:
print(
"Failed to impor... | code_fim | hard | {
"lang": "python",
"repo": "Zhengjun-Du/pymatting",
"path": "/pymatting_aot/cc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Test if modules need to be compiled
try:
import pymatting_aot.aot
except ImportError:
print(
"Failed to import ahead-of-time-compiled modules. This is expected on first import."
)
print("Compiling modules and trying again (this might take a minute).")
compile_modules()
... | code_fim | hard | {
"lang": "python",
"repo": "Zhengjun-Du/pymatting",
"path": "/pymatting_aot/cc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create orders for each ambassador
for _ in range(randrange(1, 5)):
order = Order.objects.create(
user=amb, # ambassador
code=get_random_string(15),
amb_email=amb.email,
first_name=fak... | code_fim | hard | {
"lang": "python",
"repo": "zubedev/ambassador",
"path": "/backend/core/management/commands/populate_orders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zubedev/ambassador path: /backend/core/management/commands/populate_orders.py
from decimal import Decimal
from random import randrange
from django.core.management import BaseCommand
from django.utils.crypto import get_random_string
from faker import Faker
from core.models import User, Order, Or... | code_fim | hard | {
"lang": "python",
"repo": "zubedev/ambassador",
"path": "/backend/core/management/commands/populate_orders.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def past(request):
return HttpResponse("Hello, world. You're at the past index.")
def index(request):
days = Day.objects.order_by('id').all()
slots_11 = Slot.objects.filter(starttime=11).order_by('day_id').all()
slots_12 = Slot.objects.filter(starttime=12).order_by('day_id').all()
slots_1 = Slot.... | code_fim | medium | {
"lang": "python",
"repo": "franklinfrank/hknweb",
"path": "/hknweb/tutoring/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: franklinfrank/hknweb path: /hknweb/tutoring/views.py
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.template import loader
from .models import Tutor
from .models import Day
from .models import Slot
def future(request):
return HttpResponse("H... | code_fim | medium | {
"lang": "python",
"repo": "franklinfrank/hknweb",
"path": "/hknweb/tutoring/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/rax path: /examples/t5x/tasks.py
# Copyright 2023 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | code_fim | hard | {
"lang": "python",
"repo": "google/rax",
"path": "/examples/t5x/tasks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Extract necessary inputs from MS-Marco dataset.
dataset = dataset.map(extract_inputs, num_parallel_calls=tf.data.AUTOTUNE)
# Tokenize only the text features, leave the others unchanged.
tokenize_features = {
"inputs": output_features["inputs"],
"targets": output_features["targets"],... | code_fim | hard | {
"lang": "python",
"repo": "google/rax",
"path": "/examples/t5x/tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig.add_subplot(gs[1,0])
diagnostic_plots.densityPlot(targ_ra, targ_dec, data, iso, g_radius, nbhd, 'galaxies')
fig.add_subplot(gs[2,0])
diagnostic_plots.densityPlot(targ_ra, targ_dec, data, iso, g_radius, nbhd, 'blue_stars')
fig.add_subplot(gs[0,1])
diagnostic_plots.cmPlot(targ_... | code_fim | hard | {
"lang": "python",
"repo": "lsstdarkmatter/ugali",
"path": "/ugali/simple/render_plots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lsstdarkmatter/ugali path: /ugali/simple/render_plots.py
#!/usr/bin/env python
"""
Arrange and produce plots
"""
__author__ = "Sidney Mau"
# Set the backend first!
import matplotlib
matplotlib.use('Agg')
import os
import yaml
import numpy as np
import numpy
import pylab as plt
from matplotlib i... | code_fim | hard | {
"lang": "python",
"repo": "lsstdarkmatter/ugali",
"path": "/ugali/simple/render_plots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: javaos74/ncclient path: /examples/iosxe_regex.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from pyskate.iosxe_netconf import IOSXEDevice
<|fim_suffix|>show_ip_route = router.exec_command('show ip route')
for resp in show_ip_route:
matchObj = re.match( r'(^[D|S|C|L].*) ([0-9]{1,3}\... | code_fim | medium | {
"lang": "python",
"repo": "javaos74/ncclient",
"path": "/examples/iosxe_regex.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>show_ip_route = router.exec_command('show ip route')
for resp in show_ip_route:
matchObj = re.match( r'(^[D|S|C|L].*) ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) .*', resp, re.M|re.I)
if matchObj:
print 'type = %s destination = %s' %(matchObj.group(1), matchObj.group(2))<|fim_prefix|># repo: java... | code_fim | medium | {
"lang": "python",
"repo": "javaos74/ncclient",
"path": "/examples/iosxe_regex.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samsmusa/My-manim-master path: /MyAnimations-master/quadratic_equation/QuadraticEquation.py
from manimlib.imports import *
class SolveGeneralQuadraticEquation(Scene):
def construct(self):
self.import_formulas()
self.write_formulas()
self.set_changes()
self.ste... | code_fim | hard | {
"lang": "python",
"repo": "samsmusa/My-manim-master",
"path": "/MyAnimations-master/quadratic_equation/QuadraticEquation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ani_ in pre_order:
if len(pre_write)>0 and ani_=="w":
self.play(*[Write(self.formulas[n_step-1][w])for w in pre_write])
if len(pre_fade)>0 and ani_=="f":
self.play(*[FadeOut(self.formulas[n_step-1][w])for w in pre_fade])
self.wai... | code_fim | hard | {
"lang": "python",
"repo": "samsmusa/My-manim-master",
"path": "/MyAnimations-master/quadratic_equation/QuadraticEquation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write_formulas(self):
self.play(
LaggedStart(*[
Write(self.formulas[0][i])
for i in [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]
# If you use Write(self.formulas[0])
# the animation is not displayed correctly because
... | code_fim | hard | {
"lang": "python",
"repo": "samsmusa/My-manim-master",
"path": "/MyAnimations-master/quadratic_equation/QuadraticEquation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manzar96/st7 path: /core/data/collators.py
import torch
from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence
from core.utils.masks import pad_mask, subsequent_mask
from core.utils.tensors import mktensor
class Task71aCollator(object):
def __init__(self, pad_indx=0, device='cpu... | code_fim | hard | {
"lang": "python",
"repo": "manzar96/st7",
"path": "/core/data/collators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, pad_indx=0, device='cpu'):
self.pad_indx = pad_indx
self.device = device
def __call__(self, batch):
myid, text_input, humor_rating,humor_contr = map(list, zip(*batch))
input_lengths = torch.tensor(
[len(s) for s in text_input], devic... | code_fim | hard | {
"lang": "python",
"repo": "manzar96/st7",
"path": "/core/data/collators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return HttpRequest(
method="POST",
url=_url,
params=_params,
headers=_headers,
**kwargs
)
class PipelineRunOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations ... | code_fim | hard | {
"lang": "python",
"repo": "xiangyan99/azure-sdk-for-python",
"path": "/sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_pipeline_run_operations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiangyan99/azure-sdk-for-python path: /sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_pipeline_run_operations.py
and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Di... | code_fim | hard | {
"lang": "python",
"repo": "xiangyan99/azure-sdk-for-python",
"path": "/sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_pipeline_run_operations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
run_id: str,
**kwargs: Any
) -> _models.PipelineRun:
"""Get a pipeline run by its run ID.
:param run_id: The pipeline run identifier.
:type run_id: str
:keyword api_version: Api Version. Default value is "2020-12-01". Note that overriding ... | code_fim | hard | {
"lang": "python",
"repo": "xiangyan99/azure-sdk-for-python",
"path": "/sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_pipeline_run_operations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for k, v in GRAPH_IMPORTERS.items():
for match in v['matches']:
if re.search(match, filename):
graph = v['importer'](filename, opts)
graph.set_load_function(v['loader'])
return graph
raise ValueError("Graph importer not found")<|... | code_fim | hard | {
"lang": "python",
"repo": "danieldennett/gap_sdk",
"path": "/tools/nntool/importer/importer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danieldennett/gap_sdk path: /tools/nntool/importer/importer.py
# Copyright 2019 GreenWaves Technologies, SAS
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://... | code_fim | hard | {
"lang": "python",
"repo": "danieldennett/gap_sdk",
"path": "/tools/nntool/importer/importer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Echowxsy/Swarm-nbzz path: /nbzz/types/end_of_slot_bundle.py
from dataclasses import dataclass
from typing import Optional
from nbzz.types.blockchain_format.slots import (
ChallengeChainSubSlot,
InfusedChallengeChainSubSlot,
RewardChainSubSlot,
SubSlotProofs,
)
from nbzz.... | code_fim | medium | {
"lang": "python",
"repo": "Echowxsy/Swarm-nbzz",
"path": "/nbzz/types/end_of_slot_bundle.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass(frozen=True)
@streamable
class EndOfSubSlotBundle(Streamable):
challenge_chain: ChallengeChainSubSlot
infused_challenge_chain: Optional[InfusedChallengeChainSubSlot]
reward_chain: RewardChainSubSlot
proofs: SubSlotProofs<|fim_prefix|># repo: Echowxsy/Swarm-nbzz path: /n... | code_fim | hard | {
"lang": "python",
"repo": "Echowxsy/Swarm-nbzz",
"path": "/nbzz/types/end_of_slot_bundle.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.