id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3239040
<gh_stars>0 from PageCheck import * from Extrator import * from bs4 import BeautifulSoup import requests import os import codecs class wikiMatrice: def __init__(self): self.url=" " def saisirUrl(self): url=input("veuillez entrez une url ") page=PageCheck(url) if(page.urlChek()!=...
StarcoderdataPython
38628
# Создайте модель мероприятия для сайта-афиши. # У модели должны быть такие поля: # Название мероприятия (name), не больше 200 символов # Дата и время проведения мероприятия (start_at) # Описание мероприятия (description) # Адрес электронной почты организатора мероприятия (contact) # Пользователь, который создал меропр...
StarcoderdataPython
3372908
import numpy as np from ..base import BaseSKI from tods.feature_analysis.StatisticalVecSum import StatisticalVecSumPrimitive class StatisticalVecSumSKI(BaseSKI): def __init__(self, **hyperparams): super().__init__(primitive=StatisticalVecSumPrimitive, **hyperparams) self.fit_available = False self.predict_avai...
StarcoderdataPython
3324837
import hashlib def hash_check( type, asset, filename, down_folder, subfolder, hash, k=None, b=None, ): if type == "hdris": file = down_folder + filename else: file = ( f"{subfolder}/{asset}_{k}/textures/{filename}" if not b el...
StarcoderdataPython
3365581
<filename>Algorithms_old/Easy/solve_me_second/solution/solution.py def main(input_data): input_data = [map(int, item.split(" ")) for item in input_data.split("\n")[1:]] return "\n".join(map(str, [a + b for (a, b) in input_data])) if __name__ == "__main__": from fileinput import input ...
StarcoderdataPython
1683652
<gh_stars>100-1000 import pytest from tri_struct import merged from iommi._db_compat import field_defaults_factory @pytest.mark.django def test_field_defaults_factory(): from django.db import models base = dict(parse_empty_string_as_none=True, required=True, display_name=None) assert field_defaults_fac...
StarcoderdataPython
4822350
import docker, logging, subprocess, random, io, os, time import shutil from django.conf import settings from corere.main import git as g from corere.main import models as m from corere.main import constants as c from django.db.models import Q logger = logging.getLogger(__name__) #TODO: Better error checking. stderr ha...
StarcoderdataPython
4830829
# -*- coding: utf-8 -*- # Created by restran on 2017/9/15 from __future__ import unicode_literals, absolute_import import string import subprocess def run_shell_cmd(cmd): try: (stdout, stderr) = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIP...
StarcoderdataPython
1605359
<reponame>bionet/ted.python<gh_stars>1-10 #!/usr/bin/env python """ Test and compare pure Python and Cython implementations of the Bjork-Pereyra Algorithm. """ # Copyright (c) 2009-2015, <NAME> # All rights reserved. # Distributed under the terms of the BSD license: # http://www.opensource.org/licenses/bsd-license f...
StarcoderdataPython
85051
<reponame>KarlHammar/High-threshold-QEC-toric-RL<filename>predict_script.py import numpy as np import time import os import torch import _pickle as cPickle from src.RL import RL from src.toric_model import Toric_code from NN import NN_11, NN_17 from ResNet import ResNet18, ResNet34, ResNet50, ResNet101, ResNet152 star...
StarcoderdataPython
1734500
from __clrclasses__.System import Enum as _n_0_t_0 from __clrclasses__.System import IComparable as _n_0_t_1 from __clrclasses__.System import IFormattable as _n_0_t_2 from __clrclasses__.System import IConvertible as _n_0_t_3 from __clrclasses__.System import Array as _n_0_t_4 from __clrclasses__.System import Attribu...
StarcoderdataPython
14708
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-01-03 15:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main', '0027_auto_20170103_1130'), ] ...
StarcoderdataPython
1749694
# -*- coding: utf-8 -*- # Copyright 2017-2019 <NAME> # # 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 ag...
StarcoderdataPython
153013
from flask import jsonify, request, Response, json, Blueprint import datetime ap = Blueprint('endpoint', __name__) parcels = [] # GET parcels @ap.route('/api/v1/parcels') def get_parcels(): ''' returns a list of all requests ''' if len(parcels) == 0: return jsonify({'msg': 'No parcels yet'})...
StarcoderdataPython
3336949
import asyncio import time import os from multiprocessing import Process,Lock,Value,Manager import queue import sqlite3 import threading import collections import platform from ctypes import c_bool import copy """ 这里使用的是异步触发式服务器,因为在IO上同时需要保证效率, 所以代码会比较冗长,希望能提出宝贵建议 """ __author__ = "chriskaliX" class R...
StarcoderdataPython
3324534
import connexion import six from openapi_server import query_manager from openapi_server.utils.vars import CONSTRAINT_TYPE_NAME, CONSTRAINT_TYPE_URI from openapi_server.models.constraint import Constraint # noqa: E501 from openapi_server import util def constraints_get(username=None, label=None, page=None, per_page=...
StarcoderdataPython
5915
from .stacking import StackingClassifier, stack_features from .multitask import MultiTaskEstimator
StarcoderdataPython
4820619
import pytest from datadog_checks.envoy import Envoy from .common import DEFAULT_INSTANCE, FLAKY_METRICS, PROMETHEUS_METRICS, requires_new_environment pytestmark = [requires_new_environment] @pytest.mark.e2e def test_e2e(dd_agent_check): aggregator = dd_agent_check(DEFAULT_INSTANCE, rate=True) for metric ...
StarcoderdataPython
3229923
<gh_stars>0 # a = 'vsem privet' # print(a.isdigit()) # # b = '15,7' # print(b.isdigit()) # # c = '156' # print(c.isdigit()) # # d = '15e6' # 15000000 # print(d.isdigit()) # # r = '15000000' # print(r.isdigit()) # # avg_mark = input('Введите средний балл студента\n') # # if avg_mark.isdigit(): # # avg_mark = fl...
StarcoderdataPython
3204388
<filename>src/part2_automation/t6_api_testing/locustfile.py from locust import HttpUser, task, between class WebsiteTestUser(HttpUser): wait_time = between(0.5, 3.0) def on_start(self): """ on_start is called when a Locust start before any task is scheduled """ pass def on_stop(self): ...
StarcoderdataPython
3332746
<gh_stars>10-100 #!/usr/bin/env python2.7 # Copyright 2020 The Fuchsia 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 fileinput import os import re import sys from common import (FUCHSIA_ROOT, fx_format) def ...
StarcoderdataPython
1685422
<reponame>tallzilla/project-euler<filename>euler001.py #!/bin/python3 import sys, logging t = int(input().strip()) cum_sum_cache = dict() for a0 in range(t): final_sum = 0 n = int(input().strip()) nearest_three_factor = int((n-1) / 3.0) three_multiple = nearest_three_factor * (nearest_three_factor...
StarcoderdataPython
1611513
import numpy as np from math import ceil def deriveSizeFromScale(img_shape, scale): output_shape = [] for k in range(2): output_shape.append(int(ceil(scale[k] * img_shape[k]))) return output_shape def deriveScaleFromSize(img_shape_in, img_shape_out): scale = [] for k in range(2): s...
StarcoderdataPython
1638955
"""Make BIDS compatible directory structures and infer meta data from MNE.""" # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD (3-clause) import os import errno import shutil as sh im...
StarcoderdataPython
35160
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from enum import Enum class Type(Enum): STRING = 'string' NUMBER = 'number' BOOLEAN = 'boolean' DATE = 'date' DATETIME = 'datetime' TIMEOFDAY = ...
StarcoderdataPython
4825121
from collections import OrderedDict import copy import hashlib import io import itertools import logging import os, os.path import platform import random import shutil import subprocess import sys import struct import time import zipfile from World import World from Spoiler import Spoiler from Rom import Rom from Patc...
StarcoderdataPython
3261923
"""db/models/ip.py Database Model for the IP item """ import sqlalchemy as sa from sqlalchemy.orm import declarative_base from .target import Target Base = declarative_base() class IP(Base): __tablename__ = 'ips' id = sa.Column(sa.Integer, autoincrement=True, primary_key=True) ip = sa.Column(sa.VARCHAR...
StarcoderdataPython
34469
<gh_stars>100-1000 # The following comments couldn't be translated into the new config version: # # keep only muon-related info here # import FWCore.ParameterSet.Config as cms process = cms.Process("MISO") process.load("Configuration.EventContent.EventContent_cff") # service = MessageLogger { # untracked ...
StarcoderdataPython
62202
import unittest import invoiced import responses class TestTask(unittest.TestCase): def setUp(self): self.client = invoiced.Client('api_key') def test_endpoint(self): task = invoiced.Task(self.client, 123) self.assertEqual('/tasks/123', task.endpoint()) @responses.activate d...
StarcoderdataPython
3382689
# Generated by Django 3.1.2 on 2021-01-28 10:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('elegislative_app', '0013_auto_20210122_1047'), ] operations = [ migrations.AddField( model_name='user', name='is_aro...
StarcoderdataPython
49350
# generated by 'clang2py' # flags '-c -d -l ftd2xx64.dll ftd2xx.h -vvv -o _ftd2xx64.py' # -*- coding: utf-8 -*- # # TARGET arch is: [] # WORD_SIZE is: 4 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 8 # import ctypes # if local wordsize is same as target, keep ctypes pointer function. if ctypes.sizeof(ctypes.c_void_p) =...
StarcoderdataPython
3307143
<gh_stars>10-100 # -------------------------------------------------------- # (c) Copyright 2014 by <NAME>. # Licensed under BSD 3-clause licence. # -------------------------------------------------------- from pymonad.Applicative import * class Monad(Applicative): """ Represents a "context" in which calculations c...
StarcoderdataPython
1776313
from pyne.material import Material as pymat import copy from collections import Counter class Materialflow(pymat): """ Class contains information about burnable material flow. Based on PyNE Material. """ def __init__( self, comp=None, mass=-1.0, den...
StarcoderdataPython
3268551
import math class Cpf(object): """ Etapas: - Primeira: Verificar se o CPF informado contém todos os dígidos nem são repetidos - Segunda: Confirmar se o primeiro dígito do verificador está correto - Terceira: Confirmar se o segundo dígito do verificador está correto - Quarta: Valida...
StarcoderdataPython
3306676
<filename>oslo/data/indexing/cached_indexing.py # coding=utf-8 # Copyright 2021 TUNiB Inc. # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE.apache-2.0 file in the root directory of this source tree. from functools import lru_cache from typ...
StarcoderdataPython
1626345
<gh_stars>0 # -*- coding: utf-8 -*- import scrapy import re import time from zufang.items import ZufangItem class LianjiaSpider(scrapy.Spider): name = 'lianjia' city_name = ['zz', 'bj', 'hz', 'sh', 'sz', 'gz'] allowed_domains = ['%s.lianjia.com/zufang/' % i for i in city_name] start_urls = ['https://z...
StarcoderdataPython
81060
# pylint: skip-file # type: ignore # -*- coding: utf-8 -*- # # tests.analyses.milhdbk217f.models.relay_unit_test.py is part of The RAMSTK # Project # # All rights reserved. # Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com """Test class for the relay module.""" # Thir...
StarcoderdataPython
137169
import os import subprocess import requests from flask import Flask, request app = Flask(__name__) @app.route('/', methods = ['POST']) def run_transform(): payload_url = request.args.get("payload_url") r = requests.get(payload_url, allow_redirects=True) open('payload.json', 'wb').write(r.content) transf...
StarcoderdataPython
4840566
<filename>samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/__init__.py # coding: utf-8 # flake8: noqa """ OpenAPI Extension with dynamic servers This specification shows how to use dynamic servers. # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated...
StarcoderdataPython
1737395
#!/usr/bin/env python from __future__ import division, absolute_import, print_function from future.builtins import super from iris_sdk.models.base_resource import BaseResource from iris_sdk.models.data.portouts import PortOutsData XML_NAME_PORTOUTS = "LNPResponseWrapper" XPATH_PORTOUTS = "/portouts" class PortOuts(...
StarcoderdataPython
31446
<reponame>ZhiruiFeng/CarsMemory #!/usr/bin/env python # aws s3
StarcoderdataPython
3214506
<gh_stars>1-10 # -*- coding: utf-8 -*- """ This is part of WebScout software Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en Docs RU: http://hack4sec.pro/wiki/index.php/WebScout License: MIT Copyright (c) <NAME> <<EMAIL>> Kernel class for modules results """ class WSResult(object): results =...
StarcoderdataPython
3398385
<gh_stars>1-10 #! /usr/bin/env python import setuptools from business_rules import __version__ as version setuptools.setup( name='business-rules-ext', version=version, description='Python DSL for setting up business intelligence rules that can be configured without code', author='<NAME>', author_...
StarcoderdataPython
27736
""" WLS filter: Edge-preserving smoothing based onthe weightd least squares optimization framework, as described in Farbman, Fattal, Lischinski, and Szeliski, "Edge-Preserving Decompositions for Multi-Scale Tone and Detail Manipulation", ACM Transactions on Graphics, 27(3), August 2008. Given an input image IN, we see...
StarcoderdataPython
93352
<reponame>naviocean/imgclsmob """ DABNet for image segmentation, implemented in Gluon. Original paper: 'DABNet: Depth-wise Asymmetric Bottleneck for Real-time Semantic Segmentation,' https://arxiv.org/abs/1907.11357. """ __all__ = ['DABNet', 'dabnet_cityscapes'] import os from mxnet import cpu from mxnet....
StarcoderdataPython
3233188
#!/usr/bin/python3 -u import os import numpy as np import matplotlib as mpl; mpl.use('Agg'); print("plot WITHOUT Xserver"); # this makes it run without Xserver (e.g. on supercomputer) # see http://stackoverflow.com/questions/4931376/generating-matplotlib-graphs-without-a-running-x-server import matplotlib.pyplot as p...
StarcoderdataPython
1799242
<reponame>yyxiao/boardroom #!/usr/bin/env python3.4 # -*- coding: utf-8 -*- """ __author__ = cuizc __mtime__ = 2016-08-09 """ import transaction import logging from sqlalchemy.orm import aliased from ..models.model import SysOrg, SysUser, SysUserOrg, HasPad, SysUserRole from ..common.dateutils import date_now from ..c...
StarcoderdataPython
3314368
# coding=utf-8 from dbget import get_relate, get_parent __author__ = 'GaoJie' dim_relative_map = {} class Relative(object): @staticmethod def get_os(): return get_relate('osName', 'b_base_os', where='osVersion="0"') @staticmethod def get_categorys(): return get_relate('zhName', 'b_ba...
StarcoderdataPython
3383419
<reponame>Wilson194/Angry-tux<gh_stars>0 from angrytux.model.game_objects.missile_states.Collided import Collided from angrytux.model.game_objects.missile_states.MissileState import MissileState from angrytux.model.game_objects.missile_states.OutOfGame import OutOfGame from angrytux.model.game_objects.missile_states.F...
StarcoderdataPython
180672
<filename>csrv/model/actions/gain_a_credit.py<gh_stars>0 """Base actions for the players to take.""" from csrv.model.actions import action from csrv.model import cost from csrv.model import errors from csrv.model import events from csrv.model import game_object from csrv.model import parameters class GainACredit(act...
StarcoderdataPython
3266349
"""A management command to apply mailbox operations.""" import logging from optparse import make_option import os from django.core.management.base import BaseCommand from param_tools import tools as param_tools from modoboa.lib.sysutils import exec_cmd from modoboa.lib.exceptions import InternalError from ...app_se...
StarcoderdataPython
3203366
import common.utils
StarcoderdataPython
57276
# test_files.py import unittest2 as unittest from graphviz.files import File, Source class TestBase(unittest.TestCase): def setUp(self): self.file = File() def test_format(self): with self.assertRaisesRegexp(ValueError, 'format'): self.file.format = 'spam' def test_engine(...
StarcoderdataPython
3280485
import unittest from pymath.wallpaper import wallpaper # todo: failing tests @unittest.skip class MyTestCase(unittest.TestCase): def test_2(self): self.assertEqual(wallpaper(6.3, 4.5, 3.29), "sixteen") def test_3(self): self.assertEqual(wallpaper(7.8, 2.9, 3.29), "sixteen") def test_4(s...
StarcoderdataPython
1686503
import time import unittest.mock from datetime import datetime, timezone from http import HTTPStatus from fastapi.testclient import TestClient from sqlalchemy.orm import Session import mlrun.api.crud import mlrun.api.schemas import mlrun.errors import mlrun.runtimes.constants from mlrun.api.db.sqldb.models import Run...
StarcoderdataPython
1648148
from nknsdk.wallet import Wallet # Create a new wallet wallet = Wallet.new_wallet('pswd') # Get wallet's json string print(wallet.to_json()) # Get wallet's address print(wallet.address) # Load wallet from a wallet json string wallet_from_json = Wallet.load_json_wallet(wallet.to_json(), 'pswd') # Get wallet's json ...
StarcoderdataPython
3289346
from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.template import RequestContext from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.contrib.auth import login as auth_login from django.contrib.auth.models import User fro...
StarcoderdataPython
3337377
import requests import os list_of_tin = ['192.168.1.29', '192.168.1.218', '192.168.1.219'] print('Home Lab Status:') def g_status(tin_list): wrong_code = [] for ip in tin_list: url = 'http://' + ip + '/rest/v1/system/status' get_status_response = requests.get(url, timeout=2) g_status...
StarcoderdataPython
1663296
# -------------- #Importing header files import pandas as pd import numpy as np import matplotlib.pyplot as plt #Code starts here path data = pd.read_csv(path, sep = ',', delimiter = None) loan_status = data['Loan_Status'].value_counts() loan_status.plot(kind = 'bar') plt.show() # -------------- ...
StarcoderdataPython
110976
import pyautogui from time import sleep accept=None f= None r= None c=None l=None lockin=None test=None champ= input("Which champ:") secondary=input("Which secondary:") secondary=secondary.lower() secondary=secondary.strip() champ=champ.lower() champ=champ.strip() ban= input("Which ban:") ba...
StarcoderdataPython
3391090
<filename>NJ_trees_run.py<gh_stars>0 from os import system import multiprocessing def python_run(command): print 'Running: ' + command system(command) print 'Finished with: ' + command run_file = 'terminal_run_clusters_probable.txt' # parse the file txt = open(run_file, 'r') txt_data = txt.readlines() tx...
StarcoderdataPython
122504
# Copyright [2019] [FORTH-ICS] # # 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 writing...
StarcoderdataPython
3224639
<filename>boatsandjoy_api/availability/requests.py from dataclasses import dataclass from datetime import date @dataclass class GetDayAvailabilityRequest: date: date apply_resident_discount: bool @dataclass class GetMonthAvailabilityRequest: month: int year: int
StarcoderdataPython
22517
import re import urllib import numbers from clayful.models import register_models from clayful.requester import request from clayful.exception import ClayfulException class Clayful: base_url = 'https://api.clayful.io' default_headers = { 'Accept-Encoding': 'gzip', 'User-Agent': 'clayful-python', 'Clayfu...
StarcoderdataPython
30373
from django.conf import settings from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, \ PermissionsMixin from django.core.mail import send_mail from django.db import models from django.template.loader import render_to_string from django.utils import timezone from django.utils.translation import...
StarcoderdataPython
1741936
<filename>__main__.py<gh_stars>1-10 # tree --dirsfirst --noreport -I 'Dataset*|wandb*|__pycache__|__init__.py|logs|SampleImages|List.md' > List.md from Data import explore, process, prepare from torch.utils.data import DataLoader from torchvision.utils import save_image, make_grid from torch.utils.tensorboard import...
StarcoderdataPython
4825603
import json import os from django.contrib.auth.decorators import login_required from django.db.models import Q from django.http import JsonResponse from django.http.response import HttpResponse from django.shortcuts import get_object_or_404, redirect, render from django.template.loader import render_to_string from djan...
StarcoderdataPython
3282126
# Copyright 2014 Rackspace # # 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 t...
StarcoderdataPython
1732786
<reponame>milesrout/beatle from collections import ChainMap import contextlib from itertools import chain, count import typednodes as T import cstnodes as E from astpass import DeepAstPass from is_gen import is_gen from utils import (Type, Ast, ApeError, ApeSyntaxError, ApeInternalError, ApeNotImple...
StarcoderdataPython
90727
<gh_stars>0 """ * * Author: <NAME>(coderemite) * Email: <EMAIL> * """ for s in[*open(0)][1:]:a,b=map(int,s.split())print('YNEOS'[a+b<a*b::2]) exec(int(input())*"n,m=map(int,input().split());print('YNEOS'[n+m<n*m::2]);")
StarcoderdataPython
1775110
# Code generated by lark_sdk_gen. DO NOT EDIT. from pylark.lark_request import RawRequestReq, _new_method_option from pylark import lark_type, lark_type_sheet, lark_type_approval import attr import typing import io @attr.s class DeleteDepartmentReq(object): department_id_type: lark_type.DepartmentIDType = attr.i...
StarcoderdataPython
1662238
# -*- coding: utf-8 -*- import unittest import logging as pylogging import utils.logging as logging class UtilsLoggingTests(unittest.TestCase): """Documentatoion coming soon. """ @classmethod def setUpClass(cls): pylogging.disable(pylogging.NOTSET) @classmethod def tearDownClass(cls)...
StarcoderdataPython
1635413
#coding = utf-8 import cv2 import numpy as np import sys if __name__ == '__main__': image_path ="E:/IntelliJ Projects/Thyroid/Thyroid Maven Webapp/out/artifacts/Thyroid_Maven_Webapp_Web_exploded/Thyroid_images/"+sys.argv[1] img = cv2.imread(image_path) image = c...
StarcoderdataPython
1619482
# Copyright (C) 2010, 2011 <NAME> (<EMAIL>) and contributors # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php from git.objects.submodule.base import Submodule from git.objects.submodule.root import RootModule from git.db.interface import Su...
StarcoderdataPython
153458
<filename>renderer.py #!/usr/bin/env python3 import weather import bitcoin import bitcoin2 from wand.color import Color from wand.image import Image, COMPOSITE_OPERATORS from wand.drawing import Drawing import urllib.request def update_img(): bitcoins = bitcoin.get_bitcoin() bitcoingraph = bitcoin2.ge...
StarcoderdataPython
1621257
import numpy as np from scipy.sparse import coo_matrix from scipy.sparse.linalg import norm def prepare_input(y, X, end_time): y0, y1 = y[np.isnan(y[:, 1])], y[~np.isnan(y[:, 1])] x0, x1 = X[np.isnan(y[:, 1])], X[~np.isnan(y[:, 1])] diagonal0, diagonal1 = coo_matrix((y0.shape[0], y0.shape[0])), coo_matr...
StarcoderdataPython
90906
"""Faça um programa que leia nome e média de um aluno, guardando também a situação em um dicionário. No final, mostre o conteúdo da estrutura na tela.""" aluno = {} nome = str(input('Nome: ')) aluno['Nome'] = nome media = float(input(f'Média de {nome}: ')) aluno['Média'] = media if media >= 7: aluno['Situação'] = ...
StarcoderdataPython
142714
<reponame>ayame-q/PersonalSupplyManager<filename>server/supply/migrations/0001_initial.py<gh_stars>0 # Generated by Django 3.1.6 on 2021-02-06 16:55 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import uuid class Migration(migr...
StarcoderdataPython
1723996
""" Utils ===== """ from .logging import getLogger, log_to_file, log_to_console from .map2loop import process_map2loop, build_model from .helper import get_data_axis_aligned_bounding_box, get_data_bounding_box, get_data_bounding_box_map from .helper import get_dip_vector,get_strike_vector, get_vectors, strike_dip_vecto...
StarcoderdataPython
143802
#!/usr/bin/env python3 from contextlib import contextmanager import pandas as pd import numpy as np import random import torch import time import os import argparse from scipy import sparse from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.impute import ...
StarcoderdataPython
3266590
import torch.nn as nn import tensorflow as tf import json import time import sys sys.path.append('.') import src.vanilla as vanilla from src.hardware.precompile import precompile_model from src.hardware.sim_binder import run_csim def run_layer(array_size, layer_type, in_ch, out_ch, kernel_size, input_size, batch_si...
StarcoderdataPython
3231854
""" Neo-RTD theme for Sphinx documentation generator. Based on the color combination of the original sphinx_rtd_theme, but updated with better readability. """ import os __version__ = '1.0' __version_full__ = __version__ def get_html_theme_path(): """Return list of HTML theme paths.""" cur_dir = os.path.a...
StarcoderdataPython
1621088
#! /usr/bin/python3 import json with open('grades.json', 'rb') as f: data = json.load(f) ids = [course['content']['achievementDto']['cpCourseLibDto']['id'] for course in data['resource']] with open('ids.txt', 'w') as ids_list: ids_list.write('\n'.join((str(i) for i in ids)))
StarcoderdataPython
81801
<reponame>domwillcode/home-assistant<filename>homeassistant/components/hp_ilo/__init__.py<gh_stars>1000+ """The HP Integrated Lights-Out (iLO) component."""
StarcoderdataPython
178423
<filename>Day 4 Rock Paper Scissor.py import random rock=''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper=''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissor=''' _______ ---' ____)____ ...
StarcoderdataPython
167975
<gh_stars>0 # -------------- import pandas as pd from sklearn.model_selection import train_test_split #path - Path of file # Code starts here df = pd.read_csv(path) # print(df.head()) X = df.iloc[:,1:-1] y = df['Churn'] # print(X.head()) # print(y.head()) X_train,X_test,y_train,y_test = train_test_split(X,y,test_size...
StarcoderdataPython
3218065
<reponame>daVinciCEB/Basic-Python-Package import unittest from context import core class ExampleTest(unittest.TestCase): """An example test in unittest fashion.""" def setUp(self): pass def test_will_pass(self): self.assertEqual(1, 1) def test_will_not_pass(self): self.assertE...
StarcoderdataPython
3378497
<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright 2017 Ricequant, Inc # # 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...
StarcoderdataPython
1790354
<gh_stars>0 import sys from unittest import skip from django.core.management.commands import test from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_by_path class Command(test.Command): def handle(self, *args, **kwargs): ...
StarcoderdataPython
37658
import importlib import pytest import yaml import appmap._implementation from appmap._implementation.env import Env from appmap._implementation.recording import Recorder def _data_dir(pytestconfig): return pytestconfig.rootpath / 'appmap' / 'test' / 'data' @pytest.fixture(name='data_dir') def fixture_data_dir(py...
StarcoderdataPython
3371868
<reponame>aaguasca/gammapy<gh_stars>0 import astropy.units as u from .core import IRF __all__ = [ "RadMax2D", ] class RadMax2D(IRF): """2D Rad Max table. This is not directly a IRF component but is needed as additional information for point-like IRF components when an energy or field of view de...
StarcoderdataPython
3246924
# -*- coding: utf-8 -*- """ State machine interface. This is a base class for implementing state machines. """ from copy import deepcopy from signalslot import Signal from threading import Event from .asyncexc import AsynchronousException class NotReadyError(Exception): """ Exception raised when an attempt...
StarcoderdataPython
3215851
<filename>test/wasm-js/testcfg.py # Copyright 2018 the V8 project 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 os import re from testrunner.local import testsuite from testrunner.objects import testcase ANY_JS = ".any.js" W...
StarcoderdataPython
3386405
<filename>src/spacel/security/acm.py import logging from tldextract import extract logger = logging.getLogger('spacel.security.acm') class AcmCertificates(object): def __init__(self, clients): self._clients = clients def get_certificate(self, region, hostname): logger.debug('Looking up certi...
StarcoderdataPython
146476
<reponame>alaasalman/aussieshopper from django.conf.urls import url, include from rest_framework import routers from api import views app_name = 'api' router = routers.SimpleRouter() router.register(r'stats', views.StatsViewSet) urlpatterns = [ url(r'bot/handle/', views.HandleChatMessage.as_view(), ...
StarcoderdataPython
3351868
<filename>_exclude/build-README.py import glob, os import sys import urllib import shutil from pathlib import Path def build_lectures_md(lectures_md_file_name): weekly_lectures = [] lectures_path = '../lectures' weekly_lectures = [lecture for lecture in os.listdir(lectures_path) \ if lecture.starts...
StarcoderdataPython
3369434
<filename>summarizer/analysis/plot_user.py import sys, os.path as path sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) import numpy as np import argparse import matplotlib.pyplot as plt import os from summarizer.utils.reader import read_csv import matplotlib as mpl mpl.use('pgf') def...
StarcoderdataPython
3203165
<filename>dls_pmaccontrol/CSstatus.py #!/bin/env dls-python2.6 # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from formCSStatus import Ui_formCSStatus class CSStatusForm(QDialog, Ui_formCSStatus): def __init__(self, parent): QDialog.__init__(self,parent) self.setupUi(sel...
StarcoderdataPython
1755472
<gh_stars>0 from django.shortcuts import render # Create your views here. from django.http import HttpResponse from django.db.models import Count from colleges.models import SignificantMajors, College, Blog def index(request): return render(request, 'index.html', {}) def schools_list(request): colleges = ...
StarcoderdataPython
4807924
import numpy as np import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import losses def create_embeddings_matrix(vectorizer, embeddings_path, embedding_dim=100, mask_zero=True): embeddings_index = {} with open(embeddings_path) as f: for line in f: word, coefs...
StarcoderdataPython