text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: thetianshuhuang/bmcc path: /bmcc/util/__init__.py
from .get_params import get_params
from .type_check import (
check_data,
check_assignments,
check_mixture_model,
check_compon<|fim_suffix|>_assignments",
"check_mixture_model",
"check_component_model"
]<|fim_middle|>ent_mod... | code_fim | medium | {
"lang": "python",
"repo": "thetianshuhuang/bmcc",
"path": "/bmcc/util/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ent_model
)
__all__ = [
"get_params",
"check_data",
"check_assignments",
"check_mixture_model",
"check_component_model"
]<|fim_prefix|># repo: thetianshuhuang/bmcc path: /bmcc/util/__init__.py
from .get_params import get_params
from .type_check import (
check<|fim_middle|>_data,
... | code_fim | medium | {
"lang": "python",
"repo": "thetianshuhuang/bmcc",
"path": "/bmcc/util/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CellProfiling/HPA-competition-solutions path: /wienerschnitzelgemeinschaft/src/Christof/models/ResNet34/tests/17/train_0_someof5.py
import os, sys
#os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="1"
import numpy as np
import pandas as pd
import matplotlib.pyplo... | code_fim | hard | {
"lang": "python",
"repo": "CellProfiling/HPA-competition-solutions",
"path": "/wienerschnitzelgemeinschaft/src/Christof/models/ResNet34/tests/17/train_0_someof5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def create_train(dataset_info, batch_size, shape, augument=True, heavy_augment_rares=True, oversample_factor = 0):
assert shape[2] == 3
if oversample_factor > 0:
rare_dataset_info = np.array([item for item in dataset_info if np.isin(item['labels'], rar... | code_fim | hard | {
"lang": "python",
"repo": "CellProfiling/HPA-competition-solutions",
"path": "/wienerschnitzelgemeinschaft/src/Christof/models/ResNet34/tests/17/train_0_someof5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from sklearn.metrics import f1_score
individual_f1_scores = np.zeros(28)
for i in range(28):
individual_f1_scores[i] = f1_score(y_true[:,i],preds[:,i])
individual_f1_scores = pd.DataFrame(individual_f1_scores,columns=['f1'])
individual_f1_scores.to_csv(MODEL_PATH + f'summary_f1_{exp_suffix}.csv',inde... | code_fim | hard | {
"lang": "python",
"repo": "CellProfiling/HPA-competition-solutions",
"path": "/wienerschnitzelgemeinschaft/src/Christof/models/ResNet34/tests/17/train_0_someof5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gongzhihong/HybrIK path: /hybrik/models/simple3dposeBaseSMPL.py
from collections import namedtuple
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
from .builder import SPPE
from .layers.Resnet import ResNet
from .layers.smpl.SMPL import SMPL_layer
Mod... | code_fim | hard | {
"lang": "python",
"repo": "gongzhihong/HybrIK",
"path": "/hybrik/models/simple3dposeBaseSMPL.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # transform in-bbox coordinate to image coordinate
uv_homo_jts = torch.cat(
(uvd_jts_new[:, :, :2], torch.ones_like(uvd_jts_new)[:, :, 2:]),
dim=2)
# batch-wise matrix multipy : (B,1,2,3) * (B,K,3,1) -> (B,K,2,1)
uv_jts = torch.matmul(trans_inv.unsqu... | code_fim | hard | {
"lang": "python",
"repo": "gongzhihong/HybrIK",
"path": "/hybrik/models/simple3dposeBaseSMPL.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: strigazi/athena path: /TileCalorimeter/TileConditions/python/TileInfoLoaderConfig.py
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""Define method to construct configured Tile info loader service"""
from __future__ import print_function
from AthenaConfiguration.Com... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/TileCalorimeter/TileConditions/python/TileInfoLoaderConfig.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> G4Version = flags.Sim.G4Version
G4VersionMajor, G4VersionMinor = G4Version.split(".")[1:3]
G4V = int(G4VersionMajor) + int(G4VersionMinor) / 100.
physicsList = flags.Sim.PhysicsList
if 'EmScaleA' not in kwargs:
# Default value since May-2011
... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/TileCalorimeter/TileConditions/python/TileInfoLoaderConfig.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shrikant9867/mycfo path: /mycfo/kpi/doctype/skill_mapping/skill_mapping.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015, indictrans and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
... | code_fim | hard | {
"lang": "python",
"repo": "shrikant9867/mycfo",
"path": "/mycfo/kpi/doctype/skill_mapping/skill_mapping.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@frappe.whitelist()
def get_sample_data():
return {
"get_sample_data": frappe.db.sql("""select skill_matrix_18,sub_skill,1 from `tabSkill Matrix 120` order by skill_matrix_18 asc, sub_skill asc""", as_list=1)
}
@frappe.whitelist()
def get_sample_data_from_table(doc_name):
return {
"get_sampl... | code_fim | medium | {
"lang": "python",
"repo": "shrikant9867/mycfo",
"path": "/mycfo/kpi/doctype/skill_mapping/skill_mapping.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>file.close()
with open("Testing_op.txt","r+") as myfile:
print(myfile.read())
myfile.close()<|fim_prefix|># repo: Docbroke/NPTEL-The-Joy-of-Computing-using-Python path: /NPTEL-Course-Lecture Programmes/substitutionCipher.py
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 19 10:51:39 2021
@au... | code_fim | hard | {
"lang": "python",
"repo": "Docbroke/NPTEL-The-Joy-of-Computing-using-Python",
"path": "/NPTEL-Course-Lecture Programmes/substitutionCipher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Docbroke/NPTEL-The-Joy-of-Computing-using-Python path: /NPTEL-Course-Lecture Programmes/substitutionCipher.py
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 19 10:51:39 2021
<|fim_suffix|>file.close()
with open("Testing_op.txt","r+") as myfile:
print(myfile.read())
myfile.close()<|f... | code_fim | hard | {
"lang": "python",
"repo": "Docbroke/NPTEL-The-Joy-of-Computing-using-Python",
"path": "/NPTEL-Course-Lecture Programmes/substitutionCipher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tbindseil/picture-metadata-service path: /manage.py
# manage.py
import os
import unittest
import coverage # TODO on mac i needed coverage 5.3
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
COV = coverage.coverage(
branch=True,
include='project/*',
... | code_fim | hard | {
"lang": "python",
"repo": "tbindseil/picture-metadata-service",
"path": "/manage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@manager.command
def create_db():
"""Creates the db tables."""
db.create_all()
@manager.command
def drop_db():
"""Drops the db tables."""
db.drop_all()
import json
@manager.command
def t():
"""free form code"""
t()
if __name__ == '__main__':
manager.run()<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "tbindseil/picture-metadata-service",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@manager.option('-c', '--class', dest='test_class', default='all')
def cov(test_class):
"""Runs the unit tests with coverage.
If given a class name, will determine coverage from that class"""
if test_class == 'all':
tests = unittest.TestLoader().discover('project/tests')
else:
... | code_fim | hard | {
"lang": "python",
"repo": "tbindseil/picture-metadata-service",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyunwoo9120/osscap2020 path: /etc/arrayRacing_test.py
import time
scoreHP = [[1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1],
[1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1],
[1,0,1,0,1,1,1,0,0,1,1,1,0,1,0,1],
[1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1],
[1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,1],
[1,1,... | code_fim | medium | {
"lang": "python",
"repo": "hyunwoo9120/osscap2020",
"path": "/etc/arrayRacing_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
for i in board:
time.sleep(0.2)
print(i)
<<<<<<< HEAD
=======
>>>>>>> 77592b6d07792c30ccf4c0eabf448321b075df45<|fim_prefix|># repo: hyunwoo9120/osscap2020 path: /etc/arrayRacing_test.py
import time
scoreHP = [[1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1],
[1,0,1... | code_fim | medium | {
"lang": "python",
"repo": "hyunwoo9120/osscap2020",
"path": "/etc/arrayRacing_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fmilthaler/HTMLParser path: /example/example.py
from htmlparser import HTMLParser
import pandas
# Here we scrap a page from Wikipedia, parse it for tables, and convert the first table found into<|fim_suffix|>ap_url()
# extracting only tables from the webpage
element = 'table'
params = {'class': ... | code_fim | medium | {
"lang": "python",
"repo": "fmilthaler/HTMLParser",
"path": "/example/example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ap_url()
# extracting only tables from the webpage
element = 'table'
params = {'class': 'wikitable sortable'}
elements = hp.get_page_elements(page, element=element, params=params)
# get a pandas.DataFrame from the (first) html table
df = hp.parse_html_table(elements[0])
print(df.columns.values)<|fim_prefi... | code_fim | medium | {
"lang": "python",
"repo": "fmilthaler/HTMLParser",
"path": "/example/example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nrfta/python-netbox-client path: /netbox_client/api/extras_api.py
uest by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.extras_object_changes_read(id, async_req=True)
>>> result = thread.get()
:param async_req bool
... | code_fim | hard | {
"lang": "python",
"repo": "nrfta/python-netbox-client",
"path": "/netbox_client/api/extras_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'data' in par... | code_fim | hard | {
"lang": "python",
"repo": "nrfta/python-netbox-client",
"path": "/netbox_client/api/extras_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'data' in params:
body_params = params['data']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_acce... | code_fim | hard | {
"lang": "python",
"repo": "nrfta/python-netbox-client",
"path": "/netbox_client/api/extras_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_hamming_small(self):
self.assertEqual(1, hamming('GGACGA','GGTCGA'))
def test_hamming_very_long(self):
self.assertEqual(9, hamming('GGACGGATTCTG','AGGACGGATTCT'))
def test_hamming_different_length1(self):
self.assertEqual(4, hamming('AAGCTAC','ACGTT'))
d... | code_fim | medium | {
"lang": "python",
"repo": "davehorner/xpython",
"path": "/hamming/hamming_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davehorner/xpython path: /hamming/hamming_test.py
from hamming import hamming
import unittest
# If the sequences have different lengths, assume the shorter one is extended
# with nucleotides in such a way to guarantee the extra nucleotides are all
# different between the two strands.
class ham... | code_fim | medium | {
"lang": "python",
"repo": "davehorner/xpython",
"path": "/hamming/hamming_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>.4,0.01)
print "f1 5.2 4096 10 0 1"
Pro_crescendi.accelerando(5.2,11.7,1.2,0.5)<|fim_prefix|># repo: SMERM/TR-2015-2016 path: /A.A.-2015-2016/20160111/EB/Crescendi_Sin/crescendi2.py
import Pro_crescendi
print "f1 0 4096 1<|fim_middle|>0 1"
Pro_crescendi.accelerando(0.5,3.7,0 | code_fim | easy | {
"lang": "python",
"repo": "SMERM/TR-2015-2016",
"path": "/A.A.-2015-2016/20160111/EB/Crescendi_Sin/crescendi2.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SMERM/TR-2015-2016 path: /A.A.-2015-2016/20160111/EB/Crescendi_Sin/crescendi2.py
import Pro_crescendi
print "f1 0 4096 10 1"
Pro_crescendi.accelerando(0.5,3.7,0<|fim_suffix|>_crescendi.accelerando(5.2,11.7,1.2,0.5)<|fim_middle|>.4,0.01)
print "f1 5.2 4096 10 0 1"
Pro | code_fim | easy | {
"lang": "python",
"repo": "SMERM/TR-2015-2016",
"path": "/A.A.-2015-2016/20160111/EB/Crescendi_Sin/crescendi2.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_add_roles(self):
sys.argv = ['qds.py', 'group', 'add-roles', '123', '456,789']
print_command()
Connection._api_call = Mock(return_value={})
qds.main()
Connection._api_call.assert_has_calls(call("PUT", "groups/123", {'roles':'456,789'}))
def test_ad... | code_fim | hard | {
"lang": "python",
"repo": "tanishgupta1/qds-sdk-py",
"path": "/tests/test_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tanishgupta1/qds-sdk-py path: /tests/test_group.py
import sys
import os
if sys.version_info > (2, 7, 0):
import unittest
else:
import unittest2 as unittest
from mock import *
import tempfile
sys.path.append(os.path.join(os.path.dirname(__file__), '../bin'))
import qds
import qds_sdk
from ... | code_fim | hard | {
"lang": "python",
"repo": "tanishgupta1/qds-sdk-py",
"path": "/tests/test_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_delete_group(self):
sys.argv = ['qds.py', 'group', 'delete', '123']
print_command()
Connection._api_call = Mock(return_value={})
qds.main()
Connection._api_call.assert_has_calls(call("DELETE", "groups/123", None))
def test_delete_neg(self):
... | code_fim | hard | {
"lang": "python",
"repo": "tanishgupta1/qds-sdk-py",
"path": "/tests/test_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MattMgn/DassaultUAVchallenge path: /arrow_direction.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Direction detection of a red arrow on the ground
written by Matthieu Magnon
2016-2017
Dassault UAV Challenge
"""
import cv2
import numpy as np
from numpy import linalg as LA... | code_fim | hard | {
"lang": "python",
"repo": "MattMgn/DassaultUAVchallenge",
"path": "/arrow_direction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># HOUGH
minLineLength = 20
#cv2.HoughLinesP(edges,p accuracy th accuracy in rad, 100, threshold minLineLength,maxLineGap)
lines = cv2.HoughLinesP(edges,rho = 1,theta = 1*np.pi/180,threshold = 10,minLineLength = 10,maxLineGap = 20)
#lines = cv2.HoughLinesP(edges,rho = 1,theta = 1*np.pi/180,threshold = ... | code_fim | hard | {
"lang": "python",
"repo": "MattMgn/DassaultUAVchallenge",
"path": "/arrow_direction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>i=0
rho = []
th = []
while i<= len(lines)-1:
for x1,y1,x2,y2 in lines[i]:
th_compute = round(np.arctan((0.0+x2-x1)/(y2-y1+0.01))*180/3.14,2)
rho_compute = round(LA.norm([x2-x1,y2-y1]),2)
th.append(th_compute)
rho.append(rho_compute)
cv2.line(img,(x1,y1),(x2,y2),(255,255,0),2)
... | code_fim | hard | {
"lang": "python",
"repo": "MattMgn/DassaultUAVchallenge",
"path": "/arrow_direction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emetowinner/FMS path: /FMsystem/dashboard/models.py
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.ForeignKey(User,default=1,on_delete=models.CASCADE)
first... | code_fim | hard | {
"lang": "python",
"repo": "emetowinner/FMS",
"path": "/FMsystem/dashboard/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>s.ForeignKey(User,default=1,on_delete=models.CASCADE)
# unit_price = models.IntegerField(default = 145)
# litter = models.IntegerField(default = 1)
# vendor = models.CharField(max_length = 100)<|fim_prefix|># repo: emetowinner/FMS path: /FMsystem/dashboard/models.py
from django.conf import se... | code_fim | hard | {
"lang": "python",
"repo": "emetowinner/FMS",
"path": "/FMsystem/dashboard/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: common-workflow-language/workflow-service path: /wes_client/util.py
import os
import json
import schema_salad.ref_resolver
from subprocess import check_call, DEVNULL, CalledProcessError
import yaml
import glob
import requests
import logging
from wes_service.util import visit
from urllib.request... | code_fim | hard | {
"lang": "python",
"repo": "common-workflow-language/workflow-service",
"path": "/wes_client/util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def build_wes_request(workflow_file, json_path, attachments=None):
"""
:param str workflow_file: Path to cwl/wdl file. Can be http/https/file.
:param json_path: Path to accompanying json file.
:param attachments: Any other files needing to be uploaded to the server.
:return: A list ... | code_fim | hard | {
"lang": "python",
"repo": "common-workflow-language/workflow-service",
"path": "/wes_client/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def list_runs(self):
"""
List the workflows, this endpoint will list the workflows
in order of oldest to newest. There is no guarantee of
live updates as the user traverses the pages, the behavior
should be decided (and documented) by each implementation.
... | code_fim | hard | {
"lang": "python",
"repo": "common-workflow-language/workflow-service",
"path": "/wes_client/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># it is not very clear from the problem description, but after
# some trial and error I know that they are not interested in
# k=0, so we will use k from 1 to n...
for k in range(1, n+1):
probs.append(binomial_prob_mass(k, n, 0.5))
# now compute the cumulative probabilities by summing
# the non-cumulat... | code_fim | hard | {
"lang": "python",
"repo": "kub4/rosalind",
"path": "/stronghold/09-INDC/INDC.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kub4/rosalind path: /stronghold/09-INDC/INDC.py
#!/usr/bin/env python3
"""
Independent Segregation of Chromosomes
======================================
Consider a collection of coin flips. One of the most natural questions we can
ask is if we flip a coin 92 times, what is the probability of ob... | code_fim | hard | {
"lang": "python",
"repo": "kub4/rosalind",
"path": "/stronghold/09-INDC/INDC.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> api_key = Auth.authenticate(token)
if api_key:
logger.debug('Event Response: Allow')
return generatePolicy(api_key, 'Allow', event['methodArn'])
else:
logger.debug('Event Response: Deny')
return generatePolicy(None, 'Deny', event['methodArn'])<|fim_prefix|># re... | code_fim | medium | {
"lang": "python",
"repo": "ki-tools/sls_ki_synapse",
"path": "/handlers/auth_handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ki-tools/sls_ki_synapse path: /handlers/auth_handler.py
from core import Auth
from core.log import logger
def generatePolicy(principalId, effect, methodArn):
authResponse = {}
authResponse['principalId'] = principalId
<|fim_suffix|> return authResponse
def authenticate(event, cont... | code_fim | hard | {
"lang": "python",
"repo": "ki-tools/sls_ki_synapse",
"path": "/handlers/auth_handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>import vivotools as vt
from datetime import datetime
print datetime.now(),"Start"
print vt.assert_resource_property("http://a.b","http://c.d","http://e.f")
print vt.assert_resource_property("http://a.b","vivo:authorInAuthorship",
"http://c.d")
print vt.assert_resource_p... | code_fim | medium | {
"lang": "python",
"repo": "rmatam/vivotools",
"path": "/test_assert_resource_property.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>print datetime.now(),"Start"
print vt.assert_resource_property("http://a.b","http://c.d","http://e.f")
print vt.assert_resource_property("http://a.b","vivo:authorInAuthorship",
"http://c.d")
print vt.assert_resource_property("http://a.b","vivo:authorinauthorlist",
... | code_fim | hard | {
"lang": "python",
"repo": "rmatam/vivotools",
"path": "/test_assert_resource_property.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rmatam/vivotools path: /test_assert_resource_property.py
"""
test_assert_resource_property.py -- Given a URI, a vivo resource property
predicate and a resource URI, generate RDF for asserting that the URI has
the resource property URI. The tests demonsrate that that the function does... | code_fim | hard | {
"lang": "python",
"repo": "rmatam/vivotools",
"path": "/test_assert_resource_property.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jaeilepp/eggie path: /ui/fileSelectionDialog.py
'''
Created on Dec 16, 2014
@author: Jaakko Leppakangas
'''
import os
import mne
from PyQt4.QtCore import Qt, pyqtSignal, pyqtSlot
from PyQt4.Qt import QSettings
from PyQt4 import QtGui
from edfToFifDialog import EdfToFifDialog
from general.call... | code_fim | hard | {
"lang": "python",
"repo": "jaeilepp/eggie",
"path": "/ui/fileSelectionDialog.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def accept(self, *args, **kwargs):
"""
Called when ok button is clicked.
If raw file is successfully loaded, a fileChanged -signal is emitted.
"""
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(Qt.WaitCursor))
mneRoot = self.ui.lineEditMneRo... | code_fim | hard | {
"lang": "python",
"repo": "jaeilepp/eggie",
"path": "/ui/fileSelectionDialog.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("{} lançou um raio do trovão em {}".format(self, pokemon))
return super().atacar(pokemon)
class PokemonFogo(Pokemon):
tipo = "fogo"
def atacar(self, pokemon):
print("{} lançou uma bola de fogo na cabeça de {}".format(self, pokemon))
return super()... | code_fim | medium | {
"lang": "python",
"repo": "RychardCosta/pokemon-game",
"path": "/pokemon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RychardCosta/pokemon-game path: /pokemon.py
import random
class Pokemon:
def __init__(self, especie, level=None, nome=None):
self.especie = especie
if level:
self.level = level
else:
self.level = random.randint(1, 100)
... | code_fim | hard | {
"lang": "python",
"repo": "RychardCosta/pokemon-game",
"path": "/pokemon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>a = pylab.gca()
a.set_yticks([0,2])
a.set_xlim([-1,18])
a.set_xlabel('Time')
a.set_ylabel('Amplitude')<|fim_prefix|># repo: nipy/nipy path: /doc/users/plots/random_amplitudes_times.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Thi... | code_fim | hard | {
"lang": "python",
"repo": "nipy/nipy",
"path": "/doc/users/plots/random_amplitudes_times.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nipy/nipy path: /doc/users/plots/random_amplitudes_times.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This figure is meant to represent an event-type design with
events at random times centered [0,2,4,6,8] and random
ampl... | code_fim | medium | {
"lang": "python",
"repo": "nipy/nipy",
"path": "/doc/users/plots/random_amplitudes_times.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mentix02/revolve path: /protests/migrations/0001_initial.py
# Generated by Django 3.1.1 on 2020-09-25 13:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Pr... | code_fim | hard | {
"lang": "python",
"repo": "mentix02/revolve",
"path": "/protests/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Protest',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False... | code_fim | hard | {
"lang": "python",
"repo": "mentix02/revolve",
"path": "/protests/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(TypeError):
function_constraints(int)(1)
def test_return_type_annotation():
@function_constraints
def func1():
pass
@function_constraints
def func2() -> Any:
pass
func1()
func2()<|fim_prefix|># repo: huntzhan/magic-constraints pa... | code_fim | hard | {
"lang": "python",
"repo": "huntzhan/magic-constraints",
"path": "/tests/test_py3_annotation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huntzhan/magic-constraints path: /tests/test_py3_annotation.py
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
import pytest
from magi... | code_fim | hard | {
"lang": "python",
"repo": "huntzhan/magic-constraints",
"path": "/tests/test_py3_annotation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @function_constraints
def func5() -> NoneType:
pass
assert func5() is None
with pytest.raises(TypeError):
@function_constraints
def func6() -> None: # None is instance.
pass
with pytest.raises(TypeError):
function_constraints(int)(1)
de... | code_fim | hard | {
"lang": "python",
"repo": "huntzhan/magic-constraints",
"path": "/tests/test_py3_annotation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># # Expose image embedding classes
# from .image import ImageEmbeddings
# from .image import IdentityImageEmbeddings
# from .image import PrecomputedImageEmbeddings
# from .image import NetworkImageEmbeddings
# from .image import ConvTransformNetworkImageEmbeddings
# # Expose legacy embedding classes
# f... | code_fim | hard | {
"lang": "python",
"repo": "pd3f/pd3-flair",
"path": "/flair/embeddings/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pd3f/pd3-flair path: /flair/embeddings/__init__.py
# Expose base classses
from .base import Embeddings
from .base import ScalarMix
# Expose token embedding classes
from .token import TokenEmbeddings
# from .token import StackedEmbeddings
# from .token import WordEmbeddings
# from .token import C... | code_fim | hard | {
"lang": "python",
"repo": "pd3f/pd3-flair",
"path": "/flair/embeddings/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def save_df(data_frame, file_path):
"""Saves the DataFrame to a specified path
Arguments:
data_frame {pandas.DataFrame} -- DataFrame
file_path {str} -- specifies the data file's desired location to be
saved
Returns:
None --... | code_fim | hard | {
"lang": "python",
"repo": "rndev2017/ExoBoost",
"path": "/src/nasa_api_request.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
data_frame.to_csv(file_path)
return None
def extract_unique_values(existing_df, new_df):
"""Extract unique values (i.e number of planets)
from an external data frame
Arguments:
existing_df {pandas.DataFrame} -- old DataFrame that will be used to
... | code_fim | hard | {
"lang": "python",
"repo": "rndev2017/ExoBoost",
"path": "/src/nasa_api_request.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rndev2017/ExoBoost path: /src/nasa_api_request.py
import os
import pandas as pd
import numpy as np
from astroquery.nasa_exoplanet_archive import NasaExoplanetArchive as query
# reads a data file (.csv) from a designated file path
params_df = pd.read_csv("\\path\\to\\data")
# retrieves d... | code_fim | hard | {
"lang": "python",
"repo": "rndev2017/ExoBoost",
"path": "/src/nasa_api_request.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: InfinityCollaborations/teeedubb-xbmc-repo path: /plugin.hyper.launcher/default.py
play(rom_full_path, listitem)
else:
launcher_script_command = os.path.join(LAUNCHER_SCRIPTS, launcher_script)
file_check(launcher_script_command, launcher_script_command)
cmd = '"%s" "%s" "%s" "%s" "%s" "... | code_fim | hard | {
"lang": "python",
"repo": "InfinityCollaborations/teeedubb-xbmc-repo",
"path": "/plugin.hyper.launcher/default.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>elif mode[0] == 'folder':
prevent_video_playback('start')
system_name = args['foldername'][0]
system_game_list = args['foldername'][0] + '.xml'
system_config = os.path.join(SYSTEMS_CONFIG_PATH, system_name + '-config.xml')
rom_path, rom_extensions, launcher_script, artwork_base_path, icon_path, icon_... | code_fim | hard | {
"lang": "python",
"repo": "InfinityCollaborations/teeedubb-xbmc-repo",
"path": "/plugin.hyper.launcher/default.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if mode is None:
showAllGamesTrailers = []
listing = []
for system in os.listdir(SYSTEMS_PATH):
if system.endswith(".xml"):
system_name = system[:-4]
system_config = os.path.join(SYSTEMS_CONFIG_PATH, system_name + '-config.xml')
system_artwork_path = os.path.join(SYSTEMS_ARTWORK_PATH, system... | code_fim | hard | {
"lang": "python",
"repo": "InfinityCollaborations/teeedubb-xbmc-repo",
"path": "/plugin.hyper.launcher/default.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WilliamSampaio/ExerciciosPython path: /exerc01/01.py
import os
catetoAd = float(input("Cateto Adjacente: "))
catetoOp = float(input("Cateto Oposto: "))
<|fim_suffix|>print(f'Hipotenusa: {hipotenusa}')
os.system('pause')<|fim_middle|>hipotenusa = (catetoAd ** 2 + catetoOp ** 2) ** (1 ... | code_fim | easy | {
"lang": "python",
"repo": "WilliamSampaio/ExerciciosPython",
"path": "/exerc01/01.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f'Hipotenusa: {hipotenusa}')
os.system('pause')<|fim_prefix|># repo: WilliamSampaio/ExerciciosPython path: /exerc01/01.py
import os
catetoAd = float(input("Cateto Adjacente: "))
catetoOp = float(input("Cateto Oposto: "))
<|fim_middle|>hipotenusa = (catetoAd ** 2 + catetoOp ** 2) ** (1 ... | code_fim | easy | {
"lang": "python",
"repo": "WilliamSampaio/ExerciciosPython",
"path": "/exerc01/01.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># ##############################################################################
# ##############################################################################<|fim_prefix|># repo: Aloike/Freebox-Revolution-Monitoring path: /src/export/objects/SystemFan.py
#!/usr/bin/python3
#-*- coding: utf-8 -*-
# co... | code_fim | hard | {
"lang": "python",
"repo": "Aloike/Freebox-Revolution-Monitoring",
"path": "/src/export/objects/SystemFan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aloike/Freebox-Revolution-Monitoring path: /src/export/objects/SystemFan.py
#!/usr/bin/python3
#-*- coding: utf-8 -*-
# coding: utf-8
# pylint: disable=C0103,C0111,W0621
from .. import _generic
# ##############################################################################
# ##################... | code_fim | hard | {
"lang": "python",
"repo": "Aloike/Freebox-Revolution-Monitoring",
"path": "/src/export/objects/SystemFan.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WenqiJiang/FPGA-Accelerator-for-Recommender-Systems path: /keras_wide_deep/python/string2buckets.py
import pandas as pd
import numpy as np
import argparse
import pandas as pd
import operator
from datetime import datetime
import matplotlib.pyplot as plt
from scipy.stats import itemfreq
import te... | code_fim | hard | {
"lang": "python",
"repo": "WenqiJiang/FPGA-Accelerator-for-Recommender-Systems",
"path": "/keras_wide_deep/python/string2buckets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> total_access = np.sum(freq_list_sorted)
x_axis = np.arange(1, total_access+ 1)
freq_cumulative_sum = np.cumsum(freq_list_sorted)
y_axis = np.full(shape=x_axis.shape, fill_value=freq_cumulative_sum[-1])
y_axis[:len(freq_cumulative_sum)] = freq_cumulative_sum
x_axis /= total_access
... | code_fim | hard | {
"lang": "python",
"repo": "WenqiJiang/FPGA-Accelerator-for-Recommender-Systems",
"path": "/keras_wide_deep/python/string2buckets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("length: ", len(freq_list))
# given the data provided, total number of embedding that will be accessed is less than 1MB cache size
freq_list_sorted = sorted(freq_list, reverse=True)
dim = 8
float_size = 4
# BRAM cache = 1MB
cache_entry_num = 1024 * 1024 / dim / float_size... | code_fim | hard | {
"lang": "python",
"repo": "WenqiJiang/FPGA-Accelerator-for-Recommender-Systems",
"path": "/keras_wide_deep/python/string2buckets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theLaborInVain/kdm-manager-api path: /app/assets/__init__.py
"""
This module allows programmatic access to the various asset dictionaries we
support. Some are game assets, some are "meta" assets used by the webapp(s),
etc.
This module also replaces the deprecated/cancelled 'requ... | code_fim | hard | {
"lang": "python",
"repo": "theLaborInVain/kdm-manager-api",
"path": "/app/assets/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if game_assets:
for collection_name in output:
collectionObject = get_game_asset(collection_name, return_type=object)
if not getattr(collectionObject, 'is_game_asset', False):
output.remove(collection_name)
return sorted(output)
@utils.metered
def... | code_fim | hard | {
"lang": "python",
"repo": "theLaborInVain/kdm-manager-api",
"path": "/app/assets/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>+ (sal * 15 / 100)
print('Você receberá R${:.2f} (R${:.2f} + 15%)'.format(novo, sal))<|fim_prefix|># repo: figueiredo-alef/estudo-python path: /exemplos/ex013.py
print('=' * 5, 'EX_013', '=' * 5)
sal = fl<|fim_middle|>oat(input('Salário atual: R$'))
novo = sal | code_fim | easy | {
"lang": "python",
"repo": "figueiredo-alef/estudo-python",
"path": "/exemplos/ex013.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>{:.2f} (R${:.2f} + 15%)'.format(novo, sal))<|fim_prefix|># repo: figueiredo-alef/estudo-python path: /exemplos/ex013.py
print('=' * 5, 'EX_013', '=' * 5)
sal = float(input('Salário atual: R$'))
novo = sal <|fim_middle|>+ (sal * 15 / 100)
print('Você receberá R$ | code_fim | easy | {
"lang": "python",
"repo": "figueiredo-alef/estudo-python",
"path": "/exemplos/ex013.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: figueiredo-alef/estudo-python path: /exemplos/ex013.py
print('=' * 5, 'EX_013', '=' * 5)
sal = float(input('Salário atual: R$'))
novo = sal <|fim_suffix|>{:.2f} (R${:.2f} + 15%)'.format(novo, sal))<|fim_middle|>+ (sal * 15 / 100)
print('Você receberá R$ | code_fim | easy | {
"lang": "python",
"repo": "figueiredo-alef/estudo-python",
"path": "/exemplos/ex013.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RodericDay/MiniPNM path: /examples/convergence_app.py
import sys
import numpy as np
from PyQt4 import QtCore, QtGui
import pyqtgraph as QtGraph
import minipnm as mini
import MKS
MKS.define(globals())
class Walker(QtGui.QMainWindow):
def __init__(self):
super(Walker, self).__init_... | code_fim | hard | {
"lang": "python",
"repo": "RodericDay/MiniPNM",
"path": "/examples/convergence_app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> last_i = self.cl.orr
new_i = self.cl.solve_systems(last_i, self.variableLine.value() )
self.setPlot(0, self.cl.electronic_potential(V),
self.cl.protonic_potential(V),
self.cl.overpotential(V), )
self.setPlot(1, self.cl.oxygen_... | code_fim | hard | {
"lang": "python",
"repo": "RodericDay/MiniPNM",
"path": "/examples/convergence_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 18F/State-TalentMAP-API path: /talentmap_api/messaging/urls/share.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(r'^(?P<pk>[0-9]+)/$', views.ShareView.as_view(), name='messaging.Sharable-patch'),
url(r'^$', views.ShareView.as_view(), name='messaging.Sharable-create... | code_fim | medium | {
"lang": "python",
"repo": "18F/State-TalentMAP-API",
"path": "/talentmap_api/messaging/urls/share.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^(?P<pk>[0-9]+)/$', views.ShareView.as_view(), name='messaging.Sharable-patch'),
url(r'^$', views.ShareView.as_view(), name='messaging.Sharable-create'),
]<|fim_prefix|># repo: 18F/State-TalentMAP-API path: /talentmap_api/messaging/urls/share.py
from django.conf.urls import ... | code_fim | medium | {
"lang": "python",
"repo": "18F/State-TalentMAP-API",
"path": "/talentmap_api/messaging/urls/share.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>te(glist):
assert len(g_seq) == len(rearranged[interaction_id]['interaction'])
for turn_id, g in enumerate(g_seq):
data.append({'interaction_id': interaction_id + 1, 'turn_id': turn_id + 1,
'question': rearranged[interaction_id]['interaction'][turn_id]['utterance'],
... | code_fim | hard | {
"lang": "python",
"repo": "Smalltarget108/chase",
"path": "/Benchmark_Approaches/Editsql/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Smalltarget108/chase path: /Benchmark_Approaches/Editsql/test.py
import json
import pickle
import re
with open('./data/chase/dev_gold.txt', 'r') as f:
glist = []
gseq_one = []
for l in f.readlines():
if len(l.strip()) == 0:
glist.append(gseq_one)
gseq_... | code_fim | hard | {
"lang": "python",
"repo": "Smalltarget108/chase",
"path": "/Benchmark_Approaches/Editsql/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>eak
pos += i + 1
assert re.findall(r'gold: (.*)\n', res[pos - 3])[0] == g[0]
data[-1]['sql'] = re.findall(r'pred: (.*)\n', res[pos - 4])[0]
data[-1]['exact'] = True if re.findall(r'exact: (.*)\n', res[pos - 2])[0] == 'True' else 0
print(len(data))
print(len([d for d in data... | code_fim | hard | {
"lang": "python",
"repo": "Smalltarget108/chase",
"path": "/Benchmark_Approaches/Editsql/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vnkbrand/NowNow path: /agents/admin.py
from django.contrib import admin
<|fim_suffix|> list_display = ('id', 'name', 'email', 'hire_date')
list_display_links = ('id', 'name')
search_fields = ( 'name',)
list_per_page = 25
admin.site.register(Agent, AgentAdmin)<|fim_middle|># Agents - brin... | code_fim | medium | {
"lang": "python",
"repo": "vnkbrand/NowNow",
"path": "/agents/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AgentAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'email', 'hire_date')
list_display_links = ('id', 'name')
search_fields = ( 'name',)
list_per_page = 25
admin.site.register(Agent, AgentAdmin)<|fim_prefix|># repo: vnkbrand/NowNow path: /agents/admin.py
from django.contrib import ... | code_fim | medium | {
"lang": "python",
"repo": "vnkbrand/NowNow",
"path": "/agents/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vnkbrand/NowNow path: /agents/admin.py
from django.contrib import admin
# Agents - bring in Listing model
from .models import Agent
<|fim_suffix|>admin.site.register(Agent, AgentAdmin)<|fim_middle|>class AgentAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'email', 'hire_date')
list_... | code_fim | medium | {
"lang": "python",
"repo": "vnkbrand/NowNow",
"path": "/agents/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fout = open('../data/corpus-split.txt', 'w')
line_count = 0
with open('../data/corpus.txt') as f:
for line in f:
result = pattern.match(line)
if result and result.groups()[0] in analyzer_fields:
a_list = list(filter(lambda x: len(x) > 0, map(lambda x: x[0].strip(), analyzer... | code_fim | medium | {
"lang": "python",
"repo": "Somefive/eki",
"path": "/python/split.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Somefive/eki path: /python/split.py
import thulac
import re
analyzer = thulac.thulac(seg_only=True)
pattern = re.compile(r'.*<(.*)>=(.*)')
<|fim_suffix|>fout = open('../data/corpus-split.txt', 'w')
line_count = 0
with open('../data/corpus.txt') as f:
for line in f:
result = pattern.... | code_fim | medium | {
"lang": "python",
"repo": "Somefive/eki",
"path": "/python/split.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saj/unpack-cidr path: /setup.py
#!/usr/bin/env python
# pylint: disable=missing-docstring
from setuptools import setup
import _about
setup(
name=_about.NAME,
version=_about.VERSION,
description=_about.DESCRIPTION,
<|fim_suffix|> entry_points={
"console_scripts": [
... | code_fim | medium | {
"lang": "python",
"repo": "saj/unpack-cidr",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> entry_points={
"console_scripts": [
"unpack-cidr = unpack_cidr:main",
],
},
install_requires=[
"ipaddress",
"six",
"sortedcontainers",
],
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
... | code_fim | medium | {
"lang": "python",
"repo": "saj/unpack-cidr",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catalystneuro/AnDO path: /ando/tools/generator/AnDOGenerator.py
from pathlib import Path
import shutil
import warnings
import argparse
import os
import re
try:
import pandas as pd
HAVE_PANDAS = True
except ImportError:
HAVE_PANDAS = False
from ando.AnDOChecker import build_rule_rege... | code_fim | hard | {
"lang": "python",
"repo": "catalystneuro/AnDO",
"path": "/ando/tools/generator/AnDOGenerator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if not HAVE_PANDAS:
raise ImportError('Extraction of ando structure from csv requires pandas.')
df = pd.read_csv(csv_file, dtype=str)
# ensure all fields contain information
if df.isnull().values.any():
raise ValueError(f'Csv file contains empty cells.')
# standardi... | code_fim | hard | {
"lang": "python",
"repo": "catalystneuro/AnDO",
"path": "/ando/tools/generator/AnDOGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Useful for investigating whether the create_positions_and_kmers function
creates a useful runtime heuristic.
"""
out = io.StringIO()
out.write(
"kmer\tstart\tstop\tconsidered sites\thit chance by random sequence (%)\n"
)
accumulated_not_hit_chance = 1.0
for start, s... | code_fim | hard | {
"lang": "python",
"repo": "marcelm/cutadapt",
"path": "/src/cutadapt/kmer_heuristic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcelm/cutadapt path: /src/cutadapt/kmer_heuristic.py
import io
from typing import List, Optional, Set, Tuple
from collections import defaultdict
def kmer_chunks(sequence: str, chunks: int) -> Set[str]:
"""
Partition a sequence in almost equal sized chunks. Returns the shortest
pos... | code_fim | hard | {
"lang": "python",
"repo": "marcelm/cutadapt",
"path": "/src/cutadapt/kmer_heuristic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# This allows for easy debugging and benchmarking of the kmer heuristic code.
import argparse
from ._kmer_finder import KmerFinder
import dnaio
parser = argparse.ArgumentParser()
parser.add_argument("--adapter")
parser.add_argument("--anywhere", act... | code_fim | hard | {
"lang": "python",
"repo": "marcelm/cutadapt",
"path": "/src/cutadapt/kmer_heuristic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeremiedecock/snippets path: /python/pyside/pyside6/widget_QWebEngineView_with_marked_online.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See http://doc.qt.io/qt-5/qwebengineview.html#details
# This class replace the deprecated QWebView (based on QtWebKit).
# See:
# - https://stackoverfl... | code_fim | hard | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyside/pyside6/widget_QWebEngineView_with_marked_online.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>web = QWebEngineView()
web.setHtml(HTML)
web.show()
# The mainloop of the application. The event handling starts from this point.
# The exec_() method has an underscore. It is because the exec is a Python keyword. And thus, exec_() was used instead.
exit_code = app.exec_()
# The sys.exit() method ensure... | code_fim | medium | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyside/pyside6/widget_QWebEngineView_with_marked_online.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_qop_ne_4(monty_find, mongo_find):
docs = [
{"a": [2, 1]},
{"a": [1, 2]},
{"a": [[2, 1], 3]},
{"a": [[1, 2], 3]},
]
spec = {"a": {"$ne": [2, 1]}}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo... | code_fim | hard | {
"lang": "python",
"repo": "lepy/montydb",
"path": "/tests/test_engine/test_queries/test_queryop_comparsion_ne.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lepy/montydb path: /tests/test_engine/test_queries/test_queryop_comparsion_ne.py
from montydb.types import PY3, bson
from ...conftest import skip_if_no_bson
def count_documents(cursor, spec=None):
return cursor.collection.count_documents(spec or {})
def test_qop_ne_1(monty_find, mongo_f... | code_fim | hard | {
"lang": "python",
"repo": "lepy/montydb",
"path": "/tests/test_engine/test_queries/test_queryop_comparsion_ne.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert count_documents(mongo_c, spec) == 1
assert count_documents(monty_c, spec) == count_documents(mongo_c, spec)
@skip_if_no_bson
def test_qop_ne_7(monty_find, mongo_find):
docs = [
{"a": [{"b": "a"}]},
... | code_fim | hard | {
"lang": "python",
"repo": "lepy/montydb",
"path": "/tests/test_engine/test_queries/test_queryop_comparsion_ne.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.