text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>if torch.cuda.is_available():
cuda_device = 0
model = model.cuda(cuda_device)
else:
cuda_device = -1
# Train the model - 30 epochs seem to give a pretty good baseline accuracy - 0.7 val accuracy
optimizer = optim.SGD(model.parameters(), lr=0.1)
iterator = BucketIterator(batch_size=2, sorting_... | code_fim | hard | {
"lang": "python",
"repo": "Murfin/allennlp_lab4",
"path": "/modules/homework_4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def clear():
if os.name in ('nt','dos'):
os.system("cls")
elif os.name in ('linux','osx','posix'):
subprocess.call("clear")
else:
print ("\n"*120)<|fim_prefix|># repo: taeminlee/steembank.howmuch path: /util.py
import util, os,subprocess
from collections import Ordered... | code_fim | hard | {
"lang": "python",
"repo": "taeminlee/steembank.howmuch",
"path": "/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def make_row(cols,vals,roundOpt=-1,currencyOpt=False):
o = []
for col in cols:
if col in vals:
temp = vals[col]
if roundOpt > 0:
temp = round(temp, roundOpt)
if roundOpt == 0:
temp = int(temp)
if currencyOpt ==... | code_fim | hard | {
"lang": "python",
"repo": "taeminlee/steembank.howmuch",
"path": "/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taeminlee/steembank.howmuch path: /util.py
import util, os,subprocess
from collections import OrderedDict
from babel.numbers import format_decimal
def get_diff_last(x, y):
diff_last = OrderedDict()
for currency in x.keys():
if currency in y:
diff_last[currency] = (x[c... | code_fim | medium | {
"lang": "python",
"repo": "taeminlee/steembank.howmuch",
"path": "/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emg110/graphique path: /graphique/schema.py
"""
Output graphql schema from a parquet data set.
"""
import argparse
import os
import strawberry
from .scalars import scalar_map
<|fim_suffix|>if __name__ == '__main__':
os.environ['PARQUET_PATH'] = parser.parse_args().path
from graphique imp... | code_fim | medium | {
"lang": "python",
"repo": "emg110/graphique",
"path": "/graphique/schema.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> schema = strawberry.Schema(query=service.Query, scalar_overrides=scalar_map)
print(strawberry.printer.print_schema(schema))<|fim_prefix|># repo: emg110/graphique path: /graphique/schema.py
"""
Output graphql schema from a parquet data set.
"""
import argparse
import os
import strawberry
from .sca... | code_fim | medium | {
"lang": "python",
"repo": "emg110/graphique",
"path": "/graphique/schema.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def process(self, vec):
p = np.dot(np.vstack(self.data), np.append(vec,0))
#p = np.dot(np.vstack(self.data)[:,:-1], vec)
yield self.keys[0], p
class MatrixLtimesMapper(BlockMapper):
def __init__(self):
BlockMapper.__init__(self)
self.ba = None
def pro... | code_fim | hard | {
"lang": "python",
"repo": "reckdk/randomized-LS-solvers",
"path": "/src/rowmatrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield self.ba[:-1]
class MatrixAtABMapper(BlockMapper):
def __init__(self):
BlockMapper.__init__(self)
self.atamat = None
def process(self, vec):
data = np.vstack(self.data)[:,:-1]
if self.atamat:
self.atamat += np.dot( data.T, np.dot( data, m... | code_fim | hard | {
"lang": "python",
"repo": "reckdk/randomized-LS-solvers",
"path": "/src/rowmatrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reckdk/randomized-LS-solvers path: /src/rowmatrix.py
from utils import BlockMapper, add
from ls_utils import convert_rdd, add_index
import numpy as np
import logging
logger = logging.getLogger(__name__)
class RowMatrix(object):
'''
A row matrix class
'''
def __init__(self, rdd, ... | code_fim | hard | {
"lang": "python",
"repo": "reckdk/randomized-LS-solvers",
"path": "/src/rowmatrix.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>namespace = {
'NW' : NAMESPACE_WEIGHT,
'ND' : NAMESPACE_DATA,
'NG' : NAMESPACE_GRADIENT,
'NI' : NAMESPACE_INTERIM,
'NM' : NAMESPACE_META,
'NN' : NAMESPACE_NEIGHBOR,
'NB' : NAMESPACE_BUS,
'NL' : NAMESPACE_NULL,
}<|fim_prefix|># repo: magic3007/tabla path: /compiler/... | code_fim | hard | {
"lang": "python",
"repo": "magic3007/tabla",
"path": "/compiler/include/code.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: magic3007/tabla path: /compiler/include/code.py
NAMESPACE_NULL=0
NAMESPACE_WEIGHT=1 # NAMESPACE_DATA[0] # NAMESPACE_WEIGHT[0]
NAMESPACE_DATA=2
NAMESPACE_GRADIENT=3
NAMESPACE_INTERIM=4
NAMESPACE_META=5
NAMESPACE_NEIGHBOR=6 # [0] = PE_NEIGHBOR, [1] = PU_NEIGHBOR
NAMESPACE_BUS=7
FN_PASS=0
F... | code_fim | hard | {
"lang": "python",
"repo": "magic3007/tabla",
"path": "/compiler/include/code.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _calculate_params(self, cameras):
self._params = np.zeros((PARAMS_PER_CAMERA * len(cameras)), dtype=np.float64)
for i in range(0, len(cameras) * PARAMS_PER_CAMERA, PARAMS_PER_CAMERA):
camera = cameras[i//PARAMS_PER_CAMERA]
self._params[i] = camera.focal
self._params[i+1] ... | code_fim | hard | {
"lang": "python",
"repo": "Conyhui/panoramic-image-stitching",
"path": "/src/stitcher/state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Conyhui/panoramic-image-stitching path: /src/stitcher/state.py
import numpy as np
from ordered_set import OrderedSet
from camera import Camera
from constants import PARAMS_PER_CAMERA
class State:
'''
Bundle adjustment state, stores all camera parameters as a 1D array
Warning: state.camera... | code_fim | hard | {
"lang": "python",
"repo": "Conyhui/panoramic-image-stitching",
"path": "/src/stitcher/state.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Boris-Barboris/PySubs path: /engine/testmodules/TestFIFOModule1.py
# Copyright Alexander Baranin 2016
Logging = None
EngineCore = None
def onLoad(core):
<|fim_suffix|> Logging.logMessage('dummy print from Module1')
def run2():
Logging.logMessage('another dummy print from Module1')
... | code_fim | hard | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/testmodules/TestFIFOModule1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def onUnload():
Logging.logMessage('TestFIFOModule1.onUnload()')
EngineCore.unschedule_FIFO(10)
EngineCore.unschedule_FIFO(30)
def run1():
Logging.logMessage('dummy print from Module1')
def run2():
Logging.logMessage('another dummy print from Module1')
raise ArithmeticError()<|fi... | code_fim | hard | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/testmodules/TestFIFOModule1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run1():
Logging.logMessage('dummy print from Module1')
def run2():
Logging.logMessage('another dummy print from Module1')
raise ArithmeticError()<|fim_prefix|># repo: Boris-Barboris/PySubs path: /engine/testmodules/TestFIFOModule1.py
# Copyright Alexander Baranin 2016
Logging = None
E... | code_fim | medium | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/testmodules/TestFIFOModule1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glynjackson/django-oscar-sagepay path: /tests/facade_tests.py
from django.test import TestCase
from sagepay.forms import SagePayForm
from sagepay.facade import Facade
<|fim_suffix|>
def setUp(self):
self.facade = Facade()
self.card = SagePayForm('1000350000000007', '10/13'... | code_fim | medium | {
"lang": "python",
"repo": "glynjackson/django-oscar-sagepay",
"path": "/tests/facade_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_authorise(self):
sagepay_ref = self.facade.authorise(
order_number="123",
amount="10.99",
billing_address="21 Jump Street",
bankcard=self.card,
shipping_address="21 Jump Street"
)
self.assertTrue(sagepay_ref... | code_fim | medium | {
"lang": "python",
"repo": "glynjackson/django-oscar-sagepay",
"path": "/tests/facade_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: platform9/express-cli path: /pf9/cluster/cluster_attach.py
import os
import time
import requests
import json
import click
from pf9.cluster.exceptions import ClusterAttachFailed, FailedActiveMasters, ClusterNotAvailable, NodeNotFound
from pf9.modules.util import Logger
from pf9.modules.express im... | code_fim | hard | {
"lang": "python",
"repo": "platform9/express-cli",
"path": "/pf9/cluster/cluster_attach.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # configure attach payload (master nodes)
cluster_attach_payload = []
for uuid in uuid_list:
if node_type == 'master':
master_flag = True
else:
master_flag = False
payload_item = {
"uuid": uuid,
... | code_fim | hard | {
"lang": "python",
"repo": "platform9/express-cli",
"path": "/pf9/cluster/cluster_attach.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.environ["IS_OFFLINE"] = offline
os.environ["AWS_DEFAULT_REGION"] = region
table = dynamo.getTable("USER-"+stage)
user = {
"email" : email,
"password": flask_bcrypt.generate_password_hash(password).decode('utf-8')
}
table.put_item(Item=user)
print("User ... | code_fim | medium | {
"lang": "python",
"repo": "davematias/PortfolioV2",
"path": "/Backend/add_admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davematias/PortfolioV2 path: /Backend/add_admin.py
#pylint: disable = no-value-for-parameter
import click
import os
import flask_bcrypt
from utils import dynamo
@click.command()
@click.option('--offline', '-o', default='')
@click.option('--region', '-r', required=True)
@click.option('--stage', ... | code_fim | medium | {
"lang": "python",
"repo": "davematias/PortfolioV2",
"path": "/Backend/add_admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pennsignals/dsdk path: /src/dsdk/__init__.py
"""Data Science Deployment Kit."""
from .asset import Asset
from .flowsheet import Flowsheet
from .flowsheet import Mixin as FlowsheetMixin
from .flowsheet import Result as FlowsheetResult
from .interval import Interval, profile
from .model import Mix... | code_fim | hard | {
"lang": "python",
"repo": "pennsignals/dsdk",
"path": "/src/dsdk/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>xin",
"MssqlMixin",
"Mssql",
"PostgresPredictionMixin",
"PostgresMixin",
"Postgres",
"Service",
"Task",
"chunks",
"configure_logger",
"dump_json_file",
"dump_pickle_file",
"load_json_file",
"load_pickle_file",
"profile",
"now_utc_datetime",
"... | code_fim | hard | {
"lang": "python",
"repo": "pennsignals/dsdk",
"path": "/src/dsdk/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>onfigure_logger,
dump_json_file,
dump_pickle_file,
load_json_file,
load_pickle_file,
now_utc_datetime,
retry,
)
__all__ = (
"Asset",
"Batch",
"CompositeTask",
"Delegate",
"Flowsheet",
"FlowsheetMixin",
"FlowsheetResult",
"Interval",
"Model",
... | code_fim | hard | {
"lang": "python",
"repo": "pennsignals/dsdk",
"path": "/src/dsdk/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OaklandPeters/pyinterfaces path: /pyinterfaces/generics/validate.py
"""
Example implementation of a GenericFunction
validate(Sequence, myvar, name="myvar")
class ExistingFile(Validator):
...
validate(ExistingFile, myvar, name="myvar")
"""
import abc
from ..ducktype import meets
from .... | code_fim | hard | {
"lang": "python",
"repo": "OaklandPeters/pyinterfaces",
"path": "/pyinterfaces/generics/validate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Return message for exception.
@type: subject: type
@param: subject: An interface (such as collections.Sequence)
@type: obj: Any
@type: name: Optional[AnyStr]
@rtype: str
"""
return str.format(
"{subject_name} does not ... | code_fim | hard | {
"lang": "python",
"repo": "OaklandPeters/pyinterfaces",
"path": "/pyinterfaces/generics/validate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anniyanvr/DeepSpeech-1 path: /paddlespeech/s2t/modules/conformer_convolution.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
# Copyright 2019 Mobvoi Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/DeepSpeech-1",
"path": "/paddlespeech/s2t/modules/conformer_convolution.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
x: paddle.Tensor,
mask_pad: paddle.Tensor=paddle.ones([0, 0, 0], dtype=paddle.bool),
cache: paddle.Tensor=paddle.zeros([0, 0, 0, 0])
) -> Tuple[paddle.Tensor, paddle.Tensor]:
"""Compute convolution module.
Args:
x (paddl... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/DeepSpeech-1",
"path": "/paddlespeech/s2t/modules/conformer_convolution.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> learn_energy
del compute_energy
del classify_bounds_on_vars<|fim_prefix|># repo: JayceeLee/LyapunovLearner path: /clfm_lib/__init__.py
from .compute_energy import computeEnergy
# from .. config <|fim_middle|>import *
from .learn_energy import learnEnergy
from .classify_bounds_on_vars import classifyBoun... | code_fim | medium | {
"lang": "python",
"repo": "JayceeLee/LyapunovLearner",
"path": "/clfm_lib/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayceeLee/LyapunovLearner path: /clfm_lib/__init__.py
from .compute_energy import computeEnergy
# from .. config import *
from .learn_energy import learnEnergy
from .classif<|fim_suffix|> learn_energy
del compute_energy
del classify_bounds_on_vars<|fim_middle|>y_bounds_on_vars import classifyBoun... | code_fim | medium | {
"lang": "python",
"repo": "JayceeLee/LyapunovLearner",
"path": "/clfm_lib/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmgowda/kmg-leetcode-python path: /number-of-provinces/number-of-provinces.py
// https://leetcode.com/problems/number-of-provinces
class Solution(object):
<|fim_suffix|> """
:type M: List[List[int]]
:rtype: int
"""
N = len(M)
vis = [False]*N
... | code_fim | hard | {
"lang": "python",
"repo": "kmgowda/kmg-leetcode-python",
"path": "/number-of-provinces/number-of-provinces.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type M: List[List[int]]
:rtype: int
"""
N = len(M)
vis = [False]*N
cnt=0
for i in range(N):
if vis[i]:
continue
vis[i] = True
cnt+=1
q = collections.deque(... | code_fim | hard | {
"lang": "python",
"repo": "kmgowda/kmg-leetcode-python",
"path": "/number-of-provinces/number-of-provinces.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
cnt=0
for i in range(N):
if vis[i]:
continue
vis[i] = True
cnt+=1
q = collections.deque()
q.append(i)
while q:
k = q.popleft()
for j in range(N):
... | code_fim | hard | {
"lang": "python",
"repo": "kmgowda/kmg-leetcode-python",
"path": "/number-of-provinces/number-of-provinces.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return torch.qr(matrix)
@jit
def slogdet(matrix: Tensor) -> Tuple[Tensor, Tensor]:
return torch.slogdet(matrix)<|fim_prefix|># repo: qyz-thu/gnn_vae path: /tensorkit/backend/pytorch_/linalg.py
from typing import *
import torch
from .core import *
__all__ = ['qr', 'slogdet']
<|fim_middle|>@... | code_fim | easy | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tensorkit/backend/pytorch_/linalg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@jit
def slogdet(matrix: Tensor) -> Tuple[Tensor, Tensor]:
return torch.slogdet(matrix)<|fim_prefix|># repo: qyz-thu/gnn_vae path: /tensorkit/backend/pytorch_/linalg.py
from typing import *
import torch
from .core import *
<|fim_middle|>__all__ = ['qr', 'slogdet']
@jit
def qr(matrix: Tensor) ->... | code_fim | medium | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tensorkit/backend/pytorch_/linalg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qyz-thu/gnn_vae path: /tensorkit/backend/pytorch_/linalg.py
from typing import *
import torch
from .core import *
<|fim_suffix|> return torch.slogdet(matrix)<|fim_middle|>__all__ = ['qr', 'slogdet']
@jit
def qr(matrix: Tensor) -> Tuple[Tensor, Tensor]:
return torch.qr(matrix)
@jit
d... | code_fim | medium | {
"lang": "python",
"repo": "qyz-thu/gnn_vae",
"path": "/tensorkit/backend/pytorch_/linalg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetPermissionResult:
"""
Resource type definition for AWS::RAM::Permission
"""
__args__ = dict()
__args__['arn'] = arn
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
__re... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/ram/get_permission.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-aws-native path: /sdk/python/pulumi_aws_native/ram/get_permission.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
imp... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/ram/get_permission.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shakk17/WebsiteReader path: /scraping/crawler_handler.py
import os
import pathlib
import subprocess
from pathlib import Path
from databases.handlers.websites_handler import db_insert_website
from helpers.utility import add_scheme
<|fim_suffix|> def run(self):
# Insert domain into the... | code_fim | medium | {
"lang": "python",
"repo": "Shakk17/WebsiteReader",
"path": "/scraping/crawler_handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dir_path = pathlib.Path(__file__).parent.absolute()
# Change working directory to the folder of this file.
os.chdir(dir_path)
# Open a shell in the scrapy directory and start crawling in a new subprocess.
path = str(Path(os.getcwd()))
homepage_url = add_sche... | code_fim | medium | {
"lang": "python",
"repo": "Shakk17/WebsiteReader",
"path": "/scraping/crawler_handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drummonds/fab_support path: /tests/test_pelican.py
import os
import shutil
import unittest
from fabric.api import local, env, lcd
from fab_support import copy_null
def clean_test_pelican():
# Try and remove running apps however relies on demo_django directory not being deleted
# before... | code_fim | medium | {
"lang": "python",
"repo": "drummonds/fab_support",
"path": "/tests/test_pelican.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Definition of different environments to deploy to
env["stages"] = {
"testhost": {
"comment": "stage: Local build and serving from output directory",
"config_file": "local_conf.py",
"destination": "",
"copy_method... | code_fim | medium | {
"lang": "python",
"repo": "drummonds/fab_support",
"path": "/tests/test_pelican.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exiftool_args = [
"-d", f"{self.target_dir}/%Y/%Y-%m-%d/%Y%m%d_%H%M%S_%%f.%%e",
"-testname<CreateDate",
"-testname<DateTimeOriginal",
self.source_dir,
]
self.start(self.executable, exiftool_args)
def run(self):
exiftool_a... | code_fim | hard | {
"lang": "python",
"repo": "vinymeuh/egophoto-pyqt",
"path": "/egophoto/exiftool/image_importer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vinymeuh/egophoto-pyqt path: /egophoto/exiftool/image_importer.py
# Copyright 2020 VinyMeuh. All rights reserved.
# Use of the source code is governed by a MIT-style license that can be found in the LICENSE file.
from PySide2.QtCore import (
QProcess
)
<|fim_suffix|>
def __init__(self, ... | code_fim | medium | {
"lang": "python",
"repo": "vinymeuh/egophoto-pyqt",
"path": "/egophoto/exiftool/image_importer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Human.__init__(self,name)
def _printWomanName_(self):
print (self.name)
def func3():
a = Man('Adam')
a._printManName_()
b = Woman('Eva')
b._printWomanName_()
retList = [a.name, b.name]
print(retList)
func3()<|fim_prefix|># repo: zoltanvasile/ho... | code_fim | hard | {
"lang": "python",
"repo": "zoltanvasile/homework-session-3",
"path": "/homework2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def func2(strA):
print('2. The string is: {}'.format(strA))
strb = " "
a = strA.split()
newStrA = [x[::-1] for x in a]
print('2. Result for problem 2: {}'.format(strb.join(newStrA)))
a = 'This is an example!'
func2(a)
c = 'double spaces'
func2(c)
# 3. According to the ... | code_fim | hard | {
"lang": "python",
"repo": "zoltanvasile/homework-session-3",
"path": "/homework2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zoltanvasile/homework-session-3 path: /homework2.py
# 1. Define a function which receives a string as a parameter. The function splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair ... | code_fim | hard | {
"lang": "python",
"repo": "zoltanvasile/homework-session-3",
"path": "/homework2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esitarski/CrossMgr path: /LapStats.py
from math import sqrt, log, fabs
from statistics import median
import random
def inv_cdf(mu, sigma, p):
'''Inverse cumulative distribution function. x : P(X <= x) = p
Finds the value of the random variable such that the probability of the
variable... | code_fim | hard | {
"lang": "python",
"repo": "esitarski/CrossMgr",
"path": "/LapStats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def probable_lap_ranges( self, laps_max, confidence=0.25 ):
lap_ranges = []
for lap in range(2, laps_max):
lo, hi = self.probable_lap_range(lap, confidence)
if lap_ranges:
lap_last, lo_last, hi_last = lap_ranges[-1]
if hi_last > lo:
hi_last = lo = (hi_last + lo) / 2.0
... | code_fim | hard | {
"lang": "python",
"repo": "esitarski/CrossMgr",
"path": "/LapStats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ProjectCardsSchema(Schema):
nodes = fields.Nested(ProjectCardSchema, many=True, allow_none=True)
totalCount = fields.Int()<|fim_prefix|># repo: PierreRochard/bitcoin-acks path: /src/bitcoin_acks/data_schemas/project_schema.py
from marshmallow import Schema, fields
class ProjectSchema(Sche... | code_fim | hard | {
"lang": "python",
"repo": "PierreRochard/bitcoin-acks",
"path": "/src/bitcoin_acks/data_schemas/project_schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PierreRochard/bitcoin-acks path: /src/bitcoin_acks/data_schemas/project_schema.py
from marshmallow import Schema, fields
class ProjectSchema(Schema):
id = fields.Str()
number = fields.Int()
state = fields.Str()
<|fim_suffix|>
class ProjectCardsSchema(Schema):
nodes = fields.Nes... | code_fim | hard | {
"lang": "python",
"repo": "PierreRochard/bitcoin-acks",
"path": "/src/bitcoin_acks/data_schemas/project_schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>(-x**2-y**2)
mp.imshow(z,cmap='jet',origin='lower')
mp.colorbar()
mp.show()<|fim_prefix|># repo: Dython-sky/AID1908 path: /study/1905/month01/code/Stage5/day03/demo05_imshow.py
"""
demo05_imshow.py imshow图形化显示矩阵
"""
import numpy as np
import matplotli<|fim_middle|>b.pyplot as mp
n = 1000
x,y = np.meshgri... | code_fim | medium | {
"lang": "python",
"repo": "Dython-sky/AID1908",
"path": "/study/1905/month01/code/Stage5/day03/demo05_imshow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dython-sky/AID1908 path: /study/1905/month01/code/Stage5/day03/demo05_imshow.py
"""
demo05_imshow.py imshow图形化显示矩阵
"""
import numpy as np
import matplotli<|fim_suffix|>3,3,n))
# print(x, '-> x')
# print(y, '-> y')
z = (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
mp.imshow(z,cmap='jet',origin='lower')
mp.... | code_fim | medium | {
"lang": "python",
"repo": "Dython-sky/AID1908",
"path": "/study/1905/month01/code/Stage5/day03/demo05_imshow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestKombuDriverStartWorker(unittest.TestCase):
def setUp(self):
self.logger = mock.Mock()
def test_start_worker_no_defaults(self):
with mock.patch('kombu.connection.BrokerConnection'):
with mock.patch('notabene.kombu_driver.Worker') as worker:
co... | code_fim | hard | {
"lang": "python",
"repo": "StackTach/notabene",
"path": "/tests/test_kombu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StackTach/notabene path: /tests/test_kombu.py
# Copyright 2014 - Dark Secret Software Inc.
# All Rights Reserved.
from contextlib import nested
import unittest
import json
import mock
from notabene import kombu_driver
class MyException(Exception):
"""Don't use Exception in tests."""
p... | code_fim | hard | {
"lang": "python",
"repo": "StackTach/notabene",
"path": "/tests/test_kombu.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def downgrade():
op.drop_column('dbs', 'allow_csv_upload')<|fim_prefix|># repo: timifasubaa/incubator-superset path: /superset/migrations/versions/6400c588de5e_.py
"""empty message
Revision ID: 6400c588de5e
Revises: bddc498dd179
Create Date: 2018-07-13 17:10:00.156708
"""
# revision identifiers, u... | code_fim | medium | {
"lang": "python",
"repo": "timifasubaa/incubator-superset",
"path": "/superset/migrations/versions/6400c588de5e_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timifasubaa/incubator-superset path: /superset/migrations/versions/6400c588de5e_.py
"""empty message
Revision ID: 6400c588de5e
Revises: bddc498dd179
Create Date: 2018-07-13 17:10:00.156708
"""
# revision identifiers, used by Alembic.
revision = '6400c588de5e'
down_revision = 'bddc498dd179'
fr... | code_fim | easy | {
"lang": "python",
"repo": "timifasubaa/incubator-superset",
"path": "/superset/migrations/versions/6400c588de5e_.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def upgrade():
op.add_column('dbs', sa.Column('allow_csv_upload', sa.Boolean(), nullable=True))
def downgrade():
op.drop_column('dbs', 'allow_csv_upload')<|fim_prefix|># repo: timifasubaa/incubator-superset path: /superset/migrations/versions/6400c588de5e_.py
"""empty message
Revision ID: 6400... | code_fim | easy | {
"lang": "python",
"repo": "timifasubaa/incubator-superset",
"path": "/superset/migrations/versions/6400c588de5e_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SISC2014/JobAnalysis path: /job-table/single-user.wsgi
#!/usr/bin/python
# Erik Halperin, 07/17/2014
from cgi import parse_qs # for parsing query strings
import re # for character removal from strings
from pymongo import MongoClient # connect to mongodb
import json # return json doc
import time ... | code_fim | hard | {
"lang": "python",
"repo": "SISC2014/JobAnalysis",
"path": "/job-table/single-user.wsgi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> status = '200 OK'
response_body = []
response_body = json.dumps(query_jobs(hours, user), indent=2)
# return jsonp with callback
response_headers = [('Content-type', 'application/javascript')]
#response_body = callback + '(' + response_body + ');'
start_response(status, respon... | code_fim | hard | {
"lang": "python",
"repo": "SISC2014/JobAnalysis",
"path": "/job-table/single-user.wsgi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def application(environ, start_response):
# parse url parameters
d = parse_qs(environ['QUERY_STRING'])
hours = int(d.get('hours', [''])[0])
user = d.get('user', [''])[0]
status = '200 OK'
response_body = []
response_body = json.dumps(query_jobs(hours, user), indent=2)
# ... | code_fim | hard | {
"lang": "python",
"repo": "SISC2014/JobAnalysis",
"path": "/job-table/single-user.wsgi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>f = createRotatedTurbineForce(mx,my,ma,A,B,numturbs,alpha,V)
# Define symmetric gradient
def epsilon(u):
return sym(nabla_grad(u))
# Define stress tensor
def sigma(u, p):
return 2*mu*epsilon(u) - p*Identity(len(u))
# Define variational problem for step 1
F1 = rho*dot((u - u_n) / k, v)*dx \
... | code_fim | hard | {
"lang": "python",
"repo": "stefanozappa/WindSE",
"path": "/demo/undocumented/Legacy/WindSE2D_Dyn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Define trial and test functions
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)
# Define functions for solutions at previous and current time steps
u_n = Function(V)
u_ = Function(V)
p_n = Function(Q)
p_ = Function(Q)
# Define expressions used in variational forms
U... | code_fim | hard | {
"lang": "python",
"repo": "stefanozappa/WindSE",
"path": "/demo/undocumented/Legacy/WindSE2D_Dyn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stefanozappa/WindSE path: /demo/undocumented/Legacy/WindSE2D_Dyn.py
from __future__ import print_function
from fenics import *
from mshr import *
import numpy as np
from scipy import integrate
set_log_level(LogLevel.INFO)
T = 500.0 # final time
num_steps = 1000 # number of time st... | code_fim | hard | {
"lang": "python",
"repo": "stefanozappa/WindSE",
"path": "/demo/undocumented/Legacy/WindSE2D_Dyn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def inventory_report(prod_list):
"""Creates an inventory report for a given product list"""
prod_list = list(set(prod_list))
x = 0
price = 0
weight = 0
flammability = 0
stealability = 0
for item in prod_list:
x += 1
price += item.price
weight += item... | code_fim | hard | {
"lang": "python",
"repo": "CaiNowicki/DS-Unit-3-Sprint-1-Software-Engineering",
"path": "/acme_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CaiNowicki/DS-Unit-3-Sprint-1-Software-Engineering path: /acme_report.py
from acme import Product
import random
ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved']
NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???']
<|fim_suffix|>
def inventory_report(prod_list):
... | code_fim | hard | {
"lang": "python",
"repo": "CaiNowicki/DS-Unit-3-Sprint-1-Software-Engineering",
"path": "/acme_report.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Validates the existence of the deployment data document"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
schema = CONF.document_info.deployment_version_schema
# Just capitalize the "missing_severity", and then the base class will take
# care of whether or not the... | code_fim | medium | {
"lang": "python",
"repo": "airshipit/shipyard",
"path": "/src/bin/shipyard_airflow/shipyard_airflow/control/validators/validate_deployment_version.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: airshipit/shipyard path: /src/bin/shipyard_airflow/shipyard_airflow/control/validators/validate_deployment_version.py
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | code_fim | hard | {
"lang": "python",
"repo": "airshipit/shipyard",
"path": "/src/bin/shipyard_airflow/shipyard_airflow/control/validators/validate_deployment_version.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def insert(self, val: ValueT) -> int:
new_node = self._make_node(elem=self.data, tail=self.tail)
self.data = val
self.tail = new_node
return 0
def delete(self, pos: int) -> ValueT:
node: LinkedList[ValueT] = hopn(self, pos)
if node.data == EOL:
... | code_fim | hard | {
"lang": "python",
"repo": "agravier/CSBasics",
"path": "/csbasics/linkedlist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agravier/CSBasics path: /csbasics/linkedlist.py
"""An uncomplicated implementation of single-linked lists."""
from __future__ import annotations
from itertools import chain
from typing import List, Optional, Union, Iterator, Reversible, Final, Any
from csbasics.datastructure import DataStructur... | code_fim | hard | {
"lang": "python",
"repo": "agravier/CSBasics",
"path": "/csbasics/linkedlist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> next_node = None
data: Union[ValueT, _EOL] = EOL
if elems is not None:
for e in chain(reversed(elems)):
node = self._make_node(data, next_node)
next_node = node
data = e
self.tail = next_node
self.data = da... | code_fim | hard | {
"lang": "python",
"repo": "agravier/CSBasics",
"path": "/csbasics/linkedlist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flashlin/Samples path: /tf_predict_next_word/predict-next-word-image/src/test7.py
import tensorflow as tf
from transformers import BertTokenizer, TFBertForMaskedLM
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
# model = TFBertForMaskedLM.from_pretrained('bert-base-uncased')
<|f... | code_fim | hard | {
"lang": "python",
"repo": "flashlin/Samples",
"path": "/tf_predict_next_word/predict-next-word-image/src/test7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model.fit(input_ids, input_ids, epochs=100, batch_size=1)
model.save_pretrained('my_model_weights')
return model
training_data = ["select id from customer", "select id,name from prod"]
model = fit(training_data)
# model = TFBertForMaskedLM.from_pretrained("my_model_weights")
predict(model, ... | code_fim | hard | {
"lang": "python",
"repo": "flashlin/Samples",
"path": "/tf_predict_next_word/predict-next-word-image/src/test7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexazevedo/python-bitfinex path: /bitfinex/private_api.py
import requests
import json
import base64
import hmac
import time
import hashlib
class BitfinexTradingApi(object):
def __init__(self, auth_key, auth_secret):
<|fim_suffix|> def _pack_payload(self, payload):
json_payload ... | code_fim | hard | {
"lang": "python",
"repo": "alexazevedo/python-bitfinex",
"path": "/bitfinex/private_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return hmac.new(self.api_secret, encoded_payload, hashlib.sha384).hexdigest()
@staticmethod
def _get_nonce():
return str(time.time() * 1000)<|fim_prefix|># repo: alexazevedo/python-bitfinex path: /bitfinex/private_api.py
import requests
import json
import base64
import hmac
impor... | code_fim | hard | {
"lang": "python",
"repo": "alexazevedo/python-bitfinex",
"path": "/bitfinex/private_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "options": "0x22",
"sequence-number": "0x80000002",
},
{
"advertising-router": "10.34.2.250",
"age": "1814",
"checksum": "0xb7b3",
"lsa-id": "10.1.0.4",
"lsa-length": "13... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/junos/tests/ShowOspfDatabaseOpaqueArea/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/junos/tests/ShowOspfDatabaseOpaqueArea/cli/equal/golden_output_expected.py
expected_output = {
"ospf-database-information": {
"ospf-area-header": {"ospf-area": "0.0.0.8"},
"ospf-database": [
{
... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/junos/tests/ShowOspfDatabaseOpaqueArea/cli/equal/golden_output_expected.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nymous/y50-subwoofer-linux-enabler path: /subwoofer3.py
#!/usr/bin/env python3
import subprocess
import sys
import os
import time
import signal
from subprocess import call
############
# Settings #
############
# For when you don't have headphones in and you want custom volume balance
speaker_... | code_fim | hard | {
"lang": "python",
"repo": "nymous/y50-subwoofer-linux-enabler",
"path": "/subwoofer3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Signal handlers #
###################
def on_exit(*_):
global pactl
if pactl is not None:
pactl.terminate()
disable_subwoofer()
exit(0)
def on_suspend(*_):
print("Disable subwoofer on suspend.")
disable_subwoofer()
def on_resume(*_):
print("Enable subwoofer on re... | code_fim | hard | {
"lang": "python",
"repo": "nymous/y50-subwoofer-linux-enabler",
"path": "/subwoofer3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stvemillertime/time_decode path: /time_decode/time_decode.py
bined_output, reason = self.from_tiktok()
if indiv_output is False:
print(reason)
else:
print(indiv_output)
if self.twitter:
result, ind... | code_fim | hard | {
"lang": "python",
"repo": "stvemillertime/time_decode",
"path": "/time_decode/time_decode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def from_systime(self):
"""Convert a Microsoft 128-bit SYSTEMTIME timestamp to a date"""
reason = "[!] Microsoft 128-bit SYSTEMTIME timestamps are 32 hex characters (16 bytes)"
ts_type = self.ts_types['systemtime']
try:
if not len(self.systime) == 32 or not ... | code_fim | hard | {
"lang": "python",
"repo": "stvemillertime/time_decode",
"path": "/time_decode/time_decode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
"""Process arguments and errors"""
try:
if self.guess:
self.from_all()
return
if self.unix:
result, indiv_output, combined_output, reason = self.from_unix_sec()
if indiv_output is Fa... | code_fim | hard | {
"lang": "python",
"repo": "stvemillertime/time_decode",
"path": "/time_decode/time_decode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> total = 0
for str in strs:
if "s" in str:
index = str.index("s")
total = total + index
return total
print(super_sum(["mustache"]))
print(super_sum(["mustache", "pessimist"]))
print(super_sum(["mustache", "greatest", "almost"]))<|fim_prefix|># repo: iQaiserAbbas/... | code_fim | hard | {
"lang": "python",
"repo": "iQaiserAbbas/Python",
"path": "/10-Lists-Iteration/exercise-02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iQaiserAbbas/Python path: /10-Lists-Iteration/exercise-02.py
# Define a smallest_number function that accepts a list of numbers.
# It should return the smallest value in the list.
#
# smallest_number([1, 2, 3]) => 1
# smallest_number([3, 2, 1]) => 1
# smallest_number([4, 5, 4]) => 4
... | code_fim | hard | {
"lang": "python",
"repo": "iQaiserAbbas/Python",
"path": "/10-Lists-Iteration/exercise-02.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdmorganiser/rdmo path: /rdmo/core/management/commands/upgrade.py
import subprocess
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
<|fim_suffix|> print('>>> python manage.py collectstatic --noinput --clear'... | code_fim | hard | {
"lang": "python",
"repo": "rdmorganiser/rdmo",
"path": "/rdmo/core/management/commands/upgrade.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def handle(self, *args, **options):
print()
print('>>> python manage.py migrate')
print()
call_command('migrate')
print()
print('>>> python manage.py download_vendor_files')
print()
call_command('download_vendor_files')
print()... | code_fim | medium | {
"lang": "python",
"repo": "rdmorganiser/rdmo",
"path": "/rdmo/core/management/commands/upgrade.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tad_config = cfg_rd(cfg_file)
self.data_dir = tad_config.get('tad_analysis', 'data_dir')
self.hCF_resolution = tad_config.get('tad_analysis', 'hicconvertformat_resolution')
self.hFT_minD = tad_config.get('tad_analysis', 'hicfindtads_mindepth')
self.hFT_maxD = tad_co... | code_fim | hard | {
"lang": "python",
"repo": "gouxiaojuan/hic_down",
"path": "/config_wr/config_read.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> com_config = cfg_rd(cfg_file)
self.data_dir = com_config.get('AB_compartment', 'data_dir')
self.cool_resolution = com_config.get('AB_compartment', 'cool_resolution')
self.Omatrix = com_config.get('AB_compartment', 'outputMatrix')
if __name__ == "__main__":
cr = cfg_r... | code_fim | hard | {
"lang": "python",
"repo": "gouxiaojuan/hic_down",
"path": "/config_wr/config_read.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gouxiaojuan/hic_down path: /config_wr/config_read.py
################################################################################
#
################################################################################
import configparser
def cfg_rd(cfg_file):
config_read = configparser.Confi... | code_fim | hard | {
"lang": "python",
"repo": "gouxiaojuan/hic_down",
"path": "/config_wr/config_read.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanielYe1/UriResolutions path: /python_resolutions/beginner/1050.py
dict = {61: 'Brasilia', 71: 'Salvador', 11: 'Sao Paulo', 21: 'R<|fim_suffix|>dict:
print(dict[ddd])
else:
print("DDD nao cadastrado")<|fim_middle|>io de Janeiro', 32: 'Juiz de Fora', 19: 'Campinas',
27: 'Vitoria',... | code_fim | medium | {
"lang": "python",
"repo": "DanielYe1/UriResolutions",
"path": "/python_resolutions/beginner/1050.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>dict:
print(dict[ddd])
else:
print("DDD nao cadastrado")<|fim_prefix|># repo: DanielYe1/UriResolutions path: /python_resolutions/beginner/1050.py
dict = {61: 'Brasilia', 71: 'Salvador', 11: 'Sao Paulo', 21: 'Rio de Janeiro', 32: 'Juiz de Fora', 19: 'Campinas',
27:<|fim_middle|> 'Vitoria',... | code_fim | medium | {
"lang": "python",
"repo": "DanielYe1/UriResolutions",
"path": "/python_resolutions/beginner/1050.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _load_from_file(self):
""" Loads metadata from file """
try:
self.logger.debug('Load metafile %s.', self.meta_file_path)
with codecs.open(self.meta_file_path, 'r', 'utf-8') as meta_file:
self._meta_dict = json.load(meta_file)
... | code_fim | hard | {
"lang": "python",
"repo": "wowkin2/telegram-messages-dump",
"path": "/telegram_messages_dump/chat_dump_metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wowkin2/telegram-messages-dump path: /telegram_messages_dump/chat_dump_metadata.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" This Module contains classes related to Metadata Files"""
import os.path
import errno
import codecs
import json
import logging
from telegram_messages_dump.exceptio... | code_fim | hard | {
"lang": "python",
"repo": "wowkin2/telegram-messages-dump",
"path": "/telegram_messages_dump/chat_dump_metadata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@login_required
@require_http_methods(['POST'])
def action_simple(request, *args, **kwargs):
for k, v in request.POST.items():
request.session[k] = v
request.session['sent'] = True
return HttpResponse(reverse('login_simple'))<|fim_prefix|># repo: thoas/django-backward path: /backwa... | code_fim | medium | {
"lang": "python",
"repo": "thoas/django-backward",
"path": "/backward/tests/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required
def login_simple(request):
return HttpResponse('Ok')
@login_required
@require_http_methods(['POST'])
def action_simple(request, *args, **kwargs):
for k, v in request.POST.items():
request.session[k] = v
request.session['sent'] = True
return HttpResponse(reverse(... | code_fim | medium | {
"lang": "python",
"repo": "thoas/django-backward",
"path": "/backward/tests/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thoas/django-backward path: /backward/tests/views.py
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from backward.decorators import login_required
from django.views.decorators.http import require_http_methods
def simple(request):
return HttpResponse('Ok'... | code_fim | medium | {
"lang": "python",
"repo": "thoas/django-backward",
"path": "/backward/tests/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JohnReid/bioinf-utilities path: /scripts/bed-get-regions
#!/usr/bin/env python2
#
# Copyright John Reid 2013
#
"""
Read a BED file and get the regions in it.
"""
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)-15s:%(levelname)s: %(message)s')
logger... | code_fim | hard | {
"lang": "python",
"repo": "JohnReid/bioinf-utilities",
"path": "/scripts/bed-get-regions",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> chrom = genome[region.chrom]
#assert region.stop <= len(chrom)
record = chrom[region.start:region.stop]
record.id = region_as_str(region)
record.name = region.name
record.description = region.score
return record
#
# Parse the regions and write the sequences
#
if 2 == len(args... | code_fim | medium | {
"lang": "python",
"repo": "JohnReid/bioinf-utilities",
"path": "/scripts/bed-get-regions",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlessandroStaffolani/traffic-sign-recognition path: /src/controllers/MultipleRunController.py
import json
from time import gmtime, strftime
from src.controllers.MenuController import MenuController, MODELS, ACTIONS
class MultipleRunController:
def __init__(self, json_path, json_out_path=N... | code_fim | hard | {
"lang": "python",
"repo": "AlessandroStaffolani/traffic-sign-recognition",
"path": "/src/controllers/MultipleRunController.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.