text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: fengjixuchui/iWeChat path: /python/iwc_heder_inherit.py
# coding=UTF-8
# 分析继承关系
import re
import iwc_heder_db
import os
# class-dump 导出头文件所在的目录
IPA_HEADER_PATH = '/Users/wangsuyan/Desktop/baidu/reverse/header/wechat'
<|fim_suffix|> dirs = os.listdir(IPA_HEADER_PATH)
for file_name in dir... | code_fim | medium | {
"lang": "python",
"repo": "fengjixuchui/iWeChat",
"path": "/python/iwc_heder_inherit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tellapart/yum-gs-iam path: /gsiam.py
from google.auth import credentials
from google.auth import environment_vars
from google.cloud import storage
import logging
import os
import yum
import yum.config
import yum.Errors
import yum.plugins
from yum.yumRepo import YumRepository
URL_SCHEME = 'gs:... | code_fim | hard | {
"lang": "python",
"repo": "tellapart/yum-gs-iam",
"path": "/gsiam.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if repo.google_application_credentials:
os.environ[environment_vars.CREDENTIALS] = repo.google_application_credentials
self.bucket = bucket
self.base_path = path
self.name = repo.name
self.basecachedir = repo.basecachedir
self.gpgcheck = repo.gpgcheck
self.gpgkey = repo.... | code_fim | hard | {
"lang": "python",
"repo": "tellapart/yum-gs-iam",
"path": "/gsiam.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("\nSynthesize following items:")
for synthesis in crafts:
display_lst = [
k + "(%s) " % synthesis["materials"][k]
for k in synthesis["materials"]
]
print(
synthesis["ta... | code_fim | hard | {
"lang": "python",
"repo": "kyoukaya/ArkPlanner",
"path": "/MaterialPlanning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kyoukaya/ArkPlanner path: /MaterialPlanning.py
ty", "apCost", "stageCode", "stageID"].
convertion_rules: List of dictionaries recording the rules of composing.
Keys of instances: ["id", "name", "level", "source", "madeof"].
"""
# To count items and stag... | code_fim | hard | {
"lang": "python",
"repo": "kyoukaya/ArkPlanner",
"path": "/MaterialPlanning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kyoukaya/ArkPlanner path: /MaterialPlanning.py
]] -= (
gold_worths[dct["item"]["itemId"]]
* dct["quantity"]
/ float(dct["times"])
)
except (KeyError, ValueError):
pass
# Hardcoding: ex... | code_fim | hard | {
"lang": "python",
"repo": "kyoukaya/ArkPlanner",
"path": "/MaterialPlanning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: The-Academic-Observatory/academic-observatory-workflows path: /academic_observatory_workflows/model.py
uthorList
funders: FunderList
publishers: PublisherList
papers: PaperList
fields_of_study: FieldOfStudyList
repositories: RepositoryList
def make_doi(doi_prefix: int):
... | code_fim | hard | {
"lang": "python",
"repo": "The-Academic-Observatory/academic-observatory-workflows",
"path": "/academic_observatory_workflows/model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> schema_path = schema_folder()
with CliRunner().isolated_filesystem() as t:
tables = [
Table(
"repository",
False,
dataset_id_settings,
repository,
bq_find_schema(path=os.path.join(schema_path, "doi"... | code_fim | hard | {
"lang": "python",
"repo": "The-Academic-Observatory/academic-observatory-workflows",
"path": "/academic_observatory_workflows/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass
class FieldOfStudy:
"""A field of study.
:param id: unique identifier.
:param name: the field of study name.
:param level: the field of study level.
"""
id: int
name: str = None
level: int = None
@dataclass
class Journal:
"""A journal
:param id: uni... | code_fim | hard | {
"lang": "python",
"repo": "The-Academic-Observatory/academic-observatory-workflows",
"path": "/academic_observatory_workflows/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GorgonMeducer/CMSIS_5 path: /CMSIS/DSP/cmsisdsp/sdf/nodes/host/FileSource.py
###########################################
# Project: CMSIS DSP Library
# Title: FileSource.py
# Description: Node for creating file source
#
# $Date: 30 July 2021
# $Revision: V1.10.0
#
# Targe... | code_fim | medium | {
"lang": "python",
"repo": "GorgonMeducer/CMSIS_5",
"path": "/CMSIS/DSP/cmsisdsp/sdf/nodes/host/FileSource.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(self._outputSize):
s=self._file.readline()
if (len(s)>0):
a[i]=float(s)
else:
a[i] = 0
return(0)
def __del__(self):
self._file.close()<|fim_prefix|># repo: GorgonMeducer/CMSIS_5 path: /CMSIS/DSP/... | code_fim | medium | {
"lang": "python",
"repo": "GorgonMeducer/CMSIS_5",
"path": "/CMSIS/DSP/cmsisdsp/sdf/nodes/host/FileSource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> GenericSource.__init__(self,outputSize,fifoout)
self._file=open(name,"r")
def run(self):
a=self.getWriteBuffer()
for i in range(self._outputSize):
s=self._file.readline()
if (len(s)>0):
a[i]=float(s)
else:
... | code_fim | medium | {
"lang": "python",
"repo": "GorgonMeducer/CMSIS_5",
"path": "/CMSIS/DSP/cmsisdsp/sdf/nodes/host/FileSource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = 1 + t1 - t2
b = t3 - t1 * r1 + t2 * r1
pr_[idx] = rc_[idx] / (a * rc_[idx] + b)
return pr_
def get_pr_info(lst_lbl, lst_scr):
"""
calculate PR info;
"""
rc_pt = np.linspace(0, 1, 1001)
rc_pt[0] = 1e-16
prs = []
aps = []
for lbl, scr in zip(l... | code_fim | hard | {
"lang": "python",
"repo": "Sumerian-Health/azrt2021",
"path": "/azrt2021/misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sumerian-Health/azrt2021 path: /azrt2021/misc.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 14:52:15 2020
@author: cxue2
"""
from datetime import datetime
import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_auc_score, roc_... | code_fim | hard | {
"lang": "python",
"repo": "Sumerian-Health/azrt2021",
"path": "/azrt2021/misc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_pr_info(lst_lbl, lst_scr):
"""
calculate PR info;
"""
rc_pt = np.linspace(0, 1, 1001)
rc_pt[0] = 1e-16
prs = []
aps = []
for lbl, scr in zip(lst_lbl, lst_scr):
pr, rc, _ = precision_recall_curve(y_true=lbl, probas_pred=scr)
aps.append(average_precisi... | code_fim | hard | {
"lang": "python",
"repo": "Sumerian-Health/azrt2021",
"path": "/azrt2021/misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.api_endpoint = api_endpoint
if response_rule_provider:
self.rules_provider = response_rule_provider
def resolve(self, request):
for response_rule in self.api_endpoint.response_rules.all():
matcher = self.rules_provider.get_matcher(response_rule.rul... | code_fim | hard | {
"lang": "python",
"repo": "aaas19920513/rest-api-mock-server",
"path": "/mock_rest_app/mock_api/response_rules/resolvers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aaas19920513/rest-api-mock-server path: /mock_rest_app/mock_api/response_rules/resolvers.py
from mock_api.response_rules import response_rules_provider
class ResponseResolver(object):
rules_provider = response_rules_provider
<|fim_suffix|> for response_rule in self.api_endpoint.resp... | code_fim | hard | {
"lang": "python",
"repo": "aaas19920513/rest-api-mock-server",
"path": "/mock_rest_app/mock_api/response_rules/resolvers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for response_rule in self.api_endpoint.response_rules.all():
matcher = self.rules_provider.get_matcher(response_rule.rule, response_rule.param_name,
response_rule.param_value)
if matcher.match(request):
r... | code_fim | hard | {
"lang": "python",
"repo": "aaas19920513/rest-api-mock-server",
"path": "/mock_rest_app/mock_api/response_rules/resolvers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simao/Polls2k11 path: /tests/tests.py
# -*- coding: utf-8 -*-
import os
import urllib2
import unittest
import simplejson as json
import polls
from codecs import open
TEST_WIKIPEDIA_PAGE = 'tests/resources/full.html'
LATEST_TEMP_FILE = "tests/latest_temp.json"
__author__ = 'Simao Mata'
class Te... | code_fim | hard | {
"lang": "python",
"repo": "simao/Polls2k11",
"path": "/tests/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def monkey_patch_urlopen(self, expected_url):
'''
Substitute urllib2.urlopen by a custom function that checks that the url is equal to expected_url
and returns the content of the resources/full.html file
TODO: This method of testing assumes the code will use urlopen, w... | code_fim | hard | {
"lang": "python",
"repo": "simao/Polls2k11",
"path": "/tests/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_path = TEST_WIKIPEDIA_PAGE
with open(file_path, 'r', 'utf-8') as fd:
poll_stats = polls.get_poll_newest(fd)
self.assertDictEqual(self.latest_poll, poll_stats)
def monkey_patch_urlopen(self, expected_url):
'''
Substitute urllib2.urlopen by a ... | code_fim | hard | {
"lang": "python",
"repo": "simao/Polls2k11",
"path": "/tests/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.differences = np.append(self.differences, self.std_masses['mass values (g)']) # corresponds to Y, in g
self.uncerts = np.append(self.uncerts, self.std_masses['uncertainties (' + MU_STR + 'g)']) # balance uncertainties in ug
log.debug('differences:\n' + str(self.differences))... | code_fim | hard | {
"lang": "python",
"repo": "MSLNZ/Mass-Circular-Weighing",
"path": "/mass_circular_weighing/routine_classes/final_mass_calc_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MSLNZ/Mass-Circular-Weighing path: /mass_circular_weighing/routine_classes/final_mass_calc_class.py
n file with output data; ideally an absolute path
client : str
name of client
client_masses : dict
dict of client weights
Weight IDs are the stri... | code_fim | hard | {
"lang": "python",
"repo": "MSLNZ/Mass-Circular-Weighing",
"path": "/mass_circular_weighing/routine_classes/final_mass_calc_class.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return items
@app.post("/form/python-tuple")
def post_form_param_tuple(items: tuple = Form()):
return items
client = TestClient(app)
def test_python_list_param_as_form():
response = client.post(
"/form/python-list", data={"items": ["first", "second", "third"]}
)
assert re... | code_fim | medium | {
"lang": "python",
"repo": "samuelcolvin/fastapi",
"path": "/tests/test_forms_from_non_typing_sequences.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samuelcolvin/fastapi path: /tests/test_forms_from_non_typing_sequences.py
from fastapi import FastAPI, Form
from fastapi.testclient import TestClient
app = FastAPI()
@app.post("/form/python-list")
def post_form_param_list(items: list = Form()):
return items
@app.post("/form/python-set")
... | code_fim | hard | {
"lang": "python",
"repo": "samuelcolvin/fastapi",
"path": "/tests/test_forms_from_non_typing_sequences.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_python_set_param_as_form():
response = client.post(
"/form/python-set", data={"items": ["first", "second", "third"]}
)
assert response.status_code == 200, response.text
assert set(response.json()) == {"first", "second", "third"}
def test_python_tuple_param_as_form():
... | code_fim | hard | {
"lang": "python",
"repo": "samuelcolvin/fastapi",
"path": "/tests/test_forms_from_non_typing_sequences.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tusharbudhwani/django-continuous-delivery path: /hooks/pre_gen_project.py
#!/usr/bin/env python
"""Define hooks to be run before project generation."""
import sys
from slugify import slugify
PROJECT_SLUG = "{{ cookiecutter.project_slug }}"
PROJECT_DIRNAME = "{{ cookiecutter.project_dirname }}"... | code_fim | hard | {
"lang": "python",
"repo": "tusharbudhwani/django-continuous-delivery",
"path": "/hooks/pre_gen_project.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Execute intialization checks before project generation."""
check_slugs()
check_identifiers()
if __name__ == "__main__":
main()<|fim_prefix|># repo: tusharbudhwani/django-continuous-delivery path: /hooks/pre_gen_project.py
#!/usr/bin/env python
"""Define hooks to be run before project... | code_fim | hard | {
"lang": "python",
"repo": "tusharbudhwani/django-continuous-delivery",
"path": "/hooks/pre_gen_project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YoshikazuArimitsu/aksdp path: /tests/test_s3file_repository.py
from aksdp.data import RawData, DataFrameData
from aksdp.repository import S3FileRepository, LocalFileRepository
import unittest
from pathlib import Path
import os
class TestS3FileRepository(unittest.TestCase):
def setUp(self):
... | code_fim | medium | {
"lang": "python",
"repo": "YoshikazuArimitsu/aksdp",
"path": "/tests/test_s3file_repository.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> repo_s3 = S3FileRepository(self.access_key_id, self.secret_access_key, self.s3file_url)
data.repository = repo_s3
data.save()
def test_dataframe(self):
# ローカルのファイルを読んでS3に保存
repo = LocalFileRepository(Path(os.path.dirname(__file__)) / Path("titanic.csv"))
... | code_fim | hard | {
"lang": "python",
"repo": "YoshikazuArimitsu/aksdp",
"path": "/tests/test_s3file_repository.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Queries the MySQL database for a specific beer by name or id"""
attr = 'id' if is_id is True else 'name'
query = """
SELECT `id`, `name`, `styleid`, `abv`
FROM `beers`
WHERE `%s` = '%s'
""" % (attr, escape_string(search_term))
return mysq... | code_fim | easy | {
"lang": "python",
"repo": "stormpython/brewmaster",
"path": "/brewmaster/database/lookup_beer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stormpython/brewmaster path: /brewmaster/database/lookup_beer.py
from pymysql import escape_string
from app import mysql
<|fim_suffix|> """Queries the MySQL database for a specific beer by name or id"""
attr = 'id' if is_id is True else 'name'
query = """
SELECT `id`, `nam... | code_fim | easy | {
"lang": "python",
"repo": "stormpython/brewmaster",
"path": "/brewmaster/database/lookup_beer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stochasticnetworkcontrol/snc path: /tests/snc/agents/hedgehog/policies/test_big_step_layered_policy.py
import numpy as np
from snc.agents.hedgehog.params import BigStepLayeredPolicyParams, BigStepPenaltyPolicyParams
from snc.agents.hedgehog.policies.big_step_layered_policy import BigStepLayeredP... | code_fim | hard | {
"lang": "python",
"repo": "stochasticnetworkcontrol/snc",
"path": "/tests/snc/agents/hedgehog/policies/test_big_step_layered_policy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_state = state + (policy_obj.buffer_processing_matrix @ z_star
+ policy_obj.demand_rate) * horizon
# critical safety stock is maintained
np.testing.assert_almost_equal(new_state[2], 10)
def test_full_draining_layered_policy():
env = get_simple_link_constraine... | code_fim | hard | {
"lang": "python",
"repo": "stochasticnetworkcontrol/snc",
"path": "/tests/snc/agents/hedgehog/policies/test_big_step_layered_policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quantumlib/ReCirq path: /recirq/fermi_hubbard/converting_sampler.py
# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.o... | code_fim | hard | {
"lang": "python",
"repo": "quantumlib/ReCirq",
"path": "/recirq/fermi_hubbard/converting_sampler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
program: cirq.Circuit,
params: cirq.Sweepable,
repetitions: int = 1,
) -> List[cirq.Result]:
program = self._convert(program)
return self._sampler.run_sweep(program, params, repetitions)
async def run_async(self, program: cirq.... | code_fim | hard | {
"lang": "python",
"repo": "quantumlib/ReCirq",
"path": "/recirq/fermi_hubbard/converting_sampler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lewfish/mlx path: /mlx/od/fcos/model.py
from collections import defaultdict
import math
import torch
import torch.nn as nn
from torchvision import models
from mlx.od.fcos.decoder import decode_batch_output
from mlx.od.fcos.loss import fcos_batch_loss
class FPN(nn.Module):
"""Feature Pyrami... | code_fim | hard | {
"lang": "python",
"repo": "lewfish/mlx",
"path": "/mlx/od/fcos/model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> u5 = self.up_conv5(c4)
c3 = self.cross_conv3(self.backbone_out['layer3'])
d3 = c3 + nn.functional.interpolate(d4, c3.shape[2:])
c2 = self.cross_conv2(self.backbone_out['layer2'])
d2 = c2 + nn.functional.interpolate(d3, c2.shape[2:])
c1 = self.cross_conv1(... | code_fim | hard | {
"lang": "python",
"repo": "lewfish/mlx",
"path": "/mlx/od/fcos/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: romshen/epam_python_training path: /lecture_11/homework11/tasks/task1.py
"""
Vasya implemented nonoptimal Enum classes.
Remove duplications in variables declarations using metaclasses.
from enum import Enum
class ColorsEnum(Enum):
RED = "RED"
BLUE = "BLUE"
ORANGE = "ORANGE"
BLA... | code_fim | hard | {
"lang": "python",
"repo": "romshen/epam_python_training",
"path": "/lecture_11/homework11/tasks/task1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Raises:
AttributeError: if object has no attribute name;
Returns:
attribute, if is.
"""
try:
return type.__getattribute__(self, name)
except AttributeError as error:
try:
return self.__dict__["member... | code_fim | hard | {
"lang": "python",
"repo": "romshen/epam_python_training",
"path": "/lecture_11/homework11/tasks/task1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rapidsai/cugraph path: /python/cugraph/cugraph/structure/graph_classes.py
Error("Series/DataFrame contains NULL values")
class Graph:
"""
A GPU Graph Object (Base class of other graph types)
Parameters
----------
m_graph : cuGraph.MultiGraph object or None (default=None)
... | code_fim | hard | {
"lang": "python",
"repo": "rapidsai/cugraph",
"path": "/python/cugraph/cugraph/structure/graph_classes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
-------
series : cudf.Series or dask_cudf.Series
The internal vertex identifiers
"""
return self.renumber_map.to_internal_vertex_id(df, column_name)
def add_internal_vertex_id(
self,
df,
internal_column_name,
... | code_fim | hard | {
"lang": "python",
"repo": "rapidsai/cugraph",
"path": "/python/cugraph/cugraph/structure/graph_classes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def is_multipartite(self):
"""
Checks if Graph is multipartite. This solely relies on the user call
of add_nodes_from with the partition parameter. This does not parse
the graph to check if it is multipartite.
NOTE: Currently not implemented and always returns... | code_fim | hard | {
"lang": "python",
"repo": "rapidsai/cugraph",
"path": "/python/cugraph/cugraph/structure/graph_classes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>numba.cuda.cudadrv.driver.Device.reset()
"""
deletes the context for the device. This will destroy all memory allocations, events, and streams created within the context.
"""
classnumba.cuda.cudadrv.driver.Stream(context, handle, finalizer, external=False)
https://numba.pydata.org/numba-doc/dev/cuda-re... | code_fim | medium | {
"lang": "python",
"repo": "timtyree/care",
"path": "/notebooks/lib/controller/numba_stream_processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timtyree/care path: /notebooks/lib/controller/numba_stream_processing.py
#TODO: utilize multiple stream processors for high throughput.
# Stream Management
# Streams allow concurrency of execution on a single device within a given context. Queued work items in the same stream execute sequentially... | code_fim | hard | {
"lang": "python",
"repo": "timtyree/care",
"path": "/notebooks/lib/controller/numba_stream_processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crisdeodates/UAV-MAVSDK-Python path: /examples/camera_params.py
#!/usr/bin/env python3
import asyncio
from aioconsole import ainput
from mavsdk import System
from mavsdk.camera import (CameraError, Mode, Option, Setting)
usage_str = """
Usage:
p print current (changeable) camera settings... | code_fim | hard | {
"lang": "python",
"repo": "crisdeodates/UAV-MAVSDK-Python",
"path": "/examples/camera_params.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def observe_possible_setting_options(drone):
global possible_setting_options
async for settings in drone.camera.possible_setting_options():
possible_setting_options = settings
def print_current_settings():
print(f"* CAM_MODE: {camera_mode}")
for setting in current_settings... | code_fim | hard | {
"lang": "python",
"repo": "crisdeodates/UAV-MAVSDK-Python",
"path": "/examples/camera_params.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
maf: MAF to be converted.
Returns:
DagMaf built from the MAF.
"""
sorted_blocks = sort_mafblocks(maf.filecontent)
dagmafnodes = [
DAGMaf.DAGMafNode(block_id=b.id,
alignment=b.alignment,
orient=b.orient,... | code_fim | medium | {
"lang": "python",
"repo": "meoke/pangtree",
"path": "/pangtreebuild/pangenome/builders/maf2dagmaf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meoke/pangtree path: /pangtreebuild/pangenome/builders/maf2dagmaf.py
from pangtreebuild.mafgraph.sorter import sort_mafblocks
from pangtreebuild.pangenome import DAGMaf
from pangtreebuild.pangenome.parameters import msa
from pangtreebuild.tools import logprocess
<|fim_suffix|> Args:
m... | code_fim | medium | {
"lang": "python",
"repo": "meoke/pangtree",
"path": "/pangtreebuild/pangenome/builders/maf2dagmaf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Training StepFn."""
@tf.function(jit_compile=jit_compile)
def step_fn(inputs):
samples, labels = inputs
with tf.GradientTape() as tape:
logits = model(samples)
loss = compute_loss(labels, logits... | code_fim | hard | {
"lang": "python",
"repo": "xiaoheilong3112/keras",
"path": "/keras/distribute/ctl_correctness_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaoheilong3112/keras path: /keras/distribute/ctl_correctness_test.py
n a copy of the License at
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "xiaoheilong3112/keras",
"path": "/keras/distribute/ctl_correctness_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaoheilong3112/keras path: /keras/distribute/ctl_correctness_test.py
ONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================... | code_fim | hard | {
"lang": "python",
"repo": "xiaoheilong3112/keras",
"path": "/keras/distribute/ctl_correctness_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_braking.py
#calss header
class _BRAKING():
<|fim_suffix|> self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['brake']<|fim_middle|> def __init__(self,):
self.name = "BRAKING"
self.definitio... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_braking.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.basic = ['brake']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_braking.py
#calss header
class _BRAKING():
def __init__(self,):
<|fim_middle|> self.name = "BRAKING"
self.definitions = brake
self.parents = []
self.childen = []
self.properties = []
self.jso... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_braking.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ARM-software/bob-build path: /config_system/config_system/__init__.py
import os
import sys
# The config system depends on the `ply` parser generator. On Android, this may
# come as a prebuilt, but may _not_ automatically be added to PYTHONPATH. If
# we're on Android (tested by checking for `envs... | code_fim | hard | {
"lang": "python",
"repo": "ARM-software/bob-build",
"path": "/config_system/config_system/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .expr import (
format_dependency_list,
) # nopep8: E402 module level import not at top of file<|fim_prefix|># repo: ARM-software/bob-build path: /config_system/config_system/__init__.py
import os
import sys
# The config system depends on the `ply` parser generator. On Android, this may
# come ... | code_fim | hard | {
"lang": "python",
"repo": "ARM-software/bob-build",
"path": "/config_system/config_system/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soipachara43/Alcohol path: /never_หญิง.py
import pandas as pd
import pygal
from pygal.style import DarkStyle
def spirit():
"""start age"""
data = pd.read_csv("never_female.csv")
line_graph = pygal.Pie(fill=True, interpolate='cubic', style=DarkStyle)
line_graph.x_labels = data.AGE... | code_fim | hard | {
"lang": "python",
"repo": "soipachara43/Alcohol",
"path": "/never_หญิง.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>", data.THIRTYTOTHIRFOUR)
line_graph.add("35-39 years old", data.THIRFIVETOTHIRNINE)
line_graph.add("Above 40 years old", data.ABOVEFORTY)
line_graph.render_to_file("never_fe.svg")
spirit()<|fim_prefix|># repo: soipachara43/Alcohol path: /never_หญิง.py
import pandas as pd
import pygal
from py... | code_fim | hard | {
"lang": "python",
"repo": "soipachara43/Alcohol",
"path": "/never_หญิง.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alessandrobalata/pyaigym path: /qlearning_training.py
from src.environment import Environment
from src.action import Action
from src.q_learning.q_agent import QAgent
from src.q_learning.q_episode import QEpisode
from src.performace import Performance
from src.state import State
from src.q_learnin... | code_fim | hard | {
"lang": "python",
"repo": "alessandrobalata/pyaigym",
"path": "/qlearning_training.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> episodes = 1000
try:
pickling_on = open(f"models/{environment_name}.pickle", "rb")
q = pickle.load(pickling_on)
pickling_on.close()
print('loading completed')
except FileNotFoundError:
q = None
env = Environment(environment_name)
q_learn = QLea... | code_fim | medium | {
"lang": "python",
"repo": "alessandrobalata/pyaigym",
"path": "/qlearning_training.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rule mmseqs2:
input: fastx_both_input
output: reads='data/{seq}.mmseqs2.{db}.tsv.gz'
log: log='log/mmseqs2/{seq}.{db}.log',
time='time/mmseqs2/{seq}.{db}.log'
params: db=mmseqs2_db,
db_tsv=mmseqs2_tsv,
query_db='queryDB',
query_lca_db='queryLcaD... | code_fim | hard | {
"lang": "python",
"repo": "thunder123321/metax_bakeoff_2019",
"path": "/rules/mmseqs2.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thunder123321/metax_bakeoff_2019 path: /rules/mmseqs2.smk
MMSEQS2 = config.get('MMSEQS2', 'mmseqs')
mmseqs2_base_all = expand('reports/{sample}.mmseqs2.{{db}}.tsv', sample=samples_all)
MMSEQS2_ALL = expand(mmseqs2_base_all, db=['nr', 'refseqc'])
rule mmseqs2_all:
input: MMSEQS2_ALL
MMSEQS2... | code_fim | hard | {
"lang": "python",
"repo": "thunder123321/metax_bakeoff_2019",
"path": "/rules/mmseqs2.smk",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rule mmseqs2_benchmark:
input: fastx_both_input
output: reads='benchmark/data/{seq}.mmseqs2.{db}.tsv.gz'
log: log='benchmark/log/mmseqs2/{seq}.{db}.log',
time='benchmark/time/mmseqs2/{seq}.{db}.log'
params: db=mmseqs2_db,
db_tsv=mmseqs2_tsv,
query_db='query... | code_fim | hard | {
"lang": "python",
"repo": "thunder123321/metax_bakeoff_2019",
"path": "/rules/mmseqs2.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> centroids = self.client.list_all_centroids().centroids
self.assertEqual(set(['centroid-1', 'centroid-3']), set(centroids))
def test_centroid_creation_already_exists(self):
self.client.create_centroid('centroid-1')
with self.assertRaises(ECentroidAlreadyExists):
... | code_fim | hard | {
"lang": "python",
"repo": "random-mud-pie/relevanced",
"path": "/clients/python/client/relevanced_client/test/test_centroid_crud.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: random-mud-pie/relevanced path: /clients/python/client/relevanced_client/test/test_centroid_crud.py
from __future__ import print_function
from .common import IsolatedTestCase
from .. import (
ECentroidDoesNotExist,
ECentroidAlreadyExists
)
class TestCentroidCrud(IsolatedTestCase):
d... | code_fim | hard | {
"lang": "python",
"repo": "random-mud-pie/relevanced",
"path": "/clients/python/client/relevanced_client/test/test_centroid_crud.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexajwhite/spatialmath-python path: /spatialmath/base/animate.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 12:44:45 2020
@author: corkep
"""
#matplotlib inline
# line.set_data()
# text.set_position()
# quiver.set_offsets(), quiver.set_UVC()
# FancyArrow.set_xy()
... | code_fim | hard | {
"lang": "python",
"repo": "alexajwhite/spatialmath-python",
"path": "/spatialmath/base/animate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def text(self, x, y, z, *args, **kwargs):
h = self.ax.text3D(x, y, z, *args, **kwargs)
self.displaylist.append(Animate.Text(self, h, x, y, z))
#------------------- scatter()
def scatter(self, **kwargs):
pass
#------------------- wrappers fo... | code_fim | hard | {
"lang": "python",
"repo": "alexajwhite/spatialmath-python",
"path": "/spatialmath/base/animate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeilBaksi/Dental-Appointment-Bot path: /dentistAPI/app/demo/v1/api/dentists.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import json,os,sys
from flask import request, g, jsonify
<|fim_suffix|> with open(sys.path[0]+'/v1/api/dentists.json') as json_data... | code_fim | hard | {
"lang": "python",
"repo": "NeilBaksi/Dental-Appointment-Bot",
"path": "/dentistAPI/app/demo/v1/api/dentists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get(self):
with open(sys.path[0]+'/v1/api/dentists.json') as json_data:
d = json.load(json_data)
#return jsonify(d), 200, None
return jsonify({"dentists":d['dentists']})
def post(self):
with open(sys.path[0]+'/v1/api/dentists.json') as json_data:
... | code_fim | medium | {
"lang": "python",
"repo": "NeilBaksi/Dental-Appointment-Bot",
"path": "/dentistAPI/app/demo/v1/api/dentists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renovate-bot/python-game-servers path: /samples/snippets/update_cluster.py
#!/usr/bin/env python
# Copyright 2020 Google 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 obta... | code_fim | hard | {
"lang": "python",
"repo": "renovate-bot/python-game-servers",
"path": "/samples/snippets/update_cluster.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> request = game_server_clusters.UpdateGameServerClusterRequest(
game_server_cluster=game_server_clusters.GameServerCluster(
name=f"projects/{project_id}/locations/{location}/realms/{realm_id}/gameServerClusters/{cluster_id}",
labels={"label-key-1": "label-value-1", "labe... | code_fim | hard | {
"lang": "python",
"repo": "renovate-bot/python-game-servers",
"path": "/samples/snippets/update_cluster.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--project-id', help='Your cloud project ID.', required=True)
parser.add_argument('--location', help='Your realm location.', required=True)
parser.add_argument('--realm-id', help='Your realm ID.', required=T... | code_fim | hard | {
"lang": "python",
"repo": "renovate-bot/python-game-servers",
"path": "/samples/snippets/update_cluster.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.check(expected, doc)
def test_when_with_let(self):
doc = """\
::when:
::let:
a: 1
::get: a == 1
::then:
foo: one
::else:
bar: two
"""
expected ... | code_fim | hard | {
"lang": "python",
"repo": "TestingIaCwithNewAccount/jinsi",
"path": "/tests/test_conditionals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TestingIaCwithNewAccount/jinsi path: /tests/test_conditionals.py
import unittest
from .common import JinsiTestCase
class JinsiConditionals(JinsiTestCase):
def test_conditional_with_let(self):
doc = """\
::let:
a: 1
::when:
::... | code_fim | hard | {
"lang": "python",
"repo": "TestingIaCwithNewAccount/jinsi",
"path": "/tests/test_conditionals.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.check(expected, doc)
def test_case_default_underscore(self):
doc = """\
value:
::let:
x: 17
::case:
x == 1: one
x == 2: two
x == 3: three
... | code_fim | hard | {
"lang": "python",
"repo": "TestingIaCwithNewAccount/jinsi",
"path": "/tests/test_conditionals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> weight_map=1./weight_map
for i,data in enumerate(test_dataset):
output_list=np.zeros((1,1,2*img_size[0],2*img_size[1],2*img_size[2]))
label_list=np.zeros((1,1,2*img_size[0],2*img_size[1],2*img_size[2]))
(inputs,labels,_,guidance,mask)=data
labels3D = pt.autograd.Va... | code_fim | hard | {
"lang": "python",
"repo": "locchio/PFSeg",
"path": "/train_PFSeg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hd_sum+=hausdorff
jc_sum+=jaccard
print("Finished. Total dice: ",dice_sum/len(val_dataset),'\n')
print("Finished. Avg Jaccard: ",jc_sum/len(val_dataset))
print("Finished. Avg hausdorff: ",hd_sum/len(val_dataset))
return dice_sum/len(val_dataset)
def TestModel():
mode... | code_fim | hard | {
"lang": "python",
"repo": "locchio/PFSeg",
"path": "/train_PFSeg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: locchio/PFSeg path: /train_PFSeg.py
import torch as pt
import numpy as np
from model.PFSeg import PFSeg3D
from medpy.metric.binary import jc,hd95
from dataset.GuidedBraTSDataset3D import GuidedBraTSDataset3D
# from loss.FALoss3D import FALoss3D
import cv2
from loss.TaskFusionLoss import TaskFusio... | code_fim | hard | {
"lang": "python",
"repo": "locchio/PFSeg",
"path": "/train_PFSeg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __prune_definition(self, parsed_definition):
stars = parsed_definition
index = 0
while index < len(stars):
delete = []
for pointer in range(index + 1, len(stars)):
if self.__equals(stars[index], stars[pointer]):
de... | code_fim | hard | {
"lang": "python",
"repo": "betty29/code-1",
"path": "/recipes/Python/483735_Constellation_Finder/recipe-483735.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betty29/code-1 path: /recipes/Python/483735_Constellation_Finder/recipe-483735.py
class stars:
def __init__(self, owner, star_data):
self.__owner = owner
self.__star_data = star_data
self.__stars = self.__parse()
self.__set = set(self.__stars)
def __parse... | code_fim | hard | {
"lang": "python",
"repo": "betty29/code-1",
"path": "/recipes/Python/483735_Constellation_Finder/recipe-483735.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> midi_in = rtmidi.RtMidiIn()
if args.list:
list_ports()
else:
if args.port:
port = args.port
else:
port = choose_port()
if args.keycodes:
print_keycodes(port)
else:
config = read_config(args.config)
... | code_fim | hard | {
"lang": "python",
"repo": "Nuhddy/midi-input-mapper",
"path": "/midi-input-mapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> midi_in.openPort(port)
while True:
m = midi_in.getMessage(250)
if m:
print_message(m)
def eval_input(port):
midi_in.openPort(port)
while True:
m = midi_in.getMessage(250)
if m:
note = m.getNoteNumber()
if note in config:... | code_fim | hard | {
"lang": "python",
"repo": "Nuhddy/midi-input-mapper",
"path": "/midi-input-mapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nuhddy/midi-input-mapper path: /midi-input-mapper.py
#! /usr/bin/env python3
import rtmidi
import os
import yaml
import argparse
import sys
def get_args():
p = argparse.ArgumentParser(description="Map MIDI input to commands")
p.add_argument("-l", "--list",
action="st... | code_fim | hard | {
"lang": "python",
"repo": "Nuhddy/midi-input-mapper",
"path": "/midi-input-mapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rospy.sleep(0.01)
if aprendendo:
return 'aprendendo'
return desviando(mini)
# main
def main():
global velocidade_saida
global buffer
rospy.init_node('cf_estados')
# Para usar a webcam
#recebedor = rospy.Subscriber("/cv_camera/image_raw/compressed", CompressedImage, roda_todo_frame, queu... | code_fim | hard | {
"lang": "python",
"repo": "wesleygas/RoR9000",
"path": "/state_full.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wesleygas/RoR9000 path: /state_full.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import rospy
import numpy as np
import tf
from matplotlib import pyplot as plt
import math
import cv2
import time
from geometry_msgs.msg import Twist, Vector3, Pose
from nav_msgs.msg import Odometry
from sensor_... | code_fim | hard | {
"lang": "python",
"repo": "wesleygas/RoR9000",
"path": "/state_full.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Para usar a webcam
#recebedor = rospy.Subscriber("/cv_camera/image_raw/compressed", CompressedImage, roda_todo_frame, queue_size=1, buff_size = 2**24)
start = rospy.get_rostime()
recebedor = rospy.Subscriber("/raspicam_node/image/compressed", CompressedImage, roda_todo_frame, queue_size=10, buff_si... | code_fim | hard | {
"lang": "python",
"repo": "wesleygas/RoR9000",
"path": "/state_full.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/")
async def health(request):
return json({"status": "ok"})
async def send_sms(to_addr, claim_id, body):
headers = {
"Authorization": "Bearer {}".format(getenv("TURN_TOKEN")),
"Content-Type": "application/json",
"x-turn-fallback-channel": "1",
"X-Turn... | code_fim | hard | {
"lang": "python",
"repo": "praekeltfoundation/momconnect-solidarity-sms",
"path": "/api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: praekeltfoundation/momconnect-solidarity-sms path: /api.py
import base64
import hmac
from functools import wraps
from hashlib import sha256
from os import getenv
from urllib.parse import urljoin
import httpx
from sanic import Sanic
from sanic.response import json
from sanic_prometheus import mon... | code_fim | hard | {
"lang": "python",
"repo": "praekeltfoundation/momconnect-solidarity-sms",
"path": "/api.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @wraps(f)
async def decorated_function(request, *args, **kwargs):
try:
signature = request.headers["X-Turn-Hook-Signature"]
assert signature
except (KeyError, AssertionError):
return json({"authorization": "X-Turn-Hook-Signature header required"}... | code_fim | hard | {
"lang": "python",
"repo": "praekeltfoundation/momconnect-solidarity-sms",
"path": "/api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>"A" and linha[j]<="Z"):
linha[j] =<|fim_prefix|># repo: pufe/programa path: /2020-11-16/cripto.py
n = int(input())
for i in range(n):
linh<|fim_middle|>a = input()
for j in range(len(linha)):
c = ""
if (linha[j] >= | code_fim | medium | {
"lang": "python",
"repo": "pufe/programa",
"path": "/2020-11-16/cripto.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pufe/programa path: /2020-11-16/cripto.py
n = int(input())
for i in range(n):
linha = input()
for j in range(len(linh<|fim_suffix|>"A" and linha[j]<="Z"):
linha[j] =<|fim_middle|>a)):
c = ""
if (linha[j] >= | code_fim | easy | {
"lang": "python",
"repo": "pufe/programa",
"path": "/2020-11-16/cripto.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pufe/programa path: /2020-11-16/cripto.py
n = int(input())
for i in range(n):
linh<|fim_suffix|>"A" and linha[j]<="Z"):
linha[j] =<|fim_middle|>a = input()
for j in range(len(linha)):
c = ""
if (linha[j] >= | code_fim | medium | {
"lang": "python",
"repo": "pufe/programa",
"path": "/2020-11-16/cripto.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> colormap = "viridis"
sc = 1/np.sum(cm, axis=1)
cm_norm = sc[None].T * cm
plt.figure()
plt.title(title)
plt.imshow(cm_norm, cmap=colormap)
plt.xlabel("Predicted Label")
plt.ylabel("True Label")
plt.colorbar()
plt.xticks(np.arange(len(cm_norm)))
plt.yticks(np.ar... | code_fim | hard | {
"lang": "python",
"repo": "mandulaj/CryBabyCry",
"path": "/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mandulaj/CryBabyCry path: /tools.py
import os
import numpy as np
import pickle
import matplotlib.pyplot as plt
import matplotlib
def zero_pad(a, length):
z = np.zeros(length)
offset = len(z)//2 - len(a)//2
if offset < 0:
offset = 0
z[offset:offset+len(a)] = a
retur... | code_fim | hard | {
"lang": "python",
"repo": "mandulaj/CryBabyCry",
"path": "/tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/protected_objects_by_env.py
# -*- coding: utf-8 -*-
# Copyright 2023 Cohesity Inc.
class ProtectedObjectsByEnv(object):
"""Implementation of the 'ProtectedObjectsByEnv' model.
Number of Protected Objects by Type.
... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/protected_objects_by_env.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ and one val"""
self.val = val
self.sum += val * n
self.count += n
self.avg = self.sum / self.count
def __str__(self):
fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})'
return fmtstr.format(**self.__dict__)
def wei... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/cv/classification/DnCNN/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/contrib/cv/classification/DnCNN/utils.py
# -*- coding: utf-8 -*-
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/cv/classification/DnCNN/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})'
return fmtstr.format(**self.__dict__)
def weights_init_kaiming(m):
""" init layers """
classname = m.__class__.__name__
if classname.find('Conv') != -1:
nn.init.kaiming_normal(m... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/cv/classification/DnCNN/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KoxAlen/adventofcode path: /day02/script.py
#Written for Python 3.4.2
data = [line.rstrip('\n') for line in open("input.txt")]
totalpaper = 0
totalribbon = 0
for present in data:
<|fim_suffix|> f3 = dimensions[2]*dimensions[0]
extra = min(f1,f2,f3)
wraplenght = 2*(dimensions[0]+dimens... | code_fim | medium | {
"lang": "python",
"repo": "KoxAlen/adventofcode",
"path": "/day02/script.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> f3 = dimensions[2]*dimensions[0]
extra = min(f1,f2,f3)
wraplenght = 2*(dimensions[0]+dimensions[1])
bow = dimensions[0]*dimensions[1]*dimensions[2]
totalpaper += 2*(f1+f2+f3)+extra
totalribbon += wraplenght+bow
print(totalpaper)
print(totalribbon)<|fim_prefix|># repo: KoxAlen/a... | code_fim | medium | {
"lang": "python",
"repo": "KoxAlen/adventofcode",
"path": "/day02/script.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.