text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Axtell/golflang-encodings path: /golflang_encodings/Gaia/gaia.py
NAME = "Gaia"
CODEPAGE = {
0: '₀', 1: '₁', 2: '₂', 3: '₃', 4: '₄', 5: '₅', 6: '₆', 7: '₇',
8: '₈', 9: '₉', 10: 'ₓ', 11: '₌', 12: 'ₔ', 13: '∂', 14: '€', 15: '₵',
16: '⟨', 17: '⟩', 18: '⟪', 19: '⟫', 20: '⇑', 21: '⇓', 22: ... | code_fim | hard | {
"lang": "python",
"repo": "Axtell/golflang-encodings",
"path": "/golflang_encodings/Gaia/gaia.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>┅', 132: '⌋', 133: '⌉', 134: '⊂', 135: '⊃',
136: '∧', 137: '∨', 138: 'Σ', 139: 'Π', 140: '‼', 141: '×', 142: '÷', 143: '⁻',
144: 'ø', 145: 'Ø', 146: '¤', 147: '¶', 148: '§', 149: ' ', 150: '₸', 151: 'ℍ',
152: 'Ȧ', 153: 'Ċ', 154: 'Ḋ', 155: 'Ė', 156: 'Ḟ', 157: 'Ġ', 158: 'Ḣ', 159: 'Ṁ',
160: '... | code_fim | hard | {
"lang": "python",
"repo": "Axtell/golflang-encodings",
"path": "/golflang_encodings/Gaia/gaia.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Ḳ', 194: 'Ḷ', 195: 'Ṃ', 196: 'Ṇ', 197: 'Ọ', 198: 'Ṛ', 199: 'Ṣ',
200: 'Ṭ', 201: 'Ụ', 202: 'Ṿ', 203: 'Ẉ', 204: 'Ỵ', 205: 'Ẓ', 206: 'ạ', 207: 'ḅ',
208: 'ḍ', 209: 'ẹ', 210: 'ḥ', 211: 'ḳ', 212: 'ḷ', 213: 'ṃ', 214: 'ṇ', 215: 'ọ',
216: 'ṛ', 217: 'ṣ', 218: 'ṭ', 219: 'ụ', 220: 'ṿ', 221: 'ẉ', 222: 'ỵ', ... | code_fim | hard | {
"lang": "python",
"repo": "Axtell/golflang-encodings",
"path": "/golflang_encodings/Gaia/gaia.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: animeshinvinci/airflow-plugins path: /outreach_plugin/__init__.py
from airflow.plugins_manager import AirflowPlugin
from outreach_plugin.hooks.outreach_hook import OutreachHook
from outreach_plugin.operators.outreach_to_redshift_operator import OutreachToRedshiftOperator
<|fim_suffix|> name ... | code_fim | easy | {
"lang": "python",
"repo": "animeshinvinci/airflow-plugins",
"path": "/outreach_plugin/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class OutreachPlugin(AirflowPlugin):
name = "outreach_plugin"
operators = [OutreachToRedshiftOperator]
hooks = [OutreachHook]
# Leave in for explicitness even if not using
executors = []
macros = []
admin_views = []
flask_blueprints = []
menu_links = []<|fim_prefix|># r... | code_fim | medium | {
"lang": "python",
"repo": "animeshinvinci/airflow-plugins",
"path": "/outreach_plugin/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = "outreach_plugin"
operators = [OutreachToRedshiftOperator]
hooks = [OutreachHook]
# Leave in for explicitness even if not using
executors = []
macros = []
admin_views = []
flask_blueprints = []
menu_links = []<|fim_prefix|># repo: animeshinvinci/airflow-plugins ... | code_fim | medium | {
"lang": "python",
"repo": "animeshinvinci/airflow-plugins",
"path": "/outreach_plugin/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># %%
from stable_baselines.common.vec_env import SubprocVecEnv
from stable_baselines.common.vec_env import VecNormalize
# %% [markdown]
# Load config and create the environments
# %%
envs = [make_env(config.episode_length,
config.max_motor_rotation,
config.flat_reward_ha... | code_fim | hard | {
"lang": "python",
"repo": "WPI-MMR/learning_experiments",
"path": "/experiments/train/solo8v2vanilla/ppo2-home-pos-normalized.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WPI-MMR/learning_experiments path: /experiments/train/solo8v2vanilla/ppo2-home-pos-normalized.py
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.10.1
# kernelspec:
# displ... | code_fim | hard | {
"lang": "python",
"repo": "WPI-MMR/learning_experiments",
"path": "/experiments/train/solo8v2vanilla/ppo2-home-pos-normalized.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># %% [markdown]
# Load config and create the environments
# %%
envs = [make_env(config.episode_length,
config.max_motor_rotation,
config.flat_reward_hard_margin,
config.flat_reward_soft_margin,
config.height_reward_target,
c... | code_fim | hard | {
"lang": "python",
"repo": "WPI-MMR/learning_experiments",
"path": "/experiments/train/solo8v2vanilla/ppo2-home-pos-normalized.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> params = 'language=english|debridoptions=nodownloadlinks,nocatalog'
if self._pm_apikey:
params += '|premiumize=' + self._pm_apikey
if self._rd_apikey:
params += '|realdebrid=' + self._rd_apikey
if self._ad_apikey:
params += '|alldebrid=' ... | code_fim | hard | {
"lang": "python",
"repo": "rrosajp/a4kScrapers",
"path": "/providers/a4kScrapers/en/torrent/torrentio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rrosajp/a4kScrapers path: /providers/a4kScrapers/en/torrent/torrentio.py
# -*- coding: utf-8 -*-
from providerModules.a4kScrapers import core
class sources(core.DefaultSources):
def __init__(self, *args, **kwargs):
super(sources, self).__init__(__name__, *args, single_query=True, **... | code_fim | hard | {
"lang": "python",
"repo": "rrosajp/a4kScrapers",
"path": "/providers/a4kScrapers/en/torrent/torrentio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _soup_filter(self, response):
return response
def _title_filter(self, el):
if not self.is_movie_query():
parts = el['title'].split('\n')
if len(parts) > 1 and '👤' not in parts[1]:
parts.pop(1)
return '\n'.join(parts)
... | code_fim | hard | {
"lang": "python",
"repo": "rrosajp/a4kScrapers",
"path": "/providers/a4kScrapers/en/torrent/torrentio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyemin-han/Prior-Adjustment-CBM path: /working_memory/NeuroQuery/HCP/bayes_correction_split.py
import nibabel as nib
import numpy as np
def bayes_correction_split(mask, processes):
# create list of tasks
tasks = np.zeros((processes,2),dtype =int)
# load mask img
img = nib.load(mask)
# get... | code_fim | medium | {
"lang": "python",
"repo": "hyemin-han/Prior-Adjustment-CBM",
"path": "/working_memory/NeuroQuery/HCP/bayes_correction_split.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if the end point of the last process < X (due to some zeros in last Xs), correct it.
if tasks[processes-1,1] < X:
tasks[processes-1,1] = X
return tasks<|fim_prefix|># repo: hyemin-han/Prior-Adjustment-CBM path: /working_memory/NeuroQuery/HCP/bayes_correction_split.py
import nibabel as nib
import ... | code_fim | hard | {
"lang": "python",
"repo": "hyemin-han/Prior-Adjustment-CBM",
"path": "/working_memory/NeuroQuery/HCP/bayes_correction_split.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dataPoints in range(len(preparedData)):
print("----------------------\nDatapoint-{}\n".format(dataPoints))
partofPreparedData = preparedData[dataPoints]
partofActualData = fileContent[dataPoints]
# Prediction
Lambda,Beta = pst.predic... | code_fim | hard | {
"lang": "python",
"repo": "MounicaDevaguptapu/DiscountedSatisficing",
"path": "/Code/onlineAlgorithm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MounicaDevaguptapu/DiscountedSatisficing path: /Code/onlineAlgorithm.py
import os
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
from predictStoppingTime import predictStoppingTime
def readDataset(fileName):
fileContent = []
with open(fileName,'r') as f... | code_fim | hard | {
"lang": "python",
"repo": "MounicaDevaguptapu/DiscountedSatisficing",
"path": "/Code/onlineAlgorithm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("True Lambda - {} and True Beta - {} and True Weights - {}".format(trueLambda,trueBeta,trueweightVector))
print("Predicted Lambda - {} and predicted Beta - {} and predicted weights - {}".format(Lambda,Beta,weightVector))
plt.plot(list(LambdaError.keys()),list(Lambda... | code_fim | hard | {
"lang": "python",
"repo": "MounicaDevaguptapu/DiscountedSatisficing",
"path": "/Code/onlineAlgorithm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
What comes in: A positive integer n.
What goes out: Returns the sum:
1 + 1/2 + 1/3 + ... + 1/n.
Side effects: None.
"""
total = 0
for k in range(n):
total = total + 1 / (k+1)
return total
# -----------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "hawkinsbl/05a-Debugging",
"path": "/src/m1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hawkinsbl/05a-Debugging path: /src/m1.py
"""
This module lets you practice DEBUGGING when RUN-TIME EXCEPTIONS occur.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Valerie Galluzzi, Mark Hays, Amanda Stouder, Aaron Wilkin,
their colleagues, and Ben Hawkins.
... | code_fim | hard | {
"lang": "python",
"repo": "hawkinsbl/05a-Debugging",
"path": "/src/m1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: M-Sabrina/MinDE_analysis_2022 path: /min_analysis_tools/clean_kymograph.py
import numpy as np
from numpy import matlib
def clean_kymograph(reslice):
"""
Prepares a kymograph for autocorrelation analysis.
Input: slice as 2D numpy array of dimension (xx,tt) or (yy, tt).
Output: cl... | code_fim | medium | {
"lang": "python",
"repo": "M-Sabrina/MinDE_analysis_2022",
"path": "/min_analysis_tools/clean_kymograph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # flatten along t axis
md_prf_t = np.median(reslice, axis=0)
md_t = np.median(md_prf_t)
st_t = np.std(md_prf_t)
axz = np.arange(tt)
lo = md_t - 2 * st_t
hi = md_t + 2 * st_t
fitsel = np.argwhere((lo < md_prf_t) & (md_prf_t < hi))
sub_prf = md_prf_t[fitsel]
sub_axz =... | code_fim | medium | {
"lang": "python",
"repo": "M-Sabrina/MinDE_analysis_2022",
"path": "/min_analysis_tools/clean_kymograph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>None | null |
# +-------------------+---------------+
JsonValue = Union[
Dict[str, "JsonValue"],
List["JsonValue"],
Tuple["JsonValue", ...],
str,
int,
float,
bool,
None,
]<|fim_prefix|># repo: Arcensoth/pyckaxe path: /pyckaxe/lib/types.py
from typing ... | code_fim | hard | {
"lang": "python",
"repo": "Arcensoth/pyckaxe",
"path": "/pyckaxe/lib/types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> | number |
# +-------------------+---------------+
# | True | true |
# +-------------------+---------------+
# | False | false |
# +-------------------+---------------+
# | None | null |
# +-------------------+---------------+
JsonV... | code_fim | hard | {
"lang": "python",
"repo": "Arcensoth/pyckaxe",
"path": "/pyckaxe/lib/types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arcensoth/pyckaxe path: /pyckaxe/lib/types.py
from typing import Dict, List, Tuple, Union
__all__ = ("JsonValue",)
# +-------------------+---------------+
# | Python | JSON |
# +===================+===============+
# | dict | object <|fim_suffix|>None ... | code_fim | hard | {
"lang": "python",
"repo": "Arcensoth/pyckaxe",
"path": "/pyckaxe/lib/types.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The sys.exit() method ensures a clean exit.
# The environment will be informed, how the application ended.
sys.exit(exit_code)<|fim_prefix|># repo: jeremiedecock/snippets path: /python/pyqt/pyqt5/widget_QWebView.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See https://pythonspot.com/en/pyqt5-br... | code_fim | hard | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyqt/pyqt5/widget_QWebView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeremiedecock/snippets path: /python/pyqt/pyqt5/widget_QWebView.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See https://pythonspot.com/en/pyqt5-browser/
##############################################################################
# WARNING: QWebView/QtWebKit are DEPRECATED !!! Use QWe... | code_fim | medium | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyqt/pyqt5/widget_QWebView.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgnball/loan-item-api path: /system_test.py
import unittest
import requests
import json
import os
class TestLoanItemApi(unittest.TestCase):
def test_get_own_user(self):
body, code = self.get(f"/users/{bob}", bob)
self.assertEqual(200, code)
self.assertEqual(
... | code_fim | hard | {
"lang": "python",
"repo": "dgnball/loan-item-api",
"path": "/system_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check Bob can't make himself an admin
body, code = self.put(f"/users/{bob}", bob, {"role": "admin"})
self.assertEqual(403, code)
self.assertEqual({"error": "Not authorized."}, body)
# User the admin user to make Bob an admin and check he can then loan an item to ... | code_fim | hard | {
"lang": "python",
"repo": "dgnball/loan-item-api",
"path": "/system_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_attribute(self):
match = re.match(r'^([~@])(\w+)=(\w+):(.+)$', self.text)
prefix = match.group(1)
type = match.group(2)
name = match.group(3)
values = list(csv.reader(StringIO(match.group(4)), quotechar="'"))[0]
return {'prefix':prefix, 'type':t... | code_fim | hard | {
"lang": "python",
"repo": "DanielLaszlo/cvat-fork",
"path": "/cvat/apps/engine/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanielLaszlo/cvat-fork path: /cvat/apps/engine/models.py
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
import shlex
import csv
from io import StringIO
import re
import os
class Task(models.Model):
name = models.CharField(max_leng... | code_fim | hard | {
"lang": "python",
"repo": "DanielLaszlo/cvat-fork",
"path": "/cvat/apps/engine/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: py-in-the-sky/challenges path: /intermediate_words_search_python/utils.py
# 3rd-party imports
from itertools import chain
def memo(f):
"""memoization decorator, taken from Peter Norvig's Design of Computer
Programs course on Udacity.com"""
cache = {}
def _f(*args):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "py-in-the-sky/challenges",
"path": "/intermediate_words_search_python/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def underestimate_edit_distance(word_2):
shorter, longer = sorted((word, word_2), key=lambda string: len(string))
n_character_diff = len(longer) - len(shorter)
n_tranform_diff = sum(char not in longer for char in shorter)
return n_character_diff + n_tranform_diff
... | code_fim | hard | {
"lang": "python",
"repo": "py-in-the-sky/challenges",
"path": "/intermediate_words_search_python/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OSCI-WG/Extract_GitHub_Info path: /yaml_parse.py
__author__ = 'Majisto'
import sys
import os
import tkinter as tk
from tkinter import filedialog
import yaml
from openpyxl import Workbook
class Member(yaml.YAMLObject):
yaml_tag = "Member"
def __init__(self, login, id_number, ful... | code_fim | hard | {
"lang": "python",
"repo": "OSCI-WG/Extract_GitHub_Info",
"path": "/yaml_parse.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def ProcessInputFile(member_list):
wb, ws = GetWorkBook()
i = 2
for member in member_list:
assert isinstance(member, Member)
ws['A%d' % (i,)] = member.login
ws['B%d' % (i,)] = member.full_name
ws['C%d' % (i,)] = member.user_email
ws['D%d' % (i,)]... | code_fim | hard | {
"lang": "python",
"repo": "OSCI-WG/Extract_GitHub_Info",
"path": "/yaml_parse.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PazhenkovaEA/NeSim path: /simulation.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 09:46:09 2020
@author: elena
"""
import simuOpt
simuOpt.setOptions(alleleType='lineage', quiet=True)
import simuPOP as sim
import pandas as pd
import numpy as np
import seaborn as sn... | code_fim | hard | {
"lang": "python",
"repo": "PazhenkovaEA/NeSim",
"path": "/simulation.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#success_repr_males and success_dominant_males must be global variables, so it need to be set by the same name as here
success_repr_males = 1 # Chance of reproductive males to have an offspring (p in binomial distribution)
success_dominant_males = 1 # Chance of dominant males to have an offspring (p in bi... | code_fim | hard | {
"lang": "python",
"repo": "PazhenkovaEA/NeSim",
"path": "/simulation.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ], subPopSize=popmodel.demoModel),
postOps = [
sim.PyOperator(func=popmodel.cullCountry,param={"slo_cull": slo_cull, "cro_cull": cro_cull}),
sim.PyOperator(func = popmodel.CalcNe, param={"me":me, "Ne":Ne}, begin=int(0.2*generations)),
... | code_fim | hard | {
"lang": "python",
"repo": "PazhenkovaEA/NeSim",
"path": "/simulation.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> schema_func = null_dict_schema if null else dict_schema
return schema_func(
required_schema_properties=[],
id=num_schema(),
line1=null_str_schema(),
line2=null_str_schema(),
line3=null_str_schema(),
landmark=null_str_schema(),
pin=null_str_sc... | code_fim | hard | {
"lang": "python",
"repo": "manibhushan05/tms",
"path": "/web/transiq/customer/schema.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manibhushan05/tms path: /web/transiq/customer/schema.py
from api.schema import status_msg_extra_schema, dict_schema, list_schema, str_schema, num_schema, null_str_schema, \
enum_schema, null_dict_schema
def customer_app_data_schema():
return status_msg_extra_schema(
data=dict_sc... | code_fim | hard | {
"lang": "python",
"repo": "manibhushan05/tms",
"path": "/web/transiq/customer/schema.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willee/lorawan_toa path: /lorawan_toa_cal.py
# 4.1.1.6. LoRaTM Packet Structure, SX1276/77/78/79 Datasheet Rev.5 Aug 2016
# http://www.semtech.com/images/datasheet/sx1276.pdf
import math
from argparse import ArgumentParser
def mpsrange(a, b):
'''
Mac Payload Size range.
return a lis... | code_fim | hard | {
"lang": "python",
"repo": "willee/lorawan_toa",
"path": "/lorawan_toa_cal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> p = ArgumentParser(description="LoRa Time on Air calculator.")
p.add_argument("sf", metavar="SF",
help="Spreading Factor. It should be from 7 to 12, or FSK")
p.add_argument("n_size", metavar="SIZE", type=int,
help="""PHY payload size in byte.
Remember that P... | code_fim | hard | {
"lang": "python",
"repo": "willee/lorawan_toa",
"path": "/lorawan_toa_cal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkongjeen001118/awesome-python path: /generator/simple_manual_generator.py
def my_gen():
n = 1
print('This is printed first')
yield n
n += 1
print('This is printed second')
yield n
<|fim_suffix|>
if __name__ == '__main__':
a = my_gen()
# return generator obj.
... | code_fim | medium | {
"lang": "python",
"repo": "pkongjeen001118/awesome-python",
"path": "/generator/simple_manual_generator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
a = my_gen()
# return generator obj.
print(a)
print(next(a))
# it will resume their execution and state around the last point of value
print(next(a))
# and go to next yield
print(next(a))
# and when no more yiled it will do a 'StopIteration'
... | code_fim | medium | {
"lang": "python",
"repo": "pkongjeen001118/awesome-python",
"path": "/generator/simple_manual_generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LCAS/topological_navigation path: /topological_utils/scripts/dummy_topological_navigation.py
#!/usr/bin/env python
import sys
import topological_navigation.testing
import rospy
from mongodb_store.message_store import MessageStoreProxy
from topological_navigation.manager import map_manager
from t... | code_fim | hard | {
"lang": "python",
"repo": "LCAS/topological_navigation",
"path": "/topological_utils/scripts/dummy_topological_navigation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.nav_server.is_preempt_requested():
# print "done preempted"
self.nav_result.success = False
self.nav_server.set_preempted(self.nav_result)
else:
# print "done normal"
self.cn = goal.target
... | code_fim | hard | {
"lang": "python",
"repo": "LCAS/topological_navigation",
"path": "/topological_utils/scripts/dummy_topological_navigation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print 'called with policy goal %s'%goal
# this no longer seems valid
# target is the one which is not in the source list
# if len(goal.route.source) == 0:
# target_node = self.cn
# else:
# target_node = self.node_names - set(goal.route.sou... | code_fim | hard | {
"lang": "python",
"repo": "LCAS/topological_navigation",
"path": "/topological_utils/scripts/dummy_topological_navigation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
put_results.raise_for_status()
except requests.exceptions.HTTPError as httperr:
pretty_print_POST(put_results.request)
raise httperr
finally:
print( json.dumps(put_results.json(), indent= 2) )<|fim_prefix|># repo: ragpan29/Azure path: /search/python-files/... | code_fim | hard | {
"lang": "python",
"repo": "ragpan29/Azure",
"path": "/search/python-files/mgmt/search_mgmt.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open("./mgmt/python-files-index.json") as schema_path:
index_schema = json.load(schema_path)
index_schema.update({"name": appvar.config["SEARCH_INDEX_NAME"]})
index_url = search_url()
put_results = requests.put(index_url, headers=search_header(), data = json.dumps(index_... | code_fim | medium | {
"lang": "python",
"repo": "ragpan29/Azure",
"path": "/search/python-files/mgmt/search_mgmt.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ragpan29/Azure path: /search/python-files/mgmt/search_mgmt.py
import sys, os
sys.path.append(os.getcwd())
import requests
from app import appvar
import json
from util.common import pretty_print_POST
from util.search import search_header, search_url
<|fim_suffix|> try:
put_results.ra... | code_fim | hard | {
"lang": "python",
"repo": "ragpan29/Azure",
"path": "/search/python-files/mgmt/search_mgmt.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>logger = AimetLogger.get_area_logger(AimetLogger.LogAreas.Quant)
ClsSet = Union[Tuple['Conv', 'Conv'],
Tuple['Conv', 'Conv', 'Conv']]
ScaleFactor = Union[np.ndarray, Tuple[np.ndarray]]
cls_supported_layer_types = ['Conv', 'ConvTranspose']
cls_supported_activation_types = ['Relu', 'PRelu']
... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quic/aimet path: /TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py
IDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER ... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quic/aimet path: /TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py
RANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIA... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: globocom/iaas-usage path: /app/projects/resource.py
from flask import request
from flask_restful import reqparse
from app.auth.utils import required_login
from app.cloudstack.cloudstack_base_resource import CloudstackResource, handle_errors
import app
class ProjectResource(CloudstackResource):
... | code_fim | hard | {
"lang": "python",
"repo": "globocom/iaas-usage",
"path": "/app/projects/resource.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if response is not None and response.get('count') is not None:
if self.args.get('id') is not None:
return [
{
"name": self._get_project_name(project), "id": project['id'], "vm_count": project["vmtotal"],
"prima... | code_fim | hard | {
"lang": "python",
"repo": "globocom/iaas-usage",
"path": "/app/projects/resource.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Publish the data to the corresponding topic for each plug
mqtt_client.publish(plug_configurations[idx]["topic"], payload, 1)
# Wait for some time before publishing the next data (adjust as needed)
time.sleep(5)
# Disconnect from AWS IoT Core when the loop is stopped (not reache... | code_fim | hard | {
"lang": "python",
"repo": "highhair20/verkundenbot",
"path": "/device/app/MQTTComm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mqtt_clients.append(mqtt_client)
# Main loop to publish data for each plug
while True:
for idx, mqtt_client in enumerate(mqtt_clients):
# Replace the following with your smart plug's data for each plug
smartplug_data = {
"status": "on", # Replace with the current stat... | code_fim | medium | {
"lang": "python",
"repo": "highhair20/verkundenbot",
"path": "/device/app/MQTTComm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: highhair20/verkundenbot path: /device/app/MQTTComm.py
import os
import time
import json
import boto3
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
# AWS IoT Core configuration
endpoint = "your-iot-endpoint.amazonaws.com" # Replace with your AWS IoT endpoint
root_ca_path = "path/to/your/r... | code_fim | hard | {
"lang": "python",
"repo": "highhair20/verkundenbot",
"path": "/device/app/MQTTComm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with tf.Session() as sess:
print('cal e : ', sess.run(e))
writer = tf.summary.FileWriter('./my_graph', sess.graph)
writer.close()<|fim_prefix|># repo: xinzheshen/tf_practice path: /src/practice_7.py
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
import tensorflow as tf
<|fim_middle|>'''n... | code_fim | hard | {
"lang": "python",
"repo": "xinzheshen/tf_practice",
"path": "/src/practice_7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xinzheshen/tf_practice path: /src/practice_7.py
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
import tensorflow as tf
'''name scope'''
<|fim_suffix|>with tf.Session() as sess:
print('cal e : ', sess.run(e))
writer = tf.summary.FileWriter('./my_graph', sess.graph)
writer.close()... | code_fim | hard | {
"lang": "python",
"repo": "xinzheshen/tf_practice",
"path": "/src/practice_7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with tf.name_scope('scope_add'):
a = tf.add(1, 2, name='add_a')
b = tf.add(a, 2, name='add_b')
with tf.name_scope('scope_multiply'):
c = tf.multiply(3, 2, name='multiply_c')
d = tf.multiply(c, 2, name='multiply_d')
e = tf.add(b, d, name='output')
with tf.Session() as sess:
print('ca... | code_fim | medium | {
"lang": "python",
"repo": "xinzheshen/tf_practice",
"path": "/src/practice_7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># This is where we set up the eastern cottage.
east.db.desc = evtable.EvTable(map_module.return_minimap(6,5),
"A cosy cottage nestled among mountains stretching " \
"east as far as the eye can see.",
border=None)
east.db.desc.reformat_column(1, width=70)
ea... | code_fim | hard | {
"lang": "python",
"repo": "taishan90/evennia",
"path": "/mygame/world/batchcode_world.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Now we repeat this for the other rooms we'll be implementing.
# This is where we set up the northern castle.
north.db.desc = evtable.EvTable(map_module.return_minimap(4,2),
"An impressive castle surrounds you. There might be " \
"a princess in one of these towers.",
... | code_fim | hard | {
"lang": "python",
"repo": "taishan90/evennia",
"path": "/mygame/world/batchcode_world.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taishan90/evennia path: /mygame/world/batchcode_world.py
# -*- coding:utf-8 -*-
# mygame/world/batchcode_world.py
from evennia import create_object, search_object
from typeclasses import rooms, exits
from evennia.utils import evtable
from world import map_module
# We begin by creating our ro... | code_fim | hard | {
"lang": "python",
"repo": "taishan90/evennia",
"path": "/mygame/world/batchcode_world.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/Roadinter.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class Roadinter(object):
def __init__(self):
self._direction = None
self._distance = None
... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/Roadinter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not d:
return None
o = Roadinter()
if 'direction' in d:
o.direction = d['direction']
if 'distance' in d:
o.distance = d['distance']
if 'first_id' in d:
o.first_id = d['first_id']
if 'first_name' in d:
... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/Roadinter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return items
@app.delete("/items/{item_id}",
tags=["items"])
def delete_item(item_id: uuid.UUID):
"""Delete a ToDo item in the database."""
coll_items = data_access.get_items_collection()
item = coll_items.find_one({"item_id": item_id})
if item is None:
raise HTT... | code_fim | hard | {
"lang": "python",
"repo": "chermes/TodoService",
"path": "/todo_api/src/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chermes/TodoService path: /todo_api/src/main.py
"""Main entry point for the API service."""
from typing import List, Optional
import uuid
import datetime
from fastapi import FastAPI, Query, status, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from models impor... | code_fim | hard | {
"lang": "python",
"repo": "chermes/TodoService",
"path": "/todo_api/src/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># prints sum below
print(first - second)<|fim_prefix|># repo: Izardo/my-work path: /Topic_2_statements/simpleSubtraction.py
# This program subtracts one number from another
# Author: Isabella Doyle
<|fim_middle|>first = int(input("Enter the first number:")) # requests input of integer from user
second... | code_fim | medium | {
"lang": "python",
"repo": "Izardo/my-work",
"path": "/Topic_2_statements/simpleSubtraction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Izardo/my-work path: /Topic_2_statements/simpleSubtraction.py
# This program subtracts one number from another
# Author: Isabella Doyle
<|fim_suffix|># prints sum below
print(first - second)<|fim_middle|>first = int(input("Enter the first number:")) # requests input of integer from user
second... | code_fim | medium | {
"lang": "python",
"repo": "Izardo/my-work",
"path": "/Topic_2_statements/simpleSubtraction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vsukhor/mitoSim-postProcessor path: /src/records.py
"""Container class for time-dependent variables.
The variables are read from the simulation log file.
"""
import numpy as np
import matplotlib.pyplot as plt
class Records:
"""
Container for time-dependent variables recorded in the lo... | code_fim | hard | {
"lang": "python",
"repo": "vsukhor/mitoSim-postProcessor",
"path": "/src/records.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for r in recs:
if unit == 'd':
r.t = [t / 3600 / 24 for t in r.time]
elif unit == 'hours':
r.t = [t / 3600 for t in r.time]
elif unit == 'min':
r.t = [t / 60 for t in r.time]
elif unit in ('s', 'sec'):
... | code_fim | hard | {
"lang": "python",
"repo": "vsukhor/mitoSim-postProcessor",
"path": "/src/records.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def scale_time_to(recs, unit):
"""
Scale time to the desired unit 'unit'.
Acceptable units: 'd', 'hours', 'min', 's', 'secs'
"""
for r in recs:
if unit == 'd':
r.t = [t / 3600 / 24 for t in r.time]
elif... | code_fim | hard | {
"lang": "python",
"repo": "vsukhor/mitoSim-postProcessor",
"path": "/src/records.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frankier/finntk path: /examples/list_abbrvs.py
import click
from nltk.corpus import wordnet
from finntk.data.wordnet import ALL_ABBRVS
<|fim_suffix|> pronouns = {}
for lemma in wordnet.all_lemma_names(lang="fin"):
if "_" not in lemma:
continue
for b in lemma.s... | code_fim | medium | {
"lang": "python",
"repo": "frankier/finntk",
"path": "/examples/list_abbrvs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pronouns = {}
for lemma in wordnet.all_lemma_names(lang="fin"):
if "_" not in lemma:
continue
for b in lemma.split("_"):
if b not in ALL_ABBRVS:
continue
pronouns.setdefault(b, []).append(lemma)
if output == "group":
f... | code_fim | medium | {
"lang": "python",
"repo": "frankier/finntk",
"path": "/examples/list_abbrvs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cccccccccccccc/Myleetcode path: /66/plusOne.py
'''
time complexity=O(n) space complexity = 0
'''
from typing import List
class Solution:
<|fim_suffix|> for i in reversed(range(len(digits))):
if (digits[i]==9):
digits[i]=0
else:
digit... | code_fim | easy | {
"lang": "python",
"repo": "cccccccccccccc/Myleetcode",
"path": "/66/plusOne.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in reversed(range(len(digits))):
if (digits[i]==9):
digits[i]=0
else:
digits[i]+=1
return digits
return [1]+digits
A = Solution()
a = [9,9,9,9,9,9]
print(A.plusOne(a))<|fim_prefix|># repo: cccccccccccccc/Myleetco... | code_fim | easy | {
"lang": "python",
"repo": "cccccccccccccc/Myleetcode",
"path": "/66/plusOne.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('scheduled_classes', '0006_merge'),
]
operations = [
migrations.RunPython(add_microseconds)
]<|fim_prefix|># repo: shrmoud/schoolapp path: /src/tandlr/scheduled_classes/migrations/0007_auto_20160525_2013.py
# -*- coding: utf-8 -*-
from __future__ import... | code_fim | hard | {
"lang": "python",
"repo": "shrmoud/schoolapp",
"path": "/src/tandlr/scheduled_classes/migrations/0007_auto_20160525_2013.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shrmoud/schoolapp path: /src/tandlr/scheduled_classes/migrations/0007_auto_20160525_2013.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
from django.db import migrations, models
from django.utils import timezone
from django.utils.timez... | code_fim | hard | {
"lang": "python",
"repo": "shrmoud/schoolapp",
"path": "/src/tandlr/scheduled_classes/migrations/0007_auto_20160525_2013.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global pub
global waypoints
global is_insert
is_insert = insertId.data
print ("insert" + str(is_insert))
while is_insert != -1:
rospy.Subscriber("/move_base/goal", MoveBaseActionGoal, insertWaypoint)
printWaypoints()
updateWaypointjson()
rewriteMarker()
pub.... | code_fim | hard | {
"lang": "python",
"repo": "j-fujimoto/arno",
"path": "/nodes/arno_waypoint_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def listener():
global pub
global num
rospy.init_node('goal_sub', anonymous=True)
rospy.Subscriber("/move_base/goal", MoveBaseActionGoal, goalCallback)
rospy.Subscriber("/file", MoveBaseGoal, fileCallback)
rospy.Subscriber("/remove", Int16, removeCallback)
rospy.Subscriber("/i... | code_fim | hard | {
"lang": "python",
"repo": "j-fujimoto/arno",
"path": "/nodes/arno_waypoint_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-fujimoto/arno path: /nodes/arno_waypoint_loader.py
#!/usr/bin/env python
import rospy
from move_base_msgs.msg import MoveBaseActionGoal, MoveBaseGoal
from visualization_msgs.msg import Marker
from geometry_msgs.msg import PoseArray, Pose
from std_msgs.msg import Int16
waypoints = PoseArray()
... | code_fim | hard | {
"lang": "python",
"repo": "j-fujimoto/arno",
"path": "/nodes/arno_waypoint_loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_corrects = 0
for i in range(num_samples):
pred = y_pred[i]
test = y_test[i]
if pred == test:
num_corrects += 1
return num_corrects / num_samples
if __name__ == '__main__':
img_width, img_height = 224, 224
num_channels = 3
num_classes = 196
... | code_fim | hard | {
"lang": "python",
"repo": "TaQuangTu/DeepLearning_CarRecorgnition",
"path": "/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TaQuangTu/DeepLearning_CarRecorgnition path: /analyze.py
# -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import numpy as np
from keras.preprocessing import image
from sklearn.metrics import confusion_matrix
from tqdm import tqdm
from utils import load_model
def decode_predi... | code_fim | hard | {
"lang": "python",
"repo": "TaQuangTu/DeepLearning_CarRecorgnition",
"path": "/analyze.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Plot non-normalized confusion matrix
plt.figure()
plot_confusion_matrix(cnf_matrix, classes=class_names,
title='Confusion matrix, without normalization')
# Plot normalized confusion matrix
plt.figure()
plot_confusion_matrix(cnf_matrix, classes=class_nam... | code_fim | hard | {
"lang": "python",
"repo": "TaQuangTu/DeepLearning_CarRecorgnition",
"path": "/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gingerkirsch/ctci path: /1_arraysAndStrings/9_stringRotation.py
"""
1.9 String Rotation: Assume you have a method isSubstring which checks if one word is a substring of another.
Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring.
"""
<... | code_fim | hard | {
"lang": "python",
"repo": "gingerkirsch/ctci",
"path": "/1_arraysAndStrings/9_stringRotation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(rotation("waterbottle","erbottlewat") in "erbottlewat")
print(rotation("waterbattle","erbottlewat") in "erbottlewat")<|fim_prefix|># repo: gingerkirsch/ctci path: /1_arraysAndStrings/9_stringRotation.py
"""
1.9 String Rotation: Assume you have a method isSubstring which checks if one word is a subs... | code_fim | medium | {
"lang": "python",
"repo": "gingerkirsch/ctci",
"path": "/1_arraysAndStrings/9_stringRotation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: corenel/GAN-Zoo path: /DCGAN/models.py
"""Models for DCGAN."""
import os
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
from utils import init_weights
class Discriminator(nn.Module):
"""Model for Discriminator."""
def __init__(self, num_channels, conv_dim, n... | code_fim | hard | {
"lang": "python",
"repo": "corenel/GAN-Zoo",
"path": "/DCGAN/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, num_channels, z_dim, conv_dim, num_gpu):
"""Init for Generator model."""
super(Generator, self).__init__()
self.num_gpu = num_gpu
self.layer = nn.Sequential(
# 1st deconv layer, input Z, output (conv_dim*8) x 4 x 4
nn.ConvTrans... | code_fim | hard | {
"lang": "python",
"repo": "corenel/GAN-Zoo",
"path": "/DCGAN/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_models(num_channels, d_conv_dim, g_conv_dim, z_dim, num_gpu,
d_model_restore=None, g_model_restore=None):
"""Get models with cuda and inited weights."""
D = Discriminator(num_channels=num_channels,
conv_dim=d_conv_dim,
num_gpu=num_... | code_fim | hard | {
"lang": "python",
"repo": "corenel/GAN-Zoo",
"path": "/DCGAN/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## @var reservation
# Reservation status of a bid in [0,1].
## @var min
# Minimum flexibility for each period.
## @var max
# Maximum flexibility for each period.
## @var modulation
# Modulation request for each period.
## Energy constrained obligation bid.
cl... | code_fim | hard | {
"lang": "python",
"repo": "sebMathieu/dsima",
"path": "/simulator/src/ecbid.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.reservation=0
self.min=[0.0]*T
self.max=[0.0]*T
self.modulation=[0.0]*T
## @var reservation
# Reservation status of a bid in [0,1].
## @var min
# Minimum flexibility for each period.
## @var max
# Maximum flexibility for each ... | code_fim | hard | {
"lang": "python",
"repo": "sebMathieu/dsima",
"path": "/simulator/src/ecbid.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebMathieu/dsima path: /simulator/src/ecbid.py
##@package ecbid
#@author Sebastien MATHIEU
from .bid import Bid, BidRequest
from . import options
## Request of a energy constrained bid.
class ECBidRequest(BidRequest):
## Constructor
# @param bid Corresponding bid.
# @param... | code_fim | hard | {
"lang": "python",
"repo": "sebMathieu/dsima",
"path": "/simulator/src/ecbid.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TNRIS/api.tnris.org path: /src/data_hub/lcd/migrations/0015_ruaview.py
# Generated by Django 2.0.6 on 2018-10-02 16:27
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('lcd', '0014_auto_20180927_0836'),
]
operations = [
migrations.CreateModel... | code_fim | hard | {
"lang": "python",
"repo": "TNRIS/api.tnris.org",
"path": "/src/data_hub/lcd/migrations/0015_ruaview.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='RuaView',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('collection_id', models.UUIDField(verbose_name='Collection ID')),
... | code_fim | hard | {
"lang": "python",
"repo": "TNRIS/api.tnris.org",
"path": "/src/data_hub/lcd/migrations/0015_ruaview.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Akshat-unt/Text-Editor path: /editor.py
from tkinter import *
from tkinter import Tk,scrolledtext,filedialog,messagebox,END,simpledialog,colorchooser,commondialog
import datetime
import os
'''
this editor is made by Akshat
'''
def cut():
textarea.clipboard_clear()
textarea.cl... | code_fim | hard | {
"lang": "python",
"repo": "Akshat-unt/Text-Editor",
"path": "/editor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ask = messagebox.askyesno("Quit","Are you sure to quit")
if ask:
root.destroy()
def aboutus():
messagebox.showinfo("About us","Python Alternative of NotePad")
# main window thaat will get all the data on the screen
root = Tk(className="Python TextEditor")
textarea = scrolled... | code_fim | hard | {
"lang": "python",
"repo": "Akshat-unt/Text-Editor",
"path": "/editor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
SENSING_FILE = os.path.join(os.path.dirname(__file__), "../../tests/samples/sensing_protocol_samples.txt")
LEARNING_FILE = os.path.join(os.path.dirname(__file__), "../../tests/samples/learning_protocol_samples.txt")
model = FirstActionHandModel()
TrainingHandler.... | code_fim | hard | {
"lang": "python",
"repo": "tech-sketch/maico",
"path": "/maico/server/utils/data_processor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tech-sketch/maico path: /maico/server/utils/data_processor.py
import os
from maico.model.first_action.model import FirstActionHandModel
from maico.protocol.sensing_protocol import SensingProtocol, LearningProtocol
class TrainingHandler(object):
model = None
feedbacks = {}
@classme... | code_fim | hard | {
"lang": "python",
"repo": "tech-sketch/maico",
"path": "/maico/server/utils/data_processor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bomme/openl3 path: /tests/test_core.py
dio, sr,
input_repr="mel256", content_type="music", embedding_size=512,
center=True, hop_size=0.1, verbose=-1)
pytest.raises(OpenL3Error, openl3.get_audio_embedding, audio, sr,
input_repr="mel256", co... | code_fim | hard | {
"lang": "python",
"repo": "Bomme/openl3",
"path": "/tests/test_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bomme/openl3 path: /tests/test_core.py
2, verbose=True)
assert emb1.shape[1] == 512
assert np.all(np.abs(np.diff(ts1) - 1.0/frame_rate) < tol)
assert not np.any(np.isnan(emb1))
K.clear_session()
# Make sure all embedding types work fine
emb1 = openl3.get_image_embedding(i... | code_fim | hard | {
"lang": "python",
"repo": "Bomme/openl3",
"path": "/tests/test_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.