text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Evelyn-H/vectormath path: /vectormath/vector.py
isinstance(vec, self.__class__):
raise TypeError('Angle operand must be of class {}'
.format(self.__class__.__name__))
if unit not in ['deg', 'rad']:
raise ValueError('Only units of rad or ... | code_fim | hard | {
"lang": "python",
"repo": "Evelyn-H/vectormath",
"path": "/vectormath/vector.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @z.setter
def z(self, value):
self[2] = value
@property
def phi(self):
"""
Polar angle / inclination of this vector in radians
Based on sperical coordinate space
returns angle between this vector and the positive z-azis
range: (0 <= phi <= ... | code_fim | hard | {
"lang": "python",
"repo": "Evelyn-H/vectormath",
"path": "/vectormath/vector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def nV(self):
"""Number of vectors"""
return self.shape[0]
def normalize(self):
"""Scale the length of all vectors to 1 in place"""
self.length = np.ones(self.nV)
return self
@property
def dims(self):
"""Tuple of different dim... | code_fim | hard | {
"lang": "python",
"repo": "Evelyn-H/vectormath",
"path": "/vectormath/vector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ondrejsika/mbp path: /urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
<|fim_suffix|>)
if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns(
'',
url(r'^__debug__/', include(debug_toolbar.urls)),
)<|fim_middle|>fr... | code_fim | hard | {
"lang": "python",
"repo": "ondrejsika/mbp",
"path": "/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns(
'',
url(r'^__debug__/', include(debug_toolbar.urls)),
)<|fim_prefix|># repo: ondrejsika/mbp path: /urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
<|fim_middle|>from ... | code_fim | hard | {
"lang": "python",
"repo": "ondrejsika/mbp",
"path": "/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path("instance/", views.AuthInstanceView.as_view(), name="open.auth_instance"),
path("path/", views.AuthPathView.as_view(), name="open.auth_path"),
path("batch_instance/", views.AuthBatchInstanceView.as_view(), name="open.auth_batch_instance"),
path("batch_path/", views.Aut... | code_fim | medium | {
"lang": "python",
"repo": "Laotanling/bk-iam-saas",
"path": "/saas/backend/api/authorization/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Laotanling/bk-iam-saas path: /saas/backend/api/authorization/urls.py
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed u... | code_fim | medium | {
"lang": "python",
"repo": "Laotanling/bk-iam-saas",
"path": "/saas/backend/api/authorization/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("time_used:", used_time/count, count, used_time)
result_folder = os.path.abspath(os.path.join(os.getcwd(), "..")) + '/Results_ConservativeComparison' ## results save folder
if not os.path.exists(result_folder):
os.mkdir(result_folder)
## save the compa... | code_fim | hard | {
"lang": "python",
"repo": "YixingLuo/HSA",
"path": "/Codes/Conservative_Comparison.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YixingLuo/HSA path: /Codes/Conservative_Comparison.py
import numpy as np
import os
from time import time
import pandas as pd
df_compare_record = pd.DataFrame(columns=['Configuration A', 'Configuration B', 'Comparison Results'])
# This function(get_comparison_under_scenario) is designed to calcu... | code_fim | hard | {
"lang": "python",
"repo": "YixingLuo/HSA",
"path": "/Codes/Conservative_Comparison.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("time_used:", used_time/count, count, used_time)
result_folder = os.path.abspath(os.path.join(os.getcwd(), "..")) + '/Results_ConservativeComparison' ## results save folder
if not os.path.exists(result_folder):
os.mkdir(result_folder)
## save the compar... | code_fim | hard | {
"lang": "python",
"repo": "YixingLuo/HSA",
"path": "/Codes/Conservative_Comparison.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = Solution()
assert s.isIsomorphic("egg", "add") is True
assert s.isIsomorphic("foo", "bar") is False
assert s.isIsomorphic("paper", "title") is True
assert s.isIsomorphic("ab", "aa") is False<|fim_prefix|># repo: linshaoyong/leetcode path: /python/hash_table/0205_isomorphic_strings... | code_fim | medium | {
"lang": "python",
"repo": "linshaoyong/leetcode",
"path": "/python/hash_table/0205_isomorphic_strings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linshaoyong/leetcode path: /python/hash_table/0205_isomorphic_strings.py
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
m1, m2 = {}, {}
for i in range(0, len(s)):
if s[i] ... | code_fim | medium | {
"lang": "python",
"repo": "linshaoyong/leetcode",
"path": "/python/hash_table/0205_isomorphic_strings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zhaoc917/cg path: /Blender/backupfile/render/lib/ImageMagick_Append.py
import sys
sys.path.append('..\\SceneTask')
sys.path.append('..\\lib')
from DirSetting import *
from Tool.IO import *
from Tool.PrettyColor import *
from Tool.FfmpegWrapper import *
from Tool.ImageMagickWrapper import *
mag... | code_fim | hard | {
"lang": "python",
"repo": "Zhaoc917/cg",
"path": "/Blender/backupfile/render/lib/ImageMagick_Append.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># magick.Run( "+appendThreeFolder",
# "C:\\Users\\soapk\\OneDrive\\xuke\\Mitsuba\\Output\\Deform\\wrinklePlane\\JPG\\RenderResult_Label\\plane1682arapspoke",
# "C:\\Users\\soapk\\OneDrive\\xuke\\Mitsuba\\Output\\Deform\\wrinklePlane\\JPG\\RenderResult_Label\\plane1682arapspokerim",
# "C:\\Users... | code_fim | hard | {
"lang": "python",
"repo": "Zhaoc917/cg",
"path": "/Blender/backupfile/render/lib/ImageMagick_Append.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: compas-dev/compas_slicer path: /src/compas_slicer/print_organization/print_organization_utilities/blend_radius.py
from compas.geometry import norm_vector, Vector
import logging
logger = logging.getLogger('logger')
__all__ = ['set_blend_radius']
def set_blend_radius(print_organizer, d_fillet=1... | code_fim | hard | {
"lang": "python",
"repo": "compas-dev/compas_slicer",
"path": "/src/compas_slicer/print_organization/print_organization_utilities/blend_radius.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
radius = d_fillet
if neighboring_items[0]:
radius = min(radius, norm_vector(Vector.from_start_end(neighboring_items[0].pt, printpoint.pt)) * buffer)
if neighboring_items[1]:
radius = min(radius, nor... | code_fim | hard | {
"lang": "python",
"repo": "compas-dev/compas_slicer",
"path": "/src/compas_slicer/print_organization/print_organization_utilities/blend_radius.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Remove the transport parameters
TRANSPORT_PARAMS = ('jwt_token', 'collectors_host', 'event_type')
postbody = dict([(key, val) for key, val in module.params.iteritems() if key not in TRANSPORT_PARAMS and val])
# Prepare the request
url = "https://{0}/{1}".format(module.params['collec... | code_fim | hard | {
"lang": "python",
"repo": "SignifAi/signifai-ansible-integration",
"path": "/library/signifai.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SignifAi/signifai-ansible-integration path: /library/signifai.py
"""
The MIT License
Copyright (c) 2017 SignifAI Inc. https://signifai.io
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in... | code_fim | hard | {
"lang": "python",
"repo": "SignifAi/signifai-ansible-integration",
"path": "/library/signifai.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nachereshata/bets-cli path: /src/bets/program_io/matches_output.py
import logging
from pathlib import Path
from typing import List
from tabulate import tabulate
from pandas import DataFrame
from bets.model.match import Match
_log = logging.getLogger(__name__)
<|fim_suffix|> return fmt... | code_fim | hard | {
"lang": "python",
"repo": "nachereshata/bets-cli",
"path": "/src/bets/program_io/matches_output.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with Path(self.out_dest).open("wb") as fp:
fp.write(self.text.encode("utf-8"))
@classmethod
def write_matches(cls, matches: List[Match], out_dest="console", fmt="plain"):
cls(matches, out_dest, fmt).write()<|fim_prefix|># repo: nachereshata/bets-cli path: /src/bets/pr... | code_fim | hard | {
"lang": "python",
"repo": "nachereshata/bets-cli",
"path": "/src/bets/program_io/matches_output.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kuri65536/python-for-android path: /sl4atools/fullscreenwrapper2/py3/gyro_sl4a_test.py
'''
Created on Aug 1, 2012
@author: Admin
'''
xmldata = """<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
and... | code_fim | hard | {
"lang": "python",
"repo": "kuri65536/python-for-android",
"path": "/sl4atools/fullscreenwrapper2/py3/gyro_sl4a_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> colorvals = ["#ff66a3d2","#FF63BE7B", "#FF83C77D","#FFA2D07F", "#FFC1DA81", "#FFE0E383", "#FFFFEB84", "#FFFDD17F", "#FFFCB77A", "#FFFA9D75", "#FFF98370", "#FFF8696B"]
def get_color(self,value):
value = abs(value)
if value >59:
value = 59
if... | code_fim | hard | {
"lang": "python",
"repo": "kuri65536/python-for-android",
"path": "/sl4atools/fullscreenwrapper2/py3/gyro_sl4a_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kdeal/devdocs-cli path: /devdocs_cli/devdocs.py
from __future__ import print_function
import json
import os
import sys
from os import path
from time import time
import requests
from .config import DEFAULT_CONFIG
def cache_request(func):
def strip_url(url):
for pattern in ('http:/... | code_fim | hard | {
"lang": "python",
"repo": "kdeal/devdocs-cli",
"path": "/devdocs_cli/devdocs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def docsets(docsets_filter, conf):
all_docsets = make_request('docs/docs.json', conf)
return search_dicts(all_docsets, docsets_filter, 'slug')
def search(docset, query, conf):
docset_index = get_index(docset, conf)
matched_docs = search_dicts(docset_index['entries'], query, 'name')
... | code_fim | hard | {
"lang": "python",
"repo": "kdeal/devdocs-cli",
"path": "/devdocs_cli/devdocs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def neuralNetSetup(self, num_features):
neuralnet = NN.SequentialNeuralNetwork(optim_algo=self.OPTIM_ALGO, loss_func=LF.SparseBinaryCrossEntropy(from_logits=False))
input_layer = Layer.DenseLayer(num_inputs=num_features, num_neurons=6, network_output_neurons=2,
... | code_fim | hard | {
"lang": "python",
"repo": "samit-ahlawat/NNPy",
"path": "/unittest/HeartModelTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class HeartModelSGDSigmoidTest(HeartModelTest):
OPTIM_ALGO = OA.SimpleGradDescent(learning_rate=0.02)
ACTIVATION = AC.Sigmoid()
class HeartModelADAMReluTest(HeartModelTest):
# with ReLU need to use higher learning rates
OPTIM_ALGO = OA.ADAM(learning_rate=0.1)
ACTIVATION = A... | code_fim | hard | {
"lang": "python",
"repo": "samit-ahlawat/NNPy",
"path": "/unittest/HeartModelTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samit-ahlawat/NNPy path: /unittest/HeartModelTest.py
from __future__ import absolute_import, print_function
import numpy as np
import pandas as pd
import unittest
import os
import os.path
import logging
import src.lib.OptimizationAlgo as OA
import src.lib.NeuralNetwork as NN
import src... | code_fim | hard | {
"lang": "python",
"repo": "samit-ahlawat/NNPy",
"path": "/unittest/HeartModelTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
install_source_by_identifier_string = {
install_source.identifier_string: install_source
for install_source in install_sources
}
class EnvironmentSchema(marshmallow.Schema):
class Meta:
ordered = True
platform = create_one_of_string([
platform.configuration_string
... | code_fim | hard | {
"lang": "python",
"repo": "altendky/ciborg",
"path": "/src/ciborg/configuration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: altendky/ciborg path: /src/ciborg/configuration.py
import json
import attr
import marshmallow
import marshmallow.fields
import marshmallow.validate
import ciborg
# TODO: fancier sentinels give nicer errors or something
_NOTHING = object()
def create_one_of_string(choices, missing=_NOTHING):... | code_fim | hard | {
"lang": "python",
"repo": "altendky/ciborg",
"path": "/src/ciborg/configuration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TrueEdOs/NotTowerDefence path: /units/Zombie.py
import pygame
from config.Resources import Constants, UnitTypes
from controllers.ZombieController import ZombieController
from units.MovableUnit import MovableUnit
from units.AttackableUnit import AttackableUnit
<|fim_suffix|> if self.sur... | code_fim | hard | {
"lang": "python",
"repo": "TrueEdOs/NotTowerDefence",
"path": "/units/Zombie.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.surface:
self.game_map.surface.blit(self.surface, self.pos)
else:
pygame.draw.circle(self.game_map.surface, (0, 200, 0),
(int(self.pos[0] + self.width / 2), int(self.pos[1] + self.height / 2)), self.width // 2)
def is_colli... | code_fim | hard | {
"lang": "python",
"repo": "TrueEdOs/NotTowerDefence",
"path": "/units/Zombie.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> datapath.send_msg(mod)
self.throttle_info[meter_key]['throttle_started'] = True
self.throttle_info[meter_key]['meter_id'] = dpid
self.logger.info("Throttle started between %r and %r on dpid %r", src, dst, dpid)
def should_throttle(self, datapath, in_port, src, dst, tim... | code_fim | hard | {
"lang": "python",
"repo": "dtangster/cmpe210-project",
"path": "/ryu/controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtangster/cmpe210-project path: /ryu/controller.py
from threading import Thread
import time
from flask import jsonify, Flask
import requests
from ryu.app.simple_switch_13 import SimpleSwitch13
from ryu.app.ofctl_rest import RestStatsApi
from ryu.base import app_manager
from ryu.controller impor... | code_fim | hard | {
"lang": "python",
"repo": "dtangster/cmpe210-project",
"path": "/ryu/controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def should_throttle(self, datapath, in_port, src, dst, timeout=10):
current_time = time.time()
key = (datapath.id, in_port, src, dst)
if key not in self.throttle_info:
self.throttle_info[key] = {
"detected_time": current_time,
"meter_... | code_fim | hard | {
"lang": "python",
"repo": "dtangster/cmpe210-project",
"path": "/ryu/controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if msg.guild is None:
return '[DM] {0.author.name} ({0.author.id}): {0.content}'.format(msg)
else:
return '[{0.guild.name} ({0.guild.id}) -> #{0.channel.name} ({0.channel.id})] ' \
'{0.author.name} ({0.author.id}): {0.content}'.format(msg)
async def prompt(msg, ctx... | code_fim | hard | {
"lang": "python",
"repo": "Maamue/cardinal.py",
"path": "/src/cardinal/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maamue/cardinal.py path: /src/cardinal/utils.py
from .errors import PromptTimeout
def clean_prefix(ctx):
user = ctx.me
replacement = user.nick if ctx.guild and ctx.me.nick else user.name
return ctx.prefix.replace(user.mention, '@' + replacement)
def format_message(msg):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Maamue/cardinal.py",
"path": "/src/cardinal/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.tmp.unlink()
return self.processed, len(self.to_drop)
def _drop(self, index: Hashable):
print(f"{self.name}: No source tokens for record {index}")
self.to_drop.append(index)
def save(self, name):
self.dataset.to_pickle(f"{self.target_path}/{name}_{se... | code_fim | hard | {
"lang": "python",
"repo": "SecureThemAll/CquenceR",
"path": "/processing/pre/input_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SecureThemAll/CquenceR path: /processing/pre/input_dataset.py
from pathlib import Path
from typing import Hashable
from utils.processing.c_tokenizer import truncate, tokenize
from pandas import DataFrame
class InputDataset:
def __init__(self, name: str, dataset: DataFrame, target_path: Pat... | code_fim | hard | {
"lang": "python",
"repo": "SecureThemAll/CquenceR",
"path": "/processing/pre/input_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pankajkumarkbn/angus-doc path: /services/wordspotting/wordspotting.py
# -*- coding: utf-8 -*-
from pprint import pprint
import angus
conn = angus.connect()
service = conn.services.get_service('word_spotting', version=1)
<|fim_suffix|>job = service.process({'sound': open("./sound.wav", 'rb'), '... | code_fim | hard | {
"lang": "python",
"repo": "pankajkumarkbn/angus-doc",
"path": "/services/wordspotting/wordspotting.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>job = service.process({'sound': open("./sound.wav", 'rb'), 'sensitivity': 0.7, 'vocabulary': vocabulary})
pprint(job.result)<|fim_prefix|># repo: pankajkumarkbn/angus-doc path: /services/wordspotting/wordspotting.py
# -*- coding: utf-8 -*-
from pprint import pprint
import angus
conn = angus.connect()
... | code_fim | hard | {
"lang": "python",
"repo": "pankajkumarkbn/angus-doc",
"path": "/services/wordspotting/wordspotting.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>vocabulary = {'turn wifi on': [w1_s1, w1_s2, w1_s3], 'turn wifi off': [w2_s1, w2_s2, w2_s3]}
job = service.process({'sound': open("./sound.wav", 'rb'), 'sensitivity': 0.7, 'vocabulary': vocabulary})
pprint(job.result)<|fim_prefix|># repo: pankajkumarkbn/angus-doc path: /services/wordspotting/wordspotti... | code_fim | hard | {
"lang": "python",
"repo": "pankajkumarkbn/angus-doc",
"path": "/services/wordspotting/wordspotting.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.elimina_copertina(codice)
self.carica_copertina(copertina, codice)
##### RECENSIONI #####
# Leggi sommario recensioni
def leggi_sommario(self, libro):
return self.manager.leggi_riga('''
SELECT l.titolo, l.autore, l.copertina, AVG(r.valore... | code_fim | hard | {
"lang": "python",
"repo": "tomellericcardo/Biblioteca",
"path": "/server-side/biblioteca.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomellericcardo/Biblioteca path: /server-side/biblioteca.py
# -*- coding: utf-8 -*-
from manager import Manager
from hashlib import sha256
from base64 import b64decode
from os import rename, remove
from os.path import realpath, dirname, join
class Biblioteca:
# Inizializzazione
de... | code_fim | hard | {
"lang": "python",
"repo": "tomellericcardo/Biblioteca",
"path": "/server-side/biblioteca.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
from wordmarker.data.resource import Resource
from wordmarker.data.formatter import SqlFormatter<|fim_prefix|># repo: lostblackknight/wordmarker path: /wordmarker/data/__init__.py
"""
:作者: 陈思祥
:时间: 2021年4月
:概述:
当前模块用来处理数据和资源。
1. ``wordmarker.data.resource``
::
加载的资源,包... | code_fim | medium | {
"lang": "python",
"repo": "lostblackknight/wordmarker",
"path": "/wordmarker/data/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lostblackknight/wordmarker path: /wordmarker/data/__init__.py
"""
:作者: 陈思祥
:时间: 2021年4月
:概述:
当前模块用来处理数据和资源。
1. ``wordmarker.data.resource``
::
<|fim_suffix|> 2. ``wordmarker.data.formatter``
::
格式化数据,对某些数据进行处理。
"""
from wordmarker.data.resource impor... | code_fim | easy | {
"lang": "python",
"repo": "lostblackknight/wordmarker",
"path": "/wordmarker/data/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beaumelon/melgan-pytorch path: /melgan.py
from torch import nn
from torch.nn import functional as F
from torch.nn.utils import weight_norm
def calc_padding(kernel_size, stride, dilation=1):
return (dilation * (kernel_size - 1) - stride + 2) // 2
def wnconv1d(
in_channel, out_channel, ... | code_fim | hard | {
"lang": "python",
"repo": "beaumelon/melgan-pytorch",
"path": "/melgan.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class MultiScaleDiscriminator(nn.Module):
def __init__(self, n_scales=3):
super().__init__()
self.n_scales = n_scales
self.discriminators = nn.ModuleList()
for i in range(self.n_scales):
self.discriminators.append(Discriminator())
def forward(self, i... | code_fim | hard | {
"lang": "python",
"repo": "beaumelon/melgan-pytorch",
"path": "/melgan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MultiScaleDiscriminator(nn.Module):
def __init__(self, n_scales=3):
super().__init__()
self.n_scales = n_scales
self.discriminators = nn.ModuleList()
for i in range(self.n_scales):
self.discriminators.append(Discriminator())
def forward(self, in... | code_fim | hard | {
"lang": "python",
"repo": "beaumelon/melgan-pytorch",
"path": "/melgan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> write_line(header, 1, '// Set parameters needed for all types of parallelism.')
write_line(header, 1, '// int num_threads = 0;')
write_line(header, 1, 'omp_set_num_threads(num_threads);')
write_line(header, 0, '#ifdef _PARALLEL_')
write_line(header, 0, '# pragma omp parallel')
writ... | code_fim | hard | {
"lang": "python",
"repo": "arbenson/fast-matmul",
"path": "/codegen/gen.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Finally, write the actual call to matrix multiply.
write_line(header, 1,
'FastMatmulRecursive(locker, mem_mngr, %s, %s, %s, total_steps, steps_left - 1, %s, x, num_threads, Scalar(0.0));' % (
subblock_name(a_coeffs, 'A', 'S', (dims[0], dims[1])),
subblock_n... | code_fim | hard | {
"lang": "python",
"repo": "arbenson/fast-matmul",
"path": "/codegen/gen.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arbenson/fast-matmul path: /codegen/gen.py
mplate <typename Scalar>')
add = 'void %s_Add%d(' % (mat_name, index)
add += ', '.join(['Matrix<Scalar>& %s%d' % (mat_name, i + 1) for i in range(nnz)])
add += ', Matrix<Scalar>& C, double x, bool sequential'
# Handle the C := alpha A * B... | code_fim | hard | {
"lang": "python",
"repo": "arbenson/fast-matmul",
"path": "/codegen/gen.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
for i in xrange(10000):
answer = i ** 3
if self.iterations > 0:
self.iterations -= 1
self.reactor.call_later(seconds=0, callback=self.run)
def main(argv=argv[1:]):
iterations, threads = map(int, argv)
reactor = Reactor()
... | code_fim | medium | {
"lang": "python",
"repo": "digideskio/Inevitable",
"path": "/examples/call_later.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> iterations, threads = map(int, argv)
reactor = Reactor()
for _ in xrange(threads):
looper = Looper(iterations=iterations, reactor=reactor)
reactor.call_later(seconds=0, callback=looper.run)
reactor.run_until_idle()
main()<|fim_prefix|># repo: digideskio/Inevitable path: ... | code_fim | hard | {
"lang": "python",
"repo": "digideskio/Inevitable",
"path": "/examples/call_later.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: digideskio/Inevitable path: /examples/call_later.py
from sys import argv
import random
import transaction
from inevitable.core import Reactor
class Looper(object):
def __init__(self, iterations, reactor):
self.iterations = iterations
self.reactor = reactor
def run(self... | code_fim | medium | {
"lang": "python",
"repo": "digideskio/Inevitable",
"path": "/examples/call_later.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qrilka/wand path: /wand/image.py
"""
return library.MagickGetImageDepth(self.wand)
@depth.setter
def depth(self, depth):
r = library.MagickSetImageDepth(self.wand, depth)
if not r:
raise self.raise_exception()
@property
def format(self):
... | code_fim | hard | {
"lang": "python",
"repo": "qrilka/wand",
"path": "/wand/image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Reset the coordinate frame of the image so to the upper-left corner
is (0, 0) again (crop and rotate operations change it).
.. versionadded:: 0.2.0
"""
library.MagickResetImagePage(self.wand, None)
def resize(self, width=None, height=None, filter='undefine... | code_fim | hard | {
"lang": "python",
"repo": "qrilka/wand",
"path": "/wand/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param degree: a degree to rotate. multiples of 360 affect nothing
:type degree: :class:`numbers.Real`
:param background: an optional background color.
default is transparent
:type background: :class:`wand.color.Color`
:param reset_coords:... | code_fim | hard | {
"lang": "python",
"repo": "qrilka/wand",
"path": "/wand/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # change the form of our log
word = tup.values[0].split('[')
word = word[1].split(' -0800')
word = datetime.datetime.strptime(word[0], "%d/%b/%Y:%H:%M:%S")
word = time.strftime('%Y-%m-%d T %H:00:00.000')+"\t1"
storm.logInfo("received %s" % word)
# ... | code_fim | medium | {
"lang": "python",
"repo": "b02901017/CC2017",
"path": "/hw4/target/classes/resources/splitbolt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b02901017/CC2017 path: /hw4/target/classes/resources/splitbolt.py
import storm
import time
import datetime
class SplitBolt(storm.BasicBolt):
# There's nothing to initialize here,
# since this is just a split and emit
# Initialize this instance
def initialize(self, conf, context):
... | code_fim | medium | {
"lang": "python",
"repo": "b02901017/CC2017",
"path": "/hw4/target/classes/resources/splitbolt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open(input_fn) as input_file:
txt = input_file.read()
with open(output_fn, 'w') as output_file:
original_package = 'from ' + original_package
output_package = 'from ' + output_package
output_file.write(txt.replace(original_package, output_package))<|fim_prefix|># repo: OliverKoo/bazel... | code_fim | medium | {
"lang": "python",
"repo": "OliverKoo/bazel-distribution",
"path": "/pip/replace_imports.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OliverKoo/bazel-distribution path: /pip/replace_imports.py
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. ... | code_fim | medium | {
"lang": "python",
"repo": "OliverKoo/bazel-distribution",
"path": "/pip/replace_imports.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> initial = True
dependencies = [
('organization', '0004_auto_20200914_0713'),
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_nam... | code_fim | hard | {
"lang": "python",
"repo": "daniyaalk/busman",
"path": "/products/migrations/0001_squashed_0008_auto_20200923_0437.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daniyaalk/busman path: /products/migrations/0001_squashed_0008_auto_20200923_0437.py
# Generated by Django 3.1.1 on 2020-09-23 04:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrat... | code_fim | hard | {
"lang": "python",
"repo": "daniyaalk/busman",
"path": "/products/migrations/0001_squashed_0008_auto_20200923_0437.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muralisr/blaze path: /tests/evaluator/test_analyzer.py
import pytest
from blaze.action import ActionSpace, Policy
from blaze.config.client import get_random_client_environment
from blaze.evaluator import Analyzer
from tests.mocks.config import get_config
class TestAnalyzer:
def setup(self... | code_fim | hard | {
"lang": "python",
"repo": "muralisr/blaze",
"path": "/tests/evaluator/test_analyzer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_init_reward_function(self):
a0 = self.get_analyzer(0)
assert a0.reward_func_num == 0
a1 = self.get_analyzer(1)
assert a1.reward_func_num == 1
a2 = self.get_analyzer(2)
assert a2.reward_func_num == 2
a3 = self.get_analyzer(3)
asse... | code_fim | hard | {
"lang": "python",
"repo": "muralisr/blaze",
"path": "/tests/evaluator/test_analyzer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(IndexError):
self.get_analyzer(4)
# TODO: REWRITE THESE TESTS
# @mock.patch("blaze.evaluator.lighthouse.get_metrics")
# @mock.patch("blaze.mahimahi.mahimahi.MahiMahiConfig")
# def test_get_reward_mahimahi_config(self, mock_MahiMahiConfig, mock_get_m... | code_fim | hard | {
"lang": "python",
"repo": "muralisr/blaze",
"path": "/tests/evaluator/test_analyzer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''An agent that chooses a random channel and transmits over that channel.'''
def act(self):
'''Return an action for current state. Choose a random channel and
transmit over that channel. If there are multiple of such channels,
choose randomly.'''
super(RandomChann... | code_fim | medium | {
"lang": "python",
"repo": "maemre/rasim",
"path": "/agent/random.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pkgs_to_send == 0:
return self.idle()
# transmit with a random power choice
return self.transmit(P_tx, pkgs_to_send)<|fim_prefix|># repo: maemre/rasim path: /agent/random.py
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 5 01:18:59 2014
@author: Mehmet Emre
"""
f... | code_fim | hard | {
"lang": "python",
"repo": "maemre/rasim",
"path": "/agent/random.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maemre/rasim path: /agent/random.py
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 5 01:18:59 2014
@author: Mehmet Emre
"""
from .base import BaseAgent
from numpy import random
import params
<|fim_suffix|> if pkgs_to_send == 0:
return self.idle()
# transmit with a r... | code_fim | hard | {
"lang": "python",
"repo": "maemre/rasim",
"path": "/agent/random.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PanDAWMS/panda-common path: /pandacommon/commonconfig/common_config.py
from ..liveconfigparser.LiveConfigParser import LiveConfigParser
<|fim_suffix|> return getattr(tmpConf, section)<|fim_middle|># get ConfigParser
tmpConf = LiveConfigParser()
# read
tmpConf.read('panda_common.cfg')
# get... | code_fim | medium | {
"lang": "python",
"repo": "PanDAWMS/panda-common",
"path": "/pandacommon/commonconfig/common_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return getattr(tmpConf, section)<|fim_prefix|># repo: PanDAWMS/panda-common path: /pandacommon/commonconfig/common_config.py
from ..liveconfigparser.LiveConfigParser import LiveConfigParser
# get ConfigParser
tmpConf = LiveConfigParser()
<|fim_middle|># read
tmpConf.read('panda_common.cfg')
# get... | code_fim | medium | {
"lang": "python",
"repo": "PanDAWMS/panda-common",
"path": "/pandacommon/commonconfig/common_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZHUXUHAN/Privision path: /modules/old/facerecog.py
# -*- coding:utf8 -*-
import sys
from config import cfg_priv
sys.path.append(cfg_priv.GLOBAL.CAFFE_ROOT)
import caffe
import numpy as np
from libs.utils import objs_sort_by_center
from pypriv.nnutils.caffeutils import Detector, Identity
from p... | code_fim | hard | {
"lang": "python",
"repo": "ZHUXUHAN/Privision",
"path": "/modules/old/facerecog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id_net = caffe.Net(cfg_priv.FaceID.DEPLOY, cfg_priv.FaceID.WEIGHTS, caffe.TEST)
self.I = Identity(id_net, mean=cfg_priv.FaceID.PIXEL_MEANS, std=cfg_priv.FaceID.PIXEL_STDS,
base_size=256, crop_size=224, crop_type='center', prob_layer='classifier',
... | code_fim | hard | {
"lang": "python",
"repo": "ZHUXUHAN/Privision",
"path": "/modules/old/facerecog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlamoure/Indigo-Image-Analysis path: /Image Analysis.indigoPlugin/Contents/Server Plugin/plugin.py
#! /usr/bin/env python
####################
import indigo
import os
import sys
import datetime
import time
import json
import copy
from copy import deepcopy
import requests
from ImageProcessingAd... | code_fim | hard | {
"lang": "python",
"repo": "mlamoure/Indigo-Image-Analysis",
"path": "/Image Analysis.indigoPlugin/Contents/Server Plugin/plugin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> indigo.server.log("sending " + image + " to AWS Rekognition API")
result = imageProcessor.sendImage(image, options)
if result is None:
self.logger.error("Returned no results")
return
### PROCESS RESULTS
buildstr = ""
facecounter = 0
resultsFound = False
## OUTPUT TO INDIGO
i... | code_fim | hard | {
"lang": "python",
"repo": "mlamoure/Indigo-Image-Analysis",
"path": "/Image Analysis.indigoPlugin/Contents/Server Plugin/plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pluginAction.props["locationOption"] == "static":
image = pluginAction.props["location"]
else:
image = indigo.variables[int(pluginAction.props["locationVariable"])].value
### SEND TO GOOGLE
if pluginAction.pluginTypeId == "sendImageGoogle":
imageProcessor = None
for processor in s... | code_fim | hard | {
"lang": "python",
"repo": "mlamoure/Indigo-Image-Analysis",
"path": "/Image Analysis.indigoPlugin/Contents/Server Plugin/plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print '10 / 3 =', 10 / 3
print '10.0 / 3 =', 10.0 / 3
print '10 // 3 =', 10 // 3<|fim_prefix|># repo: hewentian/python-learning path: /src/python27/module/future.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
<|fim_middle|>print '\'xxx\' is unicode?', ... | code_fim | hard | {
"lang": "python",
"repo": "hewentian/python-learning",
"path": "/src/python27/module/future.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hewentian/python-learning path: /src/python27/module/future.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
<|fim_suffix|>print '10 / 3 =', 10 / 3
print '10.0 / 3 =', 10.0 / 3
print '10 // 3 =', 10 // 3<|fim_middle|>print '\'xxx\' is unicode?', ... | code_fim | hard | {
"lang": "python",
"repo": "hewentian/python-learning",
"path": "/src/python27/module/future.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rosette-api-community/compare-vocabulary path: /visualize.py
#!/usr/bin/env python3
"""Visualize term frequency distributions via Rosette API analyses"""
import os
from collections import namedtuple
from getpass import getpass
from math import log
from bs4 import BeautifulSoup
from compare_vo... | code_fim | hard | {
"lang": "python",
"repo": "rosette-api-community/compare-vocabulary",
"path": "/visualize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> This is useful for interpolating values from one range to another
"""
min1, max1, min2, max2 = min(range1), max(range1), min(range2), max(range2)
def resize(value):
return (((value - min1) * (max2 - min2)) / (max1 - min1)) + min2
return resize
def visualize(fd, pos_tags=None):... | code_fim | hard | {
"lang": "python",
"repo": "rosette-api-community/compare-vocabulary",
"path": "/visualize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print ("Account ....")
account_name = input()
print("User-name ...")
user_name = input()
print("Phone number ...")
number = input()
print("Password ...")
password = input()
save_users_credentials(create_user_acc(account_nam... | code_fim | hard | {
"lang": "python",
"repo": "mwaiyusuf/password-locker",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwaiyusuf/password-locker path: /run.py
#!/usr/bin/env python3.6
from user import User # Importing the user class
from user import Loc_user #importing the loc_user class
def create_user_acc(account_name,user_name,number,password):
'''
creating a new user
'''
new_user = User(account_name... | code_fim | hard | {
"lang": "python",
"repo": "mwaiyusuf/password-locker",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patrick-5546/ubc-course-explorer path: /app/coursetracker/migrations/0002_auto_20201228_2245.py
# Generated by Django 3.1.1 on 2020-12-29 06:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coursetracker', '0001_initial'),
]... | code_fim | hard | {
"lang": "python",
"repo": "patrick-5546/ubc-course-explorer",
"path": "/app/coursetracker/migrations/0002_auto_20201228_2245.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_name='course',
name='prequisites',
field=models.TextField(default=''),
),
migrations.AddField(
model_name='course',
name='prerequisites_description',
field=models.TextField(default=''),
),
migration... | code_fim | hard | {
"lang": "python",
"repo": "patrick-5546/ubc-course-explorer",
"path": "/app/coursetracker/migrations/0002_auto_20201228_2245.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geekcampchina/happy-python path: /tests/parameter_manager_test.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from happy_python import ParameterManager
ARG_FLAG_USER_NAME = 1 << 0
ARG_FLAG_USER_ID = 2 << 0
ARG_FLAG_ROLE_ID = 3 << 0
def check_user_name(user_name):
retur... | code_fim | hard | {
"lang": "python",
"repo": "geekcampchina/happy-python",
"path": "/tests/parameter_manager_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.pm.enable_paras(ARG_FLAG_USER_NAME | ARG_FLAG_USER_ID | ARG_FLAG_ROLE_ID)
paras = self.pm.get_enable_paras()
self.assertListEqual(['roleId', check_role_id], paras[ARG_FLAG_ROLE_ID])
self.assertListEqual(['userName', check_user_name], paras[ARG_FLAG_USER_NAME])
... | code_fim | hard | {
"lang": "python",
"repo": "geekcampchina/happy-python",
"path": "/tests/parameter_manager_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set the token to False if the string is not valid
if len(self.becode_token) < 200:
return None
return self.becode_token<|fim_prefix|># repo: Joffreybvn/alan-dashboard path: /src/sanitizers/settings_update.py
from typing import Union
from pydantic import BaseModel
... | code_fim | hard | {
"lang": "python",
"repo": "Joffreybvn/alan-dashboard",
"path": "/src/sanitizers/settings_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Joffreybvn/alan-dashboard path: /src/sanitizers/settings_update.py
from typing import Union
from pydantic import BaseModel
class SettingsUpdateRequest(BaseModel):
<|fim_suffix|> """Return a sanitized version of the BeCode token."""
# Set the token to False if the string is not ... | code_fim | medium | {
"lang": "python",
"repo": "Joffreybvn/alan-dashboard",
"path": "/src/sanitizers/settings_update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gtno1chun/gantry-aiops path: /gantry-ml/tensorflow/gantry_aiops/test_classify_data.py
import pandas as pd
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
df = pd.DataFrame([
[2, 1],
[3, 2],
[3, 4],
[5, 5],
[7, 5],
[2, 5],
[8, 9],
[9, 10],
[... | code_fim | medium | {
"lang": "python",
"repo": "gtno1chun/gantry-aiops",
"path": "/gantry-ml/tensorflow/gantry_aiops/test_classify_data.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>centers=model.cluster_centers_
plt.scatter(centers[:, 0], centers[:, 1], c='black', s=200, alpha=0.5)
#plt.scatter(model.cluster_centers_[:, 0], model.cluster_centers_[:, 1], s=100, marker='D', c='red', label = 'Centroids')
plt.show()<|fim_prefix|># repo: gtno1chun/gantry-aiops path: /gantry-ml/tensorflo... | code_fim | hard | {
"lang": "python",
"repo": "gtno1chun/gantry-aiops",
"path": "/gantry-ml/tensorflow/gantry_aiops/test_classify_data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>df['cluster'] = y_predict
print(df)
#df.to_csv("cluster.csv")
#plt.scatter(df['hour'], y_predict, df['attendance'], c='blue')
plt.scatter(df['hour'], df['attendance'], c=y_predict, s=50, cmap='viridis')
centers=model.cluster_centers_
plt.scatter(centers[:, 0], centers[:, 1], c='black', s=200, alpha=0.... | code_fim | hard | {
"lang": "python",
"repo": "gtno1chun/gantry-aiops",
"path": "/gantry-ml/tensorflow/gantry_aiops/test_classify_data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nkongne/QRSMS-V1 path: /QRSMS/initial/migrations/0044_auto_20200522_1714.py
# Generated by Django 2.2 on 2020-05-22 12:14
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='marksheet',
name='grand_total_marks',
field=models.FloatField(... | code_fim | medium | {
"lang": "python",
"repo": "Nkongne/QRSMS-V1",
"path": "/QRSMS/initial/migrations/0044_auto_20200522_1714.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('initial', '0043_auto_20200522_1707'),
]
operations = [
migrations.AlterField(
model_name='marksheet',
name='grand_total_marks',
field=models.FloatField(blank=True, default=100, null=True),
),
]<|fim_prefix|># ... | code_fim | easy | {
"lang": "python",
"repo": "Nkongne/QRSMS-V1",
"path": "/QRSMS/initial/migrations/0044_auto_20200522_1714.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> path('google-oauth-access-token/', google_oauth_access_token, name='google_oauth_access_token'),
]<|fim_prefix|># repo: theju/quick-send-nl path: /app/urls.py
from django.urls import path
from .views import index, upload_csv, compose_message, pick_send_mode, confirm_send, \
send_mails, send_statu... | code_fim | hard | {
"lang": "python",
"repo": "theju/quick-send-nl",
"path": "/app/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theju/quick-send-nl path: /app/urls.py
from django.urls import path
from .views import index, upload_csv, compose_message, pick_send_mode, confirm_send, \
send_mails, send_status, google_oauth_access_token
<|fim_suffix|> path('google-oauth-access-token/', google_oauth_access_token, name='... | code_fim | hard | {
"lang": "python",
"repo": "theju/quick-send-nl",
"path": "/app/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
while not transport.disconnected.is_set():
transport.disconnected.wait(5)
except KeyboardInterrupt:
dispatcher.close()
transport.close()<|fim_prefix|># repo: SeyZ/baboon path: /baboon/baboond/main.py
from baboon.baboond.transport import transport
from babo... | code_fim | easy | {
"lang": "python",
"repo": "SeyZ/baboon",
"path": "/baboon/baboond/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeyZ/baboon path: /baboon/baboond/main.py
from baboon.baboond.transport import transport
from baboon.baboond.dispatcher import dispatcher
from baboon.common.eventbus import eventbus
<|fim_suffix|> """ Initializes baboond.
"""
try:
while not transport.disconnected.is_set():
... | code_fim | easy | {
"lang": "python",
"repo": "SeyZ/baboon",
"path": "/baboon/baboond/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: byro/byro path: /src/byro/common/settings/utils.py
import os
from itertools import repeat
def log_initial(*, debug, config_files, db_name, LOG_DIR, plugins):
from byro import __version__
from byro.common.console import end_box, print_line, start_box
if hasattr(os, "geteuid") and os... | code_fim | hard | {
"lang": "python",
"repo": "byro/byro",
"path": "/src/byro/common/settings/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def reduce_dict(data):
return {
section_name: {
key: value for key, value in section_content.items() if value is not None
}
for section_name, section_content in data.items()
}<|fim_prefix|># repo: byro/byro path: /src/byro/common/settings/utils.py
import os
fro... | code_fim | medium | {
"lang": "python",
"repo": "byro/byro",
"path": "/src/byro/common/settings/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_dict= dict()
for language in languages:
if id is not None:
language_with_context = language + '#' + id
if language_with_context in template.keys():
data_dict[language] = template[language_with_context]
continue
data_dict[... | code_fim | medium | {
"lang": "python",
"repo": "Alzpeta/oarepo-multilingual",
"path": "/oarepo_multilingual/mapping/mapping_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.