text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: open-mmlab/mmdeploy path: /mmdeploy/codebase/mmocr/models/text_recognition/sar_decoder.py
# Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import Optional, Sequence
import torch
import torch.nn.functional as F
from mmocr.utils.typing_utils import TextRecogDataSample
from t... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmdeploy",
"path": "/mmdeploy/codebase/mmocr/models/text_recognition/sar_decoder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geru-br/keyloop path: /tests/fake_permission.py
import math
from keyloop.api.v1.exceptions import PermissionAlreadyExists, PermissionNotFound
from keyloop.utils import generate_uuid
class Page(object):
def __init__(self, items, page, page_size, total):
self.items = items
se... | code_fim | hard | {
"lang": "python",
"repo": "geru-br/keyloop",
"path": "/tests/fake_permission.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def list(cls, page, limit):
params = []
total = len(cls.PERMISSIONS) if limit > len(cls.PERMISSIONS) else limit
current_page = 0 if page in (0, 1) else page
if not cls.PERMISSIONS:
return Page([], current_page, limit, total)
params... | code_fim | hard | {
"lang": "python",
"repo": "geru-br/keyloop",
"path": "/tests/fake_permission.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openbmc/pldm path: /tools/fw-update/pldm_fwup_pkg_creator.py
rom bitarray import bitarray
from bitarray.util import ba2int
string_types = dict(
[
("Unknown", 0),
("ASCII", 1),
("UTF8", 2),
("UTF16", 3),
("UTF16LE", 4),
("UTF16BE", 5),
]
)
... | code_fim | hard | {
"lang": "python",
"repo": "openbmc/pldm",
"path": "/tools/fw-update/pldm_fwup_pkg_creator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> index = 0
pkg_header_checksum_size = 4
start_offset = pldm_fw_up_pkg.tell() + pkg_header_checksum_size
# Update ComponentLocationOffset and ComponentSize for all the components
for offset in component_location_offsets:
file_size = os.stat(image_files[index]).st_size
pld... | code_fim | hard | {
"lang": "python",
"repo": "openbmc/pldm",
"path": "/tools/fw-update/pldm_fwup_pkg_creator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openbmc/pldm path: /tools/fw-update/pldm_fwup_pkg_creator.py
d as
series of 13 bytes defined in DSP0240 specification.
Parameters:
pldm_fw_up_pkg: PLDM FW update package
release_date_time: Package Release Date Time
"""
time = release_date_time.time()
... | code_fim | hard | {
"lang": "python",
"repo": "openbmc/pldm",
"path": "/tools/fw-update/pldm_fwup_pkg_creator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>3/0/41",
"Gi3/0/42",
"Gi3/0/43",
"Gi3/0/44",
"Gi3/0/45",
"Gi3/0/46",
"Gi3/0/47",
"Gi3/0/48",
"Fo3/1/1",
"Fo3/1/2",
"Ap3/0/1",
"Gi4... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/iosxe/tests/ShowVlanBrief/cli/equal/golden_output_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/0/30",
"Gi4/0/32",
"Gi4/0/33",
"Gi4/0/34",
"Gi4/0/35",
"Gi4/0/36",
"Gi4/0/38",
"Gi4/0/39",
"Gi4/0/40",
"Gi4/0/42",
"Gi4/0/43",
"G... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/iosxe/tests/ShowVlanBrief/cli/equal/golden_output_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/iosxe/tests/ShowVlanBrief/cli/equal/golden_output_expected.py
expected_output = {
"vlan": {
"vlan1": {
"vlan_name": "default",
"vlan_status": "active",
"vlan_port": [
"Gi1/... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/iosxe/tests/ShowVlanBrief/cli/equal/golden_output_expected.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_instalments.py
from xai.brain.wordbase.nouns._instalment import _INSTALMENT
#calss header
class _INSTALMENTS(_INSTALMENT, ):
<|fim_suffix|> _INSTALMENT.__init__(self)
self.name = "INSTALMENTS"
self.specie = 'nouns'
self.basic = "instalment"
... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_instalments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,):
_INSTALMENT.__init__(self)
self.name = "INSTALMENTS"
self.specie = 'nouns'
self.basic = "instalment"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_instalments.py
from xai.brain.wordbase.nouns._instalment import _INSTALMENT
<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_instalments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _INSTALMENT.__init__(self)
self.name = "INSTALMENTS"
self.specie = 'nouns'
self.basic = "instalment"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_instalments.py
from xai.brain.wordbase.nouns._instalment import _INSTALMENT
<|fim_middle|>#calss header
c... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_instalments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rsbyrne/everest path: /everest/window/properties/props.py
###############################################################################
''''''
###############################################################################
from ._base import _Vanishable, _Colourable, _Fillable, _Fadable
from .e... | code_fim | hard | {
"lang": "python",
"repo": "rsbyrne/everest",
"path": "/everest/window/properties/props.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self,
mplax,
outerupdate,
dims = ('x', 'y'),
alpha = 1.,
colour = 'black',
fill = 'white',
visible = True,
title = '',
):
self._outerupdate = outerupdate
super().... | code_fim | hard | {
"lang": "python",
"repo": "rsbyrne/everest",
"path": "/everest/window/properties/props.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,
mplax,
outerupdate,
dims = ('x', 'y'),
alpha = 1.,
colour = 'black',
fill = 'white',
visible = True,
title = '',
):
self._outerupdate = outerupdate
super()._... | code_fim | hard | {
"lang": "python",
"repo": "rsbyrne/everest",
"path": "/everest/window/properties/props.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> service = "appstream"
enum_spec = ('describe_fleets', 'Fleets', None)
arn_type = "fleet"
arn = "Arn"
id = "Name"
name = "Name"
cfn_type = "AWS::AppStream::Fleet"
universal_taggable = object()
source_mapping = {
"describe": query.... | code_fim | medium | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/c7n/resources/appstream.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /c7n/resources/appstream.py
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.manager import resources
from c7n import query
@resources.register("appstream-fleet")
class AppStreamFleet(query.QueryResourceManager):
c... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/c7n/resources/appstream.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jenniferColonell/ecephys_spike_sorting path: /tests/integration/__init__.py
# -*- coding: utf-8 -*-
import os
import sys
<|fim_suffix|> if sys.platform == "win32":
entry_point += ".exe"
executable_dir = os.path.dirname(sys.executable)
return os.path.exists(os.path.join(execut... | code_fim | easy | {
"lang": "python",
"repo": "jenniferColonell/ecephys_spike_sorting",
"path": "/tests/integration/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sys.platform == "win32":
entry_point += ".exe"
executable_dir = os.path.dirname(sys.executable)
return os.path.exists(os.path.join(executable_dir, entry_point))<|fim_prefix|># repo: jenniferColonell/ecephys_spike_sorting path: /tests/integration/__init__.py
# -*- coding: utf-8 -*-
... | code_fim | easy | {
"lang": "python",
"repo": "jenniferColonell/ecephys_spike_sorting",
"path": "/tests/integration/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MellowMarsh/Web-Scraper path: /webscraper.py
import requests
from bs4 import BeautifulSoup
#pulling all home<|fim_suffix|> BeautifulSoup( response.content, "html.parser")
print (content)<|fim_middle|>page content to test out the web-scraper
url = 'http://mothertreewellness.com'
response = reque... | code_fim | medium | {
"lang": "python",
"repo": "MellowMarsh/Web-Scraper",
"path": "/webscraper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> BeautifulSoup( response.content, "html.parser")
print (content)<|fim_prefix|># repo: MellowMarsh/Web-Scraper path: /webscraper.py
import requests
from bs4 import BeautifulSoup
#pulling all homepage content to test out the web-scraper
url = 'http://mothertree<|fim_middle|>wellness.com'
response = reque... | code_fim | medium | {
"lang": "python",
"repo": "MellowMarsh/Web-Scraper",
"path": "/webscraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
local_config = config
parsl.load(local_config)
x = test_resource(2)<|fim_prefix|># repo: MatthewBM/parsl path: /parsl/tests/test_error_handling/test_resource_spec.py
import parsl
from parsl.app.app import python_app
from parsl.tests.configs.local_threads import conf... | code_fim | hard | {
"lang": "python",
"repo": "MatthewBM/parsl",
"path": "/parsl/tests/test_error_handling/test_resource_spec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MatthewBM/parsl path: /parsl/tests/test_error_handling/test_resource_spec.py
import parsl
from parsl.app.app import python_app
from parsl.tests.configs.local_threads import config
from parsl.executors.errors import UnsupportedFeatureError
from parsl.executors import WorkQueueExecutor
<|fim_suff... | code_fim | medium | {
"lang": "python",
"repo": "MatthewBM/parsl",
"path": "/parsl/tests/test_error_handling/test_resource_spec.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
local_config = config
parsl.load(local_config)
x = test_resource(2)<|fim_prefix|># repo: MatthewBM/parsl path: /parsl/tests/test_error_handling/test_resource_spec.py
import parsl
from parsl.app.app import python_app
from parsl.tests.configs.local_threads import con... | code_fim | hard | {
"lang": "python",
"repo": "MatthewBM/parsl",
"path": "/parsl/tests/test_error_handling/test_resource_spec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ident, dirType, positions in [('_cell', 'Cell', cells), ('_protocol', 'Protocol', prots)]:
## map positions, build data tables
data, fields = self.generateDataArray(positions, dirType)
prof.mark("got data arrays for %s" %dirType)
#di... | code_fim | hard | {
"lang": "python",
"repo": "acq4/acq4",
"path": "/acq4/analysis/atlas/Atlas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def baseDirChanged(self):
## file loader base dir changed; if it s a slice, set it now.
try:
self.setSliceDir(self.loader.baseDir())
except:
pass
def setSliceClicked(self):
dh = self.loader.selectedFiles()
if len(... | code_fim | hard | {
"lang": "python",
"repo": "acq4/acq4",
"path": "/acq4/analysis/atlas/Atlas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acq4/acq4 path: /acq4/analysis/atlas/Atlas.py
# -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.util import Qt
import pyqtgraph as pg
from acq4.util.debug import Profiler
Ui_Form = Qt.importTemplate('.atlasCtrlTemplate')
class Atlas(Qt.QObject):
DBIdentity = None... | code_fim | hard | {
"lang": "python",
"repo": "acq4/acq4",
"path": "/acq4/analysis/atlas/Atlas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # store how far off we are
deviations = []
for _ in xrange(num_iterations):
kwargs["roll"] = decimal.Decimal(random.uniform(
self.MIN_BENCHMARK_ROLL, self.MAX_BENCHMARK_ROLL))
kwargs["pitch"] = decimal.Decimal(random.uniform(
... | code_fim | hard | {
"lang": "python",
"repo": "leohentschker/database-crazie",
"path": "/python_interface/crazyflie/management/commands/find_closest_trajectory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leohentschker/database-crazie path: /python_interface/crazyflie/management/commands/find_closest_trajectory.py
from django.core.management.base import BaseCommand, CommandError
from crazyflie.models import SolvedTrajectory
import decimal
import random
import math
import time
class Command(BaseC... | code_fim | hard | {
"lang": "python",
"repo": "leohentschker/database-crazie",
"path": "/python_interface/crazyflie/management/commands/find_closest_trajectory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fermiPy/fermipy path: /fermipy/diffuse/gt_coadd_split.py
#!/usr/bin/env python
#
"""
Prepare data for diffuse all-sky analysis
"""
import os
import copy
from collections import OrderedDict
import yaml
from fermipy.jobs.utils import is_null
from fermipy.jobs.link import Link
from fermipy.jobs.... | code_fim | hard | {
"lang": "python",
"repo": "fermiPy/fermipy",
"path": "/fermipy/diffuse/gt_coadd_split.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> name_keys = dict(zcut=zcut,
ebin=comp.ebin_name,
psftype=comp.evtype_name,
coordsys=comp.coordsys,
irf_ver=NAME_FACTORY.irf_ver(),
... | code_fim | hard | {
"lang": "python",
"repo": "fermiPy/fermipy",
"path": "/fermipy/diffuse/gt_coadd_split.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> components = Component.build_from_yamlfile(args['comp'])
datafile = args['data']
if datafile is None or datafile == 'None':
return job_configs
NAME_FACTORY.update_base_dict(args['data'])
outdir_base = os.path.join(NAME_FACTORY.base_dict['basedir'], 'cou... | code_fim | hard | {
"lang": "python",
"repo": "fermiPy/fermipy",
"path": "/fermipy/diffuse/gt_coadd_split.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = serializers.IntegerField()
username = serializers.CharField()
last_login = serializers.DateTimeField()
login_count = serializers.IntegerField()
project_count = serializers.IntegerField()<|fim_prefix|># repo: coreycoole/users-api path: /profiles_api/serializers.py
from rest_framew... | code_fim | easy | {
"lang": "python",
"repo": "coreycoole/users-api",
"path": "/profiles_api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coreycoole/users-api path: /profiles_api/serializers.py
from rest_framework import serializers
<|fim_suffix|> id = serializers.IntegerField()
username = serializers.CharField()
last_login = serializers.DateTimeField()
login_count = serializers.IntegerField()
project_count = s... | code_fim | easy | {
"lang": "python",
"repo": "coreycoole/users-api",
"path": "/profiles_api/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modin-project/modin path: /modin/core/execution/python/implementations/pandas_on_python/partitioning/partition.py
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyrigh... | code_fim | hard | {
"lang": "python",
"repo": "modin-project/modin",
"path": "/modin/core/execution/python/implementations/pandas_on_python/partitioning/partition.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Function to apply.
*args : iterable
Additional positional arguments to be passed in `func`.
**kwargs : dict
Additional keyword arguments to be passed in `func`.
Returns
-------
PandasOnPythonDataframePartition
New ``P... | code_fim | hard | {
"lang": "python",
"repo": "modin-project/modin",
"path": "/modin/core/execution/python/implementations/pandas_on_python/partitioning/partition.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_psql_valid(self):
print(src.Database(dbname="psql", vault_url="http://localhost", token="s.GoR2nisHPeKU1vOaw9hZ5L7h").get_creds())
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: bvanroll/python-vault-db path: /test/test_database.py
import unittest
import sys
... | code_fim | hard | {
"lang": "python",
"repo": "bvanroll/python-vault-db",
"path": "/test/test_database.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bvanroll/python-vault-db path: /test/test_database.py
import unittest
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import src
class DatabaseClassTests(unittest.TestCase):
def test_vault_connection_error(self):
#TODO give som... | code_fim | medium | {
"lang": "python",
"repo": "bvanroll/python-vault-db",
"path": "/test/test_database.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # given
df = pd.read_csv(os.path.dirname(__file__) + "/resources/" + 'interest-rates.csv')
table = TableDisplay(df)
# when
table.setAlignmentProviderForType(ColumnType.Double, TableDisplayAlignmentProvider.RIGHT_ALIGNMENT)
table.setAlignmentProviderForType(C... | code_fim | medium | {
"lang": "python",
"repo": "splicemachine/beakerx",
"path": "/beakerx_tabledisplay/beakerx_tabledisplay/tests/test_tabledisplay_api_set_alignment_provider_for_type_method.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: splicemachine/beakerx path: /beakerx_tabledisplay/beakerx_tabledisplay/tests/test_tabledisplay_api_set_alignment_provider_for_type_method.py
# Copyright 2019 TWO SIGMA OPEN SOURCE, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | code_fim | medium | {
"lang": "python",
"repo": "splicemachine/beakerx",
"path": "/beakerx_tabledisplay/beakerx_tabledisplay/tests/test_tabledisplay_api_set_alignment_provider_for_type_method.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mauler/meeting-gate path: /meeting/gate/migrations/0006_auto_20180131_1003.py
# Generated by Django 2.0.1 on 2018-01-31 10:03
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='qrcode',
name='qrcode_requir... | code_fim | medium | {
"lang": "python",
"repo": "mauler/meeting-gate",
"path": "/meeting/gate/migrations/0006_auto_20180131_1003.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('gate', '0005_auto_20180131_0959'),
]
operations = [
migrations.AlterField(
model_name='qrcode',
name='qrcode_requires_identification',
field=models.BooleanField(default=False, help_text='qrcode_requires_identification', ve... | code_fim | medium | {
"lang": "python",
"repo": "mauler/meeting-gate",
"path": "/meeting/gate/migrations/0006_auto_20180131_1003.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lunarobliq/o365spray path: /o365spray/core/utils/writer.py
#!/usr/bin/env python3
from pathlib import Path
class ThreadWriter(object):
"""Custom class to write data to a file accross threads"""
<|fim_suffix|> """Write data to file
Arguments:
data: data to writ... | code_fim | hard | {
"lang": "python",
"repo": "lunarobliq/o365spray",
"path": "/o365spray/core/utils/writer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def flush(self):
"""Flush the file buffer"""
self.out_file.flush()
def close(self):
"""Close the file handle"""
self.out_file.close()<|fim_prefix|># repo: lunarobliq/o365spray path: /o365spray/core/utils/writer.py
#!/usr/bin/env python3
from pathlib import Path
... | code_fim | hard | {
"lang": "python",
"repo": "lunarobliq/o365spray",
"path": "/o365spray/core/utils/writer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Arguments:
data: data to write to file
"""
self.out_file.write(f"{data}\n")
def flush(self):
"""Flush the file buffer"""
self.out_file.flush()
def close(self):
"""Close the file handle"""
self.out_file.close()<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "lunarobliq/o365spray",
"path": "/o365spray/core/utils/writer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_LIDARRECOGNITIONCOMPONENTCONFIG = _descriptor.Descriptor(
name='LidarRecognitionComponentConfig',
full_name='apollo.perception.onboard.LidarRecognitionComponentConfig',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='main_sensor_name... | code_fim | hard | {
"lang": "python",
"repo": "mengdejiang/OpenHDMap",
"path": "/map_label_tool/py_proto/modules/perception/onboard/proto/lidar_component_config_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mengdejiang/OpenHDMap path: /map_label_tool/py_proto/modules/perception/onboard/proto/lidar_component_config_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/perception/onboard/proto/lidar_component_config.proto
import sys
_b=sys.version_info[0]<3 and (lambda x... | code_fim | hard | {
"lang": "python",
"repo": "mengdejiang/OpenHDMap",
"path": "/map_label_tool/py_proto/modules/perception/onboard/proto/lidar_component_config_pb2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for event in self.monitor.refresh():
self.assertEqual(Event.MODULE_CREATED, event.type)
self.assertEqual(descriptors['prisoners.d'], event.descriptor)
break
else:
self.fail("Empty modifieds")
self.assertEq... | code_fim | hard | {
"lang": "python",
"repo": "ishikawa/modipyd",
"path": "/tests/test_monitor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ishikawa/modipyd path: /tests/test_monitor.py
#!/usr/bin/env python
import unittest
import time
import os
from os.path import join, exists
from tests import TestCase, FILES_DIR
from modipyd.monitor import Event, Monitor
class TestSimpleMonitor(TestCase):
def setUp(self):
self.moni... | code_fim | hard | {
"lang": "python",
"repo": "ishikawa/modipyd",
"path": "/tests/test_monitor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> event = modified[0]
self.assertEqual(Event.MODULE_MODIFIED, event.type)
m = event.descriptor
self.assertEqual('prisoners.b', m.name)
self.assertEqual(0, len(m.dependencies))
self.assertEqual(2, len(m.reverse_dependencies))
def test_deleted(self):
... | code_fim | hard | {
"lang": "python",
"repo": "ishikawa/modipyd",
"path": "/tests/test_monitor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> email_input = browser.find_element_by_name('email')
email_input.send_keys(data['email'])
pass_input = browser.find_element_by_name('pass')
pass_input.send_keys(data['password'])
pass_input.submit()
return print("Login Successful")<|fim_prefix|># repo: miketheinkman/facebook_admin ... | code_fim | hard | {
"lang": "python",
"repo": "miketheinkman/facebook_admin",
"path": "/utils/menu.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miketheinkman/facebook_admin path: /utils/menu.py
from __future__ import print_function
import sys
import os
# hacky input func to handle Python 2
if sys.version_info[0] < 3:
from compat import input
# keep the clutter down
def clear_term():
os.system('cls' if os.name == 'nt' else 'cl... | code_fim | hard | {
"lang": "python",
"repo": "miketheinkman/facebook_admin",
"path": "/utils/menu.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def login(browser, data):
email_input = browser.find_element_by_name('email')
email_input.send_keys(data['email'])
pass_input = browser.find_element_by_name('pass')
pass_input.send_keys(data['password'])
pass_input.submit()
return print("Login Successful")<|fim_prefix|># repo: mik... | code_fim | hard | {
"lang": "python",
"repo": "miketheinkman/facebook_admin",
"path": "/utils/menu.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # objects where any property differs are considered unequal
different_args = dict(
interface="https://schema.skao.int/ska-low-mccs-releaseresources/999.0",
subarray_id=2,
release_all=False,
)
for k, v in different_args.items():
other_args = dict(constructor_... | code_fim | hard | {
"lang": "python",
"repo": "ska-telescope/cdm-shared-library",
"path": "/tests/unit/ska_tmc_cdm/messages/mccscontroller/test_releaseresources.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ska-telescope/cdm-shared-library path: /tests/unit/ska_tmc_cdm/messages/mccscontroller/test_releaseresources.py
"""
Unit tests for the mccscontroller.releaseresources module
"""
from ska_tmc_cdm.messages.mccscontroller.releaseresources import ReleaseResourcesRequest
<|fim_suffix|> """
Ver... | code_fim | hard | {
"lang": "python",
"repo": "ska-telescope/cdm-shared-library",
"path": "/tests/unit/ska_tmc_cdm/messages/mccscontroller/test_releaseresources.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Te-k/apkcli path: /apkcli/plugins/jsonp.py
#! /usr/bin/env python
import hashlib
import json
from apkcli.plugins.base import Plugin
from apkcli.lib.utils import get_urls, get_intent_filers, convert_x509_name
class PluginJson(Plugin):
name = "json"
description = "Extract information on t... | code_fim | hard | {
"lang": "python",
"repo": "Te-k/apkcli",
"path": "/apkcli/plugins/jsonp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Certificate
if len(apk.get_certificates()) > 0:
cert = apk.get_certificates()[0]
res['certificate']['sha1'] = cert.sha1_fingerprint.replace(' ', '')
res['certificate']['serial'] = '{:X}'.format(cert.serial_number)
res['certificate']['issuer... | code_fim | hard | {
"lang": "python",
"repo": "Te-k/apkcli",
"path": "/apkcli/plugins/jsonp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
A `tff.simulation.datasets.ClientData` of synthentic Shakespeare text.
"""
return from_tensor_slices_client_data.TestClientData(
_SYNTHETIC_SHAKESPEARE_DATA
)
# A small sub-sample of snippets from the Shakespeare dataset.
_SYNTHETIC_SHAKESPEARE_DATA = {
'THE_TRAGEDY_OF_KIN... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/simulation/datasets/shakespeare.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/federated path: /tensorflow_federated/python/simulation/datasets/shakespeare.py
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a ... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/simulation/datasets/shakespeare.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cache_dir: Optional[str] = None,
) -> tuple[client_data.ClientData, client_data.ClientData]:
"""Loads the federated Shakespeare dataset.
Downloads and caches the dataset locally. If previously downloaded, tries to
load the dataset from cache.
This dataset is derived from the Leaf repository
... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/simulation/datasets/shakespeare.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def train_batch(self, input_data, target_data):
deltas = [np.zeros(l.weight.shape) for l in self.train_layers]
raw_predict = self.raw_predict
get_gradient = self.get_gradient
for input_row, target_row in zip(input_data, target_data):
output_train = raw_pre... | code_fim | hard | {
"lang": "python",
"repo": "Neocher/neupy",
"path": "/neupy/algorithms/backprop/gradient_descent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.output_train = output_train
weight_delta = get_gradient(output_train, target_data)
deltas = map(sum, zip(deltas, weight_delta))
self.weight_delta = [-delta / len(input_data) for delta in deltas]
return self.weight_delta
def train_epoch(self, ... | code_fim | hard | {
"lang": "python",
"repo": "Neocher/neupy",
"path": "/neupy/algorithms/backprop/gradient_descent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Neocher/neupy path: /neupy/algorithms/backprop/gradient_descent.py
import numpy as np
from neupy.core.properties import NumberProperty
from .backpropagation import Backpropagation
__all__ = ('MinibatchGradientDescent',)
class MinibatchGradientDescent(Backpropagation):
""" Mini-batch Grad... | code_fim | hard | {
"lang": "python",
"repo": "Neocher/neupy",
"path": "/neupy/algorithms/backprop/gradient_descent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pravesh-Jamgade/projectSOS path: /help_api/models.py
from django.db import models
import uuid
# TYPE
STATUS = [("AE", "Active"), ("IE", "Inactive")]
TYPE = [("HL", "Hospital"), ("PN", "Person")]
TAG = [("BD", "Bed"), ("ONRL", "Oxygen Refill"), ("EYCR", "Empty Cylinder"),
("FLCR", "Full Cylind... | code_fim | hard | {
"lang": "python",
"repo": "Pravesh-Jamgade/projectSOS",
"path": "/help_api/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sos_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
sos_description = models.TextField(blank=False)
sos_from = models.ForeignKey("EntityModel", models.PROTECT)
sos_date = models.DateTimeField(auto_now=True)
sos_state = models.CharField(max_length=3, choices=... | code_fim | medium | {
"lang": "python",
"repo": "Pravesh-Jamgade/projectSOS",
"path": "/help_api/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
urlpatterns = [
url(r'^signup/$', views.signup, name='signup'),
url(r'^success/$', views.success, name='success'),
]<|fim_prefix|># repo: stephanpoetschner/demo-whitehats path: /signups/urls.py
from django.conf.urls import url
<|fim_middle|>from . import views
| code_fim | easy | {
"lang": "python",
"repo": "stephanpoetschner/demo-whitehats",
"path": "/signups/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephanpoetschner/demo-whitehats path: /signups/urls.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(r'^signup/$', views.signup, name='signup'),
url(r'^success/$', views.success, name='success'),
]<|fim_middle|>from . import views
| code_fim | easy | {
"lang": "python",
"repo": "stephanpoetschner/demo-whitehats",
"path": "/signups/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> If insufficient common ranks between first and second are available to
resolve any common ancestor, returns None.
Note that stratum rention policies are strictly required to permanently
retain the most ancient stratum.
Parameters
----------
confidence_level : float, optional
... | code_fim | hard | {
"lang": "python",
"repo": "mmore500/hstrat",
"path": "/hstrat/phylogenetic_inference/pairwise/_does_have_any_common_ancestor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmore500/hstrat path: /hstrat/phylogenetic_inference/pairwise/_does_have_any_common_ancestor.py
import typing
from ..._auxiliary_lib import HereditaryStratigraphicArtifact
from ...juxtaposition import calc_rank_of_first_retained_disparity_between
from ._calc_rank_of_earliest_detectable_mrca_betw... | code_fim | hard | {
"lang": "python",
"repo": "mmore500/hstrat",
"path": "/hstrat/phylogenetic_inference/pairwise/_does_have_any_common_ancestor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # First, Clip Everything
self.StepLength = np.clip(self.StepLength, self.StepLength_LIMITS[0],
self.StepLength_LIMITS[1])
self.StepVelocity = np.clip(self.StepVelocity,
self.StepVelocity_LIMITS[0],
... | code_fim | hard | {
"lang": "python",
"repo": "OpenQuadruped/spot_mini_mini",
"path": "/spotmicro/OpenLoopSM/SpotOL.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ramp_up(self):
if self.StepLength < self.desired_StepLength:
self.StepLength += self.desired_StepLength * self.dt
def reshuffle(self):
self.time = 0
# Make sure FWD/BWD is always first state
FB_index = self.order.index(FB)
if FB_index != 0:
... | code_fim | hard | {
"lang": "python",
"repo": "OpenQuadruped/spot_mini_mini",
"path": "/spotmicro/OpenLoopSM/SpotOL.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenQuadruped/spot_mini_mini path: /spotmicro/OpenLoopSM/SpotOL.py
""" Open Loop Controller for Spot Micro. Takes GUI params or uses default
"""
import numpy as np
from random import shuffle
import copy
# Ensuring totally random seed every step!
np.random.seed()
FB = 0
LAT = 1
ROT = 2
COMBI = 3
... | code_fim | hard | {
"lang": "python",
"repo": "OpenQuadruped/spot_mini_mini",
"path": "/spotmicro/OpenLoopSM/SpotOL.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markus-antero/Stock path: /data/geographic/shapefileGeo.py
'''
Created on 8.5.2017
TODO - packages not loaded but applicable
- geojson
- shapely
- seaborn as sns
- shapely.wkt, wkt = http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html
@author: Markus.Walden
'''... | code_fim | hard | {
"lang": "python",
"repo": "markus-antero/Stock",
"path": "/data/geographic/shapefileGeo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for feature in r.shapeRecords():
try:
geom = feature.shape.__geo_interface__
atr = dict(zip(fields, feature.record))
print ("geo_interface: ", geom)
print ('feature record: ', atr)
except:
print ('Exception type:', sys.... | code_fim | hard | {
"lang": "python",
"repo": "markus-antero/Stock",
"path": "/data/geographic/shapefileGeo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # process for SQL
sql = sqla.create_engine(engineString)
conn = sql.connect()
metadata = sqla.schema.MetaData(bind=sql,reflect=True)
table = sqla.Table(tableNameA, metadata, autoload=True)
print (table)
# Open the session
... | code_fim | hard | {
"lang": "python",
"repo": "markus-antero/Stock",
"path": "/data/geographic/shapefileGeo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yhsunshining/fuzzy-c-means path: /src/static.py
import matplotlib.pyplot as plt
import numpy as np
from optmize import *
fig, axes = plt.subplots(nrows=1,ncols=2, figsize=(12,5))
all_data = loadCsv('./test.20.log')
all_data = [np.random.normal(0, std, 100) for std in range(6, 10)]
#fig = plt... | code_fim | hard | {
"lang": "python",
"repo": "yhsunshining/fuzzy-c-means",
"path": "/src/static.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.setp(axes, xticks=[y+1 for y in range(len(all_data))],
xticklabels=['abc', 'pso', 'pso-basic', 'tsfcm'],
)
plt.show()<|fim_prefix|># repo: yhsunshining/fuzzy-c-means path: /src/static.py
import matplotlib.pyplot as plt
import numpy as np
from optmize import *
fig, axes = plt.subpl... | code_fim | hard | {
"lang": "python",
"repo": "yhsunshining/fuzzy-c-means",
"path": "/src/static.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>64, 0.75150151],
[ 0.61875522, 0.7848455 , 0.75399375],
[ 0.62573528, 0.7877522 , 0.7565131 ],
[ 0.63267915, 0.79067016, 0.75905849],
[ 0.63958763, 0.79359978, 0.76162887],
[ 0.64646151, 0.79654145, 0.76422323],
[ 0.6533016 , 0.79949552, 0.... | code_fim | hard | {
"lang": "python",
"repo": "matplotlib/cmocean",
"path": "/cmocean/rgb/delta-blue.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matplotlib/cmocean path: /cmocean/rgb/delta-blue.py
from matplotlib.colors import ListedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in pycam02ucs.cm.viscm
parameters = {'xp': [-3.4830597643097576, 0.6289831887553419, -17.483059764309758, -36.149726430976415, -10.11950... | code_fim | hard | {
"lang": "python",
"repo": "matplotlib/cmocean",
"path": "/cmocean/rgb/delta-blue.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silky/apsis path: /code/apsis/demos/demo_MNIST_NN.py
__author__ = 'Frederik Diehl'
# Code for the NN adapted from the breze library example.
# For Breze, see github.com/breze-no-salt/breze.
import cPickle
import gzip
import time
import numpy as np
import theano.tensor as T
import climin.sched... | code_fim | hard | {
"lang": "python",
"repo": "silky/apsis",
"path": "/code/apsis/demos/demo_MNIST_NN.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def demo_on_MNIST(random_steps, steps, cv=1):
X, Z, VX, VZ, TX, TZ, image_dims = load_MNIST()
param_defs = {
#"step_rate": MinMaxNumericParamDef(0, 1),
"step_rate": AsymptoticNumericParamDef(0, 1),
#"momentum": MinMaxNumericParamDef(0, 1),
"momentum": AsymptoticNum... | code_fim | hard | {
"lang": "python",
"repo": "silky/apsis",
"path": "/code/apsis/demos/demo_MNIST_NN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> param_defs = {
#"step_rate": MinMaxNumericParamDef(0, 1),
"step_rate": AsymptoticNumericParamDef(0, 1),
#"momentum": MinMaxNumericParamDef(0, 1),
"momentum": AsymptoticNumericParamDef(1, 0),
'decay': MinMaxNumericParamDef(0, 1),
"c_wd": MinMaxNumericPara... | code_fim | hard | {
"lang": "python",
"repo": "silky/apsis",
"path": "/code/apsis/demos/demo_MNIST_NN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # detrends each stock time series using the difference method
for n in names:
df[n] = df[n].diff()
return df
if __name__ == "__main__":
detrend()<|fim_prefix|># repo: andrewczgithub/Hedgecraft path: /detrend.py
import pandas as pd
import numpy as np
import preproc as pre
cols ... | code_fim | medium | {
"lang": "python",
"repo": "andrewczgithub/Hedgecraft",
"path": "/detrend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewczgithub/Hedgecraft path: /detrend.py
import pandas as pd
import numpy as np
import preproc as pre
cols = ["Date", "Open", "High", "Low", "Close", "Volume", "Name"]
names = [
"MMM",
"AXP",
"AAPL",
"BA",
"CAT",
"CVX",
"CSCO",
"KO",
"DIS",
"XOM",
"... | code_fim | medium | {
"lang": "python",
"repo": "andrewczgithub/Hedgecraft",
"path": "/detrend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> [1,2,3,4,(1,2,3,4,),{1:3,3:5,},'rohit','mohit',1.1,2.5]
print(type_finder(list_items))<|fim_prefix|># repo: structlooper/miniProgramsExercises_python path: /exer_18_type_function_comp.py
def type_finder(l):
return [str(item) for item in l if (type(item) == int or type(item) == float)]
# new_l... | code_fim | medium | {
"lang": "python",
"repo": "structlooper/miniProgramsExercises_python",
"path": "/exer_18_type_function_comp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: structlooper/miniProgramsExercises_python path: /exer_18_type_function_comp.py
def type_finder(l):
return [str(item) for item in l if (type(item) == int or type(i<|fim_suffix|> [1,2,3,4,(1,2,3,4,),{1:3,3:5,},'rohit','mohit',1.1,2.5]
print(type_finder(list_items))<|fim_middle|>tem) == float)... | code_fim | medium | {
"lang": "python",
"repo": "structlooper/miniProgramsExercises_python",
"path": "/exer_18_type_function_comp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HLBdetect/detection-module path: /lib/rpn_msr/attention_refine_layer_tf.py
# in this file, python style
import numpy as np
from fast_rcnn.config import cfg
def attention_refine_layer(feat, att_map):
# this function realizes channel-wise Hadamard matrix product operation.
# input shape(... | code_fim | hard | {
"lang": "python",
"repo": "HLBdetect/detection-module",
"path": "/lib/rpn_msr/attention_refine_layer_tf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
output = np.array([[]])
r = 0
for j in range(1):
for i in range(512):
channel = feat[j,:,:,i]
channel = np.array(channel)
# channel = np.reshape(channel,(input_shape[1],input_shape[2]))
attention_map = np.array(attention_map)
... | code_fim | hard | {
"lang": "python",
"repo": "HLBdetect/detection-module",
"path": "/lib/rpn_msr/attention_refine_layer_tf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while right > 0:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
right -= 1
# Now we know if our connector is None that we actually started reversing at the first node so we will update head
if connection is None:
... | code_fim | hard | {
"lang": "python",
"repo": "KevinKnott/Coding-Review",
"path": "/Month 03/Week 03/Day 06/b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># In this problem all we have to do is traverse until we find left and then go ahead and reverse every node up to the right
# the only trick to keep note of is if the head node is the left we will also need to reassing our head node.
class Solution:
def reverseBetween(self, head: Optional[ListNode]... | code_fim | medium | {
"lang": "python",
"repo": "KevinKnott/Coding-Review",
"path": "/Month 03/Week 03/Day 06/b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KevinKnott/Coding-Review path: /Month 03/Week 03/Day 06/b.py
# Reverse Linked List II: https://leetcode.com/problems/reverse-linked-list-ii/
# Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position ... | code_fim | hard | {
"lang": "python",
"repo": "KevinKnott/Coding-Review",
"path": "/Month 03/Week 03/Day 06/b.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CDAT/dv3d path: /demo/demo_plots/clt_test_demo.py
def simpleanimation():
import vcs, cdms2, sys
x = vcs.init()
f = cdms2.open(vcs.sample_data+"/clt.nc")
v = f["clt"]
dv3d = vcs.get3d_scalar()
x.plot( v, dv3d )
x.interact()
def simplevector():
import vcs, cdms2, sy... | code_fim | hard | {
"lang": "python",
"repo": "CDAT/dv3d",
"path": "/demo/demo_plots/clt_test_demo.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> import vcs
parameters = {
"ScaleColormap": [89.13197640956652, 100.0, 1],
"ScaleOpacity": [1.0, 1.0],
"BasemapOpacity": [0.5],
"Animation": [0.0],
"ZSlider": ( [0.2833581758795678], vcs.on ),
"YSlider": [-90.0],
"ToggleVolumePlot": ( [[1]], vcs.on ),
"XSlide... | code_fim | medium | {
"lang": "python",
"repo": "CDAT/dv3d",
"path": "/demo/demo_plots/clt_test_demo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marco-fp/cryptography-algorithms path: /modular_arithmetic/euclidean.py
"""
Marco Fernandez Pranno
Ejercicio 1
"""
def extendedGcd(a, b):
"""
Greatest common divisor d of a and b, and x and y integers satisfying ax + by = d
"""
if b == 0:
return a, 1, 0
<|fim_suffix|> while b !... | code_fim | medium | {
"lang": "python",
"repo": "marco-fp/cryptography-algorithms",
"path": "/modular_arithmetic/euclidean.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gcd(a, b):
while b != 0:
a, b = b, a % b
return a<|fim_prefix|># repo: marco-fp/cryptography-algorithms path: /modular_arithmetic/euclidean.py
"""
Marco Fernandez Pranno
Ejercicio 1
"""
def extendedGcd(a, b):
"""
Greatest common divisor d of a and b, and x and y integers sati... | code_fim | medium | {
"lang": "python",
"repo": "marco-fp/cryptography-algorithms",
"path": "/modular_arithmetic/euclidean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vaub/hackqc2019-backend path: /chalicelib/donations_service.py
from chalicelib import recipients_service
from chalicelib.donations.donation import Donation
from chalicelib.donations.donations_repository import DonationsDynamoDBRepository
DONATIONS = DonationsDynamoDBRepository.create()
def sen... | code_fim | medium | {
"lang": "python",
"repo": "Vaub/hackqc2019-backend",
"path": "/chalicelib/donations_service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return DONATIONS.find_by(citizen=citizen)
def find_for_recipient(recipient):
return DONATIONS.find_by(recipient=recipient)
def find_donations():
return DONATIONS.get_all()<|fim_prefix|># repo: Vaub/hackqc2019-backend path: /chalicelib/donations_service.py
from chalicelib import recipients... | code_fim | hard | {
"lang": "python",
"repo": "Vaub/hackqc2019-backend",
"path": "/chalicelib/donations_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjacob/NTupleProduction path: /python/BristolNTuple_Tracks_cfi.py
import FWCore.ParameterSet.Config as cms
rootTupleTracks = cms.EDProducer("Bristo<|fim_suffix|>'Track.'),
Suffix = cms.string(''),
)<|fim_middle|>lNTuple_Tracks",
Prefix = cms.string( | code_fim | easy | {
"lang": "python",
"repo": "jjacob/NTupleProduction",
"path": "/python/BristolNTuple_Tracks_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>lNTuple_Tracks",
Prefix = cms.string('Track.'),
Suffix = cms.string(''),
)<|fim_prefix|># repo: jjacob/NTupleProduction path: /python/BristolNTuple_Tracks_cfi.py
import FWCore.ParameterSet.Config as cms
<|fim_middle|>
rootTupleTracks = cms.EDProducer("Bristo | code_fim | easy | {
"lang": "python",
"repo": "jjacob/NTupleProduction",
"path": "/python/BristolNTuple_Tracks_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if count == 3:
iwc_heder_db.iwx_insert(name, super_name, protocol)
print file_name
break
# 脚本入口
if __name__ == '__main__':
iwc_parse_header()<|fim_prefix|># repo: fengjixuchui/iWeChat path: /python/iwc_heder_inherit.py
# coding=UTF-8
# 分析继承关系
import re
import iwc_heder_db
import os
# ... | code_fim | hard | {
"lang": "python",
"repo": "fengjixuchui/iWeChat",
"path": "/python/iwc_heder_inherit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.