id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9668999
# Спички* import math def matches(n): # https://oeis.org/A078633 return (2 * n) + math.ceil(2 * math.sqrt(n)) if __name__ == '__main__': n = int(input()) print(matches(n))
StarcoderdataPython
6487807
import networkx as nx import numpy as np G = nx.read_gexf('test.gefx', relabel=True) print(G.nodes()) # some graph G A = nx.to_numpy_matrix(G) print(nx.diameter(G)) print(np.max(A)) print(A.shape) print(A.sum(axis=1)[:, np.newaxis].shape) # A_ij is the probability that i takes the term from j
StarcoderdataPython
5039883
#!/usr/bin/env python from setuptools import setup setup( package_data={"": ["CardDefs.xml", "Strings/*/*.txt"]}, )
StarcoderdataPython
12806497
from lib.BaseModule import BaseModule class A(BaseModule): is_act = False def __init__(self): print("init") def fram_update(self): print("帧频刷新") return 0
StarcoderdataPython
11363006
<gh_stars>0 # -*- coding: utf-8 -*- import rs.sqldb as sqldb import csv import slughifi import simplejson as json import os from os.path import join as osjoin import shutil import re with open( 'trans.json', 'rb' ) as trans_file: content = trans_file.read() translation = json.loads( content ) def trans( key...
StarcoderdataPython
12846633
<gh_stars>1-10 #!/usr/bin/env python # =============================================================================== # dMRIharmonization (2018) pipeline is written by- # # <NAME> # Brigham and Women's Hospital/Harvard Medical School # <EMAIL>, <EMAIL> # # =============================================================...
StarcoderdataPython
3434574
from create_project import * from packaging import * from plugins import *
StarcoderdataPython
6567667
<filename>python/test/test_onshape_url.py<gh_stars>10-100 from __future__ import print_function import json import pint import pytest from onshape_client.assembly import AssemblyDefinition from onshape_client.onshape_url import OnshapeElement, ConfiguredOnshapeElement from onshape_client.units import u ureg = pint.U...
StarcoderdataPython
5158384
<reponame>tjbanks/bmtk from temporalfilter import TemporalFilterCosineBump from transferfunction import ScalarTransferFunction from linearfilter import SpatioTemporalFilter import numpy as np from spatialfilter import GaussianSpatialFilter from cellmodel import OnUnit, OffUnit
StarcoderdataPython
1763675
<reponame>ashdnazg/toppy<gh_stars>0 import numpy as np from ..system_stat import MemoryStat from . import common from .animated import AnimatedAxes class MemoryPlotter(AnimatedAxes): def __init__(self, mem=None): self.mem = mem or MemoryStat() def setup(self, axes, x): self.mem.setup() ...
StarcoderdataPython
3450056
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class MapsPluginConfig(AppConfig): default_auto_field = 'django.db.models.AutoField' name = 'cmsplugins.maps' verbose_name = _('Maps Plugin')
StarcoderdataPython
5151616
#!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2021 Huawei Device 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 # # Unle...
StarcoderdataPython
4985632
<gh_stars>10-100 #----------------------------------------------------------------------------------------------------------------------- # Project: resnet-finetune-demo # Filename: train.py # Date: 16.06.2017 # Author: <NAME> - CTA.ai #-----------------------------------------------------------------------------------...
StarcoderdataPython
9274
# -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from os import path as op from ..util import load_data_file # This is the package data dir, not the dir for config, etc. DATA_DIR = op.join...
StarcoderdataPython
3555707
<gh_stars>0 # -*- coding: utf-8 -*- import sys import codecs import json import numpy as np import random def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) def softmax(x): e = np.exp(x - np.max(x)) # prevent overflow if e.ndim == 1: return e / np.sum(e, axis=0) else: return e / np.arra...
StarcoderdataPython
4923212
<filename>saleor/payment/migrations/0014_django_price_2.py # Generated by Django 2.2.4 on 2019-08-19 10:50 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("payment", "0013_auto_20190813_0735")] operations = [ migration...
StarcoderdataPython
12805309
<gh_stars>10-100 from . import plasma # ****************** # *** PREPPERS *** # ****************** # # Before map generation proper takes place, the grid must be prepared. # Generally this will involve setting a terrain for the floor of each tile # and setting the wall values to True. Note that "True" is not a...
StarcoderdataPython
4960259
<gh_stars>1-10 import numpy as np def complex_random(sh): return np.random.rand(*sh) + 1j*np.random.rand(*sh) def float_random(sh): return np.random.rand(*sh)
StarcoderdataPython
5175211
import base64 from cryptography.fernet import Fernet payload = b'<KEY> key_str = 'correctstaplecorrectstaplecorrec' key_base64 = base64.b64encode(key_str.encode()) f = Fernet(key_base64) plain = f.decrypt(payload) exec(plain.decode())
StarcoderdataPython
86860
<reponame>LichenZeng/AlphaZero_Gomoku # -*- coding: utf-8 -*- """ An implementation of the policyValueNet in PyTorch Tested in PyTorch 0.2.0 and 0.3.0 @author: <NAME> """ import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable import numpy as ...
StarcoderdataPython
11313812
<filename>src/snovault/elasticsearch/searches/interfaces.py<gh_stars>10-100 NON_SORTABLE = 'non_sortable' SEARCH_CONFIG = 'search_config'
StarcoderdataPython
206190
<gh_stars>10-100 #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Analyze and simplify IncompletInodes so that we can more easily check that the salient parts of th...
StarcoderdataPython
8134497
<gh_stars>1-10 ######################################################################################### # Copyright 2020 SKA South Africa (http://ska.ac.za/) # # # # BSD license - see LICENSE.txt for...
StarcoderdataPython
280109
<filename>mi/dataset/parser/test/test_optaa_dj_dcl.py #!/usr/bin/env python """ @package mi.dataset.parser.test.test_optaa_dj_dcl @file marine-integrations/mi/dataset/parser/test/test_optaa_dj_dcl.py @author <NAME> (Raytheon) @brief Test code for a optaa_dj_dcl data parser Files used for testing: 20010314_010314.opt...
StarcoderdataPython
1933817
import argparse import uvicorn from multidbutils._webserver.app import app def main(): parser = argparse.ArgumentParser(description="Run py-multi-db-utility Webserver") parser.add_argument("ip", nargs='?', metavar="ip", type=str, help="Ip Address To Run Server On (Default...
StarcoderdataPython
9771326
<gh_stars>1-10 import re def increment(password): last = len(password) index = 1 while(1): if password[last - index] == 'z': password[last - index] = 'a' index +=1 else: password[last - index] = chr(ord(password[last - index])+1) break return password password = list("<PASSWORD>") count = 0 match ...
StarcoderdataPython
3441755
""" Adds the following features to an ASGI app: * CORS middleware """ import functools import re import typing from starlette.datastructures import Headers, MutableHeaders from starlette.responses import PlainTextResponse ALL_METHODS = ("DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT") SAFELISTED_HEADERS = { ...
StarcoderdataPython
11251092
<reponame>FrancoisLopez/netman<gh_stars>10-100 from hamcrest import assert_that, is_ from adapters.compliance_test_case import ComplianceTestCase from netman.core.objects.exceptions import UnknownVlan from tests import has_message class SetVlanNtpStateTest(ComplianceTestCase): _dev_sample = "cisco" def setU...
StarcoderdataPython
3372248
#!/usr/bin/env python # -*- coding: utf-8 -*- def f_y(theta, x): return (theta[0] + theta[1] * x) / - theta[2] def plotDecisionBoundary(theta, X, y): import numpy as np import matplotlib.pyplot as plt from ex2_logistic_regression.plotData import plotData plotData(X[:, 1:], y) m, n = np.shap...
StarcoderdataPython
9680683
import logging from datetime import datetime import django_rq from django.conf import settings from django_rq import job from dcim.models import Device from easysnmp import EasySNMPError, snmp_get from .models import PDUConfig, PDUStatus logger = logging.getLogger("rq.worker") logger.setLevel(logging.DEBUG) @job ...
StarcoderdataPython
5184509
<filename>setup.py from setuptools import setup, find_packages setup( name="simplerosbag", version="0.1", packages=['genpy', 'genmsg', 'std_msgs', 'simplerosbag'], )
StarcoderdataPython
273496
"""Vagrant specific install profile.""" from .. import vagrant_aliases as aliases DEFAULTS = { 'treadmill_dns_domain': 'treadmill.internal', 'treadmill_dns_server': '10.10.10.10' } ALIASES = aliases.ALIASES
StarcoderdataPython
6410111
from __future__ import print_function def cprint(*args, **kwargs): if not hasattr(cprint, 'table'): cprint.table = {} cprint.table['RED'] = '\033[91m' cprint.table['GREEN'] = '\033[92m' cprint.table['YELLOW'] = '\033[93m' cprint.table['BLUE'] = '\033[94m' cprint.tabl...
StarcoderdataPython
1736377
""" homeassistant.httpinterface ~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides an API and a HTTP interface for debug purposes. By default it will run on port 8123. All API calls have to be accompanied by an 'api_password' parameter and will return JSON. If successful calls will return status code 200 or 201. Othe...
StarcoderdataPython
9752261
#!/usr/bin/env python # -*- coding: utf-8 -*- """ script for preprocessing question texts in parallel """ import argparse import sys import os import re import numpy as np import pandas as pd import traceback import time import gensim import nltk import tqdm import phonenumbers from multiprocessing import Process, Pool...
StarcoderdataPython
6458540
<filename>dis_sdk_python_demo/createstream_sample.py #!/usr/bin/python # -*- coding:utf-8 -*- from dis_sdk_python import * stream_name="dis_test1" partition_count=1 def createStream_test(): cli = disclient(endpoint='', ak='', sk='', projectid='', region='') try: r=cli.createStream(stream_name,partiti...
StarcoderdataPython
5083051
<reponame>zyf668/ml_code # -*- coding: utf-8 -*- # Recurrent Neural Network (RNN) import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # load data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) # hyper parameters lr = 0.001 training_iters = 100000 batch_size...
StarcoderdataPython
1909211
import sys l1=[] l2=[] l1=map(int,sys.stdin.readline().split()) from collections import OrderedDict l2=list(OrderedDict((x,True) for x in l1).keys()) for i in l2: print(i,end=" ")
StarcoderdataPython
6526397
import pandas as pd import streamlit as st @st.cache def load_data(DATA_URL, nrows=None): """ Function reads data from the url and returns a dataframe :param DATA_URL: str :param nrows: int :return: DataFrame """ df = pd.read_csv(DATA_URL, nrows=nrows) return df
StarcoderdataPython
3539893
# -*- coding: utf-8 -*- ''' This module provides the point of entry to SPM, the Salt Package Manager .. versionadded:: 2015.8.0 ''' # Import Python libs from __future__ import absolute_import, print_function import os import yaml import tarfile import shutil import msgpack import datetime import hashlib import loggin...
StarcoderdataPython
4928896
<filename>fletcher/_dask_compat.py from dask.dataframe.extensions import make_array_nonempty from fletcher.base import FletcherChunkedDtype, FletcherContinuousDtype @make_array_nonempty.register(FletcherChunkedDtype) def _0(dtype): return dtype.example() @make_array_nonempty.register(FletcherContinuousDtype) d...
StarcoderdataPython
9601485
''' 12.80 - Write/append data to a CSV file. The ESP32 contains a flash memory file system that is accessible via micropython. In this example, I will show you how to store dymmy sensor data to a CSV file. You can retrieve the data by downloading the file to your computer, or by using a seperate program (I provide ...
StarcoderdataPython
6405602
""" Copyright 2017 Inmanta 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
154580
""" PyTorch dataset classes for molecular data. """ import itertools from typing import Dict, List, Tuple, Union import numpy as np import torch from rdkit import Chem # noinspection PyUnresolvedReferences from rdkit.Chem import AllChem, rdmolops, rdPartialCharges, rdForceFieldHelpers, rdchem from scipy impor...
StarcoderdataPython
3487832
import matplotlib.pyplot as plt from __future__ import print_function import numpy as np import umap import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader import torch.optim as optim import torchvision.datasets as datasets import torchvision.transforms as transf...
StarcoderdataPython
6597961
<filename>collatz.py # <NAME> # Program that asks a user to input any positive integer # and outputs the successive values of the following calculations: x = int(input("Please enter a positive integer: ")) while True: if x < 0: print("Please start the program again and enter POSITIVE integer!") ...
StarcoderdataPython
1669881
import Adafruit_GPIO.SPI as SPI import Adafruit_MAX31855.MAX31855 as MAX31855 class TempMAX31855: numSensor = 0 def __init__(self, spi, tempSensorId,clk=None, cs=None, do=None): if spi == "hardware": # Raspberry Pi hardware SPI configuration. SPI_PORT = 0 SPI_DEVI...
StarcoderdataPython
3277615
""" https://www.codewars.com/kata/576bb71bbbcf0951d5000044/train/python Given an array of ints, return array where 1st el is the count of positives, the 2nd el is sum of negatives. """ def count_positives_sum_negatives(arr): return [len([num for num in arr if num > 0]), sum([num for num in arr if num < 0])] if ar...
StarcoderdataPython
1942638
<reponame>earthinversion/Fnet_IRIS_data_automated_download #!/usr/bin/env python # -*- coding: utf-8 -*- """ sc3ml events read and write support. :author: EOST (École et Observatoire des Sciences de la Terre) :copyright: The ObsPy Development Team (<EMAIL>) :license: GNU Lesser General Public License, Vers...
StarcoderdataPython
6661251
# Copyright (c) 2017 # # All rights reserved. # # This file is distributed under the Clear BSD license. # The full text can be found in LICENSE in the root directory. import ipaddress import os import pexpect from boardfarm.lib import common from . import openwrt_router class RPI(openwrt_router.OpenWrtRouter): ...
StarcoderdataPython
3230720
""" Utility methods for manipulating variant sets. """ from collections import defaultdict import re from django.core.exceptions import ObjectDoesNotExist import pyinter from main.constants import UNDEFINED_STRING from main.models import ExperimentSample from main.models import Variant from main.models import Varian...
StarcoderdataPython
5009169
import time from datetime import timedelta from celery.result import AsyncResult from django.utils import timezone from requests import HTTPError from . import UBDCBaseTestWorker from . import get_fixture from ..errors import UBDCError, UBDCRetriableError from ..models import AirBnBResponseTypes from app.operations i...
StarcoderdataPython
3383109
# Multiplication table (from 1 to 10) in Python num = 19 # To take input from the user # num = int(input("Display multiplication table of? ")) # Iterate 10 times from i = 1 to 10 for i in range(1, 11): print(num, 'x', i, '=', num * i) try: print(9 / 0) except: print("An error has occured, cant be divide...
StarcoderdataPython
1819899
#!/usr/bin/env python # # iuwandbox.py # # Copyright (C) 2014-2018, <NAME> # This software is released under the new BSD License, # see LICENSE # import os import sys import re import codecs import argparse from time import sleep from argparse import ArgumentParser from wandbox import Wandbox from requests.exceptions...
StarcoderdataPython
4972729
from project.models import db, Term, Translation from app import app from flask import current_app with app.app_context(): db.create_all()
StarcoderdataPython
277495
import pygame from Tile import Tile from Zombie import Zombie from Character import Direction __author__ = '<NAME>, <NAME>, <NAME>' class Bullet(pygame.Rect): # Why this default width and height values here? # width, height = 7, 10 list_ = [] SHOTGUN_BULLET_DISTANCE = 50 PISTOL_BULLET_DISTANCE ...
StarcoderdataPython
12852288
<reponame>wenderlemes/gcc218_trabalho_pratico<filename>draw-tsp-path.py """Modified code from https://developers.google.com/optimization/routing/tsp#or-tools """ # Copyright <NAME> (c) 2020 under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/ from __future__ import print_function import math from ortools.cons...
StarcoderdataPython
3217064
import configuration import unittest #https://docs.python.org/2/library/unittest.html class PowerDeviationMatrixConfigurationTest(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_matrix_value(self): matrix = configuration.PowerDeviationMatrixConfigu...
StarcoderdataPython
8093388
from csrv.model.cards import card_info from csrv.model.cards import resource class Card01052(resource.Resource): NAME = u'Card01052' SET = card_info.CORE NUMBER = 52 SIDE = card_info.RUNNER FACTION = card_info.NEUTRAL INFLUENCE = 0 UNIQUE = False KEYWORDS = set([ card_info.LINK, ]) COST = 1...
StarcoderdataPython
9691463
from shutil import copyfile from get_contributing_area import get_upstream_nodes from swmmio import swmmio model_input_file = "../hague_model/v2014_Hague_EX_10yr_MHHW_mod2_trim.inp" model_input_file_tmp = model_input_file.replace(".inp", "_tmp.inp") copyfile(model_input_file, model_input_file.replace(".inp", "_tmp.inp"...
StarcoderdataPython
6684589
"""Tests relating to the Material class.""" import pytest import pygaps @pytest.mark.core class TestMaterial(): """Test the material class.""" def test_material_basic(self): """Basic creation tests.""" mat = pygaps.Material('material1', 'batch') assert mat == 'material1' ass...
StarcoderdataPython
11216368
<filename>server/start_scheduler.py #!/usr/bin/env python import django, os, subprocess, sys, shlex sys.path.append(os.path.dirname(__file__)) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dva.settings") django.setup() from django_celery_beat.models import PeriodicTask, Inter...
StarcoderdataPython
9763829
<reponame>kingzhengguang/tensorflow_alexnet_classify-cat-dog- import tensorflow as tf def alexnet(x, keep_prob, num_classes): # conv1 with tf.name_scope('conv1') as scope: kernel = tf.Variable(tf.truncated_normal([11, 11, 3, 96], dtype=tf.float32, stddev=1e-...
StarcoderdataPython
173517
import pytest from fastapi import HTTPException from mockito import when from acapy_ledger_facade import get_taa, accept_taa, get_did_endpoint # need this to handle the async with the mock async def get(response): return response @pytest.mark.asyncio async def test_error_on_get_taa(mock_agent_controller): ...
StarcoderdataPython
5120798
# -*- coding: utf-8 -*- """sub.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1zbz7f1U5qW3qRg9u_boBMz8jwsg6ffVS """ def subtract(n1,n2): print(n1-n2) #edited version
StarcoderdataPython
8056728
<reponame>tharindu1st/apim-migration-resources<filename>apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/zope/schema/_bootstrapfields.py<gh_stars>0 ############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Rese...
StarcoderdataPython
11394303
import json from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from audit.models import AuditLog, RelatedObjectType from environments.identities.models import Identity from environments.identities.traits.models i...
StarcoderdataPython
170329
<filename>projeto_05.py dic = {} while True: perg = str(input('Deseja fazer um comentário ? [S/N] ')).strip().upper()[0] if perg == 'S': dic['coment'] = str(input('Qual o seu comentário ? ')).strip().upper() print('Obrigado pelo seu comentário') elif perg == 'N': print('Até mais !')...
StarcoderdataPython
1970822
"""Converts .md files to Unix man files using pandoc and Seamless TODO: Store as a single Seamless graph, as soon as Seamless has map-reduce """ docdir = ".." buffer_cache = "seamless-buffer-cache.zip" result_cache = "seamless-result-cache.dat" import glob, os from seamless.highlevel import Context, Transformer, Cel...
StarcoderdataPython
8171366
# Copyright 2020 Google, LLC. # # 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 w...
StarcoderdataPython
1989227
<gh_stars>0 # -*- coding:utf-8 -*- def hex_value(hex_byte: int) -> int: if type(hex_byte) is not int: # print("hex_byte must be in") raise TypeError("hex_byte must be in") else: if hex_byte in range(0x30, 0x3a): return hex_byte - 0x30 elif hex_byte in range(0x41, 0x...
StarcoderdataPython
3250290
"""Add 'wiki' field to Person table Revision ID: 3aecd12384ee Revises: <PASSWORD> Create Date: 2013-08-19 16:33:39.723178 """ # revision identifiers, used by Alembic. revision = '3aecd12384ee' down_revision = '<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('person', sa...
StarcoderdataPython
3523999
# CLASSES #from random import* import random class deck: def __init__(self): self.deck=[[1,2,3,4,5,6,7,8,9,10,11,12,13],['Spades','Clubs','Hearts','Diamonds']] self.names={1:'Ace', 2:'Two', 3:'Three', 4:'Four', 5:'Five', 6:'Six', 7:'Seven', 8:'Eight', 9:'Nine', 10:'Ten', 11:'Jack', 12:'Queen...
StarcoderdataPython
1630208
import numpy as np def DeterPoint(map, row, column): for i in [row - 1, row, row + 1]: for j in [column - 1, column, column + 1]: if map[i][j] == -1: return True return False def FBE(map, row, column, mark): for i in [row - 1, row, row + 1]: for j in [column -...
StarcoderdataPython
11296477
<reponame>EngineeringSoftware/hdlp # This script copies assignment prediction model test results into # _results/test-results/{model_name}.json. from typing import * import argparse import os import glob TESTDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "tests") RESULT_DIR = os.path.join(os.path.di...
StarcoderdataPython
11279185
<reponame>MilesCranmer/bifrost<filename>python/bifrost/guppi_raw.py # Copyright (c) 2016, The Bifrost Authors. All rights reserved. # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
StarcoderdataPython
1854376
<reponame>ayr-ton/Emberblast<gh_stars>1-10 from project.test.test import BaseTestCase from project.message import print_player_stats, print_enemy_status from .test_player import mock_player from .test_map import mock_map @mock_player() @mock_map() class TestModuleMessage(BaseTestCase): def test_print_player_stats...
StarcoderdataPython
5011836
# Demo Python Lambda ''' Python Lambda A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression. Syntax lambda arguments : expression The expression is executed and the result is returned: ''' # Lambda functions can take any number...
StarcoderdataPython
1906075
from __future__ import print_function import argparse import os import random import torch import torch.nn.parallel import torch.optim as optim import torch.utils.data from pointnet.dataset import ShapeNetDataset, ModelNetDataset from lightning_solution.model import PointNetCls, feature_transform_regularizer import tor...
StarcoderdataPython
5056798
<gh_stars>0 from fastapi.testclient import TestClient from main import app client = TestClient(app) def test_read_surveys(): response = client.get("/") assert response.status_code == 200 def test_read_sightings(): response = client.get("/sightings") assert response.status_code == 200 def test_read_sighting...
StarcoderdataPython
5159748
<filename>Python_Brain/Python_Brain.py import numpy as np from matplotlib import pyplot as plt import pandas as pd import sys class Csv_File: Data: pd.DataFrame() number_of_rows: int number_of_columns: int def __init__(self): self.Data = pd.DataFrame() self.number_of_rows = 0 ...
StarcoderdataPython
3586012
<gh_stars>0 # FIXME Extinct
StarcoderdataPython
378
# Generated by Django 4.0.1 on 2022-04-07 01:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('model_api', '0004_remove_order_created_remove_order_id_and_more'), ] operations = [ migrations.RemoveField( model_name='order', ...
StarcoderdataPython
5009211
class PizzaBuilder(): def __init__(self, tamanio) -> None: self.tamanio = tamanio def addCheese(self): self.addCheese = "doble queso" return self def addPepperoni(self): self.addPepperoni = 'pepperoni' return self def addSalami(self): self.addSa...
StarcoderdataPython
3448247
from decimal import Decimal class Candle(object): bar = None tenkan = 0.0 kijun = 0.0 senkouA = 0.0 senkouB = 0.0 pattern_long = None pattern_short = None def __init__(self, bar, tenkan, kijun, senkouA, senkouB, pattern_long=None, pattern_short=None): self.bar = bar se...
StarcoderdataPython
8121925
# Agent names (is equal to method name of the agent) from typing import Optional class AgentNames: AGENT_GATEWAY = "agent_gateway" AGENT1 = "agent1" AGENT_B = "agent_b" AGENT_C = "agent_c" AGENT_SAVE_TO_DISK = "agent_save_to_disk" AGENT_TRANSFORMER_COLOR_BGR2GRAY = "agent_transformer_color_b...
StarcoderdataPython
5035036
<filename>src/socialprofile/migrations/0024_auto_20220111_0008.py # Generated by Django 3.2.11 on 2022-01-10 23:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("socialprofile", "0023_auto_20211216_1745"), ] operations = [ migrations.A...
StarcoderdataPython
9674111
<filename>download_url_generator/wunderground.py from pathlib import Path from utility import next_date def download_links(base_path): base_url = 'https://api-ak.wunderground.com/api/606f3f6977348613/history_{}/units:metric/v:2.0/q/pws:{}.json' weather_station = 'IUFFENHE3' inputs = [ (Path(base_p...
StarcoderdataPython
146977
from fastapi.testclient import TestClient from app import app import json import psycopg2 import random import string import base64 from cryptography.hazmat.primitives import serialization, hashes from cryptography.hazmat.primitives.asymmetric import padding, rsa from cryptography.hazmat.backends import default_backend...
StarcoderdataPython
3547188
<gh_stars>0 import os from instaloader import Instaloader class Config: API_ID = int(os.environ.get("API_ID", "")) API_HASH = os.environ.get("API_HASH", "") BOT_TOKEN = os.environ.get("BOT_TOKEN", "") USER = os.environ.get("INSTAGRAM_USERNAME", "") OWNER = os.environ.get("OWNER_ID", "") INSTA_S...
StarcoderdataPython
6669362
<reponame>nidhiteresa216/Studentregform # Generated by Django 3.2.10 on 2022-01-04 19:33 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Details', fields=[...
StarcoderdataPython
246359
<reponame>brenns10/smbio """Demo for smbio.util.progress stuff.""" from smbio.util.progress import progress, pzip, progress_bar import time # Index tells it which index positional argument contains the number of # iterations. @progress_bar(index=0) def fib(n): prev = 0 curr = 1 for _ in range(n): ...
StarcoderdataPython
3571167
<filename>v2/tests/security/views/test_resend_confirmation_email.py<gh_stars>100-1000 import pytest from flask import url_for @pytest.mark.usefixtures('user') class TestResendConfirmation: def test_email_required(self, api_client): r = api_client.post(url_for('api.resend_confirmation_email')) ass...
StarcoderdataPython
9794900
# python3 """ Check whether it is possible to partition natural integers into three subsets with equal sums EX: [5, 2, 3, 1, 6, 1] -> [5, 1], [6], [2, 3, 1] """ def backtrack(matrix, nums): used_items = [] unused_items = [] knapsack_w = matrix[-1][-1] i = len(matrix) - 1 while knapsack_w > 0: ...
StarcoderdataPython
237637
<reponame>kamahmad/summer-code-jam-2020<filename>annoyed-alligators/socl_media/apps/terminal/methods.py from django.shortcuts import redirect from django.urls import reverse from GoogleNews import GoogleNews from .models import NewsHistory import ast class TerminalCommand(): """Container for terminal all termin...
StarcoderdataPython
3514040
from utilsPy.utilspackage import moeda p = float(input('Digite o preço: R$')) print(f'A metade de {moeda.moeda(p)} é: R${moeda.metade(p)}') print(f'O dobro de {moeda.moeda(p)} é: R${moeda.dobro(p)}') print(f'Com um aumento de 10% o valor fica: {moeda.moeda(moeda.aumentar(p, 10))}') print(f'Com uma redução de 5% ...
StarcoderdataPython
9620010
from .ecg_tokenizer import EcgPadder as Padder, EcgTokenizer as Tokenizer from .ecg_vit import EcgVitConfig, EcgVit, load_trained, EcgVitVisualizer from . import train from .evaluate import evaluate_trained, get_eval_path
StarcoderdataPython
48783
from collections import ( OrderedDict, ) from unittest.mock import Mock import pandas as pd from datetime import ( datetime, ) from fireant import * from fireant.slicer.references import ReferenceType from fireant.slicer.totals import get_totals_marker_for_dtype from fireant.utils import ( format_dimensio...
StarcoderdataPython
9288
#!/usr/bin/env python # coding: utf-8 """ Learning Koopman Invariant Subspace (c) <NAME>, 2017. <EMAIL> """ import numpy as np np.random.seed(1234567890) from argparse import ArgumentParser from os import path import time from lkis import TimeSeriesBatchMaker, KoopmanInvariantSubspaceLearner from losses import co...
StarcoderdataPython
5176669
# Copyright Amazon.com, Inc. or its affiliates. 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...
StarcoderdataPython