id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1663941
<reponame>jfthuong/pydpf-core """ default_value =============== Autogenerated DPF operator classes. """ from warnings import warn from ansys.dpf.core.dpf_operator import Operator from ansys.dpf.core.inputs import Input, _Inputs from ansys.dpf.core.outputs import Output, _Outputs from ansys.dpf.core.operators.specificat...
StarcoderdataPython
1766011
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-29 22:12 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('transcript', '0013_informationflow'), ] ...
StarcoderdataPython
1757470
<filename>main_app/migrations/0007_auto_20200118_2040.py<gh_stars>100-1000 # Generated by Django 2.2.5 on 2020-01-18 15:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main_app', '0006_remove_consultation_messages'), ] operations = [ migrati...
StarcoderdataPython
32764
""" Converts some lyx files to the latex format. Note: everything in the file is thrown away until a section or the workd "stopskip" is found. This way, all the preamble added by lyx is removed. """ from waflib import Logs from waflib import TaskGen,Task from waflib import Utils from waflib.Configure import conf def ...
StarcoderdataPython
1768687
<reponame>Integrative-Transcriptomics/VIPurPCA from vipurpca import load_data from vipurpca import PCA if __name__ == '__main__': Y, cov_Y, y = load_data.load_studentgrades_dataset() print(y) pca = PCA(Y, cov_Y, 2, compute_jacobian=True) pca.pca_grad() pca.compute_cov_eigenvectors() pca.transfo...
StarcoderdataPython
1653901
<reponame>JunhaLee/HRNet-Human-Pose-Estimation # ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by <NAME> (<EMAIL>) # ------------------------------------------------------------------------------ from __future__ impo...
StarcoderdataPython
3271536
<filename>GenRep/main_autoencoder.py ## Adapted for biggan based on latent-composite code from __future__ import print_function import argparse import os import random import itertools import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torch.optim as optim import torchvision.utils as vutil...
StarcoderdataPython
3213743
with open("p022_names.txt", 'rt', encoding='utf8') as f: my_file = f.read() name_lst = [item.strip(r'"') for item in my_file.split(',')] name_lst = sorted(name_lst) # print(name_lst[:10]) alp_score_dict = dict(zip("ABCDEFGHIJKLMNOPQRSTUVWXYZ", range(1,len("ABCDEFGHIJKLMNOPQRSTUVWXYZ")+1))) # print(alp_score_dict)...
StarcoderdataPython
3265549
<reponame>timtim17/myuw<filename>myuw/dao/__init__.py<gh_stars>0 # Copyright 2022 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 import logging import os from django.conf import settings from uw_sws import DAO as SWS_DAO from userservice.user import ( UserService, get_user, get_original_user...
StarcoderdataPython
3351578
# Copyright 2018 Huawei Technologies Co.,LTD. # # 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...
StarcoderdataPython
3293861
DYN_TYPE = 76 BANNER_TYPE = 11 PLAINTEXT_TYPE = 255
StarcoderdataPython
164253
import numpy as np class RunningScore(object): def __init__(self, n_classes): self.n_classes = n_classes self.confusion_matrix = np.zeros((n_classes, n_classes)) @staticmethod def _fast_hist(label_true, label_pred, n_class): mask = (label_true >= 0) & (label_true < n_class) ...
StarcoderdataPython
1792798
# pylint: disable=redefined-outer-name, unused-argument from __future__ import print_function import functools import os import random from uuid import uuid4 import pytest import slash def test_normal_sorting(test_dir, names): assert get_file_names(load(test_dir)) == names def test_custom_ordering(test_dir, n...
StarcoderdataPython
3238899
<filename>services.py from anthill.framework.utils.urls import reverse, build_absolute_uri from anthill.platform.services import PlainService class Service(PlainService): """Anthill default service.""" async def set_messenger_url(self): path = reverse('messenger') host_url = self.app.registry...
StarcoderdataPython
160157
################################################################################# # The Institute for the Design of Advanced Energy Systems Integrated Platform # Framework (IDAES IP) was produced under the DOE Institute for the # Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021 # by the softwar...
StarcoderdataPython
1600565
<filename>aws_dataclasses/cf_event.py from collections import namedtuple from typing import Dict, List, Optional from dataclasses import InitVar, field, dataclass from aws_dataclasses.base import GenericDataClass, EventClass KVPair = namedtuple("KVPair", ['key', 'value']) def _parse_headers(headers) -> Dict[str, L...
StarcoderdataPython
1739106
from tensorflow import keras import tensorflow.keras.layers as layers LETTERS = list('abcdefghijklmnopqrstuvwxyz') bn_axis = 3 # channels last # based on https://github.com/keras-team/keras-applications/blob/master/keras_applications/resnet50.py def identity_block(input_tensor, kernel_size, filters, stage, block): ...
StarcoderdataPython
1691065
<reponame>skylarjhdownes/yutu import random import discord from discord.ext import commands class Interact: pass def interact_fwrk(name, text, help, aliases=[], images=None, disallow_none=False): @commands.command(name=name, aliases=aliases, help=help) async def cmd(self, ctx: commands.Context, user: d...
StarcoderdataPython
88139
<filename>server/server.py import os from flask import Flask, request, redirect, url_for, jsonify, make_response from werkzeug.utils import secure_filename from flask_cors import CORS, cross_origin import json import sys import imageservice from imageservice import myImage UPLOAD_FOLDER = os.path.abspath("images") ALL...
StarcoderdataPython
118196
<reponame>campbell-ja/MetashapePythonScripts # This script created by <NAME> - 03/2021 """ Set up Working Environment """ # import Metashape library module import Metashape # create a reference to the current project via Document Class doc = Metashape.app.document """ Prompt User to Select Images """ # creat...
StarcoderdataPython
3301366
import cv2 number_imgs = []
StarcoderdataPython
172966
<filename>scripts/runner.settings.py # Copyright 2020 <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 re...
StarcoderdataPython
4818568
""" The unit test module for AutoScheduler dialect. """ # pylint:disable=missing-docstring, redefined-outer-name, invalid-name # pylint:disable=unused-argument, unused-import, wrong-import-position, ungrouped-imports import argparse import os import re import tempfile import mock import pytest from moto import mock_dy...
StarcoderdataPython
157349
############################################################################### # The MIT License (MIT) # # Copyright (c) 2017 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without...
StarcoderdataPython
3287292
# Copyright 2017 The Oppia Authors. 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 ...
StarcoderdataPython
3218075
<filename>tests/test_build_html5.py """ test_build_html5 ~~~~~~~~~~~~~~~~ Test the HTML5 writer and check output against XPath. This code is digest to reduce test running time. Complete test code is here: https://github.com/sphinx-doc/sphinx/pull/2805/files :copyright: Copyright 2007-201...
StarcoderdataPython
1666869
<filename>IoT_Web/iotweb/views/token_view.py from django.shortcuts import redirect from django.http import HttpResponse from django.template import loader from http.server import HTTPStatus from .User import User import iotweb.views.urls_and_messages as UM import requests import json def tokens(request, shdw_id): ...
StarcoderdataPython
3370606
<filename>UT330/UT330.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Provides a cross-platform Python interface for the UNI-T 330A/B/C temperature, humidity, and pressure data loggers. This code controls a UNI-T 330 A/B/C device via a cross-platform Python script. The device accepts commands and provides respons...
StarcoderdataPython
3307365
import time import requests import os import datetime as dt # import telegram BOT_TOKEN = os.environ.get('BOT_TOKEN') # checking status every 12 hours SLEEP_INTERVAL = 43200 FINANCE_URL = "http://resources.finance.ua/ua/public/currency-cash.json" def send_telegram(dollar): # chat = "-383060434" # chat_test =...
StarcoderdataPython
3351900
<filename>src/autogluon_contrib_nlp/data/tokenizers/huggingface.py __all__ = ['HuggingFaceTokenizer', 'HuggingFaceBPETokenizer', 'HuggingFaceWordPieceTokenizer', 'HuggingFaceByteBPETokenizer'] import os import json from pkg_resources import parse_version from typing import Optional, Union, List, Tuple from ...
StarcoderdataPython
152028
<reponame>Gabriel-p/pyABC from typing import Union import numpy as np import pandas as pd import scipy.stats as stats from ..parameters import Parameter from .base import DiscreteTransition class DiscreteRandomWalkTransition(DiscreteTransition): """ This transition is based on a discrete random walk. This m...
StarcoderdataPython
162206
<reponame>lordmallam/aether<gh_stars>0 # Copyright (C) 2018 by eHealth Africa : http://www.eHealthAfrica.org # # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
StarcoderdataPython
1632102
<gh_stars>10-100 name = input() print("Nice to meet you " + name + ".")
StarcoderdataPython
1714003
import pygame import random from pygame import QUIT, KEYDOWN, KEYUP, K_UP, K_DOWN, K_LEFT, K_RIGHT, K_SPACE pygame.init() tela = pygame.display.set_mode((800, 600), 0, 32) imagem = pygame.image.load("images/gato.png").convert_alpha() angulo = 50 while True: #Calcular regras gato_rot = pygame.transform.rotate(i...
StarcoderdataPython
3322725
<filename>multiagent/football/gate.py import numpy as np from multiagent.core import Entity class Gate(Entity): def __init__(self): super(Gate, self).__init__() self.width = 1 self.height = .1 w_half = self.width / 2 h_half = self.height / 2 self.v = [[-w_half, -h_h...
StarcoderdataPython
1787740
<reponame>oicr-gsi/dashi from collections import defaultdict import dash_html_components as html from dash.dependencies import Input, Output, State from ..dash_id import init_ids from ..utility.plot_builder import * from ..utility.table_builder import table_tabs_single_lane, cutoff_table_data_ius from ..utility impor...
StarcoderdataPython
3204822
# -*- coding: utf-8 -*- """ Created on Mon May 30 17:29:28 2016 @author: Michael How does gaussian white noise behave when it is input to a running average filter, i.e. a perfect low pass filter (except for discretization errors)? I assume ergodicity, i.e. marginal probability densities can be estimated by averagin...
StarcoderdataPython
118923
import numpy as np import termcolor import cnc_structs def string_array_to_char_array(m): c = np.array([x.decode('ascii')[0] if len(x) > 0 else ' ' for x in m.flat]).reshape(m.shape) return '\n'.join(map(''.join, c)) def staticmap_array(map: cnc_structs.CNCMapDataStruct) -> np.ndarray: tile_names = np....
StarcoderdataPython
1600041
""" Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. Example 1: Input: nums = [2,2,3,2] Output: 3 Example 2: Input: nums = [0,1,0,1,0,1,99] Output: 99 Constraints: 1 <= nums.length <= 3 * 104 -231 <= nums[i] <= 231 ...
StarcoderdataPython
3395225
<gh_stars>0 # -*-coding:Utf-8 -* # Copyright (c) 2014 <NAME> # 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 notice, this # ...
StarcoderdataPython
1732325
""" 1字符串:不可变 2.测试字符串拼接操作的效率 """ import time def ba_str(): str1 = 'hello, world!' # 通过len函数计算字符串的长度 print(len(str1)) # 13 # 获得字符串首字母大写的拷贝 print(str1.capitalize()) # Hello, world! # 获得字符串变大写后的拷贝 print(str1.upper()) # HELLO, WORLD! # 从字符串中查找子串所在位置 print(str1.find('or')) # ...
StarcoderdataPython
24285
import numpy from kapteyn import maputils from matplotlib.pyplot import show, figure import csv # Read some poitions from file in Comma Separated Values format # Some initializations blankcol = "#334455" # Represent undefined values by this color epsilon = 0.0000000001 figsize = (9,7) ...
StarcoderdataPython
1655545
from django.shortcuts import render, get_object_or_404, redirect from django.http import HttpResponseRedirect from django.contrib import messages from .models import Comments # Create your views here. def delete_comment(request, id): """function baraye pak kardane comment""" comment = get_object_or_404(Comme...
StarcoderdataPython
3296396
from .face import FaceDetector from .body import BodyDetector, Pose
StarcoderdataPython
114937
<filename>Content/Scripts/ObjectLoader.py import os.path import json,codecs import unreal_engine as ue from unreal_engine import FVector,FRotator from unreal_engine.classes import Actor, Pawn, Character, ProjectileMovementComponent, PawnSensingComponent, StaticMesh from unreal_engine.classes import StaticMeshComponent...
StarcoderdataPython
199957
# # @lc app=leetcode id=977 lang=python3 # # [977] Squares of a Sorted Array # # https://leetcode.com/problems/squares-of-a-sorted-array/description/ # # algorithms # Easy (72.86%) # Total Accepted: 56.2K # Total Submissions: 77.7K # Testcase Example: '[-4,-1,0,3,10]' # # Given an array of integers A s...
StarcoderdataPython
4805848
# -*- coding: utf-8 -*- import sys import os.path import math import nltk from nltk.corpus import PlaintextCorpusReader # sys.argv.append('./gold/pku_training_words.utf8') # sys.argv.append('./training/pku_training.utf8') # sys.argv.append('./testing/pku_test.utf8') assert len(sys.argv) == 4 with open(sys.argv[1], '...
StarcoderdataPython
1713629
from time import sleep i = int(input('inicio: ')) f = int(input('Fim: ')) p = int(input('Passo: ')) for i in range(i,f+1,p): sleep(1) print(i)
StarcoderdataPython
3231260
# coding: utf-8 STATS_RESOURCE_MAPPING = { "stats": { "resource": "stat/v1/data", "docs": "https://yandex.ru/dev/metrika/doc/api2/api_v1/intro-docpage/", "params": [ "direct_client_logins=<string,_string,...>", "ids=<int,int,...>", "metrics=<string>", ...
StarcoderdataPython
3311200
<reponame>gabriel-samfira/nova<filename>nova/tests/unit/api/openstack/compute/test_microversions.py<gh_stars>0 # Copyright 2014 IBM Corp. # # 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...
StarcoderdataPython
4839185
<reponame>aljer/ptf """ Remote platform This platform uses physical ethernet interfaces. """ # Update this dictionary to suit your environment. remote_port_map = { (0, 0): "eth0", (0, 1): "eth1", (0, 2): "eth2", (0, 3): "eth3", (0, 4): "eth4", (0, 5): "eth5", (0, 6): "eth6", (0, 7): "e...
StarcoderdataPython
1633420
from .import_data import import_data
StarcoderdataPython
3253761
<reponame>zmxdream/Paddle # Copyright (c) 2021 PaddlePaddle Authors. 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 ...
StarcoderdataPython
1680092
<filename>tests/benchmark/test_benchmark_engine.py # This file is part of the Reproducible Open Benchmarks for Data Analysis # Platform (ROB). # # Copyright (C) 2019 NYU. # # ROB is free software; you can redistribute it and/or modify it under the # terms of the MIT License; see LICENSE file for more details. """Test ...
StarcoderdataPython
3207926
class ValidationException(Exception): pass def guard_alphanumeric(string: str, message: str): if not string.isalnum(): raise ValidationException(message)
StarcoderdataPython
3318899
'''图片文字识别示例''' import re from urllib.parse import urljoin from renderer.utils import GeneralOcr, retry_get url = 'http://www.snqindu.gov.cn/html/zwgk/xxgkml/xzzf/xzcf/202006/44820.html' resp = retry_get(url) string = resp.content.decode('utf-8') imgs = re.findall(r'''src=['"](/uploadfile\S+(jpg|png))['"]''', string)...
StarcoderdataPython
1744667
<gh_stars>0 ############################################ #当前数据集的标注存放在txt文件,并且与同名图片成对存在同一个文件夹下 #按照一个格式提取相应的标注信息 #图片存放的绝对路径 标注1 类别2 标注2 类别2 ... #提取出的信息放到train, val, test ############################################## import os from os import getcwd import glob from convert_bbox_for_anno_extraction import conve...
StarcoderdataPython
4806933
<reponame>dolbyio-samples/dolbyio-rest-apis-client-python """ dolbyio_rest_apis.communications.authentication ~~~~~~~~~~~~~~~ This module contains the functions to work with the authentication API. """ from deprecated import deprecated from dolbyio_rest_apis.core.helpers import add_if_not_none from dolbyio_rest_apis....
StarcoderdataPython
1610337
<gh_stars>0 from importNormativeTypes import * ##################################################################################################################################################################################################### # # # Import Nfv Ty...
StarcoderdataPython
55130
<filename>6 programs work/logarithm.py import math def main(): def logList(numList): for i in range(len(numList)): if numList[i] > 0: numList[i] = math.log(numList[i]) else: numList[i] = None return numList numList = ...
StarcoderdataPython
3357583
cfg = dict( model_type='STDCNet813', n_cats=19, num_aux_heads=2, lr_start=1e-2, weight_decay=5e-4, warmup_iters=1000, max_iter=80000, dataset='CityScapes', im_root='./datasets/cityscapes', train_im_anns='./datasets/cityscapes/train.txt', val_im_anns='./datasets/cityscapes/va...
StarcoderdataPython
66415
<filename>examples/decoupledibpm/cylinder2dRe550_GPU/scripts/plot_drag_coefficient_compare_ibpm.py """Plot the history of the drag coefficient. Compare with the numerical results using the IBPM of PetIBM. Compare with the numerical results reported in Koumoutsakos & Leonard (1995). _References:_ * <NAME>., & <NAME>....
StarcoderdataPython
105152
""" Aim: Given an undirected graph and an integer M. The task is to determine if the graph can be colored with at most M colors such that no two adjacent vertices of the graph are colored with the same color. Intuition: We consider all the different combinations of the colors for the given graph...
StarcoderdataPython
191604
# Generated by Django 2.2.9 on 2020-02-07 11:36 from django.db import migrations, models import django.db.models.deletion import wagtail.core.fields class Migration(migrations.Migration): initial = True dependencies = [ ('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'), ]...
StarcoderdataPython
3240253
import logging import numpy as np import rasterio from pesto.ws.core.pesto_feature import PestoFeature from pesto.ws.features.converter.image.bands import FullBand, Band log = logging.getLogger(__name__) # TODO: Classe WIP (les méthodes expérimentales sont privées) # Potentiellement: Revoir le rationnel / faire un ...
StarcoderdataPython
33957
<gh_stars>0 from django.shortcuts import render,redirect from django.views.generic import View from django.contrib.auth.models import User from .forms import LoginUser,RegisterUser from django.http import HttpResponse,Http404 from django.contrib.auth import authenticate,login,logout class UserLogin(View): form_cla...
StarcoderdataPython
1766575
<filename>useraccount/migrations/0001_initial.py # Generated by Django 4.0.3 on 2022-03-06 09:36 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
1619969
import cv2 as cv import numpy as np import utilities def empty(a): pass cv.namedWindow("Trackbars") cv.resizeWindow("Trackbars", 640, 240) cv.createTrackbar("Hue Min", "Trackbars", 55, 179,empty) cv.createTrackbar("Hue Max", "Trackbars", 155, 179,empty) cv.createTrackbar("Sat Min", "Trackbars", 21, 255,empty) cv....
StarcoderdataPython
163159
# ====================================================================== # Air Duct Spelunking # Advent of Code 2016 Day 24 -- <NAME> -- https://adventofcode.com # # Python implementation by Dr. <NAME> III # ====================================================================== # ====================================...
StarcoderdataPython
1770731
<reponame>MiaRatkovic/LAMA """ LAMA produces lots of data. Sometimes we can get rid of much of it afterwards. This script removes folders specified in a config file. This is a work in progress example yaml config. ------------------- This will delete all folders named 'resolution_images'. And will delete all conten...
StarcoderdataPython
178053
<filename>colassigner/core.py<gh_stars>0 from .constants import PREFIX_SEP from .meta_base import ColMeta from .util import camel_to_snake class ColAccessor(metaclass=ColMeta): """describe and access raw columns useful for - getting column names from static analysis - documenting types - dry desc...
StarcoderdataPython
142438
import os from celery.result import AsyncResult from fastapi import APIRouter, Depends, Request from fastapi.responses import FileResponse, JSONResponse from services.database.user_database import UserDatabase from services.pandi import Pandi from services.schemas import User from tasks import fetch_for_accounting, fe...
StarcoderdataPython
190953
<filename>pte_module.py import pandas as pd def main(): list_effectiveness = import_effectiveness() list_types = get_types(list_effectiveness) li = find_n_way_double(list_effectiveness, list_types, 16) for row in li: print(row) print(len(li)) def import_effectiveness(): path = 'effec...
StarcoderdataPython
1705235
from advanced_reports.defaults import Action class BackOfficeAction(Action): form_template = 'advanced_reports/backoffice/contrib/advanced-reports/bootstrap-modal-form.html' def action(*args, **kwargs): return BackOfficeAction(*args, **kwargs)
StarcoderdataPython
3373574
<filename>satchmo/apps/satchmo_store/accounts/urls.py """ URLConf for Django user registration. Recommended usage is to use a call to ``include()`` in your project's root URLConf to include this URLConf for any URL beginning with '/accounts/'. """ from django.conf.urls import patterns from satchmo_store.accounts.vie...
StarcoderdataPython
74646
############################################### # ZPEED: Z' Exclusions from Experimental Data # ############################################### # By <NAME> and <NAME>, 2019 from __future__ import division import numpy as np import scipy.integrate as integrate from chi2_CLs import get_likelihood from ATLAS_13TeV_calib...
StarcoderdataPython
16122
<gh_stars>1-10 from pathlib import Path import pandas from muller.dataio import import_tables from loguru import logger DATA_FOLDER = Path(__file__).parent.parent / "data" def test_filter_empty_trajectories(): input_column_0 = ['genotype-1', 'genotype-2', 'genotype-3', 'genotype-4', 'genotype-5', 'genotype-6'] inp...
StarcoderdataPython
4837333
<reponame>h4ck3rm1k3/scrapy<gh_stars>10-100 """ This modules implements the CrawlSpider which is the recommended spider to use for scraping typical web sites that requires crawling pages. See documentation in docs/topics/spiders.rst """ import copy from scrapy.http import Request, HtmlResponse from scrapy.utils.spid...
StarcoderdataPython
3240449
from django.db import models from django.contrib.auth.models import User from django.urls import reverse class Post(models.Model): created_at = models.DateTimeField(auto_now_add=True) text = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, null=True, default=None) def __str...
StarcoderdataPython
1616924
<filename>DataUse/migrations/0004_datapull_author_datapull_detail_datapull_keyword_datapull_title.py<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-01-17 18:54 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migr...
StarcoderdataPython
1795680
<reponame>gsi-luis/djangolearning import json from rest_framework import serializers from django_elasticsearch_dsl_drf.serializers import DocumentSerializer from learning_search_indexes.documents.tag import TagDocument class TagDocumentSerializer(DocumentSerializer): """Serializer for the Book document.""" c...
StarcoderdataPython
1672893
from hierarc.LensPosterior.ddt_kin_constraints import DdtKinConstraints from lenstronomy.Analysis.kinematics_api import KinematicsAPI from hierarc.Likelihood.hierarchy_likelihood import LensLikelihood from lenstronomy.Cosmo.lens_cosmo import LensCosmo import numpy as np import numpy.testing as npt import pytest class...
StarcoderdataPython
1695451
def prepare_scorecounter(scorenumber): """ :param scorenumber: ScoreNumber :return: [PIL.Image] """ img = [] for image in scorenumber.score_images: image.change_size(0.87, 0.87) img.append(image.img) return img
StarcoderdataPython
115257
# board/models.py from django.contrib.auth.models import User from django.db import models class Article(models.Model): title = models.CharField(max_length=120, null=False) author = models.ForeignKey(User, on_delete=models.CASCADE) content = models.TextField(null=False) created_at = models.DateTimeFie...
StarcoderdataPython
178840
#Faça um programa que leia um número inteiro e diga #se ele é ou não um número primo tot = 0 num = int(input("digite um número inteiro: ")) for c in range(1, num + 1): if num % c == 0: print('\033[33m', end='') tot += 1 else: print('\033[31m', end='') print(f'{c} ', end='') print(f'\...
StarcoderdataPython
196705
<filename>cron/__init__.py import schedule import settings from .poll_pull_requests import poll_pull_requests as poll_pull_requests from .restart_homepage import restart_homepage as restart_homepage def schedule_jobs(): schedule.every(settings.PULL_REQUEST_POLLING_INTERVAL_SECONDS).seconds.do(poll_pull_requests) ...
StarcoderdataPython
22680
<gh_stars>1-10 import random import database from fastapi import FastAPI, Request from fastapi.middleware.cors import CORSMiddleware import uvicorn # Instantiate FastAPI app = FastAPI() # Whitelist origins app.add_middleware( CORSMiddleware, allow_origins = ["*"], allow_credentials = True, allow_met...
StarcoderdataPython
3238420
<filename>tests/unit/utils/test_permissions.py """ This test will use the default permissions found in flaskbb.utils.populate """ from flaskbb.utils.permissions import * def test_moderator_permissions_in_forum( forum, moderator_user, topic, topic_moderator): """Test the moderator permissions in a ...
StarcoderdataPython
109656
<reponame>matham/kivy-trio import trio import random from kivy.app import App from kivy.lang import Builder from kivy.properties import StringProperty from kivy_trio.to_kivy import async_run_in_kivy, EventLoopStoppedError from kivy_trio.context import kivy_trio_context_manager kv = ''' Label: text: 'trio sent: {...
StarcoderdataPython
80532
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 25 10:44:24 2017 @author: wroscoe """ import time from threading import Thread import socket from donkeycar.parts.controller import JoystickController, PS3JoystickController, PS3Joystick class Vehicle(): def __init__(self, mem=None): ...
StarcoderdataPython
3229405
import os import sentry_sdk from dotenv import load_dotenv from django.contrib.messages import constants as messages from sentry_sdk.integrations.django import DjangoIntegration # Environment variables load_dotenv() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = os.path.dirname(os.path.di...
StarcoderdataPython
39984
import numpy as np import pydensecrf.densecrf as dcrf from pydensecrf.utils import compute_unary, create_pairwise_bilateral, create_pairwise_gaussian, unary_from_softmax def dense_crf(img, prob): ''' input: img: numpy array of shape (num of channels, height, width) prob: numpy array of shape (9, hei...
StarcoderdataPython
3292841
<filename>contabilidad/contabilidad/celery.py from celery import Celery import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'contabilidad.contabilidad.settings') app = Celery('contabilidad') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() @app.on_after_configure.con...
StarcoderdataPython
1678721
<reponame>serglit72/Python_exercises<gh_stars>0 thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } for x, y in thisdict.items(): print(x, y) print(type(x),type(y))
StarcoderdataPython
1784257
<filename>asyncserial/async_serial_wrapper.py<gh_stars>1-10 # :Filename: # async_serial_wrapper.py # :Authors: # <NAME> <<EMAIL>> # :License: # Apache 2.0 import asyncio import serial from . import AbstractAsyncWrapper class Serial(AbstractAsyncWrapper): """ asyncserial is a simple w...
StarcoderdataPython
3231335
<filename>03 - Types/3.2 - InbuiltTypes-ListsTuples/28-named-tuple.py # HEAD # DataType - Named Tuples # DESCRIPTION # Working with Named Tuples # RESOURCES # # https://docs.python.org/2/library/collections.html#collections.namedtuple # https://stackoverflow.com/questions/39345995/how-does-python-return-multiple-value...
StarcoderdataPython
1646640
#!/usr/bin/env python # md5: dd33245d9893bd42b01276a1b0a5b1cf # coding: utf-8 from tmilib import * from h2o_utils import * import h2o h2o.init() import traceback #print len(sdir_glob('*mtries_*_sample_rate_*')) #classifier = load_h2o_model(sdir_path('binclassifier_catfeatures_gradientboost_v3.h2o')) #print clas...
StarcoderdataPython
1642838
from argparse import ArgumentParser from glob import glob from importlib import import_module import numpy as np import tensorflow as tf from common import load_labels, load_pickle_file def run_prediction(args): batch_size = args.batch_size model_class = import_module("models.{}".format(args.model)).Model(...
StarcoderdataPython
3230256
<reponame>MilesWJ/Jokey<gh_stars>0 from datetime import datetime import discord from discord.ext import commands, tasks from discord_slash import SlashCommand, SlashContext from discord_slash.utils.manage_commands import create_option, create_choice from json import loads from itertools import cycle from random import ...
StarcoderdataPython
99005
<filename>BOJ/13000~13999/13800~13899/13871.py N, C, S, *l = map(int, open(0).read().split()) c = 0 S -= 1 ans = 0 for i in l: ans += c == S c = (c+i+N)%N ans += c == S print(ans)
StarcoderdataPython