text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> print 'Identified files to process:'
for item in self.files_to_process:
filename = item[0]
registry = item[1]
print '%s' % (filename)
def process_files(self, username=None, password=None):
for pair in self.files_to_process:
filen... | code_fim | hard | {
"lang": "python",
"repo": "juliazchen/xgds_braille",
"path": "/apps/xgds_braille_app/importer/timestamp_handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juliazchen/xgds_braille path: /apps/xgds_braille_app/importer/timestamp_handler.py
#!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The ... | code_fim | hard | {
"lang": "python",
"repo": "juliazchen/xgds_braille",
"path": "/apps/xgds_braille_app/importer/timestamp_handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gangtao/dataplay path: /main.py
from flask import Flask, request, make_response, redirect, url_for, jsonify
from flask.ext.script import Manager
import csv
import os
import os.path
import glob
import json
from rviz import Builder
from rviz import SampleData
UPLOAD_FOLDER = './data/'
ALLOWED_EX... | code_fim | hard | {
"lang": "python",
"repo": "gangtao/dataplay",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return json.dumps(SampleData().getlist())
@app.route('/rdata/<dataname>')
def getrdata(dataname):
csvstr = SampleData().getdata(dataname)
if csvstr is not None:
return jsonify(name=dataname, csv=csvstr)
else:
return "Bad Request", 400
@app.route('/viz', methods=['POST']... | code_fim | hard | {
"lang": "python",
"repo": "gangtao/dataplay",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dzeromsk/goma path: /build/run_gn.py
#!/usr/bin/env python
# Copyright 2016 The Goma Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper script to run gn in this directory."""
<|fim_suffix|>
def main(args... | code_fim | medium | {
"lang": "python",
"repo": "dzeromsk/goma",
"path": "/build/run_gn.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> gn_py_path = os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py')
subprocess.check_call(
[sys.executable, gn_py_path] + args[1:],
cwd=_SCRIPT_DIR)
if __name__ == '__main__':
sys.exit(main(sys.argv))<|fim_prefix|># repo: dzeromsk/goma path: /build/run_gn.py
#!/usr/bin/env python
# ... | code_fim | medium | {
"lang": "python",
"repo": "dzeromsk/goma",
"path": "/build/run_gn.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
def main(args):
gn_py_path = os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py')
subprocess.check_call(
[sys.executable, gn_py_path] + args[1:],
cwd=_SCRIPT_DIR)
if __name__ == '__main__':
sys.exit(main(sys.argv))<|fim_pre... | code_fim | medium | {
"lang": "python",
"repo": "dzeromsk/goma",
"path": "/build/run_gn.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lrpopeyou/pynlp path: /qaPairsRelationClassification/CONVNET/args.py
seq_length = 15
char_embedding_size = 100
learning_rate = 0.0005
keep_prob = 0.7
vocab_size = 7901
class_<|fim_suffix|>= 3
filter_height = char_embedding_size
n_filter = 32<|fim_middle|>size = 2
epochs = 50
batch_size = 1024
fil... | code_fim | easy | {
"lang": "python",
"repo": "lrpopeyou/pynlp",
"path": "/qaPairsRelationClassification/CONVNET/args.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>size = 2
epochs = 50
batch_size = 1024
filter_width = 3
filter_height = char_embedding_size
n_filter = 32<|fim_prefix|># repo: lrpopeyou/pynlp path: /qaPairsRelationClassification/CONVNET/args.py
seq_length = 15
char_embedding_size = 100
learning_r<|fim_middle|>ate = 0.0005
keep_prob = 0.7
vocab_size = 7... | code_fim | easy | {
"lang": "python",
"repo": "lrpopeyou/pynlp",
"path": "/qaPairsRelationClassification/CONVNET/args.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShyamSubramanian/HESM path: /src/chaonan_src/doc_retrieval_experiment.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""Document retrieval experiments for `FEVER <http://fever.ai/>`_
/***
* ┌─┐ ┌─┐ + +
* ┌──┘ ┴───────┘ ┴──┐++
* │ │
* │ ─── │++ +... | code_fim | hard | {
"lang": "python",
"repo": "ShyamSubramanian/HESM",
"path": "/src/chaonan_src/doc_retrieval_experiment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """DocRetrievalExperiment
"""
def __init__(self, item_rb=None):
# self.item_rb = ItemRuleBuilder() if item_rb is None else item_rb
# self.item_rb = ItemRuleBuilderLower() if item_rb is None else item_rb
self.item_rb = ItemRuleBuilderRawID() if item_rb is None else item_... | code_fim | hard | {
"lang": "python",
"repo": "ShyamSubramanian/HESM",
"path": "/src/chaonan_src/doc_retrieval_experiment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewyoung1991/supriya path: /supriya/tools/ugentools/PitchShift.py
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.UGen import UGen
class PitchShift(UGen):
r'''A pitch shift unit generator.
::
>>> source = ugentools.SoundIn.ar()
>>> ugentools.PitchShift.ar(
... | code_fim | hard | {
"lang": "python",
"repo": "andrewyoung1991/supriya",
"path": "/supriya/tools/ugentools/PitchShift.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r'''Gets `pitch_dispersion` input of PitchShift.
::
>>> pitch_dispersion = 0.01
>>> source = ugentools.SoundIn.ar()
>>> pitch_shift = ugentools.PitchShift.ar(
... pitch_dispersion=pitch_dispersion,
... source=source,
... | code_fim | hard | {
"lang": "python",
"repo": "andrewyoung1991/supriya",
"path": "/supriya/tools/ugentools/PitchShift.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: z1pti3/jimiPlugin-clicksend path: /models/action.py
import jimi
from plugins.clicksend.includes import clicksend
class _clicksendSMS(jimi.action._action):
username = str()
apiToken = str()
to = str()
body = str()
def run(self,data,persistentData,actionResult):
us... | code_fim | hard | {
"lang": "python",
"repo": "z1pti3/jimiPlugin-clicksend",
"path": "/models/action.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self,data,persistentData,actionResult):
username = self.username
apiToken = jimi.auth.getPasswordFromENC(self.apiToken)
result, statusCode = clicksend._clicksend(username,apiToken).getAccount()
if result:
actionResult["result"] = True
... | code_fim | hard | {
"lang": "python",
"repo": "z1pti3/jimiPlugin-clicksend",
"path": "/models/action.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __pos__(self) -> 'Quaternion': ...
def __abs__(self) -> float: ...
def __invert__(self) -> 'Quaternion': ...
@classmethod
def from_vectors(cls, start: vector.Vector3, end: vector.Vector3 = ...) -> 'Quaternion': ...
@classmethod
def from_angles(cls, x: numbers.Real, y: ... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/SpiderTools",
"path": "/stubs/spidertools/math/quaternion.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def from_angles(cls, x: numbers.Real, y: numbers.Real, z: numbers.Real) -> 'Quaternion': ...
def conjugate(self) -> 'Quaternion': ...
def magnitude(self) -> float: ...
def magnitude_squared(self) -> float: ...
def normal(self) -> 'Quaternion': ...
def inverse(... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/SpiderTools",
"path": "/stubs/spidertools/math/quaternion.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CraftSpider/SpiderTools path: /stubs/spidertools/math/quaternion.pyi
from typing import overload, TypeVar, Union
import numbers
import spidertools.math.vector as vector
_T = TypeVar('_T')
def _float_correct(item: _T) -> _T: ...
ValidQuat = Union['Quaternion', numbers.Real]
class Quaterni... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/SpiderTools",
"path": "/stubs/spidertools/math/quaternion.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from sktime.forecasting.adapters._hcrystalball import HCrystalBallAdapter<|fim_prefix|># repo: sktime/sktime path: /sktime/forecasting/adapters/__init__.py
"""Module containing adapters to other forecasting framework packages."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
<|... | code_fim | easy | {
"lang": "python",
"repo": "sktime/sktime",
"path": "/sktime/forecasting/adapters/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sktime/sktime path: /sktime/forecasting/adapters/__init__.py
"""Module containing adapters to other forecasting framework packages."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
<|fim_suffix|>from sktime.forecasting.adapters._hcrystalball import HCrystalBallAdapter<|... | code_fim | easy | {
"lang": "python",
"repo": "sktime/sktime",
"path": "/sktime/forecasting/adapters/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> difference = self.sol.findTheDifference(s, t)
self.assertEqual(difference, "a")
if __name__ == "__main__":
unittest.main()<|fim_prefix|># repo: brigitteunger/katas path: /test_find_the_difference.py
import unittest
from collections import Counter
class Solution:
def findTheDi... | code_fim | hard | {
"lang": "python",
"repo": "brigitteunger/katas",
"path": "/test_find_the_difference.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brigitteunger/katas path: /test_find_the_difference.py
import unittest
from collections import Counter
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
s_dict = Counter(s)
t_dict = Counter(t)
for key in t_dict.keys():
if key not in s_di... | code_fim | medium | {
"lang": "python",
"repo": "brigitteunger/katas",
"path": "/test_find_the_difference.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ol = vol[:,iB[1]:iE[1]]
if iB[2]>=0:
vol = vol[:,:,iB[2]:iE[2]]
sh = np.array(vol.shape,dtype=int)
wid = dims-sh
wid[wid<0] = 0
return np.pad(vol,((0,wid[0]),(0,wid[1]),(0,wid[2])),mode='constant')<|fim_prefix|># repo: uttaratipnis/autoatlas_utipnis path: /autoatlas/_utils.py... | code_fim | medium | {
"lang": "python",
"repo": "uttaratipnis/autoatlas_utipnis",
"path": "/autoatlas/_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uttaratipnis/autoatlas_utipnis path: /autoatlas/_utils.py
import numpy as np
def adjust_dims(vol,dims):
dims = np.array(dims,dtype=int)
iB = (np.array(vol.shape,<|fim_suffix|>ol = vol[:,iB[1]:iE[1]]
if iB[2]>=0:
vol = vol[:,:,iB[2]:iE[2]]
sh = np.array(vol.shape,dtype=in... | code_fim | medium | {
"lang": "python",
"repo": "uttaratipnis/autoatlas_utipnis",
"path": "/autoatlas/_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def delete(self, obj):
try:
del self.db['{}-{}-{}'.format(obj.ip, obj.port, obj.protocol)]
except:
pass
def __len__(self):
return len(self.db)
class RAMMapStorager(StoragerMeta):
def __init__(self, *args, **kwargs):
super(RAMMapSto... | code_fim | hard | {
"lang": "python",
"repo": "Spico197/ProxiesKit",
"path": "/proxieskit/storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Spico197/ProxiesKit path: /proxieskit/storage.py
# import heapq # heap is not good enough for this task
from functools import total_ordering
@total_ordering
class ProxyInstance(object):
def __init__(self, *args, **kwargs):
assert kwargs.get('ip', False)
assert kwargs.get('po... | code_fim | hard | {
"lang": "python",
"repo": "Spico197/ProxiesKit",
"path": "/proxieskit/storage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def split_preserve_tokens(s):
"""Return split words of a string including the non-word tokens.
Parameters
----------
s : str
The string to be split.
Returns
-------
list of str
The list of words in the string including the separator tokens,
typically s... | code_fim | hard | {
"lang": "python",
"repo": "steppi/gilda",
"path": "/gilda/process.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def split_preserve_tokens(s):
"""Return split words of a string including the non-word tokens.
Parameters
----------
s : str
The string to be split.
Returns
-------
list of str
The list of words in the string including the separator tokens,
typically ... | code_fim | hard | {
"lang": "python",
"repo": "steppi/gilda",
"path": "/gilda/process.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steppi/gilda path: /gilda/process.py
"""Module containing various string processing functions used for grounding."""
import regex as re
from .greek_alphabet import greek_alphabet, greek_to_latin
# We try to list all kinds of dashes here
dashes = [chr(0x2212), chr(0x002d)] + [chr(c) for c in ran... | code_fim | hard | {
"lang": "python",
"repo": "steppi/gilda",
"path": "/gilda/process.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
source :
Source namespace and identifier.
relation :
The relation label to constrain to when finding targets.
Returns
-------
targets
A list of target nodes as INDRA Agents.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "STIRLIN6/indra_cogex",
"path": "/src/indra_cogex/neo4j_client.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: STIRLIN6/indra_cogex path: /src/indra_cogex/neo4j_client.py
om indra_cogex.representation import Node, Relation, norm_id
logger = logging.getLogger(__name__)
NEO4J_URL = "bolt://localhost:7687"
class Neo4jClient:
"""A client to communicate with an INDRA CogEx neo4j instance
Parameter... | code_fim | hard | {
"lang": "python",
"repo": "STIRLIN6/indra_cogex",
"path": "/src/indra_cogex/neo4j_client.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
neo4j_node :
A neo4j internal node using its internal data structure and
identifier scheme.
Returns
-------
node :
A Node object with the INDRA standard identifier scheme.
"""
props =... | code_fim | hard | {
"lang": "python",
"repo": "STIRLIN6/indra_cogex",
"path": "/src/indra_cogex/neo4j_client.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>l_transcriber import FullTranscriber
from resample import resample, resampled
from transcription import Transcription<|fim_prefix|># repo: wkranti/gentle path: /gentle/__init__.py
from __version__ import __version__
from resources import <|fim_middle|>Resources
from forced_aligner import ForcedAligner
fr... | code_fim | easy | {
"lang": "python",
"repo": "wkranti/gentle",
"path": "/gentle/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wkranti/gentle path: /gentle/__init__.py
from __version__ import __version__
from resources import <|fim_suffix|>l_transcriber import FullTranscriber
from resample import resample, resampled
from transcription import Transcription<|fim_middle|>Resources
from forced_aligner import ForcedAligner
fr... | code_fim | easy | {
"lang": "python",
"repo": "wkranti/gentle",
"path": "/gentle/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryangillard/artificial_intelligence path: /machine_learning/gan/pgan/tf2_pgan/pgan_class_ctl_module/trainer/train.py
import os
import tensorflow as tf
class Train(object):
"""Class that contains methods used for only training.
"""
def __init__(self):
"""Instantiate instance ... | code_fim | hard | {
"lang": "python",
"repo": "ryangillard/artificial_intelligence",
"path": "/machine_learning/gan/pgan/tf2_pgan/pgan_class_ctl_module/trainer/train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Trains generator network.
Args:
features: dict, feature tensors from input function.
growth_idx: int, current growth index model has progressed to.
Returns:
Dictionary of scalar losses for each network.
"""
# Extract real ima... | code_fim | hard | {
"lang": "python",
"repo": "ryangillard/artificial_intelligence",
"path": "/machine_learning/gan/pgan/tf2_pgan/pgan_class_ctl_module/trainer/train.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fzyukio/python-cspade path: /tests/test_cspade.py
import unittest
from pycspade import spade
class Test(unittest.TestCase):
def setUp(self):
result = spade(filename='tests/zaki.txt', support=2, maxsize=5, maxlen=5)
self.nseqs = result['nsequences']
self.occurs = {}
... | code_fim | hard | {
"lang": "python",
"repo": "fzyukio/python-cspade",
"path": "/tests/test_cspade.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_sequences(self):
correct_sequences = ['(1)', '(1 2)', '(1 2 6)', '(1 6)', '(2)', '(2)->(1)', '(2 6)', '(2 6)->(1)', '(4)',
'(4)->(1)',
'(4)->(2)', '(4)->(2)->(1)', '(4)->(2 6)', '(4)->(2 6)->(1)', '(4)->(6)', '(4)->(6)->(1)',
... | code_fim | hard | {
"lang": "python",
"repo": "fzyukio/python-cspade",
"path": "/tests/test_cspade.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: py1-10-2017/rgero215_PY1-10-2017 path: /Dojo_Survey_With_Validation/dojo_survey.py
from flask import Flask, render_template, request, redirect, session, flash
app = Flask(__name__)
app.secret_key = 'secret'
# our index route will handle rendering our form
@app.route('/')
def index():
<|fim_suffix... | code_fim | medium | {
"lang": "python",
"repo": "py1-10-2017/rgero215_PY1-10-2017",
"path": "/Dojo_Survey_With_Validation/dojo_survey.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "Got Post Info"
name = request.form['name']
location = request.form['location']
language = request.form['language']
comment = request.form['comment']
if request.method == 'POST':
if len(name) < 1:
flash("Name cannot be empty!")
return render_templ... | code_fim | medium | {
"lang": "python",
"repo": "py1-10-2017/rgero215_PY1-10-2017",
"path": "/Dojo_Survey_With_Validation/dojo_survey.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@decorators.aws_relationship(ParameterGroup, RESOURCE_TYPE)
def attach_to(ctx, iface, resource_config, **_):
'''Attaches an RDS ParameterGroup to something else'''
rtprops = ctx.target.instance.runtime_properties
params = resource_config or rtprops.get('resource_config') or dict()
if utils... | code_fim | hard | {
"lang": "python",
"repo": "cloudify-cosmo/cloudify-aws-plugin",
"path": "/cloudify_aws/rds/resources/parameter_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloudify-cosmo/cloudify-aws-plugin path: /cloudify_aws/rds/resources/parameter_group.py
# Copyright (c) 2018 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... | code_fim | hard | {
"lang": "python",
"repo": "cloudify-cosmo/cloudify-aws-plugin",
"path": "/cloudify_aws/rds/resources/parameter_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@decorators.aws_resource(ParameterGroup, RESOURCE_TYPE,
ignore_properties=True)
@decorators.wait_for_delete(status_pending=['available'])
def delete(iface, resource_config, **_):
'''Deletes an AWS Parameter Group'''
iface.delete(resource_config)
@decorators.aws_relations... | code_fim | hard | {
"lang": "python",
"repo": "cloudify-cosmo/cloudify-aws-plugin",
"path": "/cloudify_aws/rds/resources/parameter_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> img = cv2.imread('data/'+fname)
Show(img,'before')
#threshold
clow = np.array([0,0,0])
chigh = np.array([150,150,150])
mask = cv2.inRange(img, clow, chigh)
#grain remov
ker = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2,2) )
mask = cv2.dilate(mask... | code_fim | hard | {
"lang": "python",
"repo": "PiotrBalik/py-trollWorld",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PiotrBalik/py-trollWorld path: /main.py
import cv2
import numpy as np
#cwd(),dir()
import os
#ocr
from PIL import Image
import pytesseract
import argparse
#small object removal
from skimage import morphology
#
import matplotlib.pyplot as plt
from matplotlib import interactive
... | code_fim | hard | {
"lang": "python",
"repo": "PiotrBalik/py-trollWorld",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Floodfill from point (1,1)
cv2.floodFill(im_floodfill, mask, (1,1), 255);
im_floodfill_inv = cv2.bitwise_not(im_floodfill)
# Combine the two images to get the foreground.
## out = cv2.bitwise_not(im_bin_inv | im_floodfill_inv)
out = im_bin_inv | im_floodfill_inv
... | code_fim | hard | {
"lang": "python",
"repo": "PiotrBalik/py-trollWorld",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Root of project
root = os.path.normpath(
os.path.join(os.path.dirname(os.path.basename(__file__))))
# Directories to include in search path
includes = [] if args.include is None else args.include
if platform.system() == 'Darwin':
includes.insert(
0, "/Lib... | code_fim | hard | {
"lang": "python",
"repo": "viczhn/pangeo-pyinterp",
"path": "/run-clang-tidy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: viczhn/pangeo-pyinterp path: /run-clang-tidy.py
# Copyright (c) 2021 CNES
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import argparse
import concurrent.futures
import multiprocessing
import os
import platform
import ... | code_fim | hard | {
"lang": "python",
"repo": "viczhn/pangeo-pyinterp",
"path": "/run-clang-tidy.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(program, fix, path, options=""):
"""Launch clang-tidy"""
args = [
program, '-checks=*,-llvm-header-guard,-fuchsia-*,-android-*,'
'-*-magic-numbers,-google-runtime-references,'
'-cppcoreguidelines-init-variables,'
'-cppcoreguidelines-pro-bounds-pointer-arith... | code_fim | hard | {
"lang": "python",
"repo": "viczhn/pangeo-pyinterp",
"path": "/run-clang-tidy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erinaldi/taxi path: /src/taxi/batch_queue.py
#!/usr/bin/env python
# Interface for system queues. Used by the Pool class to interact with the batch system.
# This is an abstract class; implementations to be provided for specific machines in "local" subdir.
class BatchQueue(object):
# Enum... | code_fim | hard | {
"lang": "python",
"repo": "erinaldi/taxi",
"path": "/src/taxi/batch_queue.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
- Tell the batch system to start a new job associated with the given taxi.
- No return, but raises exceptions if a failure is detected.
- Don't launch a taxi that already exists on the queue unless respawning.
"""
queue_status = self.report_taxi... | code_fim | hard | {
"lang": "python",
"repo": "erinaldi/taxi",
"path": "/src/taxi/batch_queue.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IDAES/idaes-pse path: /idaes/models/properties/modular_properties/coolprop/coolprop_forms.py
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under th... | code_fim | hard | {
"lang": "python",
"repo": "IDAES/idaes-pse",
"path": "/idaes/models/properties/modular_properties/coolprop/coolprop_forms.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create expressions for CoolProp rational polynomial forms
Args:
cobj: Component object that will contain the parameters
prop: name of property parameters are associated with
T: temperature to use in expression
Returns:
Pyomo expression matching CoolPro... | code_fim | hard | {
"lang": "python",
"repo": "IDAES/idaes-pse",
"path": "/idaes/models/properties/modular_properties/coolprop/coolprop_forms.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> coeff = Var(doc="A parameter for CoolProp polynomial form", units=param_units)
cobj.add_component(prop + "_coeff_A" + str(i), coeff)
coeff.fix(aval)
for i, bval in enumerate(blist):
if i == 0:
param_units = pyunits.dimensionless
else:
pa... | code_fim | hard | {
"lang": "python",
"repo": "IDAES/idaes-pse",
"path": "/idaes/models/properties/modular_properties/coolprop/coolprop_forms.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uxyi/NL-Augmenter path: /transformations/butter_fingers_perturbation/transformation.py
import random
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
"""
Base Class for implementing the different input transformations a generation should be robust ... | code_fim | hard | {
"lang": "python",
"repo": "uxyi/NL-Augmenter",
"path": "/transformations/butter_fingers_perturbation/transformation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""
Butter Finger implementation borrowed from https://github.com/alexyorke/butter-fingers.
"""
class ButterFingersPerturbation(SentenceOperation):
tasks = [
TaskType.TEXT_CLASSIFICATION,
TaskType.TEXT_TO_TEXT_GENERATION,
TaskType.TEXT_TAGGING,
]
languages = ["en"]
... | code_fim | hard | {
"lang": "python",
"repo": "uxyi/NL-Augmenter",
"path": "/transformations/butter_fingers_perturbation/transformation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AstroHuntsman/POCS path: /pocs/utils/logger.py
import json
import os
import sys
import time
import datetime
import logging
import logging.config
from tempfile import gettempdir
from .config import load_config
class PanLogger(object):
""" Logger for PANOPTES with format style strings """
... | code_fim | hard | {
"lang": "python",
"repo": "AstroHuntsman/POCS",
"path": "/pocs/utils/logger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if handler == 'all':
# Symlink the log file to $PANDIR/logs/panoptes.log
try:
os.unlink(log_symlink)
except FileNotFoundError:
pass
finally:
os.symlink(full_log_fname, log_symlink)
# Configure the ... | code_fim | hard | {
"lang": "python",
"repo": "AstroHuntsman/POCS",
"path": "/pocs/utils/logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>mongo_db = MongoEngine()
sql_db = SQLAlchemy()
migrate = Migrate()
celery = Celery(__name__, broker=CONF.CELERY_BROKER_URL)
etcd = etcd3.client(host=CONF.ETCD_HOST, port=CONF.ETCD_PORT)<|fim_prefix|># repo: MaXXXXfeng/flask-scaffolding path: /flask_scaffolding/scaffoldings/basic/proj/extensions.py
from f... | code_fim | easy | {
"lang": "python",
"repo": "MaXXXXfeng/flask-scaffolding",
"path": "/flask_scaffolding/scaffoldings/basic/proj/extensions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaXXXXfeng/flask-scaffolding path: /flask_scaffolding/scaffoldings/basic/proj/extensions.py
from flask_mongoengine import MongoEngine
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from celery import Celery
import etcd3
<|fim_suffix|>mongo_db = MongoEngine()
sql_db = S... | code_fim | easy | {
"lang": "python",
"repo": "MaXXXXfeng/flask-scaffolding",
"path": "/flask_scaffolding/scaffoldings/basic/proj/extensions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chelackal/gentic_clustering path: /P4.py
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 5 22:42:07 2020
@author: Alish Chelackal
"""
"""This module contains P4 of the project.Last function Cluster(DistMatrix,list_labels)
is the main function.
"""
def createdict(Matrix,List):
"""c... | code_fim | hard | {
"lang": "python",
"repo": "chelackal/gentic_clustering",
"path": "/P4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Recursive function to create a binary tree
"""
d_new = defaultdict(dict)
#labels corresponding to minimum evolutionary distance in Matrix
a,b = minInDict(d)
n = ['(',a,',',b,')']
new_cluster = ''.join(n)
#remove the entries in newly formed cluste... | code_fim | hard | {
"lang": "python",
"repo": "chelackal/gentic_clustering",
"path": "/P4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #remove the entries in newly formed cluster from our list
for k in list_L:
if k == a:
list_L.remove(k)
break
for p in list_L:
if p == b:
list_L.remove(p)
break
#to remove an existing cluster with those entries
... | code_fim | hard | {
"lang": "python",
"repo": "chelackal/gentic_clustering",
"path": "/P4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.indoor_path=os.path.join(self.root,self.typel,indoor)
self.o=os.path.join(self.root,self.typel,outdoor)
self.filenames=sorted(os.listdir(self.indoor_path))
self.fil=sorted(os.listdir(self.o))
self.indor_name=[]
self.outdoor_name=[]
for item,data... | code_fim | medium | {
"lang": "python",
"repo": "ZEROonev/dataloader-pytorch",
"path": "/loaderimage.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZEROonev/dataloader-pytorch path: /loaderimage.py
'''
data
-train
--indoor
---1.1
-----1.1.mp3
-----1.101.png
-----1.101.jpg
-----1.102.jpg
-----1.103.jpg
-----1.103.png
--outdoor
---1.1
-----1.1.mp3
-----1.101.png
-----1.101.jpg
-----1.102.jpg
-----1.103.jpg
-----1.103.png
'''
import os
import g... | code_fim | medium | {
"lang": "python",
"repo": "ZEROonev/dataloader-pytorch",
"path": "/loaderimage.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> prihdr = fits.Header()
prihdr['COMMENT'] = "Above are the data sources"
prihdu = fits.PrimaryHDU(header=prihdr)
table_hdu = fits.BinTableHDU.from_columns(np.array(table.filled()))
thdulist = fits.HDUList([prihdu, table_hdu])
thdulist.writeto(outfil,clobber=... | code_fim | hard | {
"lang": "python",
"repo": "afeinsod/xastropy",
"path": "/xastropy/igm/abs_sys/abssys_utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: afeinsod/xastropy path: /xastropy/igm/abs_sys/abssys_utils.py
"""
#;+
#; NAME:
#; abssys_utils
#; Version 1.0
#;
#; PURPOSE:
#; Module for Absorption Systems
#; 23-Oct-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ im... | code_fim | hard | {
"lang": "python",
"repo": "afeinsod/xastropy",
"path": "/xastropy/igm/abs_sys/abssys_utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Class for Generic Absorption Line System
class Generic_System(Absline_System):
"""A simple absorption system
"""
def print_abs_type(self):
""""Return a string representing the type of vehicle this is."""
return 'Generic'
# Class for Generic Absorption Line System
class Abs... | code_fim | hard | {
"lang": "python",
"repo": "afeinsod/xastropy",
"path": "/xastropy/igm/abs_sys/abssys_utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Table of Item
dirpath filename transcriber TierNum(=itemNum) TierName(=name) intervalNum xmin xmax text
common key(s) between tables Item and Main would be 'filepath', 'filename', and 'transcriber'
Created on Aug 8, 2012
@author: Scot... | code_fim | hard | {
"lang": "python",
"repo": "scottcode/pyPraat",
"path": "/src/textgrid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scottcode/pyPraat path: /src/textgrid.py
'''
textgrid.py
Purpose: to read in TextGrid files
(which are created with Praat for annotation of sound files)
Output: object which is a dictionary of dictionaries (Python object type), with the following key-value pairs (typically)
object
... | code_fim | hard | {
"lang": "python",
"repo": "scottcode/pyPraat",
"path": "/src/textgrid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Filippo125/k8s-deploy-external-dns path: /k8s-deploy-external-dns/ingressrulewatcher.py
import logging
import sys
from datetime import datetime
from dnsconfig import DNSConfig
import pytz
from kubernetes import client, watch
class IngressRuleWatcher:
def __init__(self, dns_config, api_client,... | code_fim | hard | {
"lang": "python",
"repo": "Filippo125/k8s-deploy-external-dns",
"path": "/k8s-deploy-external-dns/ingressrulewatcher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if event_type == 'ADDED':
creation_timestamp = ob.metadata.creation_timestamp
if creation_timestamp < self.start_time:
self.logger.debug("[ADDED] %s.%s before start time " % (ob.metadata.namespace, ob.metadata.name))
else:
self.logger.debug("[ADDED] %s.%s after start time " % (ob.metada... | code_fim | hard | {
"lang": "python",
"repo": "Filippo125/k8s-deploy-external-dns",
"path": "/k8s-deploy-external-dns/ingressrulewatcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ropik/skia-buildbot path: /ct/py/remove_invalid_skps.py
#!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Python utility to detect invalid SKPs and remove ... | code_fim | hard | {
"lang": "python",
"repo": "ropik/skia-buildbot",
"path": "/ct/py/remove_invalid_skps.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def RemoveInvalidSKPs(skp_dir, path_to_skpinfo):
"""Removes invalid SKPs from the provided local dir."""
invalid_skps = []
for path_to_skp in glob.glob(os.path.join(skp_dir, '*.skp')):
if not IsSKPValid(path_to_skp, path_to_skpinfo):
print '=====%s is invalid!=====' % path_to_skp
inv... | code_fim | hard | {
"lang": "python",
"repo": "ropik/skia-buildbot",
"path": "/ct/py/remove_invalid_skps.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if '__main__' == __name__:
option_parser = optparse.OptionParser()
option_parser.add_option(
'', '--skp_dir', help='Directory that contains the SKPs we want to check.')
option_parser.add_option(
'', '--path_to_skpinfo', help='Complete path to the skpinfo binary.')
options, unused_args = o... | code_fim | hard | {
"lang": "python",
"repo": "ropik/skia-buildbot",
"path": "/ct/py/remove_invalid_skps.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhijitpai000/moviebot-mike path: /backend/intent_classifier.py
"""
Takes user input and classifies intent for further action.
"""
import torch
import numpy as np
import nltk
nltk.download('punkt')
from nltk.tokenize import word_tokenize
# Local Imports.
from backend.config import parameters_pa... | code_fim | hard | {
"lang": "python",
"repo": "abhijitpai000/moviebot-mike",
"path": "/backend/intent_classifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Processes user input for intent classification.
Parameters
----------
user_input: str
vocab: list
word_to_idx: dict
Returns
------
user_input_tokens, bow_vec, unk_percent.
"""
user_input_tokens = word_tokenize(user_input)
user_input... | code_fim | hard | {
"lang": "python",
"repo": "abhijitpai000/moviebot-mike",
"path": "/backend/intent_classifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def deleleFrame():
fist_frame.destroy()
## Display background image again
second_frame=Frame(root, width = 900, height = 540, bg = '#823af7')
second_frame.place(x=60,y=0)
global image_default
image_default = Ima... | code_fim | hard | {
"lang": "python",
"repo": "taiducvng/Multi-tasking-program",
"path": "/src/Control/Control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taiducvng/Multi-tasking-program path: /src/Control/Control.py
from webbrowser import open_new
from PIL import ImageTk,Image
from Control.Application import*
from Control.Login import*
from Control.Sign import*
from Control.About import*
from Control.Home import*
from Tools.CenterDisplay import*
... | code_fim | hard | {
"lang": "python",
"repo": "taiducvng/Multi-tasking-program",
"path": "/src/Control/Control.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fist_frame.destroy()
## Display background image again
second_frame=Frame(root, width = 900, height = 540, bg = '#823af7')
second_frame.place(x=60,y=0)
global image_default
image_default = ImageTk.PhotoImage(file = 'ima... | code_fim | hard | {
"lang": "python",
"repo": "taiducvng/Multi-tasking-program",
"path": "/src/Control/Control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CoinAlpha/hummingbot path: /hummingbot/connector/exchange/vertex/vertex_constants.py
from typing import Any, Dict
# A single source of truth for constant variables related to the exchange
from hummingbot.core.api_throttler.data_types import LinkedLimitWeightPair, RateLimit
from hummingbot.core.d... | code_fim | hard | {
"lang": "python",
"repo": "CoinAlpha/hummingbot",
"path": "/hummingbot/connector/exchange/vertex/vertex_constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># OrderStates
ORDER_STATE = {
"PendingNew": OrderState.PENDING_CREATE,
"New": OrderState.OPEN,
"Filled": OrderState.FILLED,
"PartiallyFilled": OrderState.PARTIALLY_FILLED,
"Canceled": OrderState.CANCELED,
"Rejected": OrderState.FAILED,
}
# Any call increases call rate in ALL pool,... | code_fim | hard | {
"lang": "python",
"repo": "CoinAlpha/hummingbot",
"path": "/hummingbot/connector/exchange/vertex/vertex_constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># REST QUERY API TYPES
STATUS_REQUEST_TYPE = "status"
ORDER_REQUEST_TYPE = "order"
SUBACCOUNT_INFO_REQUEST_TYPE = "subaccount_info"
MARKET_LIQUIDITY_REQUEST_TYPE = "market_liquidity"
ALL_PRODUCTS_REQUEST_TYPE = "all_products"
MARKET_PRICE_REQUEST_TYPE = "market_price"
FEE_RATES_REQUEST_TYPE = "fee_rates"
... | code_fim | hard | {
"lang": "python",
"repo": "CoinAlpha/hummingbot",
"path": "/hummingbot/connector/exchange/vertex/vertex_constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(dir_path):
dir_list = sorted([os.path.join(dir_path, d) for d in os.listdir(dir_path) if os.path.isdir(os.path.join(dir_path, d))])
# dir_list = [
# # '/home/macsz/datasets/emotions/img/rgb/S02/I04',
# '/home/macsz/datasets/emotions/img/rgb/S02/V01',
# '/home/macsz... | code_fim | hard | {
"lang": "python",
"repo": "macsz/magic-scripts",
"path": "/ai/ms-emotions-api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: macsz/magic-scripts path: /ai/ms-emotions-api.py
import httplib
import urllib
import base64
import json
import os
import sys
import requests
import time
def processRequest( json, data, headers, params ):
retries = 0
result = None
while True:
response = requests.request( 'pos... | code_fim | hard | {
"lang": "python",
"repo": "macsz/magic-scripts",
"path": "/ai/ms-emotions-api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(result) == 1:
for emotion in result[0]['scores'].keys():
r = result[0]['scores'][emotion]
r = int(r*1000)/1000.0
if r > highest_val:
highest_val = r
highest_label = emotion
else:
print('No faces found')
... | code_fim | hard | {
"lang": "python",
"repo": "macsz/magic-scripts",
"path": "/ai/ms-emotions-api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chbndrhnns/finapi-client path: /swagger_client/models/cash_flow_list.py
# coding: utf-8
"""
finAPI RESTful Services
finAPI RESTful Services # noqa: E501
OpenAPI spec version: v1.42.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
impo... | code_fim | hard | {
"lang": "python",
"repo": "chbndrhnns/finapi-client",
"path": "/swagger_client/models/cash_flow_list.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Gets the total_balance of this CashFlowList. # noqa: E501
The total balance # noqa: E501
:return: The total_balance of this CashFlowList. # noqa: E501
:rtype: float
"""
return self._total_balance
@total_balance.setter
def total_balance(self,... | code_fim | hard | {
"lang": "python",
"repo": "chbndrhnns/finapi-client",
"path": "/swagger_client/models/cash_flow_list.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quake0day/oj path: /changebase.py
class Solution(object):
def changebase(self, n, base):
digits = "0123456789ABCDEF"
remstack = []
while n > 0:
rem = n % base
remstack.append(rem)
n = n / base
<|fim_suffix|>
a = Solution()
print a.changebase(44, 4)
print a.c... | code_fim | hard | {
"lang": "python",
"repo": "quake0day/oj",
"path": "/changebase.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>a = Solution()
print a.changebase(44, 4)
print a.countNum(44, 4)
print a.changebase(23, 4)<|fim_prefix|># repo: quake0day/oj path: /changebase.py
class Solution(object):
def changebase(self, n, base):
digits = "0123456789ABCDEF"
remstack = []
while n > 0:
rem = n % base
re... | code_fim | medium | {
"lang": "python",
"repo": "quake0day/oj",
"path": "/changebase.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
a = Solution()
print a.changebase(44, 4)
print a.countNum(44, 4)
print a.changebase(23, 4)<|fim_prefix|># repo: quake0day/oj path: /changebase.py
class Solution(object):
def changebase(self, n, base):
digits = "0123456789ABCDEF"
remstack = []
while n > 0:
rem = n % base
r... | code_fim | hard | {
"lang": "python",
"repo": "quake0day/oj",
"path": "/changebase.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if top is None:
top = registry('gear/hier_root')
elif isinstance(top, str):
top = find(top)
bind('svgen/conf', conf)
for oper in registry('svgen/flow'):
top = oper(top, conf)
return top
class SVGenPlugin(PluginBase):
@classmethod
def bind(cls):
... | code_fim | medium | {
"lang": "python",
"repo": "Risto97/pygears",
"path": "/pygears/svgen/svgen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Risto97/pygears path: /pygears/svgen/svgen.py
from pygears.conf import PluginBase, bind, registry, safe_bind
from pygears.rtl.inst import rtl_inst
from pygears.rtl.connect import rtl_connect
from pygears.rtl.channel import RTLChannelVisitor, RTLOutChannelVisitor
from pygears.util.find import find... | code_fim | medium | {
"lang": "python",
"repo": "Risto97/pygears",
"path": "/pygears/svgen/svgen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ax, data in zip(axes, [water,nowater]):
ax.axis('equal')
ax.hist2d(data[:, 0], data[:, 1],
bins=100,)
fig.tight_layout()
plt.show()
if __name__ == '__main__':
main()<|fim_prefix|># repo: KyQiao/balltrack path: /example/2dhist.py
import numpy as n... | code_fim | hard | {
"lang": "python",
"repo": "KyQiao/balltrack",
"path": "/example/2dhist.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KyQiao/balltrack path: /example/2dhist.py
import numpy as np
from dataAnalysis import trace
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
def preprocess():
<|fim_suffix|> water = np.load('Pwater.npy')
nowater = np.load('Pno_water.npy')
fig, axes = plt.subplots(n... | code_fim | hard | {
"lang": "python",
"repo": "KyQiao/balltrack",
"path": "/example/2dhist.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
bbox_pred (Tensor): in [tl_x, tl_y, br_x, br_y] format.
best_score (Tensor): the tracking bbox confidence in range [0,1],
and the score of initial frame is -1.
"""
if frame_id == 0:
gt_bboxes = gt_bboxes[0][0]
... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmtracking",
"path": "/mmtrack/models/sot/siamrpn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmtracking path: /mmtrack/models/sot/siamrpn.py
if isinstance(m, _ConvNd) or isinstance(m, _BatchNorm):
m.reset_parameters()
if self.with_head:
for m in self.head.modules():
if isinstance(m, _ConvNd) or isinstance(m, _B... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmtracking",
"path": "/mmtrack/models/sot/siamrpn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test without augmentation.
Args:
img (Tensor): of shape (1, C, H, W) encoding input image.
img_metas (list[dict]): list of image information dict where each
dict has: 'img_shape', 'scale_factor', 'flip', and may also
contain 'file... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmtracking",
"path": "/mmtrack/models/sot/siamrpn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlucas-NU/advent_of_code path: /2020/day_11/main.py
import argparse
import logging
from dataclasses import dataclass
# Parse Arguments
parser = argparse.ArgumentParser()
parser.add_argument('input_file', help='input file to read')
parser.add_argument('--verbosity', help='specify verbosity leve... | code_fim | hard | {
"lang": "python",
"repo": "mlucas-NU/advent_of_code",
"path": "/2020/day_11/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if seat_contents == 'L' and num_neighbors == 0: # Assign seat if it is empty and has no neighbors
new_row.append('#')
any_updates = True
elif seat_contents == '#' and num_neighbors > 3: # Remove assignment if passenger has > 3 neig... | code_fim | hard | {
"lang": "python",
"repo": "mlucas-NU/advent_of_code",
"path": "/2020/day_11/main.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.