text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: aguschanchu/dbcreame path: /db/tools/price_calculator.py
from django.conf import settings
import numpy as np
import json
import urllib3
from urllib3.util import Retry
from urllib3 import PoolManager, ProxyManager, Timeout
from urllib3.exceptions import MaxRetryError, TimeoutError
urllib3.disable_... | code_fim | medium | {
"lang": "python",
"repo": "aguschanchu/dbcreame",
"path": "/db/tools/price_calculator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return res
# This function dump the given dictionary into a yaml file with the file name
# specified through a dialog
def writeDumpFileDialog(window, content):
filename = asksaveasfilename(parent=window, title="Gives a file name",\
defaultextension=".yaml", filetypes=[("YAML file", "*.yaml")])
... | code_fim | medium | {
"lang": "python",
"repo": "pengy25/rosparam_tuner_gui",
"path": "/src/rosparam_tuner_gui/utility.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pengy25/rosparam_tuner_gui path: /src/rosparam_tuner_gui/utility.py
#! /usr/bin/evn python
import rospy
import yaml
from tkFileDialog import askopenfilename, asksaveasfilename
# This function gives a dialog to obtain the yaml file and load the supported
# value types only
def readDumpFileDialog(... | code_fim | medium | {
"lang": "python",
"repo": "pengy25/rosparam_tuner_gui",
"path": "/src/rosparam_tuner_gui/utility.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename = asksaveasfilename(parent=window, title="Gives a file name",\
defaultextension=".yaml", filetypes=[("YAML file", "*.yaml")])
if filename:
fd = open(filename, "w+")
yaml.dump(content, fd, default_flow_style=False)
fd.close()<|fim_prefix|># repo: pengy25/rosparam_tuner_gui pat... | code_fim | medium | {
"lang": "python",
"repo": "pengy25/rosparam_tuner_gui",
"path": "/src/rosparam_tuner_gui/utility.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def executed_tests(self):
if self.skipped:
return self.tests - self.skipped
return self.tests
@property
def ciurl_type(self):
if 'travis' in self.ciurl:
return 'Tra'
elif 'appveyor' in self.ciurl:
return 'Apv'
... | code_fim | hard | {
"lang": "python",
"repo": "seisplot-coder-s/reporter",
"path": "/src/reporter/core/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.sum:
if self.errors:
return "glyphicon glyphicon-remove"
else:
return "glyphicon glyphicon-remove"
else:
return "glyphicon glyphicon-ok"
@property
def next_id(self):
obj = self.get_next_by_datetime... | code_fim | hard | {
"lang": "python",
"repo": "seisplot-coder-s/reporter",
"path": "/src/reporter/core/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seisplot-coder-s/reporter path: /src/reporter/core/models.py
# -*- coding: utf-8 -*-
import time
from django.db import models
from django.urls.base import reverse
from mptt.models import MPTTModel, TreeForeignKey
from taggit.managers import TaggableManager
class Report(models.Model):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "seisplot-coder-s/reporter",
"path": "/src/reporter/core/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert response.status_code == HTTP_200_OK
expected_keys = {'code', 'domain', 'name'}
assert json_response['count'] == 1
assert set(json_response['results'][0]) == expected_keys
assert json_response['results'][0]['domain'] == domain.code
assert json_response['results'][0]['code'] =... | code_fim | medium | {
"lang": "python",
"repo": "City-of-Helsinki/parkkihubi",
"path": "/parkings/tests/api/operator/permit_area.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-of-Helsinki/parkkihubi path: /parkings/tests/api/operator/permit_area.py
from django.urls import reverse
from rest_framework.status import HTTP_200_OK
from parkings.models import EnforcementDomain, PermitArea
from ..enforcement.test_check_parking import create_area_geom
<|fim_suffix|>def ... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Helsinki/parkkihubi",
"path": "/parkings/tests/api/operator/permit_area.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def transform(self, X):
if self.transform_cols is None:
raise NotFittedError(f"This {self.__class__.__name__} instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.")
features = list(self.stat_df[self.stat_df['support']]['feature_nam... | code_fim | hard | {
"lang": "python",
"repo": "Hann-THL/DATA_SCIENCE",
"path": "/python/feature_selection/lib/_class/DFExhaustiveFeatureSelector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hann-THL/DATA_SCIENCE path: /python/feature_selection/lib/_class/DFExhaustiveFeatureSelector.py
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.exceptions import NotFittedError
from mlxtend.feature_selection import ExhaustiveFeatureSelector
import pandas as pd
class DFExhau... | code_fim | hard | {
"lang": "python",
"repo": "Hann-THL/DATA_SCIENCE",
"path": "/python/feature_selection/lib/_class/DFExhaustiveFeatureSelector.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def fit(self, X, y):
self.columns = X.columns if self.columns is None else self.columns
self.transform_cols = [x for x in X.columns if x in self.columns]
self.selector.fit(X[self.transform_cols], y)
self.stat_df = pd.DataFrame.from_dict(self.selector.get_metric_... | code_fim | hard | {
"lang": "python",
"repo": "Hann-THL/DATA_SCIENCE",
"path": "/python/feature_selection/lib/_class/DFExhaustiveFeatureSelector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if last_num not in count.keys():
set_new_count(last_num, turn, count)
else:
update_count(last_num, turn, count)
if __name__ == "__main__":
print("30000000th Turn - last number: {}".format(part_1()))<|fim_prefix|># repo: m0mosenpai/dsagrind path: /AdventOfCode_... | code_fim | hard | {
"lang": "python",
"repo": "m0mosenpai/dsagrind",
"path": "/AdventOfCode_2020/15_rambunctious_recitation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if turn <= len(PUZZLE_INPUT):
last_num = PUZZLE_INPUT[turn - 1]
else:
last_num = 0 if count[last_num][0] == 1 else get_new_number(last_num, count)
if last_num not in count.keys():
set_new_count(last_num, turn, count)
else:
up... | code_fim | hard | {
"lang": "python",
"repo": "m0mosenpai/dsagrind",
"path": "/AdventOfCode_2020/15_rambunctious_recitation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m0mosenpai/dsagrind path: /AdventOfCode_2020/15_rambunctious_recitation.py
#!/usr/bin/env python3.9
# 0, 3, 6
# count[0] = [2, {1, 4}]
# count[3] = [1, {None, 2}]
# count[6] = [1, {None, 3}]
#
# global
PUZZLE_INPUT = [20, 0, 1, 11, 6, 3]
def set_new_count(num, turn, count):
count[num] = [1... | code_fim | medium | {
"lang": "python",
"repo": "m0mosenpai/dsagrind",
"path": "/AdventOfCode_2020/15_rambunctious_recitation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(Generator, self).__init__()
self.name = 'generator'
self.latent_dim = latent_dim
self.x_dim = x_dim
self.verbose = verbose
self.dscale = dscale
self.scaled_x_lat = int(dscale*self.latent_dim)
self.scaled_x_dim = int(dscale*self.x_dim)
... | code_fim | hard | {
"lang": "python",
"repo": "zhampel/gaussGAN",
"path": "/gaussgan/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhampel/gaussGAN path: /gaussgan/models.py
from __future__ import print_function
try:
import numpy as np
from torch.autograd import Variable
from torch.autograd import grad as torch_grad
import torch.nn as nn
import torch.nn.functional as F
import torch
... | code_fim | hard | {
"lang": "python",
"repo": "zhampel/gaussGAN",
"path": "/gaussgan/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(Discriminator, self).__init__()
self.name = 'discriminator'
self.wass = wass_metric
self.dim = dim
self.verbose = verbose
self.dscale = dscale
self.scaled_x_dim = int(dscale*self.dim)
self.model = nn.Sequential(
... | code_fim | hard | {
"lang": "python",
"repo": "zhampel/gaussGAN",
"path": "/gaussgan/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomerwolgithub/Break path: /qdmr_parsing/model/seq2seq/simple_seq2seq_dynamic_predictor.py
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.predictors.predictor import Predictor
<|fim_suffix|> def predict(self, source:... | code_fim | hard | {
"lang": "python",
"repo": "tomerwolgithub/Break",
"path": "/qdmr_parsing/model/seq2seq/simple_seq2seq_dynamic_predictor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Expects JSON that looks like ``{"source": "..."}``.
"""
source = json_dict["source"]
allowed_tokens = json_dict["allowed_tokens"]
return self._dataset_reader.text_to_instance(source, allowed_tokens)<|fim_prefix|># repo: tomerwolgithub/Break path: /qdmr_... | code_fim | medium | {
"lang": "python",
"repo": "tomerwolgithub/Break",
"path": "/qdmr_parsing/model/seq2seq/simple_seq2seq_dynamic_predictor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return f"Employee('{self.title}', '{self.date_employee}')"<|fim_prefix|># repo: vutrongdong/Employee_Flask path: /FlaskApp/apps/Employees/models.py
from datetime import date
from FlaskApp import db
class Employee(db.Model):
<|fim_middle|> id = db.Column(db.Integer, pri... | code_fim | hard | {
"lang": "python",
"repo": "vutrongdong/Employee_Flask",
"path": "/FlaskApp/apps/Employees/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vutrongdong/Employee_Flask path: /FlaskApp/apps/Employees/models.py
from datetime import date
from FlaskApp import db
class Employee(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
address = db.Column(db.String(200), nullable=F... | code_fim | medium | {
"lang": "python",
"repo": "vutrongdong/Employee_Flask",
"path": "/FlaskApp/apps/Employees/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: r35krag0th/jsonstruct path: /jsonstruct/util.py
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Helper func... | code_fim | hard | {
"lang": "python",
"repo": "r35krag0th/jsonstruct",
"path": "/jsonstruct/util.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> def foo(): pass
>>> is_picklable('foo', foo)
False
"""
if name in tags.RESERVED:
return False
return not is_function(value)
def is_installed(module):
"""Tests to see if ``module`` is available on the sys.path
>>> is_installed('sys')
True
>>> is_insta... | code_fim | hard | {
"lang": "python",
"repo": "r35krag0th/jsonstruct",
"path": "/jsonstruct/util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yianxitong/peipei2 path: /supi/admin.py
from django.contrib import admin
from .models import Major,Student
class MajorAdmin(admin.ModelAdmin):
list_display=['pk','major','num_of_women','num_of_men','isDelete','school']
list_filter=['major']
search_fields=['major']
list_per_page=... | code_fim | medium | {
"lang": "python",
"repo": "yianxitong/peipei2",
"path": "/supi/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.gender:
return"男"
else:
return"女"
list_display=['sid','student_name','major',gender,'school','isDelete']
list_filter=['student_name']
search_fields=['student_name']
list_per_page=6
admin.site.register(Student,StudentsAdmin)<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "yianxitong/peipei2",
"path": "/supi/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def nearest_multiple( a, b ): # returns number smaller than a, which is the nearest multiple of b
return int(a/b) * b
# can be used for test dataset as well
def build_dataset(path="Preproc/Train/", load_frac=1.0, batch_size=None, tile=False, max_per_class=0):
class_names = get_class_names(pa... | code_fim | hard | {
"lang": "python",
"repo": "drscotthawley/panotti",
"path": "/panotti/datautils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (phase):
phasegram = make_phase_gram(signal[channel],sr, n_bins=mels)
layers = np.append(layers,phasegram,axis=3)
return layers
def nearest_multiple( a, b ): # returns number smaller than a, which is the nearest multiple of b
return int(a/b) * b
# can be u... | code_fim | hard | {
"lang": "python",
"repo": "drscotthawley/panotti",
"path": "/panotti/datautils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsiverskog/pyOCD path: /pyocd/target/builtin/target_CY8C6xxA.py
# pyOCD debugger
# Copyright (c) 2006-2013 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... | code_fim | hard | {
"lang": "python",
"repo": "jsiverskog/pyOCD",
"path": "/pyocd/target/builtin/target_CY8C6xxA.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.core_number == 0:
vtbase = self.read_memory(0x40201120) # VTBASE_CM0
elif self.core_number == 1:
vtbase = self.read_memory(0x40200200) # VTBASE_CM4
else:
raise exceptions.TargetError("Invalid CORE ID")
vtbase &= 0xFFFFFF00
... | code_fim | hard | {
"lang": "python",
"repo": "jsiverskog/pyOCD",
"path": "/pyocd/target/builtin/target_CY8C6xxA.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: derek-williams/RenderFarm path: /JobKill.py
# standard
from sys import argv
from socket import error as socketerror
# Project Hydra
from MySQLSetup import Hydra_rendertask, transaction, KILLED, READY, STARTED
from Connections import TCPConnection
from Questions import KillCurrentJobQuestion
fro... | code_fim | hard | {
"lang": "python",
"repo": "derek-williams/RenderFarm",
"path": "/JobKill.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Resurrects job with the given id. Tasks marked 'K' or 'F' will have
their data cleared and their statuses set to 'R'"""
with transaction() as t:
t.cur.execute("""update Hydra_rendertask
set status = 'R'
where job_id = '%d' and ... | code_fim | hard | {
"lang": "python",
"repo": "derek-williams/RenderFarm",
"path": "/JobKill.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>o de la multiplicacion es --> ", d)
elif a == 3 :
d = b / c
print("el resultado de la division es ---> ", d )
else:
print("el numeor de operacion ingresada no exixte")<|fim_prefix|># repo: andreali1/tra_ubunto path: /calculadora.py
print ("calculadora basica ")
print("ingrese el numero de operacion q... | code_fim | medium | {
"lang": "python",
"repo": "andreali1/tra_ubunto",
"path": "/calculadora.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andreali1/tra_ubunto path: /calculadora.py
print ("calculadora basica ")
print("ingrese el numero de operacion que desea realizar ")
print("opc 1 .-sumar ")
print("opc 2 .-restar ")
print("opc 3 .-dividir ")
print<|fim_suffix|>o de la multiplicacion es --> ", d)
elif a == 3 :
d = b / c
print("... | code_fim | hard | {
"lang": "python",
"repo": "andreali1/tra_ubunto",
"path": "/calculadora.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: limhaneul12/side_project path: /flask_project/average_prediction.py
import pymysql
import joblib
import pandas as pd
def linear_prediction(time):
linear = joblib.load("score.pkl")
score_prediction = linear.predict(time)
return score_prediction
class DataBase:
<|fim_suffix|> s... | code_fim | hard | {
"lang": "python",
"repo": "limhaneul12/side_project",
"path": "/flask_project/average_prediction.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 데이터 저장 및 평균
def data_saving_average(self):
average = self.get_sum() / 5
saving = DataBase().database_insert(average, self.time)
return average<|fim_prefix|># repo: limhaneul12/side_project path: /flask_project/average_prediction.py
import pymysql
import joblib
import pan... | code_fim | hard | {
"lang": "python",
"repo": "limhaneul12/side_project",
"path": "/flask_project/average_prediction.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, _client=None, minimum_length=None):
"""Creates a local `PasswordPolicy` instance
Parameters can be supplied on creation of the instance or given by
setting the properties on the instance after creation.
Parameters marked as `required` must be set fo... | code_fim | hard | {
"lang": "python",
"repo": "GQMai/mbed-cloud-sdk-python",
"path": "/src/mbed_cloud/foundation/entities/accounts/password_policy.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GQMai/mbed-cloud-sdk-python path: /src/mbed_cloud/foundation/entities/accounts/password_policy.py
"""
.. warning::
PasswordPolicy should not be imported directly from this module as the
organisation may change in the future, please use the :mod:`mbed_cloud.foundation` module to import ent... | code_fim | hard | {
"lang": "python",
"repo": "GQMai/mbed-cloud-sdk-python",
"path": "/src/mbed_cloud/foundation/entities/accounts/password_policy.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>}
_renames = {}
# Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>}
_renames_to_api = {}
def __init__(self, _client=None, minimum_length=None):
... | code_fim | hard | {
"lang": "python",
"repo": "GQMai/mbed-cloud-sdk-python",
"path": "/src/mbed_cloud/foundation/entities/accounts/password_policy.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>", "Paint", 1)
orders_list = [order1, order2, order3]<|fim_prefix|># repo: linabiel/week_3_day_3_flask_lab_lina-niall path: /models/order_list.py
from models.order import *
order1 = Order("Niall", <|fim_middle|>"April 14th", "Food", 1)
order2 = Order("Lina", "May 15th", "Books", 1)
order3 = Order("Bob",... | code_fim | medium | {
"lang": "python",
"repo": "linabiel/week_3_day_3_flask_lab_lina-niall",
"path": "/models/order_list.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linabiel/week_3_day_3_flask_lab_lina-niall path: /models/order_list.py
from models.order import *
order1 = Order("Niall", <|fim_suffix|> 15th", "Books", 1)
order3 = Order("Bob", "June 20th", "Paint", 1)
orders_list = [order1, order2, order3]<|fim_middle|>"April 14th", "Food", 1)
order2 = Order("... | code_fim | easy | {
"lang": "python",
"repo": "linabiel/week_3_day_3_flask_lab_lina-niall",
"path": "/models/order_list.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webclinic017/GraphARK path: /fastapi/app/sql_model_example/sql_m_config.py
from sqlmodel import Session, SQLModel, create_engine
<|fim_suffix|>SessionLocal2 = Session(engine)<|fim_middle|>import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
pg_url2 = os.environ.get("... | code_fim | medium | {
"lang": "python",
"repo": "webclinic017/GraphARK",
"path": "/fastapi/app/sql_model_example/sql_m_config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>SessionLocal2 = Session(engine)<|fim_prefix|># repo: webclinic017/GraphARK path: /fastapi/app/sql_model_example/sql_m_config.py
from sqlmodel import Session, SQLModel, create_engine
import os
from dotenv import load_dotenv, find_dotenv
<|fim_middle|>load_dotenv(find_dotenv())
pg_url2 = os.environ.get("... | code_fim | medium | {
"lang": "python",
"repo": "webclinic017/GraphARK",
"path": "/fastapi/app/sql_model_example/sql_m_config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RishabhBrajabasi/Internship_IITB path: /Filter Bank.py
from scipy.io import wavfile
import math
import re
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
def moving_average(interval, window_size):
window = np.ones(int(window_size)) / float(window_s... | code_fim | hard | {
"lang": "python",
"repo": "RishabhBrajabasi/Internship_IITB",
"path": "/Filter Bank.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>st_energy = []
for i in range(no_frames): # Calculating frame wise short term energy
frame = data[i * hop_size:i * hop_size + window_size] * window_type # Multiplying each frame with a hamming window
st_energy.append(sum(frame ** 2)) # Calculating the short term energy
max_st_energy = max(st_en... | code_fim | hard | {
"lang": "python",
"repo": "RishabhBrajabasi/Internship_IITB",
"path": "/Filter Bank.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self) -> str:
output = {
'Union':{
'children': str(self.children)
}
}
return str(output)
class JoinNode(Node):
def __init__(self, join_predicate, children = []) -> None:
super().__init__(children=children)
... | code_fim | hard | {
"lang": "python",
"repo": "alti-tude/distributed_dbms",
"path": "/src/DDBMS/RATree/Nodes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alti-tude/distributed_dbms path: /src/DDBMS/RATree/Nodes.py
import json
from typing import List
from DDBMS.Parser.SQLQuery.Column import Column
from DDBMS.Parser.SQLQuery.Table import Table
from abc import ABC, abstractmethod
#TODO add a function to return the output dict as dict (for pretty pr... | code_fim | hard | {
"lang": "python",
"repo": "alti-tude/distributed_dbms",
"path": "/src/DDBMS/RATree/Nodes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def selfDividingNumbers(self, left: int, right: int) -> List[int]:
Ans=[]
for num in range(left,right+1):
done=True
temp=num
while(num):
n=num%10
if n==0 or temp%n!=0:
done=False
... | code_fim | hard | {
"lang": "python",
"repo": "SandeepPadhi/Algorithmic_Database",
"path": "/Math/Self_Dividing_Number.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SandeepPadhi/Algorithmic_Database path: /Math/Self_Dividing_Number.py
"""
Date:28/03/2021
728. Self Dividing Numbers - Leetcode Easy
<|fim_suffix|>class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
Ans=[]
for num in range(left,right+1):
... | code_fim | hard | {
"lang": "python",
"repo": "SandeepPadhi/Algorithmic_Database",
"path": "/Math/Self_Dividing_Number.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amrojas/comp_genom_final_project path: /src/cuckoo_bit_tree.py
from typing import List, Optional, Deque
from cuckoo_filter import CuckooFilterBit
from collections import deque
from read import Read
from copy import deepcopy
import sys
class CuckooBitTree:
def __init__(self, theta, k, num_b... | code_fim | hard | {
"lang": "python",
"repo": "amrojas/comp_genom_final_project",
"path": "/src/cuckoo_bit_tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, k, num_buckets, fp_size, bucket_size, max_iter):
"""
Represents a single node of Cuckoo Tree.
"""
self.children: List[Node] = []
self.parent: Optional[Node] = None
self.filter = CuckooFilterBit(num_buckets, fp_size, bucket_size, max_i... | code_fim | hard | {
"lang": "python",
"repo": "amrojas/comp_genom_final_project",
"path": "/src/cuckoo_bit_tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set appropriate parent/child pointers
current.parent = new_parent
node_to_insert.parent = new_parent
new_parent.children.append(current)
new_parent.children.append(node_to_insert)
# Special case where root i... | code_fim | hard | {
"lang": "python",
"repo": "amrojas/comp_genom_final_project",
"path": "/src/cuckoo_bit_tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dataiku/dss-plugin-nlp-named-entity-recognition path: /code-env/python/spec/resources_init.py
######################## Base imports #################################
from dataiku.code_env_resources import clear_all_env_vars
from dataiku.code_env_resources import set_env_path
####################... | code_fim | medium | {
"lang": "python",
"repo": "dataiku/dss-plugin-nlp-named-entity-recognition",
"path": "/code-env/python/spec/resources_init.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from flair.models import SequenceTagger
# Download pretrained model: automatically managed by Flair,
# does not download anything if model is already in FLAIR_CACHE_ROOT
SequenceTagger.load('flair/ner-english-fast@3d3d35790f78a00ef319939b9004209d1d05f788')
# Add any other models you want to download, che... | code_fim | medium | {
"lang": "python",
"repo": "dataiku/dss-plugin-nlp-named-entity-recognition",
"path": "/code-env/python/spec/resources_init.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vslavik/poedit path: /deps/boost/libs/python/test/numpy/dtype.py
#!/usr/bin/env python
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.... | code_fim | medium | {
"lang": "python",
"repo": "vslavik/poedit",
"path": "/deps/boost/libs/python/test/numpy/dtype.py",
"mode": "psm",
"license": "GPL-1.0-or-later",
"source": "the-stack-v2"
} |
<|fim_suffix|> for bits in (8, 16, 32, 64):
s = getattr(numpy, "int%d" % bits)
u = getattr(numpy, "uint%d" % bits)
fs = getattr(dtype_ext, "accept_int%d" % bits)
fu = getattr(dtype_ext, "accept_uint%d" % bits)
self.assertEquivalent(fs(s(1)), numpy.dtype... | code_fim | medium | {
"lang": "python",
"repo": "vslavik/poedit",
"path": "/deps/boost/libs/python/test/numpy/dtype.py",
"mode": "spm",
"license": "GPL-1.0-or-later",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SebastiaanZ/simple-django-app path: /simple_django_app/core/management/commands/waitforpostgres.py
"""
A module that provides a manage.py command to wait for a database.
Our Django-application can only start once our database server accepts
incoming connections. Since we cannot always guarantee ... | code_fim | medium | {
"lang": "python",
"repo": "SebastiaanZ/simple-django-app",
"path": "/simple_django_app/core/management/commands/waitforpostgres.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """A command to wait for postgres to become available."""
def add_arguments(self, parser: argparse.ArgumentParser) -> None:
"""Add additional arguments to the default argument parser."""
super().add_arguments(parser)
parser.add_argument(
"--database-attempts",
... | code_fim | hard | {
"lang": "python",
"repo": "SebastiaanZ/simple-django-app",
"path": "/simple_django_app/core/management/commands/waitforpostgres.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: colinroybell/aoc2020 path: /src/aoc2020/day18.py
import sys
import re
def compute_simple(line):
fields = line.split(' ')
N = (len(fields) - 1) // 2
n = int(fields.pop(0))
for i in range(0, N):
op = fields.pop(0)
val = int(fields.pop(0))
if op == '+':
... | code_fim | hard | {
"lang": "python",
"repo": "colinroybell/aoc2020",
"path": "/src/aoc2020/day18.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def part_b(filename):
return(both_parts(filename, 'b'))
def entry():
if 'a' in sys.argv:
print(part_a('data/day18.txt'))
if 'b' in sys.argv:
print(part_b('data/day18.txt'))
if __name__ == "__main__":
entry()<|fim_prefix|># repo: colinroybell/aoc2020 path: /src/aoc2020/... | code_fim | hard | {
"lang": "python",
"repo": "colinroybell/aoc2020",
"path": "/src/aoc2020/day18.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlg389/PySke path: /pyske/examples/list/fft.py
"""
Discrete Fast Fourier Transform
"""
import math
from functools import partial
from pyske.core import PList, par
# ------- Fast Fourier Transform ------------
def _bit_complement(index_k: int, index_i: int) -> int:
return index_i ^ (1 << ... | code_fim | hard | {
"lang": "python",
"repo": "mlg389/PySke",
"path": "/pyske/examples/list/fft.py",
"mode": "psm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|> import gc
from pyske.core import Timing
from pyske.examples.list import util
size, num_iter, _ = util.standard_parse_command_line(data_arg=False)
assert _is_power_of_2(size), "The size should be a power of 2."
assert _is_power_of_2(len(par.procs())), "The number of processors shoul... | code_fim | hard | {
"lang": "python",
"repo": "mlg389/PySke",
"path": "/pyske/examples/list/fft.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|> # pylint: disable=unsubscriptable-object
"""
Return the Discrete Fourier Transform.
Examples::
>>> from pyske.core import PList
>>> fft(PList.init(lambda _: 1.0, 128)).to_seq()[0]
(128+0j)
:param input_list: a PySke list of floating point numbers
:return:... | code_fim | hard | {
"lang": "python",
"repo": "mlg389/PySke",
"path": "/pyske/examples/list/fft.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|> line in sys.stdin:
if first_line:
first_line = 0
else:
cur_case_line +=1
if cur_case not in all_data:
all_data[cur_case] = [int(line.strip('\n'))]
elif cur_case_line < 6:
all_data[cur_case].append(int(line.strip('\n')))
else:
all_data[cur_case].append(list(map(int,line.strip('\n').sp... | code_fim | hard | {
"lang": "python",
"repo": "onionhoney/codesprint",
"path": "/judge/sessions/2018Individual/jillzhoujinjing@gmail.com/PD_03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onionhoney/codesprint path: /judge/sessions/2018Individual/jillzhoujinjing@gmail.com/PD_03.py
import sys
def find_time(data):
ele_floor = data[0]
stop_floor = data[1]
walk_floor = data[2]
num_floor = data[3]
floor_arr =list(set(data[5]))
floor_arr.sort()
num_ppl = len(floor_arr)
min_sec ... | code_fim | hard | {
"lang": "python",
"repo": "onionhoney/codesprint",
"path": "/judge/sessions/2018Individual/jillzhoujinjing@gmail.com/PD_03.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)*ele_floor
cur_record[floor_arr[i]] = per_sec
ele_time += (floor_arr[i]-floor_arr[i-1])*ele_floor + stop_floor
if per_sec > cur_sec:
cur_sec = per_sec
if cur_sec < min_sec:
min_sec = cur_sec
record[floor_th] = min_sec
last_cal = (floor_arr[num_ppl-1]-1)*walk_floor
if last_ca... | code_fim | hard | {
"lang": "python",
"repo": "onionhoney/codesprint",
"path": "/judge/sessions/2018Individual/jillzhoujinjing@gmail.com/PD_03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
drama_title = pandas.DataFrame({'Broadcaster' : broad_list,'title' : title_list,'type' : type_list})
f=open("C:/Users/jaehyun/Crawling/drama_list/SBS.csv","w")
f.write(pandas.DataFrame.to_csv(drama_title))
f.close()<|fim_prefix|># repo: jungsugi/snp_500_Grouping path: /Web_Crawler/sbs_drama_list_cra... | code_fim | hard | {
"lang": "python",
"repo": "jungsugi/snp_500_Grouping",
"path": "/Web_Crawler/sbs_drama_list_crawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
drama_title = pandas.DataFrame({'Broadcaster' : broad_list,'title' : title_list,'type' : type_list})
f=open("C:/Users/jaehyun/Crawling/drama_list/SBS.csv","w")
f.write(pandas.DataFrame.to_csv(drama_title))
f.close()<|fim_prefix|># repo: jungsugi/snp_500_Grouping path: /Web_Crawler/sbs_dram... | code_fim | hard | {
"lang": "python",
"repo": "jungsugi/snp_500_Grouping",
"path": "/Web_Crawler/sbs_drama_list_crawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jungsugi/snp_500_Grouping path: /Web_Crawler/sbs_drama_list_crawler.py
from bs4 import BeautifulSoup
import pandas
import time
from selenium import webdriver
url = 'http://w3.sbs.co.kr/tv/tvsectionMainImg.do?pgmCtg=T&pgmSct=DR&pgmSort=week&div=pc_drama'
driver = webdriver.Firefox()
driver.get(u... | code_fim | medium | {
"lang": "python",
"repo": "jungsugi/snp_500_Grouping",
"path": "/Web_Crawler/sbs_drama_list_crawler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestIntersection(unittest.TestCase):
def test_intersecting(self):
n1 = Node(1)
n2 = Node(2)
n1.next = n2
n3 = Node(3)
n2.next = n3
n4 = Node(4)
n5 = Node(5)
n5.next = n4
n4.next = n2
ll1 = LinkedList()
ll1.h... | code_fim | hard | {
"lang": "python",
"repo": "jinayshah86/DSA",
"path": "/CtCI-6th-Edition/Chapter2/2_7/intersection_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jinayshah86/DSA path: /CtCI-6th-Edition/Chapter2/2_7/intersection_2.py
# Q. Given two (singly) linked list, determine if the two lists intersect.
# Return the intersecting node. Note that the intersection is defined based on
# reference, not value. That is, the kth node of the first linked list i... | code_fim | hard | {
"lang": "python",
"repo": "jinayshah86/DSA",
"path": "/CtCI-6th-Edition/Chapter2/2_7/intersection_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while p1:
if p1 is p2:
return p1
p1 = p1.next
p2 = p2.next
return None
class TestIntersection(unittest.TestCase):
def test_intersecting(self):
n1 = Node(1)
n2 = Node(2)
n1.next = n2
n3 = Node(3)
... | code_fim | hard | {
"lang": "python",
"repo": "jinayshah86/DSA",
"path": "/CtCI-6th-Edition/Chapter2/2_7/intersection_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nickcordella/CarND-Vehicle-Detection-Submission5 path: /Vehicle Detection.py
(nx_windows):
# Calculate window position
startx = xs*nx_pix_per_step + x_start_stop[0]
endx = startx + xy_window[0]
starty = ys*ny_pix_per_step + y_start_stop[0]
... | code_fim | hard | {
"lang": "python",
"repo": "nickcordella/CarND-Vehicle-Detection-Submission5",
"path": "/Vehicle Detection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if test_prediction == 1:
xbox_left = np.int(xleft*scale)
ytop_draw = np.int(ytop*scale)
win_draw = np.int(window*scale)
bboxes.append(((xbox_left + xstart, ytop_draw+ystart),(xbox_left+win_draw+xstart,ytop_draw+win_draw+ystart)))
... | code_fim | hard | {
"lang": "python",
"repo": "nickcordella/CarND-Vehicle-Detection-Submission5",
"path": "/Vehicle Detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# In[11]:
# Define a single function that can extract features using hog sub-sampling and make predictions
def find_cars(img, color_space, xstart, xstop, ystart, ystop, scale, svc, X_scaler, orient, pix_per_cell, cell_per_block, spatial_size, hist_bins, spatial_feat):
# draw_img = np.copy(img)
... | code_fim | hard | {
"lang": "python",
"repo": "nickcordella/CarND-Vehicle-Detection-Submission5",
"path": "/Vehicle Detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = ''
for y in range(height):
for x in range(0, width, 2):
green_pair_diff = abs(image.getpixel((x, y))[1] - image.getpixel((x + 1, y))[1])
if green_pair_diff != 42:
message += chr(green_pair_diff)
print(message)
print(whodunnit()... | code_fim | hard | {
"lang": "python",
"repo": "alexandrofernando/python",
"path": "/pythonchallenge/P28.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexandrofernando/python path: /pythonchallenge/P28.py
#!/usr/bin/env python3
# Q: http://www.pythonchallenge.com/pc/ring/bell.html
# A: http://www.pythonchallenge.com/pc/ring/guido.html
import urllib.request
from PIL import Image
import PC_Util
def whodunnit():
return 'Guido van Rossum'.l... | code_fim | medium | {
"lang": "python",
"repo": "alexandrofernando/python",
"path": "/pythonchallenge/P28.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'Guido van Rossum'.lower()
def main():
PC_Util.configure_auth()
local_filename = urllib.request.urlretrieve('http://www.pythonchallenge.com/pc/ring/bell.png')[0]
image = Image.open(local_filename)
width, height = image.size
message = ''
for y in range(height):
... | code_fim | medium | {
"lang": "python",
"repo": "alexandrofernando/python",
"path": "/pythonchallenge/P28.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sar009/project-euler path: /018/18.py
file=open("18.txt", "r")
a=[[int(val) for val in line.split()] for line in<|fim_suffix|>(size-1, -1, -1):
for j in range(0, c, 1):
if (a[i][j]+b[j]>a[i][j]+b[j+1]):
b[j]=a[i][j]+b[j]
else:
b[j]=a[i][j]+b[j+1]
c-=1
print(b[0])<|fim_middle|> file.re... | code_fim | medium | {
"lang": "python",
"repo": "sar009/project-euler",
"path": "/018/18.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>+1]):
b[j]=a[i][j]+b[j]
else:
b[j]=a[i][j]+b[j+1]
c-=1
print(b[0])<|fim_prefix|># repo: sar009/project-euler path: /018/18.py
file=open("18.txt", "r")
a=[[int(val) for val in line.split()] for line in<|fim_middle|> file.readlines()]
file.close()
b=a[-1]
c=size=a.__len__()-1
for i in range(size-1... | code_fim | medium | {
"lang": "python",
"repo": "sar009/project-euler",
"path": "/018/18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('sanskrit', '0018_auto_20200326_2050'),
]
operations = [
migrations.AddField(
model_name='userprogress',
name='day',
field=models.DateField(null=True),
),
]<|fim_prefix|># repo: Rohit-Bhandari/LearnSanskrit pat... | code_fim | easy | {
"lang": "python",
"repo": "Rohit-Bhandari/LearnSanskrit",
"path": "/sanskrit/migrations/0019_userprogress_day.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rohit-Bhandari/LearnSanskrit path: /sanskrit/migrations/0019_userprogress_day.py
# Generated by Django 2.2.6 on 2020-03-28 16:38
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('sanskrit', '0018_auto_20200326_2050'),
]
operations = [
migrat... | code_fim | easy | {
"lang": "python",
"repo": "Rohit-Bhandari/LearnSanskrit",
"path": "/sanskrit/migrations/0019_userprogress_day.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('sanskrit', '0018_auto_20200326_2050'),
]
operations = [
migrations.AddField(
model_name='userprogress',
name='day',
field=models.DateField(null=True),
),
]<|fim_prefix|>... | code_fim | easy | {
"lang": "python",
"repo": "Rohit-Bhandari/LearnSanskrit",
"path": "/sanskrit/migrations/0019_userprogress_day.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>rng = random.PRNGKey(4)
rng, key = random.split(rng)
m = survae.rvs(rng,4)
print(m)
print(m.dot(m.T))<|fim_prefix|># repo: shayan-kousha/SurVAE path: /unit_test/US1.20/test_rvs.py
import sys
sys.path.append(".")
import survae
<|fim_middle|>from jax import numpy as jnp, random
import jax
| code_fim | easy | {
"lang": "python",
"repo": "shayan-kousha/SurVAE",
"path": "/unit_test/US1.20/test_rvs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shayan-kousha/SurVAE path: /unit_test/US1.20/test_rvs.py
import sys
sys.path.append(".")
import survae
from jax import numpy as jnp, random
import jax
rng = random.PRNGKey(4)
rng, key = random.split(rng)
<|fim_suffix|>print(m)
print(m.dot(m.T))<|fim_middle|>m = survae.rvs(rng,4)
| code_fim | easy | {
"lang": "python",
"repo": "shayan-kousha/SurVAE",
"path": "/unit_test/US1.20/test_rvs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>m = survae.rvs(rng,4)
print(m)
print(m.dot(m.T))<|fim_prefix|># repo: shayan-kousha/SurVAE path: /unit_test/US1.20/test_rvs.py
import sys
sys.path.append(".")
import survae
from jax import numpy as jnp, random
import jax
<|fim_middle|>rng = random.PRNGKey(4)
rng, key = random.split(rng)
| code_fim | easy | {
"lang": "python",
"repo": "shayan-kousha/SurVAE",
"path": "/unit_test/US1.20/test_rvs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rfloyd01/Golf_Chip path: /Resources/Data_Sets/OGMatlab.py
from mat4py import loadmat
data = loadmat(R"C:/Users/Bobby/Documents/Coding/C++/BLE_33/BLE_33/Resources/Data_Sets/ExampleData.mat")
#print(data['Gyroscope'][0])
#print(data['Accelerometer'][0])
#print(data['Magnetometer'][0])
#print(data... | code_fim | hard | {
"lang": "python",
"repo": "rfloyd01/Golf_Chip",
"path": "/Resources/Data_Sets/OGMatlab.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for count in range(1):
for i in range(len(data['Gyroscope'])):
if(data['time'][time_count][0] > time_cutoff): break
file1.write(str(data['time'][time_count][0]))
file1.write(" ")
file1.write(str(data['Gyroscope'][start_location + i][0]))
file1.write(" ")
file1.write(str(data['Gyroscope'... | code_fim | hard | {
"lang": "python",
"repo": "rfloyd01/Golf_Chip",
"path": "/Resources/Data_Sets/OGMatlab.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(location, len(data['Gyroscope'])):
file1.write(str(data['time'][time_count][0]))
file1.write(" ")
file1.write(str(0))
file1.write(" ")
file1.write(str(0))
file1.write(" ")
file1.write(str(0))
file1.write(" ")
file1.write(str(data['Accelerometer'][location][0]))... | code_fim | hard | {
"lang": "python",
"repo": "rfloyd01/Golf_Chip",
"path": "/Resources/Data_Sets/OGMatlab.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sym170030/ML path: /CRSPData.py
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 21 14:55:53 2018
<|fim_suffix|>df1 = pd.read_csv('crsp.csv')
d3 = pd.merge(df, df1, on='gvkey') #merging based on gvkey<|fim_middle|>@author: Admin
"""
import pandas as pd
import numpy as np
df_path = "C:\ASM exam\c... | code_fim | hard | {
"lang": "python",
"repo": "sym170030/ML",
"path": "/CRSPData.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>df1 = pd.read_csv('crsp.csv')
d3 = pd.merge(df, df1, on='gvkey') #merging based on gvkey<|fim_prefix|># repo: sym170030/ML path: /CRSPData.py
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 21 14:55:53 2018
@author: Admin
"""
import pandas as pd
import numpy as np
df_path = "C:\ASM exam\cds_spread5y_20... | code_fim | hard | {
"lang": "python",
"repo": "sym170030/ML",
"path": "/CRSPData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>data = pd.io.stata.read_stata("C:\ASM exam\cds_spread5y_2001_2016.dta")
data.to_csv('my_stata_file.csv')
df = pd.read_csv('my_stata_file.csv')
print(df['gvkey'])
a = df.gvkey.unique()
np.savetxt('k1.txt', a,fmt='% 4d') ##saving gvkeys into text file
df1 = pd.read_csv('crsp.csv')
d3 = pd.merge(df, df1, o... | code_fim | medium | {
"lang": "python",
"repo": "sym170030/ML",
"path": "/CRSPData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlower/GWInference path: /GWInference_condor.py
##
import numpy as np
from scipy.misc import logsumexp
from scipy.interpolate import interp1d
import lal
import lalsimulation as lalsim
import emcee
from emcee import PTSampler
import GenWaveform as wv
import os, sys
import time
import matplotlib... | code_fim | hard | {
"lang": "python",
"repo": "mlower/GWInference",
"path": "/GWInference_condor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> angle_min, angle_max = 0., np.pi*2.
dist_min, dist_max = 50, 3000.
m1 = np.random.uniform(low=(m1_min+5), high=m1_max, size=(ntemps, nwalkers, 1))
m2 = np.random.uniform(low=m2_min, high=m2_max, size=(ntemps, nwalkers, 1))
if ecc == True:
ecc_min, ecc_max = np.log10(... | code_fim | hard | {
"lang": "python",
"repo": "mlower/GWInference",
"path": "/GWInference_condor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>【题目】 一种特殊的链表节点类描述如下:
public class Node {
public int value;
public Node next;
public Node rand;
public Node(int data) {
this.value = data;
}
}
Node类中的value是节点值,next指针和正常单链表中next指针的意义一样,都指向下一个节点
rand指针是Node类中新增的指针,这个指针可能指向链表中的任意一个节点,也可能指向null。
给定一个由Node节点类型组成的无环单链表的头节点head,请实... | code_fim | medium | {
"lang": "python",
"repo": "Pysuper/LetCODE",
"path": "/左神/02/z_n_13_复制含有随机指针节点的链表.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pysuper/LetCODE path: /左神/02/z_n_13_复制含有随机指针节点的链表.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/4/15 22:20
# @Author : Zheng Xingtao
# @File : z_n_13_复制含有随机指针节点的链表.py
"""
复制含有随机指针节点的链表
【题目】 一种特殊的链表节点类描述如下:
public class Node {
<|fim_suffix|> public Node(int data) {
... | code_fim | medium | {
"lang": "python",
"repo": "Pysuper/LetCODE",
"path": "/左神/02/z_n_13_复制含有随机指针节点的链表.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: David-Hatcher/CS-Classes path: /COP 4530 - Data Structures/Day 9/main.py
# Day 9 lecture notes
# Review
# The Secret of the Red Dot
# Slides with red dot are MORE IMPORTANT
# than the other slides
# Arrays,set,binsearch,bub sort, sel sort, insert sort, hash, stakcs, queues, recursion
# ... | code_fim | hard | {
"lang": "python",
"repo": "David-Hatcher/CS-Classes",
"path": "/COP 4530 - Data Structures/Day 9/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>st case performance is O(N)
# Everything in one slot
# Three Factors
# How much data
# How many cells avail in table
# What hash function is being used
# Stacks and Queues
# Temp data
# Stacks LIFO
# Push to stack - end
# Pop from stack - end#
# Queue FIFO
# ... | code_fim | hard | {
"lang": "python",
"repo": "David-Hatcher/CS-Classes",
"path": "/COP 4530 - Data Structures/Day 9/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("\n=== mlflow.xgboost.load_model")
model = mlflow.xgboost.load_model(args.model_uri)
print("model:", model)
predictions = model.predict(X_xgb)
print("predictions.type:", type(predictions))
print("predictions.shape:", predictions.shape)
print("predictions:", predictions)
... | code_fim | hard | {
"lang": "python",
"repo": "Teora/mlflow-examples",
"path": "/python/xgboost/predict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Teora/mlflow-examples path: /python/xgboost/predict.py
from argparse import ArgumentParser
import pandas as pd
from sklearn.model_selection import train_test_split
import xgboost as xgb
import mlflow
import mlflow.xgboost
print("Tracking URI:", mlflow.tracking.get_tracking_uri())
print("MLflow V... | code_fim | hard | {
"lang": "python",
"repo": "Teora/mlflow-examples",
"path": "/python/xgboost/predict.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.