text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # defining triangle vertices
v1x, v1y = 0, 0
v2x, v2y = 1, 1
v3x, v3y = 1, 0
# test vertices are inside
self.assertTrue(inside_triangle(v1x, v1y, v2x, v2y, v3x, v3y, v1x, v1y))
self.assertTrue(inside_triangle(v1x, v1y, v2x, v2y, v3x, v3y, v2x, v2y))... | code_fim | medium | {
"lang": "python",
"repo": "vsnever/raysect-source",
"path": "/raysect/core/math/cython/tests/test_triangle.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = Neighbourhood
exclude = ['neighbour_user']<|fim_prefix|># repo: lilianwaweru/Neighbourhood path: /neighbour/forms.py
from django import forms
from .models import Profile,Business,Post,Neighbourhood
class ProfileForm(forms.ModelForm):
class Meta:
model ... | code_fim | hard | {
"lang": "python",
"repo": "lilianwaweru/Neighbourhood",
"path": "/neighbour/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lilianwaweru/Neighbourhood path: /neighbour/forms.py
from django import forms
from .models import Profile,Business,Post,Neighbourhood
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user_prof']
class BusinessForm(forms.ModelForm):
class Meta:... | code_fim | medium | {
"lang": "python",
"repo": "lilianwaweru/Neighbourhood",
"path": "/neighbour/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("database", ["asos"])
def test_real_parser(cursor):
"""Test that we can parse TAFS!"""
taf_parser.real_process(cursor, get_example_file("TAF.txt"))<|fim_prefix|># repo: akrherz/pyWWA path: /tests/workflows/test_taf_parser.py
"""Test taf_parser."""
# 3rd Party
import pytes... | code_fim | easy | {
"lang": "python",
"repo": "akrherz/pyWWA",
"path": "/tests/workflows/test_taf_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test that we can parse TAFS!"""
taf_parser.real_process(cursor, get_example_file("TAF.txt"))<|fim_prefix|># repo: akrherz/pyWWA path: /tests/workflows/test_taf_parser.py
"""Test taf_parser."""
# 3rd Party
import pytest
from pywwa.testing import get_example_file
# Local
from pywwa.workflows im... | code_fim | medium | {
"lang": "python",
"repo": "akrherz/pyWWA",
"path": "/tests/workflows/test_taf_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akrherz/pyWWA path: /tests/workflows/test_taf_parser.py
"""Test taf_parser."""
# 3rd Party
import pytest
from pywwa.testing import get_example_file
<|fim_suffix|>@pytest.mark.parametrize("database", ["asos"])
def test_real_parser(cursor):
"""Test that we can parse TAFS!"""
taf_parser.rea... | code_fim | easy | {
"lang": "python",
"repo": "akrherz/pyWWA",
"path": "/tests/workflows/test_taf_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in xrange(0, n):
if arr[i] != sorted_arr[i]:
for j in xrange(i+1, n):
if arr[j] == sorted_arr[i]:
arr[i], arr[j] = arr[j], arr[i]
swaps.append([i, j])
break
swaps_count = len(swaps)
ans =... | code_fim | medium | {
"lang": "python",
"repo": "Ahsanhabib1080/CodeForces",
"path": "/problems/A/SwapSort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if arr[j] == sorted_arr[i]:
arr[i], arr[j] = arr[j], arr[i]
swaps.append([i, j])
break
swaps_count = len(swaps)
ans = str(swaps_count)
if swaps_count != 0:
ans += "\n" + "\n".join(str(swap[0]) + " " + str(swa... | code_fim | medium | {
"lang": "python",
"repo": "Ahsanhabib1080/CodeForces",
"path": "/problems/A/SwapSort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ahsanhabib1080/CodeForces path: /problems/A/SwapSort.py
__author__ = 'Devesh Bajpai'
'''
https://codeforces.com/problemset/problem/489/A
Solution: Create a sorted copy of the array. Iterate over the array and check if the current indexed element
is same as the one in its sorted version. If not,... | code_fim | hard | {
"lang": "python",
"repo": "Ahsanhabib1080/CodeForces",
"path": "/problems/A/SwapSort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Writing RKE cluster manifest...')
with open(cluster_manifest_file, 'w') as manifest_file:
manifest_file.write('# RKE Manifest\n')
yaml.dump(rke_manifest, manifest_file,
default_flow_style=False # Ugh, flow style is ugly
)
print('Done.')
if __name_... | code_fim | hard | {
"lang": "python",
"repo": "DimensionDataResearch/glider-gun-v2",
"path": "/docker/remote-node/scripts/generate-rke-config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DimensionDataResearch/glider-gun-v2 path: /docker/remote-node/scripts/generate-rke-config.py
#!/usr/bin/python
import click
import json
import yaml
from collections import defaultdict
from os import path
RKE_IMAGES = {
'etcd': 'quay.io/coreos/etcd:latest',
'kube-api': 'rancher/k8s:v1... | code_fim | hard | {
"lang": "python",
"repo": "DimensionDataResearch/glider-gun-v2",
"path": "/docker/remote-node/scripts/generate-rke-config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> value = outputs[output]
if not isinstance(value, list):
value = [value]
if output == 'rke_control_plane_nodes':
rke_control_plane_nodes.extend(value)
if output == 'rke_etcd_nodes':
rke_etcd_nodes.extend(value)
if output == 'rke_w... | code_fim | hard | {
"lang": "python",
"repo": "DimensionDataResearch/glider-gun-v2",
"path": "/docker/remote-node/scripts/generate-rke-config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('evaluation', '0018_unique_degrees'),
('evaluation', '0014_rename_lecturer'),
]
operations = [
]<|fim_prefix|># repo: felixrindt/EvaP path: /evap/evaluation/migrations/0019_merge.py
from django.db import migrations
<|fim_middle|>class Migration(migrat... | code_fim | easy | {
"lang": "python",
"repo": "felixrindt/EvaP",
"path": "/evap/evaluation/migrations/0019_merge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: felixrindt/EvaP path: /evap/evaluation/migrations/0019_merge.py
from django.db import migrations
<|fim_suffix|> dependencies = [
('evaluation', '0018_unique_degrees'),
('evaluation', '0014_rename_lecturer'),
]
operations = [
]<|fim_middle|>
class Migration(migrati... | code_fim | easy | {
"lang": "python",
"repo": "felixrindt/EvaP",
"path": "/evap/evaluation/migrations/0019_merge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ERATOMMSD/dynamic-shielding path: /envs/self_driving_car/rl/core.py
if facing_right(dr):
inp = (1,1,0,1)
info = "top right facing right"
else:
inp = (0,1,1,1)
info = "top right"
elif 420<=x and y>=390: #bot and right -up allowed for... | code_fim | hard | {
"lang": "python",
"repo": "ERATOMMSD/dynamic-shielding",
"path": "/envs/self_driving_car/rl/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> nb_max_episode_steps=None, nb_max_start_steps=0, start_step_policy=None, verbose=1):
if not self.compiled:
raise RuntimeError('Your tried to test your agent but it hasn\'t been compiled yet. Please call `compile()` before `test()`.')
if action_repetition < 1:
... | code_fim | hard | {
"lang": "python",
"repo": "ERATOMMSD/dynamic-shielding",
"path": "/envs/self_driving_car/rl/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ERATOMMSD/dynamic-shielding path: /envs/self_driving_car/rl/core.py
callbacks.on_episode_begin(episode)
episode_step = 0
episode_reward = 0.
# Obtain the initial observation by resetting the environment.
self.reset... | code_fim | hard | {
"lang": "python",
"repo": "ERATOMMSD/dynamic-shielding",
"path": "/envs/self_driving_car/rl/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webclinic017/ib_console path: /ibc/tests/test_data_models.py
"""
Test ibc data models
"""
import datetime
from typing import List
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from sqlalchemy.orm import Session
import ib_insync as ib
import ibc.data_models as dm
im... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/ib_console",
"path": "/ibc/tests/test_data_models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_positions_crud(session: Session, account: dm.Account, position_msft: dm.Position, position_googl: dm.Position):
session.add(account)
session.flush()
session.add(position_msft)
session.add(position_googl)
session.commit()
session.expire_all()
accs: List[dm.Account] = ... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/ib_console",
"path": "/ibc/tests/test_data_models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: melikavah/test path: /moe/tests/bandit/ucb/ucb_test_case.py
# -*- coding: utf-8 -*-
"""Base test case class for UCB tests; includes different cases where unsampled arms are winners."""
from moe.tests.bandit.bandit_test_case import BanditTestCase
class UCBTestCase(BanditTestCase):
"""Base t... | code_fim | medium | {
"lang": "python",
"repo": "melikavah/test",
"path": "/moe/tests/bandit/ucb/ucb_test_case.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Base test case for the UCB bandit library."""
def _test_two_unsampled_arms(self):
"""Check that the two-unsampled-arms case always allocate each arm equally (the allocation is 0.5 for both arms). This tests num_unsampled_arms == num_arms > 1."""
bandit = self.bandit_class(self.... | code_fim | medium | {
"lang": "python",
"repo": "melikavah/test",
"path": "/moe/tests/bandit/ucb/ucb_test_case.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #print(st.AsJsonString())
##print(f"{st.id} -- {st.AsJsonString()}")
#print(st.id)
print(st.text)
earliest_tweet = min(earliest_tweet, st.id)
if not DRY_RUN:
print(st.AsJsonString(), file=f)
tw.api.DestroyStatus(st.id)
print("done!")<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "tedder/tweet-cleanup",
"path": "/delete-all-tweets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tedder/tweet-cleanup path: /delete-all-tweets.py
#!/usr/bin/env python3
import twitter
import json
import sys
import datetime
import os
#DRY_RUN = True
DRY_RUN = False
DATA_DIR = os.environ.get('DATA_DIR', '')
DELETED_LOG = os.path.join(DATA_DIR, 'deleted_tweets.json')
class Tweeter:
<|fim_su... | code_fim | medium | {
"lang": "python",
"repo": "tedder/tweet-cleanup",
"path": "/delete-all-tweets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='presentation',
name='template',
field=models.CharField(choices=[('standard_left_header.html', 'standard left header'), ('survey_centered_header.html', 'survey centered header')], max_length=50, verbose_name='... | code_fim | medium | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/landing/migrations/0038_auto_20190329_0740.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flavoi/diventi path: /diventi/landing/migrations/0038_auto_20190329_0740.py
# Generated by Django 2.0.13 on 2019-03-29 06:40
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('landing', '0037_presentation_template'),
]
operations = [
migrati... | code_fim | medium | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/landing/migrations/0038_auto_20190329_0740.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('landing', '0037_presentation_template'),
]
operations = [
migrations.AlterField(
model_name='presentation',
name='template',
field=models.CharField(choices=[('standard_left_header.html', 'standard left header'), ('survey_c... | code_fim | medium | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/landing/migrations/0038_auto_20190329_0740.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>lastsToTestSQL = '''SELECT TOP 1000
[lineid]
,[linedir]
,[tid]
,[runIndex]
,[stopIndex]
,[time]
FROM [HZ_BUS].[dbo].[FcdB_BasicDataStop]
where time > '2013-11-8 7:40:00' and
tid = %d and runIndex = %d'''
for last in lasts:
lastsToTestSQLRes = lasts... | code_fim | hard | {
"lang": "python",
"repo": "Terrrenceliu/hercules.python.pro",
"path": "/HZ_BUS/ReachTimeTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Terrrenceliu/hercules.python.pro path: /HZ_BUS/ReachTimeTest.py
# -*- coding: utf-8 -*-
import pymssql
conn=pymssql.connect(host="192.168.2.5",user="sde",password="sde",database="HZ_BUS",charset="utf8")
conn.autocommit(True)
cur = conn.cursor();
lastsSQL = '''SELECT TOP 1000
[li... | code_fim | hard | {
"lang": "python",
"repo": "Terrrenceliu/hercules.python.pro",
"path": "/HZ_BUS/ReachTimeTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DavTho1983/UPress_codetest path: /sarcasm/urls.py
from django.urls import path
from .views import HeadlineAPILi<|fim_suffix|>t:pk>", HeadlineAPIID.as_view(), name="results_api_detail"),
]<|fim_middle|>stView, HeadlineAPIID
urlpatterns = [
path("", HeadlineAPIListView.as_view(), name="results... | code_fim | medium | {
"lang": "python",
"repo": "DavTho1983/UPress_codetest",
"path": "/sarcasm/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t:pk>", HeadlineAPIID.as_view(), name="results_api_detail"),
]<|fim_prefix|># repo: DavTho1983/UPress_codetest path: /sarcasm/urls.py
from django.urls import path
from .views import HeadlineAPIListView, HeadlineAPIID
urlpatterns = [
path("", HeadlineA<|fim_middle|>PIListView.as_view(), name="results... | code_fim | medium | {
"lang": "python",
"repo": "DavTho1983/UPress_codetest",
"path": "/sarcasm/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #if pretrained: pretrained_backbone = False
backbone = resnet_fpn_backbone(arch_str, pretrained=pretrained_backbone, trainable_layers=trainable_layers)
model = MaskRCNN(backbone,
num_classes,
image_mean = [0.0, 0.0, 0.0], # already normalized by fasta... | code_fim | hard | {
"lang": "python",
"repo": "fabiogeraci/fastai_object_detection",
"path": "/fastai_object_detection/models/maskrcnn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fabiogeraci/fastai_object_detection path: /fastai_object_detection/models/maskrcnn.py
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/04b_models.maskrcnn.ipynb (unless otherwise specified).
__all__ = ['get_maskrcnn_model', 'maskrcnn_resnet18', 'maskrcnn_resnet34', 'maskrcnn_resnet50', 'mas... | code_fim | hard | {
"lang": "python",
"repo": "fabiogeraci/fastai_object_detection",
"path": "/fastai_object_detection/models/maskrcnn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def make_html(self, filename):
html_base = '''
<!DOCTYPE html>
<html>
<head>
<title>Оценки подраздела %(subject)s imhonet</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
body {
... | code_fim | hard | {
"lang": "python",
"repo": "idlesign/imhodump",
"path": "/imhodump.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: idlesign/imhodump path: /imhodump.py
# -*- coding: utf-8 -*-
import requests
import logging
import os
import shutil
import datetime
import argparse
from lxml import etree
from json import dumps, loads
from math import ceil
from collections import OrderedDict
from urllib.parse import quote
logg... | code_fim | hard | {
"lang": "python",
"repo": "idlesign/imhodump",
"path": "/imhodump.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>StringBuilder = TList[str]<|fim_prefix|># repo: GuRenYiBeiAiHuangLiang/ScriptTool path: /src/Core/Typedef.py
import types
import typing
<|fim_middle|>TList = typing.List
TDict = typing.Dict
TSet = typing.Set
TTuple = typing.Tuple
TNTuple = typing.NamedTuple
| code_fim | medium | {
"lang": "python",
"repo": "GuRenYiBeiAiHuangLiang/ScriptTool",
"path": "/src/Core/Typedef.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GuRenYiBeiAiHuangLiang/ScriptTool path: /src/Core/Typedef.py
import types
import typing
<|fim_suffix|>StringBuilder = TList[str]<|fim_middle|>TList = typing.List
TDict = typing.Dict
TSet = typing.Set
TTuple = typing.Tuple
TNTuple = typing.NamedTuple
| code_fim | medium | {
"lang": "python",
"repo": "GuRenYiBeiAiHuangLiang/ScriptTool",
"path": "/src/Core/Typedef.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_inside_dir(command, dirpath):
# import shlex
"""
Run a command from inside a given directory, returning the exit status
:param command: Command that will be executed
:param dirpath: String, path of the directory the command is being run.
"""
with inside_dir(dirpath):
... | code_fim | hard | {
"lang": "python",
"repo": "snakypy/snakypy-cookiecutter",
"path": "/tests/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snakypy/snakypy-cookiecutter path: /tests/base.py
# NOTE: Before testing, update the pip: pip install --upgrade pip
import os
import subprocess
import cookiecutter
from contextlib import contextmanager
@contextmanager
def inside_dir(dirpath):
"""
Execute code from inside the given dire... | code_fim | medium | {
"lang": "python",
"repo": "snakypy/snakypy-cookiecutter",
"path": "/tests/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # import shlex
"""
Run a command from inside a given directory, returning the exit status
:param command: Command that will be executed
:param dirpath: String, path of the directory the command is being run.
"""
with inside_dir(dirpath):
# return subprocess.check_call(s... | code_fim | hard | {
"lang": "python",
"repo": "snakypy/snakypy-cookiecutter",
"path": "/tests/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_train_and_get_topics_scipy():
model = BowEstimator(vocabulary, batch_size=32)
model.fit(X_scipy)
model.get_topic_vectors()
assert(True)<|fim_prefix|># repo: mitre/tmnt path: /tests/bowvae_test.py
import numpy as np
from scipy.sparse import csr_matrix
from tmnt.estimator import Bo... | code_fim | hard | {
"lang": "python",
"repo": "mitre/tmnt",
"path": "/tests/bowvae_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = BowEstimator(vocabulary, batch_size=32)
model.fit(X_scipy)
model.perplexity(X_scipy)
assert(True)
def test_train_and_npmi_scipy():
model = BowEstimator(vocabulary, batch_size=32)
model.fit(X_scipy)
assert(model.npmi(X_scipy, 10)[0] == 0)
def test_train_and_transform_s... | code_fim | medium | {
"lang": "python",
"repo": "mitre/tmnt",
"path": "/tests/bowvae_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitre/tmnt path: /tests/bowvae_test.py
import numpy as np
from scipy.sparse import csr_matrix
from tmnt.estimator import BowEstimator
import gluonnlp as nlp
X_scipy = csr_matrix(np.ones((100,100)))
vocabulary = nlp.Vocab(nlp.data.Counter(['a'*i for i in range(100)]), unknown_token=None, padding_... | code_fim | medium | {
"lang": "python",
"repo": "mitre/tmnt",
"path": "/tests/bowvae_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olgam4/GLO-3013_Pain path: /rpiRobot/src/communication/infrastructure/socketBaseConnector.py
from logging import getLogger
from socket import socket, AF_INET, SOCK_DGRAM, SOCK_STREAM
from typing import Tuple
<|fim_suffix|>logger = getLogger(__name__)
class SocketBaseConnector(IBaseConnector):
... | code_fim | hard | {
"lang": "python",
"repo": "olgam4/GLO-3013_Pain",
"path": "/rpiRobot/src/communication/infrastructure/socketBaseConnector.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SocketBaseConnector(IBaseConnector):
def __init__(self, port: int) -> None:
self._port = port
def connect_base(self) -> IConnection:
msg = ''
address = ('', 0)
while not msg == "request pain\n":
msg, address = self._receive_broadcast()
... | code_fim | medium | {
"lang": "python",
"repo": "olgam4/GLO-3013_Pain",
"path": "/rpiRobot/src/communication/infrastructure/socketBaseConnector.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nouranium/Monolith path: /Monolith/Farming.py
'''
Created on 11 Aug 2015
AGRICOLA!!!
@author: NoNotCar
'''
import Tools
import Img
import Object
import random
import Buyers
import Entity
randint=random.randint
class Hoe(Tools.Tool):
img=Img.imgret2("Farming/Hoe.png")
def use(self, x, y, w... | code_fim | hard | {
"lang": "python",
"repo": "Nouranium/Monolith",
"path": "/Monolith/Farming.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hasp=self.owner.get_power(500)
if self.idle==0:
for x in range(self.x-2,self.x+3):
for y in range(self.y-2,self.y+3):
if world.get_obj(x,y) and not self.output and hasp:
ent=world.get_obj(x,y).pick(world)
... | code_fim | hard | {
"lang": "python",
"repo": "Nouranium/Monolith",
"path": "/Monolith/Farming.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kkerwin1/everscan path: /modules/evernote.py
# everscan/modules/evernote.py
<|fim_suffix|> self.m_master = master<|fim_middle|>class EvernoteManager:
"""
Evernote manager class.
Interfaces with EverscanMaster, peer manager classes, and children
in order to facilitat... | code_fim | hard | {
"lang": "python",
"repo": "kkerwin1/everscan",
"path": "/modules/evernote.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Evernote manager class.
Interfaces with EverscanMaster, peer manager classes, and children
in order to facilitate communication between them.
"""
def __init__(self, master):
self.m_master = master<|fim_prefix|># repo: kkerwin1/everscan path: /modules/evernote.py... | code_fim | easy | {
"lang": "python",
"repo": "kkerwin1/everscan",
"path": "/modules/evernote.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 2c. Ensure valid pose, and add to pose graph
if pose1 is not None:
# print 'Adding ', pose1, ' between nodes: ', ut_idx0, 'and', ut_idx1
self.relpose_graph.add_node(ut_idx1, data=pose1)
added += 1
total += 1
s... | code_fim | hard | {
"lang": "python",
"repo": "spillai/articulation_learning",
"path": "/software/python/utils/pose_estimation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
# Initial tf, final tf
pose01 = RigidTransform.from_homogenous_matrix(T01)
draw_utils.publish_pose_list2('rel_poses_sac', [pose01], sensor_tf='KINECT')
posew1 = posew0.oplus(pose01)
# print 'pw0:', posew0, '\np01:', pose01, ... | code_fim | hard | {
"lang": "python",
"repo": "spillai/articulation_learning",
"path": "/software/python/utils/pose_estimation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spillai/articulation_learning path: /software/python/utils/pose_estimation.py
self.relpose_graph = nx.DiGraph()
# Init, and Final Pose map of track ( utime->pose )
self.final_pose_map = dict()
self.initial_pose_map = dict()
self.pose_pub = defaultdict(lis... | code_fim | hard | {
"lang": "python",
"repo": "spillai/articulation_learning",
"path": "/software/python/utils/pose_estimation.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
## XG Boost
xgb = xgboost.XGBRegressor(colsample_bytree=0.4,
gamma=0,
learning_rate=0.07,
max_depth=3,
min_child_weight=1.5,
n_estimators=10000, ... | code_fim | hard | {
"lang": "python",
"repo": "avacaondata/EquipoGamma",
"path": "/Modelos_R/models_python.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avacaondata/EquipoGamma path: /Modelos_R/models_python.py
# -*- coding: utf-8 -*-
"""models_python.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1BfMX0MzENL8swrw0XnRMuTJwgvwL-CqZ
"""
import pandas as pd
import numpy as np... | code_fim | hard | {
"lang": "python",
"repo": "avacaondata/EquipoGamma",
"path": "/Modelos_R/models_python.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bheff88/pylation path: /SolarForecast/ServerConfig.py
from multiprocessing import Process
import os
import time
import pickleshare as ps
#db = ps.PickleShareDB('~/Database')
#symbols = db['symbols']
def setup(server, key):
os.system('ssh -i "~/' + key + '" ubuntu@' + server + ' "git clone ... | code_fim | hard | {
"lang": "python",
"repo": "bheff88/pylation",
"path": "/SolarForecast/ServerConfig.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> procs = []
for server in servers:
proc = Process(target=sync, name=server, args=(server, key,))
procs.append(proc)
proc.start()
for proc in procs:
proc.join()
return
if __name__ == '__main__':
servers = ['ec2-18-219-47-209.us-east-2.compute.amazonaws.c... | code_fim | medium | {
"lang": "python",
"repo": "bheff88/pylation",
"path": "/SolarForecast/ServerConfig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NVIDIA/NVFlare path: /nvflare/app_common/statistics/statisitcs_objects_decomposer.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/NVFlare",
"path": "/nvflare/app_common/statistics/statisitcs_objects_decomposer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return target.value
def recompose(self, data: Any) -> DataType:
return DataType(data)
def fobs_registration():
fobs.register(StatisticConfigDecomposer)
fobs.register(FeatureDecomposer)
fobs.register(HistogramDecomposer)
fobs.register(BinDecomposer)
fobs.register(... | code_fim | hard | {
"lang": "python",
"repo": "NVIDIA/NVFlare",
"path": "/nvflare/app_common/statistics/statisitcs_objects_decomposer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = Solution()
str = "abcdefgh"
sublen = [3, 2, 2, 1]
print(s.reformatString(str, sublen))<|fim_prefix|># repo: kangli-bionic/algorithm path: /lintcode/315.py
"""
315. Reformat String
https://www.lintcode.com/problem/reformat-string/description
"""
class Solution:
<|fim_middle|> """
@param str: th... | code_fim | hard | {
"lang": "python",
"repo": "kangli-bionic/algorithm",
"path": "/lintcode/315.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # write your code here
sub = []
n = len(str)
i = 0
j = 0
while i < n:
sub.append(str[i:i+sublen[j]])
i += sublen[j]
j += 1
if j == len(sublen):
break
# print(sub)
i = 0
n... | code_fim | medium | {
"lang": "python",
"repo": "kangli-bionic/algorithm",
"path": "/lintcode/315.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kangli-bionic/algorithm path: /lintcode/315.py
"""
315. Reformat String
https://www.lintcode.com/problem/reformat-string/description
"""
class Solution:
<|fim_suffix|> # write your code here
sub = []
n = len(str)
i = 0
j = 0
while i < n:
... | code_fim | medium | {
"lang": "python",
"repo": "kangli-bionic/algorithm",
"path": "/lintcode/315.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CurrencyAdmin(NamedModelAdmin):
"""
Currency model admin class
"""
form = CurrencyAdminForm
list_display = iso_list_display
fieldsets = (
('Currency',
{'fields': iso_fields}),
) + NamedModelAdmin.get_field_sets()
_named_classes = (Category,)
for clasz... | code_fim | hard | {
"lang": "python",
"repo": "ajaniv/django-core-models",
"path": "/django_core_models/core/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajaniv/django-core-models path: /django_core_models/core/admin.py
"""
.. module:: django_core_models.core.admin
:synopsis: django_core_models core application admin module.
django_core_models core application admin module.
"""
from __future__ import absolute_import
from django.contrib i... | code_fim | hard | {
"lang": "python",
"repo": "ajaniv/django-core-models",
"path": "/django_core_models/core/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hrmirzadeh/wildbook-ia path: /wbia/tests/web/test_routes.py
# -*- coding: utf-8 -*-
import wbia
<|fim_suffix|> with wbia.opendb_with_web('testdb2') as (ibs, client):
resp = client.get('/turk/identification/lnbnn/')
assert resp.status_code == 200
assert b'Traceback' no... | code_fim | easy | {
"lang": "python",
"repo": "Hrmirzadeh/wildbook-ia",
"path": "/wbia/tests/web/test_routes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with wbia.opendb_with_web('testdb2') as (ibs, client):
resp = client.get('/turk/identification/lnbnn/')
assert resp.status_code == 200
assert b'Traceback' not in resp.data
assert b'<h1>No more to review!</h1>' in resp.data<|fim_prefix|># repo: Hrmirzadeh/wildbook-ia pa... | code_fim | easy | {
"lang": "python",
"repo": "Hrmirzadeh/wildbook-ia",
"path": "/wbia/tests/web/test_routes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # finding element with Link Text
elementByTextLink = driver.find_element(By.LINK_TEXT, "Login")
runBrowser = findElementByXPath()
runBrowser.test()<|fim_prefix|># repo: tushargoyal02/Python-Selenium path: /Find Elements/ByElement_find_element.py
from selenium import webdriver
fr... | code_fim | hard | {
"lang": "python",
"repo": "tushargoyal02/Python-Selenium",
"path": "/Find Elements/ByElement_find_element.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# finding element with Xpath
elementByXPath = driver.find_element(By.XPATH,"//*[@id='name']")
if elementByXPath:
print("Found the Element with Xpath")
# finding element with Link Text
elementByTextLink = driver.find_element(By.LINK_TEXT, "Logi... | code_fim | hard | {
"lang": "python",
"repo": "tushargoyal02/Python-Selenium",
"path": "/Find Elements/ByElement_find_element.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tushargoyal02/Python-Selenium path: /Find Elements/ByElement_find_element.py
from selenium import webdriver
from selenium.webdriver.common.by import By
class ByFindElement():
<|fim_suffix|> # finding element with Id
elementById = driver.find_element(By.ID, "name")
... | code_fim | hard | {
"lang": "python",
"repo": "tushargoyal02/Python-Selenium",
"path": "/Find Elements/ByElement_find_element.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silabs-DavidS/sdk_support path: /platform/hwconf_data/efr32mg1p/modules/MODEM/__init__.py
import efr32mg1p.halconfig.halconfig_types as halconfig_types
import efr32mg<|fim_suffix|>timeModel as RuntimeModel
import efr32mg1p.PythonSnippet.Metadata as Metadata<|fim_middle|>1p.halconfig.halconfig_dep... | code_fim | medium | {
"lang": "python",
"repo": "silabs-DavidS/sdk_support",
"path": "/platform/hwconf_data/efr32mg1p/modules/MODEM/__init__.py",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|>thonSnippet.ExporterModel as ExporterModel
import efr32mg1p.PythonSnippet.RuntimeModel as RuntimeModel
import efr32mg1p.PythonSnippet.Metadata as Metadata<|fim_prefix|># repo: silabs-DavidS/sdk_support path: /platform/hwconf_data/efr32mg1p/modules/MODEM/__init__.py
import efr32mg1p.halconfig.halconfig_ty... | code_fim | medium | {
"lang": "python",
"repo": "silabs-DavidS/sdk_support",
"path": "/platform/hwconf_data/efr32mg1p/modules/MODEM/__init__.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Raised when a fsspec function timed out occurs
"""
...<|fim_prefix|># repo: xyb/filesystem_spec path: /fsspec/exceptions.py
"""
fsspec user-defined exception classes
"""
import asyncio
<|fim_middle|>class FSTimeoutError(asyncio.TimeoutError):
| code_fim | easy | {
"lang": "python",
"repo": "xyb/filesystem_spec",
"path": "/fsspec/exceptions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xyb/filesystem_spec path: /fsspec/exceptions.py
"""
fsspec user-defined exception classes
"""
import asyncio
<|fim_suffix|> """
Raised when a fsspec function timed out occurs
"""
...<|fim_middle|>class FSTimeoutError(asyncio.TimeoutError):
| code_fim | easy | {
"lang": "python",
"repo": "xyb/filesystem_spec",
"path": "/fsspec/exceptions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hps is None:
hps = LogisticRegressionHyperparameters()
model = LogisticRegression(
penalty=hps.penalty,
max_iter=hps.max_iters,
C=hps.inv_reg_strength,
l1_ratio=hps.l1_ratio,
random_state=hps.seed,
c... | code_fim | medium | {
"lang": "python",
"repo": "dssg/mlpolicylab_fall20_schools3_public",
"path": "/schools3/ml/models/logistic_regression_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dssg/mlpolicylab_fall20_schools3_public path: /schools3/ml/models/logistic_regression_model.py
from sklearn.linear_model import LogisticRegression
from schools3.ml.models.sklearn_model import SklearnModel
from schools3.ml.hyperparameters.logistic_regression_hyperparameters import LogisticRegressi... | code_fim | hard | {
"lang": "python",
"repo": "dssg/mlpolicylab_fall20_schools3_public",
"path": "/schools3/ml/models/logistic_regression_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class GoSubLayout(ExpressionLayout):
"""
Goto Layout represents Gosub expression. It extends the Expression Layout
"""
def __init__(self, line, **kwargs):
super(GoSubLayout, self).__init__(line, 'GOSUB', **kwargs)
self.cols = 4
self.padding = 4
self.heig... | code_fim | hard | {
"lang": "python",
"repo": "pranay-91/kivyApp",
"path": "/KivyApp/Layouts/Expressions/GoSubLayout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.txt_value = TextInput(multiline = False, size_hint =(.3,1))
"""
Add the widgets to the layout
"""
def draw(self):
super(GoSubLayout, self).draw()
self.add_widget(self.txt_value)
"""
Get the expression list
"""
def get_expression(self... | code_fim | hard | {
"lang": "python",
"repo": "pranay-91/kivyApp",
"path": "/KivyApp/Layouts/Expressions/GoSubLayout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pranay-91/kivyApp path: /KivyApp/Layouts/Expressions/GoSubLayout.py
"""
@author: Pranay Pradhananga, Damian Katsigiannis
@filename: GoSubLayout.py
@title: GoSubLayout
@description: This is the main program for the Scratchbasic application.
It consists of four major layout panel: Ma... | code_fim | hard | {
"lang": "python",
"repo": "pranay-91/kivyApp",
"path": "/KivyApp/Layouts/Expressions/GoSubLayout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.mean(accuracies)
def main():
# Load data
file_folder = '~/Data/Kaggle/AugTabPG/'
train_file = file_folder + 'train.csv'
df = pd.read_csv(train_file)
ycols = "loss"
xcols = [col for col in df.columns if col.startswith("f")]
y = df[ycols].values
... | code_fim | hard | {
"lang": "python",
"repo": "sachinumrao/Kaggle",
"path": "/AugTabPG/tuned_gbm_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sachinumrao/Kaggle path: /AugTabPG/tuned_gbm_model.py
import numpy as np
import pandas as pd
from lightgbm import LGBMRegressor
from sklearn import linear_model
import sklearn
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import StratifiedKFold
from functools import ... | code_fim | hard | {
"lang": "python",
"repo": "sachinumrao/Kaggle",
"path": "/AugTabPG/tuned_gbm_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: psteinb/parallel2018 path: /tools/filters/columnfilter.py
#!/usr/bin/env python
from pandocfilters import toJSONFilter, RawBlock, Div, stringify
import re
def html(x):
return RawBlock('html', x)
<|fim_suffix|>if __name__ == "__main__":
toJSONFilter(mk_columns)<|fim_middle|>def latex(s)... | code_fim | hard | {
"lang": "python",
"repo": "psteinb/parallel2018",
"path": "/tools/filters/columnfilter.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return RawBlock('latex', s)
def mk_columns(k, v, f, m):
if k == "Para":
value = stringify(v)
if value.startswith('.') and value.endswith('['):
return html(r'<div class="%s">' % value[1:-1])
elif value == ".]":
return html(r'</div>')
if __name__ == ... | code_fim | medium | {
"lang": "python",
"repo": "psteinb/parallel2018",
"path": "/tools/filters/columnfilter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nedbat/scriv path: /src/scriv/format.py
"""Dispatcher for format-based knowledge."""
import abc
from typing import Dict, List, Optional
from .config import Config
# When collecting changelog fragments, we group them by their category into
# Sections. A SectionDict maps category names to a lis... | code_fim | hard | {
"lang": "python",
"repo": "nedbat/scriv",
"path": "/src/scriv/format.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Return the FormatTools to use.
Args:
fmt: One of the supported formats ("rst" or "md").
config: The configuration settings to use.
"""
if fmt == "rst":
from . import ( # pylint: disable=cyclic-import,import-outside-toplevel
format_rst,
... | code_fim | hard | {
"lang": "python",
"repo": "nedbat/scriv",
"path": "/src/scriv/format.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_format_tools(fmt: str, config: Config) -> FormatTools:
"""
Return the FormatTools to use.
Args:
fmt: One of the supported formats ("rst" or "md").
config: The configuration settings to use.
"""
if fmt == "rst":
from . import ( # pylint: disable=cycli... | code_fim | hard | {
"lang": "python",
"repo": "nedbat/scriv",
"path": "/src/scriv/format.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.config.fileConfig(conf, disable_existing_loggers=False)
logger = logging.getLogger(name)
return logger<|fim_prefix|># repo: gabriel10619/b-rabbit path: /b_rabbit/logs.py
import logging.config
from os import path
conf = path.join(path.dirname(path.abspath(__file__)), 'logging.ini')
<|fim... | code_fim | easy | {
"lang": "python",
"repo": "gabriel10619/b-rabbit",
"path": "/b_rabbit/logs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabriel10619/b-rabbit path: /b_rabbit/logs.py
import logging.config
from os import path
conf = path.join(path.dirname(path.abspath(__file__)), 'logging.ini')
<|fim_suffix|> logging.config.fileConfig(conf, disable_existing_loggers=False)
logger = logging.getLogger(name)
return logger<|fim... | code_fim | easy | {
"lang": "python",
"repo": "gabriel10619/b-rabbit",
"path": "/b_rabbit/logs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if the state doesn't have the relation extension, our job is pretty easy
if not state.hasExtension("relation"):
return Stream.mzero()
# if it does, we need to pull out all ground facts and check that we can unify against one
ground = state["relation"][self.rel... | code_fim | medium | {
"lang": "python",
"repo": "csmith49/logic",
"path": "/logic/relation/fact.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return f"{self.relation}({', '.join([str(arg) for arg in self.arguments])})"
# function for construction
def fact(rel, *args):
return Fact(rel, *args)<|fim_prefix|># repo: csmith49/logic path: /logic/relation/fact.py
from ..core.stream import Stream
from ..core.goal im... | code_fim | hard | {
"lang": "python",
"repo": "csmith49/logic",
"path": "/logic/relation/fact.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csmith49/logic path: /logic/relation/fact.py
from ..core.stream import Stream
from ..core.goal import Goal
from ..core import disj, eq
class Fact(Goal):
# relation can be anything hashable
def __init__(self, relation, *arguments):
self.relation = relation
self.arguments =... | code_fim | hard | {
"lang": "python",
"repo": "csmith49/logic",
"path": "/logic/relation/fact.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarbos/Neptune path: /host/controller.py
#import serial
import pygame
import time
pygame.init()
j = pygame.joystick.Joystick(0)
j.init()
print('Initial Joystick : %s' % j.get_name())
# Keeps a history of buttons pressed
button_history = [0,0,0<|fim_suffix|>xes_history[i]:
print("Axis ", i... | code_fim | hard | {
"lang": "python",
"repo": "sarbos/Neptune",
"path": "/host/controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_button(i) is not 0:
if button_history[i] is 0:
print('Button %i reads %i' % (i, j.get_button(i)))
button_history[i] = 1
else:
button_history[i] = 0
except KeyboardInterrupt:
j.quit()<|fim_prefix|># repo: sarbos/Neptune path: /host/controller.py
#import serial
import pygame
import t... | code_fim | hard | {
"lang": "python",
"repo": "sarbos/Neptune",
"path": "/host/controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @returns None
"""
logging.debug("Try parsing file: %s" % file_name)
try:
with open(file_name) as f:
exec(f.read(), globals())
except Exception as e:
logging.error("Error while parsing file %s" % file_name)
logging.error(e)
print("Error while ... | code_fim | hard | {
"lang": "python",
"repo": "pc2/HPCC_FPGA",
"path": "/scripts/code_generator/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pc2/HPCC_FPGA path: /scripts/code_generator/generator.py
#!/usr/bin/env python3
#
# Copyright (c) 2019 Marius Meyer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software wi... | code_fim | hard | {
"lang": "python",
"repo": "pc2/HPCC_FPGA",
"path": "/scripts/code_generator/generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @return the modified code
"""
global CODE
if not code_block:
code_block = CODE
if local_variables is not None:
variables = {**globals(), **local_variables}
else:
variables = globals()
matches = itertools.chain(re.finditer("%s\\s*%s\\s+(?P<code>(.|\n)+?)%... | code_fim | hard | {
"lang": "python",
"repo": "pc2/HPCC_FPGA",
"path": "/scripts/code_generator/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
rule training_parSMURF_combine_labels:
conda:
"../../envs/default.yml"
input:
predictions=(
"results/training/{training_run}/predictions/parsmurf/{predictions_alone_or_repetitive}.txt"
),
positives=lambda wc: getTrainingPositives(wc.training_run),
... | code_fim | hard | {
"lang": "python",
"repo": "kircherlab/ReMM",
"path": "/workflow/rules/training/parSMURF.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kircherlab/ReMM path: /workflow/rules/training/parSMURF.smk
rule training_parSMURF_createParsmurfInput:
conda:
"../../envs/default.yml"
input:
cb=lambda wc: getTrainingRunFolds(wc.training_run),
positives=lambda wc: getTrainingPositives(wc.training_run),
n... | code_fim | hard | {
"lang": "python",
"repo": "kircherlab/ReMM",
"path": "/workflow/rules/training/parSMURF.smk",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuyaneMatsu/hata path: /hata/discord/guild/guild_join_request/tests/test__GuildJoinRequest__utility.py
from datetime import datetime as DateTime
import vampytest
from ....guild import Guild
from ....user import User
from ...guild_join_request_form_response import GuildJoinRequestFormResponse
... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_join_request/tests/test__GuildJoinRequest__utility.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test__GuildJoinRequest__user():
"""
Tests whether ``GuildJoinRequest.user`` works as intended.
Case: no fields given.
"""
user_id = 202305170040
user = User.precreate(user_id, name = 'Koishi')
event = GuildJoinRequest(
user = user,
)
output = ... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_join_request/tests/test__GuildJoinRequest__utility.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> Case: no fields given.
"""
user_id = 202305170040
user = User.precreate(user_id, name = 'Koishi')
event = GuildJoinRequest(
user = user,
)
output = event.user_id
vampytest.assert_instance(output, int)
vampytest.assert_eq(output, user_id)
def test__Gu... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_join_request/tests/test__GuildJoinRequest__utility.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RitzAnthony/Ski_GeoDjango path: /geoweb/skiresorts/migrations/0002_auto_20190420_2134.py
# Generated by Django 2.2 on 2019-04-20 19:34
from django.db import migrations
<|fim_suffix|> operations = [
migrations.AlterModelTable(
name='skiresort',
table='skiresor... | code_fim | medium | {
"lang": "python",
"repo": "RitzAnthony/Ski_GeoDjango",
"path": "/geoweb/skiresorts/migrations/0002_auto_20190420_2134.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterModelTable(
name='skiresort',
table='skiresorts',
),
]<|fim_prefix|># repo: RitzAnthony/Ski_GeoDjango path: /geoweb/skiresorts/migrations/0002_auto_20190420_2134.py
# Generated by Django 2.2 on 2019-04-20 19:34
<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "RitzAnthony/Ski_GeoDjango",
"path": "/geoweb/skiresorts/migrations/0002_auto_20190420_2134.py",
"mode": "spm",
"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.