text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> def test_model_train_lstm(self):
input_config = self._create_test_input_config(
input_config_pb2.EncoderType.LSTM)
model_config = self._create_test_model_config()
test_model = recommendation_model.RecommendationModel(
input_config=input_config, model_config=model_config)
... | code_fim | hard | {
"lang": "python",
"repo": "slmsshk/examples",
"path": "/lite/examples/recommendation/ml/model/recommendation_model_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slmsshk/examples path: /lite/examples/recommendation/ml/model/recommendation_model_test.py
# Copyright 2021 The TensorFlow Authors. 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.
# ... | code_fim | hard | {
"lang": "python",
"repo": "slmsshk/examples",
"path": "/lite/examples/recommendation/ml/model/recommendation_model_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(form_idx_path,'rb') as fin:
# If arrived at 10-K section of forms
arrived = False
for row in fin.readlines():
row = row.decode('ascii')
if row.startswith("Form Type"):
fields_begin = [ row.find("Form... | code_fim | hard | {
"lang": "python",
"repo": "yepuv1/edgar-10k-mda",
"path": "/formindex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser("Download EDGAR form 10k index")
parser.add_argument('--year_start', type=int, default=2014)
parser.add_argument('--year_end', type=int, default=2016)
parser.add_argument('--index_dir', type=str, default='./data/index')
parser.add_argument('--out_file',... | code_fim | hard | {
"lang": "python",
"repo": "yepuv1/edgar-10k-mda",
"path": "/formindex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yepuv1/edgar-10k-mda path: /formindex.py
import argparse
from collections import namedtuple
import csv
import itertools
import os
import requests
SEC_GOV_URL = 'http://www.sec.gov/Archives'
FORM_INDEX_URL = os.path.join(SEC_GOV_URL,'edgar','full-index','{}','QTR{}','form.idx')
IndexRecord = nam... | code_fim | hard | {
"lang": "python",
"repo": "yepuv1/edgar-10k-mda",
"path": "/formindex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tsherwen/AC_tools path: /AC_tools/mask.py
se to preprocess the data.
# exactly the same as input
# xr.testing.assert_identical(dr_out['time'], dsA['time'])
# save variable
ds_l += [dr_out]
ds = xr.Dataset()
for n, var2use in enumerate(vars2regrid):
d... | code_fim | hard | {
"lang": "python",
"repo": "tsherwen/AC_tools",
"path": "/AC_tools/mask.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def mask_all_but(region='All', M_all=False, saizlopez=False,
res='4x5', trop_limit=True, mask2D=False, mask3D=False,
mask4D=False,
use_multiply_method=True, lat=None, lon=None,
verbose=False, debug=False):
"""
Returns a mask for ... | code_fim | hard | {
"lang": "python",
"repo": "tsherwen/AC_tools",
"path": "/AC_tools/mask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_CVAO_Africa_nest_Masked(res='0.25x0.3125', ):
"""
Create a mask of sub equatorial africa
"""
# Sub equatorial africa
lowerlat = 0.0
higherlat = 34.0
lowerlon = -32.0
higherlon = 15.0
# Get a mask for lat and lon range, then combine
mask1 = lat2lat_2D_unmask... | code_fim | hard | {
"lang": "python",
"repo": "tsherwen/AC_tools",
"path": "/AC_tools/mask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Register the handler to be called once the frame has changed.
bpy.app.handlers.frame_change_post.append(my_handler)<|fim_prefix|># repo: csebesta/mechanimation path: /python_files/working/check_test.py
import bpy
import math
from math import degrees
import serial
# Create a persistent connection... | code_fim | hard | {
"lang": "python",
"repo": "csebesta/mechanimation",
"path": "/python_files/working/check_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csebesta/mechanimation path: /python_files/working/check_test.py
import bpy
import math
from math import degrees
import serial
# Create a persistent connection to COM port 6
ser = serial.Serial('COM3',4800,timeout=1)
<|fim_suffix|># Register the handler to be called once the frame has c... | code_fim | hard | {
"lang": "python",
"repo": "csebesta/mechanimation",
"path": "/python_files/working/check_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kenwoov/PlayLeetCode path: /Algorithms/Easy/832. Flipping an Image/answer.py
from typing import List
class Solution:
def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]:
<|fim_suffix|>if __name__ == "__main__":
s = Solution()
result = s.flipAndInvertImage(
[[... | code_fim | medium | {
"lang": "python",
"repo": "kenwoov/PlayLeetCode",
"path": "/Algorithms/Easy/832. Flipping an Image/answer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
s = Solution()
result = s.flipAndInvertImage(
[[1, 1, 0], [1, 0, 1], [0, 0, 0]])
print(result)<|fim_prefix|># repo: kenwoov/PlayLeetCode path: /Algorithms/Easy/832. Flipping an Image/answer.py
from typing import List
class Solution:
def flipAndInvertIm... | code_fim | medium | {
"lang": "python",
"repo": "kenwoov/PlayLeetCode",
"path": "/Algorithms/Easy/832. Flipping an Image/answer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># using cache sessions instead of database sessions
# in dev makes it easier to debug the wizard
SESSION_ENGINE = "django.contrib.sessions.backends.cache"<|fim_prefix|># repo: DemocracyClub/EveryElection path: /every_election/settings/local.example.py
DATABASES = {
"default": {
"ENGINE": "dja... | code_fim | hard | {
"lang": "python",
"repo": "DemocracyClub/EveryElection",
"path": "/every_election/settings/local.example.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DemocracyClub/EveryElection path: /every_election/settings/local.example.py
DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"NAME": "",
"USER": "",
"PASSWORD": "",
"HOST": "",
"PORT": "",
}
}
# google custom s... | code_fim | medium | {
"lang": "python",
"repo": "DemocracyClub/EveryElection",
"path": "/every_election/settings/local.example.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> result_file_path=None,
outcome=None,
verification_time=None,
timestamp=None,
timestamp_str=None):
'''
Constructor
'''
self.result_file_path = result_file_path
self.outcome = outcome... | code_fim | hard | {
"lang": "python",
"repo": "dice-project/DICE-Verification",
"path": "/d-vert-server/d-vert-json2mc/json2mc/dia_verification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dice-project/DICE-Verification path: /d-vert-server/d-vert-json2mc/json2mc/dia_verification.py
'''
Created on Jan 6, 2017
@author: francesco
'''
import os
import shutil
import json
import subprocess as sp
import utils
import pkg_resources
import config as cfg
class VerificationTask(object):... | code_fim | hard | {
"lang": "python",
"repo": "dice-project/DICE-Verification",
"path": "/d-vert-server/d-vert-json2mc/json2mc/dia_verification.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def process_zot_results(self, result_dir=None, trace_file=None):
raise NotImplementedError()
def plot_trace(self):
raise NotImplementedError()
def __str__(self):
return '''Verification Task:
template_path: {} \n
template: {} \n
... | code_fim | hard | {
"lang": "python",
"repo": "dice-project/DICE-Verification",
"path": "/d-vert-server/d-vert-json2mc/json2mc/dia_verification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ClickHouse/ClickHouse path: /tests/integration/test_block_structure_mismatch/test.py
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance("node1", main_configs=["configs/remote_servers.xml"])
node2 = cluster.add_instance... | code_fim | medium | {
"lang": "python",
"repo": "ClickHouse/ClickHouse",
"path": "/tests/integration/test_block_structure_mismatch/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> finally:
cluster.shutdown()
def test(started_cluster):
node1.query(
"INSERT INTO local_test (t, shard, col1, col2) VALUES (1000, 0, 'x', 'y')"
)
node2.query(
"INSERT INTO local_test (t, shard, col1, col2) VALUES (1000, 1, 'foo', 'bar')"
)
assert (
... | code_fim | hard | {
"lang": "python",
"repo": "ClickHouse/ClickHouse",
"path": "/tests/integration/test_block_structure_mismatch/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> node1.query(
"INSERT INTO local_test (t, shard, col1, col2) VALUES (1000, 0, 'x', 'y')"
)
node2.query(
"INSERT INTO local_test (t, shard, col1, col2) VALUES (1000, 1, 'foo', 'bar')"
)
assert (
node1.query(
"SELECT col1, col2 FROM dist_test WHERE (t <... | code_fim | hard | {
"lang": "python",
"repo": "ClickHouse/ClickHouse",
"path": "/tests/integration/test_block_structure_mismatch/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def check_scale(ctx,
scale: Scale,
x,
pre_scale,
expected_y,
expected_log_det):
assert(T.shape(x) == T.shape(expected_log_det))
# dimension error
with pytest.raises(Exception,
match=r'`rank... | code_fim | hard | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tests/flows/test_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qyz-thu/gnn_vae path: /tests/flows/test_core.py
it_compile(_MyFlow())
self.assertEqual(flow.get_x_event_ndims(), 1)
self.assertEqual(flow.get_y_event_ndims(), 2)
self.assertEqual(flow.is_explicitly_invertible(), True)
# test call
x = T.random.randn([2, 3, ... | code_fim | hard | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tests/flows/test_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(Exception,
match=r'The shape of `input_log_det` is not expected'):
_ = scale(T.random.randn([2, 3]),
T.random.randn([2, 3]),
event_ndims=2,
input_log_det=T.random.randn([2]))
# check call
f... | code_fim | hard | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tests/flows/test_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chalamka/battle-notifier path: /slack_webhooks.py
import requests
import json
def build_slack_attachment(fallback, pretext, text, level, title, fields, thumb_url, markdown_in):
attachment = {'fallback': fallback,
'pretext': pretext,
'color': level,
... | code_fim | hard | {
"lang": "python",
"repo": "chalamka/battle-notifier",
"path": "/slack_webhooks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def send_slack_webhook(api_url, slack_payload):
"""
:param api_url: slack API url provided by incoming webhook integration
:param slack_payload: message payload to be sent to slack channel
Send message to a specified slack channel
"""
response = requests.post(api_url, slack_payload... | code_fim | hard | {
"lang": "python",
"repo": "chalamka/battle-notifier",
"path": "/slack_webhooks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eth-brownie/brownie path: /brownie/exceptions.py
#!/usr/bin/python3
import sys
from typing import Optional, Type
import eth_abi
import psutil
import yaml
from hexbytes import HexBytes
import brownie
# network
ERROR_SIG = "0x08c379a0"
class UnknownAccount(Exception):
pass
class Undepl... | code_fim | hard | {
"lang": "python",
"repo": "eth-brownie/brownie",
"path": "/brownie/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ContractExists(Exception):
pass
class ContractNotFound(Exception):
pass
class ProjectAlreadyLoaded(Exception):
pass
class ProjectNotFound(Exception):
pass
class BadProjectName(Exception):
pass
class CompilerError(Exception):
def __init__(self, e: Type[psutil.Popen],... | code_fim | hard | {
"lang": "python",
"repo": "eth-brownie/brownie",
"path": "/brownie/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NiveditJain/muZik path: /server/__main__.py
import runchecks
import setup
import socket
import settings
import request_handler
import threading
print('Identifying IP!')
HOST = socket.gethostbyname(socket.gethostname())
print('Your IPv4, is ' + str(HOST))
<|fim_suffix|> print(f'server suc... | code_fim | hard | {
"lang": "python",
"repo": "NiveditJain/muZik",
"path": "/server/__main__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # making server running continuously
while True:
connection, address = server.accept()
thread = threading.Thread(target=request_handler.gate_way, args=(connection, address))
print(f'Starting Connection with {address}')
thread.start()
print(f'active connectio... | code_fim | medium | {
"lang": "python",
"repo": "NiveditJain/muZik",
"path": "/server/__main__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/django-cqrs path: /examples/demo_project/master_service/app/views.py
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
from django.http import HttpResponseNotAllowed
from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.http import requ... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/django-cqrs",
"path": "/examples/demo_project/master_service/app/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@render_main_page_if_get
def purchase_create_view(request):
user_id = request.POST.get('user')
product_id = request.POST.get('product')
Purchase.objects.create(user_id=user_id, product_id=product_id)
return redirect('/')
@render_main_page_if_get
def purchase_delete_view(request, pk):
... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/django-cqrs",
"path": "/examples/demo_project/master_service/app/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ElakkiyaRaj/News-Aggregator path: /web_server/parsers/WIP/NY.py
import csv
import requests
from multiprocessing import Process, Queue, Value, Lock, current_process
import queue
from datetime import datetime, timedelta
import signal
import logging
import time
import pandas as pd
import datetime
im... | code_fim | hard | {
"lang": "python",
"repo": "ElakkiyaRaj/News-Aggregator",
"path": "/web_server/parsers/WIP/NY.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
logging.basicConfig(level=logging.DEBUG,
format='[PID %(process)d %(asctime)s] %(message)s',
datefmt='%d/%m/%Y %H:%M:%S')
logging.getLogger('requests').setLevel(logging.CRITICAL)
Q = Queue()
sync_flag = Value('i', 1)
workers... | code_fim | hard | {
"lang": "python",
"repo": "ElakkiyaRaj/News-Aggregator",
"path": "/web_server/parsers/WIP/NY.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zyw400/NimbusML-1 path: /src/python/nimbusml/examples/FastForestBinaryClassifier.py
###############################################################################
# FastForestBinaryClassifier
import numpy
from nimbusml import Pipeline, FileDataStream
from nimbusml.datasets import get_dataset
fro... | code_fim | hard | {
"lang": "python",
"repo": "zyw400/NimbusML-1",
"path": "/src/python/nimbusml/examples/FastForestBinaryClassifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># print predictions
print(predictions.head())
# PredictedLabel Score
# 0 0.0 -26.985743
# 1 0.0 -26.562090
# 2 0.0 -24.832508
# 3 0.0 -23.799389
# 4 0.0 -19.612534
# print evaluation metrics
print(metrics)
# AUC Accuracy Positive ... | code_fim | hard | {
"lang": "python",
"repo": "zyw400/NimbusML-1",
"path": "/src/python/nimbusml/examples/FastForestBinaryClassifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.plot(x, curves_dict_def['RS'], '-ro', label= "DO")
plt.plot(x, curves_dict_def['SP'], '-go', label= "DO+SP")
plt.xlabel("Epochs")
plt.ylabel("Defender's Regret w.r.t Combined Game")
plt.title("Regret Curves")
plt.legend(loc="best")
plt.show()
# plt.plot(x, curves_dict_att['RS'], '-ro', label= "DO")
... | code_fim | medium | {
"lang": "python",
"repo": "wyz2368/fine_tune",
"path": "/attackgraph/drawing/drawing_regret_curves.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyz2368/fine_tune path: /attackgraph/drawing/drawing_regret_curves.py
import os
from attackgraph import file_op as fp
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import numpy as np
import math
load_path = os.getcwd() + '/drawing/matrix/'
curves_dict_att = fp.load_p... | code_fim | hard | {
"lang": "python",
"repo": "wyz2368/fine_tune",
"path": "/attackgraph/drawing/drawing_regret_curves.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alex-w/vplanet path: /tests/MagmOc_GJ1132b/test_MagmOc_GJ1132b.py
from vplot import GetOutput
import subprocess
import numpy as np
import os
cwd = os.path.dirname(os.path.realpath(__file__))
def test_MagmOcGJ1132b():
<|fim_suffix|> # Primary Variables: GJ1132b -- checks MagmOc parameters
... | code_fim | hard | {
"lang": "python",
"repo": "alex-w/vplanet",
"path": "/tests/MagmOc_GJ1132b/test_MagmOc_GJ1132b.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Grab the output
output = GetOutput(path=cwd)
# Primary Variables: GJ1132b -- checks MagmOc parameters
assert np.isclose(output.log.final.GJ1132b.PotTemp, 3358.229436)
assert np.isclose(output.log.final.GJ1132b.SurfTemp, 4000.000000)
assert np.isclose(output.log.final.GJ1132b.Sol... | code_fim | hard | {
"lang": "python",
"repo": "alex-w/vplanet",
"path": "/tests/MagmOc_GJ1132b/test_MagmOc_GJ1132b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Primary Variables: GJ1132b -- checks MagmOc parameters
assert np.isclose(output.log.final.GJ1132b.PotTemp, 3358.229436)
assert np.isclose(output.log.final.GJ1132b.SurfTemp, 4000.000000)
assert np.isclose(output.log.final.GJ1132b.SolidRadius, 0.750604)
assert np.isclose(output.log.fin... | code_fim | medium | {
"lang": "python",
"repo": "alex-w/vplanet",
"path": "/tests/MagmOc_GJ1132b/test_MagmOc_GJ1132b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sc.get_source(0).transfer_function = tf
cam = sc.add_camera(ds, lens_type="perspective")
cam.resolution = (1920, 1080)
cam.position = 1.5*ds.arr(np.array([0.0, 5.e9, 5.e9]), 'cm')
# look toward the center -- we are dealing with an octant
center = 0.5*(ds.domain_left_edge + ds.do... | code_fim | hard | {
"lang": "python",
"repo": "AMReX-Astro/wdmerger",
"path": "/analysis/vol-wd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cam = sc.add_camera(ds, lens_type="perspective")
cam.resolution = (1920, 1080)
cam.position = 1.5*ds.arr(np.array([0.0, 5.e9, 5.e9]), 'cm')
# look toward the center -- we are dealing with an octant
center = 0.5*(ds.domain_left_edge + ds.domain_right_edge)
normal = (center - cam.po... | code_fim | hard | {
"lang": "python",
"repo": "AMReX-Astro/wdmerger",
"path": "/analysis/vol-wd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AMReX-Astro/wdmerger path: /analysis/vol-wd.py
#!/usr/bin/env python
import matplotlib
matplotlib.use('agg')
import sys
import yt
import numpy as np
from yt.visualization.volume_rendering.api import \
Scene, \
VolumeSource
# this is for the wdconvect problem
def doit(plotfile):
... | code_fim | hard | {
"lang": "python",
"repo": "AMReX-Astro/wdmerger",
"path": "/analysis/vol-wd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # --- test __call__ ---
result = evaluator()
pytest.approx(result['train/main/prc_auc'], expected_prc_auc)
def _test_prc_auc_evaluator_with_labels(data1):
"""test `pos_labels` and `ignore_labels` behavior"""
predictor = DummyPredictor()
dataset = NumpyTupleDataset(*data1)
i... | code_fim | hard | {
"lang": "python",
"repo": "k-ishiguro/chainer-chemistry",
"path": "/tests/training_tests/extensions_tests/test_prc_auc_evaluator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: k-ishiguro/chainer-chemistry path: /tests/training_tests/extensions_tests/test_prc_auc_evaluator.py
"""
PRCAUCEvaluator uses `sklearn.metrics.precision_recall_curve` and
`sklearn.metrics.auc` internally.
Refer: http://scikit-learn.org/stable/modules/generated/sklearn.metrics.\
prc_auc_score.html
... | code_fim | hard | {
"lang": "python",
"repo": "k-ishiguro/chainer-chemistry",
"path": "/tests/training_tests/extensions_tests/test_prc_auc_evaluator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FabianSchuetze/gym-continuousDoubleAuction path: /gym_continuousDoubleAuction/envs/exchg/reward_helper.py
import numpy as np
import pandas as pd
class Reward_Helper(object):
def set_reward(self, rewards, trader):
<|fim_suffix|> # maximize NAV, minimize num of trades (more trades gets... | code_fim | hard | {
"lang": "python",
"repo": "FabianSchuetze/gym-continuousDoubleAuction",
"path": "/gym_continuousDoubleAuction/envs/exchg/reward_helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
reward per t step
reward = nav@t+1 - nav@t
"""
NAV_chg = float(trader.acc.nav - trader.acc.prev_nav)
# maximize NAV
#rewards[trader.ID] = NAV_chg
# maximize NAV, minimize num of trades (more trades gets penalized).
if NAV_chg >... | code_fim | medium | {
"lang": "python",
"repo": "FabianSchuetze/gym-continuousDoubleAuction",
"path": "/gym_continuousDoubleAuction/envs/exchg/reward_helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> answer, part=None, day=None, year=None, session=None, reopen=True, quiet=False
):
if session is None:
user = default_user()
else:
user = User(token=session)
if day is None:
day = current_day()
if year is None:
year = most_recent_year()
puzzle = Puzzl... | code_fim | medium | {
"lang": "python",
"repo": "JackieMaw/advent-of-code-data",
"path": "/aocd/post.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>log = logging.getLogger(__name__)
def submit(
answer, part=None, day=None, year=None, session=None, reopen=True, quiet=False
):
if session is None:
user = default_user()
else:
user = User(token=session)
if day is None:
day = current_day()
if year is None:
... | code_fim | medium | {
"lang": "python",
"repo": "JackieMaw/advent-of-code-data",
"path": "/aocd/post.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JackieMaw/advent-of-code-data path: /aocd/post.py
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
<|fim_suffix|>log = logging.getLogger(__name__)
def submit(
... | code_fim | medium | {
"lang": "python",
"repo": "JackieMaw/advent-of-code-data",
"path": "/aocd/post.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lcoderfit/Introduction-to-algotithms path: /PythonLeetcode/stack/1544. 整理字符串.py
"""
方法1:
时间复杂度:O(n)
空间复杂度:O(n)
case1:
r:
"""
import sys
from typing import List
<|fim_suffix|> stack = []
for ch in s:
if stack and abs(ord(ch) - ord(stack[-1])) == 32:
... | code_fim | medium | {
"lang": "python",
"repo": "Lcoderfit/Introduction-to-algotithms",
"path": "/PythonLeetcode/stack/1544. 整理字符串.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
sl = Solution()
for line in sys.stdin:
s_cur = line.strip()
print(sl.make_good(s_cur))<|fim_prefix|># repo: Lcoderfit/Introduction-to-algotithms path: /PythonLeetcode/stack/1544. 整理字符串.py
"""
方法1:
时间复杂度:O(n)
空间复杂度:O(n)
case1:
r:
"""
import sys
from... | code_fim | hard | {
"lang": "python",
"repo": "Lcoderfit/Introduction-to-algotithms",
"path": "/PythonLeetcode/stack/1544. 整理字符串.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
setuptools.setup(
name=SETUP_JSON["name"],
version=SETUP_JSON["version"],
author=", ".join(SETUP_JSON["authors"]),
author_email=", ".join(SETUP_JSON["emails"]),
description=SETUP_JSON["description"],
long_description=readme(),
long_description_content_type="text/markdown",
... | code_fim | hard | {
"lang": "python",
"repo": "janten/dpt-rp1-py",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janten/dpt-rp1-py path: /setup.py
#!/usr/bin/env python
# coding=utf-8
import os
import sys
import json
import setuptools
from setuptools.command.test import test as TestCommand
DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SETUP_JSON = None
try:
with open(os.path.join(DIRECTORY,... | code_fim | medium | {
"lang": "python",
"repo": "janten/dpt-rp1-py",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>VALIDATION_DIR = "/tmp/cats-v-dogs/testing/"
validation_generator = test_datagen.flow_from_directory(
VALIDATION_DIR,
target_size=(150, 150),
batch_size=20,
class_mode='binary')
history = model.fit_generator(
train_generator,
steps_per_epoch=100, # 20... | code_fim | hard | {
"lang": "python",
"repo": "SteveJu1/Computer-version-toturials",
"path": "/example/Augmentation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>import matplotlib.pyplot as plt
acc=history.history['acc']
val_acc = history.history['val_acc']
epochs = range(len(acc)) #可以直接给50
plt.plot(epochs,acc,'bo',label='Training accuracy') #plt.plot(x轴,y轴,用点画,label标签) label要用 plt.legend()
plt.figure()
plt.show()
########### upload your data
import numpy as... | code_fim | hard | {
"lang": "python",
"repo": "SteveJu1/Computer-version-toturials",
"path": "/example/Augmentation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SteveJu1/Computer-version-toturials path: /example/Augmentation.py
# Augmentation 数据增强
# imageDataGenerator
# Cats v Dogs classifier
#
import os
import zipfile
import tensorflow as tf
from tensorflow.keras.optimizers import RMSprop
from tensorflow.keras.preprocessing.image import ImageDataGenerat... | code_fim | hard | {
"lang": "python",
"repo": "SteveJu1/Computer-version-toturials",
"path": "/example/Augmentation.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cgutierrezpa/jiratag-commitizen path: /jiratag_commitizen/config.py
import configparser
import json
import os
import warnings
from typing import Optional
from pathlib import Path
from tomlkit import parse, exceptions
from jiratag_commitizen import defaults
class Config:
def __init__(self):... | code_fim | hard | {
"lang": "python",
"repo": "cgutierrezpa/jiratag-commitizen",
"path": "/jiratag_commitizen/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def read_pyproject_conf(data: str) -> dict:
"""We expect to have a section in pyproject looking like
```
[tool.jiratag_commitizen]
name = "cz_conventional_commits"
```
"""
doc = parse(data)
try:
return doc["tool"]["jiratag_commitizen"]
except exceptions.NonExis... | code_fim | hard | {
"lang": "python",
"repo": "cgutierrezpa/jiratag-commitizen",
"path": "/jiratag_commitizen/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """We expect to have a section like this
```
[jiratag_commitizen]
name = cz_jira
files = [
"jiratag_commitizen/__version__.py",
"pyproject.toml"
] # this tab at the end is important
```
"""
config = configparser.ConfigParser(allow_no_value=True)
... | code_fim | hard | {
"lang": "python",
"repo": "cgutierrezpa/jiratag-commitizen",
"path": "/jiratag_commitizen/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def check(self, trigger: RoboModTrigger) -> bool:
now = datetime.utcnow()
created_at = trigger.author.created_at
if created_at is None:
return False
age = now - created_at
is_older = (self.more_than is None) or (age > self.more_than)
is... | code_fim | hard | {
"lang": "python",
"repo": "Arcensoth/cogbot",
"path": "/cogbot/cogs/robo_mod/conditions/author_account_age.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.more_than: Optional[timedelta] = None
self.less_than: Optional[timedelta] = None
async def update(self, state: "RoboModServerState", data: dict):
# more_than
raw_more_than = data.get("more_than", None)
if raw_more_than is not None:
... | code_fim | medium | {
"lang": "python",
"repo": "Arcensoth/cogbot",
"path": "/cogbot/cogs/robo_mod/conditions/author_account_age.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arcensoth/cogbot path: /cogbot/cogs/robo_mod/conditions/author_account_age.py
from datetime import datetime, timedelta
from typing import Optional
from cogbot.cogs.robo_mod.robo_mod_condition import RoboModCondition
from cogbot.cogs.robo_mod.robo_mod_trigger import RoboModTrigger
<|fim_suffix|... | code_fim | medium | {
"lang": "python",
"repo": "Arcensoth/cogbot",
"path": "/cogbot/cogs/robo_mod/conditions/author_account_age.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = dict()
r['id'] = model_obj.id
r['title'] = model_obj.title
r['description'] = model_obj.description
r['memory'] = model_obj.memory
r['env'] = model_obj.env
r['code_address'] = model_obj.code_address
r['app_host'] = model_obj.app_host
... | code_fim | hard | {
"lang": "python",
"repo": "mumulizi/app",
"path": "/model/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db_table = "app"
id = IntegerField()
user_id = IntegerField()
title = CharField(max_length=20)
description = CharField(max_length=200)
memory = IntegerField()
env = CharField(max_length=20)
code_address = CharField(max_length=255)
app_host = CharField(max_length=200... | code_fim | medium | {
"lang": "python",
"repo": "mumulizi/app",
"path": "/model/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mumulizi/app path: /model/app.py
# coding:UTF-8
"""
应用模型
@author: yubang
"""
from peewee import CharField, IntegerField, DateTimeField
from model.base import BaseModel
from model.app_container import AppContainModel
<|fim_suffix|> class Meta:
db_table = "app"
id = IntegerField()... | code_fim | medium | {
"lang": "python",
"repo": "mumulizi/app",
"path": "/model/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UpsampleLike(tf.keras.layers.Layer):
"""
Keras layer for upsampling a Tensor to be the same shape as another Tensor.
"""
def call(self, inputs, **kwargs):
"""
Upsamples the tensor.
Args:
inputs : List of [source, target] tensors.
"""
... | code_fim | medium | {
"lang": "python",
"repo": "GaetanLepage/tf-retinanet",
"path": "/tf_retinanet/layers/upsample_like.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GaetanLepage/tf-retinanet path: /tf_retinanet/layers/upsample_like.py
"""
Copyright 2017-2019 Fizyr (https://fizyr.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | code_fim | hard | {
"lang": "python",
"repo": "GaetanLepage/tf-retinanet",
"path": "/tf_retinanet/layers/upsample_like.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def serialize_json(json_data):
"""
Serialize Python dict to JSON-formatted, UTF-8 encoded string
"""
return json.dumps(json_data).encode("utf-8")<|fim_prefix|># repo: Waelson/SF-Crime-Statistics-with-Spark-Streaming path: /producer_server.py
from kafk... | code_fim | hard | {
"lang": "python",
"repo": "Waelson/SF-Crime-Statistics-with-Spark-Streaming",
"path": "/producer_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Waelson/SF-Crime-Statistics-with-Spark-Streaming path: /producer_server.py
from kafka import KafkaProducer
import json
import time
class ProducerServer(KafkaProducer):
def __init__(self, input_file, topic, **kwargs):
super().__init__(**kwargs)
self.input_file = input_file
... | code_fim | hard | {
"lang": "python",
"repo": "Waelson/SF-Crime-Statistics-with-Spark-Streaming",
"path": "/producer_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {
"reporter": "John Doe",
"location": {
"floor": 7
}
}
try:
WinstonParser(payload).validate()
except Exception as e:
self.fail(f"test_valid_schema() raised {e.__class__.__name__}")
de... | code_fim | medium | {
"lang": "python",
"repo": "gorillalogic/ns-alert-api",
"path": "/test/rest/parsers/test_winston_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gorillalogic/ns-alert-api path: /test/rest/parsers/test_winston_parser.py
import unittest
import jsonschema
from rest.parsers.winston_parser import WinstonParser
<|fim_suffix|> def test_invalid_payload(self):
payload = {
"reporter": "John Doe"
}
with self.... | code_fim | hard | {
"lang": "python",
"repo": "gorillalogic/ns-alert-api",
"path": "/test/rest/parsers/test_winston_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {
"reporter": "John Doe"
}
with self.assertRaises(jsonschema.exceptions.ValidationError):
WinstonParser(payload).validate()<|fim_prefix|># repo: gorillalogic/ns-alert-api path: /test/rest/parsers/test_winston_parser.py
import unittest
import jsons... | code_fim | medium | {
"lang": "python",
"repo": "gorillalogic/ns-alert-api",
"path": "/test/rest/parsers/test_winston_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mishaploid/Bo-demography path: /rules/trash/smc.smk
# Demographic history with SMC++
# adapted from lovely script by cattlefriends Harly Durbin & Troy Rowan
# This command will parse data for the contig chr1 for samples S1 and S2
# which are members of population Pop1
# produces output for each ... | code_fim | hard | {
"lang": "python",
"repo": "mishaploid/Bo-demography",
"path": "/rules/trash/smc.smk",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># rule smc_cv_time:
# input:
# smc_chr = lambda wildcards: expand('models/smc/input_c150k/{pop}.{chr}.smc.gz', chr = chr, pop = wildcards.pop)
# output:
# expand("models/smc/cv_time_c150k/{{pop}}/fold{fold}/model.final.json", fold = ['0','1'])
# threads: 16
# params:
# model_in = "models/smc/inp... | code_fim | hard | {
"lang": "python",
"repo": "mishaploid/Bo-demography",
"path": "/rules/trash/smc.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nextdoor/ndscheduler path: /ndscheduler/default_settings.py
"""Default settings."""
import logging
import os
#
# Development mode or production mode
# If DEBUG is True, then auto-reload is enabled, i.e., when code is modified, server will be
# reloaded immediately
#
DEBUG = True
#
# Static As... | code_fim | hard | {
"lang": "python",
"repo": "Nextdoor/ndscheduler",
"path": "/ndscheduler/default_settings.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># See different database providers in ndscheduler/core/datastore/providers/
# SQLite
#
DATABASE_CLASS = 'ndscheduler.corescheduler.datastore.providers.sqlite.DatastoreSqlite'
DATABASE_CONFIG_DICT = {
'file_path': 'datastore.db'
}
# Postgres
#
# DATABASE_CLASS = 'ndscheduler.corescheduler.datastore.p... | code_fim | hard | {
"lang": "python",
"repo": "Nextdoor/ndscheduler",
"path": "/ndscheduler/default_settings.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if timeout == 0:
return _ok()
# we're polling to end of file. Socket and fd are open,
# fd is at EOF. Wait for file size to change
pos = fd.tell()
remaining_timeout = timeout
while remaining_timeout > 0:
... | code_fim | hard | {
"lang": "python",
"repo": "oolorg/opencenter-agent",
"path": "/opencenteragent/modules/output_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oolorg/opencenter-agent path: /opencenteragent/modules/output_manager.py
#!/usr/bin/env python
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License,... | code_fim | hard | {
"lang": "python",
"repo": "oolorg/opencenter-agent",
"path": "/opencenteragent/modules/output_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>nput, expected):
assert eval(test_input) == expected<|fim_prefix|># repo: JetBrains/intellij-community path: /python/testData/testRunner/env/pytest/parametrized/test_pytest_parametrized.py
import pytest
@pytest.mark.parametrize("test_input,expected", [
("three plus file", 8),
("(2)+(4)", 6)<|... | code_fim | easy | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/testData/testRunner/env/pytest/parametrized/test_pytest_parametrized.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/testData/testRunner/env/pytest/parametrized/test_pytest_parametrized.py
import pytest
@pytest.mark.parametrize("test_input,expe<|fim_suffix|>nput, expected):
assert eval(test_input) == expected<|fim_middle|>cted", [
("three plus file", 8),
("... | code_fim | medium | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/testData/testRunner/env/pytest/parametrized/test_pytest_parametrized.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>litted[1]) < 0 or int(splitted[1]) > 59:
return False
return True<|fim_prefix|># repo: netor27/codefights-solutions path: /arcade/python/arcade-theCore/16_TimeRiver/130_ValidTime.py
def validTime(time):
if time is None:
return False
splitted = time.split(":")
if len(splitt... | code_fim | medium | {
"lang": "python",
"repo": "netor27/codefights-solutions",
"path": "/arcade/python/arcade-theCore/16_TimeRiver/130_ValidTime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netor27/codefights-solutions path: /arcade/python/arcade-theCore/16_TimeRiver/130_ValidTime.py
def validTime(time):
if time is None:
return False
splitted = time.split(":")
if len(splitted) != 2:
return False
if int(<|fim_suffix|>litted[1]) < 0 or int(splitted[1])... | code_fim | medium | {
"lang": "python",
"repo": "netor27/codefights-solutions",
"path": "/arcade/python/arcade-theCore/16_TimeRiver/130_ValidTime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MolSSI/mmschema path: /mmschema/dev/forcefield/nonbonded.py
"""
The json-schema for the NonBonded model definition
"""
import mmelemental
import sys
__all__ = ["NonBonded"]
current_module = sys.modules[__name__]
<|fim_suffix|>for (
name,
obj,
) in mmelemental.models.forcefield.nonbonded... | code_fim | hard | {
"lang": "python",
"repo": "MolSSI/mmschema",
"path": "/mmschema/dev/forcefield/nonbonded.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for (
name,
obj,
) in mmelemental.models.forcefield.nonbonded.NonBonded.supported_potentials.items():
__all__.append(name)
setattr(current_module, name, obj.schema())<|fim_prefix|># repo: MolSSI/mmschema path: /mmschema/dev/forcefield/nonbonded.py
"""
The json-schema for the NonBonded mod... | code_fim | hard | {
"lang": "python",
"repo": "MolSSI/mmschema",
"path": "/mmschema/dev/forcefield/nonbonded.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open("rRNA_allele_summary.txt", "w") as outfile:
outfile.write("sample\t23S_A2059G\t23S_C2611T\t16S_C1192T\t16S_G478T\n")
for s in A2059G:
pos_1192_16S = alleles_16S[s]["1192"]
pos_478_16S = alleles_16S[s]["478"]
outfile.write(f"{s}\t{A2059G[s]}... | code_fim | hard | {
"lang": "python",
"repo": "gradlab/rplD-conditional-gwas",
"path": "/software/scripts/rRNA_variants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gradlab/rplD-conditional-gwas path: /software/scripts/rRNA_variants.py
#!/usr/bin/env python
import sys
import argparse
import os
from datetime import datetime
def get_args():
parser = argparse.ArgumentParser(description='Parse rRNA VCFs')
parser.add_argument("dir23S", help="23S VCFs di... | code_fim | hard | {
"lang": "python",
"repo": "gradlab/rplD-conditional-gwas",
"path": "/software/scripts/rRNA_variants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>copy_number_dict_A2059G = call_copy_number(dict_23S_freqs, "2051")
copy_number_dict_C2611T = call_copy_number(dict_23S_freqs, "2603")
write_itol_23S(copy_number_dict_A2059G, ["#ffffff", "#ffffcc", "#c2e699", "#78c679", "#238443"], "23S_A2059G")
write_itol_23S(copy_number_dict_C2611T, ["#ffffff", "#f6eff7"... | code_fim | hard | {
"lang": "python",
"repo": "gradlab/rplD-conditional-gwas",
"path": "/software/scripts/rRNA_variants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Load the annotations
annots_dict = {}
with open(annot_fp, 'r') as f:
for l in f:
larr = l[:-1].split(",")
annots_dict[larr[0]] = larr[6:]
header_str = "seq_id\tpident\tgenus\tspecies"
if out_fp != "":
out = open(out_fp, 'w')
out.write("... | code_fim | hard | {
"lang": "python",
"repo": "mattmiller899/biosys-analytics",
"path": "/assignments/07-csv/blastomatic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattmiller899/biosys-analytics path: /assignments/07-csv/blastomatic.py
#!/usr/bin/env python3
"""
Author : mattmiller899
Date : 2019-03-13
Purpose: Rock the Casbah
"""
import argparse
import sys
import os
# --------------------------------------------------
def get_args():
"""get command... | code_fim | hard | {
"lang": "python",
"repo": "mattmiller899/biosys-analytics",
"path": "/assignments/07-csv/blastomatic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif col.lower().strip() in ["eaf", "freq1", "af_coded_all", "effallelefreq"]:
original_colnames[index] = "EAF"
elif col.lower().strip() in ["n", "ntot", "n_total"]:
original_colnames[index] = "N"
elif col.lower().strip() in ["ncase", "ncases", "n_case", "... | code_fim | hard | {
"lang": "python",
"repo": "swvanderlaan/MetaGWASToolKit",
"path": "/UTILITYSCRIPTS/fixheaders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif col.lower().strip() in ["pos", "position", "bp"]:
original_colnames[index] = "Position"
elif col.lower().strip() in ["effallele", "eff_allele", "effectallele", "effect_allele", "coded_all", "codedall", "allele1"]:
original_colnames[index] = "Effect_allele"
... | code_fim | hard | {
"lang": "python",
"repo": "swvanderlaan/MetaGWASToolKit",
"path": "/UTILITYSCRIPTS/fixheaders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swvanderlaan/MetaGWASToolKit path: /UTILITYSCRIPTS/fixheaders.py
#!/hpc/local/CentOS7/dhl_ec/software/python37/bin/python3
"""
Python script that do some basic checks for cohort files
Written by Moezammin Baksi BSc.
Last edited: 16/03/2021
"""
"""
EXAMPLE Usage (BASH) + SLURM
-----------------... | code_fim | hard | {
"lang": "python",
"repo": "swvanderlaan/MetaGWASToolKit",
"path": "/UTILITYSCRIPTS/fixheaders.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fop = models.ForeignKey(Fop, related_name='kveds', on_delete=models.CASCADE, db_index=True,
verbose_name='entrepreneur')
kved = models.ForeignKey(Kved, on_delete=models.CASCADE, verbose_name='NACE')
primary_kved = models.BooleanField('declared as primary', default=F... | code_fim | medium | {
"lang": "python",
"repo": "OlexandrTopuzov/Data_converter",
"path": "/business_register/models/fop_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OlexandrTopuzov/Data_converter path: /business_register/models/fop_models.py
from django.db import models
from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords
from business_register.models.kved_models import Kved
from data_ocean.models import... | code_fim | hard | {
"lang": "python",
"repo": "OlexandrTopuzov/Data_converter",
"path": "/business_register/models/fop_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcefanitoli/recipe_manager path: /app/rms_core/migrations/0001_initial.py
# Generated by Django 3.1 on 2020-08-23 15:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operat... | code_fim | hard | {
"lang": "python",
"repo": "marcefanitoli/recipe_manager",
"path": "/app/rms_core/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lt='', max_length=200)),
('changes', models.CharField(blank=True, default='todo', max_length=200)),
('rating', models.IntegerField()),
('recipe', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='rms_core.recipes')),
],
... | code_fim | hard | {
"lang": "python",
"repo": "marcefanitoli/recipe_manager",
"path": "/app/rms_core/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/788262/snippet.py
import re
import simplejson
def camelize(value):
ret = "".join([w.title() for w in re.split(re.compile("[\W_]*"), value)])
lower = ret[0].lower()
return "%s%s" % (lower, ret[1:])
<|fim_suffix|> return simplejson.dumps(wha... | code_fim | hard | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/788262/snippet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return simplejson.dumps(what)
def json_decode(json):
return simplejson.loads(json)<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/788262/snippet.py
import re
import simplejson
def camelize(value):
ret = "".join([w.title() for w in re.split(re.compile("[\W_]*"), value)])
... | code_fim | hard | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/788262/snippet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def dasherize(value):
return re.sub(r'_', r'-', decamelize(value))
class JsonEncoder(simplejson.JSONEncoder):
def default(self, obj):
if isinstance(obj, list):
return [o.view() if isinstance(o, Base) else simplejson.JSONEncoder.default(self, o) for o in obj]
elif i... | code_fim | medium | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/788262/snippet.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.