text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
# For future consideration:
#
# - Other metadata (__docformat__, __copyright__, etc.)
# - N̶a̶m̶e̶s̶p̶a̶c̶e̶ ̶p̶a̶c̶k̶a̶g̶e̶s̶ we got this<|fim_prefix|># repo: NASA-PDS/pds-api path: /src/pds/api/__init__.py
# -*- coding: utf-8 -*-
"""My PDS Module."""
import pkg_resources
<|fim_middle|>__version__ = ... | code_fim | medium | {
"lang": "python",
"repo": "NASA-PDS/pds-api",
"path": "/src/pds/api/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NASA-PDS/pds-api path: /src/pds/api/__init__.py
# -*- coding: utf-8 -*-
"""My PDS Module."""
import pkg_resources
<|fim_suffix|>
# For future consideration:
#
# - Other metadata (__docformat__, __copyright__, etc.)
# - N̶a̶m̶e̶s̶p̶a̶c̶e̶ ̶p̶a̶c̶k̶a̶g̶e̶s̶ we got this<|fim_middle|>
__version__ = ... | code_fim | medium | {
"lang": "python",
"repo": "NASA-PDS/pds-api",
"path": "/src/pds/api/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mvx24/code path: /fastapi/models/media.py
from datetime import datetime
from enum import Enum
from typing import Set
from pydantic import Schema, validator, constr
from database.models import AbstractDbBaseModel
from database.types import ForeignKey, HttpUrl
def _id_path(id_, size, ext="jpeg"... | code_fim | hard | {
"lang": "python",
"repo": "mvx24/code",
"path": "/fastapi/models/media.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if values and values.get("id"):
return f"https://media.digibook.app/{_id_path(values['id'], MediaSize.NORMALIZED)}"
return v
@validator("poster_url", pre=True, always=True)
def set_poster_url(cls, v, values):
if values and values.get("id"):
return (... | code_fim | hard | {
"lang": "python",
"repo": "mvx24/code",
"path": "/fastapi/models/media.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> thumbnail_url: HttpUrl = Schema("http://default.example", computed=True)
card_url: HttpUrl = Schema("http://default.example", computed=True)
large_url: HttpUrl = Schema("http://default.example", computed=True)
normalized_url: HttpUrl = Schema("http://default.example", computed=True)
or... | code_fim | hard | {
"lang": "python",
"repo": "mvx24/code",
"path": "/fastapi/models/media.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if serie_name in self.series_info.keys():
assert ValueError("El nombre de serie '{}' ya ha sido asignado, seleccione un nombre unico.".format(serie_name))
self.series_info[serie_name] = {
#'type': type,
'color': color
}
self.legends.app... | code_fim | hard | {
"lang": "python",
"repo": "jairotunior/deeplog",
"path": "/deeplog/wrappers/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jairotunior/deeplog path: /deeplog/wrappers/model.py
import gym
import gym.spaces
from deeplog.environments import SupplyEnv
import pandas as pd
import numpy as np
from deeplog.wrappers import Base
from abc import ABC, abstractmethod
class Model(Base):
def __init__(self, env):
Ba... | code_fim | hard | {
"lang": "python",
"repo": "jairotunior/deeplog",
"path": "/deeplog/wrappers/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /Calibration/LumiAlCaRecoProducers/python/alcaPCCIntegrator_cfi.py
import FWCore.ParameterSet.Config as cms
alcaPCCIntegrator = cms.ED<|fim_suffix|>alcaPCCEvent"),
ProdInst = cms.string("alcaPCCRandom")
)
)<|fim_middle|>Producer("AlcaPCCIntegrator",
AlcaPCCInt... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Calibration/LumiAlCaRecoProducers/python/alcaPCCIntegrator_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>alcaPCCEvent"),
ProdInst = cms.string("alcaPCCRandom")
)
)<|fim_prefix|># repo: cms-sw/cmssw path: /Calibration/LumiAlCaRecoProducers/python/alcaPCCIntegrator_cfi.py
import FWCore.ParameterSet.Config as cms
alcaPCCIntegrator = cms.ED<|fim_middle|>Producer("AlcaPCCIntegrator",
AlcaPCCInt... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Calibration/LumiAlCaRecoProducers/python/alcaPCCIntegrator_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mergederg/deuterium path: /game/gamesrc/commands/examples/cmdset.py
"""
Example command set template module.
To create new commands to populate the cmdset, see
examples/command.py.
To extend the character command set:
- copy this file up one level to gamesrc/commands and name it
something... | code_fim | hard | {
"lang": "python",
"repo": "mergederg/deuterium",
"path": "/game/gamesrc/commands/examples/cmdset.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PlayerCmdSet(default_cmds.PlayerCmdSet):
"""
This is set is available to the player when they have no
character connected to them (i.e. they are out-of-character, ooc).
"""
key = "DefaultPlayer"
def at_cmdset_creation(self):
"""
Populates the cmdset
"... | code_fim | hard | {
"lang": "python",
"repo": "mergederg/deuterium",
"path": "/game/gamesrc/commands/examples/cmdset.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ed, the program will not speak the text on the page", action='store_true')
args = parser.parse_args()
page = wikia.page(args.t)
if not args.q:
speaker = pyttsx3.init()
speaker.setProperty('rate', 185)
speaker.say(page.summary)
speaker.runAndWait()
if args.f:
art = wikia.article... | code_fim | medium | {
"lang": "python",
"repo": "MuhammadAlzamily/wiki_bot",
"path": "/wikibot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MuhammadAlzamily/wiki_bot path: /wikibot.py
import argparse
import pyttsx3
import wikipediaapi
wikia = wikipediaapi.Wikipedia('en')
parser = argparse.ArgumentParser()
parser.add_argument('t', help="the title you wanna search for",<|fim_suffix|>ed, the program will not speak the text on the page",... | code_fim | medium | {
"lang": "python",
"repo": "MuhammadAlzamily/wiki_bot",
"path": "/wikibot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tProperty('rate', 185)
speaker.say(page.summary)
speaker.runAndWait()
if args.f:
art = wikia.article(args.t)
speaker.say(art.text)
speaker.runAndWait()<|fim_prefix|># repo: MuhammadAlzamily/wiki_bot path: /wikibot.py
import argparse
import pyttsx3
import wikipediaapi
w... | code_fim | medium | {
"lang": "python",
"repo": "MuhammadAlzamily/wiki_bot",
"path": "/wikibot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangqi-net/ironic-python-agent path: /ironic_python_agent/tests/unit/extensions/test_image.py
'-L', 'ironic1', '-l',
'\\EFI\\BOOT\\BOOTX64.EFI'),
mock.call('umount', self.fake_dir + '/boot/efi',
... | code_fim | hard | {
"lang": "python",
"repo": "zhangqi-net/ironic-python-agent",
"path": "/ironic_python_agent/tests/unit/extensions/test_image.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_execute.side_effect = mount_raise_func
self.assertRaises(errors.CommandExecutionError,
image._install_grub2,
self.fake_dev, root_uuid=self.fake_root_uuid,
efi_system_part_uuid=self.fake_efi_system_part_uuid)... | code_fim | hard | {
"lang": "python",
"repo": "zhangqi-net/ironic-python-agent",
"path": "/ironic_python_agent/tests/unit/extensions/test_image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangqi-net/ironic-python-agent path: /ironic_python_agent/tests/unit/extensions/test_image.py
env_variables={'PATH': '/sbin:/bin:/usr/sbin'}),
mock.call('umount', self.fake_dir + '/boot/efi',
attempts=3, delay_on_retry=True)]
... | code_fim | hard | {
"lang": "python",
"repo": "zhangqi-net/ironic-python-agent",
"path": "/ironic_python_agent/tests/unit/extensions/test_image.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pytest.mark.skipif('UNKNOWN_DOCKER_SSH_HOST' not in os.environ,
reason='Unknown Docker SSH host not configured')
def test_ssh_unknown_host(self):
with self.assertRaises(paramiko.ssh_exception.SSHException) as cm:
docker.APIClient(
versio... | code_fim | medium | {
"lang": "python",
"repo": "docker/docker-py",
"path": "/tests/ssh/connect_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: docker/docker-py path: /tests/ssh/connect_test.py
import os
import unittest
import docker
import paramiko.ssh_exception
import pytest
from .base import TEST_API_VERSION
<|fim_suffix|> with self.assertRaises(paramiko.ssh_exception.SSHException) as cm:
docker.APIClient(
... | code_fim | hard | {
"lang": "python",
"repo": "docker/docker-py",
"path": "/tests/ssh/connect_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = argsparser.parse_args()
wsocket_client = WebsocketClient(args.uri)
asyncio.get_event_loop().run_until_complete(wsocket_client.connect())
asyncio.get_event_loop().run_until_complete(wsocket_client.send("GGWPPP"))
while True:
print("Enter input: ")
wsocket_client.... | code_fim | hard | {
"lang": "python",
"repo": "SRFG-MAT/RoboGen-DeepSpeechServices",
"path": "/Server_Client/Scripts/wsocket_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SRFG-MAT/RoboGen-DeepSpeechServices path: /Server_Client/Scripts/wsocket_client.py
import websockets
import ssl
import pathlib
import argparse
import asyncio
class WebsocketClient():
def __init__(self, uri: str):
self.uri = uri
<|fim_suffix|> args = argsparser.parse_args()
... | code_fim | hard | {
"lang": "python",
"repo": "SRFG-MAT/RoboGen-DeepSpeechServices",
"path": "/Server_Client/Scripts/wsocket_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rate = float(rate)
hrs = float(hrs)
grosspay = rate * hrs
grosspay = str(grosspay)
print("Pay: " + grosspay)
asdasdasd
dczxcxzcxzs
dcxcvcx<|fim_prefix|># repo: Dadsh/PY4E path: /py4e_02.3.py
# 2.3 Write a program to prompt the user
# for hours and rate per hour using input
# to compute gross pay. Use... | code_fim | medium | {
"lang": "python",
"repo": "Dadsh/PY4E",
"path": "/py4e_02.3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dadsh/PY4E path: /py4e_02.3.py
# 2.3 Write a program to prompt the user
# for hours and rate per hour using input
# to compute gross pay. Use 35 hours and a
# rate of <|fim_suffix|>ng to a number.
# Do not worry about error checking or bad user data.
hrs = input("Enter Hours: ")
rate = input... | code_fim | medium | {
"lang": "python",
"repo": "Dadsh/PY4E",
"path": "/py4e_02.3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ng to a number.
# Do not worry about error checking or bad user data.
hrs = input("Enter Hours: ")
rate = input("Enter Rate per hour: ")
rate = float(rate)
hrs = float(hrs)
grosspay = rate * hrs
grosspay = str(grosspay)
print("Pay: " + grosspay)
asdasdasd
dczxcxzcxzs
dcxcvcx<|fim_prefix|># repo: Dadsh... | code_fim | medium | {
"lang": "python",
"repo": "Dadsh/PY4E",
"path": "/py4e_02.3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ukaea/ALC_UQ path: /user_interface/test/test_dakota_class.py
from dakota_class import DakotaClass
from exceptions import *
import unittest
import xarray as xr
import numpy as np
import os
class TestDakotaClass(unittest.TestCase):
# Try and create an instance of the dakota class
def test... | code_fim | hard | {
"lang": "python",
"repo": "ukaea/ALC_UQ",
"path": "/user_interface/test/test_dakota_class.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> attrs = { 'type':'scan_correlated' }
lower = [ 0.1,0.2,0.3,0.4 ]
upper = [ 1.0,2.0,3.0,4.0 ]
partitions = [ 4,4,4,4 ]
lower = xr.DataArray( data=lower, dims='T' )
upper = xr.DataArray( data=upper, dims='T' )
partitions = xr.DataArray( data=partition... | code_fim | hard | {
"lang": "python",
"repo": "ukaea/ALC_UQ",
"path": "/user_interface/test/test_dakota_class.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isinstance(args[0], obj_type):
raise TypeError("{} is not a {}".format(args[0], obj_type))
return func(*args, **kwargs)
return wrapper
return real_decorator<|fim_prefix|># repo: RockefellerArchiveCenter/rac_aspace path: /rac_aspace/decorators.py
... | code_fim | easy | {
"lang": "python",
"repo": "RockefellerArchiveCenter/rac_aspace",
"path": "/rac_aspace/decorators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RockefellerArchiveCenter/rac_aspace path: /rac_aspace/decorators.py
from functools import wraps
def check_type(obj_type):
<|fim_suffix|> if not isinstance(args[0], obj_type):
raise TypeError("{} is not a {}".format(args[0], obj_type))
return func(*args, **... | code_fim | medium | {
"lang": "python",
"repo": "RockefellerArchiveCenter/rac_aspace",
"path": "/rac_aspace/decorators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _init_kw(self, **kw):
if kw.get('icons'):
icons = kw.get('icons')
def init_app(self, app, **kw):
self.app = app
self._init_kw(**kw)
app.jinja_env.globals.update(icon_html=icon_html)
def html_function(self, func):
ic... | code_fim | medium | {
"lang": "python",
"repo": "simonemmott/python-k2",
"path": "/k2/icons/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simonemmott/python-k2 path: /k2/icons/__init__.py
icons={}
def icon_html(name):
cls=icons.get(name.lower(), icons.get('UNKNOWN'))
return '<span aria-hidden="true" class="{cls}"></span>'.format(cls=cls)
class Icons(object):
<|fim_suffix|> if kw.get('icons'):
icons = kw... | code_fim | medium | {
"lang": "python",
"repo": "simonemmott/python-k2",
"path": "/k2/icons/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> icon_html = func
if self.app:
self.app.jinja_env.globals.update(icon_html=func)
def icons(self, i):
icons.update(i)<|fim_prefix|># repo: simonemmott/python-k2 path: /k2/icons/__init__.py
icons={}
def icon_html(name):
cls=icons.get(name.lower(), ic... | code_fim | hard | {
"lang": "python",
"repo": "simonemmott/python-k2",
"path": "/k2/icons/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create results dict
results = {
'filename': filename,
'freq': x,
'dBm': y,
'amp': yvolt,
'f0': p[1],
'kappa': kappa,
'Q': q,
'fig': grid,
'f0err': f0err,
'kappaerr': kappaerr,
'qerr': qerr
}
return re... | code_fim | hard | {
"lang": "python",
"repo": "calebjordan/Data-Analysis",
"path": "/ResonatorFit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig.line(x*1e-9,lorentz(x,*p))
grid = gridplot([[fig1, fig]], title=filename)
show(grid)
# Create results dict
results = {
'filename': filename,
'freq': x,
'dBm': y,
'amp': yvolt,
'f0': p[1],
'kappa': kappa,
'Q': q,
... | code_fim | hard | {
"lang": "python",
"repo": "calebjordan/Data-Analysis",
"path": "/ResonatorFit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: calebjordan/Data-Analysis path: /ResonatorFit.py
from scipy.constants import c
from scipy.optimize import curve_fit
from numpy import loadtxt, real, imag, pi, sqrt, diag, where
from bokeh.plotting import *
output_notebook()
def lorentz(x,*p):
# p = amp, f0, kappa
return (real(p[0]/(1-1j... | code_fim | medium | {
"lang": "python",
"repo": "calebjordan/Data-Analysis",
"path": "/ResonatorFit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: weaveworks/grafanalib path: /grafanalib/humio.py
"""Helpers to create Humio-specific Grafana queries."""
import attr
@attr.s
class HumioTarget(object):
"""
Generates Humio target JSON structure.
Link to Humio Grafana plugin https://grafana.com/grafana/plugins/humio-datasource/
<|... | code_fim | medium | {
"lang": "python",
"repo": "weaveworks/grafanalib",
"path": "/grafanalib/humio.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> humioQuery = attr.ib(default="")
humioRepository = attr.ib(default="")
refId = attr.ib(default="")
def to_json_data(self):
return {
"humioQuery": self.humioQuery,
"humioRepository": self.humioRepository,
"refId": self.refId
}<|fim_prefi... | code_fim | medium | {
"lang": "python",
"repo": "weaveworks/grafanalib",
"path": "/grafanalib/humio.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.id2token = self.special_tokens + [token for token, count in self.counter.most_common(max_size)]
self.token2id = dict([(token, i) for i, token in enumerate(self.id2token)])
def load_pretrained_embeddings(self, embedding_path):
"""
loads the pretrained embeddings fr... | code_fim | hard | {
"lang": "python",
"repo": "DeepDarkOdyssey/TextClassification",
"path": "/tensorflow-version/vocab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_tokens(self, tokens=[]):
self.counter.update(tokens)
def update_vocab(self):
self.id2token = self.special_tokens + [token for token, count in self.counter.most_common()]
self.token2id = dict([(token, i) for i, token in enumerate(self.id2token)])
@property
... | code_fim | hard | {
"lang": "python",
"repo": "DeepDarkOdyssey/TextClassification",
"path": "/tensorflow-version/vocab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeepDarkOdyssey/TextClassification path: /tensorflow-version/vocab.py
"""
This module implements a Vocab class for converting token to id and back
"""
from collections import Counter
import numpy as np
class Vocab(object):
def __init__(self, fins=[], sep=None, use_special_token=True, unk_t... | code_fim | hard | {
"lang": "python",
"repo": "DeepDarkOdyssey/TextClassification",
"path": "/tensorflow-version/vocab.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: usc-psychsim/atomic path: /atomic/analytic/rutgers_wrapper.py
from atomic.analytic.acwrapper import ACWrapper
import json
import pandas as pd
import numpy as np
class BeliefDiffWrapper(ACWrapper):
def __init__(self, agent_name, world=None, **kwargs):
super().__init__(agent_name, wor... | code_fim | hard | {
"lang": "python",
"repo": "usc-psychsim/atomic",
"path": "/atomic/analytic/rutgers_wrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_data = []
if data['wait_time'][-1] != float('Infinity'):
# For now, wait until the threat has been resolved before storing data
new_data.append({'Player': data['threat_activation_player'][-1].split('_')[0].capitalize(),
'Timestamp':... | code_fim | hard | {
"lang": "python",
"repo": "usc-psychsim/atomic",
"path": "/atomic/analytic/rutgers_wrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
num: (int) The number to convert based on fizzbuzz rules.
"""
if ((num%3 == 0) and (num%5 == 0)):
print("fizzbuzz")
elif num%3 == 0:
print("fizz")
elif num%5 == 0:
print("buzz")
else:
print(num)
for this in range(1, 100):
fi... | code_fim | medium | {
"lang": "python",
"repo": "lilliansun/cssi_2018_intro",
"path": "/python/python-testing/fizzbuzz.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lilliansun/cssi_2018_intro path: /python/python-testing/fizzbuzz.py
"""my implementation of fizzbuzz"""
def fizz_buzz(num):
"""Prints different words for certain natural numbers
<|fim_suffix|> if ((num%3 == 0) and (num%5 == 0)):
print("fizzbuzz")
elif num%3 == 0:
print... | code_fim | hard | {
"lang": "python",
"repo": "lilliansun/cssi_2018_intro",
"path": "/python/python-testing/fizzbuzz.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Peng-YM/pymoo path: /pymoo/usage/algorithms/usage_rnsga2.py
import numpy as np
from pymoo.algorithms.rnsga2 import RNSGA2
from pymoo.factory import get_problem
from pymoo.optimize import minimize
from pymoo.visualization.scatter import Scatter
problem = get_problem("zdt1", n_var=30)
pf = proble... | code_fim | hard | {
"lang": "python",
"repo": "Peng-YM/pymoo",
"path": "/pymoo/usage/algorithms/usage_rnsga2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Scatter().add(pf, label="pf").add(res.F, label="F").add(ref_points, label="ref_points").show()<|fim_prefix|># repo: Peng-YM/pymoo path: /pymoo/usage/algorithms/usage_rnsga2.py
import numpy as np
from pymoo.algorithms.rnsga2 import RNSGA2
from pymoo.factory import get_problem
from pymoo.optimize import m... | code_fim | hard | {
"lang": "python",
"repo": "Peng-YM/pymoo",
"path": "/pymoo/usage/algorithms/usage_rnsga2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Write a function to take in a dataset of (unnormalized)states, (unnormalized)actions, (unnormalized)next_states and
fit the dynamics model going from normalized states, normalized actions to normalized state differences (s_t+1 - s_t)
"""
#paths=data
obs... | code_fim | hard | {
"lang": "python",
"repo": "vamshikumarkurva/DeepReinforcementLearning",
"path": "/4_ModelBasedRL_OptimalControllers/dynamics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vamshikumarkurva/DeepReinforcementLearning path: /4_ModelBasedRL_OptimalControllers/dynamics.py
import tensorflow as tf
import numpy as np
# Predefined function to build a feedforward neural network
def build_mlp(input_placeholder,
output_size,
scope,
... | code_fim | hard | {
"lang": "python",
"repo": "vamshikumarkurva/DeepReinforcementLearning",
"path": "/4_ModelBasedRL_OptimalControllers/dynamics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>View.as_view, name='profile_page'),
path('add_comment', AddCommentView.as_view, name='add_comment'),
path('all_comments', views.show_comments, name='all_comments'),
path('login/', view.LoginView.as_view(), name='login'),
path('logout/', view.LogoutView.as_view(), name='logout'),
p... | code_fim | medium | {
"lang": "python",
"repo": "TonikX/ITMO_ICT_WebProgramming_2020",
"path": "/students/k3343/laboratory_works/Artamonova_Valeriya/laboratory_work_1/hometask/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TonikX/ITMO_ICT_WebProgramming_2020 path: /students/k3343/laboratory_works/Artamonova_Valeriya/laboratory_work_1/hometask/urls.py
from urllib import request
from django.urls import path
from django.contrib.auth import views as view
from . import views
from .views import StudentRegistrationV... | code_fim | medium | {
"lang": "python",
"repo": "TonikX/ITMO_ICT_WebProgramming_2020",
"path": "/students/k3343/laboratory_works/Artamonova_Valeriya/laboratory_work_1/hometask/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ogin/', view.LoginView.as_view(), name='login'),
path('logout/', view.LogoutView.as_view(), name='logout'),
path('register', RegisterUserView.as_view(), name='register_page'),
]<|fim_prefix|># repo: TonikX/ITMO_ICT_WebProgramming_2020 path: /students/k3343/laboratory_works/Artamonova_Valeriya/... | code_fim | medium | {
"lang": "python",
"repo": "TonikX/ITMO_ICT_WebProgramming_2020",
"path": "/students/k3343/laboratory_works/Artamonova_Valeriya/laboratory_work_1/hometask/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Adds parametric_hook, sets __call__ to call_parametrized."""
if parametric_hook is None: return
self.parametric_hook = parametric_hook
insert_as_static_method( self.__class__, '__call__',
self.call_parametrized )<|fim_prefix|># r... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/sfepy/applications/application.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> generator = self.parametric_hook( self.problem )
for aux in generator:
if isinstance( aux, tuple ) and (len( aux ) == 2):
problem, container = aux
mode = 'coroutine'
else:
problem = aux
mode = 'simple'
... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/sfepy/applications/application.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: certik/sfepy path: /sfepy/applications/application.py
from sfepy.base.base import Struct, insert_as_static_method, default_printer, \
pause, debug
class Application( Struct ):
"""Base class for applications.
Subclasses should implement: __init__(), call().
Automates parametric... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/sfepy/applications/application.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gunplar/krp_localization path: /src/rssi_localization_server
#!/usr/bin/env python
from __future__ import print_function
import sys
import numpy as np
import time
import copy
import rospy
import pickle
import rospkg
import traceback
#ros messages
from std_msgs.msg import Float64MultiArray
from ... | code_fim | hard | {
"lang": "python",
"repo": "gunplar/krp_localization",
"path": "/src/rssi_localization_server",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> samples.append(best_pose)
for i in range(nsamples - 1):
samples.append([best_pose[0] + samplingX[i], best_pose[1] + samplingY[i]])
samples = np.asarray(samples)
weights = self.model.jointpdf(samples, rssi_data.data['Y'], ... | code_fim | hard | {
"lang": "python",
"repo": "gunplar/krp_localization",
"path": "/src/rssi_localization_server",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.type = "Input"
self.size = size<|fim_prefix|># repo: awlange/brainsparks path: /src/sandbox/input.py
from src.sandbox.layer import Layer
<|fim_middle|>
class Input(Layer):
def __init__(self, size=0):
| code_fim | easy | {
"lang": "python",
"repo": "awlange/brainsparks",
"path": "/src/sandbox/input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awlange/brainsparks path: /src/sandbox/input.py
from src.sandbox.layer import Layer
class Input(Layer):
<|fim_suffix|> super().__init__()
self.type = "Input"
self.size = size<|fim_middle|> def __init__(self, size=0):
| code_fim | easy | {
"lang": "python",
"repo": "awlange/brainsparks",
"path": "/src/sandbox/input.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, size=0):
super().__init__()
self.type = "Input"
self.size = size<|fim_prefix|># repo: awlange/brainsparks path: /src/sandbox/input.py
from src.sandbox.layer import Layer
<|fim_middle|>class Input(Layer):
| code_fim | easy | {
"lang": "python",
"repo": "awlange/brainsparks",
"path": "/src/sandbox/input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fakegit/groupsome path: /messengerext/bot/admin.py
from django.contrib import admin
from bot.models import TelegramLogEntry, TelegramUser
# Regi<|fim_suffix|>gramLogEntry)
admin.site.register(TelegramUser)<|fim_middle|>ster your models here.
admin.site.register(Tele | code_fim | easy | {
"lang": "python",
"repo": "fakegit/groupsome",
"path": "/messengerext/bot/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ster your models here.
admin.site.register(TelegramLogEntry)
admin.site.register(TelegramUser)<|fim_prefix|># repo: fakegit/groupsome path: /messengerext/bot/admin.py
from django.contrib import admin
from bot.model<|fim_middle|>s import TelegramLogEntry, TelegramUser
# Regi | code_fim | easy | {
"lang": "python",
"repo": "fakegit/groupsome",
"path": "/messengerext/bot/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gramLogEntry)
admin.site.register(TelegramUser)<|fim_prefix|># repo: fakegit/groupsome path: /messengerext/bot/admin.py
from django.contrib import admin
from bot.model<|fim_middle|>s import TelegramLogEntry, TelegramUser
# Register your models here.
admin.site.register(Tele | code_fim | medium | {
"lang": "python",
"repo": "fakegit/groupsome",
"path": "/messengerext/bot/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Efreak/dosage path: /dosagelib/plugins/katbox.py
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
im... | code_fim | hard | {
"lang": "python",
"repo": "Efreak/dosage",
"path": "/dosagelib/plugins/katbox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@classmethod
def getmodules(cls):
return (
cls('Draconia', 'razorfox', None, 'chapter-1-page-1', adult=True),
cls('Eorah', 'hiorou', 'eorah', 'eorah-title'),
cls('EtherealWorlds', 'sahtori', 'oasis', '1-nightly-wanderings'),
cls('FalseStart'... | code_fim | hard | {
"lang": "python",
"repo": "Efreak/dosage",
"path": "/dosagelib/plugins/katbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ['tensorflow>=2.0.0'],
'tf_gpu': ['tensorflow-gpu>=2.0.0'],
},
install_requires=[
'gym',
'numpy',
'pandas',
'cloudpickle',
])<|fim_prefix|># repo: lccasagrande/SimpleRL path: /setup.py
from setuptools import setup
setup(name='simplerl... | code_fim | medium | {
"lang": "python",
"repo": "lccasagrande/SimpleRL",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lccasagrande/SimpleRL path: /setup.py
from setuptools import setup
setup(name='simplerl',
author='lccasagrande',
license="MIT",
version='0.1',
python_requires='>=3.7',
extras_require={
'tf':<|fim_suffix|>uires=[
'gym',
'numpy',
... | code_fim | medium | {
"lang": "python",
"repo": "lccasagrande/SimpleRL",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
conjugates the verb
Input=tense, verb in infinitive form, the adverb and subject
Output=the verb conjugated
"""
#If there is no tense => we use the prese... | code_fim | hard | {
"lang": "python",
"repo": "severin-lemaignan/dialogs",
"path": "/src/dialogs/verbalization/element_rebuilding.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: severin-lemaignan/dialogs path: /src/dialogs/verbalization/element_rebuilding.py
ilding
from . import other_functions
def nom_struc_rebuilding(nom_struc):
"""
This function recovers nominal structure
Input=class nominal structure ... | code_fim | hard | {
"lang": "python",
"repo": "severin-lemaignan/dialogs",
"path": "/src/dialogs/verbalization/element_rebuilding.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Negative case : we have to use do or have or be or modal if there is no
elif state == VerbalGroup.negative:
if vrb[0] == 'be' or vrb[0] == 'do' or vrb[0] == 'have':
return [vrb_condjugated[0]] + ['not'] + adv + vrb_condjugated[1:]
if tense != 'present simple' and tens... | code_fim | hard | {
"lang": "python",
"repo": "severin-lemaignan/dialogs",
"path": "/src/dialogs/verbalization/element_rebuilding.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CommanderPho/pyPhoPlaceCellAnalysis path: /src/pyphoplacecellanalysis/External/breeze_style_sheets/example/slider.py
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2022-Present> <Alex Huszagh>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# o... | code_fim | hard | {
"lang": "python",
"repo": "CommanderPho/pyPhoPlaceCellAnalysis",
"path": "/src/pyphoplacecellanalysis/External/breeze_style_sheets/example/slider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> options.subControls = compat.SC_SliderHandle
painter.drawComplexControl(compat.CC_Slider, options)
class Ui:
'''Main class for the user interface.'''
def setup(self, MainWindow):
MainWindow.setObjectName('MainWindow')
MainWindow.resize(1068, 824)
self.cen... | code_fim | hard | {
"lang": "python",
"repo": "CommanderPho/pyPhoPlaceCellAnalysis",
"path": "/src/pyphoplacecellanalysis/External/breeze_style_sheets/example/slider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
'DriveDriveOperations',
'DriveOperations',
'DriveActivityOperations',
'DriveActivityListItemOperations',
'DriveActivityListItemVersionOperations',
'DriveListOperations',
'DriveListActivityOperations',
'DriveListActivityListItemOperations',
'DriveListActivity... | code_fim | hard | {
"lang": "python",
"repo": "ezkemboi/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/files_beta/azext_files_beta/vendored_sdks/files/operations/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ezkemboi/msgraph-cli path: /msgraph-cli-extensions/beta/files_beta/azext_files_beta/vendored_sdks/files/operations/__init__.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under t... | code_fim | hard | {
"lang": "python",
"repo": "ezkemboi/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/files_beta/azext_files_beta/vendored_sdks/files/operations/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kgaughan/aoc path: /2017/day10/test_knot.py
#!/usr/bin/env python3
import unittest
import knot
class KnotTest(unittest.TestCase):
<|fim_suffix|> def test_hash(self):
fixtures = {
'': 'a2582a3a0e66e6e86e3812dcb672a272',
'AoC 2017': '33efeb34ea91902bb2f59c9920... | code_fim | hard | {
"lang": "python",
"repo": "kgaughan/aoc",
"path": "/2017/day10/test_knot.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> fixtures = {
'': 'a2582a3a0e66e6e86e3812dcb672a272',
'AoC 2017': '33efeb34ea91902bb2f59c9920caa6cd',
'1,2,3': '3efbe78a8d82f29979031a4aa0b16a9d',
'1,2,4': '63960835bcdc130f0b66d7ff4f6a5a8e',
}
for src, expected in fixtures.items():
... | code_fim | hard | {
"lang": "python",
"repo": "kgaughan/aoc",
"path": "/2017/day10/test_knot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gespejo/foward_bot path: /src/foward_bot/fowarder/utils.py
# coding=utf-8
from __future__ import unicode_literals
from telegram.ext import BaseFilter
from telegram.ext import RegexHandler
from foward_bot.telegram_API import models
from foward_bot.utils.helpers import get_or_none
from foward_bot... | code_fim | hard | {
"lang": "python",
"repo": "gespejo/foward_bot",
"path": "/src/foward_bot/fowarder/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ForwardMessageFilters(CustomFilters):
class _TextForwardings(BaseFilter):
def filter(self, message):
forwardings = AutoForward.objects.filter(forwarder__id=message.chat.id, enabled=True)
return len(forwardings) > 0 and (message.text and not message.text.startsw... | code_fim | hard | {
"lang": "python",
"repo": "gespejo/foward_bot",
"path": "/src/foward_bot/fowarder/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># valid network names:
# NN_11
# NN_17
# ResNet18
# ResNet34
# ResNet50
# ResNet101
# ResNet152
if __name__ == "__main__":
set_start_method('spawn')
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# common system sizes are 3,5,7 and... | code_fim | hard | {
"lang": "python",
"repo": "Lindeby/toric-RL-decoder",
"path": "/old/start_distributed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lindeby/toric-RL-decoder path: /old/start_distributed.py
from copy import deepcopy
from src.Distributed import Distributed
#from gym_ToricCode import gym_ToricCode
import gym, torch
import gym_ToricCode
from torch.multiprocessing import set_start_method
import torchvision.models as models
<|fim... | code_fim | hard | {
"lang": "python",
"repo": "Lindeby/toric-RL-decoder",
"path": "/old/start_distributed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while(True):
f, c = None, None
try:
c = int(input("> "))
except ValueError:
print("That doesn't look like a valid entry")
if c is not None:
try:
f = interface[list(interface.keys())[c]]
except IndexError:
print("That looks like it's o... | code_fim | hard | {
"lang": "python",
"repo": "ehennenfent/redteam_dot_py",
"path": "/redteam.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ehennenfent/redteam_dot_py path: /redteam.py
from collections import OrderedDict
from tasks import MonitorTask
import concurrent.futures
import glob
import importlib.util
import pprint as pp
header = """
_________________________________________
_ _
___ ___ _| | |_ ___ ___ _____ __... | code_fim | hard | {
"lang": "python",
"repo": "ehennenfent/redteam_dot_py",
"path": "/redteam.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guoshzhao/superbenchmark path: /superbench/benchmarks/micro_benchmarks/cuda_nccl_bw_performance.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""Module of the NCCL/RCCL performance benchmarks.
We assume NCCL-tests and RCCL-tests have the same interface and output i... | code_fim | hard | {
"lang": "python",
"repo": "guoshzhao/superbenchmark",
"path": "/superbench/benchmarks/micro_benchmarks/cuda_nccl_bw_performance.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._result.add_raw_data() and self._result.add_result() need to be called to save the results.
Args:
cmd_idx (int): the index of command corresponding with the raw_output.
raw_output (str): raw output string of the micro-benchmark.
Return:
... | code_fim | hard | {
"lang": "python",
"repo": "guoshzhao/superbenchmark",
"path": "/superbench/benchmarks/micro_benchmarks/cuda_nccl_bw_performance.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uc-cdis/userdatamodel path: /userdatamodel/models.py
from .user import (
User,
GoogleProxyGroup,
Project,
Group,
UserToGroup,
<|fim_suffix|>er,
S3Credential,
HMACKeyPair,
HMACKeyPairArchive,
ProjectToBucket,
Tag,
)<|fim_middle|> AccessPrivilege,
Iden... | code_fim | medium | {
"lang": "python",
"repo": "uc-cdis/userdatamodel",
"path": "/userdatamodel/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
StorageAccess,
Bucket,
ComputeAccess,
UserToBucket,
AuthorizationProvider,
S3Credential,
HMACKeyPair,
HMACKeyPairArchive,
ProjectToBucket,
Tag,
)<|fim_prefix|># repo: uc-cdis/userdatamodel path: /userdatamodel/models.py
from .user import (
User,
GooglePro... | code_fim | medium | {
"lang": "python",
"repo": "uc-cdis/userdatamodel",
"path": "/userdatamodel/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _default_driver_dir = os.path.join(
_driver_dir,
'chromedriver.exe'
)
if sys.platform.startswith('linux'):
_default_driver_dir = \
'/opt/google/chrome/chromedriver'
if os.path.exists(_default_driver_dir):
_dr... | code_fim | hard | {
"lang": "python",
"repo": "mombakkes/uiXautomation",
"path": "/src/main/python/taf/foundation/plugins/web/selenium/browser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mombakkes/uiXautomation path: /src/main/python/taf/foundation/plugins/web/selenium/browser.py
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "mombakkes/uiXautomation",
"path": "/src/main/python/taf/foundation/plugins/web/selenium/browser.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Inzamam93/gym path: /gym/envs/toy_text/frozenlake without env render.py
import gym
import numpy as np
import random
import time
from IPython.display import clear_output
from gym.envs.registration import register
register(
id='FrozenLakeNotSlippery-v0',
entry_point='gym.envs.toy_... | code_fim | hard | {
"lang": "python",
"repo": "Inzamam93/gym",
"path": "/gym/envs/toy_text/frozenlake without env render.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rewards_all_episodes.append(rewards_current_episode)
env.close()
# Print updated Q-table
print("\n\n********Q-table********\n")
print(" Left Down Right Up\n")
print(q_table)
print("Number of times reached goal =",goal_reached)
print("Number of holes encountered =",hole... | code_fim | hard | {
"lang": "python",
"repo": "Inzamam93/gym",
"path": "/gym/envs/toy_text/frozenlake without env render.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/onnxruntime path: /tools/python/util/android/__init__.py
# Copyright (c) Microsoft Corporation. All rights reserved.
<|fim_suffix|> noqa: F401
SdkToolPaths,
create_virtual_device,
get_sdk_tool_paths,
start_emulator,
stop_emulator,
)<|fim_middle|># Licensed under the ... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/onnxruntime",
"path": "/tools/python/util/android/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> get_sdk_tool_paths,
start_emulator,
stop_emulator,
)<|fim_prefix|># repo: microsoft/onnxruntime path: /tools/python/util/android/__init__.py
# Copyright (c) Microsoft Corporation. All rights reserved.
<|fim_middle|># Licensed under the MIT License.
from .android import ( # noqa: F401
SdkTo... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/onnxruntime",
"path": "/tools/python/util/android/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VB6Hobbyst7/OpenGL-Python path: /zero/drivers/__init__.py
from __future__ import absolute_import, division, print_function
from .opengl import (OpenGLBuffer,
OpenGLTexture,
OpenGLShader,
OpenGLRender)
<|fim_suffix|>from .display ... | code_fim | easy | {
"lang": "python",
"repo": "VB6Hobbyst7/OpenGL-Python",
"path": "/zero/drivers/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .devices import PygameDevice
from .display import PygameDisplay<|fim_prefix|># repo: VB6Hobbyst7/OpenGL-Python path: /zero/drivers/__init__.py
from __future__ import absolute_import, division, print_function
<|fim_middle|>from .opengl import (OpenGLBuffer,
OpenGLTexture,
... | code_fim | hard | {
"lang": "python",
"repo": "VB6Hobbyst7/OpenGL-Python",
"path": "/zero/drivers/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .display import PygameDisplay<|fim_prefix|># repo: VB6Hobbyst7/OpenGL-Python path: /zero/drivers/__init__.py
from __future__ import absolute_import, division, print_function
from .opengl import (OpenGLBuffer,
OpenGLTexture,
OpenGLShader,
... | code_fim | easy | {
"lang": "python",
"repo": "VB6Hobbyst7/OpenGL-Python",
"path": "/zero/drivers/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>o[i + 1] = nums[i]
return one == sorted(one) or two == sorted(two)
return True<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0665-Non-Decreasing-Array/soln.py
class Solution:
def checkPossibility(self, nums):
"""
:type nums: List[int]
... | code_fim | hard | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/0665-Non-Decreasing-Array/soln.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0665-Non-Decreasing-Array/soln.py
class Solution:
def checkPossibility(self, nums):
"""
:type nums: List[int]
<|fim_suffix|>o[i + 1] = nums[i]
return one == sorted(one) or two == sorted(two)
return True<|... | code_fim | hard | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/0665-Non-Decreasing-Array/soln.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leeping/forcebalance path: /src/legacy/unit/quantity.py
u
might want to make new dimensions for, say, "currency" or
"information".
Some features of this implementation:
* Quantities are a combination of a value and a unit. The value
part can be any python type, including numbers, lists, n... | code_fim | hard | {
"lang": "python",
"repo": "leeping/forcebalance",
"path": "/src/legacy/unit/quantity.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
####################################
### Sequence methods of Quantity ###
### in case value is a sequence ###
####################################
def __len__(self):
"""
Return size of internal value type.
"""
return len(self._value)
def __getite... | code_fim | hard | {
"lang": "python",
"repo": "leeping/forcebalance",
"path": "/src/legacy/unit/quantity.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leeping/forcebalance path: /src/legacy/unit/quantity.py
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABIL... | code_fim | hard | {
"lang": "python",
"repo": "leeping/forcebalance",
"path": "/src/legacy/unit/quantity.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>inal.copy()
mixture[corners > corners.max() * 0.01] = [0, 0, 255]
cv.imshow('Mixture', mixture)
cv.waitKey()<|fim_prefix|># repo: wan230114/PythonNote path: /docs/02.AI_ML/code-1805/Day07all/harris.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import cv2 as cv
original = cv.imread('.... | code_fim | hard | {
"lang": "python",
"repo": "wan230114/PythonNote",
"path": "/docs/02.AI_ML/code-1805/Day07all/harris.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wan230114/PythonNote path: /docs/02.AI_ML/code-1805/Day07all/harris.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import cv2 as cv
original = cv.imread('../.<|fim_suffix|>inal.copy()
mixture[corners > corners.max() * 0.01] = [0, 0, 255]
cv.imshow('Mixture', mixture)
cv.waitKe... | code_fim | hard | {
"lang": "python",
"repo": "wan230114/PythonNote",
"path": "/docs/02.AI_ML/code-1805/Day07all/harris.py",
"mode": "psm",
"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.