text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>if os.path.exists(outpath):
print('Written %s successfully.' % outpath)
sys.exit(0)
else:
print('Failed to write %s.' % outpath, file=sys.stderr)
sys.exit(1)<|fim_prefix|># repo: c74p/Capstone-SalesForecasting path: /tests/constraints/verify_constraints.py
import os
import pandas as pd
im... | code_fim | hard | {
"lang": "python",
"repo": "c74p/Capstone-SalesForecasting",
"path": "/tests/constraints/verify_constraints.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('in_wav_f', type=str, help='text to be cleaned')
parser.add_argument("out_wav_f", type=str, default="kana")
parser.add_argument("rate", type=int)
args = parser.parse_args()
downsample(args.in_wav_f, ... | code_fim | medium | {
"lang": "python",
"repo": "undeadyequ/espnet",
"path": "/egs/blizzard13/tts2_gst/local/down_sample.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('in_wav_f', type=str, help='text to be cleaned')
parser.add_argument("out_wav_f", type=str, default="kana")
parser.add_argument("rate", type=int)
args = parser.parse_args()
downsample(args.in_wav_f, a... | code_fim | medium | {
"lang": "python",
"repo": "undeadyequ/espnet",
"path": "/egs/blizzard13/tts2_gst/local/down_sample.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: undeadyequ/espnet path: /egs/blizzard13/tts2_gst/local/down_sample.py
#!/usr/bin/env python3
import os
import argparse
def downsample(wav_f, out_wav_f, d_sample_rate=16000):
<|fim_suffix|>
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('in_wav_f', type... | code_fim | medium | {
"lang": "python",
"repo": "undeadyequ/espnet",
"path": "/egs/blizzard13/tts2_gst/local/down_sample.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wuxinxiaoshifu/rh_ros path: /camera_driver/scripts/nikon_d5100.py
#!/usr/bin/env python
# Implement Polled Camera Node for Nikon D5100
#
# http://wiki.ros.org/camera_drivers
#
# Services
# request_image (polled_camera/GetPolledImage)
# set_camera_info (sensor_msgs/SetCameraInfo)
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "Wuxinxiaoshifu/rh_ros",
"path": "/camera_driver/scripts/nikon_d5100.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return GetPolledImageResponse(success, message, stamp)
def d5100_image_capture():
global image_raw_publisher
global camera_info_publisher
global camera_info
rospy.init_node(name())
# Tell camera to write images to RAM instead of media card
try:
subprocess.check... | code_fim | hard | {
"lang": "python",
"repo": "Wuxinxiaoshifu/rh_ros",
"path": "/camera_driver/scripts/nikon_d5100.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: n1amr/MCQ-Checker path: /mcq_checker/grader.py
import os
import cv2
from mcq_checker.constants import MODEL_ANSWERS, get_cached_image_path
from mcq_checker.deskewer import Deskewer
from mcq_checker.detector import extract_answers
from mcq_checker.utils.image import load_image
class Grader:
<|... | code_fim | medium | {
"lang": "python",
"repo": "n1amr/MCQ-Checker",
"path": "/mcq_checker/grader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def grade(self, img_path):
cached_path = get_cached_image_path(img_path)
if os.path.exists(cached_path):
img = load_image(cached_path)
else:
img = load_image(img_path)
img = self.deskewer.deskew(img)
cv2.imwrite(cached_path, img)
... | code_fim | medium | {
"lang": "python",
"repo": "n1amr/MCQ-Checker",
"path": "/mcq_checker/grader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cached_path = get_cached_image_path(img_path)
if os.path.exists(cached_path):
img = load_image(cached_path)
else:
img = load_image(img_path)
img = self.deskewer.deskew(img)
cv2.imwrite(cached_path, img)
answers = extract_answ... | code_fim | medium | {
"lang": "python",
"repo": "n1amr/MCQ-Checker",
"path": "/mcq_checker/grader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ environment fits constraints """
# ball is to the top right from player's position
if (obs["ball"][0] > player_x and
obs["ball"][1] < player_y):
return True
return False
def get_action(obs, player_x, player_y):
""" get ac... | code_fim | hard | {
"lang": "python",
"repo": "guocongyun/gfootball-competition",
"path": "/rule-based-agents/v3_6_add_opponent_distance_highpass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def khorne_slide(obs, berzerker_x, berzerker_y):
""" BLOOD FOR THE BLOOD GOD!!! SKULLS FOR THE SKULL THRONE!!! """
def environment_fits(obs, berzerker_x, berzerker_y):
""" environment fits constraints """
# if prey has the ball
if obs["ball_owned_team"] == 1:
pr... | code_fim | hard | {
"lang": "python",
"repo": "guocongyun/gfootball-competition",
"path": "/rule-based-agents/v3_6_add_opponent_distance_highpass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guocongyun/gfootball-competition path: /rule-based-agents/v3_6_add_opponent_distance_highpass.py
close around
if distances_amount == 0:
return 2, distances_amount
return distances_sum / distances_amount, distances_amount
def get_distance(x1, y1, x2, y2):
""" get two-dimension... | code_fim | hard | {
"lang": "python",
"repo": "guocongyun/gfootball-competition",
"path": "/rule-based-agents/v3_6_add_opponent_distance_highpass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zer0eXploit/myannime-api path: /resources/Genre.py
from flask import request
from flask_restful import Resource
from flask_jwt_extended import jwt_required
from marshmallow.exceptions import ValidationError
from models.Genre import GenreModel
from models.Anime import AnimeModel
from schemas.Gen... | code_fim | hard | {
"lang": "python",
"repo": "zer0eXploit/myannime-api",
"path": "/resources/Genre.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Genres(Resource):
'''
GET: responds with a list of all genres
POST: accepts genre_name, genre_explanation and creates it if not exists already.
PUT: accepts genre_name and genre_explanation to update. creates it if not exists already.
DELETE: accepts genre_name to be deleted from... | code_fim | hard | {
"lang": "python",
"repo": "zer0eXploit/myannime-api",
"path": "/resources/Genre.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def preprocess_russian_text(text):
tokens = tokenize(text)
tokens = filter(lambda token: is_russian_word(token), tokens)
tokens = filter(lambda token: token not in russian_stopwords, tokens)
tokens = map(ru_stemmer.stem, tokens)
return ' '.join(tokens)
def preprocess_russian_text_wit... | code_fim | medium | {
"lang": "python",
"repo": "LyzhinIvan/YouTubeAdvertisementDetector",
"path": "/AdDetectorModel/utils/texts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def preprocess_english_text(text):
tokens = tokenize(text)
tokens = filter(lambda token: is_english_word(token), tokens)
tokens = filter(lambda token: token not in english_stopwords, tokens)
tokens = map(en_stemmer.stem, tokens)
return ' '.join(tokens)
def lemmatize(word):
return... | code_fim | hard | {
"lang": "python",
"repo": "LyzhinIvan/YouTubeAdvertisementDetector",
"path": "/AdDetectorModel/utils/texts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LyzhinIvan/YouTubeAdvertisementDetector path: /AdDetectorModel/utils/texts.py
import nltk
from nltk.corpus import stopwords
import pymorphy2 as pm
nltk.download("stopwords")
ru_stemmer = nltk.stem.SnowballStemmer('russian')
en_stemmer = nltk.stem.PorterStemmer()
russian_stopwords = set(stopword... | code_fim | hard | {
"lang": "python",
"repo": "LyzhinIvan/YouTubeAdvertisementDetector",
"path": "/AdDetectorModel/utils/texts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mit-gfx/diff_pd_public path: /python/example/water_snake_ppo.py
import os
from pathlib import Path
import sys
import time
from functools import partial
import math
import random
import copy
from collections import deque
import logging
sys.path.append(str(Path(__file__).resolve().parent.parent))
... | code_fim | hard | {
"lang": "python",
"repo": "mit-gfx/diff_pd_public",
"path": "/python/example/water_snake_ppo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> config.num_workers = 4
config.task_fn = lambda: DiffPDTask(make_water_snake_3d, IndSim, seed, config.num_workers, False) # pylint: disable=no-member
config.eval_env = DiffPDTask(make_water_snake_3d, IndSim, seed, 1, True)
config.network_fn = lambda: MyGaussianActorCriticNet(
conf... | code_fim | hard | {
"lang": "python",
"repo": "mit-gfx/diff_pd_public",
"path": "/python/example/water_snake_ppo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pypa/pip path: /src/pip/_vendor/rich/_null_file.py
from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Type
class NullFile(IO[str]):
def close(self) -> None:
pass
def isatty(self) -> bool:
return False
def read(self, __n: int ... | code_fim | medium | {
"lang": "python",
"repo": "pypa/pip",
"path": "/src/pip/_vendor/rich/_null_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def truncate(self, __size: Optional[int] = 1) -> int:
return 0
def writable(self) -> bool:
return False
def writelines(self, __lines: Iterable[str]) -> None:
pass
def __next__(self) -> str:
return ""
def __iter__(self) -> Iterator[str]:
retur... | code_fim | hard | {
"lang": "python",
"repo": "pypa/pip",
"path": "/src/pip/_vendor/rich/_null_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_random_operator():
return random.choice(VALID_OPERATORS)
def get_random_ecn():
return random.choice(VALID_ECN_TYPES)<|fim_prefix|># repo: snierodz/neutron-classifier path: /neutron_classifier/tests/tools.py
# Copyright 2017 Intel Corporation.
#
# Licensed under the Apache License, Ve... | code_fim | medium | {
"lang": "python",
"repo": "snierodz/neutron-classifier",
"path": "/neutron_classifier/tests/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snierodz/neutron-classifier path: /neutron_classifier/tests/tools.py
# Copyright 2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | code_fim | medium | {
"lang": "python",
"repo": "snierodz/neutron-classifier",
"path": "/neutron_classifier/tests/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_random_operator():
return random.choice(VALID_OPERATORS)
def get_random_ecn():
return random.choice(VALID_ECN_TYPES)<|fim_prefix|># repo: snierodz/neutron-classifier path: /neutron_classifier/tests/tools.py
# Copyright 2017 Intel Corporation.
#
# Licensed under the Apache License, V... | code_fim | medium | {
"lang": "python",
"repo": "snierodz/neutron-classifier",
"path": "/neutron_classifier/tests/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lukasz-starosta/imputation path: /utils/hypothesis.py
from scipy import stats
ALPHA = 0.05
def check_mean_value_hypothesis(df, attribute_name, hypothesis):
_, p_val = stats.ttest_1samp(df[attribute_name], hypothesis, nan_p<|fim_suffix|> f"P-wartość={'{0:.4f}'.format(p_val)} jest niższa ... | code_fim | hard | {
"lang": "python",
"repo": "lukasz-starosta/imputation",
"path": "/utils/hypothesis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f"P-wartość={'{0:.4f}'.format(p_val)} jest niższa niż przyjęty poziom istotności statystycznej={ALPHA}. Hipotezę odrzucamy, ponieważ różnice są istotne statystycznie.")<|fim_prefix|># repo: lukasz-starosta/imputation path: /utils/hypothesis.py
from scipy import stats
ALPHA = 0.05
def check_mean_va... | code_fim | hard | {
"lang": "python",
"repo": "lukasz-starosta/imputation",
"path": "/utils/hypothesis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
backbone: str,
input_size: tuple[int, int],
layers: list[str],
anomaly_map_mode: AnomalyMapGenerationMode,
pre_trained: bool = True,
) -> None:
super().__init__()
self.tiler: Tiler | None = None
encoder_backbone = backbone
... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/anomalib",
"path": "/src/anomalib/models/reverse_distillation/torch_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.tiler:
image_size = (self.tiler.tile_size_h, self.tiler.tile_size_w)
else:
image_size = input_size
self.anomaly_map_generator = AnomalyMapGenerator(image_size=image_size, mode=anomaly_map_mode)
def forward(self, images: Tensor) -> Tensor | list... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/anomalib",
"path": "/src/anomalib/models/reverse_distillation/torch_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openvinotoolkit/anomalib path: /src/anomalib/models/reverse_distillation/torch_model.py
"""PyTorch model for Reverse Distillation."""
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from torch import Tensor, nn
from anomalib.mode... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/anomalib",
"path": "/src/anomalib/models/reverse_distillation/torch_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> regex = r"[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com"
super().__init__(actions, regex)<|fim_prefix|># repo: bbhunter/pastepwn path: /pastepwn/analyzers/googleoauthkeyanalyzer.py
# -*- coding: utf-8 -*-
from .regexanalyzer import RegexAnalyzer
class GoogleOAuthKeyAnalyzer(Rege... | code_fim | easy | {
"lang": "python",
"repo": "bbhunter/pastepwn",
"path": "/pastepwn/analyzers/googleoauthkeyanalyzer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbhunter/pastepwn path: /pastepwn/analyzers/googleoauthkeyanalyzer.py
# -*- coding: utf-8 -*-
from .regexanalyzer import RegexAnalyzer
class GoogleOAuthKeyAnalyzer(RegexAnalyzer):
<|fim_suffix|> regex = r"[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com"
super().__init__(act... | code_fim | easy | {
"lang": "python",
"repo": "bbhunter/pastepwn",
"path": "/pastepwn/analyzers/googleoauthkeyanalyzer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esaSPICEservice/spival path: /spival/utils/frames.py
import spiceypy
import datetime
from spiceypy.utils.support_types import SpiceyError
def gen_frame_dict(mk, report=False):
#
# Frame names are as follows:
# r'FRAME_-?[0-9]*_NAME'
#
frame_dict = {}
spiceypy.furnsh(mk... | code_fim | hard | {
"lang": "python",
"repo": "esaSPICEservice/spival",
"path": "/spival/utils/frames.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key in frame_dict.keys():
if frame_dict[key]['class'] == 4:
fname = frame_dict[key]['name']
try:
spiceypy.pxform(fname, 'J2000', et)
except SpiceyError:
frames_to_check = True
print( f'Frame {fname} not pro... | code_fim | hard | {
"lang": "python",
"repo": "esaSPICEservice/spival",
"path": "/spival/utils/frames.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
frame_dict[cvars[0]] = { 'name': cvars[0],
'class':frmclass[0],
'id': frmid[0],
'center': frmcentr[0],
'relative': frmrelat[0]
... | code_fim | hard | {
"lang": "python",
"repo": "esaSPICEservice/spival",
"path": "/spival/utils/frames.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crew102/reprexpy path: /tests/test_reprexpy.py
import os
import re
import textwrap
import pyperclip
import pytest
from reprexpy import reprex
skip_on_github = pytest.mark.skipif(
'CI' in os.environ,
reason='Skipping during Github workflow.'
)
def _read_reprex_file(file):
with ope... | code_fim | hard | {
"lang": "python",
"repo": "crew102/reprexpy",
"path": "/tests/test_reprexpy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Good test to use during interactive debugging
def test_debug_example():
_assert_reprex_exact_match('debug-example')
def test_two_statements_per_line():
_assert_reprex_exact_match('two-statements-per-line')
def test_docstring_venue():
_assert_reprex_exact_match('docstring-venue', venue='... | code_fim | hard | {
"lang": "python",
"repo": "crew102/reprexpy",
"path": "/tests/test_reprexpy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> code = _read_reprex_file('tests/reprexes/txt-outputs.py')
out_str = reprex(code=code)
out_infile = reprex(code_file='tests/reprexes/txt-outputs.py')
pyperclip.copy(code)
out_clipboard = reprex()
assert out_str == out_infile == out_clipboard
@skip_on_github
def test_output_to_c... | code_fim | hard | {
"lang": "python",
"repo": "crew102/reprexpy",
"path": "/tests/test_reprexpy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: damounayman/ros_gazebo_gym path: /rl_algo/test_python.py
import numpy
import random
<|fim_suffix|>test = []
for i in range(20):
goal_x = random.randrange(-12, 13) / 10.0
rand = random.randint(0, 1)
goal_y = 0.5 *rand -(1-rand)*0.5
temp=[goal_x,goal_y]
test.append(temp)
print... | code_fim | easy | {
"lang": "python",
"repo": "damounayman/ros_gazebo_gym",
"path": "/rl_algo/test_python.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>test = []
for i in range(20):
goal_x = random.randrange(-12, 13) / 10.0
rand = random.randint(0, 1)
goal_y = 0.5 *rand -(1-rand)*0.5
temp=[goal_x,goal_y]
test.append(temp)
print(test)<|fim_prefix|># repo: damounayman/ros_gazebo_gym path: /rl_algo/test_python.py
import numpy
import ra... | code_fim | easy | {
"lang": "python",
"repo": "damounayman/ros_gazebo_gym",
"path": "/rl_algo/test_python.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nibydlo/modAL path: /experiments/models/after_encoder_models.py
import torch
import torch.nn.functional as F
import torch.nn as nn
IMG_LEN = 1024
TXT_LEN = 300
N_CLASSES = 50
class AfterEncoderModel(nn.Module):
def __init__(self, encoder, d=128, drop=0.5):
super().__init__()
... | code_fim | hard | {
"lang": "python",
"repo": "nibydlo/modAL",
"path": "/experiments/models/after_encoder_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, inp_img, inp_txt):
x = self.encoder(inp_img, inp_txt)
x = self.bn(F.relu(self.fc(x)))
x = F.log_softmax(self.out(x), dim=1)
return x
class AfterEncoderModelTrident(nn.Module):
def __init__(self, encoder, d=128, drop=0.5):
super().__init_... | code_fim | hard | {
"lang": "python",
"repo": "nibydlo/modAL",
"path": "/experiments/models/after_encoder_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, inp_img, inp_txt):
x_img, x_txt = self.encoder(inp_img, inp_txt)
x = torch.cat((x_img, x_txt), 1)
x = self.dropout(self.bn1(F.relu(self.fc1(x))))
x = self.bn2(F.relu(self.fc2(x)))
x = F.log_softmax(self.out(x), dim=1)
x_img = F.log_sof... | code_fim | hard | {
"lang": "python",
"repo": "nibydlo/modAL",
"path": "/experiments/models/after_encoder_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimthostrup/HomeRouter path: /HomeRouter/__init__.py
import os
from flask import Flask
from flask_login import LoginManager
#from flask_sslify import SSLify
<|fim_suffix|>if not app.debug:
import logging
from logging.handlers import RotatingFileHandler
file_handler = RotatingFileHandler('logs... | code_fim | medium | {
"lang": "python",
"repo": "kimthostrup/HomeRouter",
"path": "/HomeRouter/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not app.debug:
import logging
from logging.handlers import RotatingFileHandler
file_handler = RotatingFileHandler('logs/HomeRouter.log', 1024 * 1024, 5)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno... | code_fim | medium | {
"lang": "python",
"repo": "kimthostrup/HomeRouter",
"path": "/HomeRouter/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miskolc/spacy-pytorch-transformers path: /stubs/thinc/extra/_vendorized/keras_generic_utils.pyi
# Stubs for thinc.extra._vendorized.keras_generic_utils (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from ...compat import string_types
from typing import A... | code_fim | hard | {
"lang": "python",
"repo": "miskolc/spacy-pytorch-transformers",
"path": "/stubs/thinc/extra/_vendorized/keras_generic_utils.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> width: Any = ...
target: Any = ...
sum_values: Any = ...
unique_values: Any = ...
start: Any = ...
last_update: int = ...
interval: Any = ...
total_width: int = ...
seen_so_far: int = ...
verbose: Any = ...
def __init__(self, target: Any, width: int = ..., verbo... | code_fim | medium | {
"lang": "python",
"repo": "miskolc/spacy-pytorch-transformers",
"path": "/stubs/thinc/extra/_vendorized/keras_generic_utils.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cnsetzer/astrotog path: /hpc_parallel/create_submit_all_pbs.py
import os
import re
import sys
import numpy as np
from subprocess import Popen, PIPE
queue = sys.argv[1]
n_nodes = sys.argv[2]
ppn = sys.argv[3]
env = sys.argv[4]
n_seeds = np.int(sys.argv[5])
script = sys.argv[6]
input_paths = []
... | code_fim | hard | {
"lang": "python",
"repo": "cnsetzer/astrotog",
"path": "/hpc_parallel/create_submit_all_pbs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> export PYTHONPATH=$PYTHONPATH:/home/{7}/.conda/envs/{4}/bin/python
mpirun -genvlist PATH,LD_LIBRARY_PATH,LD_RUN_PATH,PYTHONPATH --machinefile $PBS_NODEFILE -ppn {3} python {8} {9} {6}
""".format(
job_name,
queue,
... | code_fim | hard | {
"lang": "python",
"repo": "cnsetzer/astrotog",
"path": "/hpc_parallel/create_submit_all_pbs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rom maogou".format(s))
data = result.fetchall()
print(type(data))
print(len(data))
conn.close()
return data
select()<|fim_prefix|># repo: NiceBlueChai/Spiders path: /mmgg/sqlite_select.py
import sqlite3
def select(s="thumbnail"):
conn = sqlite3.connec<|fim_middle|>t("mmg.db")
... | code_fim | medium | {
"lang": "python",
"repo": "NiceBlueChai/Spiders",
"path": "/mmgg/sqlite_select.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NiceBlueChai/Spiders path: /mmgg/sqlite_select.py
import sqlite3
def select(s="thumbnail"):
conn = sqlite3.connect("mmg.db")
c = conn.cursor()
result = c.execute("select {} f<|fim_suffix|>ata))
print(len(data))
conn.close()
return data
select()<|fim_middle|>rom maogou".f... | code_fim | medium | {
"lang": "python",
"repo": "NiceBlueChai/Spiders",
"path": "/mmgg/sqlite_select.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># ax.view_init(elev=None, azim=None)
for i in range(1, 5, 1):
# change data here to show different images
ax.plot_surface(i, Y, X, facecolors=data, **opts)
plt.savefig('output.png')<|fim_prefix|># repo: edjdavid/adventures path: /python/matplotlib/image_sequence.py
import matplotlib.pyplot as pl... | code_fim | hard | {
"lang": "python",
"repo": "edjdavid/adventures",
"path": "/python/matplotlib/image_sequence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edjdavid/adventures path: /python/matplotlib/image_sequence.py
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
<|fim_suffix|># ax.view_init(elev=None, azim=None)
for i in range(1, 5, 1... | code_fim | hard | {
"lang": "python",
"repo": "edjdavid/adventures",
"path": "/python/matplotlib/image_sequence.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: izzatnadzmi/ConcentricTubeRobot path: /test/plotTest.py
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from scipy import stats
from mayavi import mlab
data = pd.read_csv(r'/afs/inf.ed.ac.uk/user/s18/s1854010/Downloads/DONEresultsz... | code_fim | medium | {
"lang": "python",
"repo": "izzatnadzmi/ConcentricTubeRobot",
"path": "/test/plotTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>xyz = np.vstack([xx,yy,zz])
kde = stats.gaussian_kde(xyz)
density = kde(xyz)
# # Plot scatter with mayavi
# figure = mlab.figure('DensityPlot')
# pts = mlab.points3d(xx, yy, zz, density, scale_mode='none', scale_factor=0.07)
# mlab.axes()
# mlab.show()
# Plot scatter with mayavi
figure = mlab.figure('De... | code_fim | hard | {
"lang": "python",
"repo": "izzatnadzmi/ConcentricTubeRobot",
"path": "/test/plotTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rongzha1/incubator-mxnet path: /python/mxnet/numpy/utils.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this f... | code_fim | hard | {
"lang": "python",
"repo": "rongzha1/incubator-mxnet",
"path": "/python/mxnet/numpy/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_DTYPE_2_STR_ = {float16: 'float16', float32: 'float32', float64: 'float64', float: 'float64',
int8: 'int8', int16: 'int16', int32: 'int32', int64: 'int64', int:'int64',
uint8: 'uint8', uint16: 'uint16', uint32: 'uint32', uint64: 'uint64',
bool: 'bool', b... | code_fim | hard | {
"lang": "python",
"repo": "rongzha1/incubator-mxnet",
"path": "/python/mxnet/numpy/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>newaxis = None
_STR_2_DTYPE_ = {'float16': float16, 'float32': float32, 'float64': float64, 'float': float64,
'int8': int8, 'int16': int16, 'int32': int32, 'int64': int64, 'int': int64,
'uint8': uint8, 'uint16': uint16, 'uint32': uint32, 'uint64': uint64,
... | code_fim | hard | {
"lang": "python",
"repo": "rongzha1/incubator-mxnet",
"path": "/python/mxnet/numpy/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_sentences_from_store(self,keys,translate_wf_input):
data_keys=[]
for key in keys:
if "userID" not in key or not key["userID"] or "src" not in key or not key["src"] or "locale" not in key or not key["locale"]:
return None
... | code_fim | hard | {
"lang": "python",
"repo": "project-anuvaad/anuvaad",
"path": "/anuvaad-etl/anuvaad-translator/translator/utilities/translatorutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: project-anuvaad/anuvaad path: /anuvaad-etl/anuvaad-translator/translator/utilities/translatorutils.py
import json
import logging
import os
import re
import time
import zlib
import requests
import hashlib
from configs.translatorconfig import download_folder, nmt_fetch_models_url, tmx_disable_role... | code_fim | hard | {
"lang": "python",
"repo": "project-anuvaad/anuvaad",
"path": "/anuvaad-etl/anuvaad-translator/translator/utilities/translatorutils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Method to simultaneously replace multiple strings in a sentence
def multiple_replace(self, sentence, replacement_dict):
pattern = re.compile("|".join([re.escape(k) for k in sorted(replacement_dict, key=len, reverse=True)]),
flags=re.DOTALL)
return pat... | code_fim | hard | {
"lang": "python",
"repo": "project-anuvaad/anuvaad",
"path": "/anuvaad-etl/anuvaad-translator/translator/utilities/translatorutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>bRequest',
'RestartMigrationJobRequest',
'ResumeMigrationJobRequest',
'SshScript',
'StartMigrationJobRequest',
'StopMigrationJobRequest',
'UpdateConnectionProfileRequest',
'UpdateMigrationJobRequest',
'VerifyMigrationJobRequest',
'VmCreationConfig',
'VmSelectionConf... | code_fim | hard | {
"lang": "python",
"repo": "oltoco/googleapis-gen",
"path": "/google/cloud/clouddms/v1/clouddms-v1-py/google/cloud/clouddms_v1/types/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>MigrationJob,
MigrationJobVerificationError,
MySqlConnectionProfile,
PostgreSqlConnectionProfile,
ReverseSshConnectivity,
SqlAclEntry,
SqlIpConfig,
SslConfig,
StaticIpConnectivity,
VpcPeeringConnectivity,
DatabaseEngine,
DatabaseProvider,
)
__all__ = (
'Cre... | code_fim | hard | {
"lang": "python",
"repo": "oltoco/googleapis-gen",
"path": "/google/cloud/clouddms/v1/clouddms-v1-py/google/cloud/clouddms_v1/types/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oltoco/googleapis-gen path: /google/cloud/clouddms/v1/clouddms-v1-py/google/cloud/clouddms_v1/types/__init__.py
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | code_fim | hard | {
"lang": "python",
"repo": "oltoco/googleapis-gen",
"path": "/google/cloud/clouddms/v1/clouddms-v1-py/google/cloud/clouddms_v1/types/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rapidsms/rapidsms-contrib-apps-dev path: /scheduler/templatetags/scheduler_tags.py
from django import template
<|fim_suffix|>@register.filter
def display_list(list_):
'''display a list'''
return ','.join([unicode(i) for i in list_])<|fim_middle|>register = template.Library()
| code_fim | easy | {
"lang": "python",
"repo": "rapidsms/rapidsms-contrib-apps-dev",
"path": "/scheduler/templatetags/scheduler_tags.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.filter
def display_list(list_):
'''display a list'''
return ','.join([unicode(i) for i in list_])<|fim_prefix|># repo: rapidsms/rapidsms-contrib-apps-dev path: /scheduler/templatetags/scheduler_tags.py
from django import template
<|fim_middle|>register = template.Library()
| code_fim | easy | {
"lang": "python",
"repo": "rapidsms/rapidsms-contrib-apps-dev",
"path": "/scheduler/templatetags/scheduler_tags.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> MC = CM & AM
NC = CN & BN
KC = AK & BK
if MC == set():
MC = ['']
if NC == set():
NC = ['']
minCost = LoGCost()
minLog = None
for m in sorted(MC):
for n in sorted(NC):
for k in sorted(KC):
log = LoopOverGEMM(I.indices, L, R, m, n, k)
cost = log.cost()
... | code_fim | hard | {
"lang": "python",
"repo": "SeisSol/yateto",
"path": "/yateto/ast/log.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeisSol/yateto path: /yateto/ast/log.py
import copy, re
from .node import LoopOverGEMM
from .indices import LoGCost
def allSubstrings(s):
L = len(s)
return [s[i:j+1] for i in range(L) for j in range(i,L)]
def splitByDistance(p):
L = len(p)
splits = [i+1 for x,y,i in zip(p[:-1], p[1:], r... | code_fim | hard | {
"lang": "python",
"repo": "SeisSol/yateto",
"path": "/yateto/ast/log.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ll print a Hello World message.
# printing to the user
print('Hello World')<|fim_prefix|># repo: nathaniel-walker/python_methods path: /hello_world/Hello_World.py
# Author - @Nathaniel Walker
# Date - <|fim_middle|>9/23/20
# Description - This program wi | code_fim | easy | {
"lang": "python",
"repo": "nathaniel-walker/python_methods",
"path": "/hello_world/Hello_World.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nathaniel-walker/python_methods path: /hello_world/Hello_World.py
# Author - @Nathaniel Walker
# Date - <|fim_suffix|>inting to the user
print('Hello World')<|fim_middle|>9/23/20
# Description - This program will print a Hello World message.
# pr | code_fim | medium | {
"lang": "python",
"repo": "nathaniel-walker/python_methods",
"path": "/hello_world/Hello_World.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ProEgitim/Python-Dersleri-BEM path: /Ogrenciler/Erdogan-Canbay/dongulerSoru.py
print("""-------------------------------------------------
Hesap Makinesi Programına Hoşgeldiniz
İşlemler;
1. Toplama İşlemi
2. Çıkarma İşlemi
3. Çarpma İşlemi
4. Bölme İşlemi
-----------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "ProEgitim/Python-Dersleri-BEM",
"path": "/Ogrenciler/Erdogan-Canbay/dongulerSoru.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> giris=input("çıkmak için Y yi seçiniz devam etmek için enterla devam edin ")
if giris=="Y":
break
else:
continue<|fim_prefix|># repo: ProEgitim/Python-Dersleri-BEM path: /Ogrenciler/Erdogan-Canbay/dongulerSoru.py
print("""-------------------------------------------------
Hesa... | code_fim | hard | {
"lang": "python",
"repo": "ProEgitim/Python-Dersleri-BEM",
"path": "/Ogrenciler/Erdogan-Canbay/dongulerSoru.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='deadline',
name='error_date_type_mismatch',
field=models.TextField(blank=True, null=True, verbose_name='error message for date type mismatch'),
),
]<|fim_prefix|># repo: City-of-Helsinki/kaavapino ... | code_fim | medium | {
"lang": "python",
"repo": "City-of-Helsinki/kaavapino",
"path": "/projects/migrations/0108_deadline_error_date_type_mismatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-of-Helsinki/kaavapino path: /projects/migrations/0108_deadline_error_date_type_mismatch.py
# Generated by Django 2.2.13 on 2021-04-27 07:08
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "City-of-Helsinki/kaavapino",
"path": "/projects/migrations/0108_deadline_error_date_type_mismatch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LandscapeGeoinformatics/est_water_qual path: /scripts/preprocessing/preprocess_soil.py
# Import libraries
import sys
import os
import numpy as np
from osgeo import gdal
from utils import get_zone, fp_to_soil_data, fp_to_zonal_raster
# Input arguments
wd = sys.argv[1]
zone_id = int(s... | code_fim | medium | {
"lang": "python",
"repo": "LandscapeGeoinformatics/est_water_qual",
"path": "/scripts/preprocessing/preprocess_soil.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Get zone
zone = get_zone(zone_id)
# Create zonal raster and export as GeoTIFF
gdal.Rasterize(
fp_to_zonal_raster(predictor, zone_id), fp_to_soil_data(), outputType=gdal.GDT_Float32,
outputBounds=zone.total_bounds, outputSRS='epsg:3301', xRes=5, yRes=5, noData=np.nan,
attribute=f'{pre... | code_fim | hard | {
"lang": "python",
"repo": "LandscapeGeoinformatics/est_water_qual",
"path": "/scripts/preprocessing/preprocess_soil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create zonal raster and export as GeoTIFF
gdal.Rasterize(
fp_to_zonal_raster(predictor, zone_id), fp_to_soil_data(), outputType=gdal.GDT_Float32,
outputBounds=zone.total_bounds, outputSRS='epsg:3301', xRes=5, yRes=5, noData=np.nan,
attribute=f'{predictor}', layers='EstSoil-EH_v1.2c', cre... | code_fim | hard | {
"lang": "python",
"repo": "LandscapeGeoinformatics/est_water_qual",
"path": "/scripts/preprocessing/preprocess_soil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ready_to_checkpoint(self):
steps_passed = self.agent.get_steps() - self._checkpoint_step
if steps_passed < 2e9:
return False
main_agents = [
player for player in self._payoff.players
if isinstance(player, MainPlayer)
]
win_rates = self._payoff[self, main_ag... | code_fim | hard | {
"lang": "python",
"repo": "kimbring2/AlphaStar_Implementation",
"path": "/pseudocode/multiagent.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_match(self):
pass
def ready_to_checkpoint(self):
return False
def _create_checkpoint(self):
return Historical(self, self.payoff)
@property
def payoff(self):
return self._payoff
@property
def race(self):
return self._race
def checkpoint(self):
raise NotI... | code_fim | hard | {
"lang": "python",
"repo": "kimbring2/AlphaStar_Implementation",
"path": "/pseudocode/multiagent.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimbring2/AlphaStar_Implementation path: /pseudocode/multiagent.py
ry for multiagent concerns."""
import collections
import numpy as np
import random
from pysc2.lib import actions, features, units
from utils import get_entity_obs, get_upgrade_obs, get_gameloop_obs, get_race_onehot, get_agent_sta... | code_fim | hard | {
"lang": "python",
"repo": "kimbring2/AlphaStar_Implementation",
"path": "/pseudocode/multiagent.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_login_link_user_id"), table_name="login_link")
op.drop_index(op.f("ix_login_link_id"), table_name="login_link")
op.drop_index(op.f("ix_login_link_code"), table_name="login_link")
op.drop_table("login_l... | code_fim | medium | {
"lang": "python",
"repo": "caverage/caverage-events",
"path": "/backend/app/alembic/versions/ee552bd361f7_add_login_link_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: caverage/caverage-events path: /backend/app/alembic/versions/ee552bd361f7_add_login_link_table.py
"""Add login link table
Revision ID: ee552bd361f7
Revises: f19151e0aec0
Create Date: 2020-09-22 22:08:45.631191
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by A... | code_fim | hard | {
"lang": "python",
"repo": "caverage/caverage-events",
"path": "/backend/app/alembic/versions/ee552bd361f7_add_login_link_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"login_link",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("code", sa.String(), nullable=False),
sa.Column("user_id", sa.Integer(), nullable=False),
sa.Column("active"... | code_fim | medium | {
"lang": "python",
"repo": "caverage/caverage-events",
"path": "/backend/app/alembic/versions/ee552bd361f7_add_login_link_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""Function: test_repair_db2
Description: Test repair_db function.
Arguments:
"""
mock_process.return_value = (True, "Error Message")
self.assertEqual(
mongo_db_admin.repair_db(
self.server, self.args_array), (True, "Error... | code_fim | hard | {
"lang": "python",
"repo": "deepcoder42/mongo-db-admin",
"path": "/test/unit/mongo_db_admin/repair_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deepcoder42/mongo-db-admin path: /test/unit/mongo_db_admin/repair_db.py
#!/usr/bin/python
# Classification (U)
"""Program: repair_db.py
Description: Unit testing of repair_db in mongo_db_admin.py.
Usage:
test/unit/mongo_db_admin/repair_db.py
Arguments:
"""
# Libraries ... | code_fim | hard | {
"lang": "python",
"repo": "deepcoder42/mongo-db-admin",
"path": "/test/unit/mongo_db_admin/repair_db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: programaker-project/programaker-gitlab-bridge path: /bin/programaker-gitlab-service
#!/usr/bin/env python3
import logging
import json
from programaker_bridge import (
ProgramakerBridge,
BlockArgument,
BlockContext,
CallbackBlockArgument,
VariableBlockArgument,
FormBasedSe... | code_fim | hard | {
"lang": "python",
"repo": "programaker-project/programaker-gitlab-bridge",
"path": "/bin/programaker-gitlab-service",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@bridge.getter(
id="is_issue_open",
message="Is issue %1 open?",
arguments=[BlockArgument(str, "Add here an issue variable")],
block_result_type=bool,
)
def is_issue_open(issue_pointer, extra_data):
return _get_issue_property(
issue_pointer, extra_data, lambda issue: issue.att... | code_fim | hard | {
"lang": "python",
"repo": "programaker-project/programaker-gitlab-bridge",
"path": "/bin/programaker-gitlab-service",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if parsed.d is not None:
kwargs['dest_path'] = parsed.d
if parsed.debug:
kwargs['use_logging'] = logging.DEBUG
try:
deflacue = Deflacue(**kwargs)
if not deflacue.sox_check_is_available():
raise DeflacueError(
'SoX seems not availab... | code_fim | medium | {
"lang": "python",
"repo": "idlesign/deflacue",
"path": "/deflacue/cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: idlesign/deflacue path: /deflacue/cli.py
import argparse
import logging
from .deflacue import Deflacue, DeflacueError
def main():
argparser = argparse.ArgumentParser('deflacue')
argparser.add_argument(
'source_path', help='Absolute or relative source path with .cue file(s).')... | code_fim | hard | {
"lang": "python",
"repo": "idlesign/deflacue",
"path": "/deflacue/cli.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "adding event on EV_DELETING"
sobj.event_callback_priority_add(EoBase.DEL, 0, _o_cb_del)
print "adding event on CHANGING"
sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding event on EV_ADDING"
sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, _o_cb_add)
pr... | code_fim | hard | {
"lang": "python",
"repo": "yakov-g/eo_bindings",
"path": "/examples/signal_test.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "adding 2 events on EV_DELETING"
sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
print "adding event on CHANGING"
sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding 2nd event o... | code_fim | hard | {
"lang": "python",
"repo": "yakov-g/eo_bindings",
"path": "/examples/signal_test.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yakov-g/eo_bindings path: /examples/signal_test.py
# -*- coding: UTF-8 -*-
from eoeoeo.eodefault import *#for CALLBACK_STOP
from eoeoeo.eobase import EoBase
from eoeoeo.signals_py import Simple
def cb_del(o, d):
print "OBJECT DELETED"
_o_cb_del = (cb_del, None)
def cb_free(o, d):
print "O... | code_fim | hard | {
"lang": "python",
"repo": "yakov-g/eo_bindings",
"path": "/examples/signal_test.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ---
post:
description: Migrate a project.
requestBody:
content:
application/json:
schema: ProjectMigrateRequest
responses:
200:
description: Migration status.
content:
application/json:
schema: Pr... | code_fim | hard | {
"lang": "python",
"repo": "code-inflation/renku-python",
"path": "/renku/service/views/cache.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: code-inflation/renku-python path: /renku/service/views/cache.py
# -*- coding: utf-8 -*-
#
# Copyright 2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Ap... | code_fim | hard | {
"lang": "python",
"repo": "code-inflation/renku-python",
"path": "/renku/service/views/cache.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ---
get:
description: List cached projects.
responses:
200:
description: List of cached projects.
content:
application/json:
schema: ProjectListResponseRPC
tags:
- cache
"""
return ListProjectsCtrl(cache, user_... | code_fim | hard | {
"lang": "python",
"repo": "code-inflation/renku-python",
"path": "/renku/service/views/cache.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Moneda(models.Model):
codigo = models.IntegerField(unique=True)
nombre = models.CharField(unique=True, max_length=10)
simbolo = models.CharField(unique=True, max_length=5)
class Meta:
verbose_name = "Moneda"
verbose_name_plural = "Monedas"
def __str__(self):
... | code_fim | medium | {
"lang": "python",
"repo": "upeu-jul-20161-epis-ads2/americas",
"path": "/apps/cobranza/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return self.nombre
S = 'SI'
N = 'NO'
COBRANZA_INTERES_CHOICES = (
(S, 'SI'),
(N, 'NO'),
)
class Moneda(models.Model):
codigo = models.IntegerField(unique=True)
nombre = models.CharField(unique=True, max_length=10)
simbolo = models.CharField(unique=Tru... | code_fim | medium | {
"lang": "python",
"repo": "upeu-jul-20161-epis-ads2/americas",
"path": "/apps/cobranza/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: upeu-jul-20161-epis-ads2/americas path: /apps/cobranza/models.py
from django.db import models
# from django.utils.translation import ugettext_lazy as _
# from django.utils.text import capfirst, get_text_list
# from unicodedata import normalize
class Concepto(models.Model):
codigo = models.... | code_fim | hard | {
"lang": "python",
"repo": "upeu-jul-20161-epis-ads2/americas",
"path": "/apps/cobranza/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# @lc code=end<|fim_prefix|># repo: ApocalypseMac/LeetCode path: /Code/py3/1017.负二进制转换.py
#
# @lc app=leetcode.cn id=1017 lang=python3
#
# [1017] 负二进制转换
#
<|fim_middle|># @lc code=start
class Solution:
def baseNeg2(self, N: int) -> str:
res = ""
while N:
... | code_fim | hard | {
"lang": "python",
"repo": "ApocalypseMac/LeetCode",
"path": "/Code/py3/1017.负二进制转换.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ApocalypseMac/LeetCode path: /Code/py3/1017.负二进制转换.py
#
# @lc app=leetcode.cn id=1017 lang=python3
#
# [1017] 负二进制转换
#
<|fim_suffix|> def baseNeg2(self, N: int) -> str:
res = ""
while N:
res += str(N & 1)
N = -(N // 2)
#print(N)
if r... | code_fim | easy | {
"lang": "python",
"repo": "ApocalypseMac/LeetCode",
"path": "/Code/py3/1017.负二进制转换.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "service %s was called" % req["SvrNo"]
conn = sqlite3.connect("test.db")
conn.execute("update test set id=id+1")
conn.commit()
cur = conn.cursor()
cur.execute("select id from test")
res = cur.fetchone()
rsp["Id"] = res['id'];
cur.close()
conn.close()
rsp[... | code_fim | easy | {
"lang": "python",
"repo": "wonderocean/pysvr_framework",
"path": "/SqlSvr.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.