text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> def get_move(self):
self.engine.stdin.write("go\n")
bestmove = self._poll_until("bestmove", 30)[-1]
move = bestmove.split()[1]
return move[:2] + "-" + move[2:]
def make_move(self, move):
parsedmove = parse_move(move, self.turn)
self.allmoves += " " ... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/manual/chess/components/UCIChessEngine.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_denature.py
#calss header
class _DENATURE():
def __init__(self,):
self.name = "DENATURE"
self.definitions = [u'to change the characteristics of a substance, for example by the action of heat or an acid']
<|fim_suffix|> def run(self, obj1 = []... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_denature.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.inputBox = QtWidgets.QLineEdit(window)
self.inputBox.setStyleSheet(inputCSS)
self.inputBox.setPlaceholderText("Enter Name here")
self.inputBox.resize(300, 30)
self.inputBox.move(100, 120)
AddButton = QtWidgets.QPushButton(window)
AddButton.setStyleSheet(inputCSS)
AddButton.setText("A... | code_fim | hard | {
"lang": "python",
"repo": "datmemerboi/Qt-Shopping-Cart",
"path": "/windowcontents.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datmemerboi/Qt-Shopping-Cart path: /windowcontents.py
from PyQt5 import QtWidgets
from pymongo import MongoClient
class ShoppingWindow(object):
def ShoppingWindowFn(self, window):
window.setWindowTitle("Shopping Window")
welcomeMsg = QtWidgets.QMessageBox()
welcomeMsg.setText("Welcome ... | code_fim | hard | {
"lang": "python",
"repo": "datmemerboi/Qt-Shopping-Cart",
"path": "/windowcontents.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(AssertionError):
assert 1 == 2
# Example class based testing. Useful if you have some data
# to generate first which you can store as a class variable
# instead of regenerating it for each function
class TestClass(object):
def __init__(self):
self.something = 1... | code_fim | medium | {
"lang": "python",
"repo": "chandramurugeshan/WorkshopExample",
"path": "/tests/test_examples.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chandramurugeshan/WorkshopExample path: /tests/test_examples.py
from some_module import add_stuff
import pytest
# Basic test functions are fun
def test_assertion_example():
<|fim_suffix|>def test_expected_error_example():
with pytest.raises(AssertionError):
assert 1 == 2
# Example... | code_fim | medium | {
"lang": "python",
"repo": "chandramurugeshan/WorkshopExample",
"path": "/tests/test_examples.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_dict(self):
return {c.name: getattr(self, c.name, None) for c in self.__table__.columns}
class ServiceDependencyGraph(Base):
__tablename__ = 'service_dependency_graph'
id = Column(Integer, primary_key=True)
fault_id = Column(Integer)
graph_json = Column(Text)
create... | code_fim | hard | {
"lang": "python",
"repo": "OS-ABC/AIOsp-Fault-Diagnosis",
"path": "/bean/save_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OS-ABC/AIOsp-Fault-Diagnosis path: /bean/save_model.py
from sqlalchemy import Column, Integer, Text, DateTime, Date, String,text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class FaultService(Base):
__tablename__ = 'fault_service'
id = Column(Integ... | code_fim | hard | {
"lang": "python",
"repo": "OS-ABC/AIOsp-Fault-Diagnosis",
"path": "/bean/save_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olujedai/esusu path: /esusu/api/handlers.py
import arrow
from .models.collection_schedule import CollectionSchedule
def get_new_tentative_end_date(date):
<|fim_suffix|> """signal intercept for user_joined_society"""
user = params['user']
newest_tenure = user.society.tenures.order_by... | code_fim | medium | {
"lang": "python",
"repo": "olujedai/esusu",
"path": "/esusu/api/handlers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def user_joined_society_handler(sender, **params):
"""signal intercept for user_joined_society"""
user = params['user']
newest_tenure = user.society.tenures.order_by('-start_date').first()
if newest_tenure:
if newest_tenure.is_active() or newest_tenure.starts_soon():
la... | code_fim | medium | {
"lang": "python",
"repo": "olujedai/esusu",
"path": "/esusu/api/handlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> __hash__ = BaseItem.__hash__
def keys(self):
return self._values.keys()
def __repr__(self):
return pformat(dict(self))
def copy(self):
return self.__class__(self)<|fim_prefix|># repo: firefeifei/CodePool path: /fzutils/fzutils/items.py
# coding:utf-8
from scrap... | code_fim | medium | {
"lang": "python",
"repo": "firefeifei/CodePool",
"path": "/fzutils/fzutils/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return len(self._values)
def __iter__(self):
return iter(self._values)
__hash__ = BaseItem.__hash__
def keys(self):
return self._values.keys()
def __repr__(self):
return pformat(dict(self))
def copy(self):
return self.... | code_fim | hard | {
"lang": "python",
"repo": "firefeifei/CodePool",
"path": "/fzutils/fzutils/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: firefeifei/CodePool path: /fzutils/fzutils/items.py
# coding:utf-8
from scrapy.item import Item
from scrapy import Field # 只能通过x['aa']或者x.get('aa')访问, x.aa无法访问, 除非重写__getattribute__()
from pprint import pformat
from collections import MutableMapping
import six
from scrapy.utils.trackref impor... | code_fim | hard | {
"lang": "python",
"repo": "firefeifei/CodePool",
"path": "/fzutils/fzutils/items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chia-Network/chia-blockchain path: /chia/types/spend_bundle_conditions.py
from __future__ import annotations
<|fim_suffix|>__all__ = ["Spend", "SpendBundleConditions", "ELIGIBLE_FOR_DEDUP"]<|fim_middle|>from chia_rs import ELIGIBLE_FOR_DEDUP, Spend, SpendBundleConditions
| code_fim | medium | {
"lang": "python",
"repo": "Chia-Network/chia-blockchain",
"path": "/chia/types/spend_bundle_conditions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ["Spend", "SpendBundleConditions", "ELIGIBLE_FOR_DEDUP"]<|fim_prefix|># repo: Chia-Network/chia-blockchain path: /chia/types/spend_bundle_conditions.py
from __future__ import annotations
<|fim_middle|>from chia_rs import ELIGIBLE_FOR_DEDUP, Spend, SpendBundleConditions
| code_fim | medium | {
"lang": "python",
"repo": "Chia-Network/chia-blockchain",
"path": "/chia/types/spend_bundle_conditions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jerrylovepizza/amazing-python path: /Study/interesting_program/binary_search.py
"""
Copyright: Copyright (c) 2019
License : WTFPL License
owner : pynickle
title : amazing-python study projects
description : projects for studying python
"""
import time
def time_c(func):
def wrapper(*args, *... | code_fim | hard | {
"lang": "python",
"repo": "jerrylovepizza/amazing-python",
"path": "/Study/interesting_program/binary_search.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> return wrapper
def binary_search(lst, data):
n = len(lst)
first = 0
last = n - 1
while first <= last:
mid = (last + first) // 2
if lst[mid] > data:
last = mid - 1
elif lst[mid] < data:
first = mid + 1
else:
return mi... | code_fim | hard | {
"lang": "python",
"repo": "jerrylovepizza/amazing-python",
"path": "/Study/interesting_program/binary_search.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adampziegler/Archipelago path: /worlds/factorio/__init__.py
_table, advancement_technologies, \
all_ingredient_names, all_product_sources, required_technologies, get_rocket_requirements, rocket_recipes, \
progressive_technology_table, common_tech_table, tech_to_progressive_lookup, progres... | code_fim | hard | {
"lang": "python",
"repo": "adampziegler/Archipelago",
"path": "/worlds/factorio/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adampziegler/Archipelago path: /worlds/factorio/__init__.py
..AutoWorld import World
from BaseClasses import Region, Entrance, Location, Item
from .Technologies import base_tech_table, recipe_sources, base_technology_table, advancement_technologies, \
all_ingredient_names, all_product_sourc... | code_fim | hard | {
"lang": "python",
"repo": "adampziegler/Archipelago",
"path": "/worlds/factorio/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Recipe(original.name, original.category, new_ingredients, original.products, original.energy)
def set_custom_technologies(self):
custom_technologies = {}
allowed_packs = self.world.max_science_pack[self.player].get_allowed_packs()
for technology_name, technology... | code_fim | hard | {
"lang": "python",
"repo": "adampziegler/Archipelago",
"path": "/worlds/factorio/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def argmax(tensor):
"""The argument of the max value in a tensor.
Parameters
----------
tensor : tensor
Returns
-------
scalar
"""
raise NotImplementedError
@staticmethod
def argmin(tensor):
""... | code_fim | hard | {
"lang": "python",
"repo": "tensorly/tensorly",
"path": "/tensorly/backend/core.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorly/tensorly path: /tensorly/backend/core.py
icating whether any value is non-zero
otherwise, returns a tensor of bools.
"""
return tensor.any(axis=axis, keepdims=keepdims, **kwargs)
@staticmethod
def maximum(x1, x2, *args, **kwargs):
"""Element-w... | code_fim | hard | {
"lang": "python",
"repo": "tensorly/tensorly",
"path": "/tensorly/backend/core.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorly/tensorly path: /tensorly/backend/core.py
mpty tensors provided must have the
same shape, except along the specified axis.
axis : int, optional
The axis to concatenate on. Default is 0.
Returns
-------
tensor
"""
rai... | code_fim | hard | {
"lang": "python",
"repo": "tensorly/tensorly",
"path": "/tensorly/backend/core.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _previous(self, coord):
"""Returns the prior element in a given line, if no prior element, returns None"""
candidates = [(coord[0] - 1, coord[1]), (coord[0] + 1, coord[1]), (coord[0], coord[1] - 1), (coord[0], coord[1] + 1)]
for candidate in (x for x in candidates if 0 <= x... | code_fim | hard | {
"lang": "python",
"repo": "james-willis/flow-free-ai",
"path": "/game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: james-willis/flow-free-ai path: /game.py
"""Represents a game of Flow Free.
This module is designed to represent an instance of the game Flow Free, Flow Free is a mobile game
created by Big Duck Games, and is available on iOS and Android devices. This modules attempts to
replicate the behavior o... | code_fim | hard | {
"lang": "python",
"repo": "james-willis/flow-free-ai",
"path": "/game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ouldevloper/Pattern-generate path: /pattern.py
import argparse
import os
import sys
import math
import re
class Pattern:
def __init__(self):
self.args = self.parse_command_line()
def parse_command_line(self):
my_parser = argparse.ArgumentParser(description='Generate patten... | code_fim | hard | {
"lang": "python",
"repo": "ouldevloper/Pattern-generate",
"path": "/pattern.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> addr = addr[2:] if addr.startswith('0x') else addr
addr = addr if len(addr)%2==0 else "0"+addr
pattern_set = ""
pattern = self.generate_pattern()
for x in range(0,len(addr)-1,2):
pattern_set += chr(int("0x"+addr[x:x+2],16))
return pattern.index(p... | code_fim | hard | {
"lang": "python",
"repo": "ouldevloper/Pattern-generate",
"path": "/pattern.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = self.args.parse_args()
if(args.lenght==None and args.offset==None):
self.args.print_help()
elif args.lenght!=None:
print(self.generate_pattern(args.lenght))
elif args.offset!=None:
print(f"Lenght of offset is : {self.get_offset_fr... | code_fim | hard | {
"lang": "python",
"repo": "ouldevloper/Pattern-generate",
"path": "/pattern.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shamanDevel/cuMat path: /benchmarks/batched_reduction/MakePlotsLinear.py
import sys
import os
import json
import matplotlib.pyplot as plt
import math
import seaborn as sns
setPath = sys.argv[1]
setName = setPath[setPath.rfind('/')+1:]
<|fim_suffix|>size = results["Size"]
sets = ["Row", "Column"... | code_fim | medium | {
"lang": "python",
"repo": "shamanDevel/cuMat",
"path": "/benchmarks/batched_reduction/MakePlotsLinear.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>size = results["Size"]
sets = ["Row", "Column", "Batch"]
methods = ["CUB",
"Thread",
"Warp",
"Block64", "Block128", "Block256", "Block512",
"Device1", "Device2", "Device4", "Device8", "Device16", "Device32"]
xlabel = "2^N entries along reduced axis"
ylabel =... | code_fim | medium | {
"lang": "python",
"repo": "shamanDevel/cuMat",
"path": "/benchmarks/batched_reduction/MakePlotsLinear.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for set in sets:
# now create the plot
plt.figure(dpi=500)
for (i,m),col in zip(enumerate(methods), colors):
plt.plot(xdata, [vx[i+1] for vx in results[set]],
'-o', label=m, color=col)
plt.xscale(xscale)
plt.yscale(yscale)
plt.xlabel(xlabel)
plt.ylabel... | code_fim | hard | {
"lang": "python",
"repo": "shamanDevel/cuMat",
"path": "/benchmarks/batched_reduction/MakePlotsLinear.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chum4k3r/Verteste path: /verteste/model/__init__.py
# This Python file uses the following enc<|fim_suffix|>tsModel
from .linesmodel import LinesModel<|fim_middle|>oding: utf-8
from .projectsmodel import ProjectsModel
from .listsmodel import Lis | code_fim | medium | {
"lang": "python",
"repo": "Chum4k3r/Verteste",
"path": "/verteste/model/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chum4k3r/Verteste path: /verteste/model/__init__.py
# This Python file uses the following encoding: utf-8
from .projectsmodel import <|fim_suffix|>tsModel
from .linesmodel import LinesModel<|fim_middle|>ProjectsModel
from .listsmodel import Lis | code_fim | easy | {
"lang": "python",
"repo": "Chum4k3r/Verteste",
"path": "/verteste/model/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ProjectsModel
from .listsmodel import ListsModel
from .linesmodel import LinesModel<|fim_prefix|># repo: Chum4k3r/Verteste path: /verteste/model/__init__.py
# This Python file uses the following enc<|fim_middle|>oding: utf-8
from .projectsmodel import | code_fim | easy | {
"lang": "python",
"repo": "Chum4k3r/Verteste",
"path": "/verteste/model/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esabitova/aws-digito-artifacts-gameday path: /documents/docdb/alarm/recovery-cluster_replica_lag/2020-04-01/Tests/step_defs/test_docdb_recovery-cluster_replica_lag.py
# coding=utf-8
from pytest_bdd import (
scenario
)
<|fim_suffix|>
@scenario('../features/docdb_recovery-cluster_replica_lag.f... | code_fim | hard | {
"lang": "python",
"repo": "esabitova/aws-digito-artifacts-gameday",
"path": "/documents/docdb/alarm/recovery-cluster_replica_lag/2020-04-01/Tests/step_defs/test_docdb_recovery-cluster_replica_lag.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@scenario('../features/docdb_recovery-cluster_replica_lag.feature',
'To detect high values of DBClusterReplicaLagMaximum - red')
def test_docdb_recovery_cluster_replica_lag_alarm_red():
pass<|fim_prefix|># repo: esabitova/aws-digito-artifacts-gameday path: /documents/docdb/alarm/recovery-c... | code_fim | hard | {
"lang": "python",
"repo": "esabitova/aws-digito-artifacts-gameday",
"path": "/documents/docdb/alarm/recovery-cluster_replica_lag/2020-04-01/Tests/step_defs/test_docdb_recovery-cluster_replica_lag.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Get highlighted class history
class_sources = cb.get_class_history()
for source in class_sources:
highlighted_sources.append( highlight_source(source) )
internal_attrs = []
private_attrs = []
attrs = []
for attr in cb.get_attrs():
if str(attr[0]).startswith("... | code_fim | hard | {
"lang": "python",
"repo": "johnthedebs/objex",
"path": "/objex/browser_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>env = {
"obj": None,
"history": [],
"trail": [],
}
# HELPER FUNCTIONS
def highlight_source(source):
"""
Highlight some python source code with HTML formatting.
"""
return highlight(source, PythonLexer(), HtmlFormatter())
def render_results(context, template_name="index.html")... | code_fim | hard | {
"lang": "python",
"repo": "johnthedebs/objex",
"path": "/objex/browser_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnthedebs/objex path: /objex/browser_test.py
#!/usr/bin/env python
from objex import Objex
import os.path
import sys
import traceback
from bottle import debug, error, redirect, request, response, route, run, static_file
from jinja2 import Environment, PackageLoader, Template
from pygments imp... | code_fim | hard | {
"lang": "python",
"repo": "johnthedebs/objex",
"path": "/objex/browser_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: colevscode/quickdata path: /quickdata/utils/timeutils.py
# division import is for td_seconds. It is required to get
# floating point division between integers
from __future__ import division
import datetime
import time
import re
## TIMEZONE STUFF -----------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "colevscode/quickdata",
"path": "/quickdata/utils/timeutils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def utcoffset(self, dt):
if self._isdst(dt):
return self._dst_offset
else:
return self._std_offset
def dst(self, dt):
if self._isdst(dt):
return self._dst_diff
else:
return datetime.timedelta(0)
def tzname(self, ... | code_fim | hard | {
"lang": "python",
"repo": "colevscode/quickdata",
"path": "/quickdata/utils/timeutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zeos/signalflow path: /examples/python/euclidean-rhythm-example.py
#!/usr/bin/env python3
#------------------------------------------------------------------------
# SignalFlow: Euclidean rhythm example, using a global pulse
# and ClockDivider to drive a series of rhythm generators.
# Impulses a... | code_fim | hard | {
"lang": "python",
"repo": "zeos/signalflow",
"path": "/examples/python/euclidean-rhythm-example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>clock = Impulse(8)
#--------------------------------------------------------------------------------
# Create four parallel Euclidean rhythm lines with different parameters.
#--------------------------------------------------------------------------------
a = EuclideanPatch(clock, 2, 23, 7, 80, 0.99, 0.0... | code_fim | hard | {
"lang": "python",
"repo": "zeos/signalflow",
"path": "/examples/python/euclidean-rhythm-example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, input=0, delay_time=1/8, feedback=0.7, wet=0.3):
super().__init__()
mono_input = ChannelMixer(1, input)
delay_l = AllpassDelay(mono_input, delay_time=delay_time, feedback=feedback)
delay_r = OneTapDelay(delay_l, delay_time=(delay_time/2))
wetd... | code_fim | hard | {
"lang": "python",
"repo": "zeos/signalflow",
"path": "/examples/python/euclidean-rhythm-example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harshag37/webots_ros2 path: /webots_ros2_core/launch/robot_launch.py
#!/usr/bin/env python
# Copyright 1996-2021 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | code_fim | hard | {
"lang": "python",
"repo": "harshag37/webots_ros2",
"path": "/webots_ros2_core/launch/robot_launch.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Webots
webots = WebotsLauncher(
world=world,
mode=mode,
gui=gui
)
# Driver node
controller = ControllerLauncher(
package=package,
executable=executable,
parameters=[
node_parameters,
{
'synchroni... | code_fim | hard | {
"lang": "python",
"repo": "harshag37/webots_ros2",
"path": "/webots_ros2_core/launch/robot_launch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def connect(self, container_name: str, aliases: list[str] = None,
ipv4: str | None = None) -> None:
"""
Connect a container to the network.
Parameters
----------
container_name: str
Name of the container that should be connected to t... | code_fim | hard | {
"lang": "python",
"repo": "vantage6/vantage6",
"path": "/vantage6-common/vantage6/common/docker/network_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vantage6/vantage6 path: /vantage6-common/vantage6/common/docker/network_manager.py
import docker
import logging
from docker.models.containers import Container
from vantage6.common.docker.addons import delete_network
from vantage6.common import logger_name
# TODO maybe move following to utils?... | code_fim | hard | {
"lang": "python",
"repo": "vantage6/vantage6",
"path": "/vantage6-common/vantage6/common/docker/network_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
container_name: str
Name of the container that should be connected to the network
aliases: list[str]
A list of aliases for the container in the network
ipv4: str | None
An IP address to assign to the containe... | code_fim | hard | {
"lang": "python",
"repo": "vantage6/vantage6",
"path": "/vantage6-common/vantage6/common/docker/network_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> segment.add_negative('stress')
assert segment.positive == ['long']
assert segment.negative == ['stress']
def test_addition():
feature_dictionary = {'stress': '+', 'syllabic': '-', 'continuant': '0',
'IPA': 'b'}
segment = Segment.from_dictionary(feature_dict... | code_fim | hard | {
"lang": "python",
"repo": "Exocamp/Onset",
"path": "/tests/test_segment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Exocamp/Onset path: /tests/test_segment.py
import sys
import os.path as path
base_directory = path.dirname(path.dirname(path.abspath(__file__)))
sys.path.append(path.join(base_directory, 'engine'))
from segment import Segment
def test_initialisation():
feature_dictionary = {'stress': '+'... | code_fim | hard | {
"lang": "python",
"repo": "Exocamp/Onset",
"path": "/tests/test_segment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> segment = Segment.from_dictionary(feature_dictionary)
syllabic_diacritic = Segment(['syllabic'], ['voice'])
addition = segment + syllabic_diacritic
assert addition.positive == ['stress', 'syllabic']
assert addition.negative == ['voice']
def test_meets_conditions():
segment = Se... | code_fim | medium | {
"lang": "python",
"repo": "Exocamp/Onset",
"path": "/tests/test_segment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>oment_data.pop() # deleting new string character
plt.plot(moment_data)
plt.show()
plt.close()<|fim_prefix|># repo: vrodochenko/wh-Hes-python-pycharm path: /LICENSE.md/scripts/draw_slice_infos.py
from matplotlib import pyplot as plt
picdata_file = open("../output/routine/price_voltree_slice... | code_fim | medium | {
"lang": "python",
"repo": "vrodochenko/wh-Hes-python-pycharm",
"path": "/LICENSE.md/scripts/draw_slice_infos.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vrodochenko/wh-Hes-python-pycharm path: /LICENSE.md/scripts/draw_slice_infos.py
from matplotlib import pyplot as plt
picdata_file = open("../output/routine/price_voltree_slices/slic<|fim_suffix|>artswith("moment 9"):
moment_data = (line.split(":")[1].split(';')) # selecting data
... | code_fim | medium | {
"lang": "python",
"repo": "vrodochenko/wh-Hes-python-pycharm",
"path": "/LICENSE.md/scripts/draw_slice_infos.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>nome))
pnome = partido[0]
nletraspnome = len(pnome)
print('Seu primeiro nome é {} e ele tem {} letras.'.format(pnome, nletraspnome))<|fim_prefix|># repo: bernardombraga/Solucoes-exercicios-cursos-gratuitos path: /Curso-em-video-Python3-mundo1/ex022.py
nome = str(input('Digite seu nome completo: '))
nome ... | code_fim | hard | {
"lang": "python",
"repo": "bernardombraga/Solucoes-exercicios-cursos-gratuitos",
"path": "/Curso-em-video-Python3-mundo1/ex022.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernardombraga/Solucoes-exercicios-cursos-gratuitos path: /Curso-em-video-Python3-mundo1/ex022.py
nome = str(input('Digite seu nome completo: '))
nome = nome.strip()
print('Analisando seu nome...')
maiusculo = nome.upper()
print(<|fim_suffix|>nome))
pnome = partido[0]
nletraspnome = len(pnome)
pr... | code_fim | hard | {
"lang": "python",
"repo": "bernardombraga/Solucoes-exercicios-cursos-gratuitos",
"path": "/Curso-em-video-Python3-mundo1/ex022.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def in_table_c12(code):
return unicodedata.category(code) == "Zs" and code != " "
def in_table_c11_c12(code):
return unicodedata.category(code) == "Zs"
def in_table_c21(code):
return ord(code) < 128 and unicodedata.category(code) == "Cc"
c22_specials = set([1757, 1807, 6158, 8204, 8205, 82... | code_fim | hard | {
"lang": "python",
"repo": "RustPython/RustPython",
"path": "/Lib/stringprep.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RustPython/RustPython path: /Lib/stringprep.py
# This file is generated by mkstringprep.py. DO NOT EDIT.
"""Library that exposes various tables found in the StringPrep RFC 3454.
There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function i... | code_fim | hard | {
"lang": "python",
"repo": "RustPython/RustPython",
"path": "/Lib/stringprep.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Self module imports
from . import utils
from . import restraints
from . import pipeline
from . import experiment
from .yank import Topography, AlchemicalPhase<|fim_prefix|># repo: choderalab/yank path: /Yank/__init__.py
#!/usr/local/bin/env python
"""
YANK
"""
# Define global version.
try:
from ... | code_fim | medium | {
"lang": "python",
"repo": "choderalab/yank",
"path": "/Yank/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: choderalab/yank path: /Yank/__init__.py
#!/usr/local/bin/env python
"""
YANK
"""
# Define global version.
try:
from . import version # Needed for yank 3.X.
except:
# Fill in information manually.
class _Version:
short_version = "dev"
version = "dev"
full_ve... | code_fim | medium | {
"lang": "python",
"repo": "choderalab/yank",
"path": "/Yank/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxvonhippel/AttackerSynthesis path: /korg/printUtils.py
'''
name : printUtils.py
author : [redacted]
authored : 9 June 2020, directly ripped from RFCNLP code.
description: provides pretty-print utils
'''
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREE... | code_fim | medium | {
"lang": "python",
"repo": "maxvonhippel/AttackerSynthesis",
"path": "/korg/printUtils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def makeBold(str):
return f"{bcolors.BOLD}{str}{bcolors.ENDC}"
def makeFail(str):
return f"{bcolors.FAIL}{str}{bcolors.ENDC}"<|fim_prefix|># repo: maxvonhippel/AttackerSynthesis path: /korg/printUtils.py
'''
name : printUtils.py
author : [redacted]
authored : 9 June 2020, directly ri... | code_fim | medium | {
"lang": "python",
"repo": "maxvonhippel/AttackerSynthesis",
"path": "/korg/printUtils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert abs(net.res_trafo.loading_percent.at[t1] - load1) < l_tol
assert abs(net.res_trafo.p_hv_mw.at[t1] - ph1) < s_tol
assert abs(net.res_trafo.q_hv_mvar.at[t1] - qh1) < s_tol
assert abs(net.res_trafo.p_lv_mw.at[t1] - pl1) < s_tol
assert abs(net.res_trafo.q_lv_mvar.at[t1] - ql1) < s_t... | code_fim | hard | {
"lang": "python",
"repo": "e2nIEE/pandapower",
"path": "/pandapower/test/loadflow/test_results.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_undefined_tap_dependent_impedance_characteristics():
# if some characteristic per 1 trafo are undefined, but at least 1 is defined -> OK
# if all characteristic per 1 trafo are undefined -> raise error
net = create_net()
pp.control.create_trafo_characteristics(net, 'trafo', [0], '... | code_fim | hard | {
"lang": "python",
"repo": "e2nIEE/pandapower",
"path": "/pandapower/test/loadflow/test_results.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: e2nIEE/pandapower path: /pandapower/test/loadflow/test_results.py
ncy_checks import runpp_with_consistency_checks
from pandapower.test.loadflow.result_test_network_generator import add_test_enforce_qlims, \
add_test_gen
from pandapower.test.helper_functions import assert_res_equal
from pandap... | code_fim | hard | {
"lang": "python",
"repo": "e2nIEE/pandapower",
"path": "/pandapower/test/loadflow/test_results.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
@vram_usage_mode("Depth Loss")
def make_comp(cls, pil_image, device=None):
if device is None:
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
depth, _ = DepthLoss.get_depth(pil_image, device=device)
return torch.from_... | code_fim | hard | {
"lang": "python",
"repo": "pytti-tools/pytti-core",
"path": "/src/pytti/LossAug/DepthLossClass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pytti-tools/pytti-core path: /src/pytti/LossAug/DepthLossClass.py
import gc
import math
from adabins.infer import InferenceHelper
from loguru import logger
from PIL import Image
import torch
from torch.nn import functional as F
from torchvision.transforms import functional as TF
from ... | code_fim | hard | {
"lang": "python",
"repo": "pytti-tools/pytti-core",
"path": "/src/pytti/LossAug/DepthLossClass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def get_depth(pil_image, device=None):
init_AdaBins(device=device)
width, height = pil_image.size
# if the area of an image is above this, the depth model fails
max_depth_area = 500000
image_area = width * height
if image_area ... | code_fim | hard | {
"lang": "python",
"repo": "pytti-tools/pytti-core",
"path": "/src/pytti/LossAug/DepthLossClass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ydauxais/pyswip path: /pyswip/easy.py
furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ... | code_fim | hard | {
"lang": "python",
"repo": "ydauxais/pyswip",
"path": "/pyswip/easy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ydauxais/pyswip path: /pyswip/easy.py
urnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EX... | code_fim | hard | {
"lang": "python",
"repo": "ydauxais/pyswip",
"path": "/pyswip/easy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if nondeterministic:
args = [getTerm(arg, swipl) for arg in args[:-1]] + [args[-1]]
else:
args = [getTerm(arg, swipl) for arg in args]
r = fun(*args)
return (r is None) and True or r
res = wrapper
funwraps[fun... | code_fim | hard | {
"lang": "python",
"repo": "ydauxais/pyswip",
"path": "/pyswip/easy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> removed_node = self._list.remove_at_tail()
evicted_entry = removed_node.cache_entry
del self._dict[removed_node.cache_entry.key]
self._count -= 1
if not all(node.cache_entry.key in self._dict for node in self._list):
assert False
return evi... | code_fim | medium | {
"lang": "python",
"repo": "amueller/MLOS",
"path": "/source/Mlos.Python/mlos/Examples/SmartCache/CacheImplementations/LruCache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amueller/MLOS path: /source/Mlos.Python/mlos/Examples/SmartCache/CacheImplementations/LruCache.py
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
from mlos.Examples.SmartCache.CacheImplementations.XruCache import XruCache
from mlos.Spaces import DiscreteDimension... | code_fim | hard | {
"lang": "python",
"repo": "amueller/MLOS",
"path": "/source/Mlos.Python/mlos/Examples/SmartCache/CacheImplementations/LruCache.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdassi/New-Shakespeare-Sonnet-Generator path: /newshakespeare.py
"""
This is the launcher to run the New Shakespeare Sonnet Generator
"""
$ git init
$ git status
$ git add .
$ git status
$ git commit -m "Initial commit"
from fetchshakespeare import fetch_data
from markov_python.cc_markov impor... | code_fim | medium | {
"lang": "python",
"repo": "rdassi/New-Shakespeare-Sonnet-Generator",
"path": "/newshakespeare.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#creates and adds the randomly generated data to the string
def get_words():
mc.add_string(fetch_data())
#generator
mc = MarkovChain()
get_words()
poem_length = 100
output = mc.generate_text(poem_length)
output = " ".join(output)
print textwrap.fill(output,width=35).capitalize()<|fim_prefix|># repo: rd... | code_fim | medium | {
"lang": "python",
"repo": "rdassi/New-Shakespeare-Sonnet-Generator",
"path": "/newshakespeare.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for _ in range(3):
for num in range(1, 10):
print('\U0001F605' * num)
(1- O primeiro for vai repetir 3 vezes
2- O segundo for vai de 1 até 9, os quais vão se repetir 3 vezes
3- Vai mostrar o emoji modificado vezes o número de vezes do num)
-- DICAS/Pycharm --
1- Ctrl + clique no pr... | code_fim | hard | {
"lang": "python",
"repo": "amarelopiupiu/python-resumos",
"path": "/loop-for.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amarelopiupiu/python-resumos path: /loop-for.py
"""
-- Exemplo 1 - Iterando uma string: --
nome = 'Fernanda'
for letra in nome:
print(letra, end='')
(Vai mostrar as letras do nome 'Fernanda', para não deixar uma embaixo da outra utilizou-se o end='')
-- Exemplo 2 - Iterando uma lista: -... | code_fim | hard | {
"lang": "python",
"repo": "amarelopiupiu/python-resumos",
"path": "/loop-for.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>(Vai mostrar do número 1 até o 9)
range(valor inicial, valor final - 1)
-- Exemplo 4 - Enumerate para pegar o índice ou o valor --
nome = 'Fernanda'
for i, v in enumerate(nome):
print(v)
(i = índice
v = valor
vai ver o índice ou o valor de nome
no print pediu para ver o valor, podemos substituir... | code_fim | hard | {
"lang": "python",
"repo": "amarelopiupiu/python-resumos",
"path": "/loop-for.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def train(hparams):
"""Trains an MNIST GAN.
Args:
hparams: An HParams instance containing the hyperparameters for training.
"""
# Initialize GANEstimator with options and hyperparameters.
gan_estimator = tfgan.estimator.GANEstimator(
generator_fn=_unconditional_generator,
discri... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/gan",
"path": "/tensorflow_gan/examples/mnist_estimator/train_lib.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/gan path: /tensorflow_gan/examples/mnist_estimator/train_lib.py
# coding=utf-8
# Copyright 2023 The TensorFlow GAN Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/gan",
"path": "/tensorflow_gan/examples/mnist_estimator/train_lib.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Trains an MNIST GAN.
Args:
hparams: An HParams instance containing the hyperparameters for training.
"""
# Initialize GANEstimator with options and hyperparameters.
gan_estimator = tfgan.estimator.GANEstimator(
generator_fn=_unconditional_generator,
discriminator_fn=networks.... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/gan",
"path": "/tensorflow_gan/examples/mnist_estimator/train_lib.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/date_time/schema_instance/nistschema_sv_iv_list_date_time_enumeration_5_xsd/nistschema_sv_iv_list_date_time_enumeration_5.py
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
from xsdata.models... | code_fim | hard | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/date_time/schema_instance/nistschema_sv_iv_list_date_time_enumeration_5_xsd/nistschema_sv_iv_list_date_time_enumeration_5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>13 = (
XmlDateTime(2023, 9, 14, 1, 21, 16),
XmlDateTime(1973, 3, 22, 2, 52, 1),
XmlDateTime(1985, 1, 11, 3, 36, 56),
XmlDateTime(2008, 7, 10, 0, 4, 24),
XmlDateTime(1971, 3, 5, 15, 32, 35),
XmlDateTime(2002, 12, 9, 9, 18, 25),
... | code_fim | hard | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/date_time/schema_instance/nistschema_sv_iv_list_date_time_enumeration_5_xsd/nistschema_sv_iv_list_date_time_enumeration_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janwillembuist/pygedcom path: /pygedcom/gedcomparser/parser.py
from pygedcom.gedcomparser.elements import FamilyTree
class Parser:
"""Parses the raw gedcom file into a Pygedcom FamilyTree instance"""
def __init__(self, file):
<|fim_suffix|> # Init tree
tree = FamilyTree()
... | code_fim | hard | {
"lang": "python",
"repo": "janwillembuist/pygedcom",
"path": "/pygedcom/gedcomparser/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # For each part of GEDCOM file, fill the tree
for i, (line, title) in enumerate(self.separators):
if 'INDI' in title:
# Add inidividual to the tree with this part of the file
tree.add_individual(self.lines[line:self.separators[i+1][0]])
... | code_fim | hard | {
"lang": "python",
"repo": "janwillembuist/pygedcom",
"path": "/pygedcom/gedcomparser/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dfs(0, judge)
for i in range(q):
c, d = map(int, input().split())
if visit[c - 1] == visit[d - 1]:
print("Town")
else:
print("Road")<|fim_prefix|># repo: NULLCT/LOMC path: /src/data/859.py
import sys #追加
sys.setrecursionlimit(500 * 500) #追加
from collections import deque
<... | code_fim | hard | {
"lang": "python",
"repo": "NULLCT/LOMC",
"path": "/src/data/859.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NULLCT/LOMC path: /src/data/859.py
import sys #追加
sys.setrecursionlimit(500 * 500) #追加
from collections import deque
n, q = map(int, input().split())
road = [[] * n for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
road[a - 1].append(b - 1)
road[b - 1].app... | code_fim | medium | {
"lang": "python",
"repo": "NULLCT/LOMC",
"path": "/src/data/859.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fedochet/shared-online-buffer path: /buffer/urls.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^read/([a-zA-Z0-9]*)$', views.read, name='read'),
url(r'^edit/([a-zA-Z0-9]*)$', views.edit, name='edit'),
url(r'^new$', ... | code_fim | easy | {
"lang": "python",
"repo": "fedochet/shared-online-buffer",
"path": "/buffer/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^read/([a-zA-Z0-9]*)$', views.read, name='read'),
url(r'^edit/([a-zA-Z0-9]*)$', views.edit, name='edit'),
url(r'^new$', views.new, name='new')
]<|fim_prefix|># repo: fedochet/shared-online-buffer path: /buffer/urls.py
from djang... | code_fim | easy | {
"lang": "python",
"repo": "fedochet/shared-online-buffer",
"path": "/buffer/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>on",
"BundledFirmware",
"UpdateError",
"ModuleAtPort",
"HeaterShaker",
"ModuleType",
"ModuleModel",
"TemperatureStatus",
"MagneticStatus",
"HeaterShakerStatus",
"SpeedStatus",
"LiveData",
]<|fim_prefix|># repo: Opentrons/opentrons path: /api/src/opentrons/hardw... | code_fim | hard | {
"lang": "python",
"repo": "Opentrons/opentrons",
"path": "/api/src/opentrons/hardware_control/modules/__init__.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Opentrons/opentrons path: /api/src/opentrons/hardware_control/modules/__init__.py
from .mod_abc import AbstractModule
from .tempdeck import TempDeck
from .magdeck import MagDeck
from .thermocycler import Thermocycler
from .heater_shaker import HeaterShaker
from .update import update_firmware
from... | code_fim | hard | {
"lang": "python",
"repo": "Opentrons/opentrons",
"path": "/api/src/opentrons/hardware_control/modules/__init__.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> pseudopotential2 = np.dot(k_i, k_i)
elif abs(q_magnitude - vector_magnitude3) < magnitude_threshold:
pseudopotential1 = pseudopotential1_3
pseudopotential2 = pseudopotential2_3
elif abs(q_magnitude - vector_magnitude4) < magnitude_thresho... | code_fim | hard | {
"lang": "python",
"repo": "KaceyLeavitt/empirical_pseudopotential",
"path": "/energy_bands_calculation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pseudopotential2_11
else:
pseudopotential1 = 0
pseudopotential2 = 0
matrix[i, j] = np.dot(k_i, k_i)*delta + pseudopotential1 + pseudopotential2*np.exp((-1j*np.dot(q_vec, atomic_basis_vector)))
eigenvalues = np.linalg.eigvals(matrix)
real_eige... | code_fim | hard | {
"lang": "python",
"repo": "KaceyLeavitt/empirical_pseudopotential",
"path": "/energy_bands_calculation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KaceyLeavitt/empirical_pseudopotential path: /energy_bands_calculation.py
import math
import numpy as np
import sympy
def energy_band_values(v1_3, v1_4, v1_11, v2_3, v2_4, v2_11, k_vec, energy_band_array, c, d_v):
pseudopotential1_3 = v1_3
pseudopotential2_3 = v2_3
vector_magnitude3 =... | code_fim | hard | {
"lang": "python",
"repo": "KaceyLeavitt/empirical_pseudopotential",
"path": "/energy_bands_calculation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self._automatic_shutdown_enabled:
return
if not self._settings.global_get(["server", "commands", "systemShutdownCommand"]):
self._logger.warning("systemShutdownCommand is not defined. Aborting shutdown.... | code_fim | hard | {
"lang": "python",
"repo": "MathieuAndrade/OctoPrint-Gladys",
"path": "/octoprint_gladys/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _shutdown_system(self):
shutdown_command = self._settings.global_get(["server", "commands", "systemShutdownCommand"])
self._logger.info("Shutting down system with command: {command}".format(command=shutdown_command))
try:
import requests
requests.get('{self._settings.... | code_fim | hard | {
"lang": "python",
"repo": "MathieuAndrade/OctoPrint-Gladys",
"path": "/octoprint_gladys/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MathieuAndrade/OctoPrint-Gladys path: /octoprint_gladys/__init__.py
# coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
from octoprint.server import user_permission
from octoprint.util import RepeatedTimer
from octoprint.events import eventManager, Events
import octopri... | code_fim | hard | {
"lang": "python",
"repo": "MathieuAndrade/OctoPrint-Gladys",
"path": "/octoprint_gladys/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ip_address = models.IPAddressField()
sent_address = models.CharField(max_length=50)
tx_time = models.DateTimeField()<|fim_prefix|># repo: LukeEarthwalk3r/freedoge path: /faucet/models.py
from django.db import models
<|fim_middle|>class Transaction(models.Model):
| code_fim | easy | {
"lang": "python",
"repo": "LukeEarthwalk3r/freedoge",
"path": "/faucet/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LukeEarthwalk3r/freedoge path: /faucet/models.py
from django.db import models
<|fim_suffix|> ip_address = models.IPAddressField()
sent_address = models.CharField(max_length=50)
tx_time = models.DateTimeField()<|fim_middle|>class Transaction(models.Model):
| code_fim | easy | {
"lang": "python",
"repo": "LukeEarthwalk3r/freedoge",
"path": "/faucet/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scrum-gang/jobapplications path: /tests/test_db_creation.py
from datetime import datetime
import pytest
import os
import sys
import time
sys.path.insert(0, os.getcwd())
from utils import db
from tables import Application, Inhouse, External, InterviewQuestion
# Global Variables
user_id = "someid... | code_fim | hard | {
"lang": "python",
"repo": "scrum-gang/jobapplications",
"path": "/tests/test_db_creation.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.