id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
108194 | <reponame>duckiecousingaming/forum-sweats<gh_stars>1-10
name = 'forum'
aliases = ('forums', 'f')
pad_none = False
async def run(message):
await message.send('Forum commands: **!forums user (username)**')
| StarcoderdataPython |
4828719 | import torch
from code_slac.network.base import BaseNetwork
class FlattenEmpty(BaseNetwork):
def forward(self, *inputs, **kwargs):
flat_inputs = torch.cat(inputs, dim=-1)
return flat_inputs
| StarcoderdataPython |
3349134 | <reponame>crawlino/crawlino-core
from .plugins_models import *
from .input_model import *
| StarcoderdataPython |
3283926 | <reponame>pitzer42/micro-tcg
class ClientConnection:
def __init__(self, _id, socket):
self._id = _id
self.socket = socket
self._disconnection_message = '%s is disconnected' % str(self._id)
self.group = None
@property
def is_connected(self):
return self.socket.closed... | StarcoderdataPython |
3248399 | # Assembly Image Encoder FredHappyface
"""
Encodes a custom set of assembly style instructions into an image. Syntax has
been inspired by the Little Man Computer (LMC) created by <NAME> in
1965. An online model of this can be found at https://peterhigginson.co.uk/LMC/
and the idea of executing a program from and i... | StarcoderdataPython |
3249486 | <reponame>NeuronAddict/sectools
#! /usr/bin/env python3
import argparse
import sys
import binascii
parser =argparse.ArgumentParser('Convert file to hexadecilam litteral (ie: for mysql)')
parser.add_argument('file', help='file to convert')
parser.add_argument('--add_0x', help='Add 0x at start of result', action='store... | StarcoderdataPython |
1649117 | <gh_stars>0
#presenetljivo lahek problem?
aji = list(range(100))
bji = list(range(100))
najvec = 0
def vsota_stevk(n):
vsota = 0
for el in str(n):
vsota += int(el)
return vsota
for a in aji:
for b in bji:
if vsota_stevk(a ** b) > najvec:
najvec = vsota_stevk(a ** b)
print(... | StarcoderdataPython |
3302875 | <reponame>yunionyun/python_yunionsdk<filename>yunionclient/api/natdentries.py
from yunionclient.common import base
class Natdentry(base.ResourceBase):
pass
class NatdentryManager(base.StandaloneManager):
resource_class = Natdentry
keyword = 'natdentry'
keyword_plural = 'natdentries'
_columns = ["... | StarcoderdataPython |
49286 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import sys
from collections import namedtuple
from .utils import humanize
DEFAULT_TIMES = 5
if sys.platform == "win32":
# On Windows, the best timer is time.clock()
timer = time.clock
else:
# On most other platf... | StarcoderdataPython |
3323459 | <filename>integration_core/integration_base.py
#!/usr/bin/python
# Base imports for all integrations, only remove these at your own risk!
import json
import sys
import os
import time
import pandas as pd
from getpass import getpass
from collections import OrderedDict
from IPython.core.magic import (Magics, magics_clas... | StarcoderdataPython |
4820146 | """
"""
from torch_ecg.augmenters.augmenter_manager import AugmenterManager
from torch_ecg.augmenters.baseline_wander import BaselineWanderAugmenter
from torch_ecg.augmenters.random_flip import RandomFlip
from torch_ecg.augmenters.mixup import Mixup
from torch_ecg.augmenters.label_smooth import LabelSmooth
from torch_... | StarcoderdataPython |
181045 | <gh_stars>0
import os
import shutil
import subprocess
import sys
from glob import glob
VIRTUAL_ENV = os.environ['VIRTUAL_ENV']
TOX_PIP_DIR = os.path.join(VIRTUAL_ENV, 'pip')
def pip(args):
# First things first, get a recent (stable) version of pip.
if not os.path.exists(TOX_PIP_DIR):
subprocess.check... | StarcoderdataPython |
3377764 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Ampel-ZTF/ampel/ztf/t3/skyportal/SkyPortalClient.py
# Author: <NAME> <<EMAIL>>
# Date: 16.09.2020
# Last Modified Date: 16.09.2020
# Last Modified By: <NAME> <<EMAIL>>
import asyncio, base64, gzip, io, json, math, time... | StarcoderdataPython |
1752484 | <reponame>ESHackathon/roses-pdf-generator<gh_stars>0
import sys
import pdfkit
import filters
from flask import Flask, render_template, request, abort, make_response
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
# Add the Jinja filters.
app.jinja_env.filters['title'] = filters.title
app.jinja_env.filte... | StarcoderdataPython |
3215863 | <filename>docs/support/trace_ex_pcsv_merge.py
# trace_ex_pcsv_merge.py
# Copyright (c) 2013-2016 <NAME>
# See LICENSE for details
# pylint: disable=C0111,W0212
import docs.support.trace_support
def trace_module(no_print=False):
""" Trace pcsv merge module exceptions """
mname = 'merge'
fname = 'pcsv'
... | StarcoderdataPython |
1700893 | <gh_stars>0
import datetime
from typing import List, Optional
from dateutil.parser import parse
from pydantic import BaseModel
ordine_json = {
'elemento_id': '123',
'data_creazione': '2002-11-24 12:22',
'pagine_visitate': [1, 2, '3'],
'prezzo': 17.22
}
class Ordine(BaseModel):
elemento_id: int
... | StarcoderdataPython |
1782597 | <filename>vqa/models/convnets.py<gh_stars>0
import copy
import torch
import torch.nn as nn
import torchvision.models as pytorch_models
import sys
import os
sys.path.append('/home/cnris/tailpose/sg/sg2im/vqa/external/pretrainedmodels')
import vqa.external.pretrainedmodels as torch7_models
pytorch_resnet_names = sorted(... | StarcoderdataPython |
1668500 | from typing import NamedTuple, List, Tuple
import numpy as np
import tensorflow as tf
from tensorflow import keras
import vae_loss
class EncoderConfig(NamedTuple):
"""NamedTuple for configuring a Conv2D layer in an encoder.
Fields:
filter: num filters in layer
kernel_size: kernel size in la... | StarcoderdataPython |
3256854 | #!/usr/bin/python3
from getpass import getpass
import importlib
import json
import os
import sys
import traceback
from lib.components import alert
from lib.components.eth import Rpc, web3, wei
from lib.components import contract
from lib.components.account import Accounts, LocalAccount
from lib.components import tran... | StarcoderdataPython |
75907 | <gh_stars>1-10
# pylint: disable=unused-variable,unused-argument,expression-not-assigned,singleton-comparison
import pytest
from expecter import expect
from .utils import load
def describe_votes():
@pytest.fixture
def url():
return "/api/collections/_c/votes/"
def describe_GET():
def ... | StarcoderdataPython |
110786 | from flask import Flask
from streamlit import cache
import pickle
from flask import request, jsonify
app = Flask(__name__)
@cache(allow_output_mutation=True)
def predict_wine(tipo, fixed, volatile, citric, residual, chlorides, freesulfur, totalsulfur, density, ph, sulphates, alcohol):
"""
This function im... | StarcoderdataPython |
1765178 | <filename>crslab/data/__init__.py
# @Time : 2020/11/22
# @Author : <NAME>
# @Email : <EMAIL>
# UPDATE:
# @Time : 2020/11/24, 2020/12/29, 2020/12/17
# @Author : <NAME>, <NAME>, <NAME>
# @Email : <EMAIL>, <EMAIL>, <EMAIL>
"""Data module which reads, processes and batches data for the whole system
Attributes:
... | StarcoderdataPython |
9043 | from django.conf.urls.defaults import url, include, patterns
from corehq.apps.appstore.dispatcher import AppstoreDispatcher
store_urls = patterns('corehq.apps.appstore.views',
url(r'^$', 'appstore_default', name="appstore_interfaces_default"),
AppstoreDispatcher.url_pattern(),
)
urlpatterns = patterns('corehq... | StarcoderdataPython |
85795 | <gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# coding: utf8
class ConsumerSequential():
"""`ConsumerSequential` class represents a Consumer pipeline Step.
"""
def __init__(
self, coroutine, name=None):
"""
Parameters
----------
co... | StarcoderdataPython |
3347065 | <gh_stars>10-100
import sys
import procgame
import pinproc
from threading import Thread
import random
import string
import time
import locale
import math
import copy
import pygame
from pygame.locals import *
import dmd
pygame.init()
screen_multiplier = 2
screen = pygame.display.set_mode((128*screen_multiplier, 32*scre... | StarcoderdataPython |
1705846 | import os
from typing import Any, Dict, Iterable, List, Optional, TYPE_CHECKING
import manta_lab as ml
import manta_lab.base.packet as pkt
if TYPE_CHECKING:
from multiprocessing.process import BaseProcess
from queue import Queue
from manta_lab.api import MantaAPI
from manta_lab.base.packet... | StarcoderdataPython |
53423 | <reponame>awoods/fcrepo-import-export-verify
from os.path import basename, isfile
from .utils import get_directory_contents, get_child_nodes
from .utils import get_data_dir
class Walker:
"""Walk a set of Fedora resources."""
def __init__(self, root, logger):
self.to_check = [root]
self.logger ... | StarcoderdataPython |
3305337 | <reponame>LianGee/galio
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : response.py
# @Author: zaoshu
# @Date : 2020-02-06
# @Desc :
import math
from copy import copy
from datetime import datetime
from flask import jsonify
from common.constant import ErrorCode
from model.base import BaseModel
class Respo... | StarcoderdataPython |
153810 | <filename>scripts/select_ref_by_ANI/parse_closest_ANI.py
import sys
counter = 0
matrix = []
with open(sys.argv[1], 'r') as inf:
for line in inf:
thisline = line.strip().split("\t")
matrix.append(thisline)
# for i,x in enumerate(thisline):
# if x == "contigs" or x == "scaffolds":
... | StarcoderdataPython |
3359309 | from flask import Blueprint
from api import converter
from api.schemas import ArgumentsSchema
from api.utils import get_json
convert_api = Blueprint('convert', __name__)
@convert_api.route('/convert', methods=['POST'])
def convert():
arguments = get_json(schema=ArgumentsSchema())
indicators_bulk = converter... | StarcoderdataPython |
90122 | <reponame>Ricechrispi/sc2_academy
import collections
import tensorflow as tf
from tf_agents.drivers import dynamic_episode_driver
from tf_agents.utils import common
from tf_agents.metrics import tf_metrics
from metrics.custom_metrics import StdMetric
from metrics.custom_metrics import ChosenActionIDHistogram
def ge... | StarcoderdataPython |
1700104 | <reponame>Rohith050/mremoteng_to_remmina<gh_stars>1-10
import sys
if sys.version_info[0] < 3:
raise Exception("Python 3 or a more recent version is required.")
import base64
from Crypto.Cipher import DES3, AES
import hashlib
from pathlib import Path, PurePath
import argparse
from lxml import etree
impo... | StarcoderdataPython |
6970 | #! /usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | StarcoderdataPython |
4382 | <gh_stars>1-10
from django.utils.translation import ugettext
from django.views.decorators.http import require_POST
from django.http import JsonResponse
from django.shortcuts import render
from django.core.exceptions import ValidationError
from django.views.decorators.csrf import csrf_exempt
from cart.lib import get_c... | StarcoderdataPython |
3260637 | from uuid import UUID
from backend.domain.contracts import ProductService
from backend.domain.exceptions import ProductUnavaliableError
class CheckProductAvaliability:
def __init__(self, service: ProductService) -> None:
self.service = service
def handle(self, product_id: UUID, amount: int) -> None:... | StarcoderdataPython |
3271636 | # -*- coding: utf-8 -*-
"""A package for converting RGD to BEL."""
from .constants import VERSION
from .manager import Manager
def get_version() -> str:
"""Get the package version."""
return VERSION
| StarcoderdataPython |
3374418 | <reponame>APirchner/gsvi
""" Holds Google Trends category codes. """
import enum
class CategoryCodes(enum.IntEnum):
""" Holds Google Trends category codes. """
NONE = 0
ARTS_ENTERTAINMENT = 3
AUTOS_VEHICLES = 47
BEAUTY_FITNESS = 44
BOOKS_LITERATURE = 22
BUSINESS_INDUSTRIAL = 12
COMPUTE... | StarcoderdataPython |
106747 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
from sklearn import svm, datasets
from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
url = "C:/Users/USUARIO/Desktop/Tesis/centroides-Apriori4.csv"
datos = pd.read_csv(url, sep=",")
# In[5]:
iris = datos
# Add noisy featur... | StarcoderdataPython |
1661544 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-12-21 11:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0048_remove_events_organization_model'),
]
operations = [
migrati... | StarcoderdataPython |
1696675 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyr... | StarcoderdataPython |
1674254 | <reponame>Smotko/ggrc-core
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: <EMAIL>
# Maintained By: <EMAIL>
"""Add some more indexes
Revision ID: 5560713e91b2
Revises: <PASSWORD>
Create Date: 2... | StarcoderdataPython |
88256 | <reponame>dadezzzzz/Covid-19-Tirocinio
import pandas as pd
import requests
import json
keywords = pd.read_csv('C:/Users/david/OneDrive/Documenti/Tirocinio/KeyWords_Da_Analizzare_Conteggio.csv', delimiter = ';')
key_list = {}
#creo un dictionary del tipo "doi":"keyword concatenate"
for index, row in keywords.iloc[1:2]... | StarcoderdataPython |
1742102 | #!/usr/bin/python
#
# Copyright (c) 2013-2018, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# ... | StarcoderdataPython |
18040 | <gh_stars>1-10
num = int(input('Digite um número inteiro: '))
print(f'O número: {num}'
f'\nO antecessor: {num - 1}'
f'\nO sucessor: {num + 1}')
| StarcoderdataPython |
197830 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-07-08 16:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0084_auto_20190508_0849'),
]
operations = [
migrations.AlterFie... | StarcoderdataPython |
100582 | <reponame>SBRG/sbaas
from models import *
from sqlalchemy.exc import SQLAlchemyError
import xl
import numpy
class ORM2Excel():
"""class to view, manipulate and update data from an ORM"""
xlColumnNames = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
... | StarcoderdataPython |
3274861 | from flask import Flask, render_template, request
from data import *
#from flask_basic.data import *
app = Flask(__name__)
@app.route('/', methods=['POST', 'GET'])
def index():
print("app.py: ")
if request == None:
return render_template('home.html')
elif request.method == 'POST':
... | StarcoderdataPython |
166435 | from mrf.mrfStructuresPara import *
###########################
##parallel implementation
###########################
class ParaPolysomeDetectionMRF(ParaMRF):
def __init__(self, G):
ParaMRF.__init__(self, G)
self._pathProb = np.ndarray((self._totalNodes, self._totalNodes))
... | StarcoderdataPython |
1792554 | from typing import List
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
# 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1],
# so we only have to care about those elements in this range and remove the rest.
# 2. we c... | StarcoderdataPython |
3313755 | <gh_stars>0
def media(file):
soma=0
counter=0
while file:
num = file.readline().strip()
if num=="":
break
soma+=int(num)
counter+=1
return soma/counter
def main():
file = open('scores.txt','r')
print(media(file))
file.close()
main()
#Colocar ... | StarcoderdataPython |
3205938 | def errorInOuter():
y = 1
del y
print(y)
def inner():
return y
def errorInInner():
def inner():
return y
y = 1
del y
inner()
___assertRaises(UnboundLocalError, errorInOuter)
___assertRaises(NameError, errorInInner)
| StarcoderdataPython |
1614926 | <reponame>aapris/MyData
import datetime
import uuid
import pytz
from django.contrib.auth.models import User
from django.test import TestCase
from logbook.models import Message, Category, Record, Profile
class MessageTestCase(TestCase):
fixtures = ["sample_categories.json"]
def setUp(self):
self.time... | StarcoderdataPython |
3394105 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('management', '0011_refactored_to_resourcedata'),
]
operations = [
migrations.RemoveFi... | StarcoderdataPython |
1636342 | <filename>gewittergefahr/gg_utils/gridrad_utils.py
"""Processing methods for GridRad data.
--- DEFINITIONS ---
WDSS-II = Warning Decision Support System -- Integrated Information = a software
package for the analysis and visualization of thunderstorm-related data
(Lakshmanan et al. 2007).
--- REFERENCES ---
http://... | StarcoderdataPython |
180368 | import typing
class ReadStdin:
def __call__(
self,
) -> bytes:
return next(self.__chunks)
def __init__(
self,
) -> typing.NoReturn:
import sys
self.__buf = (
sys.stdin.buffer
)
self.__chunks = (
self.__read_chunks()
)
def int(
self,
) -> int:
return ... | StarcoderdataPython |
114887 | <reponame>Tajnymag/vsb-pai-game-of-life<filename>gol-py/src/patterns.py
import os
from multiprocessing import Pool, Process
from multiprocessing.sharedctypes import Array, RawArray
import numpy as np
from numpy.typing import NDArray
from rle import RuleLengthEncoded
beehive = RuleLengthEncoded("""#N Beehive
#O <NAME... | StarcoderdataPython |
3273951 | <reponame>gtoffoli/commons-cops
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('commons', '0003_auto_20160930_1319'),
]
operations = [
migrations.AddField(
mode... | StarcoderdataPython |
4802868 | <filename>ampel/abstract/AbsAlertSupplier.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : Ampel-alerts/ampel/abstract/AbsAlertSupplier.py
# License : BSD-3-Clause
# Author : vb <<EMAIL>>
# Date : 23.04.2018
# Last Modified Date: 29.07.2021
# Last Modified By : v... | StarcoderdataPython |
3283950 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | StarcoderdataPython |
1709821 | <reponame>erjanmx/salam-bot
import logging
from . models.user import User
from . models.chat import Chat
from . namba_one import NambaOne
from . bot_commands import BotCommands
from config.i18n import locales, default_locale
from config.settings import NAMBA_ONE_API_TOKEN
logging.getLogger("salam-bot.log")
class Bot... | StarcoderdataPython |
46172 | <gh_stars>1-10
from dolfin.function.argument import Argument
from ufl.core.terminal import Terminal
import dolfin as df
def topological_dim(thing):
'''Extract topological dimension of thing's cell'''
domain = thing.ufl_domain() # None with e.g. Constants
return -1 if domain is None else domain.ufl_cell(... | StarcoderdataPython |
46646 | # Usage:
# Find and download fred series data
# then find the specific data on yyyy-mm-dd
import requests # used for downloading text files from FRED
import os # used for removing temporary text files
# Usage : download series data in the form of text file and extract data on given date
# param:
# se... | StarcoderdataPython |
3223225 | <reponame>maskarb/fisher_information<filename>kernel_functions.py
"""
The optimal bandwidth calculations are based on work published here:
http://www.umiacs.umd.edu/labs/cvl/pirl/vikas/Software/optimal_bw/optimal_bw_code.htm
References:
Fast optimal bandwidth selection for kernel density estimation.
<NAME> and <N... | StarcoderdataPython |
69433 | <reponame>Utagai/todoist_cli<gh_stars>0
from objects import Project
from cli_helpers import CmdError
class CLIState:
def __init__(self, wrapper):
self.listing = []
self.listing_map = {}
self.active_project = None
self._wrapper = wrapper
def set_state(self, listing):
se... | StarcoderdataPython |
45773 | # 길찾기 게임
import heapq
class Node:
def __init__(self, data, idx):
self._data = data
self._idx = idx
self.left = None
self.right = None
@property
def data(self):
return self._data
@data.setter
def data(self, data):
self._data = data
@property
... | StarcoderdataPython |
1630688 | <gh_stars>10-100
#!/usr/bin/python
# Copyright (c) 2017 The ACEseq workflow developers.
# Distributed under the MIT License (license terms are at https://www.github.com/eilslabs/ACEseqWorkflow/LICENSE.txt).
class Input:
def __init__( self, file_handle ):
self.file_handle = file_handle
if file_handle == None:
... | StarcoderdataPython |
52763 | <filename>statinf/data/__init__.py<gh_stars>0
from .GenerateData import generate_dataset | StarcoderdataPython |
18732 | <filename>setup.py
__version__ = '0.3.5'
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
setup(name='lettuce_webdriver',
version=__version__,
... | StarcoderdataPython |
4814190 | from django.http import HttpResponse
from celery.task.schedules import crontab
from celery.decorators import periodic_task, task
# from .views import gifs_queue
from gifspool.models import Gif
from celery import Celery, shared_task
# from .celery import app
# # @periodic_task(run_every=(crontab(minute='*/1')), name=... | StarcoderdataPython |
139416 | <gh_stars>10-100
"""Python implementation of a priorityq."""
from src.binheap import Binheap
class PriorityQ(object):
"""
Priority Q data structure.
Following methods are supported.
Insert(value, [priority]): inserts a value into the queue.
Takes an optional argument for that value's priority.
... | StarcoderdataPython |
3263905 | from os import environ
import re
from flask import Flask, abort, g, redirect, render_template, request
# import httpagentparser
import requests
from cache import Dummycached, Memcached
COMPROMISE_MORALS = False
#
# the app
#
app = Flask(__name__)
# app store URLs
ANDROID_URL = "https://play.google.com/store/ap... | StarcoderdataPython |
129722 | <filename>openstack_client/__init__.py
from .server import OCServer
| StarcoderdataPython |
1621973 | <gh_stars>0
from .IConfigManager import IConfigManager
from jumpscale import j
import os
import copy
from .JSBaseClassConfig import JSBaseClassConfig
from .JSBaseClassConfigs import JSBaseClassConfigs
from .FileConfig import FileConfig
import sys
installmessage = """
**ERROR**: there is no config directory created
... | StarcoderdataPython |
51388 |
class EntityPair(object):
"""实体对
Atrributes:
entity1: WordUnit,实体1的词单元
entity2: WordUnit,实体2的词单元
"""
def __init__(self, entity1, entity2):
self.entity1 = entity1
self.entity2 = entity2
def get_entity1(self):
return self.entity1
def set_entity1(self, en... | StarcoderdataPython |
1703318 | <reponame>anas-899/lopq
from setuptools import setup
setup(
name='lopqpy3',
version='1.0.0',
description='yahoo lopq for product quantization',
url='https://github.com/anas-899/lopq.git',
'author': '<NAME>,<NAME>,<NAME>',
'author_email': '<EMAIL>',
'license': 'Apache-2.0',
packages=[
... | StarcoderdataPython |
137998 | <reponame>zhaoyuzhi/Semantic-Colorization-GAN
import argparse
import os
import cv2
import numpy as np
import torch
from torch.utils.data import DataLoader
import utils
import dataset
if __name__ == "__main__":
# ----------------------------------------
# Initialize the parameters
# ---... | StarcoderdataPython |
3202907 | <reponame>Zeqiang-Lai/DPHSIR
from .qrnn3d import QRNNREDC3D
from .grunet import GRUnet
"""Define commonly used architecture"""
def qrnn3d():
net = QRNNREDC3D(1, 16, 5, [1, 3], has_ad=True, bn=True)
net.use_2dconv = False
net.bandwise = False
return net
def qrnn2d():
net = QRNNREDC3D(1, 16, 5, [... | StarcoderdataPython |
3347688 | <reponame>jiyolla/StudyForCodingTestWithDongbinNa<gh_stars>0
import sys
import math
import heapq
def solve():
read = sys.stdin.readline
# sys.setrecursionlimit(10**7)
for _ in range(int(read())):
n, m, k = map(int, read().split())
graph = [[] for _ in range(n + 1)]
for _ in range(k... | StarcoderdataPython |
18897 | <reponame>WatsonWangZh/CodingPractice
# Given a positive integer num consisting only of digits 6 and 9.
# Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6).
# Example 1:
# Input: num = 9669
# Output: 9969
# Explanation:
# Changing the first digit results in 6669.
# Cha... | StarcoderdataPython |
3292663 | <reponame>kevindoole/udacity_p4
#!/usr/bin/env python
"""speaker_service.py
Handle requests related to Wishlists.
"""
from google.appengine.ext import ndb
from models.conference_session import ConferenceSessionForms, \
ConferenceSessionForm, ConferenceSession
from models.models import ConflictException
from mod... | StarcoderdataPython |
127235 | <reponame>Mause/media
import os
from datetime import date
from enum import Enum
from itertools import chain
from typing import Dict, List, Literal, Optional, Union
import aiohttp
import aiohttp.web_exceptions
import backoff
from cachetools import LRUCache, TTLCache
from requests_toolbelt.sessions import BaseUrlSession... | StarcoderdataPython |
4830171 | <reponame>MaicoTimmerman/uva_networks_systemsecurity<filename>4wk/src/lab4-klusman_timmerman.py
## Netwerken en Systeembeveiliging Lab 4 - Distributed Sensor Network
## NAME: <NAME> & <NAME>
## STUDENT ID: 10675671
import struct
from math import sqrt
from select import select
from socket import socket, inet_aton
from s... | StarcoderdataPython |
164025 | <gh_stars>1-10
from tkinter import *
class Spin:
def __init__(self, root):
self.f=Frame(root, height=700, width=800, cursor='pencil')
self.f.propagate(0)
self.f.pack()
self.font=('Helvetica', 18,'bold')
self.l1=Label(text="Enter your Name : ", font=self.font)
... | StarcoderdataPython |
1741798 | # -*- encoding: utf-8 -*-
import os
from PyQt5.QtCore import QDateTime, Qt
from PyQt5.QtWidgets import QVBoxLayout, QLabel
import mobase
class GenericGameSaveGame(mobase.ISaveGame):
def __init__(self, filename):
super().__init__()
self._filename = filename
def getFilename(self):
re... | StarcoderdataPython |
1624423 | from .. import game
from mbtai.game import v2
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import eq_
def test_movement():
spec = game.TankSpec(
max_hp=1000,
advance_speed=8,
reverse_speed=3,
traverse_speed=1.2,
turret_traverse_speed=1.5,
... | StarcoderdataPython |
181079 | <reponame>AWhiteFox/yl-bot<filename>src/cogs/prefixes.py
import os
import discord
from discord.ext import commands
from table import Table
class Prefixes(commands.Cog):
db_table_name = 'prefixes'
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='get_prefix')
async... | StarcoderdataPython |
1792303 | <filename>tests/test_decoders.py
from __future__ import absolute_import
from central.decoders import Decoder
from central.exceptions import DecoderError
from datetime import date, datetime, time
from unittest import TestCase
class TestDecoder(TestCase):
def test_get_instance(self):
self.assertEqual(Decod... | StarcoderdataPython |
1689127 | import kfac
import CustomOp as co
import RL_farmwork.experience_replay as rl
from models.official.resnet.cifar10_main import *
from models.official.resnet.cifar10_main import input_fn, _WEIGHT_DECAY, _NUM_IMAGES
from train_val.problems import *
def get_filenames(training_type, data_dir):
"""Returns a list of fil... | StarcoderdataPython |
1655651 | <reponame>songdaegeun/school-zone-enforcement-system<filename>final/Yolo_mark/x64/Release/data/find_empty_txt.py<gh_stars>0
import cv2
name="num"
path='/home/jelly/catkin_ws/src/Yolo_mark/x64/Release/data/img/'
count=1
last=2814
while count<=last :
try:
txt = open(path+name+str(count)+'.txt','r')
... | StarcoderdataPython |
3361994 | <reponame>hansent/kivy
'''
Graphics
========
This package assembles many low level functions used for drawing. The whole
graphics package is compatible with OpenGL ES 2.0 and has many rendering
optimizations.
The basics
----------
For drawing on a screen, you will need :
1. a :class:`~kivy.graphics.instructions... | StarcoderdataPython |
132562 | <gh_stars>10-100
import os
import subprocess
import json
import logging
from .models import GPUServer, GPUInfo
task_logger = logging.getLogger('django.task')
def ssh_execute(host, user, exec_cmd, port=22, private_key_path=None):
exec_cmd = exec_cmd.replace('\r\n', '\n').replace('$', '\\$')
if exec_cmd[-1] !... | StarcoderdataPython |
3300515 | <reponame>kelson-gs/Desafios-python<filename>desafio57.py
# faça um programa que leia o sexo de uma pessoa, mas só aceite os valores 'M' ou 'F'. Caso esteja errado, peça a digitação novamente até ter um valor correto.
#/////////////////////////////////////////////////////////////////////////////////////////////////////... | StarcoderdataPython |
65743 | <gh_stars>1000+
from typing import List, Union
from collections import OrderedDict
import glob
import os
from pathlib import Path
import torch
def _load_weights(path: str) -> dict:
"""
Load weights of a model.
Args:
path: Path to model weights
Returns:
Weights
"""
weights = ... | StarcoderdataPython |
1766116 | """
.. todo::
WRITEME
"""
__authors__ = "<NAME>"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["<NAME>"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "<EMAIL>"
import numpy as N
class Multinomial(object):
"""
.. todo::
WRITEME
"""
d... | StarcoderdataPython |
3325977 | <reponame>MatthewZheng/Project-Euler-Solutions-.C-and-.py-<gh_stars>0
#! usr/bin/env python
_author_ = "<NAME>";
_purpose_ = "Project Euler Question Eight Solution: Largest product in a series"
import sys
import math
def main():
longNum = (
"73167176531330624919225119674426574742355349194934"
"96983520312... | StarcoderdataPython |
1675832 | <gh_stars>0
import logging
from typing import List
from sqlalchemy.orm import Session
from dispatch.conversation.enums import ConversationButtonActions
from dispatch.database import resolve_attr
from dispatch.decorators import background_task
from dispatch.enums import Visibility
from dispatch.incident import flows a... | StarcoderdataPython |
1641280 | import csv
import math
import os
import sys
from itertools import islice
from os import path
import numpy as np
import tensorflow as tf
from PIL import Image
TRAINING_SHARDS = 60
VALIDATION_SHARDS = 30
TRAIN_DIRECTORY = 'train'
VALIDATION_DIRECTORY = 'validation'
# List of folders for training, validation and test.
... | StarcoderdataPython |
1761119 | <reponame>coecms/CAFEAWS
from setuptools import setup
setup(
name="cafaz",
version="0.2.2",
description="To read CAFE60 on AWS from NCI",
url="https://github.com/coecms/CAFEAWS",
author="<NAME>",
author_email="<EMAIL>",
license="Apache 2.0",
packages=["cafaz"],
install_requires=[
... | StarcoderdataPython |
178684 | <gh_stars>1-10
from gensim.models import Word2Vec
def extract_synonyms(model: Word2Vec, terms: list) -> dict:
"""
Extracts the synonyms for terms in relation to a trained Word2Vec model.
TO-DO: Add tests but not sure how to because need to create Word2Vec class.
:param model: Word2Vec trained model w... | StarcoderdataPython |
173812 | import pytest
from moa import Function, NDArray, BinaryOperation
from moa.yaccer import build_parser
@pytest.mark.parametrize("filename,result", [
("test_files/moa/example0.moa", Function(
identifier='test',
arguments=[
NDArray(shape=(5, 4), data=None, constant=False, identifier='A'),... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.