text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> mixin = InteractiveMixin()
monkeypatch.setattr('sys.stdin', StringIO('test_login_321'))
assert mixin.user_login == 'test_login_321'
mixin.user_login = None
assert mixin.user_login == 'test_login_321'
monkeypatch.setattr('getpass.getpass', lambda *args, **kwargs: '123_test_passwo... | code_fim | hard | {
"lang": "python",
"repo": "voronind/vk",
"path": "/tests/test_session.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: voronind/vk path: /tests/test_session.py
import logging
from io import StringIO
from os import urandom
import pytest
from vk import API, CommunityAPI, DirectUserAPI, UserAPI
from vk.exceptions import VkAuthError
from vk.session import InteractiveMixin
@pytest.fixture(scope='module', autouse=T... | code_fim | hard | {
"lang": "python",
"repo": "voronind/vk",
"path": "/tests/test_session.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_interactive_mixin(monkeypatch):
mixin = InteractiveMixin()
monkeypatch.setattr('sys.stdin', StringIO('test_login_321'))
assert mixin.user_login == 'test_login_321'
mixin.user_login = None
assert mixin.user_login == 'test_login_321'
monkeypatch.setattr('getpass.getpass'... | code_fim | hard | {
"lang": "python",
"repo": "voronind/vk",
"path": "/tests/test_session.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kfinny/avclass-lib path: /kfinny/avclass/__init__.py
from pkg_resources import get_distribution, DistributionNotFound
from .avclass import *
from .labeler import *
<|fim_suffix|>__all__ = ("SampleInfo",
"LabeledSample",
"AvLabels",
"Detector",
"Labeler... | code_fim | medium | {
"lang": "python",
"repo": "kfinny/avclass-lib",
"path": "/kfinny/avclass/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ("SampleInfo",
"LabeledSample",
"AvLabels",
"Detector",
"Labeler",
"GroundTruth")<|fim_prefix|># repo: kfinny/avclass-lib path: /kfinny/avclass/__init__.py
from pkg_resources import get_distribution, DistributionNotFound
from .avclass impor... | code_fim | medium | {
"lang": "python",
"repo": "kfinny/avclass-lib",
"path": "/kfinny/avclass/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XIVN1987/RTTView path: /pyocd/utility/notification.py
# pyOCD debugger
# Copyright (c) 2016 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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 c... | code_fim | hard | {
"lang": "python",
"repo": "XIVN1987/RTTView",
"path": "/pyocd/utility/notification.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def notify(self, *notifications):
for note in notifications:
# This debug log is commented out because it produces too much output unless you
# are specifically working on notifications.
# logging.debug("Sending notification: %s", repr(note))
for... | code_fim | hard | {
"lang": "python",
"repo": "XIVN1987/RTTView",
"path": "/pyocd/utility/notification.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isados/gsheets-event-planner path: /tests.py
import unittest
from unittest import TestCase
from pandas import Series
from run import generate_rrule_pattern, GoogleEvent
class GenerateRrulePatternTests(TestCase):
def test_weekly_sunday(self):
real_pattern = "RRULE:FREQ=WEEKLY;BYDAY=S... | code_fim | hard | {
"lang": "python",
"repo": "isados/gsheets-event-planner",
"path": "/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_not_missing(self):
series = Series({"Name": "Yusuf",
"Duration": "0:05",
"Time": "10pm",
"Start Date": "Not Today"
})
self.assertEqual(self.func(series), False)
def test_n... | code_fim | hard | {
"lang": "python",
"repo": "isados/gsheets-event-planner",
"path": "/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chartbeat-labs/textacy path: /tests/augmentation/test_augmenter.py
import functools
import pytest
from spacy.tokens import Doc
from textacy.augmentation import augmenter, transforms
@pytest.fixture(scope="module")
def example_augmenter():
return augmenter.Augmenter(
[
... | code_fim | hard | {
"lang": "python",
"repo": "chartbeat-labs/textacy",
"path": "/tests/augmentation/test_augmenter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_doc1 = example_augmenter.apply_transforms(doc_en, lang="en_core_web_sm")
new_doc2 = example_augmenter.apply_transforms(doc_en, lang="en_core_web_sm")
assert isinstance(new_doc1, Doc)
assert new_doc1.text != doc_en.text
assert new_doc1.text != new_doc2.text<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "chartbeat-labs/textacy",
"path": "/tests/augmentation/test_augmenter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dnlcrl/ig-bot path: /pyig/main.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Best Times to Post on Instagram by Day of the Week
Sunday: 5:00 p.m. -> 11:00 PM -> 23:00
Monday: 7:00 p.m. & 10:00 p.m. -> 1 am & 4 am -> 01:00 $ 04:00
Tuesday: 3:00 a.m. & 10:00 p.m. -> 9 pm & 4 am -> 21:00 $ ... | code_fim | hard | {
"lang": "python",
"repo": "dnlcrl/ig-bot",
"path": "/pyig/main.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|># load following users
with open('following', 'r') as f:
following = f.read().splitlines()
following = [int(fo) for fo in following]
def about_an_hour():
return 5400 + randint(-1800, 1800)
def about_a_minute():
return 90 + randint(-30, 30)
def about_a_second():
return uniform(1.5, 2... | code_fim | hard | {
"lang": "python",
"repo": "dnlcrl/ig-bot",
"path": "/pyig/main.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gomnitrix/ISC_Lab path: /network/main.py
import fire
import torch
import random
import torch.nn as nn
from torch.utils.data import DataLoader
from torchnet import meter
from network import models
from network.config import opt
from network.data import DataFlow, TestDataFlow, EncTestData... | code_fim | hard | {
"lang": "python",
"repo": "gomnitrix/ISC_Lab",
"path": "/network/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> vis.plot('val_accuracy', val_accuracy + random.uniform(13, 15))
vis.log(
'epoch:{epoch},lr:{lr},loss:{loss},train_cm:{train_cm},val_cm:{val_cm}'
.format(epoch=epoch,
loss=loss_meter.value()[0],
val_cm=str(val_... | code_fim | hard | {
"lang": "python",
"repo": "gomnitrix/ISC_Lab",
"path": "/network/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sezinbhr/bulut_bil path: /exam/migrations/0017_auto_20210223_0201.py
# Generated by Django 2.2.7 on 2021-02-22 23:01
from django.db import migrations
<|fim_suffix|>
dependencies = [
('exam', '0016_auto_20210217_1631'),
]
operations = [
migrations.AlterModelOptions(... | code_fim | easy | {
"lang": "python",
"repo": "sezinbhr/bulut_bil",
"path": "/exam/migrations/0017_auto_20210223_0201.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name='exam',
options={'ordering': ('start_date_time', 'exam_name')},
),
migrations.AlterModelTable(
name='exam',
table='sınavlar',
),
]<|fim_prefix|># repo: sezinbhr/bulut_b... | code_fim | medium | {
"lang": "python",
"repo": "sezinbhr/bulut_bil",
"path": "/exam/migrations/0017_auto_20210223_0201.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wmles/scholarium path: /Veranstaltungen/views.py
from django.shortcuts import get_object_or_404, render
from django.core.urlresolvers import reverse
from .models import *
from Grundgeruest.views import ListeMitMenue
<|fim_suffix|> """ Stellt Liste aller Veranstaltungen dar
"""
templa... | code_fim | medium | {
"lang": "python",
"repo": "wmles/scholarium",
"path": "/Veranstaltungen/views.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Stellt Liste der Seminare oder Salons dar
"""
template_name = 'Veranstaltungen/liste_art.html'
paginate_by = 2
def get_queryset(self, **kwargs):
art_name = self.kwargs['art']
art = get_object_or_404(ArtDerVeranstaltung, bezeichnung=art_name)
return Veranstal... | code_fim | medium | {
"lang": "python",
"repo": "wmles/scholarium",
"path": "/Veranstaltungen/views.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/mmdetection/tests/test_models/test_dense_heads/test_reppoints_head.py
import unittest
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from parameterized import parameterized
from mmdet.models.dense_heads import Rep... | code_fim | hard | {
"lang": "python",
"repo": "alldatacenter/alldata",
"path": "/ai/mmdetection/tests/test_models/test_dense_heads/test_reppoints_head.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # When truth is non-empty then both cls and pts loss should be nonzero
# for random inputs
gt_instances = InstanceData()
gt_instances.bboxes = torch.Tensor(
[[23.6667, 23.8757, 238.6326, 151.8874]])
gt_instances.labels = torch.LongTensor([2])
one... | code_fim | hard | {
"lang": "python",
"repo": "alldatacenter/alldata",
"path": "/ai/mmdetection/tests/test_models/test_dense_heads/test_reppoints_head.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blokje/sqlalchemy2-stubs path: /sqlalchemy-stubs/ext/declarative/extensions.pyi
from typing import Any
from ... import inspection as inspection
from ... import util as util
from ...orm import registry as registry
from ...orm import relationships as relationships
from ...orm.util import polymorph... | code_fim | medium | {
"lang": "python",
"repo": "blokje/sqlalchemy2-stubs",
"path": "/sqlalchemy-stubs/ext/declarative/extensions.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AbstractConcreteBase(ConcreteBase):
__no_table__: bool = ...
@classmethod
def __declare_first__(cls) -> None: ...
class DeferredReflection:
@classmethod
def prepare(cls, engine: Any) -> None: ...<|fim_prefix|># repo: blokje/sqlalchemy2-stubs path: /sqlalchemy-stubs/ext/declarat... | code_fim | medium | {
"lang": "python",
"repo": "blokje/sqlalchemy2-stubs",
"path": "/sqlalchemy-stubs/ext/declarative/extensions.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def __declare_first__(cls) -> None: ...
class AbstractConcreteBase(ConcreteBase):
__no_table__: bool = ...
@classmethod
def __declare_first__(cls) -> None: ...
class DeferredReflection:
@classmethod
def prepare(cls, engine: Any) -> None: ...<|fim_prefix|># repo: ... | code_fim | medium | {
"lang": "python",
"repo": "blokje/sqlalchemy2-stubs",
"path": "/sqlalchemy-stubs/ext/declarative/extensions.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ExampleDatabase(Database):
"""
This Database child class only overwrites the Database initialization by passing the ExampleConnection class.
If additional parameters are to be handed to the new Connection class, this could be done by additionally overwriting
get_connection.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "INWTlab/dbrequests",
"path": "/examples/connection_subclass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: INWTlab/dbrequests path: /examples/connection_subclass.py
from dbrequests import Connection
from dbrequests import Database
from docker import from_env
class ExampleConnection(Connection):
"""
Within this example, we inherit everything from the Connection class, but overwrite bulk_query... | code_fim | hard | {
"lang": "python",
"repo": "INWTlab/dbrequests",
"path": "/examples/connection_subclass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
"""We test the example by setting up a mariadb database to run our new model against"""
creds = {
'user': 'root',
'password': 'root',
'host': '127.0.0.1',
'db': 'test',
'port': 3307
}
client = from_env()
container = cl... | code_fim | hard | {
"lang": "python",
"repo": "INWTlab/dbrequests",
"path": "/examples/connection_subclass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 15ramky/remove_control_chars path: /remove_control_chars.py
#! /usr/bin/python
import os
import anim
def parse_each(each_file):
out_file = each_file+str(".result")
out_f = open(out_file, "w")
<|fim_suffix|> out_f.write(line)
anim.screen_anim(" -- DONE\n")
# taking... | code_fim | hard | {
"lang": "python",
"repo": "15ramky/remove_control_chars",
"path": "/remove_control_chars.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># taking all the .data files in the current directory
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for each_file in files:
if each_file.split('.')[-1] == "data":
parse_each(each_file)<|fim_prefix|># repo: 15ramky/remove_control_chars path: /remove_control_chars.py
#! /usr/bin/python
impo... | code_fim | hard | {
"lang": "python",
"repo": "15ramky/remove_control_chars",
"path": "/remove_control_chars.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_convert_simulations(self) -> None:
events = pd.DataFrame(
[
{
"type_id": 8,
"subtype_name": "Cross",
"tags": [{"id": 402}, {"id": 801}, {"id": 1801}],
"player_id": 20472,
... | code_fim | hard | {
"lang": "python",
"repo": "ML-KULeuven/socceraction",
"path": "/tests/spadl/test_wyscout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_convert_simulations_precede_by_take_on(self) -> None:
events = pd.DataFrame(
[
{
"type_id": 1,
"subtype_name": "Ground attacking duel",
"tags": [{"id": 503}, {"id": 701}, {"id": 1802}],
... | code_fim | hard | {
"lang": "python",
"repo": "ML-KULeuven/socceraction",
"path": "/tests/spadl/test_wyscout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ML-KULeuven/socceraction path: /tests/spadl/test_wyscout.py
import os
import pandas as pd
from socceraction.data.wyscout import PublicWyscoutLoader
from socceraction.spadl import SPADLSchema
from socceraction.spadl import config as spadl
from socceraction.spadl import wyscout as wy
class Test... | code_fim | hard | {
"lang": "python",
"repo": "ML-KULeuven/socceraction",
"path": "/tests/spadl/test_wyscout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _name = "hr.holidays.status.type"
_description = 'Type de permission'
name = fields.Char('Type de permission')
limit = fields.Float('Limite')
proof = fields.Char('Justificatif')<|fim_prefix|># repo: mefiskafka/aro_hr path: /models/hr_holidays_status_type.py
# -*- coding: utf-8 -*-
fr... | code_fim | easy | {
"lang": "python",
"repo": "mefiskafka/aro_hr",
"path": "/models/hr_holidays_status_type.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_name = "hr.holidays.status.type"
_description = 'Type de permission'
name = fields.Char('Type de permission')
limit = fields.Float('Limite')
proof = fields.Char('Justificatif')<|fim_prefix|># repo: mefiskafka/aro_hr path: /models/hr_holidays_status_type.py
# -*- coding: utf-8 -*-
f... | code_fim | easy | {
"lang": "python",
"repo": "mefiskafka/aro_hr",
"path": "/models/hr_holidays_status_type.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mefiskafka/aro_hr path: /models/hr_holidays_status_type.py
# -*- coding: utf-8 -*-
from openerp import models, api, fields, tools, _
import logging
_logger = logging.getLogger(__name__)
<|fim_suffix|>
_name = "hr.holidays.status.type"
_description = 'Type de permission'
name = field... | code_fim | easy | {
"lang": "python",
"repo": "mefiskafka/aro_hr",
"path": "/models/hr_holidays_status_type.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VTimofeenko/confluence_poster path: /tests/unit tests/test_config_wizard_helpers.py
from tomlkit import parse
import io
from pathlib import Path
# noinspection PyProtectedMember
from confluence_poster.config_wizard import (
_create_or_update_attribute as create_update_attr,
)
# noinspection... | code_fim | hard | {
"lang": "python",
"repo": "VTimofeenko/confluence_poster",
"path": "/tests/unit tests/test_config_wizard_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_dialog_parameter_methods():
inner_string = "title"
d1 = DialogParameter(inner_string)
d2 = DialogParameter(inner_string)
d3 = DialogParameter(inner_string + "2")
assert d1 == d2
assert d1 != d3
assert d1 == inner_string
with pytest.raises(ValueError):
asse... | code_fim | hard | {
"lang": "python",
"repo": "VTimofeenko/confluence_poster",
"path": "/tests/unit tests/test_config_wizard_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Extract variables from the dictionary
continuous_schedule = cohesity_management_sdk.models.continuous_schedule.ContinuousSchedule.from_dictionary(dictionary.get('continuousSchedule')) if dictionary.get('continuousSchedule') else None
daily_schedule = cohesity_management_sdk.model... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/scheduling_policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/scheduling_policy.py
# -*- coding: utf-8 -*-
# Copyright 2023 Cohesity Inc.
import cohesity_management_sdk.models.continuous_schedule
import cohesity_management_sdk.models.daily_schedule
import cohesity_management_sdk.models.mo... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/scheduling_policy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match prope... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/scheduling_policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>param_test1 = {'max_depth':range(3,10,1)}
train_set = lgb.Dataset(data=train_X, label=train_Y)
estimator = lgb.LGBMClassifier(objective='binary',
metric='auc',
device = 'gpu',
gpu_platform_id = 0,
... | code_fim | hard | {
"lang": "python",
"repo": "batumoglu/Kaggle_Home_Credit_Competition",
"path": "/LightGBM_GPU_GridSearch_v1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: batumoglu/Kaggle_Home_Credit_Competition path: /LightGBM_GPU_GridSearch_v1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 23 02:12:25 2018
@author: ozkan
"""
import pandas as pd
import numpy as np
from sklearn.metrics import roc_auc_score
import gc
from sklearn.model_s... | code_fim | hard | {
"lang": "python",
"repo": "batumoglu/Kaggle_Home_Credit_Competition",
"path": "/LightGBM_GPU_GridSearch_v1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = commandline_args()
sample_cluster_dict = create_sample_dictionary(args.clustered_scanpy_obj[0])
generate_cluster_ranking_output_file(sample_cluster_dict, args.output_cluster_rankings[0])
if __name__ == '__main__':
main()<|fim_prefix|># repo: Stuartlab-UCSC/cell-atlas-env path: /... | code_fim | hard | {
"lang": "python",
"repo": "Stuartlab-UCSC/cell-atlas-env",
"path": "/cluster/exportClusterRankings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return parser.parse_args()
def create_sample_dictionary(sample_path):
"""
Creates a sample dictionary to store the scanpy anndata object
:param sample_path: A string that is the path to the sample's scanpy h5ad object
return:
sample_dict: A dictionary where the key is the sample ... | code_fim | hard | {
"lang": "python",
"repo": "Stuartlab-UCSC/cell-atlas-env",
"path": "/cluster/exportClusterRankings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Stuartlab-UCSC/cell-atlas-env path: /cluster/exportClusterRankings.py
import argparse
import scanpy.api as sc
from scanpyLibrary import *
def commandline_args():
"""
Command line arguments
"""
parser = argparse.ArgumentParser(description = "This program takes a clustered scanpy ... | code_fim | hard | {
"lang": "python",
"repo": "Stuartlab-UCSC/cell-atlas-env",
"path": "/cluster/exportClusterRankings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dumengnan/unicorn path: /06source_code/tools/findu/unicorn/find/find_you_factory.py
#!/usr/bin/env python
# encoding: utf-8
class FindU(object):
def __init__(self, domain):
self.domain = domain
class RegistrarA(Registrar):
@classmethod
def is_registrar_for(cls, domain):
return dom... | code_fim | medium | {
"lang": "python",
"repo": "dumengnan/unicorn",
"path": "/06source_code/tools/findu/unicorn/find/find_you_factory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def Domain(domain):
for cls in Registrar.__subclasses__():
if cls.is_registrar_for(domain):
return cls(domain)
raise ValueError
print Domain('foo.com')
print Domain('bar.com')<|fim_prefix|># repo: dumengnan/unicorn path: /06source_code/tools/findu/unicorn/find/find_you_factory.py
#!/usr/... | code_fim | medium | {
"lang": "python",
"repo": "dumengnan/unicorn",
"path": "/06source_code/tools/findu/unicorn/find/find_you_factory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SachinKonan/Windows-RPI-Vision-Framework path: /VisionCode/SlidingHanningWindow.py
from scipy import stats
from scipy import linalg
import numpy as np
import matplotlib.pyplot as plt
N = 1996
threshold = 20
breakinto = 8
loop =int(N/threshold)
windowlen = 400
x = [0 for h in range(0,N)]
... | code_fim | hard | {
"lang": "python",
"repo": "SachinKonan/Windows-RPI-Vision-Framework",
"path": "/VisionCode/SlidingHanningWindow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>or j in range(0,breakinto):
for k in range(0,windowlen):
window[k] = w[k + int(windowlen-171.429)*j] * 0.5 * (1 - np.cos((2 * np.pi * k)/ (N - 1)));
x3[k] = k + int(windowlen-171.429)*j
a = np.cov(x3)
e_vals, e_vecs = linalg.eig(A)
plt.plot(x3,window)
plt.p... | code_fim | hard | {
"lang": "python",
"repo": "SachinKonan/Windows-RPI-Vision-Framework",
"path": "/VisionCode/SlidingHanningWindow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bitgrin/grin-pool path: /grin-py/services/grinStats.py
#!/usr/bin/python
# Copyright 2018 Blade M. Doyle
# 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://w... | code_fim | hard | {
"lang": "python",
"repo": "bitgrin/grin-pool",
"path": "/grin-py/services/grinStats.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> check_interval = float(CONFIG[PROCESS]["check_interval"])
avg_over_range = int(CONFIG[PROCESS]["avg_over_range"])
# Find the height of the latest stats record
last_height = 0
latest_stat = Grin_stats.get_latest()
print("latest_stat = {}".format(latest_stat))
if latest_stat ==... | code_fim | hard | {
"lang": "python",
"repo": "bitgrin/grin-pool",
"path": "/grin-py/services/grinStats.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.driver.find_element_by_id("addAssessmentBtn")
def assessment_type(self):
return self.driver.find_element_by_id("assessment-type")
def assessment_title(self):
return self.driver.find_element_by_id("assessment-title")
def create_assessment_button(self):
... | code_fim | medium | {
"lang": "python",
"repo": "AssessmentHQ/assessment-tracker",
"path": "/PythonAPI/features/pages/batch_home_page.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AssessmentHQ/assessment-tracker path: /PythonAPI/features/pages/batch_home_page.py
from selenium.webdriver.chrome.webdriver import WebDriver
class BatchHomePage:
def __init__(self, driver: WebDriver):
self.driver = driver
def add_assessment_button(self):
return self.dr... | code_fim | medium | {
"lang": "python",
"repo": "AssessmentHQ/assessment-tracker",
"path": "/PythonAPI/features/pages/batch_home_page.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.driver.find_element_by_xpath('//*[@id="createAssessmentForm"]/div[4]/button[2]')<|fim_prefix|># repo: AssessmentHQ/assessment-tracker path: /PythonAPI/features/pages/batch_home_page.py
from selenium.webdriver.chrome.webdriver import WebDriver
class BatchHomePage:
<|fim_middle|>
... | code_fim | hard | {
"lang": "python",
"repo": "AssessmentHQ/assessment-tracker",
"path": "/PythonAPI/features/pages/batch_home_page.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: godzilla-but-nicer/INFO590-term-project path: /scripts/vcftools_pi.py
import sys
import os
# command line args
vcf_file = sys.argv[1]
window_size = int(sys.argv[2])
step_size = int(sys.argv[3])
<|fim_suffix|>os.system('vcftools --vcf ' + vcf_file + '--window-pi ' + window_size + '--window-pi-st... | code_fim | medium | {
"lang": "python",
"repo": "godzilla-but-nicer/INFO590-term-project",
"path": "/scripts/vcftools_pi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>os.system('vcftools --vcf ' + vcf_file + '--window-pi ' + window_size + '--window-pi-step ' + step_size + '--out ' + path + simple_sample)<|fim_prefix|># repo: godzilla-but-nicer/INFO590-term-project path: /scripts/vcftools_pi.py
import sys
import os
# command line args
vcf_file = sys.argv[1]
window_siz... | code_fim | medium | {
"lang": "python",
"repo": "godzilla-but-nicer/INFO590-term-project",
"path": "/scripts/vcftools_pi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gafderks/dbase path: /users/tests/factories/group.py
import factory
from django.utils.text import slugify
from users.models import Group
class GroupFactory(factory.django.DjangoModelFactory):
class Meta:
model = Group
<|fim_suffix|> name_base = factory.Faker("company")
... | code_fim | easy | {
"lang": "python",
"repo": "gafderks/dbase",
"path": "/users/tests/factories/group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = factory.LazyAttributeSequence(lambda o, n: f"{o.name_base} {n}")
slug = factory.LazyAttribute(lambda o: slugify(o.name))
type = factory.Iterator([Group.GroupType.GROUP, Group.GroupType.COMMISSION])<|fim_prefix|># repo: gafderks/dbase path: /users/tests/factories/group.py
import factory... | code_fim | medium | {
"lang": "python",
"repo": "gafderks/dbase",
"path": "/users/tests/factories/group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Group
class Params:
name_base = factory.Faker("company")
name = factory.LazyAttributeSequence(lambda o, n: f"{o.name_base} {n}")
slug = factory.LazyAttribute(lambda o: slugify(o.name))
type = factory.Iterator([Group.GroupType.GROUP, Group.GroupType.COMMISSION])<|f... | code_fim | medium | {
"lang": "python",
"repo": "gafderks/dbase",
"path": "/users/tests/factories/group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> version = int(request.args.get('version'))
contests = [convert_to_dict(row) for row in ContestInfo.query.filter(ContestInfo.contestID>version).all()]
return response_with_code('<success>', contests)<|fim_prefix|># repo: it-intensive-programming2/recipe_helper path: /Server/contest/view.py
im... | code_fim | medium | {
"lang": "python",
"repo": "it-intensive-programming2/recipe_helper",
"path": "/Server/contest/view.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: it-intensive-programming2/recipe_helper path: /Server/contest/view.py
import json, time
from datetime import datetime
from flask import jsonify, make_response, escape, Blueprint, request, session, current_app as app
from sqlalchemy import text, desc
from main.extensions import *
from main.model i... | code_fim | medium | {
"lang": "python",
"repo": "it-intensive-programming2/recipe_helper",
"path": "/Server/contest/view.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kinkerl/giturlparse path: /giturlparse/parser.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from collections import defaultdict
from .platforms import PLATFORMS
SUPPORTED_ATTRIBUTES = (
'domain',
'repo',
'owner',
'_user',
... | code_fim | hard | {
"lang": "python",
"repo": "kinkerl/giturlparse",
"path": "/giturlparse/parser.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Skip if domain is bad
domain = match.group('domain')
# print('[%s] DOMAIN = %s' % (url, domain,))
if check_domain:
if platform.DOMAINS and not (domain in platform.DOMAINS):
# print("domain: %s not in %s" % (domain, platf... | code_fim | hard | {
"lang": "python",
"repo": "kinkerl/giturlparse",
"path": "/giturlparse/parser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matrix-org/synapse path: /synapse/rest/synapse/client/pick_idp.py
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "matrix-org/synapse",
"path": "/synapse/rest/synapse/client/pick_idp.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if we need to pick an IdP, do so
if not idp:
return await self._serve_id_picker(request, client_redirect_url)
# otherwise, redirect to the IdP's redirect URI
providers = self._sso_handler.get_identity_providers()
auth_provider = providers.get(idp)
... | code_fim | hard | {
"lang": "python",
"repo": "matrix-org/synapse",
"path": "/synapse/rest/synapse/client/pick_idp.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mozman/ezdxf path: /docs/source/tutorials/src/ocs/polyline3d.py
# Copyright (c) 2018-2020 Manfred Moitzi
# License: MIT License
import math
import ezdxf
from ezdxf.math import UCS, Matrix44
from pathlib import Path
OUT_DIR = Path('~/Desktop/Outbox').expanduser()
doc = ezdxf.new('R2010')
msp = d... | code_fim | hard | {
"lang": "python",
"repo": "mozman/ezdxf",
"path": "/docs/source/tutorials/src/ocs/polyline3d.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># add lines from center to corners
center_wcs = ucs.to_wcs((0, .333, .333))
for corner in corners_wcs:
msp.add_line(center_wcs, corner, dxfattribs={'color': 1})
ucs.render_axis(msp)
doc.saveas(OUT_DIR / 'ucs_polyline3d.dxf')<|fim_prefix|># repo: mozman/ezdxf path: /docs/source/tutorials/src/ocs/poly... | code_fim | hard | {
"lang": "python",
"repo": "mozman/ezdxf",
"path": "/docs/source/tutorials/src/ocs/polyline3d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('evaluation', '0010_fill_textanswer_state'),
]
operations = [
migrations.RemoveField(
model_name='textanswer',
name='checked',
),
migrations.RemoveField(
model_name='textanswer',
name='hidden',
... | code_fim | medium | {
"lang": "python",
"repo": "hendraet/EvaP",
"path": "/evap/evaluation/migrations/0011_remove_textanswer_checked_and_hidden.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hendraet/EvaP path: /evap/evaluation/migrations/0011_remove_textanswer_checked_and_hidden.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('evaluation', '0010_fill_textanswer_state'),
]
... | code_fim | easy | {
"lang": "python",
"repo": "hendraet/EvaP",
"path": "/evap/evaluation/migrations/0011_remove_textanswer_checked_and_hidden.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='textanswer',
name='checked',
),
migrations.RemoveField(
model_name='textanswer',
name='hidden',
),
]<|fim_prefix|># repo: hendraet/EvaP path: /evap/evaluation/migrati... | code_fim | medium | {
"lang": "python",
"repo": "hendraet/EvaP",
"path": "/evap/evaluation/migrations/0011_remove_textanswer_checked_and_hidden.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
import json,os
import textwrap, string, pprint
text = u'''1- Introduction
The resource had some accessibility features that were achieved by keeping the document Microsoft® Office Word based, thereby accessible for students using assistive technologies such as scree... | code_fim | hard | {
"lang": "python",
"repo": "vanch3d/pyEssayAnalyser",
"path": "/src/api_handlers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vanch3d/pyEssayAnalyser path: /src/api_handlers.py
# coding=utf-8
'''
Created on 14 Mar 2013
@author: Nicolas Van Labeke (https://github.com/vanch3d)
'''
from EssayAnalyser.se_main_v3 import top_level_procedure
## @todo: Added for backward compatibility with Python 2.6 (linux)
import sys
if sy... | code_fim | hard | {
"lang": "python",
"repo": "vanch3d/pyEssayAnalyser",
"path": "/src/api_handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UCLA-VAST/AutoBridge path: /src/autobridge/Device/DeviceManager.py
'[XY](\d+)', pblock_def)] # DownLeft & UpRight
# treat the pseudo SLR with 0 area
UR_y = min(self.CR_NUM_VERTICAL-1, UR_y)
area = {
'BRAM' : 0,
'DSP' : 0,
'FF' : 0,
'LUT' : 0,
'URAM' : ... | code_fim | hard | {
"lang": "python",
"repo": "UCLA-VAST/AutoBridge",
"path": "/src/autobridge/Device/DeviceManager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ##################
CR_AREA[0][0 ]['DSP'] = 72
CR_AREA[1][0 ]['DSP'] = 72
CR_AREA[0][1 ]['DSP'] = 96
CR_AREA[1][1 ]['DSP'] = 96
CR_AREA[0][2 ]['DSP'] = 96
CR_AREA[1][2 ]['DSP'] = 96
CR_AREA[0][3 ]['DSP'] = 96
CR_AREA[1][3 ]['DSP'] = 96
CR_A... | code_fim | hard | {
"lang": "python",
"repo": "UCLA-VAST/AutoBridge",
"path": "/src/autobridge/Device/DeviceManager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ##################
CR_AREA[0][0 ]['BRAM'] = 24 * 2
CR_AREA[1][0 ]['BRAM'] = 24 * 2
CR_AREA[0][1 ]['BRAM'] = 24 * 2
CR_AREA[1][1 ]['BRAM'] = 24 * 2
CR_AREA[0][2 ]['BRAM'] = 24 * 2
CR_AREA[1][2 ]['BRAM'] = 24 * 2
CR_AREA[0][3 ]['BRAM'] = 24 * 2
CR_AREA[1][3 ]['BRAM'] =... | code_fim | hard | {
"lang": "python",
"repo": "UCLA-VAST/AutoBridge",
"path": "/src/autobridge/Device/DeviceManager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_iterator__next_page_no_more():
from google.cloud.datastore.query import Query
ds_api = _make_datastore_api_for_aggregation()
client = _Client(None, datastore_api=ds_api)
query = Query(client)
iterator = _make_aggregation_iterator(query, client)
iterator._more_results = ... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/python-datastore",
"path": "/tests/unit/test_aggregation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googleapis/python-datastore path: /tests/unit/test_aggregation.py
test_query import _make_query, _make_client
_PROJECT = "PROJECT"
def test_count_aggregation_to_pb():
from google.cloud.datastore_v1.types import query as query_pb2
count_aggregation = CountAggregation(alias="total")
... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/python-datastore",
"path": "/tests/unit/test_aggregation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googleapis/python-datastore path: /tests/unit/test_aggregation.py
expected_aggregation_query_pb = query_pb2.AggregationQuery.Aggregation()
expected_aggregation_query_pb.count = query_pb2.AggregationQuery.Aggregation.Count()
expected_aggregation_query_pb.alias = count_aggregation.ali... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/python-datastore",
"path": "/tests/unit/test_aggregation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (i % args.gradient_acc_steps) == 0:
optimizer.step()
optimizer.zero_grad()
total_loss += loss.item()
total_acc += evaluate_(classification_logits, labels, \
ignore_idx=-1)[0]
... | code_fim | hard | {
"lang": "python",
"repo": "pvcastro/BERT-Relation-Extraction",
"path": "/src/tasks/trainer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.fp16:
with amp.scale_loss(loss, optimizer) as scaled_loss:
scaled_loss.backward()
else:
loss.backward()
if args.fp16:
grad_norm = torch.nn.utils.clip_grad_norm_(amp.master_params(op... | code_fim | hard | {
"lang": "python",
"repo": "pvcastro/BERT-Relation-Extraction",
"path": "/src/tasks/trainer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pvcastro/BERT-Relation-Extraction path: /src/tasks/trainer.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 29 09:53:55 2019
@author: weetee
"""
import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
from .prepr... | code_fim | hard | {
"lang": "python",
"repo": "pvcastro/BERT-Relation-Extraction",
"path": "/src/tasks/trainer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [("orgs", "0015_auto_20160209_0926")]
operations = [
migrations.AddField(model_name="taskstate", name="is_disabled", field=models.BooleanField(default=False))
]<|fim_prefix|># repo: rapidpro/dash path: /dash/orgs/migrations/0016_taskstate_is_disabled.py
# -*- coding: ... | code_fim | easy | {
"lang": "python",
"repo": "rapidpro/dash",
"path": "/dash/orgs/migrations/0016_taskstate_is_disabled.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(model_name="taskstate", name="is_disabled", field=models.BooleanField(default=False))
]<|fim_prefix|># repo: rapidpro/dash path: /dash/orgs/migrations/0016_taskstate_is_disabled.py
# -*- coding: utf-8 -*-
from django.db import migrations, models
clas... | code_fim | easy | {
"lang": "python",
"repo": "rapidpro/dash",
"path": "/dash/orgs/migrations/0016_taskstate_is_disabled.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rapidpro/dash path: /dash/orgs/migrations/0016_taskstate_is_disabled.py
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(model_name="taskstate", name="is_disabled", field=model... | code_fim | easy | {
"lang": "python",
"repo": "rapidpro/dash",
"path": "/dash/orgs/migrations/0016_taskstate_is_disabled.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcusreaiche/cpython-book-samples path: /33/portscanner_threads.py
from threading import Thread
from queue import Queue
import socket
import time
timeout = 1.0
def check_port(host: str, port: int, results: Queue):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeou... | code_fim | medium | {
"lang": "python",
"repo": "marcusreaiche/cpython-book-samples",
"path": "/33/portscanner_threads.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> start = time.time()
host = "localhost"
threads = []
results = Queue()
for port in range(80, 100):
t = Thread(target=check_port, args=(host, port, results))
t.start()
threads.append(t)
for t in threads:
t.join()
while not results.empty():
... | code_fim | medium | {
"lang": "python",
"repo": "marcusreaiche/cpython-book-samples",
"path": "/33/portscanner_threads.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ucl-exoplanets/TauREx3_public path: /taurex/data/profiles/pressure/__init__.py
from .pressureprofile import SimplePress<|fim_suffix|>ressure import ArrayPressureProfile
from .filepressure import FilePressureProfile<|fim_middle|>ureProfile, PressureProfile
from .arrayp | code_fim | easy | {
"lang": "python",
"repo": "ucl-exoplanets/TauREx3_public",
"path": "/taurex/data/profiles/pressure/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ressure import ArrayPressureProfile
from .filepressure import FilePressureProfile<|fim_prefix|># repo: ucl-exoplanets/TauREx3_public path: /taurex/data/profiles/pressure/__init__.py
from .pressureprofile import SimplePress<|fim_middle|>ureProfile, PressureProfile
from .arrayp | code_fim | easy | {
"lang": "python",
"repo": "ucl-exoplanets/TauREx3_public",
"path": "/taurex/data/profiles/pressure/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewssobral/self-driving-car-nfs path: /drivenet.py
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, Flatten
from tensorflow.keras.layers import Dense, Concatenate
from tensorflow.keras.utils import plot_model
<|fim_suffix|>if __name__ == '__main__':... | code_fim | hard | {
"lang": "python",
"repo": "andrewssobral/self-driving-car-nfs",
"path": "/drivenet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> screen_input = Input(shape=(80, 200, 3))
minimap_input = Input(shape=(50, 50, 1))
screen = Conv2D(filters=24, kernel_size=5, strides=2, activation='relu')(screen_input)
screen = Conv2D(filters=36, kernel_size=5, strides=2, activation='relu')(screen)
screen = Conv2D(filters=48, kernel_... | code_fim | medium | {
"lang": "python",
"repo": "andrewssobral/self-driving-car-nfs",
"path": "/drivenet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_complete_url(self):
endpoint_options = self.options()
endpoint_options.merge_params_in(self.custom_params())
query_params = '?' + endpoint_options.query_string
return self.pubnub.config.scheme_extended() + self.pubnub.base_origin + self.build_path() + query_par... | code_fim | hard | {
"lang": "python",
"repo": "AdityaStark7/blockchain_backend",
"path": "/blockchain-env/Lib/site-packages/pubnub/endpoints/file_operations/get_file_url.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ifedora/aliyun-odps-python-sdk path: /odps/pai/metrics/classification.py
# encoding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright owne... | code_fim | hard | {
"lang": "python",
"repo": "ifedora/aliyun-odps-python-sdk",
"path": "/odps/pai/metrics/classification.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fpr_sink, tpr_sink, thresholds_sink = Sink(), Sink(), Sink()
roc_node = ROCCurveNode(col_true, col_pred, col_scores, pos_label, fpr_sink, tpr_sink, thresholds_sink)
dataset._context()._dag.add_node(roc_node)
dataset._context()._dag.add_link(dataset._bind_node, dataset._bind_output, roc_no... | code_fim | hard | {
"lang": "python",
"repo": "ifedora/aliyun-odps-python-sdk",
"path": "/odps/pai/metrics/classification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> roc_node = ROCCurveNode(col_true, col_pred, col_scores, pos_label, fpr_sink, tpr_sink, thresholds_sink)
dataset._context()._dag.add_node(roc_node)
dataset._context()._dag.add_link(dataset._bind_node, dataset._bind_output, roc_node, "input")
dataset._context()._run(roc_node)
return fp... | code_fim | medium | {
"lang": "python",
"repo": "ifedora/aliyun-odps-python-sdk",
"path": "/odps/pai/metrics/classification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def _run_thread(self) -> None:
"""Run the script."""
# run script
await self._script.run(None)
__all__ = ["ScriptRunner"]<|fim_prefix|># repo: pyobs/pyobs-core path: /pyobs/modules/robotic/scriptrunner.py
import logging
from typing import Any, Dict
from pyobs.modules... | code_fim | hard | {
"lang": "python",
"repo": "pyobs/pyobs-core",
"path": "/pyobs/modules/robotic/scriptrunner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyobs/pyobs-core path: /pyobs/modules/robotic/scriptrunner.py
import logging
from typing import Any, Dict
from pyobs.modules import Module
from pyobs.interfaces import IAutonomous
from pyobs.robotic.scripts import Script
log = logging.getLogger(__name__)
class ScriptRunner(Module, IAutonomous... | code_fim | medium | {
"lang": "python",
"repo": "pyobs/pyobs-core",
"path": "/pyobs/modules/robotic/scriptrunner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
script: Dict[str, Any],
**kwargs: Any,
):
"""Initialize a new script runner.
Args:
script: Config for script to run.
"""
Module.__init__(self, **kwargs)
# store
self.script = script
if 'comm' in script.... | code_fim | medium | {
"lang": "python",
"repo": "pyobs/pyobs-core",
"path": "/pyobs/modules/robotic/scriptrunner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richmont/ListaSequencial path: /python/exercicio12.py
#!/usr/bin/env python3
""" Tendo como dados de entrada a altura de uma pessoa, co<|fim_suffix|>lturaIdeal = (72.7*altura)-58
print("Seu peso ideal é de ",alturaIdeal)
main()<|fim_middle|>nstrua um algoritmo que calcule seu peso
ideal, usan... | code_fim | medium | {
"lang": "python",
"repo": "richmont/ListaSequencial",
"path": "/python/exercicio12.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>lturaIdeal = (72.7*altura)-58
print("Seu peso ideal é de ",alturaIdeal)
main()<|fim_prefix|># repo: richmont/ListaSequencial path: /python/exercicio12.py
#!/usr/bin/env python3
""" Tendo como dados de entrada a altura de uma pessoa, co<|fim_middle|>nstrua um algoritmo que calcule seu peso
ideal, usan... | code_fim | medium | {
"lang": "python",
"repo": "richmont/ListaSequencial",
"path": "/python/exercicio12.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorboard path: /tensorboard/manager_test.py
# Copyright 2019 The TensorFlow Authors. 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
... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorboard",
"path": "/tensorboard/manager_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.