text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: jeroen-dhollander/python-more-or-less path: /more_or_less/search_plugin.py
from .more_plugin import MorePlugin
from .page import Page
from .page_of_height import PageOfHeight
from .repeatable_mixin import RepeatableMixin
import re
_NO_PREVIOUS_REGULAR_EXPRESSION = '--No previous regular expressi... | code_fim | hard | {
"lang": "python",
"repo": "jeroen-dhollander/python-more-or-less",
"path": "/more_or_less/search_plugin.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._update_pattern(page_builder.get_input())
return self._create_search_page(page_builder)
def _repeat_last_search(self, page_builder):
if self._pattern is None:
return page_builder.build_next_page(message=_NO_PREVIOUS_REGULAR_EXPRESSION)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "jeroen-dhollander/python-more-or-less",
"path": "/more_or_less/search_plugin.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from ._freud import PMFTR12
from ._freud import PMFTXYT
from ._freud import PMFTXY2D
from ._freud import PMFTXYZ<|fim_prefix|># repo: harperic/freud path: /freud/pmft.py
# Copyright (c) 2010-2016 The Regents of the University of Michigan
# This file is part of the Freud project, released under the BSD 3-... | code_fim | easy | {
"lang": "python",
"repo": "harperic/freud",
"path": "/freud/pmft.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harperic/freud path: /freud/pmft.py
# Copyright (c) 2010-2016 The Regents of the University of Michigan
# This file is part of the Freud project, released under the BSD 3-Clause License.
## \package freud.pmft
#
# Methods to compute pair correlation function and pmft from point distributions.
#
... | code_fim | easy | {
"lang": "python",
"repo": "harperic/freud",
"path": "/freud/pmft.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = try_now(root)
if len(path) == 0:
time.sleep(1)
path = try_now(root)
assert(len(path) > 0) # now the time should have advanced enough
return path
def try_now(root):
owd = os.getcwd()
try:
os.chdir(root)
name = datetime.datetime.now().st... | code_fim | medium | {
"lang": "python",
"repo": "koalo/iotlab_topologies",
"path": "/helper/experiment_dirs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: koalo/iotlab_topologies path: /helper/experiment_dirs.py
import datetime
import time
import os
SYMLINK_NAME = "latest"
def generate_new(root):
if not os.path.exists(root):
os.makedirs(root)
<|fim_suffix|> return path
def try_now(root):
owd = os.getcwd()
try:
os.... | code_fim | medium | {
"lang": "python",
"repo": "koalo/iotlab_topologies",
"path": "/helper/experiment_dirs.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: foss2cyber/Incident-Playbook path: /Incident-Response/Tools/beagle/tests/edges/test_edge.py
from beagle.edges import Edge
import pytest
def make_edge_obj():
class DummyEdge(Edge):
__name__ = "dummy"
field1: str
field2: bool
def __init__(self):
super()._... | code_fim | hard | {
"lang": "python",
"repo": "foss2cyber/Incident-Playbook",
"path": "/Incident-Response/Tools/beagle/tests/edges/test_edge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(edge) == 2
def test_invalid_keys_error():
with pytest.raises(RuntimeError):
edge = make_edge_obj()
edge.append(notafield="foo")
def test_invalid_keys_error_add():
with pytest.raises(RuntimeError):
edge = make_edge_obj()
edge += {"notafield": "12... | code_fim | hard | {
"lang": "python",
"repo": "foss2cyber/Incident-Playbook",
"path": "/Incident-Response/Tools/beagle/tests/edges/test_edge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/python/esprima/esprima/jsx_nodes.py
#
-
*
-
coding
:
utf
-
8
-
*
-
from
__future__
import
absolute_import
unicode_literals
from
.
nodes
import
Node
from
.
jsx_syntax
import
JSXSyntax
class
JSXClosingElement
(
Node
)
:
def
__... | code_fim | hard | {
"lang": "python",
"repo": "marco-c/gecko-dev-wordified-and-comments-removed",
"path": "/third_party/python/esprima/esprima/jsx_nodes.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>self
.
name
=
name
class
JSXMemberExpression
(
Node
)
:
def
__init__
(
self
object
property
)
:
self
.
type
=
JSXSyntax
.
JSXMemberExpression
self
.
object
=
object
self
.
property
=
property
class
JSXAttribute
(
Node
)
:
def
__init__
(
self
name
value
)
:
sel... | code_fim | hard | {
"lang": "python",
"repo": "marco-c/gecko-dev-wordified-and-comments-removed",
"path": "/third_party/python/esprima/esprima/jsx_nodes.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>self
.
type
=
JSXSyntax
.
JSXSpreadAttribute
self
.
argument
=
argument
class
JSXText
(
Node
)
:
def
__init__
(
self
value
raw
)
:
self
.
type
=
JSXSyntax
.
JSXText
self
.
value
=
value
self
.
raw
=
raw<|fim_prefix|># repo: marco-c/gecko-dev-wordified-and-comments-... | code_fim | hard | {
"lang": "python",
"repo": "marco-c/gecko-dev-wordified-and-comments-removed",
"path": "/third_party/python/esprima/esprima/jsx_nodes.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>e, ReactiveTest, is_prime
from .mockdisposable import MockDisposable
from .recorded import Recorded<|fim_prefix|># repo: py-lab/RxPY path: /rx/testing/__init__.py
from .testscheduler import TestScheduler
from .re<|fim_middle|>activetest import OnNextPredicate, OnErrorPredicat | code_fim | easy | {
"lang": "python",
"repo": "py-lab/RxPY",
"path": "/rx/testing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: py-lab/RxPY path: /rx/testing/__init__.py
from .testscheduler import TestScheduler
from .reactivetest import OnNextPredicate, OnErrorPredicat<|fim_suffix|>port MockDisposable
from .recorded import Recorded<|fim_middle|>e, ReactiveTest, is_prime
from .mockdisposable im | code_fim | easy | {
"lang": "python",
"repo": "py-lab/RxPY",
"path": "/rx/testing/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>port MockDisposable
from .recorded import Recorded<|fim_prefix|># repo: py-lab/RxPY path: /rx/testing/__init__.py
from .testscheduler import TestScheduler
from .reactivetest import OnNextPredicate, OnErrorPredicat<|fim_middle|>e, ReactiveTest, is_prime
from .mockdisposable im | code_fim | easy | {
"lang": "python",
"repo": "py-lab/RxPY",
"path": "/rx/testing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinkepp/search-for-this path: /sft/eval/visual/PathVisualizer.py
import shutil
from sft.eval.visual.SimpleVisualize import PathAndResultsPlotter
import os
import cv2
from sft import Point
class PathVisualizer(object):
RESULTS_DIR = "tmp/paths/"
WORLD_DIR = "world/"
WORLD_CONFIG_NAME = "wo... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/eval/visual/PathVisualizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import imp
module_name = exp_module_name + ".world"
path = os.path.join(results_dir, self.WORLD_DIR, self.WORLD_CONFIG_NAME)
return imp.load_source(module_name, path)
def get_world_images(self, results_dir):
worlds = {}
files = os.listdir(os.path.join(results_dir, "world", self.WORLD_INIT_D... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/eval/visual/PathVisualizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> poss = {}
init_pos_path = os.path.join(results_dir, self.WORLD_DIR, self.WORLD_INIT_DIR, self.WORLD_INIT_NAME)
_file = open(init_pos_path)
_file.next() # skip header line
for line in _file:
vals = line.split("\t")
epoch = int(vals[0])
pos = Point(int(vals[1]), int(vals[2]))
poss[epo... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/eval/visual/PathVisualizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Compute perceptual hash using ImageHash library and convert to binary
:param phash: Imagehash.ImageHash
:returns: binary-encoded bigint
"""
phash.hash[-1] = False
phash_as_bigint = struct.unpack('Q', np.packbits(phash.hash))[0]
return phash_as_bigint
def compute_phash_int(im):
"""C... | code_fim | hard | {
"lang": "python",
"repo": "meedan/alegre",
"path": "/app/main/lib/image_hash.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meedan/alegre path: /app/main/lib/image_hash.py
from PIL import Image
import imagehash
import struct
import json
import hashlib
import numpy as np
from sqlalchemy import text
from pdqhashing.hasher.pdq_hasher import PDQHasher
def ensure_pil(im):
"""Ensure image is Pillow format"""
try:
i... | code_fim | hard | {
"lang": "python",
"repo": "meedan/alegre",
"path": "/app/main/lib/image_hash.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_previous_task():
"""This function returns first task in the queue.
"""
return _tasks[0] if len(_tasks) != 0 else None<|fim_prefix|># repo: JuiceFV/Cats_Queue_Management_System path: /application/sources/concurrency/taskconfig.py
"""This module/file whatever you want aims to help us t... | code_fim | hard | {
"lang": "python",
"repo": "JuiceFV/Cats_Queue_Management_System",
"path": "/application/sources/concurrency/taskconfig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuiceFV/Cats_Queue_Management_System path: /application/sources/concurrency/taskconfig.py
"""This module/file whatever you want aims to help us to structure asyncio tasks.
"""
import asyncio
# The list of asyncio tasks which needed to be canceled or modified or something else.
_tasks = []
def... | code_fim | hard | {
"lang": "python",
"repo": "JuiceFV/Cats_Queue_Management_System",
"path": "/application/sources/concurrency/taskconfig.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """This function returns first task in the queue.
"""
return _tasks[0] if len(_tasks) != 0 else None<|fim_prefix|># repo: JuiceFV/Cats_Queue_Management_System path: /application/sources/concurrency/taskconfig.py
"""This module/file whatever you want aims to help us to structure asyncio tasks.... | code_fim | hard | {
"lang": "python",
"repo": "JuiceFV/Cats_Queue_Management_System",
"path": "/application/sources/concurrency/taskconfig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chetanjain645/food_recognition_using_IBM_cloud path: /authentication.py
from watson_developer_cloud import Vis<|fim_suffix|>= VisualRecognitionV3(
version='{version}',
iam_apikey='{apikey}'
)<|fim_middle|>ualRecognitionV3
visual_recognition | code_fim | easy | {
"lang": "python",
"repo": "chetanjain645/food_recognition_using_IBM_cloud",
"path": "/authentication.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ersion}',
iam_apikey='{apikey}'
)<|fim_prefix|># repo: chetanjain645/food_recognition_using_IBM_cloud path: /authentication.py
from watson_developer_cloud import VisualRecognitionV3
visual_recognition <|fim_middle|>= VisualRecognitionV3(
version='{v | code_fim | easy | {
"lang": "python",
"repo": "chetanjain645/food_recognition_using_IBM_cloud",
"path": "/authentication.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_path = os.path.join(excel_path, file)
wb = xl.load_workbook(file_path)
ws = wb.active
total_products += ws.max_row - 1
for col in range(1, ws.max_column + 1):
header = ws.cell(1, col).value
current_new_row['temp'] = current_new_row['global']
if header not ... | code_fim | medium | {
"lang": "python",
"repo": "allexradu/combine_excel_files",
"path": "/combine_excel_files.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allexradu/combine_excel_files path: /combine_excel_files.py
import os
import openpyxl as xl
excel_path = os.path.join(os.getcwd(), 'excel')
all_files = [f for f in os.listdir(excel_path) if os.path.isfile(os.path.join(excel_path, f))]
columns = {}
current_new_row = {'global': 1, 'temp': 1}
cur... | code_fim | medium | {
"lang": "python",
"repo": "allexradu/combine_excel_files",
"path": "/combine_excel_files.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Omin=1e6
dofit=1
if dofit:
for mc in range(NbIterationinFit):
test=0
while test==0: #test is just to re-do the iteration until we encounter no error
flag=1
#print('trying least squares for mc = {}'.format(mc))
... | code_fim | hard | {
"lang": "python",
"repo": "oradules/Deconvolution_short_long",
"path": "/pythonVersion/fitSumOf2ExponentialsMain.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oradules/Deconvolution_short_long path: /pythonVersion/fitSumOf2ExponentialsMain.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 12 11:43:43 2021
@author: rachel
"""
# %%%%%%%%%%%%%%%%% 2-exp fit%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%% %%... | code_fim | hard | {
"lang": "python",
"repo": "oradules/Deconvolution_short_long",
"path": "/pythonVersion/fitSumOf2ExponentialsMain.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: albertoburgosplaza/Supervised-Learning-on-Relational-Databases-with-GNNs path: /tests/data/test_homecreditdefaultrisk.py
from pprint import pprint
from tests.data.test_DatabaseDataset import TestDataBaseClass
class TestHomeCreditDefaultRiskData(TestDataBaseClass.TestData):
db_name = 'homec... | code_fim | hard | {
"lang": "python",
"repo": "albertoburgosplaza/Supervised-Learning-on-Relational-Databases-with-GNNs",
"path": "/tests/data/test_homecreditdefaultrisk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(node_types,
[0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2,... | code_fim | hard | {
"lang": "python",
"repo": "albertoburgosplaza/Supervised-Learning-on-Relational-Databases-with-GNNs",
"path": "/tests/data/test_homecreditdefaultrisk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsochacki/Wireless_Controller_CC3200 path: /Python Scripts/File IO/File IO.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 5 09:12:02 2017
@author: medgar
"""
<|fim_suffix|> numbers[i] = int(new_values[i], 16)
for i in range(len(numbers)):
print(hex(numbers[i]))<|fim_middle... | code_fim | hard | {
"lang": "python",
"repo": "jsochacki/Wireless_Controller_CC3200",
"path": "/Python Scripts/File IO/File IO.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> break
else:
if char == '0' and index > 2:
new_values[i] = values[i][index:]
break
for i in range(len(new_values)):
numbers[i] = int(new_values[i], 16)
for i in range(len(numbers)):
... | code_fim | hard | {
"lang": "python",
"repo": "jsochacki/Wireless_Controller_CC3200",
"path": "/Python Scripts/File IO/File IO.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> numbers[i] = int(new_values[i], 16)
for i in range(len(numbers)):
print(hex(numbers[i]))<|fim_prefix|># repo: jsochacki/Wireless_Controller_CC3200 path: /Python Scripts/File IO/File IO.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 5 09:12:02 2017
@author: medgar
"""
<|fim_middle|... | code_fim | hard | {
"lang": "python",
"repo": "jsochacki/Wireless_Controller_CC3200",
"path": "/Python Scripts/File IO/File IO.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mifour/Algorithms path: /algoexpert/easy_find_closest_value_in_BST.py
"""
find the closest value in a BST, given that a node value > every values at left and < every values at right
"""
def findClosestValueInBst(tree, target):
# Write your code here.
if tree.value == target:
return <|fim_s... | code_fim | medium | {
"lang": "python",
"repo": "Mifour/Algorithms",
"path": "/algoexpert/easy_find_closest_value_in_BST.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ee.value < target and tree.right:
return findClosestValueInBst(tree.right, target)
else:
return tree.value<|fim_prefix|># repo: Mifour/Algorithms path: /algoexpert/easy_find_closest_value_in_BST.py
"""
find the closest value in a BST, given that a node value > every values at left and < every values... | code_fim | hard | {
"lang": "python",
"repo": "Mifour/Algorithms",
"path": "/algoexpert/easy_find_closest_value_in_BST.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tree.value
elif tree.value > target and tree.left:
return findClosestValueInBst(tree.left, target)
elif tree.value < target and tree.right:
return findClosestValueInBst(tree.right, target)
else:
return tree.value<|fim_prefix|># repo: Mifour/Algorithms path: /algoexpert/easy_find_closest_value_in... | code_fim | medium | {
"lang": "python",
"repo": "Mifour/Algorithms",
"path": "/algoexpert/easy_find_closest_value_in_BST.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for index, example in enumerate(examples):
print(f"{index:-^10}:\n", example)
model_instance = model_cls(**example)
assert model_instance<|fim_prefix|># repo: pcrespov/osparc-simcore path: /packages/models-library/tests/test_api_schemas_storage.py
# pylint:disable=unused-vari... | code_fim | medium | {
"lang": "python",
"repo": "pcrespov/osparc-simcore",
"path": "/packages/models-library/tests/test_api_schemas_storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pcrespov/osparc-simcore path: /packages/models-library/tests/test_api_schemas_storage.py
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
<|fim_suffix|>
@pytest.mark.parametrize(
"model_cls", (FileLocation, FileMetaDataGet, DatasetMetaDa... | code_fim | medium | {
"lang": "python",
"repo": "pcrespov/osparc-simcore",
"path": "/packages/models-library/tests/test_api_schemas_storage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize(
"model_cls", (FileLocation, FileMetaDataGet, DatasetMetaDataGet)
)
def test_storage_api_models_examples(model_cls):
examples = model_cls.Config.schema_extra["examples"]
for index, example in enumerate(examples):
print(f"{index:-^10}:\n", example)
mod... | code_fim | medium | {
"lang": "python",
"repo": "pcrespov/osparc-simcore",
"path": "/packages/models-library/tests/test_api_schemas_storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: W55699/beta-recsys path: /beta_rec/datasets/amazon.py
import gzip
import os
import pandas as pd
from beta_rec.datasets.dataset_base import DatasetBase
from beta_rec.utils.constants import (
DEFAULT_ITEM_COL,
DEFAULT_RATING_COL,
DEFAULT_TIMESTAMP_COL,
DEFAULT_USER_COL,
... | code_fim | hard | {
"lang": "python",
"repo": "W55699/beta-recsys",
"path": "/beta_rec/datasets/amazon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get dataframe from a gzip file.
Args:
path the file path of gzip file.
Returns:
A dataframe extracted from the gzip file.
"""
i = 0
df = {}
for d in self.parse_gzip_file(path):
df[i] = d
... | code_fim | hard | {
"lang": "python",
"repo": "W55699/beta-recsys",
"path": "/beta_rec/datasets/amazon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jisuhan3201/osc-bge path: /osc_bge/users/migrations/0004_auto_20181202_1115.py
# Generated by Django 2.0.9 on 2018-12-02 11:15
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='bgebr... | code_fim | medium | {
"lang": "python",
"repo": "jisuhan3201/osc-bge",
"path": "/osc_bge/users/migrations/0004_auto_20181202_1115.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='bgebranchcoordinator',
name='branch',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='branch_coordi', to='bge.BgeBranch'),
),
]<|fim_prefix|># repo: ... | code_fim | medium | {
"lang": "python",
"repo": "jisuhan3201/osc-bge",
"path": "/osc_bge/users/migrations/0004_auto_20181202_1115.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sieve = list(optimized_sieve(SIEVE_SIZE))
sieve_set = set(sieve)
i = 0
maximum_prime_count = 0
max_a = 0
max_b = 0
while sieve[i] <= MAXIMUM:
b = sieve[i]
valid_coefficients = []
for prime in sieve:
coefficient = prime - b - 1
i... | code_fim | medium | {
"lang": "python",
"repo": "YangLuGitHub/Euler",
"path": "/src/scripts/Problem27.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YangLuGitHub/Euler path: /src/scripts/Problem27.py
# Quadratic primes
# Problem 27
# Euler discovered the remarkable quadratic formula:
#
# n^2+n+41
#
# It turns out that the formula will produce 40 primes for the consecutive integer values 0<=n<=39.
# However, when n=40,40^2+40+41=40(40+1)+41 is... | code_fim | hard | {
"lang": "python",
"repo": "YangLuGitHub/Euler",
"path": "/src/scripts/Problem27.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nim65s/nIM path: /matrix.py
from datetime import datetime
from matrix_client.client import MatrixClient
from settings import *
class Matrix(object):
def __init__(self, main):
self.main = main
self.login = login
self.client = MatrixClient(address, encryption=encryp... | code_fim | hard | {
"lang": "python",
"repo": "nim65s/nIM",
"path": "/matrix.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sender not in self.main.users:
self.main.users[sender] = self.client.api.get_display_name(sender)
def listener(self, room, event):
if event['type'] == 'm.room.message':
history = self.room_data[room.room_id]['history']
history.append(self.event_t... | code_fim | hard | {
"lang": "python",
"repo": "nim65s/nIM",
"path": "/matrix.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def listener(self, room, event):
if event['type'] == 'm.room.message':
history = self.room_data[room.room_id]['history']
history.append(self.event_to_history(event))
if self.main.account == self and room.room_id == self.main.room_id:
self.mai... | code_fim | hard | {
"lang": "python",
"repo": "nim65s/nIM",
"path": "/matrix.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/CodeXGLUE path: /Code-Code/TypePrediction-TypeScript/dataset/process_datafiles.py
#!/usr/bin/env python3
# Copyright 2022 Kevin Jesse.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain ... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/CodeXGLUE",
"path": "/Code-Code/TypePrediction-TypeScript/dataset/process_datafiles.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
vocab_size = None
argv = sys.argv[1:]
try:
opts, args = getopt.getopt(argv, "hv:", ["vocab_size="])
except getopt.GetoptError:
print('process_datafiles.py -v <vocab_size>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/CodeXGLUE",
"path": "/Code-Code/TypePrediction-TypeScript/dataset/process_datafiles.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Planheat/Planheat-Tool path: /planning_and_simulation_modules/save_utility/LoadCity.py
from .LoadScenario import LoadScenario
from PyQt5.QtWidgets import QMessageBox
from qgis.core import QgsProject
import os
import os.path
class LoadCity(LoadScenario):
Cstep01 = None
Cstep2 = None
... | code_fim | hard | {
"lang": "python",
"repo": "Planheat/Planheat-Tool",
"path": "/planning_and_simulation_modules/save_utility/LoadCity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.fill_double_spin_box(self.citySim.sbs_heat, self.get_data("share_heating"))
self.fill_double_spin_box(self.citySim.sbs_dhw, self.get_data("share"))
self.fill_double_spin_box(self.citySim.sbs_heat_h, self.get_data("heating_hours"))
self.fill_double_spin_box(self.citySim... | code_fim | hard | {
"lang": "python",
"repo": "Planheat/Planheat-Tool",
"path": "/planning_and_simulation_modules/save_utility/LoadCity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='post',
name='author',
),
]<|fim_prefix|># repo: Rxavio/django-blog path: /blog_app/migrations/0005_remove_post_author.py
# Generated by Django 3.0.3 on 2020-08-05 18:26
from django.db import migrations
c... | code_fim | medium | {
"lang": "python",
"repo": "Rxavio/django-blog",
"path": "/blog_app/migrations/0005_remove_post_author.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rxavio/django-blog path: /blog_app/migrations/0005_remove_post_author.py
# Generated by Django 3.0.3 on 2020-08-05 18:26
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='post',
name='author',
),
]<|fim_middle|>from django.db import ... | code_fim | medium | {
"lang": "python",
"repo": "Rxavio/django-blog",
"path": "/blog_app/migrations/0005_remove_post_author.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('blog_app', '0004_auto_20200805_2022'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='author',
),
]<|fim_prefix|># repo: Rxavio/django-blog path: /blog_app/migrations/0005_remove_post_author.py
# Gener... | code_fim | medium | {
"lang": "python",
"repo": "Rxavio/django-blog",
"path": "/blog_app/migrations/0005_remove_post_author.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>loading(sleep = 10 , speed = 6 , method = 2)
system('figlet \'tekrar\' | lolcat')<|fim_prefix|># repo: sys113/tekrar path: /example/sleep_example_one_source.py
# arguments used : sleep , speed , method
# arguments default value , speed = 3 , method = 1
from tekrar import loading
from os import system
... | code_fim | easy | {
"lang": "python",
"repo": "sys113/tekrar",
"path": "/example/sleep_example_one_source.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>system('figlet \'tekrar\' | lolcat')<|fim_prefix|># repo: sys113/tekrar path: /example/sleep_example_one_source.py
# arguments used : sleep , speed , method
# arguments default value , speed = 3 , method = 1
from tekrar import loading
from os import system
print('tekrar ...')
<|fim_middle|>loading(sl... | code_fim | easy | {
"lang": "python",
"repo": "sys113/tekrar",
"path": "/example/sleep_example_one_source.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sys113/tekrar path: /example/sleep_example_one_source.py
# arguments used : sleep , speed , method
# arguments default value , speed = 3 , method = 1
from tekrar import loading
from os import system
print('tekrar ...')
<|fim_suffix|>system('figlet \'tekrar\' | lolcat')<|fim_middle|>loading(sl... | code_fim | easy | {
"lang": "python",
"repo": "sys113/tekrar",
"path": "/example/sleep_example_one_source.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, regression=False):
if regression:
model_initializer = lambda: RegressionHAT(
# leaf_prediction='mc'
)
else:
model_initializer = lambda: HAT(
# leaf_prediction='mc',
# nominal_attribut... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/0xDeCA10B",
"path": "/simulation/decai/simulation/contract/classification/decision_tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/0xDeCA10B path: /simulation/decai/simulation/contract/classification/decision_tree.py
from skmultiflow.trees import HAT, RegressionHAT
from decai.simulation.contract.classification.scikit_classifier import SciKitClassifierModule
<|fim_suffix|> def __init__(self, regression=False):... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/0xDeCA10B",
"path": "/simulation/decai/simulation/contract/classification/decision_tree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if regression:
model_initializer = lambda: RegressionHAT(
# leaf_prediction='mc'
)
else:
model_initializer = lambda: HAT(
# leaf_prediction='mc',
# nominal_attributes=[ 4],
)
super().__i... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/0xDeCA10B",
"path": "/simulation/decai/simulation/contract/classification/decision_tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ITSJKS/100-Days-of-ML-Code path: /Outliers/enron_outliers.py
#!/usr/bin/python
import pickle
import sys
import matplotlib.pyplot as plt
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
### read in data dictionary, convert to numpy array
data_dict = pick... | code_fim | hard | {
"lang": "python",
"repo": "ITSJKS/100-Days-of-ML-Code",
"path": "/Outliers/enron_outliers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>### Splitting the data and fitting it into the regresssion
target, feature = targetFeatureSplit(data)
X_train, X_test, Y_train, Y_test = train_test_split(feature, target, random_state=42)
reg = LinearRegression()
t = time()
reg.fit(X_train, Y_train)
print "Time to train: ", round(time() - t, 3)
t = time()... | code_fim | hard | {
"lang": "python",
"repo": "ITSJKS/100-Days-of-ML-Code",
"path": "/Outliers/enron_outliers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codingluke/cv_generator path: /cv_generator/themes/developer.py
import pylatex
from pylatex import Command
import random
import cv_generator
class ThemeDeveloper(cv_generator.BaseTheme):
class BarChart(pylatex.base_classes.Environment):
_latex_name = 'barchart'
class EntryList(... | code_fim | hard | {
"lang": "python",
"repo": "codingluke/cv_generator",
"path": "/cv_generator/themes/developer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.cv.courses and len(self.cv.courses) > 0:
self.doc.append(Command('cvsect', _('DEVELOPER_COURSES_TITLE')))
entry_list = self.EntryList()
for course_item in self.cv.courses:
course_item_date = course_item.date.strftime('%B %Y')
... | code_fim | hard | {
"lang": "python",
"repo": "codingluke/cv_generator",
"path": "/cv_generator/themes/developer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>onment Reviews: Unit, functional, and other tests.
'''<|fim_prefix|># repo: EDRN/eke.review path: /eke/review/tests/__init__.py
# encoding: utf-8
# Copyright 2011 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Governme<|fim_middle|>nt Sponsorship acknowledged.
'''EDRN Knowledge Envir | code_fim | easy | {
"lang": "python",
"repo": "EDRN/eke.review",
"path": "/eke/review/tests/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EDRN/eke.review path: /eke/review/tests/__init__.py
# encoding: utf-8
# Copyright 2011 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Governme<|fim_suffix|>onment Reviews: Unit, functional, and other tests.
'''<|fim_middle|>nt Sponsorship acknowledged.
'''EDRN Knowledge Envir | code_fim | easy | {
"lang": "python",
"repo": "EDRN/eke.review",
"path": "/eke/review/tests/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> single_root = Node(remaining[0], position)
if single_root.value.capitalize() in symbols:
graph.add_edge(previous_root, single_root)
if remaining not in processed:
pop_root(remaining[1:], position + 1, previous_root=single_root)
if le... | code_fim | hard | {
"lang": "python",
"repo": "mcvenkat/Python-Programs",
"path": "/Speller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# A single node of the graph. A glyph and its position in the word.
Node = namedtuple('Node', ['value', 'position'])
def build_spelling_graph(word, graph, symbols=ELEMENTS):
"""Given a word and a graph, find all single and double-character
glyphs in the word. Add them to the graph only i... | code_fim | hard | {
"lang": "python",
"repo": "mcvenkat/Python-Programs",
"path": "/Speller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcvenkat/Python-Programs path: /Speller.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 23 11:04:46 2020
@author: 766810
"""
from collections import defaultdict, namedtuple
from io import StringIO
import logging
# TODO(amin): Convert symbol tuple to element name or atomic number t... | code_fim | hard | {
"lang": "python",
"repo": "mcvenkat/Python-Programs",
"path": "/Speller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coldmax88/PyGUI path: /GUI/Generic/GFrames.py
#
# Python GUI - Frames - Generic
#
from GUI import Container
class Frame(Container):
<|fim_suffix|> _default_size = (100, 100)<|fim_middle|> """A Frame is a general-purpose instantiable subclass of Container."""
| code_fim | medium | {
"lang": "python",
"repo": "coldmax88/PyGUI",
"path": "/GUI/Generic/GFrames.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coldmax88/PyGUI path: /GUI/Generic/GFrames.py
#
# Python GUI - Frames - Generic
#
<|fim_suffix|>class Frame(Container):
"""A Frame is a general-purpose instantiable subclass of Container."""
_default_size = (100, 100)<|fim_middle|>from GUI import Container
| code_fim | easy | {
"lang": "python",
"repo": "coldmax88/PyGUI",
"path": "/GUI/Generic/GFrames.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _default_size = (100, 100)<|fim_prefix|># repo: coldmax88/PyGUI path: /GUI/Generic/GFrames.py
#
# Python GUI - Frames - Generic
#
from GUI import Container
class Frame(Container):
<|fim_middle|> """A Frame is a general-purpose instantiable subclass of Container."""
| code_fim | medium | {
"lang": "python",
"repo": "coldmax88/PyGUI",
"path": "/GUI/Generic/GFrames.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sethbergman/resources_api path: /tests/unit/test_routes/test_utils.py
from configs import PaginatorConfig
from app.versioning import LATEST_API_VERSION
from yaml import load
from .helpers import assert_correct_response
def test_internal_server_error_handler(
module_client, module_db, fa... | code_fim | hard | {
"lang": "python",
"repo": "sethbergman/resources_api",
"path": "/tests/unit/test_routes/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_paginator(module_client, module_db):
client = module_client
# Default page size
response = client.get('api/v1/resources')
assert (len(response.json['resources']) == PaginatorConfig.per_page)
# Test page size
response = client.get('api/v1/resources?page_size=1')
asser... | code_fim | hard | {
"lang": "python",
"repo": "sethbergman/resources_api",
"path": "/tests/unit/test_routes/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarasolano/pants path: /src/python/pants/subsystem/subsystem.py
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_fu... | code_fim | hard | {
"lang": "python",
"repo": "sarasolano/pants",
"path": "/src/python/pants/subsystem/subsystem.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Note: A subsystem has no access to options in scopes other than its own.
TODO: We'd like that to be true of Tasks some day. Subsystems will help with that.
Task code should call instance_for_scope() or global_instance() to get a subsystem instance.
Tests can call this constructor dire... | code_fim | hard | {
"lang": "python",
"repo": "sarasolano/pants",
"path": "/src/python/pants/subsystem/subsystem.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duranrojasm/symphony path: /cli/partnerscripts/upload_files.py
#!/usr/bin/env python3
# Copyright (c) 2004-present Facebook All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
<|fim_suffix|>if __name__ == "__main__":
pars... | code_fim | hard | {
"lang": "python",
"repo": "duranrojasm/symphony",
"path": "/cli/partnerscripts/upload_files.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
parser = add_base_args()
parser.add_argument(
"local_dir_path", help="local directory path to upload", type=str
)
parser.add_argument(
"entity_type",
help="entity type",
type=str,
choices=["LOCATION", "WORK_ORDER", "SITE_S... | code_fim | hard | {
"lang": "python",
"repo": "duranrojasm/symphony",
"path": "/cli/partnerscripts/upload_files.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for m in modules:
modules_to_include += ":" + m + ","
# remove last comma
modules_to_include = modules_to_include[:-1]
# build necessary dependencies first
check_call(["mvn", "clean", "install", "-pl", modules_to_include, "-P", "quick", "--am"])
check_call(["mvn", "verify... | code_fim | hard | {
"lang": "python",
"repo": "aws/aws-sdk-java-v2",
"path": "/scripts/run-integ-test",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aws/aws-sdk-java-v2 path: /scripts/run-integ-test
#!/usr/bin/env python
"""Run Integ Tests based on the changed files
"""
from subprocess import call, check_call, Popen, PIPE
# Minimal modules to tests when core changes are detected.
# s3 - xml, dynamodb - json, sqs - query
core_modules_to_test... | code_fim | hard | {
"lang": "python",
"repo": "aws/aws-sdk-java-v2",
"path": "/scripts/run-integ-test",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> top_directory = path[0]
if top_directory in ["core", "codegen"]:
return core_modules_to_test
if top_directory in ["http-clients"]:
return http_modules_to_test.get(path[1])
elif top_directory== "services":
return path[1]
def run_tests(modules):
"""
Run inte... | code_fim | medium | {
"lang": "python",
"repo": "aws/aws-sdk-java-v2",
"path": "/scripts/run-integ-test",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/rearrange-spaces-between-words.py
# Time: O(n)
# Space: O(1)
# inplace solution
class Solution(object):
def reorderSpaces(self, text):
"""
:type text: str
:rtype: str
"""
text = list(text)
# count the ... | code_fim | hard | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/rearrange-spaces-between-words.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # rearrange all the spaces to the left
equal_count = space_count//(word_count-1) if word_count-1 > 0 else 0
extra_count = space_count%(word_count-1) if word_count-1 > 0 else space_count
right, i = len(text)-1-extra_count, len(text)-1
while i >= 0:
has_wo... | code_fim | hard | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/rearrange-spaces-between-words.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: umairnsr87/NLPSpacy path: /githubcommit/handlers.py
from notebook.utils import url_path_join as ujoin
from notebook.base.handlers import IPythonHandler
import os, json, git, urllib, requests
from git import Repo, GitCommandError
from subprocess import check_output
import subprocess
class ... | code_fim | hard | {
"lang": "python",
"repo": "umairnsr87/NLPSpacy",
"path": "/githubcommit/handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create or switch to remote
try:
remote = repo.create_remote(git_remote, git_url)
except GitCommandError:
print("Remote {} already exists...".format(git_remote))
remote = repo.remote(git_remote)
# push changes
try:
... | code_fim | hard | {
"lang": "python",
"repo": "umairnsr87/NLPSpacy",
"path": "/githubcommit/handlers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kikos300/Nano-ORM path: /updateMeta.py
import os;
import traceback
try:
meta = os.open('meta.xml', os.O_WRONLY | os.O_CREAT | os.O_TRUNC);
header = b'<meta>\n\t<info author="NanoBob" type="script" name="NanoORM" version="1.0" />\n\t<oop>false</oop>\n';
footer = b'\n\n</meta>';
_client = 'cli... | code_fim | hard | {
"lang": "python",
"repo": "kikos300/Nano-ORM",
"path": "/updateMeta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exports = open('exports.txt')
exportstring = exports.read()
for function in exportstring.split():
os.write(meta, ('\n\t<export function="' + function +'" http="true" />').encode('utf-8'));
exports.close()
os.write(meta, b'\n');
os.write(meta, footer);
os.close(meta);
except:
traceback.print_exc... | code_fim | hard | {
"lang": "python",
"repo": "kikos300/Nano-ORM",
"path": "/updateMeta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for (root, dirs, files) in os.walk(_shared):
for file in files:
path = os.path.join(root, file).replace('\\', '/');
os.write(meta, ('\n\t<script src="' + path + '" type="shared"/>').encode('utf-8'));
os.write(meta, b'\n');
for (root, dirs, files) in os.walk(_server):
for file in files:
p... | code_fim | medium | {
"lang": "python",
"repo": "kikos300/Nano-ORM",
"path": "/updateMeta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: digitronik/widgetastic.patternfly4 path: /src/widgetastic_patternfly4/button.py
from widgetastic.utils import ParametrizedLocator
from widgetastic.widget import ClickableMixin
from widgetastic.widget import Widget
from widgetastic.xpath import quote
class BaseButton:
CHECK_VISIBILITY = True... | code_fim | hard | {
"lang": "python",
"repo": "digitronik/widgetastic.patternfly4",
"path": "/src/widgetastic_patternfly4/button.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if classes:
if locator_conditions:
locator_conditions += " and "
locator_conditions += " and ".join(
"contains(@class, {})".format(quote(klass)) for klass in classes
)
if locator_conditions:
locator_conditions ... | code_fim | hard | {
"lang": "python",
"repo": "digitronik/widgetastic.patternfly4",
"path": "/src/widgetastic_patternfly4/button.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyaf/BraTS18 path: /BraTS/BraTS2018-survival-prediction/paths.py
# # The directory of brats2018 training dataset
# brats2018_training_dir = "/home/eee/ug/15084015/GE/data/MICCAI_BraTS_2018_Data_Training/"
# # The directory of brats2018 validation dataset
# brats2018_validation_dir = "/home/eee/ug... | code_fim | hard | {
"lang": "python",
"repo": "pyaf/BraTS18",
"path": "/BraTS/BraTS2018-survival-prediction/paths.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The directory of brats2018 training dataset
brats2018_training_dir = "/media/ags/CODE/GE/data/MICCAI_BraTS_2018_Data_Training/"
# The directory of brats2018 validation dataset
brats2018_validation_dir = "/media/ags/CODE/GE/data/MICCAI_BraTS_2018_Data_Validation/"
# The directory of brats2018 testing dat... | code_fim | hard | {
"lang": "python",
"repo": "pyaf/BraTS18",
"path": "/BraTS/BraTS2018-survival-prediction/paths.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def update_config_from_file(path, config):
## take first yaml file that is found in path
config_files = glob.glob(os.path.join(path,"*.yaml"))
if config_files:
config_file = config_files[0]
else:
return config
configFromFile = {}
if os.path.isfile(config... | code_fim | hard | {
"lang": "python",
"repo": "steffenheyne/UCSC_trackHub_generator",
"path": "/trackHub_generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steffenheyne/UCSC_trackHub_generator path: /trackHub_generator.py
y
## script that parses a local directory structure and maps this to a UCSC trackDB.txt config
## https://github.com/steffenheyne/UCSC_trackHub_generator
## UCSC docu
## https://genome.ucsc.edu/goldenPath/help/trackDb/trackDbHub.h... | code_fim | hard | {
"lang": "python",
"repo": "steffenheyne/UCSC_trackHub_generator",
"path": "/trackHub_generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> The toplevel can contain tracks (not related to any container)
Current code only supports *.bw|*.bigwig or *.bb|*.bigbed tracks!
"""
config = { 'tracks': {} }
container_config = {}
generatorType = None
if re.match(".*\.multiwig$",parents[-1],re.IGNORECASE):
... | code_fim | hard | {
"lang": "python",
"repo": "steffenheyne/UCSC_trackHub_generator",
"path": "/trackHub_generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main() -> None:
input_filename = get_input_filename()
input_data = get_input_data(input_filename)
do_part_1(input_data)
do_part_2(input_data)
def get_input_filename() -> str:
parser = argparse.ArgumentParser(description='Run Advent of Code program')
parser.add_argument(
... | code_fim | hard | {
"lang": "python",
"repo": "MWers/advent-of-code",
"path": "/2021/01/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_input_filename() -> str:
parser = argparse.ArgumentParser(description='Run Advent of Code program')
parser.add_argument(
'input_filename', type=str, help='the file containing input data'
)
args = parser.parse_args()
return args.input_filename
def get_input_data(input_... | code_fim | hard | {
"lang": "python",
"repo": "MWers/advent-of-code",
"path": "/2021/01/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MWers/advent-of-code path: /2021/01/main.py
import argparse
import logging
import os
from typing import List
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
logging.basicConfig(level=LOGLEVEL)
logger = logging.getLogger(__name__)
def do_part_1(input_data: List) -> None:
prev_value = ... | code_fim | hard | {
"lang": "python",
"repo": "MWers/advent-of-code",
"path": "/2021/01/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>bject.vehicle',),
),
migrations.CreateModel(
name='RaceClass',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('sp... | code_fim | hard | {
"lang": "python",
"repo": "Semprini/cbe-sport",
"path": "/sport/compete/motorsport/migrations/0001_initial.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.