text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>for media_object in s3.Bucket('hakataarchive').objects.all():
normalized_key = normalize_key(media_object.key)
if any(filter(normalized_key.endswith, ['.mp4', '.zip', '.psd', '.mp3', '.avi', '.clip', '.pdf', '.wav'])):
continue
if normalized_key in doc_ids:
continue
print(... | code_fim | hard | {
"lang": "python",
"repo": "hakatashi/HakataArchiver",
"path": "/bin/tag_executor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hakatashi/HakataArchiver path: /bin/tag_executor.py
from PIL import Image
import firebase_admin
from firebase_admin import firestore
import boto3
import io
import hashlib
from tagger import get_tags
Image.MAX_IMAGE_PIXELS = None
def normalize_key(key):
return key.replace('/', '+')
def md5(... | code_fim | hard | {
"lang": "python",
"repo": "hakatashi/HakataArchiver",
"path": "/bin/tag_executor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># For each user...
client.set_options(version = 'v1')
users = client.all('users')
num_users = 0
for user in users.get_list():
if user['show'] != u'chat' and user['show'] != u'available':
continue
# Is that user staffing any queue?
staffing = False
assignments = users.one(user['id'... | code_fim | medium | {
"lang": "python",
"repo": "GeorgetownMakerHubOrg/libraryh3lpListener",
"path": "/libraryh3lp-sdk-python/examples/current-activity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeorgetownMakerHubOrg/libraryh3lpListener path: /libraryh3lp-sdk-python/examples/current-activity.py
#!/usr/bin/env python
# current-activity.py
# -------------------
# Count the number of active chats and the number of librarians that
# are staffing services.
from datetime import datetime
<|f... | code_fim | hard | {
"lang": "python",
"repo": "GeorgetownMakerHubOrg/libraryh3lpListener",
"path": "/libraryh3lp-sdk-python/examples/current-activity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('{} active chats, {} unanswered'.format(num_active, num_unanswered))
# For each user...
client.set_options(version = 'v1')
users = client.all('users')
num_users = 0
for user in users.get_list():
if user['show'] != u'chat' and user['show'] != u'available':
continue
# Is that user st... | code_fim | hard | {
"lang": "python",
"repo": "GeorgetownMakerHubOrg/libraryh3lpListener",
"path": "/libraryh3lp-sdk-python/examples/current-activity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = {
"thing": thing,
}
return render(request, 'item.html', context)
def new_items(request):
"""
Список последних сущностей
"""
things = Thing.objects.order_by("-updated")[:3]
context = {
"things": things,
}
return render(request, 'list.html', context)<|fim_prefix|># repo: h4/fuit... | code_fim | medium | {
"lang": "python",
"repo": "h4/fuit-webdev",
"path": "/examples/lesson5/pandora/box/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render(request, 'list.html', context)
def item(request, id):
"""
Страница отдельной сущности
"""
thing = Thing.objects.get(id=id)
context = {
"thing": thing,
}
return render(request, 'item.html', context)
def new_items(request):
"""
Список последних сущностей
"""
things = Thing.... | code_fim | medium | {
"lang": "python",
"repo": "h4/fuit-webdev",
"path": "/examples/lesson5/pandora/box/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: h4/fuit-webdev path: /examples/lesson5/pandora/box/views.py
# encoding=utf-8
from django.shortcuts import render
from .models import Thing, ThingsType
<|fim_suffix|> context = {
"things": things,
}
return render(request, 'list.html', context)<|fim_middle|>def list(request):
"""
Список в... | code_fim | hard | {
"lang": "python",
"repo": "h4/fuit-webdev",
"path": "/examples/lesson5/pandora/box/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://admin:root@localhost/flask_migrate"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
db.init_app(app)
migrate.init_app(app, db)
return app<|fim_prefix|># repo: joaovitorvlb/flask_apps path: /flask_migrate/app/__init__.py
from flask... | code_fim | easy | {
"lang": "python",
"repo": "joaovitorvlb/flask_apps",
"path": "/flask_migrate/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joaovitorvlb/flask_apps path: /flask_migrate/app/__init__.py
from flask import Flask
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy()
migrate = Migrate()
<|fim_suffix|>
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://admin:r... | code_fim | easy | {
"lang": "python",
"repo": "joaovitorvlb/flask_apps",
"path": "/flask_migrate/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awesome-archive/yuri path: /basebots/databot.py
class DataBot:
def __init__(self):
self.train_data = list()
<|fim_suffix|> def get_data(self):
return self.train_data<|fim_middle|> def append_data(self, data):
if data is not None:
self.train_data.appe... | code_fim | medium | {
"lang": "python",
"repo": "awesome-archive/yuri",
"path": "/basebots/databot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.train_data<|fim_prefix|># repo: awesome-archive/yuri path: /basebots/databot.py
class DataBot:
def __init__(self):
<|fim_middle|> self.train_data = list()
def append_data(self, data):
if data is not None:
self.train_data.append(data)
def get_da... | code_fim | medium | {
"lang": "python",
"repo": "awesome-archive/yuri",
"path": "/basebots/databot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timreyes/pulseCount path: /pulseCount.py
# import math
# import numpy
from saleae.range_measurements import DigitalMeasurer
POSITIVE_PULSES = 'positivePulses'
NEGATIVE_PULSES = 'negativePulses'
class PosNegPulseMeasurer(DigitalMeasurer):
supported_measurements = [POSITIVE_PULSES, NEGATIVE_... | code_fim | hard | {
"lang": "python",
"repo": "timreyes/pulseCount",
"path": "/pulseCount.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if POSITIVE_PULSES in self.requested_measurements:
values[POSITIVE_PULSES] = self.positive_pulses
if NEGATIVE_PULSES in self.requested_measurements:
values[NEGATIVE_PULSES] = self.negative_pulses
return values<|fim_prefix|># repo: timreyes/puls... | code_fim | hard | {
"lang": "python",
"repo": "timreyes/pulseCount",
"path": "/pulseCount.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dice_sequence:
roll = dice_sequence[turn_count]
else:
roll = self.roll_dice()
if roll == 0:
self.move_crow()
elif roll == 1:
self.move_green()
elif roll == 2:
sel... | code_fim | hard | {
"lang": "python",
"repo": "silumate/first-orchard-simulator",
"path": "/FirstOrchard/Game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silumate/first-orchard-simulator path: /FirstOrchard/Game.py
import random
from FirstOrchard.Player import Player
class Game:
def __init__(self, players):
self.green_apples = 4
self.red_apples = 4
self.blue_plums = 4
self.yellow_pears = 4
self.crow_p... | code_fim | hard | {
"lang": "python",
"repo": "silumate/first-orchard-simulator",
"path": "/FirstOrchard/Game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: laowantong/paroxython path: /examples/idioms/programs/028.0350-sort-by-a-property.py
"""Sort by a property.
Sort elements of array-like collection _items in ascending order of _x._p, where _p is a field of the type _Item of the objects in _items.
<|fim_suffix|># Implementation author: Roboticus... | code_fim | medium | {
"lang": "python",
"repo": "laowantong/paroxython",
"path": "/examples/idioms/programs/028.0350-sort-by-a-property.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The lambda expression pulls out the field you want to sort by. If you want to sort in reverse order, add reverse=True to the argument list.
items = sorted(items, key=lambda x: x.p)<|fim_prefix|># repo: laowantong/paroxython path: /examples/idioms/programs/028.0350-sort-by-a-property.py
"""Sort by a p... | code_fim | medium | {
"lang": "python",
"repo": "laowantong/paroxython",
"path": "/examples/idioms/programs/028.0350-sort-by-a-property.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yzhang123/NeMo path: /nemo/constants.py
# Copyright (C) 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 obtain a copy of the License at
#
# http://www.apa... | code_fim | hard | {
"lang": "python",
"repo": "yzhang123/NeMo",
"path": "/nemo/constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ACCEPTED_NUMBER_FORMATS = ACCEPTED_INT_NUMBER_FORMATS + ACCEPTED_FLOAT_NUMBER_FORMATS + ACCEPTED_STR_NUMBER_FORMATS
# NEMO_ENV_VARNAME_DEBUG_VERBOSITY = "NEMO_DEBUG_VERBOSITY"
NEMO_ENV_VARNAME_ENABLE_COLORING = "NEMO_ENABLE_COLORING"
NEMO_ENV_VARNAME_REDIRECT_LOGS_TO_STDERR = "NEMO_REDIRECT_LOGS_TO_STDER... | code_fim | medium | {
"lang": "python",
"repo": "yzhang123/NeMo",
"path": "/nemo/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fitrialif/CoDeepNEAT path: /src/CoDeepNEAT/CDNNodes/ModuleNode.py
import random
import torch
from torch import nn as nn
from torch.nn import functional as F
from src.Config import NeatProperties as Props, Config
from src.NEAT.Gene import NodeGene, NodeType
from src.NEAT.Mutagen import Mutagen, ... | code_fim | hard | {
"lang": "python",
"repo": "fitrialif/CoDeepNEAT",
"path": "/src/CoDeepNEAT/CDNNodes/ModuleNode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_all_mutagens(self):
return [self.activation, self.layer_type]
def __repr__(self):
return str(self.node_type)
def get_node_name(self):
return repr(self.layer_type()) + "\n" + "features: " + repr(self.layer_type.get_sub_value("out_features"))
def get_comple... | code_fim | hard | {
"lang": "python",
"repo": "fitrialif/CoDeepNEAT",
"path": "/src/CoDeepNEAT/CDNNodes/ModuleNode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
###############################################################
# MENU #
###############################################################
"""
MENU
"""
class Menu(GraphObject):
type = "Menu"
... | code_fim | hard | {
"lang": "python",
"repo": "arkangelv69/test",
"path": "/back/app/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkangelv69/test path: /back/app/model.py
"" \
"" delete r,n")
def getMenus(self):
return self.have_menu
def toJson(self):
restaurant = {
"links": {
"self": "http://"+os.getenv("HOSTAPI","localhost")+":5000/pri... | code_fim | hard | {
"lang": "python",
"repo": "arkangelv69/test",
"path": "/back/app/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkangelv69/test path: /back/app/model.py
u in restaurant.have_menu:
menus["m_"+str(menu.__primaryvalue__)]=menu.toJson()
return menus
def getPlates(self):
plates = {}
for restaurant in self.admin:
for plate in restaurant.have_plate:
... | code_fim | hard | {
"lang": "python",
"repo": "arkangelv69/test",
"path": "/back/app/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AccelByte/accelbyte-python-sdk path: /accelbyte_py_sdk/api/platform/models/entitlement_history_info.py
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code genera... | code_fim | hard | {
"lang": "python",
"repo": "AccelByte/accelbyte-python-sdk",
"path": "/accelbyte_py_sdk/api/platform/models/entitlement_history_info.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
"action": "action",
"createdAt": "created_at",
"entitlementId": "entitlement_id",
"namespace": "namespace",
"operator": "operator",
"updatedAt": "updated_at",
"userId": "user_id",
"reason": "re... | code_fim | hard | {
"lang": "python",
"repo": "AccelByte/accelbyte-python-sdk",
"path": "/accelbyte_py_sdk/api/platform/models/entitlement_history_info.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for arr in (self.right,):
for i in range(len(arr)-2):
if dot(arr[i], arr[i+1], arr[i+1], arr[i+2]) < 0.0:
return False
return True
def _get_control_points(self, n):
radius = np.random.normal(1.0, 0.2, size=(n, ))
radius[-... | code_fim | hard | {
"lang": "python",
"repo": "pkubiak/gym-space-racer",
"path": "/gym_space_racer/maps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkubiak/gym-space-racer path: /gym_space_racer/maps.py
from scipy import interpolate
import random
import numpy as np
import matplotlib.pyplot as plt
import math
from types import SimpleNamespace
from gym_space_racer.geometry import intersect, intersection
class CircularMap:
"""Generate rand... | code_fim | hard | {
"lang": "python",
"repo": "pkubiak/gym-space-racer",
"path": "/gym_space_racer/maps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.left = self._remove_intersections(left)
right = self._build_track(interp[:, 0], interp[:, 1], -0.5*width)
if debug:
plt.plot(right[:, 0], right[:, 1], 'g:')
self.right = self._remove_intersections(right)
def plot(self):
plt.plot(self.start[0],... | code_fim | hard | {
"lang": "python",
"repo": "pkubiak/gym-space-racer",
"path": "/gym_space_racer/maps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nestorix1343/hue2mqtt-python path: /hue2mqtt/hue2mqtt.py
"""
Data Component base class.
A data component represents the common functionality between
State Managers and Consumers. It handles connecting to the broker
and managing the event loop.
"""
import asyncio
import json
import logging
import... | code_fim | hard | {
"lang": "python",
"repo": "nestorix1343/hue2mqtt-python",
"path": "/hue2mqtt/hue2mqtt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find the light with that uniqueid
for light_id in self._bridge.lights:
light = self._bridge.lights[light_id]
if light.uniqueid == uniqueid:
try:
state = LightSetState(**json.loads(payload))
LOGGER.info(f"Upda... | code_fim | hard | {
"lang": "python",
"repo": "nestorix1343/hue2mqtt-python",
"path": "/hue2mqtt/hue2mqtt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> encodings, encoding_keys = {}, []
for encoding_path in args.encodings:
encodings_i = np.load(encoding_path)
encoding_key = os.path.basename(encoding_path)
encoding_key = encoding_key[:encoding_key.rindex(".")]
if args.encoding_project is not None and args.encoding_project < encodings_... | code_fim | hard | {
"lang": "python",
"repo": "vejmin/nn-decoding",
"path": "/src/heatmap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def eval_pair(inputs):
enc1, enc2, encodings, sentences = inputs
# Multiprocessing task function.
if enc1 == enc2:
return enc1, enc2, (1.0, 1.0)
else:
coefs = eval_encodings_rdm(encodings, enc1, enc2, sentences=sentences)
# Calculate 95% CI bounds
lower_bound, upper_bound = np.per... | code_fim | hard | {
"lang": "python",
"repo": "vejmin/nn-decoding",
"path": "/src/heatmap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vejmin/nn-decoding path: /src/heatmap.py
"""
Render a heat-map describing the relationship between different encodings.
"""
from argparse import ArgumentParser
import itertools
import logging
import multiprocessing
import os.path
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogge... | code_fim | hard | {
"lang": "python",
"repo": "vejmin/nn-decoding",
"path": "/src/heatmap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mooshmoosh/hackerscripts path: /ntext
#!/usr/bin/python3
import os
import sys
files = os.listdir('.')
file_prefix = sys.argv[1]
<|fim_suffix|>def get_file_number(filename, prefix):
try:
return int(filename[len(prefix) + 1:-4])
except:
return -1
for filename in files:
... | code_fim | medium | {
"lang": "python",
"repo": "mooshmoosh/hackerscripts",
"path": "/ntext",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for filename in files:
if filename.startswith(file_prefix) and filename.endswith('.txt'):
candidate_file_number = get_file_number(filename, file_prefix)
if candidate_file_number >= next_file_number:
next_file_number = candidate_file_number + 1
print(file_prefix + "." + str... | code_fim | medium | {
"lang": "python",
"repo": "mooshmoosh/hackerscripts",
"path": "/ntext",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> IMAGEDIR = 'images/'
known_images = set(Image.objects.all().values_list('image', flat=True))
print(known_images)
removed = 0
for f in os.listdir(os.path.join(settings.MEDIA_ROOT, IMAGEDIR)):
if IMAGEDIR+f not in known_images:
removed += 1... | code_fim | hard | {
"lang": "python",
"repo": "drawpile/website",
"path": "/templatepages/management/commands/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cleanup(self):
IMAGEDIR = 'images/'
known_images = set(Image.objects.all().values_list('image', flat=True))
print(known_images)
removed = 0
for f in os.listdir(os.path.join(settings.MEDIA_ROOT, IMAGEDIR)):
if IMAGEDIR+f not in known_images:
... | code_fim | hard | {
"lang": "python",
"repo": "drawpile/website",
"path": "/templatepages/management/commands/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drawpile/website path: /templatepages/management/commands/images.py
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.db import IntegrityError
from django.core.files import File
from django.conf import settings
from templatepages.mode... | code_fim | hard | {
"lang": "python",
"repo": "drawpile/website",
"path": "/templatepages/management/commands/images.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imk1/MethylationQTLCode path: /getSNPMethylationFDRs.py
def getSNPMethylationFDRs(SNPMethylEffectSizesFileName, SNPMethylEffectSizesRandFileNamePrefix, numIters, SNPMethylCutoffPlusFileName, corrCutoff):
# Get the FDR for each SNP, C pair for a correlation cutoff
# ASSUMES THAT LINES IN TRUE DA... | code_fim | hard | {
"lang": "python",
"repo": "imk1/MethylationQTLCode",
"path": "/getSNPMethylationFDRs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> SNPMethylEffectSizesFile.close()
for SNPMethylEffectSizesRandFile in SNPMethylEffectSizesRandFileList:
# Close the file from each random iteration
SNPMethylEffectSizesRandFile.close()
SNPMethylCutoffPlusFile.close()
return [numRealGreaterThanCorrCutoff, numGreaterThanCorrCutoff]
def computeFDR(... | code_fim | hard | {
"lang": "python",
"repo": "imk1/MethylationQTLCode",
"path": "/getSNPMethylationFDRs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jowage58/ssmenv2exec path: /tests/test_ssmenv2exec.py
import unittest
import ssmenv2exec
class TestParameterParsing(unittest.TestCase):
def test_parse_empty(self):
params = ssmenv2exec.parse_ssm_params([], path_sep='/')
self.assertDictEqual(params, {})
def test_parse_... | code_fim | hard | {
"lang": "python",
"repo": "jowage58/ssmenv2exec",
"path": "/tests/test_ssmenv2exec.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> params = [
{'Name': '/app/myapp/DB_PASS',
'Type': 'String',
'Value': 'tiger',
},
{'Name': '/app/myapp/DB_URL',
'Type': 'String',
'Value': 'localhost/orcl',
},
{'Name': '/app/myapp/DB_U... | code_fim | hard | {
"lang": "python",
"repo": "jowage58/ssmenv2exec",
"path": "/tests/test_ssmenv2exec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyphenation/languages-german path: /skripte/python/lang_s/s2long-s.py
y be distributed and/or modified under
# the conditions of the `LaTeX Project Public License`,
# either version 1.3 of this license or (at your option)
# any later version.
# :Version: 0.3... | code_fim | hard | {
"lang": "python",
"repo": "hyphenation/languages-german",
"path": "/skripte/python/lang_s/s2long-s.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Ausgabe
# =======
#
# Wortliste mit automatisch bestimmter S-Schreibung, ohne Trennstellen::
outstream.write(u'\n'.join(completed).encode('utf8') + '\n')
# Auswertung
# ==========
#
# ::
sys.stderr.write("# Gesamtwortzahl %s %s\n" % (lang, no_of_words))
sys.stderr.write("# Automatisch kon... | code_fim | hard | {
"lang": "python",
"repo": "hyphenation/languages-german",
"path": "/skripte/python/lang_s/s2long-s.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyphenation/languages-german path: /skripte/python/lang_s/s2long-s.py
nd in Digraphen::
word = word.replace(u'st', u'ſt')
word = word.replace(u'sp', u'ſp')
word = word.replace(u'sch', u'ſch')
# word = word.replace(u'ps', u'pſ')
word = word.replace(u'Ps', u'Pſ') # Ψ
word... | code_fim | hard | {
"lang": "python",
"repo": "hyphenation/languages-german",
"path": "/skripte/python/lang_s/s2long-s.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while blockchain.head != None:
print(blockchain.head)
blockchain.head = blockchain.head.next<|fim_prefix|># repo: leonardo1101/Simple-Blockchain path: /run.py
from blockchain import *
blockchain = Blockchain()
<|fim_middle|>for n in range(10):
blockchain.mine(Block("Block " + str(n+1)))
... | code_fim | medium | {
"lang": "python",
"repo": "leonardo1101/Simple-Blockchain",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonardo1101/Simple-Blockchain path: /run.py
from blockchain import *
blockchain = Blockchain()
<|fim_suffix|>while blockchain.head != None:
print(blockchain.head)
blockchain.head = blockchain.head.next<|fim_middle|>for n in range(10):
blockchain.mine(Block("Block " + str(n+1)))
... | code_fim | medium | {
"lang": "python",
"repo": "leonardo1101/Simple-Blockchain",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for n in range(10):
blockchain.mine(Block("Block " + str(n+1)))
while blockchain.head != None:
print(blockchain.head)
blockchain.head = blockchain.head.next<|fim_prefix|># repo: leonardo1101/Simple-Blockchain path: /run.py
from blockchain import *
<|fim_middle|>blockchain = Blockchain()... | code_fim | easy | {
"lang": "python",
"repo": "leonardo1101/Simple-Blockchain",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: telstra/open-kilda path: /src-python/lab-service/traffexam/kilda/traffexam/service.py
# Copyright 2017 Telstra Open Source
#
# 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 Li... | code_fim | hard | {
"lang": "python",
"repo": "telstra/open-kilda",
"path": "/src-python/lab-service/traffexam/kilda/traffexam/service.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> bandwidth = subject.bandwidth * 1024
if subject.burst_pkt:
bandwidth = '{}/{}'.format(bandwidth, subject.burst_pkt)
cmd = self.make_cmd_common_part(subject)
cmd += [
'--client={}'.format(subject.remote_address.address),
'--port={}'.forma... | code_fim | hard | {
"lang": "python",
"repo": "telstra/open-kilda",
"path": "/src-python/lab-service/traffexam/kilda/traffexam/service.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> master_iface = model.NetworkIface(iface_ref)
results = []
with ipdb.interfaces[iface_ref].ro as iface:
for addr, prefix in iface.ipaddr:
try:
results.append(model.IpAddress(
addr, prefix=prefix, iface=master_if... | code_fim | hard | {
"lang": "python",
"repo": "telstra/open-kilda",
"path": "/src-python/lab-service/traffexam/kilda/traffexam/service.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fmayer/fancystructures path: /fancystructures/disjoint_sets.py
""" Disjoint sets represented as rooted tree. """
class Set(object):
__slots__ = ['rank', 'p']
def __init__(self):
self.rank = 0
self.p = self
def _link(self, other):
if self is other:
... | code_fim | medium | {
"lang": "python",
"repo": "fmayer/fancystructures",
"path": "/fancystructures/disjoint_sets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self is other:
return
if self.rank > other.rank:
other.p = self
else:
self.p = other
if self.rank == other.rank:
other.rank += 1
def union(self, other):
""" Indicate two sets are equal. """
self... | code_fim | medium | {
"lang": "python",
"repo": "fmayer/fancystructures",
"path": "/fancystructures/disjoint_sets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def find_set(self):
""" Get canonical object for this set. """
return self._set_set(self._find_set())<|fim_prefix|># repo: fmayer/fancystructures path: /fancystructures/disjoint_sets.py
""" Disjoint sets represented as rooted tree. """
class Set(object):
__slots__ = ['rank', 'p']... | code_fim | hard | {
"lang": "python",
"repo": "fmayer/fancystructures",
"path": "/fancystructures/disjoint_sets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print()
print(students[ 0 : 2 ])
print(students[ 1 : len(students) - 1 ])
print(students[ 1 : -2 ])
print(students[ 3 : ]) # 3 to the end
print(students[ : 3 ]) # start to 3
print(students[ : -2 ]) # start to -2
print(students[ : ])
print()
print(students[ : 4 : 2]) # increment of 2
print... | code_fim | medium | {
"lang": "python",
"repo": "Oscar-Oliveira/Python-3",
"path": "/8_Collections/B_slicing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Oscar-Oliveira/Python-3 path: /8_Collections/B_slicing.py
"""
Slicing
"""
students = ["student1", "student2", "student3", "student4", "student5"]
for i in range(5):
print("Student at {}: {}".format(i, students[i]))
print()
for i in range(-1, -(len(students) + 1), -1):
print(... | code_fim | hard | {
"lang": "python",
"repo": "Oscar-Oliveira/Python-3",
"path": "/8_Collections/B_slicing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print()
backupList = students # refers to the same object
print(students)
print(backupList)
students[0] = "XXX"
print(students)
print(backupList)
print()
backupList = students[:] # slicing creates a copy
print(students)
print(backupList)
students[0] = "YYY"
print(students)
print(backupList)... | code_fim | medium | {
"lang": "python",
"repo": "Oscar-Oliveira/Python-3",
"path": "/8_Collections/B_slicing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ccnl_home = Util.ccnl_home()
if ccnl_home is None:
return
path = Util.write_binary_content(name, data)
ctrl_path = ccnl_home + "/bin/ccn-lite-ctrl"
command = [ctrl_path, '-x', self.mgmt, 'addContentToCache', path]
check_output(command)
Lo... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/nfn-applications",
"path": "/Core/NFNNode.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> faceid = self.get_face(node)
if faceid is None:
faceid = self.add_face(node)
ctrl_path = os.path.expandvars("$CCNL_HOME/bin/ccn-lite-ctrl")
command = [ctrl_path, '-x', self.mgmt, 'prefixreg', prefix, str(faceid), 'ndn2013']
check_output(command)
... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/nfn-applications",
"path": "/Core/NFNNode.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cn-uofbasel/nfn-applications path: /Core/NFNNode.py
from subprocess import *
from Core.Node import Node
from Util.Util import *
class NFNNode(Node):
def __init__(self, port, prefix=None, launch=False):
self.mgmt = '/tmp/mgmt-nfn-relay-' + str(port) + '.sock'
self.prefix = p... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/nfn-applications",
"path": "/Core/NFNNode.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luisenp/fastMRI path: /fastmri/__init__.py
"""
Copyright (c) Facebook, Inc. and its affiliates.
<|fim_suffix|>from .coil_combine import rss, rss_complex
from .losses import SSIMLoss
from .math import (
complex_abs,
complex_abs_sq,
complex_conj,
complex_mul,
fft2c,
fftshif... | code_fim | medium | {
"lang": "python",
"repo": "luisenp/fastMRI",
"path": "/fastmri/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .coil_combine import rss, rss_complex
from .losses import SSIMLoss
from .math import (
complex_abs,
complex_abs_sq,
complex_conj,
complex_mul,
fft2c,
fftshift,
ifft2c,
ifftshift,
roll,
tensor_to_complex_np,
)
from .mri_module import MriModule
from .utils import... | code_fim | medium | {
"lang": "python",
"repo": "luisenp/fastMRI",
"path": "/fastmri/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blthree/coral path: /coral/io/writers/fasta.py
'''Write genbank sequences.'''
import textwrap
def write_fasta(sequence, handle):
<|fim_suffix|> :param sequence: The sequence to write.
:type sequence: coral.DNA, coral.ssDNA, or coral.RNA
:param handle: File handle (i.e. the output of ... | code_fim | medium | {
"lang": "python",
"repo": "blthree/coral",
"path": "/coral/io/writers/fasta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
lines = []
lines.append('>' + sequence.name)
lines += textwrap.wrap(str(sequence), 79)
handle.write('\n'.join(lines))<|fim_prefix|># repo: blthree/coral path: /coral/io/writers/fasta.py
'''Write genbank sequences.'''
import textwrap
def write_fasta(sequence, handle):
'''Writ... | code_fim | medium | {
"lang": "python",
"repo": "blthree/coral",
"path": "/coral/io/writers/fasta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#-------------
# glyph names
#-------------
def has_suffix(glyph_name, suffix):
has_suffix = False
nameParts = glyph_name.split(".")
if len(nameParts) == 2:
if nameParts[1] == suffix:
has_suffix = True
return has_suffix
def change_suffix(glyph_name, old_suffix, new_suffix=''):
_base_name = gly... | code_fim | hard | {
"lang": "python",
"repo": "sannorozco/hTools2",
"path": "/Lib/hTools2/modules/glyphutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sannorozco/hTools2 path: /Lib/hTools2/modules/glyphutils.py
# [h] hTools2.modules.glyphutils
#---------------
# side-bearings
#---------------
def centerGlyph(glyph):
whitespace = glyph.leftMargin + glyph.rightMargin
glyph.leftMargin = whitespace / 2
glyph.rightMargin = whitespace / 2
def r... | code_fim | hard | {
"lang": "python",
"repo": "sannorozco/hTools2",
"path": "/Lib/hTools2/modules/glyphutils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(glyph.anchors) > 0:
for anchor in glyph.anchors:
_x_round = round(float(anchor.x)/sizeX)
_y_round = round(float(anchor.y)/sizeY)
x_new = int(_x_round * sizeX)
y_new = int(_y_round * sizeY)
x_delta = x_new - anchor.x
y_delta = y_new - anchor.y
anchor.move((x_delta, y_delta))
... | code_fim | hard | {
"lang": "python",
"repo": "sannorozco/hTools2",
"path": "/Lib/hTools2/modules/glyphutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class SignatureIonExtractor(SignatureIonDetector):
'''Extracts signal for a set of target ions from each scan.
'''
def extract(self, peak_list, error_tolerance=2e-5):
result = {}
peak_list = PeakSetMethods(peak_list)
if peak_list.is_deconvoluted:
for sig in... | code_fim | hard | {
"lang": "python",
"repo": "WEHI-Proteomics/ms_deisotope",
"path": "/ms_deisotope/qc/signature.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WEHI-Proteomics/ms_deisotope path: /ms_deisotope/qc/signature.py
'''
'''
from collections import namedtuple
from numbers import Number
from ms_deisotope.utils import Base
from ms_deisotope.averagine import mass_charge_ratio
from ms_deisotope.data_source.scan.base import BasePeakMethods, PeakSet... | code_fim | hard | {
"lang": "python",
"repo": "WEHI-Proteomics/ms_deisotope",
"path": "/ms_deisotope/qc/signature.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Output label colors of write_label.
"""
xyz, labels = converter.check_label_colors(num_points, seed=seed, margin=margin)
write_pc_label(file_name, xyz, labels, seed=seed)
def write_pc_intensity(file_name, xyz, intensity):
rgb = converter.intensity_to_color(xyz, intensity)
... | code_fim | hard | {
"lang": "python",
"repo": "Obarads/torchpcp",
"path": "/torchpcp/utils/io/ply.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Obarads/torchpcp path: /torchpcp/utils/io/ply.py
import os, sys
import numpy as np
from plyfile import PlyData, PlyElement
from torchpcp.utils import converter
##
## Write
##
def write_pc(filename, xyz, rgb=None):
"""
write into a ply file
ref.:https://github.com/loicland/superpoi... | code_fim | hard | {
"lang": "python",
"repo": "Obarads/torchpcp",
"path": "/torchpcp/utils/io/ply.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def check_label_colors(file_name, num_points, seed=0, margin=0.5):
"""
Output label colors of write_label.
"""
xyz, labels = converter.check_label_colors(num_points, seed=seed, margin=margin)
write_pc_label(file_name, xyz, labels, seed=seed)
def write_pc_intensity(file_name, xyz, inte... | code_fim | medium | {
"lang": "python",
"repo": "Obarads/torchpcp",
"path": "/torchpcp/utils/io/ply.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ax1.plot(psonic, depth)
ax1.set_xlabel('P-Sonic')
ax2.plot(vp, depth)
ax2.set_xlabel('Vp')
ax3.plot(density, depth)
ax3.set_xlabel('Density')
ax4.plot(pimpedance, depth)
ax4.set_xlabel('P-Impednace')
for ax in fig.get_axes():
ax.grid(True)
ax.xaxis.set_ticks_position('top')
ax.xaxis.set_la... | code_fim | hard | {
"lang": "python",
"repo": "hyperiongeo/auralib",
"path": "/examples/read_las_data_example01.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# All plotting code below here...
fig = plt.figure(num=1)
fig.clf()
ax1 = fig.add_subplot(141)
ax2 = fig.add_subplot(142, sharey=ax1)
ax3 = fig.add_subplot(143, sharey=ax1)
ax4 = fig.add_subplot(144, sharey=ax1)
ax1.plot(psonic, depth)
ax1.set_xlabel('P-Sonic')
ax2.plot(vp, depth)
ax2.set_xlabel('Vp')... | code_fim | hard | {
"lang": "python",
"repo": "hyperiongeo/auralib",
"path": "/examples/read_las_data_example01.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyperiongeo/auralib path: /examples/read_las_data_example01.py
"""
Example script to illustrate how auralib may be used to read data from
LAS format data files.
Written by: Wes Hamlyn
Created: 1-Dec-2016
"""
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
impor... | code_fim | hard | {
"lang": "python",
"repo": "hyperiongeo/auralib",
"path": "/examples/read_las_data_example01.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Shell test.
qtapp = QtGui.QApplication(sys.argv)
app = ui.UI()
app.show()
sys.exit(qtapp.exec_())<|fim_prefix|># repo: chrisdevito/OScan path: /OScan/test.py
import os
import sys
DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, DIR)
import OScan
try:
relo... | code_fim | easy | {
"lang": "python",
"repo": "chrisdevito/OScan",
"path": "/OScan/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisdevito/OScan path: /OScan/test.py
import os
import sys
DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, DIR)
import OScan
<|fim_suffix|>if __name__ == '__main__':
#Shell test.
qtapp = QtGui.QApplication(sys.argv)
app = ui.UI()
app.show()
sys.exit... | code_fim | medium | {
"lang": "python",
"repo": "chrisdevito/OScan",
"path": "/OScan/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
#Shell test.
qtapp = QtGui.QApplication(sys.argv)
app = ui.UI()
app.show()
sys.exit(qtapp.exec_())<|fim_prefix|># repo: chrisdevito/OScan path: /OScan/test.py
import os
import sys
DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, DIR)
... | code_fim | medium | {
"lang": "python",
"repo": "chrisdevito/OScan",
"path": "/OScan/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # simple generator and rhs
# pylint: disable=unused-argument
def generator(t):
return -1j * 2 * np.pi * self.X / 2
self.basic_generator = generator
def _fixed_step_LMDE_method_tests(self, method):
results = solve_lmde(
self.basic_genera... | code_fim | hard | {
"lang": "python",
"repo": "averyparr/qiskit-dynamics",
"path": "/test/dynamics/test_solve_lmde.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> output = generator(t, in_frame_basis=True).data
X = np.array(self.X.data)
X_diag, U = np.linalg.eigh(X)
Uadj = U.conj().transpose()
gen = (
-1j
* 2
* np.pi
* (self.w * np.array(self.Z.data) / 2 + self.r * np.cos(2 * n... | code_fim | hard | {
"lang": "python",
"repo": "averyparr/qiskit-dynamics",
"path": "/test/dynamics/test_solve_lmde.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: averyparr/qiskit-dynamics path: /test/dynamics/test_solve_lmde.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree... | code_fim | hard | {
"lang": "python",
"repo": "averyparr/qiskit-dynamics",
"path": "/test/dynamics/test_solve_lmde.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> add_form = FindanceUserCreationForm
form = FindanceUserChangeForm
model = FindanceUser
list_display = ['email', 'username', 'is_staff', 'is_superuser']
admin.site.register(FindanceUser, FindanceUserAdmin)<|fim_prefix|># repo: mccartnm/findance path: /findance/users/admin.py
from django.c... | code_fim | easy | {
"lang": "python",
"repo": "mccartnm/findance",
"path": "/findance/users/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mccartnm/findance path: /findance/users/admin.py
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from .forms import FindanceUserCreationForm, FindanceUserChangeForm
from .models import FindanceUser
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "mccartnm/findance",
"path": "/findance/users/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gagneurlab/gfeat path: /gfeat/transcript.py
import pyensembl
import re
from itertools import product
import pandas as pd
import numpy as np
class GFTranscript(pyensembl.Transcript):
def __init__(self,
transcript_id: object = None,
transcript_name: object = ... | code_fim | hard | {
"lang": "python",
"repo": "gagneurlab/gfeat",
"path": "/gfeat/transcript.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> seq = CDS_seq[len(CDS_seq)-9:] + utr3_seq[:6]
return seq
def get_stop_codon_context_as_df(self):
"""
Get a line of stop codon context matrix for this transcript (6 elements upstream, start codon and 6 elements
downstream)
:return: pandas.DataFrame,
... | code_fim | hard | {
"lang": "python",
"repo": "gagneurlab/gfeat",
"path": "/gfeat/transcript.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hoangt/misoc path: /misoclib/tools/litescope/example_designs/targets/simple.py
from migen.bank.description import *
from migen.genlib.io import CRG
from misoclib.soc import SoC
from misoclib.tools.litescope.common import *
from misoclib.tools.litescope.core.port import LiteScopeTerm
from misocli... | code_fim | hard | {
"lang": "python",
"repo": "hoangt/misoc",
"path": "/misoclib/tools/litescope/example_designs/targets/simple.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.submodules.io = LiteScopeIO(8)
for i in range(8):
try:
self.comb += platform.request("user_led", i).eq(self.io.o[i])
except:
pass
self.submodules.counter0 = counter0 = Counter(8)
self.submodules.counter1 = counte... | code_fim | hard | {
"lang": "python",
"repo": "hoangt/misoc",
"path": "/misoclib/tools/litescope/example_designs/targets/simple.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: magma/magma path: /lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to... | code_fim | hard | {
"lang": "python",
"repo": "magma/magma",
"path": "/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> sec_mode_complete = s1ap_types.ueSecModeComplete_t()
sec_mode_complete.ue_Id = req.ue_id
self._s1ap_wrapper._s1_util.issue_cmd(
s1ap_types.tfwCmd.UE_SEC_MOD_COMPLETE,
sec_mode_complete,
)
# Receive initial context setup and attach accept ind... | code_fim | hard | {
"lang": "python",
"repo": "magma/magma",
"path": "/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._s1ap_wrapper._s1_util.issue_cmd(
s1ap_types.tfwCmd.UE_AUTH_RESP,
auth_res,
)
response = self._s1ap_wrapper.s1_util.get_response()
assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value
sec_mode_complete = s1ap_types.ueS... | code_fim | hard | {
"lang": "python",
"repo": "magma/magma",
"path": "/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fridgeresearch/kitchen path: /backend/python/rfid/rfid_tag_read.py
"""
The MIT License (MIT)
Copyright (c) 2016 Jake Lussier (Stanford University)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | code_fim | hard | {
"lang": "python",
"repo": "fridgeresearch/kitchen",
"path": "/backend/python/rfid/rfid_tag_read.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RfidArrivalClassifier:
"""Class for classifying whether or not an RFID tag just arrived
Attributes:
None
"""
def eval(self, antenna_data, stable_start, stable_end):
score = 0.0
for (antenna, data) in antenna_data.items():
for (time, rssi) in d... | code_fim | hard | {
"lang": "python",
"repo": "fridgeresearch/kitchen",
"path": "/backend/python/rfid/rfid_tag_read.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mumblepins/Pyecobee path: /pyecobee/objects/user.py
"""
This module is home to the User class
"""
from pyecobee.ecobee_object import EcobeeObject
class User(EcobeeObject):
"""
This class has been auto generated by scraping
https://www.ecobee.com/home/developer/api/documentation/v1/o... | code_fim | hard | {
"lang": "python",
"repo": "mumblepins/Pyecobee",
"path": "/pyecobee/objects/user.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Gets the user_name attribute of this User instance.
:return: The value of the user_name attribute of this User instance.
:rtype: six.text_type
"""
return self._user_name
@property
def display_name(self):
"""
Gets the display_na... | code_fim | hard | {
"lang": "python",
"repo": "mumblepins/Pyecobee",
"path": "/pyecobee/objects/user.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shiandy/epi507-project path: /Snakefile
CHROM = list(map(str, range(1, 23)))
CHROM.append("X")
# run all, default
rule all:
input:
"manhattan.png",
"manhattan_23111.png"
# get individuals of GBR ancestry
rule get_indiv:
input:
"1000-genomes/integrated_call_sample... | code_fim | hard | {
"lang": "python",
"repo": "shiandy/epi507-project",
"path": "/Snakefile",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Filter, keep MAF >= 0.05 and GBR ancestry. Had to tweak slightly to
# work for X chromosome
rule vcf_to_plink_X:
input:
"1000-genomes/ALL.chrX.phase3_shapeit2_mvncall_integrated_v1b.20130502.genotypes.vcf.gz"
output:
"1000-genomes/GBR_chrX.ped",
"1000-genomes/GBR_chrX.map... | code_fim | hard | {
"lang": "python",
"repo": "shiandy/epi507-project",
"path": "/Snakefile",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for image1, image2 in combinations(images, r=2):
assert image1 != image2<|fim_prefix|># repo: NachbarStrom/public-python-nachbarstrom-commons path: /tests/image_provider/test_google_image_provider.py
from itertools import combinations
import pytest
from nachbarstrom.commons.image_provider.go... | code_fim | hard | {
"lang": "python",
"repo": "NachbarStrom/public-python-nachbarstrom-commons",
"path": "/tests/image_provider/test_google_image_provider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NachbarStrom/public-python-nachbarstrom-commons path: /tests/image_provider/test_google_image_provider.py
from itertools import combinations
import pytest
from nachbarstrom.commons.image_provider.google_image_provider import MapType, \
GoogleImageProvider
from nachbarstrom.commons.world impo... | code_fim | hard | {
"lang": "python",
"repo": "NachbarStrom/public-python-nachbarstrom-commons",
"path": "/tests/image_provider/test_google_image_provider.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.