id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
116331
from django.contrib.sqlite3.search import FTS5Model, FTSField class Breakfast(FTS5Model): ingredients = FTSField()
StarcoderdataPython
1619114
import sys # This could use the n 2n rule and other ideas about primes # Reinstate p[] to use only those as candidate multipliers for new composites?... # ...no that won't work beyond a certain point: You don't know them yet def NthPrime(nth): if nth == 1: print('first prime is 2'); return 2 if nth == 2: prin...
StarcoderdataPython
36851
from simplelinkedin import LinkedIn def run_script(settings): with LinkedIn( username=settings.get("LINKEDIN_USER"), password=settings.get("LINKEDIN_PASSWORD"), browser=settings.get("LINKEDIN_BROWSER"), driver_path=settings.get("LINKEDIN_BROWSER_DRIVER"), headless=bool(sett...
StarcoderdataPython
3340810
<filename>tests/pipeline/composer_api_tests.py # Copyright 2018 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
StarcoderdataPython
1719313
from __future__ import annotations import copy from typing import List, Union from machine_common_sense.config_manager import Vector3d from .base_objects import ( create_soccer_ball, create_variable_definition_from_base, ) from .definitions import ( ChosenMaterial, DefinitionDataset, ObjectDefini...
StarcoderdataPython
41236
<gh_stars>0 # !/usr/bin/python # Copyright (c) 2019 Cohesity Inc # Apache License Version 2.0 from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.module_utils.basic import AnsibleModule from cohesity_management_sdk.cohesity_client import CohesityClient fro...
StarcoderdataPython
1755238
import json from utils import distance, format_dist, i2f from pokemongo_bot.human_behaviour import sleep from pokemongo_bot import logger from pokemongo_bot.step_walker import StepWalker from pokemongo_bot.cell_workers import PokemonCatchWorker class CatchVisiblePokemonWorker(object): def __init__(self, bot): ...
StarcoderdataPython
3375411
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 18-6-12 下午2:13 # @Author : Tom.Lee # @File : banner.py # @Product : PyCharm # @Docs : # @Source : import getpass import os import platform import flask banner_text = """ _________ _____ __...
StarcoderdataPython
3202285
# 4. Orders # Write a function that calculates the total price of an order and prints it on the console. # The function should receive one of the following products: coffee, coke, water, snacks; # and a quantity of the product. The prices for a single piece of each product are: # • coffee - 1.50 # • water - 1.00 # • co...
StarcoderdataPython
1742541
def compliment(): import random compliments = """Your smile is contagious You look great today You're a smart cookie I bet you make babies smile You have impeccable manners I like your style You have the best laugh I appreciate you You are the most perfect you there is Your perspective is refreshing You're an awesom...
StarcoderdataPython
1770767
# REST framework from rest_framework.test import APITestCase from rest_framework import status # Project from apps.shared.utils import timezone_fix from apps.shared.tests import ViewSetTestCase from apps.gauth.tests import TEST_USER1 class NewsPublicTest(APITestCase, ViewSetTestCase): fixtures = ['user.yaml', 'n...
StarcoderdataPython
176695
# Copyright 2021 University of Nottingham Ningbo China # Author: <NAME> <<EMAIL>> # # 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
1638994
from exoplanet.gp import terms, GP from exoplanet.distributions import estimate_inverse_gamma_parameters import exoplanet as xo import corner, os, pickle import numpy as np, matplotlib.pyplot as plt, pandas as pd, pymc3 as pm import pickle, os, corner from collections import OrderedDict from pymc3.backends.tracetab i...
StarcoderdataPython
49797
<filename>reference/word2vec_basic_all_by_kim.py # Copyright 2015 The TensorFlow 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/li...
StarcoderdataPython
3284016
from flask import Flask, render_template, request import model app = Flask(__name__, static_folder="images_site") @app.route("/", methods = ['GET']) def hello(): return render_template("index.html") @app.route("/", methods = ['POST']) def predict(): imagefile = request.files['imageFile'] imagepath = "....
StarcoderdataPython
3281945
from corems.transient.input.brukerSolarix import ReadBrukerSolarix from corems.molecular_id.search.molecularFormulaSearch import SearchMolecularFormulas from corems.mass_spectrum.output.export import HighResMassSpecExport from matplotlib import pyplot file_path= 'tests/tests_data/ftms/ESI_NEG_SRFA.d' #Bruker Solarix ...
StarcoderdataPython
1757474
<reponame>ch1huizong/learning data = {'red': 1, 'green': 2, 'blue': 3}
StarcoderdataPython
1766730
<gh_stars>0 import data from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OrdinalEncoder from sklearn.model_selection import train_test_split import numpy as np import pandas as pd from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import feature_selection fro...
StarcoderdataPython
1672305
__all__ = [ 'numerify', ] def numerify(input, default=-1): """ (number or string, default=-1) -> number This is good for query string operations. >>> numerify(1) 1 >>> numerify("1") 1 >>> numerify("1a") -1 >>> numerify("ab") -1 >>> numerify("abc", default=44) 44 ...
StarcoderdataPython
105522
from dataclasses import dataclass import numpy as np @dataclass(unsafe_hash=True) class Fraction: _numerator: int # Numerator _denominator: int # Denomenator def __init__(self, numerator, denominator): self._numerator = numerator self._denominator = denominator gcd = np.g...
StarcoderdataPython
33988
<gh_stars>0 import pathlib, typing, random, xml.etree.ElementTree as ET from itertools import chain from typing import List, Tuple from PIL import Image, ImageOps def split_background(background: Image.Image) -> list[Image.Image]: res = [] for x in range(0, background.width-416, 416): for y in range(0,...
StarcoderdataPython
154379
"""Core Modules for TDGam.""" import sys from os import path as osp from .project import TDGamProject from .touchdesigner_ui import TDGamProjectUI from .component import TDGamComponent from .touchdesigner_ui import TDGamComponentUI from .maglapath import Path
StarcoderdataPython
154467
<filename>utils.py<gh_stars>0 import discord from random import choice import time import feedparser import requests from datetime import datetime import pytz from bs4 import BeautifulSoup from mcstatus import MinecraftServer def mock_message(msg:str): """ Spongebob mocks the given input by randomly varying th...
StarcoderdataPython
3369055
import unittest import os import pandas as pd from cgnal.core.data.model.core import ( Range, CompositeRange, CachedIterable, LazyIterable, IterGenerator, ) from cgnal.core.logging.defaults import getDefaultLogger from cgnal.core.tests.core import logTest, TestCase from tests import TMP_FOLDER from...
StarcoderdataPython
1621121
#%% compute bymonth reverts import bz2 import subprocess import os from datetime import datetime from utils import utils import sys language = sys.argv[1] dataset = f'/home/gandelli/dev/data/dumps/{language}/sorted_by_pages.tsv.bz2' output_file = f'/home/gandelli/dev/data/{language}/generic/reverts.tsv' dump_in =...
StarcoderdataPython
133632
<gh_stars>1-10 from collections.abc import Mapping from dataclasses import dataclass, fields from typing import ( Optional, TypeVar, Generic, Dict, ) from typing_extensions import Protocol from hologram import JsonSchemaMixin from hologram.helpers import StrEnum from dbt import deprecations from dbt.contracts.uti...
StarcoderdataPython
3240403
<reponame>wzyanqi/My-flask-blog #encoding:utf-8 import os from app import create_app, db from app.models import Post from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand app = create_app('default') manager = Manager(app) migrate = Migrate(app, db) def make_shell_context...
StarcoderdataPython
137928
<gh_stars>0 import csv import os import xml.etree.ElementTree as ET from unittest.mock import MagicMock import pandas as pd import requests from dagster import ( IOManager, InputContext, Out, Output, OutputContext, io_manager, job, op, resource, ) ARTICLES_LINK = "https://rss.nyti...
StarcoderdataPython
1708221
<gh_stars>0 from favourites_list import * from positional_list import * class FavouritesListMTF(FavouritesList): """List of elements odered with move-to-front heuristic.""" # we override _move_up provide move to front semantics. def _move_up(self,p): """Move accesses item at Position p to frony of...
StarcoderdataPython
1603809
<reponame>KitwareMedical/pydstk ################################################################################ # # Library: pydstk # # Copyright 2010 Kitware Inc. 28 Corporate Drive, # Clifton Park, NY, 12065, USA. # # All rights reserved. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you ma...
StarcoderdataPython
3344214
<filename>python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py<gh_stars>1-10 var = <warning descr="Python version 2.6 does not support dictionary comprehensions">{i : chr(65+i) for i in range(4)}</warning>
StarcoderdataPython
61569
""" 3D Agn spin visualisation """ import logging import os import shutil import corner import matplotlib.lines as mlines import matplotlib.pyplot as plt import numpy as np import pandas as pd import pyvista as pv import scipy.stats from bbh_simulator.calculate_kick_vel_from_samples import Samples from matplotlib impor...
StarcoderdataPython
3230543
<reponame>YiyiLiao/deep_marching_cubes<filename>marching_cube/data/shape.py # Generate a series of cubes import numpy as np import os import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from numpy.random import uniform class Shape(object): """Sample points from toy primitives such as ellipsoi...
StarcoderdataPython
1785391
<reponame>ErFer7/UFSC-POO-II # -*- coding: utf-8 -*- ''' Módulo para a implementação das cartas e do baralho ''' from random import choice class CardDeck(): ''' Esta classe descreve o baralho ''' _card_list: list def __init__(self): self._card_list = [] # Geração do baralho ...
StarcoderdataPython
1769160
<gh_stars>0 from classes.strategy import Strategy def shifted_binary_search(array, target, strategy=Strategy.Iteration): ''' Given an array of numbers that is sorted but shifted by an unknown number of indices in an unknown direction, find and return the first found index of the array where array[index] == ta...
StarcoderdataPython
3319307
<reponame>USerik/liteflow<gh_stars>0 import logging import sqlite3 import threading from sqlite3 import Error from interface import implements from typing import List from liteflow.core.abstractions import IPersistenceProvider from liteflow.core.models import WorkflowInstance, EventSubscription, Event from .converters ...
StarcoderdataPython
1806
# -*- coding: utf-8 -*- """ Script to execute example covarying MMGP regression forecasting model with full Krhh. Inputs: Data training and test sets (dictionary pickle) Data for example: - normalised solar data for 25 sites for 15 minute forecast - N_train = 4200, N_test = 2276, P = 25, D = 51 - Xtr[:, :5...
StarcoderdataPython
4831769
<filename>timeeval_gui/pages/__init__.py import streamlit as st from .gutentag import GutenTAGPage from .eval import EvalPage from .page import Page from .results import ResultsPage class Pages: def __init__(self, *pages: Page): assert len(pages) > 0, "You have to add at least one Page" self.page...
StarcoderdataPython
3346052
<reponame>MarcCote/Theano<filename>theano/gof/tests/test_sched.py from __future__ import absolute_import, print_function, division from theano.gof.sched import (make_dependence_cmp, sort_apply_nodes, reverse_dict, _toposort, posort) from theano import tensor from theano.gof.graph import i...
StarcoderdataPython
68045
<gh_stars>0 import urllib2 import urllib import cookielib import os.path import time import config import htmltool import logging import json _opener = None _required = {} def build_opener(spy, refresh=False): global _opener if not refresh and _opener: return _opener _opener = urllib2.build_opene...
StarcoderdataPython
4830479
import logging import dpkt from pcaputil import * import tcp from packetdispatcher import PacketDispatcher def ParsePcap(dispatcher, filename=None, reader=None, from_side=None): ''' Parses the passed pcap file or pcap reader. Adds the packets to the PacketDispatcher. Keeps a list Args: dispatc...
StarcoderdataPython
186365
#!/usr/bin/env python # -*- coding: utf-8 -*- def filterQuestion(question_content): r0 = "[0-9]+" r1 = "[\sa-zA-Z0-9.·“”』。,,!?!\?()\'\"《》/\-:\.:\*\.\+\$\^\[\]\(\)\{\}\|]+" r2 = "[\s.·“”()#。,!?!\?()』\'\"《》/\-:\.:\*\.\+\$\^\[\]\(\)\{\}\|]+" import re # content_list_sub = [re.sub(r1, '', content) for ...
StarcoderdataPython
3225184
<gh_stars>1-10 import random class UserAgent: pc_agents = [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50...
StarcoderdataPython
1646414
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from extensions_paths import PRIVATE_TEMPLATES from file_system import FileNotFoundError class TableOfContentsRenderer(object): '''Renders a table of con...
StarcoderdataPython
3260600
import sys import os launcher={ 'shared' : '', 'MPI' : 'mpirun -genv DIST_CNC=MPI -n 4', 'SOCKETS': 'env DIST_CNC=SOCKETS CNC_SOCKET_HOST=$CNCROOT/etc/dist/sockets/start.sh', 'SHMEM' : 'env DIST_CNC=SHMEM' } cmd=launcher[sys.argv[2]] + " " + sys.argv[1] + " " + " ".join(sys.argv[4:]...
StarcoderdataPython
3312394
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Thu Aug 6 11:39:23 2015 @author: ibackus """ import pynbody as pb SimArray = pb.array.SimArray import numpy as np G = SimArray(1.0, 'G') kB = SimArray(1.0, 'k') def rho0_est(h, sigma): """ Estimates the midplane density vs r as .. math:: ...
StarcoderdataPython
3228345
SYMBOLS = {'|', '&', '^'} class Boolean: def __init__(self, exp, val, fe, se): self.exp = exp self.val = val self.fe = fe self.se = se def evaluator(arr): expr = "".join(arr) if len(arr) == 1 or len(arr) == 3: return [Boolean(expr, eval(expr), arr[0], arr[2] if le...
StarcoderdataPython
3268158
<reponame>Grapphy/python-osu """ MIT License Copyright (c) 2022 Grapphy 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 restriction, including without limitation the rights to use, copy,...
StarcoderdataPython
1618606
import numpy as np import pydart2 as pydart import QPsolver import IKsolve_one import momentum_con import motionPlan from scipy import optimize import yulTrajectoryOpt from fltk import * from PyCommon.modules.GUI import hpSimpleViewer as hsv from PyCommon.modules.Renderer import ysRenderer as yr from PyCommon.modules....
StarcoderdataPython
122670
<reponame>tflovorn/vo2mft<gh_stars>0 from uuid import uuid4 import subprocess import os import numpy as np from tetra.dos import DosValues_AllE from vo2mft.elHamiltonian import ElHamiltonian_Recip from vo2mft.lattice import _cubic_R from vo2mft.util import _run_dos_path def Dos(env, num_dos, n0, use_ctetra=True): ...
StarcoderdataPython
142017
#Queue.py #20 Oct 2017 #Written By <NAME> #DS & Algorithms With Python class Queue: def __init__(self): self.items=[] self.fronIdx=0 def __compress(self): newlst=[] for i in range(self.frontIdx,len(self.items)): newlst.append(self.items[i]) ...
StarcoderdataPython
80239
from . import audio
StarcoderdataPython
1670101
import pytest from maidchan.tasks import 占って @pytest.mark.parametrize( "birthday, expect", [ # fmt:off ("おひつじ座", 0), ("牡羊座", 0), ("0321", 0), ("0419", 0), ("おうし座", 1), ("牡牛座", 1), ("0420", 1), ("0520", 1), ("ふたご座", 2), ("双子座", 2), ("0521", 2), ("0621", 2), ("かに座", 3), (...
StarcoderdataPython
3363378
# This file is part of the # Garpar Project (https://github.com/quatrope/garpar). # Copyright (c) 2021, 2022, <NAME>, <NAME> and QuatroPe # License: MIT # Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE # ============================================================================= # DOCS # =====...
StarcoderdataPython
3245143
#!/usr/bin/env python # pylint: mode=test from absl.testing import flagsaver from grr_response_core.lib import config_lib from grr_response_core.lib.util import temp def SetUpDummyConfig(): with temp.AutoTempFilePath(suffix="yaml") as dummy_config_path: with flagsaver.flagsaver(config=dummy_config_path): ...
StarcoderdataPython
118952
<reponame>mdaal/rap from .utils import _download_data, _extract_type, _define_sweep_data_columns, _define_sweep_array import scipy.io import numpy as np def load_scandata(metadata, file_location, Verbose = True, **auth): ''' file_location is the locaiton of the scandata.mat file. It can be a URL, filename or /pat...
StarcoderdataPython
79044
<reponame>DjangoAdminHackers/django-link-report import link_report_settings from datetime import timedelta from django import forms from django.contrib import admin from django.contrib.sites.models import Site from django.core.exceptions import PermissionDenied from django.db.models import Count from django.template.de...
StarcoderdataPython
4834306
<reponame>Chronicles-of-AI/gcp-docai-pyservice # Copyright (c) 2021 <NAME> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import secrets from typing import Any, Dict, List, Optional, Union from pydantic import AnyHttpUrl, BaseSettings, EmailStr, HttpUrl, PostgresDsn, valida...
StarcoderdataPython
5562
<filename>gaphor/plugins/xmiexport/__init__.py """This plugin extends Gaphor with XMI export functionality.""" import logging from gaphor.abc import ActionProvider, Service from gaphor.core import action, gettext from gaphor.plugins.xmiexport import exportmodel from gaphor.ui.filedialog import FileDialog logger = lo...
StarcoderdataPython
4831949
<gh_stars>1-10 # -*- coding: utf-8 -*- """ sphinx.environment.managers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Manager components for sphinx.environment. :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ class EnvironmentManager(object): """Base...
StarcoderdataPython
4818373
""" Lunch Tables Ask the user to input how many people are in the lunchroom, and how many people can sit at each table. Output the number of people that will be left without a table. """ # Get user input people = input("How many people are in the lunchroom? ") table_limit = input("How many people can sit at a table? "...
StarcoderdataPython
133649
import cma import logging as log import numpy as np import os.path import pickle import humblerl as hrl from humblerl import ChainInterpreter, Mind, Worker from memory import build_rnn_model, MDNInterpreter from vision import BasicInterpreter, build_vae_model from common_utils import ReturnTracker, create_directory, ...
StarcoderdataPython
3333881
<gh_stars>0 one = 1 two = 2 three = 3 four = 4 five = 5 six = 6 seven = 7 height = 8 nine = 9 zero = 0
StarcoderdataPython
146587
<gh_stars>0 letters = ['o', 's', 'h', 'a', 'd', 'a'] print(letters.index('h')) print(letters.index('d')) print(max(letters)) print(min(letters)) print(letters.count('a')) print(letters.remove('h')) #after remove r from the list print(letters) #reverse the whole list print(letters.reverse()) print...
StarcoderdataPython
1737951
<reponame>fistaco/Smogon-Usage-Stats #!/usr/bin/python # -*- coding: latin-1 -*- import gzip import sys import json from common import * tier = str(sys.argv[1]) maxRD = 100 if (len(sys.argv) > 2): maxRD = float(sys.argv[2]) binSize = 0.01 if (len(sys.argv) > 3): binSize = float(sys.argv[3]) filename="Raw/"+tie...
StarcoderdataPython
185954
""" Parsers from NIST. """ # Standard library modules. import logging import re import os import pkgutil # Third party modules. # Local modules. import pyxray.parser.base as base from pyxray.descriptor import Reference, Element from pyxray.property import ElementAtomicWeight # Globals and constants variables. logge...
StarcoderdataPython
4801656
<filename>usaspending_api/broker/helpers/delete_fabs_transactions.py import logging from usaspending_api.common.helpers.timing_helpers import timer from usaspending_api.broker.helpers.delete_stale_fabs import delete_stale_fabs from usaspending_api.broker.helpers.store_deleted_fabs import store_deleted_fabs logger = ...
StarcoderdataPython
3206934
import sys import os import ast if "--silent" in sys.argv: os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" if "--cpu" in sys.argv or "--cpu_only" in sys.argv: os.environ["CUDA_VISIBLE_DEVICES"] = "-1" from math import sqrt from argparse import ArgumentParser, Namespace from datetime import datetime, timedelta from ...
StarcoderdataPython
3389707
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def rightSideView(self, root: TreeNode) -> List[int]: ans = list() def check(root, level, an...
StarcoderdataPython
17362
<filename>Stack.py # Erstellt aus vielen TIFF Datei eine stacked Datei mit dem ArcGIS # Tool composite bands import arcpy import os arcpy.env.overwriteOutput = True # Ueberschreiben fuer ArcGIS aktivieren arcpy.env.pyramid = "NONE" # Verhindert dass Pyramiden berechnet werden arcpy.env.rasterStatistics = "NONE"...
StarcoderdataPython
3349072
<filename>nova/tests/unit/scheduler/filters/test_numa_topology_filters.py # 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
3345289
# -*- coding: UTF-8 -*- """ Run module directly: $ python -m emoji hello world :wave: hello world 👋 """ from __future__ import print_function from __future__ import unicode_literals import argparse from emoji import __version__ from emoji import emojize def parse_arguments(argv=None): """ Return namespace wi...
StarcoderdataPython
1669020
<gh_stars>0 from django.apps import AppConfig class ChainsConfig(AppConfig): name = 'cajas.chains' verbose_name = 'Cadenas' def ready(self): try: import chains.signals # noqa F401 except ImportError: pass
StarcoderdataPython
3207530
<gh_stars>0 def if_elimination(card, p): if card == p: return True def if_elimination_converse(card, q): if card == q: return True def not_introduction(card, q): q[1] = not q[1] if if_elimination(card, q): q[1] = not q[1] return True else: q[1] = not q[1] ...
StarcoderdataPython
88353
import unittest import test class TestMethods(unittest.TestCase): def test_case_data(self): #print(test.dataread.data_corl()) el = ['a','b','c'] self.assertEqual(len(test.sklsetups.elements(el)), len(el)) if __name__ == '__main__': unittest.main()
StarcoderdataPython
4809454
<gh_stars>0 import os os.system("python train.py --dataroot .\\datasets\\font --model font_translator_gan --name test_new_dataset --no_dropout --batch_size 128 --style_channel 10")
StarcoderdataPython
3376428
<reponame>amber6hua/nazurin from enum import Enum from nazurin.config import env class PixivPrivacy(Enum): PUBLIC = 'public' PRIVATE = 'private' PRIORITY = 10 COLLECTION = 'pixiv' DOCUMENT = 'pixiv' with env.prefixed('PIXIV_'): REFRESH_TOKEN = env.str('TOKEN', default=None) IMG_PROXY = env.str('MI...
StarcoderdataPython
122600
<filename>TestNatural.py from unittest import TestCase from unittest.mock import patch from unittest.mock import Mock from NaturalNumber import NaturalNumber class TestNatural(TestCase): def test_compare(self): number_1 = NaturalNumber(3, [4, 1, 0]) number_2 = NaturalNumber(2, [3, 0]) numb...
StarcoderdataPython
135018
from methods import * ALG = KNeighborsClassifier VAR_PARAMS = { 'n_neighbors': 5, 'metric': 'minkowski', 'p': 2, 'n_jobs': 6 } FIRST_FAMILY = 2 LAST_FAMILY = None VERBOSE = 6 N_SAMPLES = 1
StarcoderdataPython
1631569
<filename>test/unit/test_utils_eds.py<gh_stars>1-10 import yaml from sovereign import config from sovereign.utils.eds import locality_lb_endpoints def test_eds_utility_adds_padding_to_zones_with_multiple_regions(): configs = list() configs.append(""" - address: google.com port: 443 proto: TC...
StarcoderdataPython
120328
"""""" import pytest from tests.PUMS.local_loader import LocalLoader local_loader_2019 = LocalLoader() local_loader_2012 = LocalLoader() EXPECTED_COLS_VALUES_CATEGORICAL = [ ( "SCHL", [ "N/A (less than 3 years old)", "No schooling completed", "Kindergarten", ...
StarcoderdataPython
3362171
from enum import Enum import openbiolink.evaluation.models.pykeen_models as pykeen_models class ModelTypes(Enum): # PYKEEN_TRANS_E = 'TransE_PyKeen' # PYKEEN_TRANS_R = 'TransR_PyKeen' TransE_Pykeen = pykeen_models.TransE_PyKeen TransR_Pykeen = pykeen_models.TransR_PyKeen
StarcoderdataPython
1765648
<reponame>ParikhKadam/eventsourcing from typing import Any, Dict from uuid import UUID from eventsourcing.application import Application from eventsourcing.examples.aggregate7.domainmodel import ( Snapshot, add_trick, project_dog, register_dog, ) from eventsourcing.examples.aggregate7.persistence impor...
StarcoderdataPython
3249079
import sys sys.path.append('../../') import config from pymongo import MongoClient class MongoMaintain(): __mongoClient = MongoClient(host=config.mongo_service_ip, port=config.mongo_service_port) __person_db = __mongoClient.person_database @classmethod def drop_collection(self): print("droppi...
StarcoderdataPython
3285219
<filename>aiohttp_s3_client/__init__.py<gh_stars>1-10 from .client import S3Client from .version import __author__, __version__, version_info __all__ = ( "S3Client", "version_info", "__author__", "__version__", )
StarcoderdataPython
1729722
import itertools from typing import Tuple, Sequence, Union from webdnn.graph.axis import Axis, AxisKeyDict class Order: """Order(axes) Descriptor class for representing semantics of data order. For example, :obj:`~webdnn.graph.order.OrderNHWC` means that the data is aligned as Channel-major (Batch-size...
StarcoderdataPython
3307478
<reponame>Gabriel-Scopel/Exs_Python<filename>ex4.py<gh_stars>0 #Exercício 1 #Faça um programa que leia uma quantidade de números que será digitada pelo usuário. Em seguida, digite todos os números, conforme quantidade digitada, e informe o maior deles. a = int(input("Digite a quantidade de números que serão digitados:...
StarcoderdataPython
1665344
<reponame>kleberfsobrinho/python s = 0 for c in range(0, 6): num = int(input('{}° Número: '.format(c+1))) if num % 2 == 0: s += num print('\nSoma: {}'.format(s))
StarcoderdataPython
1714743
<filename>backend/backend/user/notification.py<gh_stars>10-100 from django.contrib.auth.models import User from django.template.loader import render_to_string from backend.user.mail import send_mail def send_new_password_to_user(user=None, password=<PASSWORD>): try: from_mail = 'Test <<EMAIL>>' to_mails = [user.e...
StarcoderdataPython
1724562
<gh_stars>1-10 x, y = [int(x) for x in input().split()] if(x<y): print(x) else: print(y)
StarcoderdataPython
3288023
from collections import defaultdict from urllib.parse import urlencode from flask import g, Flask import settings from godmode.acl import ACL from godmode.models import models, model_map, model_hash def init_templates(app: Flask): app.context_processor(godmode_context_processor) app.add_template_filter(no_e...
StarcoderdataPython
188628
from tkinter import * from tkinter import filedialog import numpy as np import matplotlib.pyplot as plt import pandas as pd import time import random start_date = "2021-3-1" stop_date = "2021-3-31" start_time = "00:00:00" stop_time = "23:59:59" def mock_float(): mf = round(random.uniform(0.00, 2.00), 2) retu...
StarcoderdataPython
91029
<filename>test/test_bot.py import unittest from mock import MagicMock from pprint import pprint # from collections import OrderedDict class TestMatching(unittest.TestCase): def setUp(self): """ Tests setup """ pass def test_basic_csv_translation(self): """ Basi...
StarcoderdataPython
127211
from snowddl.blueprint import DatabaseBlueprint, DatabaseIdent from snowddl.parser.abc_parser import AbstractParser database_json_schema = { "type": "object", "properties": { "is_transient": { "type": "boolean" }, "retention_time": { "type": "integer" },...
StarcoderdataPython
1742127
""" This module creates the app gallery Enter details for new cards in the order you want them to appear in the gallery """ import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, MATCH import dash_bootstrap_components as dbc from apps import text from u...
StarcoderdataPython
3347045
<reponame>androm3da/clang_sles """ Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetAddress() obj.GetByteSize() obj.DoesBranch() obj.Print(None) obj.GetDescription(lldb.SBStream()) obj.EmulateWithFrame...
StarcoderdataPython
99169
#! /usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2019/3/10 7:04 PM # @Author : xiaoliji # @Email : <EMAIL> """ 判断是否为平衡二叉树 >>> t1 = '1,2,4,$,$,5,7,$,$,$,3,$,6,$,$' >>> t1 = deserialize_tree(t1) >>> isBalanced(t1) True >>> t2 = '1,2,4,$,$,5,7,8,$,$,$,$,3,$,6,$,$' >>> t2 = deseri...
StarcoderdataPython
1778304
""" Using SparkDataFrames and SQL to perform a query on a 20GB file """ import sys from IPython.core import ultratb from pyspark.sql.session import SparkSession from pyspark.sql.types import ( BooleanType, FloatType, IntegerType, StringType, StructField, StructType ) from pyspark.sql.functions ...
StarcoderdataPython
3234505
import pytest from src.stairlight.key import StairlightConfigKey from src.stairlight.source.gcs import ( GCS_URI_SCHEME, GcsTemplate, GcsTemplateSource, TemplateSourceType, ) class TestGcsTemplateSource: @pytest.fixture(scope="class") def gcs_template_source( self, stairlight_...
StarcoderdataPython
4810176
from moviepy.video.io.VideoFileClip import VideoFileClip from image_processing import ImageProcessing def video_processing(file_name): video_output = "output_videos/" + file_name[:-4] + "_result.mp4" image_processing = ImageProcessing.invoke clip1 = VideoFileClip(file_name) white_clip = clip1.fl_ima...
StarcoderdataPython