text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: JuveVR/Homework_5 path: /Exercise_2.py
#2.1
class RectangularArea:
"""Class for work with square geometric instances """
def __init__(self, side_a, side_b):
"""
Defines to parameters of RectangularArea class. Checks parameters type.
:param side_a: length of side a
... | code_fim | hard | {
"lang": "python",
"repo": "JuveVR/Homework_5",
"path": "/Exercise_2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """重新写,改为c_x,c_y,u,v,s,p"""
'''c_x,c_y,u,v,s,p 太复杂,还是换四个点序,吧'''
# print(c_x,c_y,h,w,angle)
'''计算四个点的向量'''
x1 = (w / 2) * math.cos(angle) - (h / 2) * math.sin(angle)
y1 = (w / 2) * math.sin(angle) + (h / 2) * math.cos(angle)
x2 = (-w / 2) * math.cos(... | code_fim | hard | {
"lang": "python",
"repo": "zjbit/MONet",
"path": "/utils/datasets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zjbit/MONet path: /utils/datasets.py
from torch.utils.data import Dataset, DataLoader
import cv2
import torch
from models.monet_s_set import Set
import numpy as np
from math import log
import random
import math
class DataSet(Dataset):
def __init__(self, mode='train'):
super(DataSet,... | code_fim | hard | {
"lang": "python",
"repo": "zjbit/MONet",
"path": "/utils/datasets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoeyHou/stack-overflow-question-quality path: /src_bert/train.py
# Reference Code:
# https://github.com/aws-samples/amazon-sagemaker-bert-pytorch/blob/master/code/train_deploy.py
######### Imports #########
import argparse
import json
import logging
import os
import sys
from tqdm import tqdm
im... | code_fim | hard | {
"lang": "python",
"repo": "JoeyHou/stack-overflow-question-quality",
"path": "/src_bert/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.info("Getting test dataloader!")
# 1. Load data
dataset = pd.read_csv(os.path.join(training_dir, "test_s3.csv"))
sentences = dataset.sentence.values
labels = dataset.label.values
# 2. Encode text
input_ids = []
for sent in sentences:
encoded_sent = ... | code_fim | hard | {
"lang": "python",
"repo": "JoeyHou/stack-overflow-question-quality",
"path": "/src_bert/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from sympy import *
from math import *
def table(p):
r = 0
c = 0
m = {}
q = []
for v in p:
for u in primefactors(v):
m[(u, v)] = True
q.append(u)
r = max(c, ceil(log10(u)) + 1)
c = max(r, ceil(log10(v)) + 1)
p = sorted(p)
... | code_fim | hard | {
"lang": "python",
"repo": "qeedquan/challenges",
"path": "/codegolf/prime-divisor-table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qeedquan/challenges path: /codegolf/prime-divisor-table.py
#!/usr/bin/env python
"""
Intro
Something I've played around with in recreational mathematics has been construction of a divisor table to visually compare/contrast the prime divisors of a set of numbers. The set of input numbers are acr... | code_fim | hard | {
"lang": "python",
"repo": "qeedquan/challenges",
"path": "/codegolf/prime-divisor-table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haoranw96/yara_signature path: /yabin_code_section/confusion_matrix.py
from os import listdir
import fnmatch
count = dict() # count of malwares classified to different families
percentage = dict() # percentage of malwares classified to different families
num_files = 0 # number of XXXXXXXXX ma... | code_fim | hard | {
"lang": "python",
"repo": "haoranw96/yara_signature",
"path": "/yabin_code_section/confusion_matrix.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # update vote_family with 0 for next the malware file
for f in families:
vote_family.update({f: 0})
vote_family.update({'no_family': 0})
elif 'No related samples found' in l:
count['no_family'] += 1
else:
*other, signature = l.split()
# find the family.rule file that contains the signatur... | code_fim | hard | {
"lang": "python",
"repo": "haoranw96/yara_signature",
"path": "/yabin_code_section/confusion_matrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># append to confusion matrix csv
fd = open("confusion_matrix.csv", 'a+')
line = "actual_XXXXXXXXX"
for value in count.values():
line = line + ", " + str(value)
line = line+ "\n"
fd.write(line)
fd.close()
# append to true positive csv
fd = open("true_pos.csv", 'a+')
line = "XXXXXXXXX, "
line = lin... | code_fim | hard | {
"lang": "python",
"repo": "haoranw96/yara_signature",
"path": "/yabin_code_section/confusion_matrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UniPiTechnology/evok path: /evok/schemas.py
",
"reset",
"identify_device",
"DTR0",
"DTR1",
"DTR2"
]
}
},
"group_commands": {
"type": "array",... | code_fim | hard | {
"lang": "python",
"repo": "UniPiTechnology/evok",
"path": "/evok/schemas.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>all_get_out_schema = {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"dev": {
"type": "string",
"enum": [
... | code_fim | hard | {
"lang": "python",
"repo": "UniPiTechnology/evok",
"path": "/evok/schemas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>wifi_get_out_example = {"value": 0.004243475302661791, "unit": "V", "circuit": "1_01", "dev": "ai"}
wifi_post_inp_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Neuron_Instruction",
"type": "object",
"properties": {
"value": { "type": "string"},
... | code_fim | hard | {
"lang": "python",
"repo": "UniPiTechnology/evok",
"path": "/evok/schemas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Given an access code, make a call to last.fm. Find the user's name and a session key,
and save both values into cookies."""
apiRequest = LastFmApiRequest('auth.getSession', {'token': unicode(token).encode('utf-8')})
logging.debug('sessionKey URL: ' + ap... | code_fim | hard | {
"lang": "python",
"repo": "simbha/how-you-been",
"path": "/src/howyoubeen/LastFm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simbha/how-you-been path: /src/howyoubeen/LastFm.py
import logging, pprint, hashlib, urllib, urllib2
from webapp2_extras import json
from lxml import etree
#import pylast
import Handlers, Config
# Routines for dealing with the last.fm API.
# cf http://www.last.fm/api/
# Note, chunks of this co... | code_fim | hard | {
"lang": "python",
"repo": "simbha/how-you-been",
"path": "/src/howyoubeen/LastFm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def url(self):
"""Get the URL for this method"""
queries = ['='.join([key, urllib.quote_plus(self.params[key])]) for key in self.params]
s = LAST_FM_ROOT + '?' + '&'.join(queries)
return s
def execute(self):
"""Fetch the method from last.fm; return the ... | code_fim | hard | {
"lang": "python",
"repo": "simbha/how-you-been",
"path": "/src/howyoubeen/LastFm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deka108/mathqa-server path: /meas_models/models.py
"""
# Name: meas_models/models.py
# Description:
# Created by: Phuc Le-Sanh
# Date Created: Nov 16 2016
# Last Modified: Nov 23 2016
# Modified by: Phuc Le-Sanh
"""
from __future__ import unicode_literals
from django.core.exc... | code_fim | hard | {
"lang": "python",
"repo": "deka108/mathqa-server",
"path": "/meas_models/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Paper(models.Model):
"""
List of paper
"""
def __str__(self):
return str(self.year) + " " + str(self.get_month_display()) + " " + \
str(self.number)
year = models.IntegerField()
month = models.CharField(max_length=20, choices=MONTHS, default="1")
... | code_fim | hard | {
"lang": "python",
"repo": "deka108/mathqa-server",
"path": "/meas_models/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Formula(models.Model):
"""
List of formula
"""
def __str__(self):
return self.content
content = models.TextField()
status = models.BooleanField(default=False)
inorder_term = models.CharField(max_length=1024, null=True, blank=True)
sorted_term = models.CharFi... | code_fim | hard | {
"lang": "python",
"repo": "deka108/mathqa-server",
"path": "/meas_models/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # to load all cogs
for folder in os.listdir("command"):
if os.path.exists(os.path.join("command", folder)):
for filename in os.listdir(f"./command/{folder}"):
if filename.endswith(".py"):
client.load_extension(f"command.{folder}.{filename[:-3... | code_fim | medium | {
"lang": "python",
"repo": "sitgdsc2022/roBOT",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sitgdsc2022/roBOT path: /main.py
import os
import dotenv
import jishaku
import discord
from discord.ext import commands
from command.database.loader import db_load, db_loaded, client_load, client_loaded
<|fim_suffix|> # to load all cogs
for folder in os.listdir("command"):
if os.p... | code_fim | medium | {
"lang": "python",
"repo": "sitgdsc2022/roBOT",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name='mahstery',
version=version,
description='Get mass or accretion history for modified gravity simulations',
long_description=long_description,
author=author,
url='https://github.com/correac/mahstery',
license="BSD",
keywords=['mahstery', 'cosmology', 'NFW', 'conc... | code_fim | hard | {
"lang": "python",
"repo": "correac/mahstery",
"path": "/setup.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: correac/mahstery path: /setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#from setuptools import setup, find_packages
with open("README.md") as f:
long_description = f.read()
<|fim_suffix|>setup(
name='mahstery',
version=version,
description='Get mass or accretion history... | code_fim | hard | {
"lang": "python",
"repo": "correac/mahstery",
"path": "/setup.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mansaluke/fanalysis path: /src/fanalysis/utils.py
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 31 16:23:50 2019
@author: Luke
"""
class Ipython():
@staticmethod
def run_from_ipython():
try:
__IPYTHON__
return True
except NameError:
... | code_fim | hard | {
"lang": "python",
"repo": "mansaluke/fanalysis",
"path": "/src/fanalysis/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
counts and times each occasion a function is run in a class
"""
class NewCls(object):
def __init__(self,*args,**kwargs):
self.oInstance = cls(*args,**kwargs)
def __getattribute__(self,s):
"""
called whenever any attribute of a NewC... | code_fim | hard | {
"lang": "python",
"repo": "mansaluke/fanalysis",
"path": "/src/fanalysis/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mode/plotly.py path: /plotly/graph_objs/heatmap/__init__.py
from ._stream import Stream
from ._hoverlabel import Hoverlabel
from plotly.graph_objs.heatmap <|fim_suffix|>r
from plotly.graph_objs.heatmap import colorbar<|fim_middle|>import hoverlabel
from ._colorbar import ColorBa | code_fim | easy | {
"lang": "python",
"repo": "mode/plotly.py",
"path": "/plotly/graph_objs/heatmap/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r
from plotly.graph_objs.heatmap import colorbar<|fim_prefix|># repo: mode/plotly.py path: /plotly/graph_objs/heatmap/__init__.py
from ._stream import Stream
from ._hoverlabel i<|fim_middle|>mport Hoverlabel
from plotly.graph_objs.heatmap import hoverlabel
from ._colorbar import ColorBa | code_fim | medium | {
"lang": "python",
"repo": "mode/plotly.py",
"path": "/plotly/graph_objs/heatmap/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaelmicheal/PythonVehicleAPIWrapper path: /pvaw/manufacturer.py
from __future__ import annotations
from typing import Dict, Union
import requests
from pvaw.constants import VEHICLE_API_PATH
from pvaw.results import Results, ResultsList
class Manufacturer(Results):
def __init__(self, man_... | code_fim | hard | {
"lang": "python",
"repo": "michaelmicheal/PythonVehicleAPIWrapper",
"path": "/pvaw/manufacturer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = f"{VEHICLE_API_PATH}GetManufacturerDetails/{manufacturer_name_or_id}?format=json"
response = requests.get(path)
results_list = response.json()["Results"]
return ResultsList(
[
Manufacturer(results_dict["Mfr_ID"], results_dict)
for results_dict in re... | code_fim | hard | {
"lang": "python",
"repo": "michaelmicheal/PythonVehicleAPIWrapper",
"path": "/pvaw/manufacturer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Remplace une partie de la chaîne indiquée.
Paramètres à préciser :
* origine : la chaîne d'origine, celle qui sera modifiée
* recherche : la chaîne à rechercher
* remplacement : la chaîne qui doit remplacer la recherche
Exemple d'utilisation :
... | code_fim | hard | {
"lang": "python",
"repo": "vincent-lg/tsunami",
"path": "/src/primaires/scripting/fonctions/remplacer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def init_types(cls):
cls.ajouter_types(cls.remplacer, "str", "str", "str")
@staticmethod
def remplacer(origine, recherche, remplacement):
"""Remplace une partie de la chaîne indiquée.
Paramètres à préciser :
* origine : la chaîne d'origine,... | code_fim | medium | {
"lang": "python",
"repo": "vincent-lg/tsunami",
"path": "/src/primaires/scripting/fonctions/remplacer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vincent-lg/tsunami path: /src/primaires/scripting/fonctions/remplacer.py
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | code_fim | hard | {
"lang": "python",
"repo": "vincent-lg/tsunami",
"path": "/src/primaires/scripting/fonctions/remplacer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> args=[iter('ABCDEFGHIJLMNOPQ')] * 5
>>> zip_discard_compr(*args)
[['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I', 'J'], ['L', 'M', 'N', 'O', 'P'], ['Q']]
"""
return [[entry for entry in iterable if entry is not sentinel]
for iterable in zip_longest(*iterables... | code_fim | hard | {
"lang": "python",
"repo": "marcelocrnunes/cwexporter",
"path": "/src/cwexporter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcelocrnunes/cwexporter path: /src/cwexporter.py
#!/usr/bin/python3
"""
===============
cwexport module
===============
Module for exporting cloudwatch metrics to a pure text Prometheus exposition format
To DocTest: python3 cwexporter.py -v
Example usage:
>>> region='us-east-1... | code_fim | hard | {
"lang": "python",
"repo": "marcelocrnunes/cwexporter",
"path": "/src/cwexporter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dn, attributes, auto_encode, schema: Any | None = ..., validator: Any | None = ..., check_names: bool = ...
): ...
def add_request_to_dict(request): ...
def add_response_to_dict(response): ...<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/ldap3/ldap3/operation... | code_fim | easy | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/ldap3/ldap3/operation/add.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def add_response_to_dict(response): ...<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/ldap3/ldap3/operation/add.pyi
from typing import Any
<|fim_middle|>def add_operation(
dn, attributes, auto_encode, schema: Any | None = ..., validator: Any | None = ..., che... | code_fim | medium | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/ldap3/ldap3/operation/add.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/ldap3/ldap3/operation/add.pyi
from typing import Any
def add_operation(
<|fim_suffix|>def add_response_to_dict(response): ...<|fim_middle|> dn, attributes, auto_encode, schema: Any | None = ..., validator: Any | None = ..., che... | code_fim | medium | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/ldap3/ldap3/operation/add.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return _run_dask(
name="dask_adaptive_dd",
data=cast(Array, data),
compute=kwargs.pop("compute", True),
method=kwargs.pop("dask_method", "threaded"),
func=block_hist,
expand_arg=True,
)
def histogram2d(data1, data2, bins=None, **kwargs):
"""Fac... | code_fim | hard | {
"lang": "python",
"repo": "janpipek/physt",
"path": "/src/physt/compat/dask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janpipek/physt path: /src/physt/compat/dask.py
"""Dask-based and dask oriented variants of physt histogram facade functions."""
from __future__ import annotations
from typing import TYPE_CHECKING, cast
import dask
import numpy as np
from dask.array import Array
from physt._facade import h1 as ... | code_fim | hard | {
"lang": "python",
"repo": "janpipek/physt",
"path": "/src/physt/compat/dask.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def histogram2d(data1, data2, bins=None, **kwargs):
"""Facade function to create 2D histogram using dask."""
# TODO: currently very unoptimized! for non-dasks
if "axis_names" not in kwargs:
if hasattr(data1, "name") and hasattr(data2, "name"):
kwargs["axis_names"] = [data1... | code_fim | hard | {
"lang": "python",
"repo": "janpipek/physt",
"path": "/src/physt/compat/dask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def xyz_to_acescg(xyz: Vector) -> Vector:
"""Convert XYZ to ACEScc."""
return alg.dot(XYZ_TO_AP1, xyz, dims=alg.D2_D1)
class ACEScg(sRGB):
"""The ACEScg color class."""
BASE = "xyz-d65"
NAME = "acescg"
SERIALIZE = ("--acescg",) # type: Tuple[str, ...]
WHITE = (0.32168, 0.3... | code_fim | medium | {
"lang": "python",
"repo": "facelessuser/ColorHelper",
"path": "/lib/coloraide/spaces/acescg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> BASE = "xyz-d65"
NAME = "acescg"
SERIALIZE = ("--acescg",) # type: Tuple[str, ...]
WHITE = (0.32168, 0.33767)
CHANNELS = (
Channel("r", 0.0, 65504.0, bound=True),
Channel("g", 0.0, 65504.0, bound=True),
Channel("b", 0.0, 65504.0, bound=True)
)
DYNAMIC_R... | code_fim | hard | {
"lang": "python",
"repo": "facelessuser/ColorHelper",
"path": "/lib/coloraide/spaces/acescg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facelessuser/ColorHelper path: /lib/coloraide/spaces/acescg.py
"""
ACEScg color space.
https://www.oscars.org/science-technology/aces/aces-documentation
"""
from ..channels import Channel
from ..spaces.srgb import sRGB
from .. import algebra as alg
from ..types import Vector
from typing import T... | code_fim | medium | {
"lang": "python",
"repo": "facelessuser/ColorHelper",
"path": "/lib/coloraide/spaces/acescg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: domingoesteban/robolearn path: /scenarios/bigman-ex.py
type = 'velocity'
file_save_restore = "models/bigman_agent_vars.ckpt"
observation_active = [{'name': 'joint_state',
'type': 'joint_state',
'ros_topic': '/xbotcore/bigman/joint_states',
... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn",
"path": "/scenarios/bigman-ex.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># ######################## #
# ######################## #
# ## LEARNING ALGORITHM ## #
# ######################## #
# ######################## #
# Learning params
total_episodes = 5
num_samples = 5 # Samples for exploration trajs
resume_training_itr = None # Resume from previous training iteration
T = ... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn",
"path": "/scenarios/bigman-ex.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: domingoesteban/robolearn path: /scenarios/bigman-ex.py
'joints': bigman_params['joint_ids']['UB']}, # Value that can be gotten from robot_params['joints_names']['UB']
{'name': 'ft_left_arm',
'type': 'ft_sensor',
'ros_top... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn",
"path": "/scenarios/bigman-ex.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>Was there any reason why you haven't used the Freshmaker's build? We think that by using the Freshmaker's build, you could save the time needed for rebuild and also provide the fixed image faster.
This ticket is created mainly for us to find out if there was any issue you hit with Freshmaker which preven... | code_fim | medium | {
"lang": "python",
"repo": "apaplaus/freshmaker",
"path": "/contrib/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("SEARCH_KEY", help="Freshmaker's search_key")
parser.add_argument("ORIGINAL_NVR", help="Freshmaker's original_nvr")
parser.add_argument("CONTAINER_ADVISORY", help="Advisory with shipped non-freshmaker build")... | code_fim | hard | {
"lang": "python",
"repo": "apaplaus/freshmaker",
"path": "/contrib/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apaplaus/freshmaker path: /contrib/generate_report.py
#!/usr/bin/python3
from __future__ import print_function
import argparse
import requests
from requests_kerberos import HTTPKerberosAuth
from requests import conf
TEMPLATE = """
On {freshmaker_date}, Freshmaker rebuilt {original_nvr} containe... | code_fim | hard | {
"lang": "python",
"repo": "apaplaus/freshmaker",
"path": "/contrib/generate_report.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asiaszmek/AMPAR-Trafficking-Model path: /Stochastic-Model/Fig6D_bottomLeft.py
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 21:34:08 2020
@author: Moritz
"""
"""Fig 6D
This script reproduces the plots seen in Fig 6D of "The biophysical basis underlying the maintenance of early phase long-t... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/AMPAR-Trafficking-Model",
"path": "/Stochastic-Model/Fig6D_bottomLeft.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> A_spine=N**2/70*A_spine_basal
for j,UFP_0 in enumerate(UFP_List):
BMean=np.mean(np.mean((B_N[i][j]+B_notBleached_N[i][j]), axis=0)[int(len(Time)/2)::])
UMean=np.mean(np.mean((U_N[i][j]+U_notBleached_N[i][j]), axis=0)[int(len(Time)/2)::])
print(BMean)
p... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/AMPAR-Trafficking-Model",
"path": "/Stochastic-Model/Fig6D_bottomLeft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#%%
#Cooperative binding; FRAP dependence on mobile receptor concentartion U/Aspine:
SaveFig=0#1
duration=15000#Duration in s
Nr_Trials=100
N_List=[12]#[9]
UFP_List=[10,30,60]
beta=1
alpha=16
kUB=0.0005
kBU=0.1
A_spine_basal=0.898
B_N, U_N, B_notBleached_N, U_notBleached_N, PSD, Time=FRAP(N_Lis... | code_fim | hard | {
"lang": "python",
"repo": "asiaszmek/AMPAR-Trafficking-Model",
"path": "/Stochastic-Model/Fig6D_bottomLeft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Proper-Job/django-admin-rq path: /django_admin_rq/admin.py
ext=None):
"""
Returns the template for this job's complete page
"""
return 'django_admin_rq/job_complete.html'
def get_job_callable(self, job_name, preview=True, request=None, object_id=None, view_nam... | code_fim | hard | {
"lang": "python",
"repo": "Proper-Job/django-admin-rq",
"path": "/django_admin_rq/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Proper-Job/django-admin-rq path: /django_admin_rq/admin.py
w_name'] = view_name
url = reverse('admin:%s_%s_job_run' % info, kwargs=url_kwargs, current_app=self.admin_site.name)
else:
url = reverse('admin:%s_%s_job_complete' % info, kwargs=url_kwargs, current_app=se... | code_fim | hard | {
"lang": "python",
"repo": "Proper-Job/django-admin-rq",
"path": "/django_admin_rq/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_job_context(self, request, job_name, object_id, view_name):
"""
Returns the context for all django-admin-rq views (form|preview_run|main_run|complete)
"""
info = self.model._meta.app_label, self.model._meta.model_name
preview = self.is_preview_run_view(... | code_fim | hard | {
"lang": "python",
"repo": "Proper-Job/django-admin-rq",
"path": "/django_admin_rq/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def addDocVectors(self):
docVectors = []
for docId in range(len(self.data)):
docVectors.append(self.model.infer_vector(self.rem_stop_punct(self.data[self.factorName][int(docId)])))
self.data['doc2vec'] = docVectors<|fim_prefix|># repo: fastboardAI/fling path: /flin... | code_fim | hard | {
"lang": "python",
"repo": "fastboardAI/fling",
"path": "/fling/vectorize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> splittedText = originalText.split()
lenl = len(splittedText)
wordFiltered = []
tSent = []
for r in range(lenl):
wordx_1 = splittedText[r]
wordx_2 = "".join(c for c in wordx_1 if c not in ('!','.',':',',','?',';','``','&','-','"','(',')','[','... | code_fim | hard | {
"lang": "python",
"repo": "fastboardAI/fling",
"path": "/fling/vectorize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fastboardAI/fling path: /fling/vectorize.py
import gensim
import matplotlib as mpl
from imp import reload
from nltk.corpus import stopwords
from collections import Counter
import pandas as pd
import numpy as np
import nltk,re,pprint
import sys,glob,os
import operator, string, argparse, math, rand... | code_fim | hard | {
"lang": "python",
"repo": "fastboardAI/fling",
"path": "/fling/vectorize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henricm/unifiprotect path: /custom_components/unifiprotect/switch.py
"""This component provides Switches for Unifi Protect."""
import logging
try:
from homeassistant.components.switch import SwitchEntity as SwitchDevice
except ImportError:
# Prior to HA v0.110
from homeassistant.com... | code_fim | hard | {
"lang": "python",
"repo": "henricm/unifiprotect",
"path": "/custom_components/unifiprotect/switch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def device_state_attributes(self):
"""Return the device state attributes."""
return {
ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,
ATTR_CAMERA_TYPE: self._device_type,
}
async def async_turn_on(self, **kwargs):
"""Turn the device on.... | code_fim | hard | {
"lang": "python",
"repo": "henricm/unifiprotect",
"path": "/custom_components/unifiprotect/switch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> history = dict()
for turn in range(1, len(initialization) + 1):
number = initialization[turn - 1]
history[number] = [turn]
for turn in range(1 + len(initialization), n + 1):
if len(history[number]) != 2:
number = 0
els... | code_fim | hard | {
"lang": "python",
"repo": "HannesEberhard/aoc",
"path": "/2020/15/script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HannesEberhard/aoc path: /2020/15/script.py
from common import Day
class Day_2020_15(Day):
def parse(self):
return [int(x) for x in self.input.split(",")]
def simulate(self, initialization, n):
history = dict()
for turn in range(1, len(initialization) + 1):
... | code_fim | hard | {
"lang": "python",
"repo": "HannesEberhard/aoc",
"path": "/2020/15/script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from time import time
# https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_object_detection.ipynb
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
COCO_DIR = '/root/coco2017'
# IMG_FILE = '000000581206.jpg' # Hot dogs
# IMG_FILE = '000000578967.jpg' # Train
# IMG_FILE = '000000093965.... | code_fim | medium | {
"lang": "python",
"repo": "GTkernel/Pocket",
"path": "/applications/smallbert/app.pocket.hello.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if 'cProfile' in dir():
# cProfile.create_stats()
stat_dict = Utils.measure_resource_usage()
print('[resource_usage]', f'cputime.total={stat_dict.get("cputime.total", None)}')
print('[resource_usage]', f'cputime.user={stat_dict.get("cputime.user", None)}')
print('[resource_us... | code_fim | hard | {
"lang": "python",
"repo": "GTkernel/Pocket",
"path": "/applications/smallbert/app.pocket.hello.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GTkernel/Pocket path: /applications/smallbert/app.pocket.hello.py
# https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a
# imagenet index label
import os, sys
# import tensorflow as tf
import numpy as np
import logging
import argparse
sys.path.insert(0, '/root/')
sys.path.insert(0, '/root/tfrpc/cl... | code_fim | hard | {
"lang": "python",
"repo": "GTkernel/Pocket",
"path": "/applications/smallbert/app.pocket.hello.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minar09/Clothing-Matching path: /3.Clothing-Masking/2.clothmasking_thresholding.py
### Author: Matiur Rahman Minar ###
### EMCOM Lab, SeoulTech, 2021 ###
### Task: Generating binary mask/silhouette/segmentation ###
### especially for clothing image ###
### Focused method: Binary thresholding ###
... | code_fim | hard | {
"lang": "python",
"repo": "minar09/Clothing-Matching",
"path": "/3.Clothing-Masking/2.clothmasking_thresholding.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
# Get paths
cloth_dir = "data/cloth/"
res_dir = "results/masks/"
image_list = os.listdir(cloth_dir)
# iterate images in the path
for each in image_list:
image_path = os.path.join(cloth_dir, each)
res_path = os.path.join(res_dir, each.replace(".jpg", ".p... | code_fim | hard | {
"lang": "python",
"repo": "minar09/Clothing-Matching",
"path": "/3.Clothing-Masking/2.clothmasking_thresholding.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_upstreams_rr_weight_rational():
def set_weights(w1, w2):
assert 'success' in client.conf(
{
"127.0.0.1:7081": {"weight": w1},
"127.0.0.1:7082": {"weight": w2},
},
'upstreams/one/servers',
), 'configure weights... | code_fim | hard | {
"lang": "python",
"repo": "nginx/unit",
"path": "/test/test_upstreams_rr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_upstreams_rr_delay():
delayed_dir = f'{option.test_dir}/python/delayed'
assert 'success' in client.conf(
{
"listeners": {
"*:7080": {"pass": "upstreams/one"},
"*:7081": {"pass": "routes"},
"*:7082": {"pass": "routes"},
... | code_fim | hard | {
"lang": "python",
"repo": "nginx/unit",
"path": "/test/test_upstreams_rr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nginx/unit path: /test/test_upstreams_rr.py
import os
import re
import pytest
from unit.applications.lang.python import ApplicationPython
from unit.option import option
prerequisites = {'modules': {'python': 'any'}}
client = ApplicationPython()
@pytest.fixture(autouse=True)
def setup_method_... | code_fim | hard | {
"lang": "python",
"repo": "nginx/unit",
"path": "/test/test_upstreams_rr.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> from iahaarmatrix import iahaarmatrix
f = asarray(f).astype(float64)
if len(f.shape) == 1: f = f[:,newaxis]
(m, n) = f.shape
A = iahaarmatrix(m)
if (n == 1):
F = dot(transpose(A), f)
else:
B = iahaarmatrix(n)
F = dot(dot(transpose(A), f), B)
return ... | code_fim | easy | {
"lang": "python",
"repo": "mariecpereira/IA369Z",
"path": "/deliver/ia369/iaihwt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mariecpereira/IA369Z path: /deliver/ia369/iaihwt.py
# -*- encoding: utf-8 -*-
# Module iaihwt
from numpy import *
<|fim_suffix|> f = asarray(f).astype(float64)
if len(f.shape) == 1: f = f[:,newaxis]
(m, n) = f.shape
A = iahaarmatrix(m)
if (n == 1):
F = dot(transpose(A... | code_fim | easy | {
"lang": "python",
"repo": "mariecpereira/IA369Z",
"path": "/deliver/ia369/iaihwt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = asarray(f).astype(float64)
if len(f.shape) == 1: f = f[:,newaxis]
(m, n) = f.shape
A = iahaarmatrix(m)
if (n == 1):
F = dot(transpose(A), f)
else:
B = iahaarmatrix(n)
F = dot(dot(transpose(A), f), B)
return F<|fim_prefix|># repo: mariecpereira/IA369Z... | code_fim | easy | {
"lang": "python",
"repo": "mariecpereira/IA369Z",
"path": "/deliver/ia369/iaihwt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ManifestMap(BaseModel):
"""A Manifest which can be addressed by the relative paths"""
base: Union[DirectoryPath, AnyUrl, Path] # base of the manifest tree
kind: UriKind = UriKind.Naive # how is the manifest rooted?
elements: Dict[Path, Resource] # manifest contents
class SitoFi... | code_fim | hard | {
"lang": "python",
"repo": "xkortex/sito-io",
"path": "/sito_io/fileio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xkortex/sito-io path: /sito_io/fileio.py
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
from pydantic import BaseModel, FilePath, DirectoryPath, AnyUrl
from sito_io.dctypes.resource import UriKind, Resource
UriT = Union[FilePath, AnyUrl]
OptionsT = Optional[Union... | code_fim | hard | {
"lang": "python",
"repo": "xkortex/sito-io",
"path": "/sito_io/fileio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SitoFileToDir(BaseModel):
"""Single file in, directory of files out. """
input_uri: UriT
output_dir: Optional[Union[DirectoryPath, str]]
options: OptionsT
class SitoCoreUtil(BaseModel):
"""Emulates the interface of common coreutils tools, mv, tar, etc. E.g.:
tool [options]... | code_fim | hard | {
"lang": "python",
"repo": "xkortex/sito-io",
"path": "/sito_io/fileio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hurrycane/google-hackaton-d2c path: /awesome-raspberrypi-app/webapp/models/user.py
from webapp.core import db
from flask.ext.sqlalchemy import SQLAlchemy
class User(db.Model):
<|fim_suffix|> id = db.Column(db.Integer, primary_key=True)
fullname = db.Column(db.String(255))
google_plus_id = d... | code_fim | medium | {
"lang": "python",
"repo": "hurrycane/google-hackaton-d2c",
"path": "/awesome-raspberrypi-app/webapp/models/user.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = db.Column(db.Integer, primary_key=True)
fullname = db.Column(db.String(255))
google_plus_id = db.Column(db.String(255), unique=True)
def __init__(self, fullname, google_plus_id):
self.fullname = fullname
self.google_plus_id = google_plus_id
@property
def serialize(self):
re... | code_fim | medium | {
"lang": "python",
"repo": "hurrycane/google-hackaton-d2c",
"path": "/awesome-raspberrypi-app/webapp/models/user.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distance_map = []
for a in self.graph:
distances = []
for i, b in enumerate(self.graph):
parts = self._find_all_paths(a, b)[0]
distances.append(len(parts) - 1)
distance_map.append(distances)
return self._matrix_... | code_fim | hard | {
"lang": "python",
"repo": "theproxy/awesome.skating.ai",
"path": "/skatingAI/utils/human_distance_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distance_map.append(distances)
return self._matrix_formatations(distance_map)
def _matrix_formatations(self, distance_map):
distance_map = np.array(distance_map)
distance_map = (1 - distance_map / (distance_map.shape[0] + distance_map.shape[0] / 2)).astype(np.floa... | code_fim | hard | {
"lang": "python",
"repo": "theproxy/awesome.skating.ai",
"path": "/skatingAI/utils/human_distance_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theproxy/awesome.skating.ai path: /skatingAI/utils/human_distance_map.py
import numpy as np
from skatingAI.utils.utils import BodyParts
class HumanDistanceMap(object):
def __init__(self):
self.graph = {
BodyParts.Head.name: [BodyParts.torso.name],
BodyParts.... | code_fim | hard | {
"lang": "python",
"repo": "theproxy/awesome.skating.ai",
"path": "/skatingAI/utils/human_distance_map.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
from secret_facegame_settings import *
except ImportError:
print "no secret production settings"<|fim_prefix|># repo: enikkari/facegame path: /facegame/settings/prod.py
from settings import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
EMAIL_PORT = 25
STATIC_URL = '/facegame-static/'
MEDIA_URL =... | code_fim | medium | {
"lang": "python",
"repo": "enikkari/facegame",
"path": "/facegame/settings/prod.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enikkari/facegame path: /facegame/settings/prod.py
from settings import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
EMAIL_PORT = 25
STATIC_URL = '/facegame-static/'
MEDIA_URL = '/facegame-media/'
<|fim_suffix|>try:
from secret_facegame_settings import *
except ImportError:
print "no secret... | code_fim | hard | {
"lang": "python",
"repo": "enikkari/facegame",
"path": "/facegame/settings/prod.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edmontdants/Deep-Learning-Practice-Everyday path: /DataScience/利用Python进行数据分析/02-Python函数/03_Currying.py
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.36
工具: python == 3.7.3
介绍: 函数科里化,参考《利用Python进行数据分析》3.2.5
"""
# 科里化指通过部分参数应用方式从已有函数中衍生出新的函数
def add_... | code_fim | medium | {
"lang": "python",
"repo": "edmontdants/Deep-Learning-Practice-Everyday",
"path": "/DataScience/利用Python进行数据分析/02-Python函数/03_Currying.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 方法一
add_five1 = lambda y : add_number(5, y)
# 方法二
from functools import partial
add_five2 = partial(add_number, 5)<|fim_prefix|># repo: edmontdants/Deep-Learning-Practice-Everyday path: /DataScience/利用Python进行数据分析/02-Python函数/03_Currying.py
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统... | code_fim | easy | {
"lang": "python",
"repo": "edmontdants/Deep-Learning-Practice-Everyday",
"path": "/DataScience/利用Python进行数据分析/02-Python函数/03_Currying.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.name
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
company = models.ForeignKey('Company', on_delete=models.CASCADE, null=True)
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if c... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/django-plans",
"path": "/demo/example/foo/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nuurek/django-plans path: /demo/example/foo/models.py
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.encoding import python_2_un... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/django-plans",
"path": "/demo/example/foo/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = models.OneToOneField(User, on_delete=models.CASCADE)
company = models.ForeignKey('Company', on_delete=models.CASCADE, null=True)
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
company = Company.objects.create(name=in... | code_fim | hard | {
"lang": "python",
"repo": "Nuurek/django-plans",
"path": "/demo/example/foo/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shlomis1/vsa path: /src/vsa/model/sanp_lun.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "shlomis1/vsa",
"path": "/src/vsa/model/sanp_lun.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
The description of update comes here.
@param flags
@return
"""
_load = not self.san_interface.runmode
self._update_params()
if 'cachesize' in self._updatedattr or _load or 'f' in flags:
(e,r) = self._update_cachesize()
... | code_fim | hard | {
"lang": "python",
"repo": "shlomis1/vsa",
"path": "/src/vsa/model/sanp_lun.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alltheplaces/alltheplaces path: /locations/spiders/qdoba.py
import json
import re
import scrapy
from locations.hours import OpeningHours
from locations.items import Feature
DAY_MAPPING = {
"MONDAY": "Mo",
"TUESDAY": "Tu",
"WEDNESDAY": "We",
"THURSDAY": "Th",
"FRIDAY": "Fr",... | code_fim | hard | {
"lang": "python",
"repo": "alltheplaces/alltheplaces",
"path": "/locations/spiders/qdoba.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if is_resturant_page:
yield scrapy.Request(response.url, callback=self.parse_store)
else:
if not urls and is_store_list:
for store_url in is_store_list:
yield scrapy.Request(response.urljoin(store_url), callback=self.parse_store)
... | code_fim | hard | {
"lang": "python",
"repo": "alltheplaces/alltheplaces",
"path": "/locations/spiders/qdoba.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Autodesk/nanodesign path: /nanodesign/converters/converter.py
# Copyright 2016 Autodesk Inc.
#
# 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
#
# http://www.apache.o... | code_fim | hard | {
"lang": "python",
"repo": "Autodesk/nanodesign",
"path": "/nanodesign/converters/converter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Parse helix IDs.
helix_group_xforms = []
for helix_group in helix_groups:
tokens = helix_group.split(":")
pattern = re.compile(r"[,()]")
helix_tokens = pattern.split(tokens[0])
helix_ids = []
for s in helix_tokens:
... | code_fim | hard | {
"lang": "python",
"repo": "Autodesk/nanodesign",
"path": "/nanodesign/converters/converter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Write a SimDNA pairs file.
Arguments:
file_name (String): The name of the SimDNA pairs file to write.
"""
simdna_writer = SimDnaWriter(self.dna_structure)
simdna_writer.write(file_name)
def write_topology_file(self, file_name):
... | code_fim | hard | {
"lang": "python",
"repo": "Autodesk/nanodesign",
"path": "/nanodesign/converters/converter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adeassisvieira/Cardio-Catch-Diseases---Predicting-Cardiovascular-Diseases path: /api/cardio/Cardio.py
import os
import pickle
import pandas as pd
import numpy as np
class Cardio(object):
def __init__(self):
#self.smt = pickle.load(smt, open("/home/jorge/repos/pa001_card... | code_fim | hard | {
"lang": "python",
"repo": "adeassisvieira/Cardio-Catch-Diseases---Predicting-Cardiovascular-Diseases",
"path": "/api/cardio/Cardio.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #status_bmi - OrdinalEncoding
dict_bmi = {'underweight':1,'normal':2,'overweight':3,'obse':4,'extremely_obese':5}
df5['status_bmi'] = df5['status_bmi'].map(dict_bmi)
#age_range - OrdinalEncoding
dict_age_range = {'50-65':2,'0-50':1}
df5['age_range'] = df5['... | code_fim | hard | {
"lang": "python",
"repo": "adeassisvieira/Cardio-Catch-Diseases---Predicting-Cardiovascular-Diseases",
"path": "/api/cardio/Cardio.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhijing-jin/api_classification path: /charcnn/preprocess.py
from __future__ import division
import csv
import sys
import random
from efficiency.log import fwrite
def read_mr():
contents = []
for ix, pos_neg in enumerate(['neg', 'pos']):
file = '../data/mr/rt-polarity.{}'.format(... | code_fim | hard | {
"lang": "python",
"repo": "zhijing-jin/api_classification",
"path": "/charcnn/preprocess.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = 'data/fake_news/train_raw.csv'
fields = ['label', 'title', 'author', 'text']
with open(file) as f:
csv_reader = csv.DictReader(f, delimiter=',')
data = [{f: row[f] for f in fields} for row in csv_reader]
print(f'[Info] Obtained {len(data)} lines from CSV file.')... | code_fim | hard | {
"lang": "python",
"repo": "zhijing-jin/api_classification",
"path": "/charcnn/preprocess.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(file, mode='w') as f:
writer = csv.DictWriter(f, fieldnames=fields)
# writer.writeheader()
for row in dic_list:
row[fields[0]] = str(int(row[fields[0]]) + 1)
writer.writerow(row)
print("[Info] Written {} row... | code_fim | hard | {
"lang": "python",
"repo": "zhijing-jin/api_classification",
"path": "/charcnn/preprocess.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.