id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1601937
<filename>sumu/gadget.py<gh_stars>0 """The module implements the algorithm Gadget as first detailed in :footcite:`viinikka:2020a`. Limitations: The computations rely heavily on bitwise operations, which for reasons of efficiency have been implemented using primitive data types (i.e., uint64_t). In the current ve...
StarcoderdataPython
3257741
from .pdf_reports import pug_to_html, write_report, EGF_LOGO_URL
StarcoderdataPython
1684871
<filename>K64F Python Interfacing Testing/V2_Serial_Read.py import numpy as np import serial.tools.list_ports as port_list import serial def List_All_Mbed_USB_Devices(Buadrate = 115200): ports = list(port_list.comports()) Num_Serial_Devices = len(ports) Num_Mbed_Devices = 0 COM_PORTS = [] connecti...
StarcoderdataPython
1654360
<reponame>hnc01/online-judge<gh_stars>0 ''' https://leetcode.com/problems/course-schedule-ii/ 210. Course Schedule II There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you mu...
StarcoderdataPython
1601510
__author__ = 'royrusso' import pytest pytest_plugins = ["docker_compose"] @pytest.mark.hq_ops def test_get_clusters(fixture): fixture.clear_all_clusters() response = fixture.app.get('/api/clusters') assert 200 == response.status_code res = fixture.get_response_data(response) assert res['data']...
StarcoderdataPython
3309815
# (c) 2015 <NAME> <<EMAIL>> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is...
StarcoderdataPython
3225835
def get_config(): return { 'aws': { 'profile_name': 'mgap' }, 'clarifai': { 'api_key': '' }, 'elucidate': { 'host': 'http://localhost', 'port': 8080, 'base_path': '/annotation', 'annotation_model': 'w3c',...
StarcoderdataPython
3371289
import os from tqdm import tqdm import numpy as np import cv2 data_type = "SCUT-EnsText" path = "SCUT-EnsText/train" assert data_type=="SCUT-EnsText" or data_type=="SCUT-Syn" if data_type=="SCUT-EnsText": os.makedirs(os.path.join(path, "mask"), exist_ok=True) file_names = list(map(lambda x: x.split(".")[0...
StarcoderdataPython
8528
# @AUTHOR : lonsty # @DATE : 2020/3/28 18:01 class CookiesExpiredException(Exception): pass class NoImagesException(Exception): pass class ContentParserError(Exception): pass class UserNotFound(Exception): pass
StarcoderdataPython
45671
<reponame>hillyuan/Panzer #! /usr/bin/env python """ Script for analyzing Panzer kernel performance on next-generation architectures. Runs hierarchic parallelism and generates plots from data. """ __version__ = "1.0" __author__ = "<NAME>" __date__ = "Dec 2018" # Import python modules for command-line options, t...
StarcoderdataPython
1795756
<gh_stars>10-100 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. impor...
StarcoderdataPython
1682597
############################################################################## # # Copyright (c) 2008 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
StarcoderdataPython
185575
<filename>wgdi/retain.py import re import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd import wgdi.base as base class retain(): def __init__(self, options): self.position = 'order' for k, v in options: setattr(self, str(k), v) print(str(k), ' =...
StarcoderdataPython
170853
a = int(input()) b = int(input()) print(b - (a % b) if a % b != 0 else 0)
StarcoderdataPython
3246436
<gh_stars>0 # -*- coding: utf-8 -*- # author: <NAME> # <NAME> # email: <EMAIL> #
StarcoderdataPython
1667978
# https://leetcode.com/problems/longest-palindromic-substring/ class Solution(object): def longestPalindrome(self, s): result = "" for i in range(len(s)): temp = self.helper(s,i,i) if len(temp)> len(result): result = temp temp = self.helper(s,i,i+1) if len(result)<len(temp): result = temp...
StarcoderdataPython
1612881
#!/usr/bin/env python """ Code and Configuration Comments Parsing and Stripping This module is designed to make it easy to remove or retrieve comments from a source file. This is accomplished in a single pass using a relatively complex regular expression. The module provides two interface functions: `get()` and `s...
StarcoderdataPython
3319111
# coding: utf-8 # flake8: noqa """ Swagger Petstore This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the a...
StarcoderdataPython
3317158
<reponame>SciampiJacopo/py-test import sys import pygame class UIImageClass: def __init__(self): info = pygame.display.Info() self.screenW = info.current_w self.screenH = info.current_h def createBackgroundImage(self, imagePath): image = pygame.image.load(sys.path[0] + imageP...
StarcoderdataPython
3290671
<reponame>fgitmichael/AutoregressiveModeDisentangling import torch from mode_disent.test.action_sampler import ActionSampler from mode_disent_no_ssm.network.mode_model import ModeLatentNetwork as ModeLatentNetworkNoSSM class ActionSamplerNoSSM(ActionSampler): def __init__(self, mode_model: Mode...
StarcoderdataPython
1685815
<reponame>RootA/flask-cli from flask_sqlalchemy import SQLAlchemy from datetime import datetime, timedelta from routes import db, app
StarcoderdataPython
3203799
<gh_stars>1-10 # -*- coding: utf-8 -*- """ """ try: from collections.abc import Mapping as MappingABC except ImportError: from collections import Mapping as MappingABC from ..utilities.future_from_2 import str, object, repr_compat, unicode from ..utilities.unique import NOARG from .deep_bunch import DeepBunch ...
StarcoderdataPython
1641162
<reponame>altynbek07/python-qazaq-transliterator<filename>qazaq_transliterator/__init__.py from .qazaq_transliterator import translit
StarcoderdataPython
4822121
<gh_stars>0 from django.db import models from django import forms # Create your models here. class Categoria(models.Model): nome_categoria = models.CharField('Nome Categoria', max_length=250) descricao = models.TextField('Descricao') #falta inserir dps as estatisticas def __str__(self) -> str: ...
StarcoderdataPython
123195
<gh_stars>1-10 """ Finetune goldenretriever on knwoledge bases in Elasticsearch Sample usage: ------------ python -m src.finetune.main """ import os import pickle import datetime import pandas as pd import numpy as np import logging import random import sys import tarfile import shutil import tensorflow as tf from sk...
StarcoderdataPython
4802520
#!/usr/bin/env python # Set card game from random import shuffle colors = ["red", "green", "blue"] counts = range(1,4) shapes = ["diamond", "squiggle", "oval"] shades = ["blank", "filled", "hatched"] deck = [] class Card: def __init__(self, col, cnt, shp, shd): self.col, self.cnt, self.shp, self.shd = col...
StarcoderdataPython
1791132
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-05-19 01:35 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import functools import nc.models import nc.validators class Migration(migrations.Migration): dependencies = [ ('nc'...
StarcoderdataPython
3378179
<filename>lib/Topics.py<gh_stars>0 from enum import Enum class Topics(Enum): wsWriteMessage = 'wsWriteMessage' wsReceivedMessage = 'wsReceivedMessage' wsWriteMessageJSON = 'wsWriteMessageJSON' wsReceivedMessageJSON = 'wsReceivedMessageJSON'
StarcoderdataPython
3227289
<gh_stars>0 from dataclasses import dataclass from typing import Optional, Type from datek_jaipur.application.adapters.base import BaseAdapter from datek_jaipur.domain.compound_types.game import Game @dataclass class Scope: adapter_class: Type[BaseAdapter] game: Optional[Game] = None
StarcoderdataPython
1781361
<reponame>CyberZHG/mos-6502-restricted-assembler from unittest import TestCase from asm_6502 import Assembler class TestAssembleLSR(TestCase): def setUp(self) -> None: self.assembler = Assembler() def test_lsr_accumulator(self): code = "LSR A" results = self.assembler.assemble(code,...
StarcoderdataPython
100679
import itertools from unittest import skip from django.core import urlresolvers from rest_framework.test import APIClient, APIRequestFactory from rest_framework.test import APITestCase, force_authenticate from api.tests.factories import ( UserFactory, AnonymousUserFactory, IdentityFactory, ProviderFactory, Allocat...
StarcoderdataPython
3207973
<reponame>peter-wangxu/python_play import eventlet from eventlet import wsgi def app(environ,start_response): start_response("200 OK",[("Content-Type","text/plain")]) return "Hello World\n" if __name__ == "__main__": wsgi.server(eventlet.listen(("localhost",6785)), app)
StarcoderdataPython
3209910
import numpy as np import matplotlib.pyplot as plt import visa import time import math class DSO6012A(object): def __init__(self): scopeID = "USB0::0x0957::0x1722::MY45002264::INSTR" # For DSO6012A #scopeID = "USB0::0x0957::0x1798::MY54231293::INSTR" # For DSO-X-2014A rm = visa.ResourceManager() ...
StarcoderdataPython
1719429
<reponame>Piphi5/MHM-Country-Demo from datetime import datetime import numpy as np import sys, os import pandas as pd from arcgis.gis import GIS from arcgis import features from arcgis.features import GeoAccessor from autoupdater.utils import OverwriteFS temp_layer_name = "Temp_layer" class Country_Updater: de...
StarcoderdataPython
3340208
########################################### ########################################### #### Function to generate reports in Reportlab ########################################### ########################################### # libraries import matplotlib.pyplot as plt import numpy as np import pandas as pd ## repor...
StarcoderdataPython
3361346
<gh_stars>1-10 #!/usr/bin/env python ################################################################################ # # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors # # This file is a part of the MadGraph5_aMC@NLO project, an application which # automatically generates Feynman diagrams...
StarcoderdataPython
1704136
<reponame>lyarenei/mausmakro<gh_stars>1-10 import unittest from unittest.mock import patch from mausmakro.lib.enums import Opcode from mausmakro.lib.exceptions import LabelException, ParserException from mausmakro.lib.types import Command, Conditional from mausmakro.parsing import Parser # noinspection PyUnresolvedR...
StarcoderdataPython
49154
"""Compile, run and lint files.""" import dataclasses import logging import os import pathlib import shlex import sys from functools import partial from typing import List, Optional if sys.version_info >= (3, 8): from typing import Literal else: from typing_extensions import Literal from porcupine import get...
StarcoderdataPython
3268859
from flask import Flask, render_template import pymysql import folium from folium import plugins import netifaces app = Flask(__name__) ''' * get_gateway_address()는 LocalHost gateway 정보를 반환 * @ https://pypi.org/project/netifaces/ * @ ex) 작성자의 ip 주소인 '192.168.0.10'을 반환 ''' def get_gateway_address(): return netifac...
StarcoderdataPython
4822999
from RFEM.initModel import Model from RFEM.enums import ObjectTypes, SelectedObjectInformation class ObjectInformation(): # missing def __init__( with definition of self and its variables # object_type, no, parent_no, information, row_key and result. def CentreOfGravity(self, type ...
StarcoderdataPython
133614
#!/usr/bin/python # -*- coding: utf-8 -*- import smbus import time import datetime import threading import crc16 ADDRESS = 0x5c # 7bit address (will be left shifted to add the read write bit) READ_INT = 10 # [sec], each reading interval is to be grater than 2 sec LOG_INT = 600 # [sec] DEBUG_MODE = True #W_ADDR =...
StarcoderdataPython
3214850
# decide which modules the package expoerts # __all__ = ['...']
StarcoderdataPython
3284955
<filename>grouper/fe/handlers/permission_view.py from __future__ import annotations from typing import TYPE_CHECKING from grouper.fe.templates import PermissionTemplate from grouper.fe.util import GrouperHandler from grouper.usecases.view_permission import ViewPermissionUI if TYPE_CHECKING: from grouper.entities...
StarcoderdataPython
1659625
# -*- coding: utf-8 -*- """ # Author : Camey # DateTime : 2021/12/1 7:47 下午 # Description : """ import math from COMMON.model import MLP import torch import torch.nn as nn import os import numpy as np import torch.optim as optim from COMMON.memory import ReplayBuffer import random class DQN: def __init__(s...
StarcoderdataPython
3257496
# coding=utf-8 from __future__ import unicode_literals, print_function from pylexibank.dataset import CldfDataset, TranscriptionReport from pylexibank.cli import _readme from pylexibank.util import download_and_unpack_zipfiles from clldutils.path import Path from pylexibank.lingpy_util import getEvoBibAsSource, iter_a...
StarcoderdataPython
120526
<filename>multilineage_organoid/utils.py """ Utility functions used by multiple modules * :py:func:`lowpass_filter`: Lowpass filter a signal with the filtfilt function * :py:func:`calc_frequency_domain`: Convert a time domain signal to frequency """ # Imports from typing import Tuple # 3rd party import numpy as np ...
StarcoderdataPython
110391
<reponame>saper0/scikit-hubness # -*- coding: utf-8 -*- # SPDX-License-Identifier: BSD-3-Clause from sklearn.neighbors import NearestCentroid __all__ = ['NearestCentroid']
StarcoderdataPython
96158
<gh_stars>0 GITHUB_PULLS_PROVIDER_ID = 'github_pulls'
StarcoderdataPython
4824720
<gh_stars>0 # -*- coding: utf-8 -*- from abc import ABC, abstractmethod from typing import Optional from pip_services3_commons.data import FilterParams, PagingParams, DataPage from pip_service_data_python.data.EntityV1 import EntityV1 class IEntitiesPersistence(ABC): @abstractmethod def __init__(self): ...
StarcoderdataPython
36766
<filename>qiling/qiling/os/windows/dlls/kernel32/fileapi.py #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework # import struct, time, os from shutil import copyfile from datetime import datetime from qiling.exception import * from qiling.os.windows.const import * f...
StarcoderdataPython
1604797
<filename>scripts/slave/recipe_modules/syzygy/chromium_config.py # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import DEPS CONFIG_CTX = DEPS['chromium'].CONFIG_CTX from recipe_engine.config_types import...
StarcoderdataPython
1728102
<reponame>BenSchZA/aquarius # Copyright 2018 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 import copy import json import pytest from aquarius.constants import BaseURLs from aquarius.run import app app = app @pytest.fixture def base_ddo_url(): return BaseURLs.BASE_AQUARIUS_URL + '/assets/dd...
StarcoderdataPython
79596
<gh_stars>0 # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.backend.python.rules.setup_py_util import distutils_repr testdata = { 'foo': 'bar', 'baz': { 'qux': [123, 456], 'quux': ('abc', b'xyz'), 'corge': {...
StarcoderdataPython
3247122
<filename>lab_03/main.py X, Y, Z = 0, 1, 2 def function(x, y): return x**2 + y**2 #return x + y def create_table(f): start_x = float(input('Введите начало x: ')) finish_x = float(input('Введите конец x: ')) start_y = float(input('Введите начало y: ')) finish_y = float(input('Введите конец y:...
StarcoderdataPython
1620622
<gh_stars>1-10 #!/usr/bin/python # # Copyright 2017 The Goma Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import subprocess import sys def main(): parser = argparse.ArgumentParser() parser.add_argument('--gene...
StarcoderdataPython
1770317
from random import randint computador = randint(0,10) print('Sou o COMPUTADOR, tente acertar o núemro q eu estou pensado de 1 a 10') acertou = False palpite = 0 while not acertou: jogador = int(input('Digite qual é o seu palipite: ')) palpite +=1 if jogador == computador: acertou = True else: ...
StarcoderdataPython
1778575
<reponame>Stafil0/vkbot<filename>vkresponses/__init__.py import os import importlib __imports = os.path.dirname(__file__) __module = os.path.basename(__imports) __imported = [__importing for __importing in os.listdir(__imports) if __importing.endswith('.py')] for __import in __imported: importlib.import_module(f'{...
StarcoderdataPython
178333
#-*- encoding: utf-8 -*- # 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 # # 示例: # # 输入: [0,1,0,3,12] # 输出: [1,3,12,0,0] # # 说明: # # # 必须在原数组上操作,不能拷贝额外的数组。 # 尽量减少操作次数。 # # Related Topics 数组 双指针 # leetcode submit region begin(Prohibit modification and deletion) # class Solution(object): # def moveZeroes(self, n...
StarcoderdataPython
3206119
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
1670841
<filename>Project_Lvxincan/alltogether.py #coding=utf-8 from __future__ import print_function import cv2 as cv import numpy as np from matplotlib import pylab as plt import argparse import glob from math import pi import urx import logging import time import sys import math3d as m3d def move_to_dui1():...
StarcoderdataPython
1742326
<filename>Lectures/DeepLearningClass/chapter5/train_neuralnet_cifar10.py # coding: utf-8 import numpy as np from DeepLearningClass.chapter5.two_layer_net_3_layer import TwoLayerNet from DeepLearningClass.common.optimizer import Adam train_file_list = ['data/train_data_' + str(i) + '.csv' for i in range(1, 51)] test_f...
StarcoderdataPython
1796475
from utils.singleton import Singleton class Storage: __metaclass__ = Singleton def __init__(self): pass def download_file(self, key): raise NotImplementedError
StarcoderdataPython
4804280
<filename>simpleml/models/classifiers/external_models.py from simpleml.models.external_models import ExternalModelMixin import logging __author__ = '<NAME>' LOGGER = logging.getLogger(__name__) class ClassificationExternalModelMixin(ExternalModelMixin): ''' Wrapper class for a pickleable model with expect...
StarcoderdataPython
32013
<gh_stars>0 import torch from torchvision import models from torch import nn class GoTurnRemix(nn.Module): """ Create a model based on GOTURN. The GOTURN architecture used a CaffeNet while GoTurnRemix uses AlexNet. The rest of the architecture is the similar to GOTURN. A PyTorch implementation of ...
StarcoderdataPython
3335707
import networkx as nx import pickle import os from threading import Thread import networkx as nx # DATA_PATH = '/data/split_name_hr/' # DATA_PATH = '/data/backpage_only/' # asexyservice.com # eroticmugshots.com # escortsincollege.com # hoxnif.com # liveescortreviews.com DATA_PATH = 'asexyservice.com/' # ENDING = '_b...
StarcoderdataPython
38427
from django.shortcuts import render # Create your views here. from rest_framework.views import APIView from contents.serializers import HotSKUListSerializer from goods.models import SKU class HomeAPIView(APIView): pass ''' 列表数据 热销数据:应该是到哪个分类去获取哪个分类的热销数据中 1.获取分类id 2.根据id获取数据 3.将数据转化为字典 4返回相应 ''' from rest_f...
StarcoderdataPython
54308
#!/usr/bin/env python3 from random import randint class Caesar(object): def shift(self, offset): """Shifts the alphabet using a random number. Returns the value of the shift.""" self.alphabet = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', ...
StarcoderdataPython
1644458
# This file, included with the VICE package, is protected under the terms of the # associated MIT License, and any use or redistribution of this file in original # or altered form is subject to the copyright terms therein. """ Asymptotic Giant Branch Star Nucleosynthetic Yield Tools ===============================...
StarcoderdataPython
4811348
<gh_stars>1-10 import sys a=sys.stdin.read().split()
StarcoderdataPython
42076
<filename>src/core/migrations/0006_auto_20190615_2123.py<gh_stars>0 # Generated by Django 2.2.2 on 2019-06-15 21:23 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0005_auto_20190615_2113'), ] operations = [ migrations.RemoveField( ...
StarcoderdataPython
4807019
from .scan import DocScanner
StarcoderdataPython
1622720
<filename>kcc3/hosts.py<gh_stars>1-10 from django_hosts import patterns, host host_patterns = patterns( '', host(r'fanpai', 'kcc3.urls', name='root'), host(r'yakuman', 'yakumans.urls', name='yakumans'), )
StarcoderdataPython
187474
from math import inf def river_travelling(cost_matrix): N = len(cost_matrix) M = [[0 for x in range(N)] for x in range(N)] for steps in range(1, N): for i in range(N - steps): j = i + steps lowest = cost_matrix[i][j] for k in range(i + 1, j): lowe...
StarcoderdataPython
3376189
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: list_alert_states.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.pr...
StarcoderdataPython
109160
# -*- coding: utf-8 -*- """ Solution to Project Euler problem 3 Author: <NAME> https://github.com/jaimeliew1/Project_Euler_Solutions """ from EulerFunctions import primelist def run(): N = 600851475143 return max(p for p in primelist(int(N**0.5)) if N%p == 0) if __name__ == "__main__": print(run())
StarcoderdataPython
4827219
<filename>setup.py<gh_stars>1-10 from setuptools import setup setup( name='thai_sentiment', packages=['thai_sentiment'], version='v0.1.3', # Ideally should be same as your GitHub release tag varsion description='The naive sentiment classification function based on NBSVM trained on wisesight_sent...
StarcoderdataPython
93433
NEPS_URL = 'https://neps.academy' ENGLISH_BUTTON = '/html/body/div/div/div/div[2]/div/div/a/div[2]/div' LOGIN_PAGE_BUTTON = '//*[@id="app"]/div/div/div/div[1]/div/header/div/div/div[3]/div/div/nav/ul/li[6]/button' EMAIL_INPUT = '/html/body/div/div/div/div[3]/div/div/div/form/div[1]/div/div[1]/div/input' PASSWORD_INPUT ...
StarcoderdataPython
11312
import os from . import common import cv2 import numpy as np import imageio import torch import torch.utils.data as data class Video(data.Dataset): def __init__(self, args, name='Video', train=False, benchmark=False): self.args = args self.name = name self.scale = args.scale self...
StarcoderdataPython
3274979
""" A module of useful, generic functions. """ from __future__ import annotations from collections import deque from fractions import Fraction from typing import Iterable, TypeVar IntFraction = TypeVar("IntFraction", int, Fraction) T = TypeVar("T") class Half: """A class for representing 1/2 in such a way that...
StarcoderdataPython
1758998
<filename>tests/test_drivers/httpbin_client.py<gh_stars>10-100 from apiwrappers import Method, Request, Url from apiwrappers.auth import TokenAuth class HttpBin: def __init__(self, host, driver): self.url = Url(host) self.driver = driver def get(self, params=None): """The request's qu...
StarcoderdataPython
27189
# -*- coding: utf-8 -*- ''' Created on Oct 23, 2015 @author: jrm ''' from inkcut.device.plugin import DeviceProtocol from inkcut.core.utils import async_sleep, log class DebugProtocol(DeviceProtocol): """ A protocol that just logs what is called """ def connection_made(self): log.debug("protocol.conn...
StarcoderdataPython
1785039
<reponame>Karamax/SAI1<filename>L3/irisPredictionV1.py #!/usr/bin/env python # coding: utf-8 from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import mglearn import pandas as pd import numpy as np def prediction(unicSize, measuringBorders): # Конкретное измерение и зона кла...
StarcoderdataPython
3267210
<gh_stars>0 from django.contrib.contenttypes.models import ContentType from nautobot.circuits.models import Circuit, CircuitTermination, CircuitType, Provider from nautobot.dcim.models import PowerPanel, Site from nautobot.extras.choices import RelationshipTypeChoices from nautobot.extras.models import Relationship, R...
StarcoderdataPython
1679385
#!/usr/bin/env python import argparse import contextlib from collections import defaultdict import string import sys import os def main(): script_path = os.path.realpath(__file__) script_dir = os.path.dirname(script_path) default_input = os.path.join( script_dir, "UnitTests", "TestData", "gen", "...
StarcoderdataPython
3251372
#!/usr/bin/env python3 import math import cv2 import shm from mission.constants.config import wire as constants from vision.modules.base import ModuleBase from vision import options options = [ options.IntOption('adaptive_thresh_block_size', constants.block_size, 1, 2500), options.IntOption('adaptive...
StarcoderdataPython
3224569
import re import sys from types import FunctionType import inspect import pathlib import importlib PATH_TO_PLUGINS = pathlib.Path('../..').resolve().absolute() if str(PATH_TO_PLUGINS) not in sys.path: sys.path.insert(0, str(PATH_TO_PLUGINS)) import pigor.plugins as plugins [print(module) for module in dir(plugin...
StarcoderdataPython
4801242
import pygame from level import Level from game_loop import GameLoop from event_queue import EventQueue from renderer import Renderer from clock import Clock LEVEL_MAP_1 = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 2, 3, 4, 1], [1, 1, 1, 1, 1]] LEVEL_MAP_2 = [[1, 1, 1, 1, 1, 1...
StarcoderdataPython
3222563
import itertools import six import math class PolylineCodec(object): def _pcitr(self, iterable): return six.moves.zip(iterable, itertools.islice(iterable, 1, None)) def _py2_round(self, x): # The polyline algorithm uses Python 2's way of rounding return int(math.copysign(ma...
StarcoderdataPython
4820275
import requests class Discovery(object): """docstring for Discovery""" @staticmethod def find(): r = requests.get('https://www.meethue.com/api/nupnp') ips = [] for elm in r.json(): ips.append(elm['internalipaddress']) return ips
StarcoderdataPython
1628893
<reponame>nathandaddio/puzzle_app import pytest from pyramid.exceptions import HTTPNotFound from puzzle_app.views.hitori import hitori_boards_get, hitori_board_get from factories import ( HitoriGameBoardFactory, HitoriGameBoardCellFactory ) class TestHitoriGameBoardsGet: @pytest.fixture def board...
StarcoderdataPython
3225108
<reponame>funkyfuture/cerberuse-collections __all__ = [] from cerberus_collections.error_handlers.json import JSONErrorHandler # noqa: E402 __all__.append(JSONErrorHandler.__name__) try: from cerberus_collections.error_handlers.xml import XMLErrorHandler except ImportError: pass else: __all__.append(XMLE...
StarcoderdataPython
27314
import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import functional import numpy as np class Rotate(nn.Module): """ Rotate the image by random angle between -degrees and degrees. """ def __init__(self, degrees, interpolation_method='nearest'): super(Rotate, self...
StarcoderdataPython
65827
import requests import xml.etree.ElementTree as ET import logging from logging.config import dictConfig import json import copy import tempfile import os import calendar import time import sys from requests.auth import HTTPBasicAuth import xml.dom.minidom import datetime import shutil from io import open import platfor...
StarcoderdataPython
3292159
import argparse import math import numpy as np import scipy.interpolate as interpolate import torch import torch.nn as nn import torch.nn.functional as F import lib.layers as layers from .regularization import create_regularization_fns from .layers.elemwise import _logit as logit from .layers.elemwise import _sigmoid...
StarcoderdataPython
1645398
<gh_stars>0 from impute import MissForestImputation from randomforest import RandomForest import numpy as np class MissForestImputationLocal(MissForestImputation): """private class, missforest subclass for local machine""" def __init__(self, mf_params, rf_params): super().__init__(**mf_params) ...
StarcoderdataPython
116109
<gh_stars>1-10 from game_effect_modifier.base_game_effect_modifier import BaseGameEffectModifier from game_effect_modifier.game_effect_type import GameEffectType from sims4.tuning.tunable import HasTunableSingletonFactory, TunableReference import services import sims4.resources import zone_types class RelationshipTrac...
StarcoderdataPython
3235067
<filename>stanovanja/home/migrations/0054_auto_20210825_1417.py # Generated by Django 3.2.6 on 2021-08-25 12:17 from django.db import migrations import wagtail.core.blocks import wagtail.core.fields class Migration(migrations.Migration): dependencies = [ ('home', '0053_auto_20210825_1343'), ] o...
StarcoderdataPython
4842310
import sys import pytest import numpy as np from pyinlinemodule.module import InlineModule def function_with_cpp_args_kwargs(a, b, c=None, d=3, e=(None, "test")): """this is a doctring """ __cpp__ = """ return Py_BuildValue("(O,O,O,O,O)", a, b, c, d, e); """ return None def function_with_cp...
StarcoderdataPython
3396488
<reponame>zhiming-shen/Xen-Blanket-NG #!/usr/bin/python # Copyright (C) International Business Machines Corp., 2005 # Author: <NAME> <<EMAIL>> import re from XmTestLib import * status, output = traceCommand("xm destroy 0") if status == 0: FAIL("xm destroy returned bad status, expected non 0, status is: %i" % st...
StarcoderdataPython
1712257
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- from . import nodes from .graph import Graph
StarcoderdataPython