id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5141357
import healpy as hp import numpy as np def iqu2teb(IQU, nside, lmax=None): alms = hp.map2alm(IQU, lmax=lmax, pol=True) return hp.alm2map(alms, nside=nside, lmax=lmax, pol=False) def teb2iqu(TEB, nside, lmax=None): alms = hp.map2alm(TEB, lmax=lmax, pol=False) return hp.alm2map(alms, nside=nside, lmax=...
StarcoderdataPython
1819105
<gh_stars>0 from inspera.reader import InsperaReader
StarcoderdataPython
3227994
<reponame>lunabox/leetcodepy<gh_stars>0 #coding:utf8 ''' Created on 2017年3月27日 @author: wanlipeng ''' from problems.listnode import ListNode class Solution(object): def reverseList(self, head): if head is None: return None newHead = ListNode(0) newHead.next = head curN...
StarcoderdataPython
1970143
# -*- coding: utf-8 -*- """ eve-demo-client ~~~~~~~~~~~~~~~ Simple and quickly hacked togheter, this script is used to reset the eve-demo API to its initial state. It will use standard API calls to: 1) delete all items in the 'people' and 'works' collections 2) post multiple items in ...
StarcoderdataPython
3478114
"""Test Cases for HexitecAdapter, Hexitec in hexitec.HexitecDAQ, hexitec.Hexitec. <NAME>, STFC Detector Systems Software Group """ from hexitec.adapter import HexitecAdapter, Hexitec, HexitecDetectorDefaults from odin.adapters.parameter_tree import ParameterTreeError import unittest import pytest import ti...
StarcoderdataPython
6468995
<filename>package/tests/test_ami_management/test_operations/test_delete_operation.py from unittest import TestCase from botocore.exceptions import ClientError from mock import Mock, MagicMock, call from cloudshell.cp.aws.domain.ami_management.operations.delete_operation import DeleteAMIOperation class TestDeleteOpe...
StarcoderdataPython
150663
<reponame>avi-pal/al-go-rithms<gh_stars>1000+ """ AAn isogram is a word that has no repeating letters, consecutive or non-consecutive. For example "something" and "brother" are isograms, where as "nothing" and "sister" are not. Below method compares the length of the string with the length (or size) of the set of t...
StarcoderdataPython
3457531
def aaa(): pass def bbb(): pass <caret>
StarcoderdataPython
3340327
import json import unittest from fleece import authpolicy class AuthpolicyTests(unittest.TestCase): """Tests for :class: `fleece.authpolicy.AuthPolicy`.""" def setUp(self): self.aws_account_id = "000000000000" self.resource_base_path = ("arn:aws:execute-api:*:{}:myapi/" "mystage").format( ...
StarcoderdataPython
168900
import os import json try: pyWrkspLoc = os.environ["PYWRKSP"] except KeyError: pyWrkspLoc = os.environ["HOME"] + input('Since you do not have the PYWRSKP env var ' '\nPlease enter the pwd for the pyWrskp repo not including the ' ...
StarcoderdataPython
6493960
import re import nltk import underthesea class DataUtils: def __init__(self, lang='vi'): self.lang = lang self.control = underthesea pass def nomalize_document(self, document, pattern=" +", repl=" ", reverse=False): return re.sub(pattern, repl, document.strip()) ...
StarcoderdataPython
3311844
# # Copyright (c) 2016, 2018, Oracle and/or its affiliates. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are # permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this lis...
StarcoderdataPython
3367731
<reponame>topteulen/timely-beliefs """Function store for computing knowledge horizons given a certain event start. When passed an event_start = None, these functions return bounds on the knowledge horizon, i.e. a duration window in which the knowledge horizon must lie (e.g. between 0 and 2 days before the event start)....
StarcoderdataPython
8028927
from django.contrib import admin from voc.models import lesson, vocabulary, history, record, kkdata class kkdataAdmin(admin.ModelAdmin): list_display = ('word', 'kk') class lessonAdmin(admin.ModelAdmin): list_display = ('name', 'quantity') class vocabularyAdmin(admin.ModelAdmin): list_display = ('number'...
StarcoderdataPython
3330162
<filename>bot/reviewbot/tools/pyflakes.py """Review Bot tool to run pyflakes.""" from __future__ import unicode_literals import re from reviewbot.config import config from reviewbot.tools.base import BaseTool from reviewbot.utils.process import execute class PyflakesTool(BaseTool): """Review Bot tool to run py...
StarcoderdataPython
3511818
<gh_stars>0 # Copyright 2021 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 applicable law ...
StarcoderdataPython
8089053
<filename>database/gui.py<gh_stars>0 import numpy as np import pandas as pd from PyQt5 import QtWidgets, QtCore def fill_table(df, table, max_rows=50): # TODO: threading # read indices of currently selected rows selected_indexes = table.selectedIndexes() selected_rows = [] for item in selected_in...
StarcoderdataPython
8114584
import pandas as pd import numpy as np import PyPDF2 import textract import re from nltk.tokenize import word_tokenize from nltk.corpus import stopwords #Open the PDF File using a File Object by Parsing filename ='JavaBasics-notes.pdf' pdfFileObj = open(filename,'rb') pdfReader = PyPDF2.PdfFileReader(p...
StarcoderdataPython
6561039
# Copyright The PyTorch Lightning team. # # 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 i...
StarcoderdataPython
3432790
<filename>awx/main/utils/handlers.py # Copyright (c) 2017 Ansible by Red Hat # All Rights Reserved. # Python import logging import os.path # Django from django.conf import settings class RSysLogHandler(logging.handlers.SysLogHandler): append_nul = False def _connect_unixsocket(self, address): supe...
StarcoderdataPython
8191834
<gh_stars>1-10 import numpy as np import quinoa as qu import matplotlib.pyplot as plt import GPy as gpy from scipy import linalg #np.random.seed(31051985) X = np.random.normal(scale = 1, size = (100,1)) Y = np.sin(X) + 0.01 * np.random.normal(size = (100,1)) #kern = qu.RBF(1, 1, 1) ker = gpy.kern.RBF(1, 1, 1) kern ...
StarcoderdataPython
9707707
# test__sqlitedu.py # Copyright 2019 <NAME> # Licence: See LICENCE (BSD licence) """_sqlitedu _database tests""" import unittest import os try: import sqlite3 except ImportError: # Not ModuleNotFoundError for Pythons earlier than 3.6 sqlite3 = None try: import apsw except ImportError: # Not ModuleNotFo...
StarcoderdataPython
5069352
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains # certain rights in this software. from .parameter import AnnotatedValue, ParamType from jaqalpaq import JaqalError class Constant(AnnotatedValue): ...
StarcoderdataPython
1621148
""" pygame-menu https://github.com/ppizarror/pygame-menu EXAMPLE - CALCULATOR Simple calculator app. """ __all__ = ['main'] import pygame import pygame_menu from pygame_menu.examples import create_example_window from typing import Union, List class CalculatorApp(object): """ Simple calculator app. """...
StarcoderdataPython
4882030
<reponame>imranslabninjas/python-cook-book-Imranslab-Edition import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2, 89] find_lar = heapq.nlargest(1, nums) # how many print(find_lar) # smallest numbers at lest 5 find_sml = heapq.nsmallest(5, nums) print(find_sml)
StarcoderdataPython
3403436
import torch import numpy as np from torch.utils.data import TensorDataset, DataLoader, SequentialSampler from keras.preprocessing.sequence import pad_sequences from pytorch_pretrained_bert import BertTokenizer from Downloader import downloader import sbnltk_default import zipfile import os class bert_multilingual_ca...
StarcoderdataPython
174610
"""Cutting plane solution algorithm for the lower-level bilevel MILP or LP. Includes a LLCuttingPLane class which applies the cutting plane solution method given a protection vector. Returns the objective value and attack vector obtained from the lower-level bilevel maximization. The class can be used to model either...
StarcoderdataPython
11274012
from django.urls import path from . import views urlpatterns = [ path('', views.getRoutes, name="routes"), path('needs/', views.getNeeds, name="needs"), path('needs/<str:pk>', views.getNeed, name="need"), ]
StarcoderdataPython
395857
<filename>kicker/control_human_automatic_strategy.py import math from kicker.CONST_BALL import Coordinate from kicker.CONST_KICKER import COURT_HEIGHT from kicker.CONST_GAME_FIGURES import FIGURE_FOOT_HEIGHT class HumanStrategy: def __init__(self, kicker): self.kicker = kicker def next_move(self): ...
StarcoderdataPython
9681968
<filename>wagtailautocomplete/urls/admin.py from django.urls import path try: from wagtail.admin.auth import require_admin_access except ImportError: from wagtail.admin.decorators import require_admin_access from wagtailautocomplete.views import create, objects, search urlpatterns = [ path('create/', requ...
StarcoderdataPython
6621389
<gh_stars>1-10 #!/usr/bin/env python3 """ List all projects registered in <CWL_ICA_REPO_PATH>/config/projects.yaml """ from classes.command import Command from utils.logging import get_logger import pandas as pd from utils.repo import get_tenant_yaml_path, read_yaml, get_project_yaml_path import os import sys from ut...
StarcoderdataPython
6523215
import numpy as np import numpy.linalg as la import torch import torch.nn.functional as F import torchvision import json import time from matplotlib import pyplot as plt #from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm, trange from lietorch import SE3, LieGroupParameter from scipy.spatial.transf...
StarcoderdataPython
3437726
<gh_stars>0 # coding: utf-8 """ MasterMind Service Manager No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 1.0.0 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ from _...
StarcoderdataPython
243883
from os import path import re import xmltodict HERE = path.dirname(path.abspath(__file__)) class CiqualDatasource(): def generate(self): print('- Generating Ciqual data... ', end='', flush=True) # Load data print('- Loading files... ', end='', flush=True) data_raw = CiqualDatas...
StarcoderdataPython
8186353
# TODO: Write a function that loads a checkpoint and rebuilds the model import numpy as np import torch from torch import nn from torch import optim import torch.nn.functional as F from torchvision import datasets, transforms, models import argparse import json from PIL import Image parser = argparse.ArgumentParser() ...
StarcoderdataPython
5188632
<filename>test_commit.py #!/usr/bin/env python print ("Hello World!") print ("change to this file")
StarcoderdataPython
3346208
<reponame>peterezzo/splunk-pwn-app import splunk.entity as entity import splunk.auth, splunk.search import getpass def huntPasswords(sessionKey): entities = entity.getEntities( ['admin','passwords'],owner="nobody", namespace="-",sessionKey=sessionKey) return entities def getSessionKeyFromCreds(): ...
StarcoderdataPython
3218047
<filename>chemception/models/compound.py from rdkit import Chem import cv2 import os import numpy as np import os.path from rdkit import Chem from rdkit.Chem import AllChem class Compound: extension = 'png' #compound identifier in the dataset id="" #compound SMILE _SMILE="" #mutagen mutagen=False #rdk model ...
StarcoderdataPython
1671692
from PIL import ImageGrab import numpy as np class GetDisplay: def __init__(self): self.img = np.zeros([1, 1, 3]) pass def grabDisplay(self): self.img = ImageGrab.grab() pass def img(self): return self.img def getSize(self): self.grabDisplay() ...
StarcoderdataPython
1775407
<reponame>themattrix/discord-caravan """Discord Caravan Bot Usage: caravan_bot --gyms=JSON [--server-filter=REGEX] [--channel-filter=REGEX] caravan_bot (-h | --help) caravan_bot --version Options: -h --help Show this screen. --version Show version. --gyms=JSON ...
StarcoderdataPython
9653517
# -*- coding: utf-8 -*- # This file is part of Viper - https://github.com/viper-framework/viper # See the file 'LICENSE' for copying permission. import os import time import shutil from os.path import expanduser from viper.common.abstracts import Command from viper.common.colors import bold from viper.core.database i...
StarcoderdataPython
3524070
from feincms.module.page.models import Page from feincms.content.raw.models import RawContent from feincms_bounds.models import Template Page.register_templates( Template( key='internalpage', title='Internal Page', path='pages/internal.html', regions=( ('main', 'Main C...
StarcoderdataPython
3219959
from build.management.commands.update_alignments import Command as UpdateAlignments class Command(UpdateAlignments): pass
StarcoderdataPython
1861053
<gh_stars>0 import logging import uuid from pathlib import Path from datetime import datetime from queue import Queue from threading import Event import sounddevice as sd import soundfile as sf import sqlite_utils as su import numpy as np from .settings import settings logger = logging.getLogger('panauricon.recor...
StarcoderdataPython
8033038
from .data_warehouse import DataWarehouse from .dw_table import DWTable from .dw_sql import DWSql
StarcoderdataPython
1817720
# -*- coding:utf-8 -*- from __future__ import print_function, absolute_import, division
StarcoderdataPython
24185
import glob import os import os.path import sys import shutil import cPickle from types import StringType, UnicodeType from distutils.core import setup from distutils.extension import Extension from distutils.command.install import install PY3K = sys.version_info[0] > 2 with open('README.rst') as inp: long_descr...
StarcoderdataPython
7144
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship # TODO: db_uri # dialect+driver://username:password@host:port/database?charset=utf8 DB_URI = 'mysql+pymysql://root:root123@127.0.0.1:33...
StarcoderdataPython
3370461
<reponame>jamesrharwood/journal-guidelines import io from urllib.parse import urlparse import pdftotext from bs4 import BeautifulSoup def get_text_from_response(response): return get_text_from_xml(response.text.encode("utf-8")) def get_text_from_xml(html): # from https://stackoverflow.com/questions/328356/...
StarcoderdataPython
8172173
# This code is copied and adapted from <NAME>'s code for learning to # play Pong https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5. from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import numpy as np import os import ray impor...
StarcoderdataPython
4870595
<filename>cartografo/__init__.py CONFIG_MAP_KIND = 'ConfigMap' SECRET_KIND = 'Secret' DEFAULT_OBJECT = CONFIG_MAP_KIND DEFAULT_TARGET = 'new.yaml' DEFAULT_CONFIG_MAP = {'kind': 'ConfigMap', 'apiVersion': 'v1', 'data': {}, 'metadata': {'name': 'type the name'}} DEFAULT_SECRET = {'kind': 'Secret', 'apiVersion': 'v1', '...
StarcoderdataPython
136519
""" Trains a model, acording to the experiment file input The arguments are loaded from a .yaml file, which is the input argument of this script (Instructions to run: `python train_model.py <path to .yaml file>`) """ import os import sys import time import logging import yaml from bff_positioning.data import Preproc...
StarcoderdataPython
12831358
class TranslateFilePolicy(): allowed_formats = ['txt'] def is_allowed(self, filename): split = filename.split('.') format_ = split[1] return (format_ in self.allowed_formats)
StarcoderdataPython
1922386
<filename>plugins/poclbm/HttpTransport.py<gh_stars>1-10 from Transport import Transport from base64 import b64encode from json import dumps, loads from log import * from sha256 import * from threading import Thread from time import sleep, time from urlparse import urlsplit from util import * import httplib im...
StarcoderdataPython
9780333
# Copyright 2017 The Abseil Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
StarcoderdataPython
3354106
from setuptools import setup #name1 = 'sspredict_local.plot = sspredict.plot_ss_ternary:main' name1 = 'sspredict.predict = sspredict.master:main' setup( name='SSPredict', version='v1.1.0', license ='MIT', author='<NAME>, <NAME>', author_email='<EMAIL>, <EMAIL>', description='Python-based Solid...
StarcoderdataPython
6437509
"""Support for Huawei LTE sensors.""" import logging import re import attr import voluptuous as vol from homeassistant.const import ( CONF_URL, CONF_MONITORED_CONDITIONS, STATE_UNKNOWN, ) from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.helpers.entity import Entity import homeassista...
StarcoderdataPython
8196856
class Node: def __init__(self, value, left=None, right=None): self.value = value self.right = right self.left = left def post_order(node, output_list): if node: post_order(node.left, output_list) post_order(node.right, output_list) output_list.append(node) t...
StarcoderdataPython
3370478
import cv2 import numpy as np import sys import time from classes.process import Process from classes.video import Video import pandas as pd import os ################################################################################ ######### Change these depending on where your recordings are located ########## rec_...
StarcoderdataPython
4850491
""" The output is shape 60 by 23589 where 60 is the number of stimulus bins and 23589 is the number of predicted neurons. The out_layer weights have shape 23589 by 480 where 23589 is the number of predicted neurons and 480 is the number of convolutional units in the conv layer. There are 480 convolutional units becaus...
StarcoderdataPython
6450255
# Copyright (C) 2021 ServiceNow, Inc. """ Vectorization utilties """ import numpy as np def convert_text_to_vector(text, model, method='sum'): """ Embed the tokens piece of text with a model. Tokens are produced by a simple whitespace split on the text if the text is provided as a string. ...
StarcoderdataPython
277077
from adminsortable2.admin import SortableAdminMixin from django.contrib import admin from core.admin.filters.event import EventFilter from core.models import Event class EventPageMenuAdmin(SortableAdminMixin, admin.ModelAdmin): list_display = ('title', 'event', 'url', 'position') list_filter = (EventFilter,)...
StarcoderdataPython
4858631
import fnmatch import os import re from string import Template def get_hole_files(): hole_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'envs', 'assets', 'hole') return sorted([file for file in os.listdir(hole_dir) if fnmatch.fnmatch(file, '*id=*.xml')]) def get_experiment_files(): hole_d...
StarcoderdataPython
1669545
"""genomic set member column a2d manifest Revision ID: d9742926014b Revises: <PASSWORD> Create Date: 2020-03-31 08:51:41.082152 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'd9742926014b' down_revision = '<PASSWORD>' branch_labels = None depends_on = None d...
StarcoderdataPython
6675506
<reponame>altran/Awesome-Competence-System from django.shortcuts import render_to_response from django.template import RequestContext from localsettings import SSO_URL def error401(request): return render_to_response('401.html', {'SSO_URL': SSO_URL}, context_instance=RequestContext(request)) def error503(request): ...
StarcoderdataPython
9738046
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RUuid(RPackage): """Tools for Generating and Handling of UUIDs. Tools for ge...
StarcoderdataPython
338100
"""This module contains the general information for LsbootStorage ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import ImcVersion, MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class LsbootStorageConsts(): ACCESS_READ_WRITE = "read-write" TYPE_STORAGE = "storage" clas...
StarcoderdataPython
82731
# coding: utf-8 """ DocuSign Rooms API - v2 An API for an integrator to access the features of DocuSign Rooms # noqa: E501 OpenAPI spec version: v2 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import sys import os...
StarcoderdataPython
6427028
<reponame>coagulant/django-recommends<filename>recommends/storages/redis/managers.py from recommends.managers import DictStorageManager class RedisStorageManager(DictStorageManager): def similarity_for_objects(self, score, *args, **kwargs): spec = super(RedisStorageManager, self).similarity_for_objects(*a...
StarcoderdataPython
3410121
<reponame>ab1cd2eefre3/stock-trading-website # Generated by Django 3.0.2 on 2021-02-27 01:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shares', '0004_auto_20210224_0020'), ] operations = [ migrations.RemoveField( model...
StarcoderdataPython
5166300
<filename>app/core/views.py from rest_framework import status from rest_framework.response import Response from django.db.models import ProtectedError class DestroyProtectedMixin: """ Mixin for handling ProtectedError exceptions. """ def destroy(self, request, *args, **kwargs): instance = se...
StarcoderdataPython
11260148
#!/usr/bin/env python3 """Functionality to create a :class:`Module`-hierarchy.""" import collections from schedsi.cpu import request as cpurequest from schedsi import module, threads class ModuleBuilder: """Build static hierarchies.""" def __init__(self, name=None, parent=None, *, scheduler): """Cre...
StarcoderdataPython
5094469
<gh_stars>1-10 import sys import os import pickle import numpy as np def write_vtk(fn, v, f): len_v = v.shape[0] len_f = f.shape[0] fp = open(fn, 'w') fp.write("# vtk DataFile Version 3.0\nvtk output\nASCII\nDATASET POLYDATA\n") fp.write(f"POINTS {len_v} float\n") for row in v: fp...
StarcoderdataPython
9759786
<gh_stars>0 __author__ = 'Adam'
StarcoderdataPython
5154756
try: import netifaces except: print "Please install the netifaces module from pypi" print "e.g. sudo pip install netifaces" exit(-1) import gevent from gevent.lock import RLock import sys, os import gtwconfig as CONFIG import mptnUtils as MPTN from transport_abstract import Transport import traceback i...
StarcoderdataPython
9770789
<reponame>DestinyofYeet/antonstechbot import subprocess import json global VERSION, bot_prefix, ipdata_token, ipdata_url, osu_token, osu_url, lol_token, lol_url, bot_token def assignVariables(): global VERSION, bot_prefix, ipdata_token, ipdata_url, osu_token, osu_url, lol_token, lol_url, bot_token VERSION = ...
StarcoderdataPython
1673783
<reponame>indymnv/feature_engine # Authors: <NAME> <<EMAIL>> # License: BSD 3 clause from typing import Optional, List, Union import pandas as pd from feature_engine.dataframe_checks import _is_dataframe from feature_engine.imputation.base_imputer import BaseImputer from feature_engine.variable_manipulation import _...
StarcoderdataPython
12853287
# Imports from flask import Flask, render_template, session, redirect, request, flash, url_for, abort from flask_session import Session from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError from werkzeug.security import check_password_hash, generate_password_hash from cs50 import S...
StarcoderdataPython
6416999
<gh_stars>1-10 # TC007_test - Post comment (pytest) from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By import time opt = Options() opt.headless = True def test_comment(): driver ...
StarcoderdataPython
13082
from django import template from week.models import SidebarContentPage,SidebarImagePage register = template.Library() @register.inclusion_tag('week/announcement.html') def sidebar(): sidebar_data = SidebarContentPage.objects.get() return {'sidebar_data':sidebar_data} @register.inclusion_tag('week/advertise...
StarcoderdataPython
3311395
<filename>models/problem_2a.py<gh_stars>0 import numpy as np import pickle from homework4.problem_2 import sample_train if __name__ == "__main__": X = np.genfromtxt('data/X_train.txt', delimiter=None) Y = np.genfromtxt('data/Y_train.txt', delimiter=None)[:, np.newaxis] raw_data = np.concatenate((X, Y), axi...
StarcoderdataPython
3486448
<reponame>yofn/pyacm<filename>codeforces/math数学/800/1207A两种汉堡.py<gh_stars>0 #!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1207/A t = int(input()) for _ in range(t): b,p,f = list(map(int,input().split())) h,c = list(map(int,input().split())) b1 = min(b//2,p) if h>c else min(...
StarcoderdataPython
1712619
<reponame>brianchiang-tw/UD1110_Intro_to_Python_Programming<filename>L4_Control flow/Quiz_List comprehension.py # Q1: # Quiz: Extract First Names # Use a list comprehension to create a new list first_names # containing just the first names in names in lowercase. names = ["<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME...
StarcoderdataPython
4945381
<reponame>Elrophi/flask-quote @manager.command def test(): """Run the unit tests.""" import unittest tests = unittest.TestLoader().discover('tests') unittest.TextTestRunner(verbosity=2).run(tests) from app import app if __name__ == '__main__': app.run(debug=True)
StarcoderdataPython
9724979
<reponame>bonitobonita24/Mayan-EDMS from mayan.apps.authentication.tests.mixins import LoginViewTestMixin, LogoutViewTestMixin from mayan.apps.testing.tests.base import GenericViewTestCase from mayan.apps.user_management.permissions import ( permission_user_edit, permission_user_view ) from ..events import event_u...
StarcoderdataPython
4972986
import script from archive.utils.mock_di_api import mock_api from archive.utils.operator_test import operator_test api = mock_api(__file__) # class instance of mock_api mock_api.print_send_msg = True # set class variable for printing api.send optest = operator_test(__file__) # config parameter api.confi...
StarcoderdataPython
3578449
<filename>app/currency_trade_volume_service.py<gh_stars>0 from dataclasses import dataclass from enum import Enum from typing import List, Optional from app.currency_trade_volume_store import CurrencyTradeVolumeStore, CurrencyPairAvg from app.livecoin_api import LivecoinApi from app.mailer import Mailer from app.types...
StarcoderdataPython
336850
<reponame>huibinshen/autogluon from autogluon.tabular.models.tabular_nn.torch.tabular_nn_torch import TabularNeuralNetTorchModel def test_tabular_nn_binary(fit_helper): fit_args = dict( hyperparameters={TabularNeuralNetTorchModel: {}}, ) dataset_name = 'adult' fit_helper.fit_and_validate_data...
StarcoderdataPython
8053135
<gh_stars>10-100 '''Main "script."''' import ast import copy import csv import ctypes import json import logging import os import sys import time import traceback import uuid from os import listdir from os.path import isfile from typing import List import requests.exceptions from argparse_prompt import PromptParser fr...
StarcoderdataPython
6507243
#!/usr/bin/env python import os from Generic import * from plasTeX.ConfigManager import TooManyValues from String import StringOption from UserList import UserList class MultiParser(GenericParser): def getArgument(self, args, range=None, delim=None, forcedarg=False): if range is None: range = self...
StarcoderdataPython
4812851
#!/usr/bin/python -tt #======================================================================= # General Documentation """Version number and additional information for package. """ #----------------------------------------------------------------------- # Additional Docume...
StarcoderdataPython
5001337
from functools import total_ordering TANK_DAMAGE = 10 BIG_FORT_DAMAGE = 10 SMALL_FORT_DAMAGE = 5 BIG_FORT_REWARD = 70 SMALL_FORT_REWARD = 50 BIG_CITY_PENALTY = 150 SMALL_CITY_PENALTY = 120 def eval_state(state): from scaii.env.sky_rts.env.scenarios.city_attack import UnitType, Actions enemy_tank = None ...
StarcoderdataPython
1723894
<filename>exercicio95.py #Crie um programa que tenha uma função fatorial() que receba dois parâmetros: o primeiro que indique o número a calcular e outro chamado show, que será um valor lógico (opcional) indicando se será mostrado ou não na tela o processo de cálculo do fatorial. def fatorial(n, show=True): f=1 ...
StarcoderdataPython
1674220
<filename>lib/utils/PrefetchingIter.py # -------------------------------------------------------- # Deep Feature Flow # Copyright (c) 2017 Microsoft # Licensed under The MIT License [see LICENSE for details] # Modified by <NAME> # -------------------------------------------------------- # Based on: # MX-RCNN # Copyrigh...
StarcoderdataPython
3323693
<gh_stars>0 import numpy as np import pandas as pd from keras.preprocessing import image from os.path import join import math import matplotlib.pyplot as plt def read_img(data_dir, img_id, train_or_test, size): """Read and resize image. # Arguments img_id: string train_or_test: string 'train' ...
StarcoderdataPython
12806912
<reponame>niraito/rptools import pytest from pathlib import Path from rptools.rpviz.__main__ import ( __build_arg_parser, __run, ) REF_IN_DIR = Path(__file__).resolve().parent / 'inputs' / 'as_dir' REF_IN_TAR = Path(__file__).resolve().parent / 'inputs' / 'as_tar.tgz' REF_OUT_DIR = Path(__file__).resolve().pa...
StarcoderdataPython
3237191
from bpy.types import ( Operator, Panel, UIList, UI_UL_list, ) from .internals import * from .operators import ( rto_history, rename, phantom_history, ) class CollectionManager(Operator): bl_label = "Collection Manager" bl_idname = "view3d.collection_manager" last...
StarcoderdataPython
1874769
<reponame>JohannesVerherstraeten/pypipeline<gh_stars>1-10 # Copyright 2021 <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...
StarcoderdataPython
1877730
<reponame>netor27/codefights-arcade-solutions '''' In chess, queens can move any number of squares vertically, horizontally, or diagonally. The n-queens puzzle is the problem of placing n queens on an n × n chessboard so that no two queens can attack each other. Given an integer n, print all possible distinct solution...
StarcoderdataPython
306588
<reponame>trainsn/CSE_5543<filename>lab6/Qmesh.py ## \file decimate_mesh.py # Some simple mesh decimation routines. # Use data structure HALF_EDGE_MESH_DCMT_BASE (DCMT = decimate). import math from math import sqrt from math import acos import sys import numpy as np import half_edge_mesh import half_edge_mesh_DCMT ...
StarcoderdataPython