text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> status: StatusEnum
message: str = ""
def to_dict(self) -> Dict[str, Any]:
"""Return JSON serializable dictionary representation."""
return {"status": self.status.name, "message": self.message}
@classmethod
def from_dict(cls, dic: Dict[str, Any]) -> "CircuitStatus":
... | code_fim | hard | {
"lang": "python",
"repo": "qfizik/tket",
"path": "/pytket/pytket/backends/status.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return JSON serializable dictionary representation."""
return {"status": self.status.name, "message": self.message}
@classmethod
def from_dict(cls, dic: Dict[str, Any]) -> "CircuitStatus":
"""Construct from JSON serializable dictionary."""
invalid = ValueError(f... | code_fim | medium | {
"lang": "python",
"repo": "qfizik/tket",
"path": "/pytket/pytket/backends/status.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juanmagalhaes/rpg-manager path: /rpg/migrations/0007_auto_20180225_2150.py
# Generated by Django 2.0.2 on 2018-02-25 21:50
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('rpg', '0006_character_avatar'),
]
operations = [
migrations.AlterFi... | code_fim | easy | {
"lang": "python",
"repo": "juanmagalhaes/rpg-manager",
"path": "/rpg/migrations/0007_auto_20180225_2150.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='character',
name='avatar',
field=models.URLField(blank=True, default='', max_length=400),
),
]<|fim_prefix|># repo: juanmagalhaes/rpg-manager path: /rpg/migrations/0007_auto_20180225_2150.py
# Ge... | code_fim | medium | {
"lang": "python",
"repo": "juanmagalhaes/rpg-manager",
"path": "/rpg/migrations/0007_auto_20180225_2150.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('rpg', '0006_character_avatar'),
]
operations = [
migrations.AlterField(
model_name='character',
name='avatar',
field=models.URLField(blank=True, default='', max_length=400),
... | code_fim | easy | {
"lang": "python",
"repo": "juanmagalhaes/rpg-manager",
"path": "/rpg/migrations/0007_auto_20180225_2150.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ezetowers/tp-final-fallas-I path: /backend/ArrowSelection/.svn/text-base/Question.py.svn-base
class Question(object):
'''
Questions
number = 0 - No Question
number = 1 - Arrow_Length
number = 2 - Shooter Height
number = 3 - Poundage
number = 4 - Temperature
numbe... | code_fim | medium | {
"lang": "python",
"repo": "Ezetowers/tp-final-fallas-I",
"path": "/backend/ArrowSelection/.svn/text-base/Question.py.svn-base",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def created(self):
return self._created
@created.setter
def created(self, value):
self._created = value<|fim_prefix|># repo: Ezetowers/tp-final-fallas-I path: /backend/ArrowSelection/.svn/text-base/Question.py.svn-base
class Question(object):
'''
Questio... | code_fim | hard | {
"lang": "python",
"repo": "Ezetowers/tp-final-fallas-I",
"path": "/backend/ArrowSelection/.svn/text-base/Question.py.svn-base",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jackyzha0/BentoML path: /tests/integration/model_management/test_push_and_pull.py
import os
from bentoml.yatai.client import get_yatai_client
from .example_bento_service_class import ExampleBentoService
from tests.yatai.local_yatai_service import local_yatai_service_container
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "jackyzha0/BentoML",
"path": "/tests/integration/model_management/test_push_and_pull.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pushed_path = yc.repository.push(bento_tag)
assert pushed_path != saved_path
local_yc = get_yatai_client()
delete_result = local_yc.repository.delete(bento_tag)
assert delete_result is None
assert os.path.exists(saved_path) is False
pull_result = y... | code_fim | hard | {
"lang": "python",
"repo": "jackyzha0/BentoML",
"path": "/tests/integration/model_management/test_push_and_pull.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> local_yc = get_yatai_client()
delete_result = local_yc.repository.delete(bento_tag)
assert delete_result is None
assert os.path.exists(saved_path) is False
pull_result = yc.repository.pull(bento_tag)
assert pull_result == saved_path<|fim_prefix|># repo: jac... | code_fim | hard | {
"lang": "python",
"repo": "jackyzha0/BentoML",
"path": "/tests/integration/model_management/test_push_and_pull.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>GUS = os.path.join(template_dir, 'gus.j2')
ALL_YAML = os.path.join(template_dir, 'all_yaml.j2')<|fim_prefix|># repo: devopshq/crosspm path: /crosspm/template/__init__.py
# -*- coding: utf-8 -*-
import os
template_dir<|fim_middle|> = os.path.dirname(os.path.realpath(__file__))
| code_fim | easy | {
"lang": "python",
"repo": "devopshq/crosspm",
"path": "/crosspm/template/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devopshq/crosspm path: /crosspm/template/__init__.py
# -*- coding: utf-8 -*-
import os
template_dir = os.path.dirname(os.path.realpath(__file__))
<|fim_suffix|>YAML = os.path.join(template_dir, 'all_yaml.j2')<|fim_middle|>GUS = os.path.join(template_dir, 'gus.j2')
ALL_ | code_fim | easy | {
"lang": "python",
"repo": "devopshq/crosspm",
"path": "/crosspm/template/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcus-crane/utf9k path: /scripts/social-image.py
from PIL import Image, ImageDraw, ImageFont
<|fim_suffix|>drawing.multiline_text((100, 200), "This is the body text", font=hfont, fill=(0, 0, 0))
canvas.show()<|fim_middle|>canvas = Image.new("RGB", (1280, 720), (255, 255, 255))
drawing = ImageD... | code_fim | hard | {
"lang": "python",
"repo": "marcus-crane/utf9k",
"path": "/scripts/social-image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>drawing.multiline_text((100, 200), "This is the body text", font=hfont, fill=(0, 0, 0))
canvas.show()<|fim_prefix|># repo: marcus-crane/utf9k path: /scripts/social-image.py
from PIL import Image, ImageDraw, ImageFont
<|fim_middle|>canvas = Image.new("RGB", (1280, 720), (255, 255, 255))
drawing = ImageD... | code_fim | hard | {
"lang": "python",
"repo": "marcus-crane/utf9k",
"path": "/scripts/social-image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('spectrogen_main', '0005_auto_20200112_1355'),
]
operations = [
migrations.AlterField(
model_name='spectrogram',
name='image_file',
field=models.ImageField(null=True, upload_to='spect... | code_fim | easy | {
"lang": "python",
"repo": "SteelPh0enix/TAIProject",
"path": "/spectrogen/spectrogen_main/migrations/0006_auto_20200112_1357.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SteelPh0enix/TAIProject path: /spectrogen/spectrogen_main/migrations/0006_auto_20200112_1357.py
# Generated by Django 3.0.2 on 2020-01-12 13:57
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('spectrogen_main', '0005_auto_20200112_1355'),
]
operations... | code_fim | easy | {
"lang": "python",
"repo": "SteelPh0enix/TAIProject",
"path": "/spectrogen/spectrogen_main/migrations/0006_auto_20200112_1357.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='spectrogram',
name='image_file',
field=models.ImageField(null=True, upload_to='spectrograms'),
),
]<|fim_prefix|># repo: SteelPh0enix/TAIProject path: /spectrogen/spectrogen_main/migrations/0006_... | code_fim | medium | {
"lang": "python",
"repo": "SteelPh0enix/TAIProject",
"path": "/spectrogen/spectrogen_main/migrations/0006_auto_20200112_1357.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simeoncarstens/ensemble_hic path: /ensemble_hic/error_models.py
"""
Classes defining various error models for ensemble-averaged 3C data.
Currently, only the Poisson error model is used and is thus the only
one being tested and documented.
"""
import numpy
from csb.statistics.pdf.parameterized im... | code_fim | hard | {
"lang": "python",
"repo": "simeoncarstens/ensemble_hic",
"path": "/ensemble_hic/error_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._register_variable('mock_data', differentiable=True)
self._register_variable('precision')
self.data = self.targets = data
self.update_var_param_types(mock_data=ArrayParameter, precision=Parameter)
self._set_original_variables()
def _evaluate_log_prob(self,... | code_fim | hard | {
"lang": "python",
"repo": "simeoncarstens/ensemble_hic",
"path": "/ensemble_hic/error_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time.sleep(0.1)
GPIO.output(self.servoPIN, False)
self.servo.ChangeDutyCycle(0)
self.blockControls = False
def left(self):
if self.blockControls:
return
if self.currentAngle < 120:
self.blockControls = True
... | code_fim | hard | {
"lang": "python",
"repo": "cybermritunjay/self-driving",
"path": "/carControl1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def blowHorn(self):
GPIO.output(self.horn, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(self.horn, GPIO.LOW)
print("Horn")
def lights(self):
if not self.lightsOn:
GPIO.output(self.frontLights, GPIO.HIGH)
GPIO.output(self.backLights, GPIO.H... | code_fim | hard | {
"lang": "python",
"repo": "cybermritunjay/self-driving",
"path": "/carControl1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cybermritunjay/self-driving path: /carControl1.py
from __future__ import division
import time
import RPi.GPIO as GPIO
class CarControls:
def __init__(self):
self.blockControls=False
self.currentAngle = 90
self.forwardSpeed = 0
self.backwardSpeed = 0
se... | code_fim | hard | {
"lang": "python",
"repo": "cybermritunjay/self-driving",
"path": "/carControl1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
main()
#from tkinter import Tk, Label, Button, Entry, IntVar, END, W, E
#
# class Calculator:
#
# def __init__(self, master):
# self.master = master
# master.title("Calculator")
#
# self.total = 0
# self.entered_number = 0
... | code_fim | hard | {
"lang": "python",
"repo": "amldjlee8/MagicMirror",
"path": "/magicMirror/guiTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amldjlee8/MagicMirror path: /magicMirror/guiTest.py
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
import datetime
try:
import argparse
flags... | code_fim | hard | {
"lang": "python",
"repo": "amldjlee8/MagicMirror",
"path": "/magicMirror/guiTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for subdir, dirs, files in os.walk(current_dir):
#print(files)
for file in files:
full_path = os.path.join(subdir, file)
shutil.copy(full_path, dest_dir)
counter = counter + 1
print(counter)<|fim_prefix|># repo: jonathangiguere/Emotion_Image_Classifier path: /consolidate_d... | code_fim | hard | {
"lang": "python",
"repo": "jonathangiguere/Emotion_Image_Classifier",
"path": "/consolidate_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonathangiguere/Emotion_Image_Classifier path: /consolidate_data.py
import os
import shutil
# Part 1 of 2
# Had to split it up because doing all decompressed data at once broke the VM
<|fim_suffix|>for subdir, dirs, files in os.walk(current_dir):
#print(files)
for file in files:
... | code_fim | hard | {
"lang": "python",
"repo": "jonathangiguere/Emotion_Image_Classifier",
"path": "/consolidate_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mgoar/mtt-phd-filter path: /measmodel.py
import numpy as np
from dataclasses import dataclass
@dataclass
class measmodel:
"""Measurement model class"""
def CVmeasmodel(self, sigma: float):
self.d = 2
self.H = lambda x: np.array([[1, 0, 0, 0], [0, 1, 0, 0]])
sel... | code_fim | hard | {
"lang": "python",
"repo": "mgoar/mtt-phd-filter",
"path": "/measmodel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.h = lambda x: np.arctan2(x[1] - s[1], x[0] - s[0])
# Measurement model Jacobian
self.H = lambda x: np.array(
[[-(x[1] - s[1]) / (rng(x)**2), (x[0] - s[0]) / (rng(x)**2), np.zeros([np.shape(x)[1] - 2])]])
# Measurement noise covariance
self.R = sig... | code_fim | hard | {
"lang": "python",
"repo": "mgoar/mtt-phd-filter",
"path": "/measmodel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if server.slack.rtm_connect():
#run init hook. This hook doesn't send messages to the server (ought it?)
run_hook(server.hooks, "init", server)
loop(server)
else:
logging.warn("Connection Failed, invalid token <{0}>?".format(config["token"]))
def run_cmd(cmd, serv... | code_fim | hard | {
"lang": "python",
"repo": "noise/limbo",
"path": "/limbo/limbo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: noise/limbo path: /limbo/limbo.py
#!/usr/bin/env python
from __future__ import print_function
import copy
import functools
from glob import glob
import importlib
import logging
import os
import re
import sqlite3
import sys
import time
import traceback
from slackclient import SlackClient
from ser... | code_fim | hard | {
"lang": "python",
"repo": "noise/limbo",
"path": "/limbo/limbo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade():
op.drop_constraint(schema=quoted_name('mail', False), table_name='persistent_group_list',
constraint_name='persistent_group_list_id_fkey')
op.create_foreign_key(
'persistent_group_list_id_fkey',
'persistent_group_list', 'list',
['id'... | code_fim | hard | {
"lang": "python",
"repo": "VTK-Revue/revue-flask-server",
"path": "/migrations/versions/4471531c17ad_persistent_group_inherits_directly_from_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> op.drop_constraint(schema=quoted_name('mail', False), table_name='persistent_group_list',
constraint_name='persistent_group_list_id_fkey')
op.create_foreign_key(
'persistent_group_list_id_fkey',
'persistent_group_list', 'list',
['id'], ['id'], source_... | code_fim | medium | {
"lang": "python",
"repo": "VTK-Revue/revue-flask-server",
"path": "/migrations/versions/4471531c17ad_persistent_group_inherits_directly_from_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VTK-Revue/revue-flask-server path: /migrations/versions/4471531c17ad_persistent_group_inherits_directly_from_.py
"""Persistent group inherits directly from intern
Revision ID: 4471531c17ad
Revises: a02fdc6eee57
Create Date: 2016-04-30 01:42:48.290309
"""
# revision identifiers, used by Alembic... | code_fim | hard | {
"lang": "python",
"repo": "VTK-Revue/revue-flask-server",
"path": "/migrations/versions/4471531c17ad_persistent_group_inherits_directly_from_.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""
ABOUT_MSG = """ ഞാൻ ഒരു മഹാ സംഭവമാണ്😜🤔😎.
"""<|fim_prefix|># repo: susan977/Unlimited-Filter-Bot path: /script.py
class Script(object):
START_MSG = """ഹായ്👋 {},
ഞാൻ ഒരു ഗ്രൂപ്പ് ഫിൽട്ടർ ബോട്ട് ആണ്, എൻ്റെ വിധി എൻ്റെ [അഡ്മിൻ്റ](https://t.me/Rahelvakkachan) തീരുമാനങ്ങളാണ്.എന്നെ C... | code_fim | medium | {
"lang": "python",
"repo": "susan977/Unlimited-Filter-Bot",
"path": "/script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""
ABOUT_MSG = """ ഞാൻ ഒരു മഹാ സംഭവമാണ്😜🤔😎.
"""<|fim_prefix|># repo: susan977/Unlimited-Filter-Bot path: /script.py
class Script(object):
START_MSG = """ഹായ്👋 {},
ഞാൻ ഒരു ഗ്രൂപ്പ് ഫിൽട്ടർ ബോട്ട് ആണ്, എൻ്റെ വിധി എൻ്റെ [അഡ്മിൻ്റ](https://t.me/Rahelvakkachan) തീരുമാനങ്ങളാണ്.എന്നെ... | code_fim | medium | {
"lang": "python",
"repo": "susan977/Unlimited-Filter-Bot",
"path": "/script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: susan977/Unlimited-Filter-Bot path: /script.py
class Script(object):
START_MSG = """ഹായ്👋 {},
ഞാൻ ഒരു ഗ്രൂപ്പ് ഫിൽട്ടർ ബോട്ട് ആണ്, എൻ്റെ വിധി എൻ്റെ [അഡ്മിൻ്റ](https://t.me/Rahelvakkachan) തീരുമാനങ്ങളാണ്.എന്നെ CARNIVAL CINEMAS ഗ്രൂപ്പിൽ മാത്രമേ ആഡ് ചെയ്യാൻ കഴിയൂ...!!!
<|fim_suffix|>
"... | code_fim | medium | {
"lang": "python",
"repo": "susan977/Unlimited-Filter-Bot",
"path": "/script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manojkumar-github/DataStructures-DynamicProgramming-in-Python-JAVA-Cplusplus path: /leet/plan/algorithms/branch_and_bound/notes.py
#!/usr/bin.env python
# Copyright (C) Pearson Assessments - 2020. All Rights Reserved.
# Proprietary - Use with Pearson Written Permission Only
<|fim_suffix|>1) Onl... | code_fim | hard | {
"lang": "python",
"repo": "manojkumar-github/DataStructures-DynamicProgramming-in-Python-JAVA-Cplusplus",
"path": "/leet/plan/algorithms/branch_and_bound/notes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>1) Only minimzation problems
2) Can conver maximization to minimization
"""<|fim_prefix|># repo: manojkumar-github/DataStructures-DynamicProgramming-in-Python-JAVA-Cplusplus path: /leet/plan/algorithms/branch_and_bound/notes.py
#!/usr/bin.env python
# Copyright (C) Pearson Assessments - 2020. All Rights ... | code_fim | hard | {
"lang": "python",
"repo": "manojkumar-github/DataStructures-DynamicProgramming-in-Python-JAVA-Cplusplus",
"path": "/leet/plan/algorithms/branch_and_bound/notes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fraction = fraction_lt_thresholds([1, 4, 2, 3], [4, 3])
assert fraction == [0.75, 0.5]
def test_item_ids_for_differing_annotations():
corpus = 'smc_mirex'
estimates = read_estimate_annotations(corpus, validate=False)['tempo']
references = read_reference_annotations(corpus, validate=F... | code_fim | hard | {
"lang": "python",
"repo": "tempoeval/tempo_eval",
"path": "/tests/test_evaluation.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tempoeval/tempo_eval path: /tests/test_evaluation.py
import math
from os.path import join
import jams
import pytest
import numpy as np
from numba import TypingError
from pytest import approx
from math import isnan
from tempo_eval.evaluation import list_reference_corpus_names, read_reference_ann... | code_fim | hard | {
"lang": "python",
"repo": "tempoeval/tempo_eval",
"path": "/tests/test_evaluation.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def relu(Z):
return np.maximum(0,Z)
@staticmethod
def dRelu(x):
x[x<=0] = 0
x[x>0] = 1
return x
@staticmethod
def elu(x, alpha = 0.01):
return np.where(x>=0, x, alpha*np.exp(x)-1)
@staticmethod
def dElu(x, alp... | code_fim | hard | {
"lang": "python",
"repo": "tjatkowski/AGH-AiB-Flappy-bird",
"path": "/src/network/dense.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tjatkowski/AGH-AiB-Flappy-bird path: /src/network/dense.py
import numpy as np
class Dense:
def __init__(self, size, activation=None, init_method=None):
"""
size: Tuple holding number of neurons in the input and the output
activation: Activation function
-'... | code_fim | hard | {
"lang": "python",
"repo": "tjatkowski/AGH-AiB-Flappy-bird",
"path": "/src/network/dense.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># # Running and evaluating the model
# hist = model.fit(x_train, y_train,
# batch_size=32,
# epochs=10,
# validation_data=(x_test, y_test),
# verbose=2)
# ## 6. Evaluating the model
# This will give you the accuracy of the model, as evaluated on the testing set. ... | code_fim | hard | {
"lang": "python",
"repo": "PeriGK/DeepLearningND",
"path": "/NeuralNetworksIntro/KerasIntro/keras_imdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PeriGK/DeepLearningND path: /NeuralNetworksIntro/KerasIntro/keras_imdb.py
# coding: utf-8
# # Analyzing IMDB Data in Keras
# Imports
import numpy as np
import keras
from keras.datasets import imdb
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from kera... | code_fim | hard | {
"lang": "python",
"repo": "PeriGK/DeepLearningND",
"path": "/NeuralNetworksIntro/KerasIntro/keras_imdb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# ## 2. Examining the data
# Notice that the data has been already pre-processed, where all the words have numbers, and the reviews come in as a vector with the words that the review contains. For example, if the word 'the' is the first one in our dictionary, and a review contains the word 'the', then th... | code_fim | hard | {
"lang": "python",
"repo": "PeriGK/DeepLearningND",
"path": "/NeuralNetworksIntro/KerasIntro/keras_imdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi
from braintree.resource import Resource as Resource
class ConnectedMerchantPayPalStatusChanged(Resource):
<|fim_suffix|> @property
def merchant_id(self): ...<... | code_fim | easy | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, gateway, attributes) -> None: ...
@property
def merchant_id(self): ...<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi
from braintree.resource import Resource as Resource... | code_fim | easy | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def merchant_id(self): ...<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi
from braintree.resource import Resource as Resource
class ConnectedMerchantPayPalStatusChanged(Resource):
<... | code_fim | easy | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/helpers/typeshed/stubs/braintree/braintree/connected_merchant_paypal_status_changed.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def env_variables(envs: dict[str, str]):
def env_variables_inner(ctr: dagger.Container):
for key, value in envs.items():
ctr = ctr.with_env_variable(key, value)
return ctr
return env_variables_inner
anyio.run(main)<|fim_prefix|># repo: dgageot/dagger path: /docs/cur... | code_fim | hard | {
"lang": "python",
"repo": "dgageot/dagger",
"path": "/docs/current/cookbook/snippets/environment-variables/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgageot/dagger path: /docs/current/cookbook/snippets/environment-variables/main.py
import sys
import anyio
import dagger
async def main():
# create Dagger client
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
# setup container and
# defin... | code_fim | hard | {
"lang": "python",
"repo": "dgageot/dagger",
"path": "/docs/current/cookbook/snippets/environment-variables/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Exopy/exopy path: /exopy/tasks/tasks/logic/loop_exceptions_tasks.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
#... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/tasks/tasks/logic/loop_exceptions_tasks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """If the condition evaluates to true, break from the loop.
"""
if self.format_and_eval_string(self.condition):
raise BreakException()
class ContinueTask(SimpleTask):
"""Task jumping to next loop iteration when a condition is met.
See Python continue stateme... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/tasks/tasks/logic/loop_exceptions_tasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Okrio/pylufia path: /stats/mixture/gmm.py
# -*- coding: utf-8 -*-
"""
============================================================
@file gmm.py
@date 2014/05/07
@author sasai
@brief
Gaussian Mixture Model
============================================================
"""
from ..prob_dists i... | code_fim | hard | {
"lang": "python",
"repo": "Okrio/pylufia",
"path": "/stats/mixture/gmm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for k in range(self.K):
self.rz[n,k] = gmm_pdfs[k] / gmm_pdfs.sum(0)
# self.rz = sp.maximum(self.rz, 1e-10)
self.rz /= self.rz.sum(1)[:,sp.newaxis]
print('rz:')
print(self.rz)
print( self.rz.min() )
... | code_fim | hard | {
"lang": "python",
"repo": "Okrio/pylufia",
"path": "/stats/mixture/gmm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if linalg.det(self.sigma[k]) <= 0.0:
# print 'det(Sigma)=0'
# print self.sigma[k]
for k in range(self.K):
self.pi[k] = Nk[k] / float(self.N)
print('pi:')
print(self.pi)
print('mu:')
... | code_fim | hard | {
"lang": "python",
"repo": "Okrio/pylufia",
"path": "/stats/mixture/gmm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jduan/cosmos path: /python_sandbox/python_sandbox/effective_python/item18.py
# # Things to Remember
#
# Functions can accept a variable number of positional arguments by using *args in the def
# statement.
#
# You can use the items from a sequence as the positional arguments for a function with t... | code_fim | hard | {
"lang": "python",
"repo": "jduan/cosmos",
"path": "/python_sandbox/python_sandbox/effective_python/item18.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if values:
values_str = ', '.join(str(x) for x in values)
print("%s: %s: %s" % (sequence, message, values_str))
else:
print("%s: %s" % (sequence, message))
def main():
log('My numbers are', 1, 2)
log('Hi there')
favorites = [7, 33, 99]
# This is called the... | code_fim | hard | {
"lang": "python",
"repo": "jduan/cosmos",
"path": "/python_sandbox/python_sandbox/effective_python/item18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uranc/arbitrary_style_transfer path: /encoder.py
# Encoder is fixed to the first few layers (up to relu4_1)
# of VGG-19 (pre-trained on ImageNet)
# This code is a modified version of Anish Athalye's vgg.py
# https://github.com/anishathalye/neural-style/blob/master/vgg.py
import numpy as np
impor... | code_fim | hard | {
"lang": "python",
"repo": "uranc/arbitrary_style_transfer",
"path": "/encoder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def deprocess(self, image, mode='BGR'):
if mode == 'BGR':
return image + np.array([103.939, 116.779, 123.68])
else:
return image + np.array([123.68, 116.779, 103.939])
def conv2d(x, kernel, bias):
# padding image with reflection mode
x_padded = tf.pad(... | code_fim | hard | {
"lang": "python",
"repo": "uranc/arbitrary_style_transfer",
"path": "/encoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if exists(path):
return True
return False
def get_conf_path(conf_name):
if not conf_name.endswith('.yml'):
conf_name = conf_name + '.yml'
cur_path_yml = '%s/%s' % (getcwd(), conf_name)
if exists(cur_path_yml):
result = cur_path_yml
else:
result = ... | code_fim | medium | {
"lang": "python",
"repo": "everdom/okcat",
"path": "/okcat/helper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur_path_yml = '%s/%s' % (getcwd(), conf_name)
if exists(cur_path_yml):
result = cur_path_yml
else:
result = '~/.okcat/' + conf_name
print('using config on %s' % result)
return result
def print_unicode(line):
if sys.version_info >= (3, 0):
print(bytes.dec... | code_fim | medium | {
"lang": "python",
"repo": "everdom/okcat",
"path": "/okcat/helper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: everdom/okcat path: /okcat/helper.py
#!/usr/bin/python -u
"""
Copyright (C) 2017 Jacksgong(jacksgong.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apach... | code_fim | hard | {
"lang": "python",
"repo": "everdom/okcat",
"path": "/okcat/helper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NickBonet/pytwitchbot path: /pytwitchbot/pytwitchbot.py
import asyncio
from threading import Thread
from twisted.internet import ssl, reactor, protocol
from ircbotclient import IRCBotClient
from modules.core.logger import Logger
from pytwitchdiscord import DiscordBot
log = Logger()
# Creates... | code_fim | medium | {
"lang": "python",
"repo": "NickBonet/pytwitchbot",
"path": "/pytwitchbot/pytwitchbot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # noinspection PyUnresolvedReferences
reactor.stop()
if __name__ == '__main__':
bot = IRCBotFactory()
discordBot = DiscordBot(bot.protocol.get_discord_token(),
bot.protocol.get_discord_default_channel(),
bot.protocol.get_dis... | code_fim | hard | {
"lang": "python",
"repo": "NickBonet/pytwitchbot",
"path": "/pytwitchbot/pytwitchbot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def submit_command(args):
submission_id = submit()
if submission_id:
login()
watch(submission_id)
def new_command(args):
host = f"https://{config.get('kattis', 'hostname')}"
sample_path = f"{host}/problems/{args.problem}/file/statement/samples.zip"
r = session.get(sam... | code_fim | hard | {
"lang": "python",
"repo": "jsannemo/contest_tools",
"path": "/ct.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> problem_path = Path.cwd() / args.problem
try:
problem_path.mkdir()
except FileExistsError:
pass
os.chdir(problem_path)
sample_zip = zipfile.ZipFile(io.BytesIO(r.content))
sample_zip.extractall("tests")
lang = args.language
template_path = config.get("templa... | code_fim | hard | {
"lang": "python",
"repo": "jsannemo/contest_tools",
"path": "/ct.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsannemo/contest_tools path: /ct.py
import argparse
import configparser
import curses
import io
import json
import os
import sys
import time
import re
import shutil
import zipfile
from pathlib import Path
import requests
session = requests.Session()
session.headers.update({"User-Agent": "Conte... | code_fim | hard | {
"lang": "python",
"repo": "jsannemo/contest_tools",
"path": "/ct.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lumiduino-RCOS/Lumiduino-Server path: /Server/deviceclient.py
import socket
import time
import queue
import threading
class DeviceClient(object):
def __init__(self, address, port):
self.running = True
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPR... | code_fim | hard | {
"lang": "python",
"repo": "Lumiduino-RCOS/Lumiduino-Server",
"path": "/Server/deviceclient.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._add_device_message(114, pin, length)
def send_light_range_msg(self, start: int, end: int, r: int, g: int, b: int):
self._add_device_message(116, start, end, r, g, b)
def send_single_light_msg(self, pixel: int, r: int, g: int, b: int):
self._add_device_message(115, p... | code_fim | hard | {
"lang": "python",
"repo": "Lumiduino-RCOS/Lumiduino-Server",
"path": "/Server/deviceclient.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tuomas777/mvj path: /leasing/migrations/0001_initial.py
'City')),
('email', models.CharField(blank=True, max_length=255, null=True, verbose_name='Email')),
('phone', models.CharField(blank=True, max_length=255, null=True, verbose_name='Phone')),
('l... | code_fim | hard | {
"lang": "python",
"repo": "tuomas777/mvj",
"path": "/leasing/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tuomas777/mvj path: /leasing/migrations/0001_initial.py
('postal_code', models.CharField(blank=True, max_length=255, null=True, verbose_name='Postal code')),
('city', models.CharField(blank=True, max_length=255, null=True, verbose_name='City')),
('ema... | code_fim | hard | {
"lang": "python",
"repo": "tuomas777/mvj",
"path": "/leasing/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gth=255, verbose_name='City')),
('type', enumfields.fields.EnumField(enum=leasing.enums.PlotType, max_length=30, verbose_name='Type')),
('in_contract', models.BooleanField(default=False, verbose_name='At time of contract')),
('plot_division_identifier', mode... | code_fim | hard | {
"lang": "python",
"repo": "tuomas777/mvj",
"path": "/leasing/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/Data-Structures-Algos-Codebase/ALGO/__PYTHON/exists_in.py
def find(arr, search, n):
for i in range(n):
if arr[i] == search:
return True
break
<|fim_suffix|>print(find(arr, search, 6))<|fim_middle|>arr = [1, 2, 3, 4... | code_fim | easy | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/Data-Structures-Algos-Codebase/ALGO/__PYTHON/exists_in.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(find(arr, search, 6))<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/Data-Structures-Algos-Codebase/ALGO/__PYTHON/exists_in.py
def find(arr, search, n):
<|fim_middle|> for i in range(n):
if arr[i] == search:
return True
break
arr = [1, 2, 3, 4... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/Data-Structures-Algos-Codebase/ALGO/__PYTHON/exists_in.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Print merge_by_id
print(merge_by_id)<|fim_prefix|># repo: Pegasus-01/DataCamp-works path: /11-MergingDataframeWithPandas/Chapter_3/01-Merging on a specific column.py
# Merge revenue with managers on 'city': merge_by_city
merge_by_city = pd.merge(revenue, managers, on='city')
<|fim_middle|># Print ... | code_fim | medium | {
"lang": "python",
"repo": "Pegasus-01/DataCamp-works",
"path": "/11-MergingDataframeWithPandas/Chapter_3/01-Merging on a specific column.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pegasus-01/DataCamp-works path: /11-MergingDataframeWithPandas/Chapter_3/01-Merging on a specific column.py
# Merge revenue with managers on 'city': merge_by_city
merge_by_city = pd.merge(revenue, managers, on='city')
# Print merge_by_city
print(merge_by_city)
<|fim_suffix|># Print merge_... | code_fim | medium | {
"lang": "python",
"repo": "Pegasus-01/DataCamp-works",
"path": "/11-MergingDataframeWithPandas/Chapter_3/01-Merging on a specific column.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nadirs/toscana_comuni_latlong path: /preprocess_sira.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Nadir Sampaoli
# Some rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following cond... | code_fim | hard | {
"lang": "python",
"repo": "nadirs/toscana_comuni_latlong",
"path": "/preprocess_sira.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return xml_elem_for(k, entry)
def serialize_txt(in_fname):
"""
Utility method for converting txt file to serialized file
"""
txt_dict = {}
with open(in_fname, 'rU') as infile:
txt_urls, istat_lines = infile.read().split('\n\n')[::1]
txt_dict[KEY_URL_FOR_XML], txt_d... | code_fim | hard | {
"lang": "python",
"repo": "nadirs/toscana_comuni_latlong",
"path": "/preprocess_sira.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_sandwich.py
#calss header
class _SANDWICH():
def __init__(self,):
<|fim_suffix|> def run(self, obj1 = [], obj2 = []):
return self.jsondata<|fim_middle|> self.name = "SANDWICH"
self.definitions = [u'two pieces of bread with cheese, salad, or m... | code_fim | hard | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_sandwich.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Generate the submits elements to be added to the model form.
'''
if instance:
sb = [Widget('input:submit', value='save', name=forms.SAVE_KEY),
Widget('input:submit', value='save as new',
name=forms.SAVE_AS_NEW_KEY)]
else:
sb = [Widget('... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/djpcms",
"path": "/djpcms/cms/formutils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/djpcms path: /djpcms/cms/formutils.py
'''Utility functions for :mod:`djpcms.forms`'''
import sys
import logging
from functools import partial
from datetime import datetime
from djpcms import forms, html, is_renderer, ajax
from djpcms.forms.layout import FormWidget
from djpcms.utils.t... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/djpcms",
"path": "/djpcms/cms/formutils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>:parameter form_factory: A required instance of :class:`HtmlForm`.
:parameter initial: If not none, a dictionary of initial values.
:parameter prefix: Optional prefix string to use in the form.
:parameter addinputs: An optional function for creating inputs.
If available, it is called... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/djpcms",
"path": "/djpcms/cms/formutils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # data container
data = []
# derive basic characteristics
(nbins,dt) = histogram_binning(tmin,tmax)
# implement a dictionary with each time series
series = {}
for deletion in self.list:
key = deletion.source
# initialize a ... | code_fim | hard | {
"lang": "python",
"repo": "SmartDataProjects/dynamo",
"path": "/lib/fileop/history.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sql = "select t.id,f.name,source_id,destination_id,exitcode,created,started,finished," + \
" batch_id,f.size,exitcode from file_transfers as t" + \
" inner join files as f on t.file_id=f.id" + \
" inner join sites as d on d.id = t.destination_id" + \
... | code_fim | hard | {
"lang": "python",
"repo": "SmartDataProjects/dynamo",
"path": "/lib/fileop/history.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmartDataProjects/dynamo path: /lib/fileop/history.py
import logging
import time
try:
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
except ImportError:
class PyPlot(object):
def hist(self, *args):
raise RuntimeError('matplotlib is no... | code_fim | hard | {
"lang": "python",
"repo": "SmartDataProjects/dynamo",
"path": "/lib/fileop/history.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Salingo/CTF-Net path: /code/test.py
log_string(str):
logger.info(str)
print(str)
'''HYPER PARAMETER'''
os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu
'''CREATE DIR'''
experiment_dir = Path(ROOT_DIR).joinpath('../output/', args.log_dir)
#experiment_dir = experiment_dir + args.log_dir
ou... | code_fim | hard | {
"lang": "python",
"repo": "Salingo/CTF-Net",
"path": "/code/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> error_cr_comp_gen_emd_sum.append(error_cr_comp_gen_emd.item())
error_cr_comp_full_emd_sum.append(error_cr_comp_full_emd.item())
error_cr_regi_t_sum.append(error_cr_regi_t.item())
error_rc_comp_gen_emd_sum.append(error_rc_comp_gen_emd.item())
error_rc_comp_full_emd_sum.append(error_rc_comp_f... | code_fim | hard | {
"lang": "python",
"repo": "Salingo/CTF-Net",
"path": "/code/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Salingo/CTF-Net path: /code/test.py
batch size in training')
parser.add_argument('--gpu', type=str, default='0', help='specify gpu device')
parser.add_argument('--input_scale_list',type=list,default=[2048,1024,512],help='number of points in each scales')
parser.add_argument('--output_scale_lis... | code_fim | hard | {
"lang": "python",
"repo": "Salingo/CTF-Net",
"path": "/code/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: barrust/Wikipedia path: /tests/request_mock_data.py
xt', ''), ('prop', 'extracts'), ('titles', 'Tropical Depression Ten (2005)')):
{'query': {'pages': {'21196082': {'extract': 'Tropical Depression Ten was the tenth tropical cyclone of the record-breaking 2005 Atlantic hurricane season. It for... | code_fim | hard | {
"lang": "python",
"repo": "barrust/Wikipedia",
"path": "/tests/request_mock_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: barrust/Wikipedia path: /tests/request_mock_data.py
e:TD 10 August 13, 2005.jpg'}, '-1': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/a/a5/10-L_2005_track.png', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:10-L_2005_track... | code_fim | hard | {
"lang": "python",
"repo": "barrust/Wikipedia",
"path": "/tests/request_mock_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> (('cllimit', 'max'), (u'clshow', u'!hidden'), ('prop', 'categories'), ('titles', 'Tropical Depression Ten (2005)')):
{"query":{"pages":{"21196082":{"pageid":21196082,"ns":0,"title":"Tropical Depression Ten (2005)","categories":[{"ns":14,"title":"2005 Atlantic hurricane season"},{"ns":14,"title":"A... | code_fim | hard | {
"lang": "python",
"repo": "barrust/Wikipedia",
"path": "/tests/request_mock_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> api.logger.info('Process started')
api.send(outports[0]['name'], log_stream.getvalue())
api.send(outports[0]['name'], log_stream.getvalue())
inports = [{'name': 'tables', 'type': 'message.table',"description":"List of tables"}]
outports = [{'name': 'log', 'type': 'string',"description":"Logg... | code_fim | hard | {
"lang": "python",
"repo": "jeremyyma/data-intelligence-replication",
"path": "/src/di_replication/repl_get_primary_keys/repl_get_primary_keys.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeremyyma/data-intelligence-replication path: /src/di_replication/repl_get_primary_keys/repl_get_primary_keys.py
import sdi_utils.gensolution as gs
import subprocess
import os
import pandas as pd
import logging
import io
try:
api
except NameError:
class api:
queue = list()
... | code_fim | hard | {
"lang": "python",
"repo": "jeremyyma/data-intelligence-replication",
"path": "/src/di_replication/repl_get_primary_keys/repl_get_primary_keys.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>inports = [{'name': 'tables', 'type': 'message.table',"description":"List of tables"}]
outports = [{'name': 'log', 'type': 'string',"description":"Logging data"}, \
{'name': 'sqlkeys', 'type': 'message',"description":"sql keys"}]
#api.set_port_callback(inports[0]['name'], process)
def test_... | code_fim | hard | {
"lang": "python",
"repo": "jeremyyma/data-intelligence-replication",
"path": "/src/di_replication/repl_get_primary_keys/repl_get_primary_keys.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
db_dir: str,
storage path of the database
working_dir: str, optional,
working directory, to store intermediate files and log file
verbose: int, default 2,
log verbosity
kwargs: auxilliary key word arg... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/other_databases/tele.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenh06/database_reader path: /database_reader/other_databases/tele.py
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from typing import Union, Optional, Any, List, Tuple, NoReturn
from numbers import Real
import numpy as np
np.set_printoptions(precision=5, suppress=True)
import ... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/other_databases/tele.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ not finished,
Parameters
----------
db_dir: str,
storage path of the database
working_dir: str, optional,
working directory, to store intermediate files and log file
verbose: int, default 2,
log verbosity
kwar... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/other_databases/tele.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>10)
tokenizer.load(save_dir)
print(tokenizer.predict(['中央民族乐团离开北京前往维也纳', '商品和服务']))
tokenizer.evaluate(CTB6_CWS_TEST, save_dir=save_dir)
print(f'Model saved in {save_dir}')<|fim_prefix|># repo: leobert-lan/HanLP path: /plugins/hanlp_demo/hanlp_demo/zh/tf/cws/train_large_cws_albert.py
# -*- coding:utf-8 -... | code_fim | medium | {
"lang": "python",
"repo": "leobert-lan/HanLP",
"path": "/plugins/hanlp_demo/hanlp_demo/zh/tf/cws/train_large_cws_albert.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leobert-lan/HanLP path: /plugins/hanlp_demo/hanlp_demo/zh/tf/cws/train_large_cws_albert.py
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-28 22:22
from hanlp.components.tok import TransformerTokenizer
from hanlp.datasets.cws.ctb import CTB6_CWS_VALID, CTB6_CWS_TEST
from tests import cdr... | code_fim | medium | {
"lang": "python",
"repo": "leobert-lan/HanLP",
"path": "/plugins/hanlp_demo/hanlp_demo/zh/tf/cws/train_large_cws_albert.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> CTB6_CWS_VALID, save_dir,
transformer='albert_base_zh',
max_seq_length=128,
metrics='f1', learning_rate=5e-5, epochs=10)
tokenizer.load(save_dir)
print(tokenizer.predict(['中央民族乐团离开北京前往维也纳', '商品和服务']))
tokenizer.evaluate(CTB6_CWS_TEST, save_dir=save_dir... | code_fim | medium | {
"lang": "python",
"repo": "leobert-lan/HanLP",
"path": "/plugins/hanlp_demo/hanlp_demo/zh/tf/cws/train_large_cws_albert.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.