text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ggaurav10/bcc-tools-REST path: /bccrest.py
from flask import Flask, request
from os import remove
from time import sleep
import subprocess, sys
#from flask import send_file
from flask_restful import reqparse, abort, Api, Resource
from cachetop import cachetopUtil
from vfsstat import vfsstatUtil
f... | code_fim | hard | {
"lang": "python",
"repo": "ggaurav10/bcc-tools-REST",
"path": "/bccrest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if secure is not False:
url = "https+insecure://%s:%s/debug/pprof/%s" % (ip, port, endpoint)
else:
url = "http://%s:%s/debug/pprof/%s" % (ip, port, endpoint)
file = open("goproOut", "w+")
output = subprocess.check_output(["/usr/local/go/bin/go", "tool", "pprof", "-%s" % fmt, "-seconds", "%s"... | code_fim | hard | {
"lang": "python",
"repo": "ggaurav10/bcc-tools-REST",
"path": "/bccrest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = 2
while x * i <= a[-1]:
ac[x * i] = 0
i += 1
print(sum(ac))<|fim_prefix|># repo: stdiorion/competitive-programming path: /contests_atcoder/abc170/abc170_d.py
n = int(input())
a = list(map(int, input().split()))
ac = [0] * 1000001
for x in a:
ac[x] += 1
<|fim_middle|>a.s... | code_fim | medium | {
"lang": "python",
"repo": "stdiorion/competitive-programming",
"path": "/contests_atcoder/abc170/abc170_d.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stdiorion/competitive-programming path: /contests_atcoder/abc170/abc170_d.py
n = int(input())
a = list(map(int, input().split()))
ac = [0] * 1000001
for x in a:
ac[x] += 1
a.sort()
<|fim_suffix|> i = 2
while x * i <= a[-1]:
ac[x * i] = 0
i += 1
print(sum(ac))<|fim_m... | code_fim | medium | {
"lang": "python",
"repo": "stdiorion/competitive-programming",
"path": "/contests_atcoder/abc170/abc170_d.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jmallone/CompiladorTPP path: /BCC__BCC36B__P[1]__Michel_1858351/implementacao/lex.py
# -*- coding: utf-8 -*-
chave = 0
import ply.lex as lex
import sys
import re
tokens = (
'NUM_INTEIRO',
'MAIS',
'MENOS',
'MULTIPLICACAO',
'DIVISAO',
'DOIS_PONTOS',
'VIRGULA',
'MENOR',
'MAIOR',
'IGUAL',
'DIFERENTE... | code_fim | hard | {
"lang": "python",
"repo": "Jmallone/CompiladorTPP",
"path": "/BCC__BCC36B__P[1]__Michel_1858351/implementacao/lex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r"\n+"
t.lexer.lineno += len(t.value)
def t_error(token):
line = token.lineno
message ="Caracter inválido '%s'" % token.value[0]
print(message)
token.lexer.skip(1)
lexer = lex.lex()
def proxToken(data):
lexer.input(data)
while True:
tok = lexer.token()
if no... | code_fim | hard | {
"lang": "python",
"repo": "Jmallone/CompiladorTPP",
"path": "/BCC__BCC36B__P[1]__Michel_1858351/implementacao/lex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ipv1337/flask-orator path: /flask_orator/__init__.py
# -*- coding: utf-8 -*-
from flask import current_app, request, jsonify as base_jsonify, Response
from orator import DatabaseManager, Model as BaseModel
from orator.pagination import Paginator, LengthAwarePaginator
from orator.commands.migrati... | code_fim | hard | {
"lang": "python",
"repo": "ipv1337/flask-orator",
"path": "/flask_orator/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def init_commands(self, app):
self.cli = Application(orator_application.get_name(),
orator_application.get_version())
self.cli.add(InstallCommand(self))
self.cli.add(MigrateCommand(self))
self.cli.add(MigrateMakeCommand(self))
... | code_fim | hard | {
"lang": "python",
"repo": "ipv1337/flask-orator",
"path": "/flask_orator/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hasattr(obj, 'to_json'):
response = Response(obj.to_json(indent=indent),
mimetype='application/json',
**kwargs)
elif isinstance(obj, list):
response = Response(json.dumps(obj, indent=indent),
mim... | code_fim | hard | {
"lang": "python",
"repo": "ipv1337/flask-orator",
"path": "/flask_orator/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twindb/backup path: /twindb_backup/exporter/exceptions.py
"""
Module for exporters exceptions.
"""
from twindb_backup.exceptions import TwinDBBackupError
class BaseExporterError(TwinDBBackupError):
<|fim_suffix|>
class StatsdExporterError(BaseExporterError):
"""Statsd exporters error"""
... | code_fim | medium | {
"lang": "python",
"repo": "twindb/backup",
"path": "/twindb_backup/exporter/exceptions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Statsd exporters error"""
pass<|fim_prefix|># repo: twindb/backup path: /twindb_backup/exporter/exceptions.py
"""
Module for exporters exceptions.
"""
from twindb_backup.exceptions import TwinDBBackupError
class BaseExporterError(TwinDBBackupError):
<|fim_middle|> """General exporters er... | code_fim | medium | {
"lang": "python",
"repo": "twindb/backup",
"path": "/twindb_backup/exporter/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>IDValueMap_cfi import *
hgcalPhotonIDValueMap.dEdXWeights = dEdX_weights<|fim_prefix|># repo: cecilecaillol/cmssw path: /RecoEgamma/EgammaTools/python/hgcalPhotonIDValueMap_cff.py
import FWCore.ParameterSet.Config as cms
from RecoLocalCalo.HGCalRecPro<|fim_middle|>ducers.HGCalRecHit_cfi import dEdX_weigh... | code_fim | medium | {
"lang": "python",
"repo": "cecilecaillol/cmssw",
"path": "/RecoEgamma/EgammaTools/python/hgcalPhotonIDValueMap_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cecilecaillol/cmssw path: /RecoEgamma/EgammaTools/python/hgcalPhotonIDValueMap_cff.py
import FWCore.ParameterSet.Config as cms
from RecoLocalCalo.HGCalRecPro<|fim_suffix|>IDValueMap_cfi import *
hgcalPhotonIDValueMap.dEdXWeights = dEdX_weights<|fim_middle|>ducers.HGCalRecHit_cfi import dEdX_weigh... | code_fim | medium | {
"lang": "python",
"repo": "cecilecaillol/cmssw",
"path": "/RecoEgamma/EgammaTools/python/hgcalPhotonIDValueMap_cff.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuangCongQing/mmdetection3d-note path: /mmdet3d/core/anchor/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from mmdet.core.anchor import build_anchor_generator
from .anc<|fim_suffix|>GeneratorPerCls,
Anchor3DRangeGenerator)
__all__ = [
'AlignedA... | code_fim | hard | {
"lang": "python",
"repo": "HuangCongQing/mmdetection3d-note",
"path": "/mmdet3d/core/anchor/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ngeGenerator', 'Anchor3DRangeGenerator',
'build_anchor_generator', 'AlignedAnchor3DRangeGeneratorPerCls'
]<|fim_prefix|># repo: HuangCongQing/mmdetection3d-note path: /mmdet3d/core/anchor/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from mmdet.core.anchor import build_anchor_generator
... | code_fim | hard | {
"lang": "python",
"repo": "HuangCongQing/mmdetection3d-note",
"path": "/mmdet3d/core/anchor/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return el
def random_series(start=0, end=1, seed=0, count=5000):
rnd = Random()
rnd.seed(seed)
rnds = []
for x in range(count):
rnds.append(start+rnd.random()*(end-start))
return rnds
def show_points(pen, style, offcurves=True, filter=lambda i: True):
pt_labels = DATP... | code_fim | medium | {
"lang": "python",
"repo": "beesandbombs/coldtype",
"path": "/coldtype/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def random_series(start=0, end=1, seed=0, count=5000):
rnd = Random()
rnd.seed(seed)
rnds = []
for x in range(count):
rnds.append(start+rnd.random()*(end-start))
return rnds
def show_points(pen, style, offcurves=True, filter=lambda i: True):
pt_labels = DATPenSet()
if ... | code_fim | hard | {
"lang": "python",
"repo": "beesandbombs/coldtype",
"path": "/coldtype/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beesandbombs/coldtype path: /coldtype/helpers.py
from pathlib import Path
from defcon import Font as DefconFont
from coldtype.text.reader import normalize_font_path, StyledString
from coldtype.pens.datpen import DATPenSet
from coldtype.interpolation import norm, interp_dict
from random import Ran... | code_fim | medium | {
"lang": "python",
"repo": "beesandbombs/coldtype",
"path": "/coldtype/helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hjkuijf/MixLacune path: /process.py
import SimpleITK
import numpy as np
from evalutils import SegmentationAlgorithm
from evalutils.validators import UniqueImagesValidator
# added imports
#import tensorflow as tf
from typing import Tuple, List
from pathlib import Path
import re
import subproce... | code_fim | hard | {
"lang": "python",
"repo": "hjkuijf/MixLacune",
"path": "/process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("==> Running prediction")
# Process-lacunes.py assumes images are in a sub-folder and the first seven characters are the subject ID
for i in range(len(self.input_modalities)):
SimpleITK.WriteImage(input_images[i], '/home/input_data/lacunes/lacunes_'+self.... | code_fim | hard | {
"lang": "python",
"repo": "hjkuijf/MixLacune",
"path": "/process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebi06/BioFormatsRead path: /test_getPixelsPlanes.py
# -*- coding: utf-8 -*-
"""
File: test_getPixelsPlanes.py
Date: 18.04.2017
Version. 0.2
"""
import bftools as bf
filename = r'testdata/B4_B5_S=8_4Pos_perWell_T=2_Z=1_CH=1.czi'
# use for BioFormtas <= 5.1.10
#urlnamespace = 'http://www.openm... | code_fim | medium | {
"lang": "python",
"repo": "sebi06/BioFormatsRead",
"path": "/test_getPixelsPlanes.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>planes, pixels = bf.getPlanesAndPixelsFromCZI(filename)
print("=== Planes ===")
print(planes)
print("==== Pixels ===")
print(pixels)<|fim_prefix|># repo: sebi06/BioFormatsRead path: /test_getPixelsPlanes.py
# -*- coding: utf-8 -*-
"""
File: test_getPixelsPlanes.py
Date: 18.04.2017
Version. 0.2
"""
imp... | code_fim | hard | {
"lang": "python",
"repo": "sebi06/BioFormatsRead",
"path": "/test_getPixelsPlanes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ConnectionHandler(BaseConnectionHandler[BaseDatabaseWrapper]):
@property
def databases(self) -> dict[str, dict[str, Any]]: ...
def ensure_defaults(self, alias: str) -> None: ...
def prepare_test_settings(self, alias: str) -> None: ...
def create_connection(self, alias: str) -> Ba... | code_fim | hard | {
"lang": "python",
"repo": "typeddjango/django-stubs",
"path": "/django-stubs/db/utils.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: typeddjango/django-stubs path: /django-stubs/db/utils.pyi
from collections.abc import Iterable
from types import TracebackType
from typing import Any
from django.apps import AppConfig
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import Model
from django.util... | code_fim | medium | {
"lang": "python",
"repo": "typeddjango/django-stubs",
"path": "/django-stubs/db/utils.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ConnectionRouter:
def __init__(self, routers: Iterable[Any] | None = ...) -> None: ...
@property
def routers(self) -> list[Any]: ...
def db_for_read(self, model: type[Model], **hints: Any) -> str: ...
def db_for_write(self, model: type[Model], **hints: Any) -> str: ...
def al... | code_fim | hard | {
"lang": "python",
"repo": "typeddjango/django-stubs",
"path": "/django-stubs/db/utils.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> trees = {}
for contig, grp in itertools.groupby(genes, lambda r: r['contig']):
# Build a tree for each individual chromosome.
intervals = ((g['start'], g['end'], dict(g)) for g in grp
if g['end'] > g['start']) # Avoid null intervals.
trees[contig] = In... | code_fim | hard | {
"lang": "python",
"repo": "rajithbt/pyim",
"path": "/src/pyim/annotate/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Converts strand to its numeric (integer) representation."""
if isinstance(strand, int):
return strand
elif isinstance(strand, (float, np.generic)):
return int(strand)
elif isinstance(strand, str):
if strand == '+':
return 1
elif strand == '-'... | code_fim | hard | {
"lang": "python",
"repo": "rajithbt/pyim",
"path": "/src/pyim/annotate/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajithbt/pyim path: /src/pyim/annotate/util.py
import itertools
from pathlib import Path
from intervaltree import IntervalTree
import numpy as np
from pyim.util.tabix import GtfFile
def build_interval_trees(reference_gtf):
"""Builds an interval tree of genes for each chromosome in gtf."""... | code_fim | hard | {
"lang": "python",
"repo": "rajithbt/pyim",
"path": "/src/pyim/annotate/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wagtail/wagtail path: /wagtail/admin/views/pages/usage.py
from typing import Any, Dict
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.urls import reverse
from django.utils.translation impo... | code_fim | hard | {
"lang": "python",
"repo": "wagtail/wagtail",
"path": "/wagtail/admin/views/pages/usage.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.page_class.objects.all().specific(defer=True)
def get_index_url(self):
return reverse(
"wagtailadmin_pages:type_use",
args=[
self.kwargs["content_type_app_name"],
self.kwargs["content_type_model_name"],
],... | code_fim | hard | {
"lang": "python",
"repo": "wagtail/wagtail",
"path": "/wagtail/admin/views/pages/usage.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vsoftco/pytexnumber path: /pytexnumber.py
#!/usr/bin/env python3
# pytexnumber.py
#
# Renumbers LaTeX references
#
# Type python3 pytexnumber.py --help for help
# Copyright (c) 2013 - 2023 Vlad Gheorghiu. All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to ... | code_fim | hard | {
"lang": "python",
"repo": "vsoftco/pytexnumber",
"path": "/pytexnumber.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # display warnings
original_stdout = sys.stdout
sys.stdout = sys.stderr
if label_warnings or reference_warnings:
if reference_warnings:
print('PARSING WARNING: Undefined references')
for [item, row, col] in reference_warnings:
... | code_fim | hard | {
"lang": "python",
"repo": "vsoftco/pytexnumber",
"path": "/pytexnumber.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pattern = args.pattern # pattern to replace
replacement = args.replacement # replacement
ignore_comments = args.comments # ignore LaTeX comments
keywords = ['label', 'eqref', 'ref', 'pageref'] # modify as needed
try:
# process the stream
with sys.stdin as f_in, sy... | code_fim | hard | {
"lang": "python",
"repo": "vsoftco/pytexnumber",
"path": "/pytexnumber.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
main(sys.argv)<|fim_prefix|># repo: peripitus-iot/neopo path: /neopo/__main__.py
# neopo: A lightweight solution for local Particle development.
# Copyright (c) 2021 Nathan Robinson.
# https://neopo.xyz
<|fim_middle|>import sys
from .command import main
| code_fim | easy | {
"lang": "python",
"repo": "peripitus-iot/neopo",
"path": "/neopo/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peripitus-iot/neopo path: /neopo/__main__.py
# neopo: A lightweight solution for local Particle development.
# Copyright (c) 2021 Nathan Robinson.
# https://neopo.xyz
<|fim_suffix|>if __name__ == "__main__":
main(sys.argv)<|fim_middle|>import sys
from .command import main
| code_fim | easy | {
"lang": "python",
"repo": "peripitus-iot/neopo",
"path": "/neopo/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisxue815/leetcode_python path: /problems/test_0405.py
import unittest
class Solution:
def toHex(self, num):
"""
:type num: int
:rtype: str
"""
if num == 0:
return '0'
result = []
for i in range(8):
if num ==... | code_fim | medium | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0405.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> actual = Solution().toHex(num)
self.assertEqual(expected, actual)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: chrisxue815/leetcode_python path: /problems/test_0405.py
import unittest
class Solution:
def toHex(self, num):
"""
:type num: int
... | code_fim | medium | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0405.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.running = False
def forward(self, state_dict: Dict[str, torch.Tensor]):
joint_pos_current = state_dict["joint_pos"]
joint_vel_current = state_dict["joint_vel"]
# Set reference joint position
if not self.running:
self.joint_pos_desired[:] = joi... | code_fim | medium | {
"lang": "python",
"repo": "facebookresearch/polymetis",
"path": "/polymetis/python/torchcontrol/policies/default_controller.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/polymetis path: /polymetis/python/torchcontrol/policies/default_controller.py
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict
<... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/polymetis",
"path": "/polymetis/python/torchcontrol/policies/default_controller.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.errorhandler(400)
def page_not_found(error):
content = json.dumps({"error_code": "400"})
resp = Response_headers(content)
return resp
@app.errorhandler(410)
def page_not_found(error):
content = json.dumps({"error_code": "410"})
resp = Response_headers(content)
return resp
... | code_fim | hard | {
"lang": "python",
"repo": "RealForce1024/flask-echarts",
"path": "/app4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> content = json.dumps({"error_code": "403"})
resp = Response_headers(content)
return resp
@app.errorhandler(404)
def page_not_found(error):
content = json.dumps({"error_code": "404"})
resp = Response_headers(content)
return resp
@app.errorhandler(400)
def page_not_found(error):
... | code_fim | hard | {
"lang": "python",
"repo": "RealForce1024/flask-echarts",
"path": "/app4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RealForce1024/flask-echarts path: /app4.py
# -*- coding: utf-8 -*-
#__author__="ZJL"
from flask import Flask
from flask import request
from flask import Response
import json
app = Flask(__name__)
def Response_headers(content):
resp = Response(content)
resp.headers['Access-Control-All... | code_fim | hard | {
"lang": "python",
"repo": "RealForce1024/flask-echarts",
"path": "/app4.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>encode())
message = socket.recv()
print("Received reply %s [%s]" % (request, message))<|fim_prefix|># repo: ydf0509/distributed_framework path: /test_frame/other_tests/test_zeromq/test_zeromq_client.py
import zmq,time
# Prepare our context and sockets
context = zmq.Context()
socket = context.so... | code_fim | medium | {
"lang": "python",
"repo": "ydf0509/distributed_framework",
"path": "/test_frame/other_tests/test_zeromq/test_zeromq_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ydf0509/distributed_framework path: /test_frame/other_tests/test_zeromq/test_zeromq_client.py
import zmq,time
# Prepare our context and sockets
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5559")
# Do 10 requests, waiting each time fo<|fim_suffix|>e... | code_fim | medium | {
"lang": "python",
"repo": "ydf0509/distributed_framework",
"path": "/test_frame/other_tests/test_zeromq/test_zeromq_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Micseb/Hands-On-Artificial-Intelligence-for-Banking path: /Chapter04/4A_WACC/4A_WACC_Optimization_for_Corp.py
rdate='2007-6-30', ticker=tkr,dimension='MRQ')
record_db_t_2007Q3=quandl.get_table('SHARADAR/SF1', calendardate='2007-9-30', ticker=tkr,dimension='MRQ')
record_db_t_2007Q4=quandl.get_tabl... | code_fim | hard | {
"lang": "python",
"repo": "Micseb/Hands-On-Artificial-Intelligence-for-Banking",
"path": "/Chapter04/4A_WACC/4A_WACC_Optimization_for_Corp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''*************************************
2B. Cost of Debt Formula
'''
print('existing rating')
#Existing Ratios
#the ratio below may not match 100% the fields chosen in 3A due to different data sources
#in real setting, ensure the fields are exactly the same. However for demo purpose, we use prox
r1= reco... | code_fim | hard | {
"lang": "python",
"repo": "Micseb/Hands-On-Artificial-Intelligence-for-Banking",
"path": "/Chapter04/4A_WACC/4A_WACC_Optimization_for_Corp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num = int(num[0])
if num < 2 or num > 9:
print('NUM ({}) must be between 1 and 9'.format(num))
sys.exit(1)
for i in range(1, num ** 2 + 1):
if i % num == 0:
print('{:3}\n'.format(i), end='')
else:
print('{:3}'.format(i), end='')
# --------... | code_fim | hard | {
"lang": "python",
"repo": "ssteiche/biosys-analytics",
"path": "/assignments/03-python-grad/grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(1, num ** 2 + 1):
if i % num == 0:
print('{:3}\n'.format(i), end='')
else:
print('{:3}'.format(i), end='')
# --------------------------------------------------
main()<|fim_prefix|># repo: ssteiche/biosys-analytics path: /assignments/03-python-grad/... | code_fim | hard | {
"lang": "python",
"repo": "ssteiche/biosys-analytics",
"path": "/assignments/03-python-grad/grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ssteiche/biosys-analytics path: /assignments/03-python-grad/grid.py
#!/usr/bin/env python3
"""
Author : ssteiche
Date : 2019-02-04
Purpose: Create square grid of a given length
"""
import os
import sys
<|fim_suffix|> num = int(num[0])
if num < 2 or num > 9:
print('NUM ({}) mu... | code_fim | hard | {
"lang": "python",
"repo": "ssteiche/biosys-analytics",
"path": "/assignments/03-python-grad/grid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davtalab/TigerControl path: /tigercontrol/utils/optimizers/ons.py
'''
Newton Step optimizer
'''
from tigercontrol.utils.optimizers.core import Optimizer
from tigercontrol.utils.optimizers.losses import mse
from tigercontrol import error
from jax import jit, grad
import jax.numpy as np
# regular... | code_fim | hard | {
"lang": "python",
"repo": "davtalab/TigerControl",
"path": "/tigercontrol/utils/optimizers/ons.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # partial_update automatically reshapes flat_grad into correct params shape
new_values = [self.partial_update(A, Ainv, g, w) for (A, Ainv, g, w) in zip(self.A, self.Ainv, flat_grad, params)]
self.A, self.Ainv, new_grad = list(map(list, zip(*new_values)))
new_params = [w - ... | code_fim | hard | {
"lang": "python",
"repo": "davtalab/TigerControl",
"path": "/tigercontrol/utils/optimizers/ons.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rule_runner.add_to_build_file(
"project/image/test",
dedent(
"""\
docker_image(name="image")
"""
),
)
rule_runner.create_file(
"project/image/test/Dockerfile",
dedent(
"""\
FROM baseimage
... | code_fim | medium | {
"lang": "python",
"repo": "akk5597/pants",
"path": "/src/python/pants/backend/docker/util_rules/dependencies_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akk5597/pants path: /src/python/pants/backend/docker/util_rules/dependencies_test.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from textwrap import dedent
import pytest
from pants.backend.docker.subsystems... | code_fim | medium | {
"lang": "python",
"repo": "akk5597/pants",
"path": "/src/python/pants/backend/docker/util_rules/dependencies_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manu-tej/Fish_counter path: /Misc/cluster_im.py
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import umap
import seaborn as sns
import csv
sns.set(style='white', context='poster')
with open('labels.csv', mode='r') as infile:
reader = csv.read... | code_fim | hard | {
"lang": "python",
"repo": "manu-tej/Fish_counter",
"path": "/Misc/cluster_im.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>colori = {'b':'blue', 'c':'green', 'f':'black', 'm':'orange', 'o':'cyan', 'p':'red', 'r':'yellow'}
conver = {'b':1, 'c':0, 'f':3, 'm':4, 'o':5, 'p':6, 'r':7}
classes = ['build multiple', 'scoop', 'feed spit', 'feed multiple', 'other', 'build spit', 'spit-run']
for i in range(1,200):
print(vid_list[i]... | code_fim | hard | {
"lang": "python",
"repo": "manu-tej/Fish_counter",
"path": "/Misc/cluster_im.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class InvalidEmailError(UserError):
pass<|fim_prefix|># repo: yohncf/price-catcher path: /src/models/users/errors.py
__author__ = 'YohnCF'
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotExistError(UserError):
pass
class In... | code_fim | easy | {
"lang": "python",
"repo": "yohncf/price-catcher",
"path": "/src/models/users/errors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserAlreadyRegister(UserError):
pass
class InvalidEmailError(UserError):
pass<|fim_prefix|># repo: yohncf/price-catcher path: /src/models/users/errors.py
__author__ = 'YohnCF'
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotExis... | code_fim | easy | {
"lang": "python",
"repo": "yohncf/price-catcher",
"path": "/src/models/users/errors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yohncf/price-catcher path: /src/models/users/errors.py
__author__ = 'YohnCF'
class UserError(Exception):
def __init__(self, message):
self.message = message
<|fim_suffix|> pass
class UserAlreadyRegister(UserError):
pass
class InvalidEmailError(UserError):
pass<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "yohncf/price-catcher",
"path": "/src/models/users/errors.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: group14BSE1/BSE-2021 path: /src/Chapter3/Exercise1.py
# Ask for the number of hours worked
hours_wkd = int(input("Enter the number of hours worked:"))
<|fim_suffix|># for hours above 40 ; the rate entered is multiplied by 1.5
# The product of that multiplication is used to calculate the gross pa... | code_fim | medium | {
"lang": "python",
"repo": "group14BSE1/BSE-2021",
"path": "/src/Chapter3/Exercise1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># for hours above 40 ; the rate entered is multiplied by 1.5
# The product of that multiplication is used to calculate the gross pay
if hours_wkd > 40:
rate_new = 1.5 * rate_hr
gross_pay = hours_wkd * rate_new
print("Pay:", gross_pay)
else:
# If the hours are below or equal to 40 the enter... | code_fim | medium | {
"lang": "python",
"repo": "group14BSE1/BSE-2021",
"path": "/src/Chapter3/Exercise1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lpfann/fri path: /fri/model/base_lupi.py
from abc import abstractmethod
from .base_cvxproblem import Relevance_CVXProblem
class LUPI_Relevance_CVXProblem(Relevance_CVXProblem):
def __init__(
self,
current_feature: int,
data: tuple,
hyperparameters,
b... | code_fim | hard | {
"lang": "python",
"repo": "lpfann/fri",
"path": "/fri/model/base_lupi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def split_dataset(X_combined, lupi_features):
assert X_combined.shape[1] > lupi_features
X = X_combined[:, :-lupi_features]
X_priv = X_combined[:, -lupi_features:]
return X, X_priv
def is_lupi_feature(di, data, best_model_state):
lupi_features = best_model_state["lupi_features"]
... | code_fim | hard | {
"lang": "python",
"repo": "lpfann/fri",
"path": "/fri/model/base_lupi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dav009/discoursegraphs path: /src/discoursegraphs/readwrite/paulaxml/paula.py
1.1">
<header paula_id="nolayer.maz-1423.tok"/>
<markList xmlns:xlink="http://www.w3.org/1999/xlink" type="tok"
xml:base="maz-1423.text.xml">
<mark id="sTok1"
... | code_fim | hard | {
"lang": "python",
"repo": "dav009/discoursegraphs",
"path": "/src/discoursegraphs/readwrite/paulaxml/paula.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> base_paula_id = self.paulamap['hierarchy'][top_level_layer]
mflist = E('multiFeatList',
{XMLBASE: base_paula_id+'.xml'})
for node_id in select_nodes_by_layer(self.dg, top_level_layer):
if not istoken(self.dg, node_id):
mfeat = E('mult... | code_fim | hard | {
"lang": "python",
"repo": "dav009/discoursegraphs",
"path": "/src/discoursegraphs/readwrite/paulaxml/paula.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dominance_edges = select_edges_by(
self.dg, layer=top_level_layer,
edge_type=EdgeTypes.dominance_relation, data=True)
dominance_dict = defaultdict(lambda: defaultdict(str))
for source_id, target_id, edge_attrs in dominance_edges:
if source_id != ... | code_fim | hard | {
"lang": "python",
"repo": "dav009/discoursegraphs",
"path": "/src/discoursegraphs/readwrite/paulaxml/paula.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Charles0313/crawlerUtils path: /crawlerUtils/captcha/recognizeCaptchaMain.py
from .captchaTestSetCreate import createTestSet, cropImage, CAPTCHA_SET_PATH
from .captchaRecognizeMain import longitudinalSplit, CAPTCHA_SET, captchaImageBinary
import math
from PIL import Image
import os
import numpy a... | code_fim | hard | {
"lang": "python",
"repo": "Charles0313/crawlerUtils",
"path": "/crawlerUtils/captcha/recognizeCaptchaMain.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> imageset.append({letter: temp})
letters = longitudinalSplit(binary_object)
image_objects = cropImage(
binary_object, letters, extension="jpeg", dir_path=dir_path, captcha_name="captcha_binary")
count = 0
result = []
for test_object in image_objects:
guess ... | code_fim | hard | {
"lang": "python",
"repo": "Charles0313/crawlerUtils",
"path": "/crawlerUtils/captcha/recognizeCaptchaMain.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """check whether the word light or lights appear in the text
or not and return the given bool val accordingly
"""
return bool(re.search(r'\blight|lights\b', text, re.IGNORECASE))<|fim_prefix|># repo: subhamjodha/Aaron-IOT path: /client/query_modules/light_module.py
# This module controls ... | code_fim | medium | {
"lang": "python",
"repo": "subhamjodha/Aaron-IOT",
"path": "/client/query_modules/light_module.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: subhamjodha/Aaron-IOT path: /client/query_modules/light_module.py
# This module controls the light related commands
import re
def handle(text, audio):
"""This function has to handle the turning on or off the lights
If the lights are turned on , then turn off should occur and vise versa
... | code_fim | medium | {
"lang": "python",
"repo": "subhamjodha/Aaron-IOT",
"path": "/client/query_modules/light_module.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> k = list(render.keys())[0].lower()
if "videorender" in k:
v = list(render.values())[0]
if "LIVE_NOW" in v.get('badges', [{}])[0].get('metadataBadgeRenderer', {}).get("style", ""):
continue
v... | code_fim | hard | {
"lang": "python",
"repo": "Ristellise/Negai",
"path": "/AsyncInnerTube.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ristellise/Negai path: /AsyncInnerTube.py
ary for python.
"""
import collections.abc
import json
import logging
import math
import urllib.parse
import aiohttp
from protox import Message, String, Int32
from Negai import fsDownloader, utils
def rup(d, u):
for k, v in u.items():
if ... | code_fim | hard | {
"lang": "python",
"repo": "Ristellise/Negai",
"path": "/AsyncInnerTube.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ristellise/Negai path: /AsyncInnerTube.py
ort collections.abc
import json
import logging
import math
import urllib.parse
import aiohttp
from protox import Message, String, Int32
from Negai import fsDownloader, utils
def rup(d, u):
for k, v in u.items():
if isinstance(v, collection... | code_fim | hard | {
"lang": "python",
"repo": "Ristellise/Negai",
"path": "/AsyncInnerTube.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> ],
spacing = 1,
separator = "-",
separator_color = colors.foreground["cyan"]
)
result = cli.launch()
cli.summarize()<|fim_prefix|># repo: Cloudxtreme/bullet-1 path: /examples/prompt.py
from bullet import Bullet, VerticalPrompt, Check, Input, YesNo, Numbers
from bullet import styles
from b... | code_fim | medium | {
"lang": "python",
"repo": "Cloudxtreme/bullet-1",
"path": "/examples/prompt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cloudxtreme/bullet-1 path: /examples/prompt.py
from bullet import Bullet, VerticalPrompt, Check, Input, YesNo, Numbers
from bullet import styles
from bullet import colors
cli = VerticalPrompt(
[
YesNo("Are you a student? "),
Input("Who are you? "),
Numbers("How old ar... | code_fim | medium | {
"lang": "python",
"repo": "Cloudxtreme/bullet-1",
"path": "/examples/prompt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(iters):
jw = lossfunc(w0,w1,w2,w3,area,size,room,price) # comment when timing
w0 = w0 - rate * gradientcoef(w0,w1,w2,w3,area,size,room,price,1)
w1 = w1 - rate * gradientcoef(w0,w1,w2,w3,area,size,room,price,area)
w2 = w2 - rate * gradientcoef(w0,w1,w2,w3,area,size,room,price... | code_fim | hard | {
"lang": "python",
"repo": "pengyang486868/MachineClass",
"path": "/LessonMachineLearn.GradientDescent/LessonMachineLearn.GradientDescent/functest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pengyang486868/MachineClass path: /LessonMachineLearn.GradientDescent/LessonMachineLearn.GradientDescent/functest.py
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
global columnNames
def read():
#filename = 'housing.txt'
df = pd.DataFra... | code_fim | hard | {
"lang": "python",
"repo": "pengyang486868/MachineClass",
"path": "/LessonMachineLearn.GradientDescent/LessonMachineLearn.GradientDescent/functest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Spectra456/Face-Detection-and-Recognition path: /drawer.py
import cv2
def draw_label(image, point, label, font=cv2.FONT_HERSHEY_SIMPLEX,
font_scale=1, thickness=2):
size = cv2.getTextSize(label, font, font_scale, thickness)[0<|fim_suffix|>cv2.FILLED)
cv2.putText(image, lab... | code_fim | medium | {
"lang": "python",
"repo": "Spectra456/Face-Detection-and-Recognition",
"path": "/drawer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>cv2.FILLED)
cv2.putText(image, label, point, font, font_scale, (255, 255, 255), thickness)<|fim_prefix|># repo: Spectra456/Face-Detection-and-Recognition path: /drawer.py
import cv2
def draw_label(image, point, label, font=cv2.FONT_HERSHEY_SIMPLEX,
<|fim_middle|> font_scale=1, thicknes... | code_fim | medium | {
"lang": "python",
"repo": "Spectra456/Face-Detection-and-Recognition",
"path": "/drawer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>]
x, y = point
cv2.rectangle(image, (x, y - size[1]), (x + size[0], y), (255, 0, 0), cv2.FILLED)
cv2.putText(image, label, point, font, font_scale, (255, 255, 255), thickness)<|fim_prefix|># repo: Spectra456/Face-Detection-and-Recognition path: /drawer.py
import cv2
def draw_label(image, poi... | code_fim | medium | {
"lang": "python",
"repo": "Spectra456/Face-Detection-and-Recognition",
"path": "/drawer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dominik1123/click-inspect path: /src/click_inspect/parser.py
from __future__ import annotations
from collections import defaultdict
import inspect
from typing import Any, Container, DefaultDict, Dict
import warnings
from sphinx.ext.napoleon import Config, GoogleDocstring, NumpyDocstring # type... | code_fim | hard | {
"lang": "python",
"repo": "Dominik1123/click-inspect",
"path": "/src/click_inspect/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Raises:
UnsupportedDocstringStyle: If the given docstring contains no parameter section.
"""
if isinstance(obj, str):
doc, func = inspect.cleandoc(obj), None
else:
doc, func = inspect.getdoc(obj), obj # type: ignore
if doc is None:
return defaul... | code_fim | hard | {
"lang": "python",
"repo": "Dominik1123/click-inspect",
"path": "/src/click_inspect/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
obj (function or str): Parse the docstring from the given object.
ignore (set): Ignore the type hint string of those parameters.
Returns:
DefaultDict: Per parameter specification containing 'help' and 'type' (if provided).
Raises:
UnsupportedDocstringSty... | code_fim | hard | {
"lang": "python",
"repo": "Dominik1123/click-inspect",
"path": "/src/click_inspect/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> },
),
migrations.CreateModel(
name='Photograph',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', filebrowser.fields.FileBrowseField(max_length=200)),
... | code_fim | hard | {
"lang": "python",
"repo": "groundupnews/gu",
"path": "/gallery/migrations/0001_initial.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: groundupnews/gu path: /gallery/migrations/0001_initial.py
# Generated by Django 2.1.4 on 2018-12-10 16:18
from django.db import migrations, models
import django.db.models.deletion
import filebrowser.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
... | code_fim | hard | {
"lang": "python",
"repo": "groundupnews/gu",
"path": "/gallery/migrations/0001_initial.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: project-chip/connectedhomeip path: /src/controller/python/py_matter_yamltest_repl_adapter/matter_yamltest_repl_adapter/adapter.py
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | code_fim | hard | {
"lang": "python",
"repo": "project-chip/connectedhomeip",
"path": "/src/controller/python/py_matter_yamltest_repl_adapter/matter_yamltest_repl_adapter/adapter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Adapter(TestAdapter):
def __init__(self, specifications):
self._adapter = ReplTestRunner(specifications, None, None)
def encode(self, request):
return self._adapter.encode(request)
def decode(self, response):
# TODO We should provide more meaningful logs here, b... | code_fim | medium | {
"lang": "python",
"repo": "project-chip/connectedhomeip",
"path": "/src/controller/python/py_matter_yamltest_repl_adapter/matter_yamltest_repl_adapter/adapter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stevenyu113228/AIS3_2020_pre_Exam_Writeup path: /Reverse/Fallen_Beat/full.py
a = """1
0
0
0
28
0
0
14
0
0
28
0
0
14
0
0
1
12
6
24
6
24
12
24
6
0
1
0
0
18
0
0
1
6
24
12
24
6
12
6
0
12
6
0
17
0
6
12
24
6
24
6
24
6
12
6
0
12
6
0
17
0
6
12
24
0
0
0
12
0
0
3
0
0
3
0
0
17
0
0
17
0
10
0
20
0
0
9
0
0
9
0... | code_fim | hard | {
"lang": "python",
"repo": "stevenyu113228/AIS3_2020_pre_Exam_Writeup",
"path": "/Reverse/Fallen_Beat/full.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>max_val = 127
flag = [ 89, 74, 75, 43, 126, 69, 120, 109, 68, 109, 109, 97, 73, 110, 45, 113, 102, 64, 121, 47, 111, 119, 111, 71, 114, 125, 68, 105, max_val, 124 ,94, 103, 46, 107, 97, 104]
for i in range(len(a)):
# this.flag[i % this.flag.length] = (byte)(this.flag[i % this.flag.length] ^ ((Integ... | code_fim | hard | {
"lang": "python",
"repo": "stevenyu113228/AIS3_2020_pre_Exam_Writeup",
"path": "/Reverse/Fallen_Beat/full.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Convert to log-space
if log:
user = np.log10(arr)
else:
user = np.array(arr)
diff = np.diff(user, axis=axis)
# skip the last element, or the last axis
cut = sliceForAxis(user, axis=axis, stop=-1)
start = user[cut]
mids = start + frac*diff
if log... | code_fim | hard | {
"lang": "python",
"repo": "eunheeko/Illustris_LISA_paper",
"path": "/code/utils/evolve_lzk/zcode/zcode/math/math_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eunheeko/Illustris_LISA_paper path: /code/utils/evolve_lzk/zcode/zcode/math/math_core.py
indices of the input array which are within the given extrema.
"""
assert np.ndim(vals) == 1, "Only `ndim = 1` arrays allowed!"
bnds = minmax(extr)
if(edges):
inds = np.where((vals >=... | code_fim | hard | {
"lang": "python",
"repo": "eunheeko/Illustris_LISA_paper",
"path": "/code/utils/evolve_lzk/zcode/zcode/math/math_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eunheeko/Illustris_LISA_paper path: /code/utils/evolve_lzk/zcode/zcode/math/math_core.py
np.argmin
elif(type.startswith('max')):
func = np.argmax
# Find whether the `filter` criteria is True
if(filter):
filterFunc = _comparisonFunction(filter)
sel = filterFun... | code_fim | hard | {
"lang": "python",
"repo": "eunheeko/Illustris_LISA_paper",
"path": "/code/utils/evolve_lzk/zcode/zcode/math/math_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('-rd', '--rnn_dropout', type=float, default=0.,
help='dropout in rnn cells')
parser.add_argument('-ld', '--lin_dropout', type=float, default=0.,
help='dropout in final embedding mapper')
parser.add_argument('-b', '--batches'... | code_fim | hard | {
"lang": "python",
"repo": "JackeyWang777/Deep-Representations-of-Visual-Descriptions",
"path": "/crnns4captions/train_text_encoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JackeyWang777/Deep-Representations-of-Visual-Descriptions path: /crnns4captions/train_text_encoder.py
'''Train text encoder.'''
# pylint: disable=no-member
import os
import argparse
import torch
import torch.optim as optim
from crnns4captions.utils import CUBDatasetLazy, joint_embedding_loss,... | code_fim | hard | {
"lang": "python",
"repo": "JackeyWang777/Deep-Representations-of-Visual-Descriptions",
"path": "/crnns4captions/train_text_encoder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thonny/thonny path: /thonny/locale/register_updates.py
import json
import os.path
import polib
import pyperclip
locale_dir = os.path.dirname(__file__)
def register_locale(name: str) -> None:
print(f"Processing {name}")
po_path = os.path.join(locale_dir, name, "LC_MESSAGES", "thonny.po... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/locale/register_updates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if review_messages:
print("\n".join(review_messages))
pyperclip.copy("\n".join(review_messages))
input(f"... Press ENTER to confirm {name}! ...")
with open(registered_path, "w", encoding="utf-8") as fp:
json.dump(new_registered, fp, sort_keys=True, indent=4, ensur... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/locale/register_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for entry in po:
if entry.msgstr and (
entry.msgid not in registered or registered[entry.msgid] != entry.msgstr
):
msg = entry.msgstr.strip().replace("\n", " ")
if not msg.endswith("."):
msg = msg + "."
review_messages.ap... | code_fim | hard | {
"lang": "python",
"repo": "thonny/thonny",
"path": "/thonny/locale/register_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
Solution = CodeforcesTask373BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/373B/cdf_373B.py
def nxt_num(n):
return 10 ** len(str(n))
class CodeforcesT... | code_fim | hard | {
"lang": "python",
"repo": "kopok2/CodeforcesSolutionsPython",
"path": "/src/373B/cdf_373B.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/373B/cdf_373B.py
def nxt_num(n):
return 10 ** len(str(n))
class CodeforcesTask373BSolution:
def __init__(self):
self.result = ''
self.w_m_k = []
<|fim_suffix|> self.w_m_k = [int(x) for x in input().split(" ")]
def ... | code_fim | hard | {
"lang": "python",
"repo": "kopok2/CodeforcesSolutionsPython",
"path": "/src/373B/cdf_373B.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
Solution = CodeforcesTask373BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/373B/cdf_373B.py
def nxt_num(n):
return 10 ** len(str(n))
class CodeforcesTa... | code_fim | hard | {
"lang": "python",
"repo": "kopok2/CodeforcesSolutionsPython",
"path": "/src/373B/cdf_373B.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: corranwebster/taupo path: /taupo/__init__.py
# Taupo library code.
#
# Copyright 2014, Corran Webster.
<|fim_suffix|>ut warranty under the terms of the BSD license
# in the LICENSE file.
__version__ = '0.1'
__requires__ = ['traits']<|fim_middle|># All rights reserved.
#
# This software is provid... | code_fim | easy | {
"lang": "python",
"repo": "corranwebster/taupo",
"path": "/taupo/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.