text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: sassoftware/rbuild path: /rbuild_test/unit_test/uitest.py
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ei... | code_fim | hard | {
"lang": "python",
"repo": "sassoftware/rbuild",
"path": "/rbuild_test/unit_test/uitest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testGetPassword(self):
h = self.getRbuildHandle()
mock.mock(getpass, 'getpass')
getpass.getpass._mock.setFailOnMismatch()
# test no verification
getpass.getpass._mock.setReturn('result', 'foo: ')
getpass.getpass._mock.appendReturn('result', 'Retype ... | code_fim | hard | {
"lang": "python",
"repo": "sassoftware/rbuild",
"path": "/rbuild_test/unit_test/uitest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fandreuz/Smithers path: /smithers/io/vtphandler.py
from .vtkhandler import VTKHandler
class VTPHandler(VTKHandler):
<|fim_suffix|> _reader_ = vtkXMLPolyDataReader
_writer_ = vtkXMLPolyDataWriter<|fim_middle|>
from vtk import vtkXMLPolyDataReader, vtkXMLPolyDataWriter
| code_fim | medium | {
"lang": "python",
"repo": "fandreuz/Smithers",
"path": "/smithers/io/vtphandler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fandreuz/Smithers path: /smithers/io/vtphandler.py
from .vtkhandler import VTKHandler
<|fim_suffix|> from vtk import vtkXMLPolyDataReader, vtkXMLPolyDataWriter
_reader_ = vtkXMLPolyDataReader
_writer_ = vtkXMLPolyDataWriter<|fim_middle|>class VTPHandler(VTKHandler):
| code_fim | easy | {
"lang": "python",
"repo": "fandreuz/Smithers",
"path": "/smithers/io/vtphandler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _reader_ = vtkXMLPolyDataReader
_writer_ = vtkXMLPolyDataWriter<|fim_prefix|># repo: fandreuz/Smithers path: /smithers/io/vtphandler.py
from .vtkhandler import VTKHandler
<|fim_middle|>class VTPHandler(VTKHandler):
from vtk import vtkXMLPolyDataReader, vtkXMLPolyDataWriter
| code_fim | medium | {
"lang": "python",
"repo": "fandreuz/Smithers",
"path": "/smithers/io/vtphandler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ERA-URBAN/wrfpy path: /wrfpy/cylc/wrfda_run.py
#!/usr/bin/env python
import argparse
import datetime
import time
from wrfpy import utils
from wrfpy.wrfda import wrfda
from wrfpy.bumpskin import *
from wrfpy.scale import wrfda_interpolate
from wrfpy.config import config
import shutil
class dataA... | code_fim | hard | {
"lang": "python",
"repo": "ERA-URBAN/wrfpy",
"path": "/wrfpy/cylc/wrfda_run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__=="__main__":
parser = argparse.ArgumentParser(description='Initialize obsproc.')
parser.add_argument('datestring', metavar='N', type=str,
help='Date-time string from cylc suite')
# parse arguments
args = parser.parse_args()
# call dataAssimilation c... | code_fim | hard | {
"lang": "python",
"repo": "ERA-URBAN/wrfpy",
"path": "/wrfpy/cylc/wrfda_run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> config.__init__(self)
datestart = utils.convert_cylc_time(datestring)
# initialize WRFDA object
WRFDA = wrfda(datestart)
WRFDA.prepare_updatebc(datestart)
# update lower boundary conditions
for domain in range(1, WRFDA.max_dom+1):
WRFDA.u... | code_fim | medium | {
"lang": "python",
"repo": "ERA-URBAN/wrfpy",
"path": "/wrfpy/cylc/wrfda_run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoZaddy/SchemaGen path: /schemagen/antlr/GraphQLListener.py
ctx:GraphQLParser.FieldContext):
pass
# Exit a parse tree produced by GraphQLParser#field.
def exitField(self, ctx:GraphQLParser.FieldContext):
pass
# Enter a parse tree produced by GraphQLParser#arguments.... | code_fim | hard | {
"lang": "python",
"repo": "GoZaddy/SchemaGen",
"path": "/schemagen/antlr/GraphQLListener.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Enter a parse tree produced by GraphQLParser#interfaceTypeDefinition.
def enterInterfaceTypeDefinition(self, ctx:GraphQLParser.InterfaceTypeDefinitionContext):
pass
# Exit a parse tree produced by GraphQLParser#interfaceTypeDefinition.
def exitInterfaceTypeDefinition(self, ctx:... | code_fim | hard | {
"lang": "python",
"repo": "GoZaddy/SchemaGen",
"path": "/schemagen/antlr/GraphQLListener.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoZaddy/SchemaGen path: /schemagen/antlr/GraphQLListener.py
Definition.
def exitOperationDefinition(self, ctx:GraphQLParser.OperationDefinitionContext):
pass
# Enter a parse tree produced by GraphQLParser#operationType.
def enterOperationType(self, ctx:GraphQLParser.Operatio... | code_fim | hard | {
"lang": "python",
"repo": "GoZaddy/SchemaGen",
"path": "/schemagen/antlr/GraphQLListener.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
isMomentRegistredZC_39 = 1 if "FlagLeafLiguleJustVisible" in calendarMoments else 0
return isMomentRegistredZC_39<|fim_prefix|># repo: cyrillemidingoyi/SQ_Wheat_Phenology path: /test/openalea/ismomentregistredzc_39.py
import numpy as np
from copy import copy
from math import *
<|fim_mi... | code_fim | hard | {
"lang": "python",
"repo": "cyrillemidingoyi/SQ_Wheat_Phenology",
"path": "/test/openalea/ismomentregistredzc_39.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cyrillemidingoyi/SQ_Wheat_Phenology path: /test/openalea/ismomentregistredzc_39.py
import numpy as np
from copy import copy
from math import *
def ismomentregistredzc_39(calendarMoments=['Sowing']):
"""
<|fim_suffix|> """
isMomentRegistredZC_39 = 1 if "FlagLeafLiguleJustVisible" in... | code_fim | hard | {
"lang": "python",
"repo": "cyrillemidingoyi/SQ_Wheat_Phenology",
"path": "/test/openalea/ismomentregistredzc_39.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "".join(
[
DOMStringCompat.render(c) if isinstance(c, Elt)
# Compat: reverts "Disable single and double quotes escaping outside of attributes for string engine ([#129](https://github.com/springload/draftjs_exporter/pull/129))"
else... | code_fim | hard | {
"lang": "python",
"repo": "springload/draftjs_exporter",
"path": "/draftjs_exporter/engines/string_compat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> type_ = elt.type
attr = DOMStringCompat.render_attrs(elt.attr) if elt.attr else ""
children = (
DOMStringCompat.render_children(elt.children)
if elt.children
else ""
)
if type_ == "fragment":
return children
... | code_fim | hard | {
"lang": "python",
"repo": "springload/draftjs_exporter",
"path": "/draftjs_exporter/engines/string_compat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: springload/draftjs_exporter path: /draftjs_exporter/engines/string_compat.py
from html import escape
from typing import Sequence, Union
from draftjs_exporter.engines.base import Attr
from draftjs_exporter.engines.string import DOMString, Elt, VOID_ELEMENTS
from draftjs_exporter.types import HTML... | code_fim | hard | {
"lang": "python",
"repo": "springload/draftjs_exporter",
"path": "/draftjs_exporter/engines/string_compat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ibrary.PagerDuty.LogEntries.ListLogEntriesByUser import ListLogEntriesByUser, ListLogEntriesByUserInputSet, ListLogEntriesByUserResultSet, ListLogEntriesByUserChoreographyExecution<|fim_prefix|># repo: lupyuen/RaspberryPiImage path: /home/pi/GrovePi/Software/Python/others/temboo/Library/PagerDuty/LogEntr... | code_fim | hard | {
"lang": "python",
"repo": "lupyuen/RaspberryPiImage",
"path": "/home/pi/GrovePi/Software/Python/others/temboo/Library/PagerDuty/LogEntries/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lupyuen/RaspberryPiImage path: /home/pi/GrovePi/Software/Python/others/temboo/Library/PagerDuty/LogEntries/__init__.py
from temboo.Library.PagerDuty.LogEntries.GetLogEntry import GetLogEntry, GetLogEntryInputSet, GetLogEntryResultSet, GetLogEntryChoreographyExecution
from temboo.Library.PagerDuty... | code_fim | medium | {
"lang": "python",
"repo": "lupyuen/RaspberryPiImage",
"path": "/home/pi/GrovePi/Software/Python/others/temboo/Library/PagerDuty/LogEntries/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benihime91/gale path: /gale/schedules.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02a_schedules.ipynb (unless otherwise specified).
__all__ = ['CosineAnnealingWarmRestarts', 'OneCycleLR', 'ReduceLROnPlateau', 'StepLR', 'MultiStepLR',
'SCHEDULER_REGISTRY', 'LRMultiplier', 'Warmu... | code_fim | hard | {
"lang": "python",
"repo": "benihime91/gale",
"path": "/gale/schedules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Cell
@SCHEDULER_REGISTRY.register()
def WarmupConstantLR(
optimizer: Optimizer,
max_iters: int,
pct_start: Optional[float] = None,
warmup_steps: Optional[int] = None,
warmup_factor: float = (1.0 / 1000),
) -> torch.optim.lr_scheduler._LRScheduler:
"""
Linearly increase `lr` f... | code_fim | hard | {
"lang": "python",
"repo": "benihime91/gale",
"path": "/gale/schedules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Cell
@SCHEDULER_REGISTRY.register()
def WarmupLinearLR(
optimizer: Optimizer,
max_iters: int,
pct_start: Optional[float] = None,
warmup_steps: Optional[int] = None,
warmup_factor: float = (1.0 / 1000),
) -> torch.optim.lr_scheduler._LRScheduler:
"""
Linearly increase `lr` for... | code_fim | hard | {
"lang": "python",
"repo": "benihime91/gale",
"path": "/gale/schedules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dolamroth/visual_novel path: /visual_novel/translation/admin.py
from bitfield import BitField
from django.contrib import admin
from .models import TranslationItem, TranslationBetaLink, TranslationItemSendToVK, TranslationBetaLinkSendToVK
from .widgets import StatusBitFieldWidget
class Transla... | code_fim | hard | {
"lang": "python",
"repo": "dolamroth/visual_novel",
"path": "/visual_novel/translation/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TranslationItemAdmin(admin.ModelAdmin):
inlines = (TranslationBetaLinkInline,)
list_display = (
'__str__', 'is_published', 'visual_novel', 'translation_status'
)
fields = (
'is_published', 'moderators', 'translator', 'status', 'statistics', 'visual_novel'
)
f... | code_fim | hard | {
"lang": "python",
"repo": "dolamroth/visual_novel",
"path": "/visual_novel/translation/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>in range(len(A[i])):
answer[j][i] = A[i][j]
#print(answer)
return answer
solution = Solution()
solution.transpose([[1,2,3],[4,5,6]])<|fim_prefix|># repo: zzz0906/LeetCode path: /Scripts/867.py
class Solution(object):
def transpose(self, A):
"""
:type A:... | code_fim | hard | {
"lang": "python",
"repo": "zzz0906/LeetCode",
"path": "/Scripts/867.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zzz0906/LeetCode path: /Scripts/867.py
class Solution(object):
def transpose(self, A):
"""
:type A: List[List[int]]
:rtype: List[List[int]]
"""
answer =[]
first_x = len(A)
first_y = len(A[0])
for i in range(first_y):
... | code_fim | hard | {
"lang": "python",
"repo": "zzz0906/LeetCode",
"path": "/Scripts/867.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aliyun/alibabacloud-python-sdk-v2 path: /alibabacloud/clients/ft_20180713.py
# Copyright 2019 Alibaba Cloud Inc. 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 t... | code_fim | hard | {
"lang": "python",
"repo": "aliyun/alibabacloud-python-sdk-v2",
"path": "/alibabacloud/clients/ft_20180713.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> api_request = APIRequest('FtParamList', 'GET', 'http', 'RPC', 'query')
api_request._params = {"Disk": list_of_disk, "Name": name}
repeat_info = {"Disk": ('Disk', 'list', 'dict', [('Size', 'list', 'str', None),
('Type', 'list'... | code_fim | hard | {
"lang": "python",
"repo": "aliyun/alibabacloud-python-sdk-v2",
"path": "/alibabacloud/clients/ft_20180713.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ft_api_alias_api(self, name=None):
api_request = APIRequest('FTApiAliasApi', 'GET', 'http', 'RPC', 'query')
api_request._params = {"Name": name}
return self._handle_request(api_request).result
def ft_eagle_eye(self, name=None):
api_request = APIRequest('FtEagle... | code_fim | hard | {
"lang": "python",
"repo": "aliyun/alibabacloud-python-sdk-v2",
"path": "/alibabacloud/clients/ft_20180713.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hakril/PythonForWindows path: /windows/security.py
lf):
"""The security descriptor control
:type: :class:`~windows.generated_def.winstructs.SECURITY_DESCRIPTOR_CONTROL`
"""
lpdwRevision = gdef.DWORD()
control = gdef.SECURITY_DESCRIPTOR_CONTROL()
wi... | code_fim | hard | {
"lang": "python",
"repo": "hakril/PythonForWindows",
"path": "/windows/security.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
ACE_CLASS_BY_ACE_TYPE = {cls.ACE_TYPE: cls for cls in (
# DACL
AccessAllowedACE,
AccessDeniedACE,
AccessAllowedCallbackACE,
AccessDeniedCallbackACE,
AccessAllowedObjectACE,
AccessDeniedObjectACE,
AccessAllowedCallbackObjectACE,
# SACL
SystemAuditACE,
SystemAlar... | code_fim | hard | {
"lang": "python",
"repo": "hakril/PythonForWindows",
"path": "/windows/security.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return gdef.LPWSTR(addr).value
# https://msdn.microsoft.com/en-us/library/hh877847.aspx
def retrieve_psid_from_addr(addr):
psid_addr = addr + gdef.CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_RELATIVE.OctetString.offset
return gdef.PSID(psid_addr)
def retrieve_bool_from_addr(addr):
return bool(... | code_fim | hard | {
"lang": "python",
"repo": "hakril/PythonForWindows",
"path": "/windows/security.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> created = models.DateTimeField(auto_now=True)
related_resource_1 = models.ForeignKey(
RelatedResource1, on_delete=models.CASCADE)
related_resource_2 = models.OneToOneField(
RelatedResource2, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
class CustomRes... | code_fim | hard | {
"lang": "python",
"repo": "NeilduToit13/drf-hal-json",
"path": "/tests/testproject/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeilduToit13/drf-hal-json path: /tests/testproject/models.py
from django.db import models
class RelatedResource1(models.Model):
created = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=255)
active = models.BooleanField(default=True)
@property
def _li... | code_fim | hard | {
"lang": "python",
"repo": "NeilduToit13/drf-hal-json",
"path": "/tests/testproject/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url_abs = models.CharField(max_length=255)
url_rel = models.CharField(max_length=255)
class FileResource(models.Model):
file = models.FileField(max_length=255, upload_to='./tmp')
image = models.ImageField(max_length=255, upload_to='./tmp')<|fim_prefix|># repo: NeilduToit13/drf-hal-json ... | code_fim | medium | {
"lang": "python",
"repo": "NeilduToit13/drf-hal-json",
"path": "/tests/testproject/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Json'da base64 kodlanmış belgeyi pdfye çevirir ve kaydeder.
"""
data = json['data']
b64Encoded = data['barkodluBelge']
b64Decoded = base64.b64decode(b64Encoded)
f = open(f"{filename}.pdf","wb")
f.write(b64Decoded)
print(f"{filename}.pdf kaydedildi")
f.close()
d... | code_fim | hard | {
"lang": "python",
"repo": "emrgncr/edevlet-belgedogrula-api",
"path": "/eDevlet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emrgncr/edevlet-belgedogrula-api path: /eDevlet.py
import base64
from requests_html import HTMLSession
import json
from qrtest import *
base_url = "https://m.turkiye.gov.tr"
api = "/api.php"
p = "?p=belge-dogrulama&"
def getJson(barkod:str,tc) -> dict:
"""
Barkod numarası ve tckimlik il... | code_fim | hard | {
"lang": "python",
"repo": "emrgncr/edevlet-belgedogrula-api",
"path": "/eDevlet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Girilen pdf belgesindeki qr kodunu arar ve bulursa {'barkod':barkod,'tckn':tckn} olarak returnler.
"""
return parseQRdata(readQRPdf(file))
def getQRdataImg(file:str = "img.jpg") -> dict:
"""
Girilen resim dosyasında qr kodunu arar ve bulursa {'barkod':barkod,'tckn':tckn} olara... | code_fim | hard | {
"lang": "python",
"repo": "emrgncr/edevlet-belgedogrula-api",
"path": "/eDevlet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinyu/inspec path: /src/inspec_core/app/key_handlers.py
import curses
import curses.textpad
from typing import Optional
import pydantic
from . import events
class KeyHandler(pydantic.BaseModel):
title: str
mapping: dict[tuple[int, ...], tuple[events.Event, bool]]
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "kevinyu/inspec",
"path": "/src/inspec_core/app/key_handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>default_handler = KeyHandler(
title="Main view",
mapping={
(ord("q"),): (events.QuitEvent(), True),
(ord("l"),): (events.NextPage(), True),
(ord("h"),): (events.PrevPage(), True),
(ord("r"),): (events.RequestInput(kind=events.SetRows), True),
(ord("c"),): (e... | code_fim | hard | {
"lang": "python",
"repo": "kevinyu/inspec",
"path": "/src/inspec_core/app/key_handlers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> filtered_counts_df = counts_df.loc[mask].copy()
cluster_ids = np.unique(counts_df.index.map(lambda x: x.split(':')[-1]))
filtered_cluster_ids = np.unique(filtered_counts_df.index.map(lambda x: x.split(':')[-1]))
print(' ** dropping {} introns with counts in fewer than 50% of samples\n'
... | code_fim | hard | {
"lang": "python",
"repo": "broadinstitute/gtex-pipeline",
"path": "/qtl/leafcutter/src/cluster_prepare_fastqtl.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: broadinstitute/gtex-pipeline path: /qtl/leafcutter/src/cluster_prepare_fastqtl.py
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
import subprocess
import os
import gzip
import contextlib
from datetime import datetime
import tempfile
import shutil
impo... | code_fim | hard | {
"lang": "python",
"repo": "broadinstitute/gtex-pipeline",
"path": "/qtl/leafcutter/src/cluster_prepare_fastqtl.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(' ** assigning introns to gene mapping(s)')
n = 0
gene_bed_df = []
group_s = {}
for _,r in bed_df.iterrows():
s = r['ID'].split(':')
cluster_id = s[0]+':'+s[-1]
if cluster_id in cluster2gene_dict:
gene_ids = cluster2gene_dict[cluster_id].spl... | code_fim | hard | {
"lang": "python",
"repo": "broadinstitute/gtex-pipeline",
"path": "/qtl/leafcutter/src/cluster_prepare_fastqtl.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param current_time: int, a current time in seconds.
:return: a duration since last time.
:rtype: int
"""
return current_time - self.slam.get_data(node_name=self.last_point_name)['time']
def is_interesting(self):
"""check if happens somethings interesti... | code_fim | hard | {
"lang": "python",
"repo": "MatufA/drone-simulator",
"path": "/Drone/SmartDroneV2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MatufA/drone-simulator path: /Drone/SmartDroneV2.py
from Drone import Drone
from Drone import DroneState
from SLAMGraph import SLAMGraph
import pygame
from math import isinf
from random import uniform
class SmartDroneV2(Drone):
"""
Smart-DroneV2, a drone which can make it's own decision... | code_fim | hard | {
"lang": "python",
"repo": "MatufA/drone-simulator",
"path": "/Drone/SmartDroneV2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanigdh/EmployeeApp-CRUD-Django path: /EmployeeApp/migrations/0002_rename_departmantname_department_departmentname.py
# Generated by Django 3.2.6 on 2021-08-29 18:15
from django.db import migrations
<|fim_suffix|>
dependencies = [
('EmployeeApp', '0001_initial'),
]
operatio... | code_fim | easy | {
"lang": "python",
"repo": "sanigdh/EmployeeApp-CRUD-Django",
"path": "/EmployeeApp/migrations/0002_rename_departmantname_department_departmentname.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='department',
old_name='DepartmantName',
new_name='DepartmentName',
),
]<|fim_prefix|># repo: sanigdh/EmployeeApp-CRUD-Django path: /EmployeeApp/migrations/0002_rename_departmantname_department_d... | code_fim | medium | {
"lang": "python",
"repo": "sanigdh/EmployeeApp-CRUD-Django",
"path": "/EmployeeApp/migrations/0002_rename_departmantname_department_departmentname.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Huawei-Ascend/modelzoo path: /built-in/TensorFlow/Official/cv/image_classification/MobileNetV2_for_TensorFlow/99-origin/test_apex.py
import os
os.environ['TF_AUTO_MIXED_PRECISION_GRAPH_REWRITE_IGNORE_PERFORMANCE'] = '1'
import tensorflow as tf
from tensorflow import keras as K
import numpy as np
... | code_fim | hard | {
"lang": "python",
"repo": "Huawei-Ascend/modelzoo",
"path": "/built-in/TensorFlow/Official/cv/image_classification/MobileNetV2_for_TensorFlow/99-origin/test_apex.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = tf.Session()
s.run(tf.global_variables_initializer())
for i in range(1000):
x = np.random.normal(0, 1, [10, 128, 128, 3])
loss, _ = s.run([loss_op, optim_op], {in_p: x})
print(loss)<|fim_prefix|># repo: Huawei-Ascend/modelzoo path: /built-in/TensorFlow/Official/cv/image_classification/Mo... | code_fim | hard | {
"lang": "python",
"repo": "Huawei-Ascend/modelzoo",
"path": "/built-in/TensorFlow/Official/cv/image_classification/MobileNetV2_for_TensorFlow/99-origin/test_apex.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns subprocess.CompletedProcess
'''
logger = logging.getLogger("main")
logger.debug("Running: %s", " ".join(cmd))
stderr_dest = subprocess.PIPE if keep_stderr else subprocess.DEVNULL
stdout_dest = subprocess.PIPE if keep_stdout else subprocess.DEVNULL
try:
compl_proc = subprocess.run(cmd,
... | code_fim | medium | {
"lang": "python",
"repo": "laxeye/zga",
"path": "/zga/essential.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: laxeye/zga path: /zga/essential.py
import logging
import os.path
import subprocess
import sys
def create_subdir(parent, child) -> str:
'''Tries to create a subdirectory, returns path if succes.'''
logger = logging.getLogger("main")
path = os.path.join(parent, child)
try:
os.mkdir(path)
e... | code_fim | hard | {
"lang": "python",
"repo": "laxeye/zga",
"path": "/zga/essential.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MicahZheng/news_web path: /www/config_override.py
#! /usr/bin/env python3
# -*- coding: <|fim_suffix|> {
'host': 'localhost'
}
}<|fim_middle|>utf-8 -*-
'''
Configurations
'''
__author__ = 'micah'
configs = {
'db': | code_fim | medium | {
"lang": "python",
"repo": "MicahZheng/news_web",
"path": "/www/config_override.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> {
'host': 'localhost'
}
}<|fim_prefix|># repo: MicahZheng/news_web path: /www/config_override.py
#! /usr/bin/env python3
# -*- coding: <|fim_middle|>utf-8 -*-
'''
Configurations
'''
__author__ = 'micah'
configs = {
'db': | code_fim | medium | {
"lang": "python",
"repo": "MicahZheng/news_web",
"path": "/www/config_override.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># nph-sys-reboot.pyと同様visudoに登録が必要
subprocess.Popen(['sudo', '/sbin/shutdown', '-h', 'now'])
print('HTTP/1.1 302 Found')
print('Location: ../index.html')
print('')<|fim_prefix|># repo: kuuen/drive-recorder path: /cgi-bin/nph-sys-shutdown.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
<|fim_middle|>impor... | code_fim | hard | {
"lang": "python",
"repo": "kuuen/drive-recorder",
"path": "/cgi-bin/nph-sys-shutdown.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kuuen/drive-recorder path: /cgi-bin/nph-sys-shutdown.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
<|fim_suffix|># 多重起動チェック
if multrunchk.chekMultipleRun('nph-sys-shutdown.py', '') == False:
print('HTTP/1.1 302 Found')
print('Location: ../index.html')
print('')
quit()
# nph-sys-reboot.p... | code_fim | easy | {
"lang": "python",
"repo": "kuuen/drive-recorder",
"path": "/cgi-bin/nph-sys-shutdown.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 多重起動チェック
if multrunchk.chekMultipleRun('nph-sys-shutdown.py', '') == False:
print('HTTP/1.1 302 Found')
print('Location: ../index.html')
print('')
quit()
# nph-sys-reboot.pyと同様visudoに登録が必要
subprocess.Popen(['sudo', '/sbin/shutdown', '-h', 'now'])
print('HTTP/1.1 302 Found')
print('Location: ..... | code_fim | easy | {
"lang": "python",
"repo": "kuuen/drive-recorder",
"path": "/cgi-bin/nph-sys-shutdown.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BananaDesk/banackupter path: /banackupter.py
#!/usr/bin/env python
# This is the bananadesk superhero backup script.
# Long live the banackupter!
import os
import baker
import shutil
import blinker
import logging
import tempfile
from datetime import date
from datetime import datetime
# settin... | code_fim | hard | {
"lang": "python",
"repo": "BananaDesk/banackupter",
"path": "/banackupter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@baker.command
def weekly(dbname, as_username='postgres'):
"""Create a weekly backup.
"""
filename = '{dbname}-{indate}.dump.sql'.format(
dbname=dbname, indate=datetime.now().strftime('%Y-%m-%d'))
backup_weekly_dir = os.path.join(BACKUPS_STORE_DIR, 'weekly')
if not os.path.is... | code_fim | hard | {
"lang": "python",
"repo": "BananaDesk/banackupter",
"path": "/banackupter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Puts the message in the real queue, but ensures the caller doesn't exceed the limit allowed.
Throws queue.Full exception when limit is reached. The dictionary of semaphores allows several
senders to put messages in a single queue, ensuring none of the senders is deprived and they all
pu... | code_fim | hard | {
"lang": "python",
"repo": "jlerasmus/watsor",
"path": "/watsor/stream/sync.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jlerasmus/watsor path: /watsor/stream/sync.py
from multiprocessing import Condition, Queue, Semaphore, RLock, get_context
from multiprocessing.queues import JoinableQueue
from multiprocessing.sharedctypes import Value
from enum import IntEnum
from typing import Dict
from queue import Full
from ti... | code_fim | hard | {
"lang": "python",
"repo": "jlerasmus/watsor",
"path": "/watsor/stream/sync.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def Close(self):
self.conexion.close()
if __name__ == '__main__':
x=SQlite()
db = sqlite3.connect('2p.db')
x.C()
x.R(1)
x.u()
x.D(1)
'''Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()"... | code_fim | hard | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ene-Jun-2018/Estefania Sosa/2 parcial/db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jonathan-aguilar/DAS_Sistemas path: /Ene-Jun-2018/Estefania Sosa/2 parcial/db.py
import sqlite3
class SQlite():
#conectar con bd
def __init__(self):
self.conexion = sqlite3.connect('2p.db')
self.cursor = self.conexion.cursor()
def C(self):
y=(1,"w","r","t")... | code_fim | hard | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ene-Jun-2018/Estefania Sosa/2 parcial/db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def plotImageset(self, dataset1, dataset2, dataset3):
for i in range(0, 3):
sample = (dataset1.sample(i));
#sample = np.array(sample);
pyplot.subplot(330 + 1 + i);
pyplot.imshow(cv2.cvtColor(sample[0], cv2.COLOR_BGR2RGB));
for i in range(0, 3):
sample = (dataset2.sample(i));
#sampl... | code_fim | hard | {
"lang": "python",
"repo": "dahe-cvl/apa_paper",
"path": "/3D_CNN/Visualization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a grid of 3x3 images
for i in range(0, 9):
sample = (dataset.sample(i));
#sample = np.array(sample);
pyplot.subplot(330 + 1 + i);
pyplot.imshow(cv2.cvtColor(sample[0], cv2.COLOR_BGR2RGB));
# show the plot
pyplot.show();
def plotZeroCenteredImageset(self, dataset):
print("p... | code_fim | hard | {
"lang": "python",
"repo": "dahe-cvl/apa_paper",
"path": "/3D_CNN/Visualization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dahe-cvl/apa_paper path: /3D_CNN/Visualization.py
from keras.utils.visualize_util import plot
from matplotlib import pyplot
import numpy as np
import cv2
class Visualization:
# members
def __init__(self, output_path):
self.output_path = output_path;
def visualizeModelArchitecture(self,... | code_fim | hard | {
"lang": "python",
"repo": "dahe-cvl/apa_paper",
"path": "/3D_CNN/Visualization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f'The annualized returns of the stock is {annualized_returns}, and the standard deviation of the stock is {std}')
def technical_analysis(df, technical_analysis_choice):
""" Doing technical analysis based on user's choice
Parameter: A ticker (String)
A choice (String)
... | code_fim | hard | {
"lang": "python",
"repo": "tonghuang-uw/Project_1",
"path": "/analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tonghuang-uw/Project_1 path: /analysis.py
import pandas as pd
from pandas.core.window.rolling import Window
import numpy as np
import matplotlib.pyplot as plt
def moving_average_analysis(df):
""" Present a moving_average_analysis
Parameter:
A Dataframe
Returns:
A S... | code_fim | hard | {
"lang": "python",
"repo": "tonghuang-uw/Project_1",
"path": "/analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rbwinslow/hq path: /test/hquery/hquery_test_util.py
from hq.output import convert_results_to_output_text
from hq.soup_util import make_soup, is_any_node, root_tag_from_soup
from hq.hquery.hquery_processor import HqueryProcessor
from test.common_test_util import soup_with_body, eliminate_blank_lin... | code_fim | medium | {
"lang": "python",
"repo": "rbwinslow/hq",
"path": "/test/hquery/hquery_test_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def query_context_node(node_or_source, hquery):
if not is_any_node(node_or_source):
node_or_source = root_tag_from_soup(make_soup(node_or_source))
raw_result = HqueryProcessor(hquery).query(node_or_source)
return eliminate_blank_lines(convert_results_to_output_text(raw_result).strip())... | code_fim | hard | {
"lang": "python",
"repo": "rbwinslow/hq",
"path": "/test/hquery/hquery_test_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Trondheim-kommune/Tilskuddsbasen path: /flod_sak/repo/rapport_repo.py
# -*- coding: utf-8 -*-
from sqlalchemy.orm import make_transient
from domain.models import Rapport
from repo.base_repo import BaseRepo
from repo.okonomi_post_repo import OkonomiPostRepo
from repo.soknad_repo import SoknadRepo
... | code_fim | medium | {
"lang": "python",
"repo": "Trondheim-kommune/Tilskuddsbasen",
"path": "/flod_sak/repo/rapport_repo.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> cls.update_model(rapport, 'prosjekt_gjennomforing', data)
cls.update_model(rapport, 'prosjekt_avvik', data)
cls.update_model(rapport, 'budsjett_avvik', data)
cls.update_model(rapport, 'resultat_kommentar', data)
if data.get('arrangement') is not None:
A... | code_fim | medium | {
"lang": "python",
"repo": "Trondheim-kommune/Tilskuddsbasen",
"path": "/flod_sak/repo/rapport_repo.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|>db.session.add(message)
db.session.commit()<|fim_prefix|># repo: vigov5/framgiatw_flask_demo path: /flask_app/seed.py
#!venv/bin/python
from flask import *
from app import db
from app.message.models import Message
<|fim_middle|>message = Message()
message.content = "Welcome to Framgia Workshop !"
| code_fim | medium | {
"lang": "python",
"repo": "vigov5/framgiatw_flask_demo",
"path": "/flask_app/seed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vigov5/framgiatw_flask_demo path: /flask_app/seed.py
#!venv/bin/python
from flask import *
from app import db
from app.message.models import Message
<|fim_suffix|>db.session.add(message)
db.session.commit()<|fim_middle|>message = Message()
message.content = "Welcome to Framgia Workshop !"
| code_fim | medium | {
"lang": "python",
"repo": "vigov5/framgiatw_flask_demo",
"path": "/flask_app/seed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='propriedade',
name='regiao',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='propriedade_regiao', to='localizacao.regiao', verbose_name='Região'),
... | code_fim | hard | {
"lang": "python",
"repo": "WesGtoX/agro-digital",
"path": "/imovel/migrations/0003_auto_20201004_0058.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WesGtoX/agro-digital path: /imovel/migrations/0003_auto_20201004_0058.py
# Generated by Django 3.1.1 on 2020-10-04 03:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddFiel... | code_fim | hard | {
"lang": "python",
"repo": "WesGtoX/agro-digital",
"path": "/imovel/migrations/0003_auto_20201004_0058.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Velocity-Engineering/airbyte path: /airbyte-integrations/connectors/source-snapchat-marketing/source_snapchat_marketing/source.py
rse_qsl, urlparse
import pendulum
import requests
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.stre... | code_fim | hard | {
"lang": "python",
"repo": "Velocity-Engineering/airbyte",
"path": "/airbyte-integrations/connectors/source-snapchat-marketing/source_snapchat_marketing/source.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Docs: https://marketingapi.snapchat.com/docs/#get-all-campaigns """
depends_on_stream = Adaccounts
class Ads(IncrementalSnapchatMarketingStream):
""" Docs: https://marketingapi.snapchat.com/docs/#get-all-ads-under-an-ad-account """
depends_on_stream = Adaccounts
class Adsquads(In... | code_fim | hard | {
"lang": "python",
"repo": "Velocity-Engineering/airbyte",
"path": "/airbyte-integrations/connectors/source-snapchat-marketing/source_snapchat_marketing/source.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_ns_ok1():
"""
Integer timeout should be okey
"""
env = NsSimPyEnvironment()
env.process(some_process(env, env.to_time(10)))
env.run()
assert env.now == 10
def test_ns_ok2():
"""
Integer timeout should be okey
"""
env = NsSimPyEnvironment()
env.proc... | code_fim | hard | {
"lang": "python",
"repo": "cristiklein/tailtamer",
"path": "/tests/test_nssim.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cristiklein/tailtamer path: /tests/test_nssim.py
from tailtamer import NsSimPyEnvironment
from nose.tools import raises
import simpy
import sys
def some_process(env, start_at):
yield env.timeout(start_at)
@raises(TypeError)
def test_ns_fail():
"""
Ensure it is not possible to inje... | code_fim | hard | {
"lang": "python",
"repo": "cristiklein/tailtamer",
"path": "/tests/test_nssim.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r = requests.post(url, files=multiple_files)
print(r.text)<|fim_prefix|># repo: Xrenya/dry path: /API/request.py
import requests
import json
import numpy as np
import cv2
<|fim_middle|>url = "http://127.0.0.1:8000/files"
multiple_files = [
('image1', ('image.png', open('image.png', 'rb'), 'ima... | code_fim | hard | {
"lang": "python",
"repo": "Xrenya/dry",
"path": "/API/request.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xrenya/dry path: /API/request.py
import requests
import json
import numpy as np
import cv2
<|fim_suffix|>multiple_files = [
('image1', ('image.png', open('image.png', 'rb'), 'image/png')),
('image2', ('image.png', open('image.png', 'rb'), 'image/png'))
]
r = requests.post(url, ... | code_fim | easy | {
"lang": "python",
"repo": "Xrenya/dry",
"path": "/API/request.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hogloid/graph3d path: /wscript
# -*- python -*-
APPNAME= 'graph3d'
VERSION= '0.0.1'
top = '.'
out = 'bin'
<|fim_suffix|> conf.load('compiler_cxx')
conf.env.append_value('CXXFLAGS' , ['-O3', '-fopenmp', '-Wall', '-Wextra', '-g', '-msse4.1'])
conf.env.append_value('LINKFLAGS', ['-O3', '-fop... | code_fim | medium | {
"lang": "python",
"repo": "hogloid/graph3d",
"path": "/wscript",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> opt.load('compiler_cxx')
def configure(conf):
conf.load('compiler_cxx')
conf.env.append_value('CXXFLAGS' , ['-O3', '-fopenmp', '-Wall', '-Wextra', '-g', '-msse4.1'])
conf.env.append_value('LINKFLAGS', ['-O3', '-fopenmp', '-Wall', '-Wextra', '-g'])
conf.check_cxx(lib = ['glut', 'pthread', 'GLU',... | code_fim | easy | {
"lang": "python",
"repo": "hogloid/graph3d",
"path": "/wscript",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def options(opt):
opt.load('compiler_cxx')
def configure(conf):
conf.load('compiler_cxx')
conf.env.append_value('CXXFLAGS' , ['-O3', '-fopenmp', '-Wall', '-Wextra', '-g', '-msse4.1'])
conf.env.append_value('LINKFLAGS', ['-O3', '-fopenmp', '-Wall', '-Wextra', '-g'])
conf.check_cxx(lib = ['glut',... | code_fim | easy | {
"lang": "python",
"repo": "hogloid/graph3d",
"path": "/wscript",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adityaU/quokka path: /quokka/tests/__init__.py
import os
class Test(object):
"Run tests."
def __init__(self, start_discovery_dir=None, *args, **kwargs):
<|fim_suffix|> def run(self):
import unittest
if os.path.exists(self.start_discovery_dir):
argv = ["... | code_fim | hard | {
"lang": "python",
"repo": "adityaU/quokka",
"path": "/quokka/tests/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> unittest.main(argv=argv)
else:
print(
"Directory '%s' was not found in project root."
% self.start_discovery_dir)<|fim_prefix|># repo: adityaU/quokka path: /quokka/tests/__init__.py
import os
class Test(object):
"Run tests."
def ... | code_fim | hard | {
"lang": "python",
"repo": "adityaU/quokka",
"path": "/quokka/tests/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/framework/main/logviewer/event/FVEvent.pyi
from typing import List
import ghidra.framework.main.logviewer.event
import java.lang
class FVEvent(object):
"""
Custom events to be used in conjunction with the FVEventListener module. U... | code_fim | hard | {
"lang": "python",
"repo": "kohnakagawa/ghidra_scripts",
"path": "/ghidra9.2.1_pyi/ghidra/framework/main/logviewer/event/FVEvent.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@overload
def wait(self) -> None: ...
@overload
def wait(self, __a0: long) -> None: ...
@overload
def wait(self, __a0: long, __a1: int) -> None: ...
def __init__(self, eventType: ghidra.framework.main.logviewer.event.FVEvent.EventType, arg: object)... | code_fim | hard | {
"lang": "python",
"repo": "kohnakagawa/ghidra_scripts",
"path": "/ghidra9.2.1_pyi/ghidra/framework/main/logviewer/event/FVEvent.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def name(self) -> unicode: ...
def notify(self) -> None: ...
def notifyAll(self) -> None: ...
def ordinal(self) -> int: ...
def toString(self) -> unicode: ...
@overload
@staticmethod
def valueOf(__a0: unicode) -> ghidra.framework.main.lo... | code_fim | hard | {
"lang": "python",
"repo": "kohnakagawa/ghidra_scripts",
"path": "/ghidra9.2.1_pyi/ghidra/framework/main/logviewer/event/FVEvent.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/tensorwatch path: /test/components/notebook_maker.py
import tensorwatch as tw
def main():
w = tw.Watcher()
s1 = w.create_stream()
s2 = w.create_stream(name='accuracy', vis_args=tw.VisArgs(vis_type<|fim_suffix|>reate_stream(name='loss', expr='lambda d:d.loss')
w.make_no... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/tensorwatch",
"path": "/test/components/notebook_maker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>reate_stream(name='loss', expr='lambda d:d.loss')
w.make_notebook()
main()<|fim_prefix|># repo: microsoft/tensorwatch path: /test/components/notebook_maker.py
import tensorwatch as tw
def main():
w = tw.Watcher()
s1 = w.create_stream()
s2 = w.create_stream(name='accuracy', vis_args=tw.... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/tensorwatch",
"path": "/test/components/notebook_maker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def is_linux():
return sys.platform.startswith("linux")<|fim_prefix|># repo: microsoft/onnxruntime path: /tools/python/util/platform_helpers.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
<|fim_middle|>def is_windows():
return sys.p... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/onnxruntime",
"path": "/tools/python/util/platform_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/onnxruntime path: /tools/python/util/platform_helpers.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
def is_windows():
return sys.platform.startswith("win")
<|fim_suffix|> return sys.platform.startswith("linux")<|f... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/onnxruntime",
"path": "/tools/python/util/platform_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def is_macOS(): # noqa: N802
return sys.platform.startswith("darwin")
def is_linux():
return sys.platform.startswith("linux")<|fim_prefix|># repo: microsoft/onnxruntime path: /tools/python/util/platform_helpers.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under th... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/onnxruntime",
"path": "/tools/python/util/platform_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: retip94/slack-sender path: /slack_sender/main.py
from slack import WebClient
from slack.errors import SlackApiError
import yaml
from string import Template
import logging
# noinspection PyArgumentList
logging.basicConfig(handlers=[logging.FileHandler("../log.log"), logging.StreamHandler()],
... | code_fim | medium | {
"lang": "python",
"repo": "retip94/slack-sender",
"path": "/slack_sender/main.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_api_token(token_file=API_TOKEN_FILE):
api_data = {
'api_token': None
}
try:
with open(token_file) as file:
api_data = yaml.full_load(file)
file.close()
except FileNotFoundError:
print("Provide your slack api data")
api_data['a... | code_fim | hard | {
"lang": "python",
"repo": "retip94/slack-sender",
"path": "/slack_sender/main.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yilbegan/vk.py path: /vk/keyboards/keyboard.py
from enum import Enum
from ..exceptions import KeyboardException
import logging
from vk.constants import JSON_LIBRARY
import typing
logger = logging.getLogger(__name__)
# Keyboards: https://vk.com/dev/bots_docs_3
class ButtonColor(Enum):
P... | code_fim | hard | {
"lang": "python",
"repo": "yilbegan/vk.py",
"path": "/vk/keyboards/keyboard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> action = {
"action": {
"type": ButtonType.VKAPPS.value,
"app_id": app_id,
"owner_id": owner_id,
"payload": payload,
}
}
self._add_button(action)
def get_keyboard(self) -> typing.AnyStr:
... | code_fim | hard | {
"lang": "python",
"repo": "yilbegan/vk.py",
"path": "/vk/keyboards/keyboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedesen/zeebe-microcontroller path: /esp32/main.py
'''
This device connects via WiFi and publishes a message to the MQTT channel
zeebe/grpc/createWorkflowInstance, whenever an attached button is pressed.
'''
import network
from umqtt.simple import MQTTClient
from machine import Pin, ADC
import ... | code_fim | hard | {
"lang": "python",
"repo": "pedesen/zeebe-microcontroller",
"path": "/esp32/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>button = Pin(22, Pin.IN, Pin.PULL_UP)
adc = ADC(Pin(32))
def wifi_connect():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect(WIFI_SSID, WIFI_PSK)
while not wlan.isconnected():
... | code_fim | hard | {
"lang": "python",
"repo": "pedesen/zeebe-microcontroller",
"path": "/esp32/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dimagi/commcare-cloud path: /src/commcare_cloud/ansible/library/setup_virtualenv.py
#! /usr/bin/env python3
from __future__ import (absolute_import, division, print_function)
from pathlib import Path
from shlex import quote
from ansible.module_utils.basic import AnsibleModule
__metaclass__ = t... | code_fim | hard | {
"lang": "python",
"repo": "dimagi/commcare-cloud",
"path": "/src/commcare_cloud/ansible/library/setup_virtualenv.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.