id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3441271
from django.http import HttpResponse from django.conf import settings from django.urls import reverse from falmer.auth.utils import create_magic_link_for_user from falmer.auth.models import FalmerUser from falmer.slack.models import SlackUser from .utils import verify_slack_hook, get_slacker_instance @verify_slack_h...
StarcoderdataPython
3334254
<reponame>mohammadfayaj/Django-Pro-Eshop<filename>checkout/urls.py<gh_stars>0 from django.urls import path from . import views app_name = "checkout" urlpatterns = [ path('address_info_/<int:id>/', views.check_out_view ,name='check-out'), path('payment_option_/', views.payment_option ,name='payment-options'...
StarcoderdataPython
5058327
import json import scrapy from ..settings import * from ..items import * class XimaTargetsSpider(scrapy.Spider): TARGET_CATES = [ '有声书', '段子', '情感生活', '娱乐', '影视', '儿童', '历史', '商业财经', 'IT科技', '个人成长', '头条', '二次元', ...
StarcoderdataPython
1882630
<filename>Collections-a-installer/community-general-2.4.0/scripts/inventory/landscape.py #!/usr/bin/env python # (c) 2015, <NAME> <<EMAIL>> # # This file is part of Ansible. # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division...
StarcoderdataPython
3296321
from guide.main import handler true = True false = False response = { "response": {"text": "Задаю простой вопрос...", "tts": "Задаю простой вопрос..."}, "version": "1.0", "session_state": {"scene": "SimpleQuestion"}, } REQUEST = { "meta": { "locale": "ru-RU", "timezone": "UTC", ...
StarcoderdataPython
4967344
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for implementations of L{IReactorThreads}. """ __metaclass__ = type from weakref import ref import gc, threading from twisted.python.threadable import isInIOThread from twisted.internet.test.reactormixins import ReactorBuilder from t...
StarcoderdataPython
324834
<reponame>KawashiroNitori/epicteller<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import time from typing import List, Optional, Iterable, Dict import base62 from sqlalchemy import select, and_, desc from epicteller.core.model.message import Message, TextMessageContent, ImageMessageContent, DiceMessageCo...
StarcoderdataPython
6480281
import requests import json ''' BOOK PREFIX VALUE genesis - gen, exodus - ex, leviticus - lev, numbers - num, deuteronomy - deu, joshua - joashua, judges - judges, 1 sammuel - 1sam, 2 samuel - 2sam ''' def get_book_prefix(book): prefix ="" if (book == "genesis"): prefix = "gen" elif (book == "exodus"): pre...
StarcoderdataPython
1765125
<reponame>hayesla/sunpy-soar<filename>sunpy_soar/attrs.py<gh_stars>1-10 import warnings import sunpy.net.attrs as a from sunpy.net.attr import AttrAnd, AttrOr, AttrWalker, DataAttr, SimpleAttr from sunpy.util.exceptions import SunpyDeprecationWarning __all__ = ['Product'] class Product(SimpleAttr): """ The ...
StarcoderdataPython
8101755
# -*- coding: utf-8 -*- # Copyright 2021 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type """ The Ntp_global parser templates file. This contains a list of parser definitions an...
StarcoderdataPython
8025624
import requests to_predict_dict = { "data": [ [4.8, 3, 1.4, 0.3], [2, 1, 3.2, 1.1] ] } url = 'http://1172.16.31.10:8000/api' r = requests.post(url, json=to_predict_dict) print(r.json())
StarcoderdataPython
3261159
from setuptools import setup, find_packages import os version = '1.3.0' # the number version of the package is the same than less.js version def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() long_description = ( read('README.txt') + '\n' + read('js', 'lesscss',...
StarcoderdataPython
3237803
# str_repr_test.py class foo: def __repr__(self): return "foo.repr" def __str__(self): return "foo.str" f = foo() print(f) print("str", str(f)) print("repr", repr(f)) print("{}", f"{f}") print("{!r}", f"{f!r}") print("{!s}", f"{f!s}")
StarcoderdataPython
1929106
"""The tests for the uptime sensor platform.""" import asyncio from datetime import timedelta import unittest from unittest.mock import patch from homeassistant.components.uptime.sensor import UptimeSensor from homeassistant.setup import setup_component from tests.common import get_test_home_assistant class TestUpt...
StarcoderdataPython
264846
# Copyright 2016 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/licenses/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython
6484957
<filename>paas-ce/paas/paas/common/tests.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT L...
StarcoderdataPython
3406367
<gh_stars>1-10 # Generated by Django 4.0.2 on 2022-03-06 20:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("boardmanlab", "0008_alter_helpsession_is_inperson_and_more"), ] operations = [ migrations.AlterField( model_name=...
StarcoderdataPython
4958267
def sumofpowersof2(n): # say n is 2 : 2**0+2**1+2**2 return (1<<n )-1 print sumofpowersof2(4)
StarcoderdataPython
5030136
# high res ocean regions import numpy as np import xarray as xr from xr_DataArrays import example_file, depth_lat_lon_names from paths import path_samoc from paths import file_ex_ocn_rect, file_RMASK_ocn, file_RMASK_ocn_rect, file_RMASK_ocn_low ocn_file = example_file('ocn') bll_AMO = (( 0, 60), (- 80, 0)) # (...
StarcoderdataPython
273958
########################################################################## # # Copyright 2010 VMware, Inc. # All Rights Reserved. # # 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 res...
StarcoderdataPython
4813353
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from pant...
StarcoderdataPython
106861
from exp.experiment import Experiment from exp.auctions import Auction def test_experiment_generates_auctions(): experiment = Experiment() assert experiment.auctions is not None assert len(experiment.auctions) > 0 for aid, auction in experiment.auctions.items(): assert type(auction) is Auction...
StarcoderdataPython
3591706
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): my_dict = {'insert_me': "Hello I'm from views.py"} return render(request, 'first_app/index.html', context=my_dict) def help(request): help_dict = {'help_me': 'hello from views.py'} ...
StarcoderdataPython
1949869
#!/usr/bin/env python2.7 # Forked from crowd-api # 15/12/2017 version 1.0 by <NAME> # - Add feature to update user metadata # - Add feature to get all active users import requests import json import random import string import logging class client(object): def __init__(self, **kwargs): if 'api_url' not in kwar...
StarcoderdataPython
4870378
#!/usr/bin/env python from iris_sdk.models.base_resource import BaseData from iris_sdk.models.maps.contact import ContactMap class Contact(ContactMap, BaseData): pass
StarcoderdataPython
385615
<reponame>Dheer08/Python-Projects programming_dictonary = { "Bug":"An error in program that prevents the program running as expected", "Function":"A piece of code that you can call over and over again", } # Retreive print(programming_dictonary["Bug"]) # Adding items programming_dictonary["Loop"] = "The action ...
StarcoderdataPython
12855633
<gh_stars>0 import pytest from GraphModels.models.Sarah.model_agricultural_water import AgriculturalWaterNodes from GraphModels.models.Sarah.model_freshwater_available import FreshwaterAvailableNodes from GraphModels.models.Sarah.model_municipal_water import MunicipalWaterNodes nodes_list = AgriculturalWaterNodes + ...
StarcoderdataPython
6625395
#!/usr/local/subliminal/env/bin/python from application.db import Session, Directory from application.direct import Subliminal, scan, notify import os import sys import argparse class Scanner(object): def __init__(self, directory_id): self.directory_id = directory_id self.session = Session() ...
StarcoderdataPython
3589348
<reponame>nikhiljain-413/Hacktoberfest2021_beginner # AUTHOR: <NAME> # Python3 Concept:String traversing # GITHUB: https://github.com/AadityaKumra #capitalize first letter of each word. #input-nikhil jain #output-Nikhil Jain def Capatalize_string(a): a = s.split(' ') n = (' '.join(word.capitalize() for word ...
StarcoderdataPython
11230494
# Generated by Django 2.2.7 on 2020-02-17 23:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('komax_app', '0003_auto_20200217_2235'), ] operations = [ migrations.AlterField( model_name='harnesschart', name='wir...
StarcoderdataPython
1864203
# Copyright 2016 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
StarcoderdataPython
11211691
<reponame>sakagarwal/python-aiplatform # -*- coding: utf-8 -*- # Copyright 2021 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 # # https://www.apache.org/licenses/LICENSE-2.0...
StarcoderdataPython
9639423
import torch import torch.nn as nn def L2_loss(l1,l2): loss = nn.MSELoss() losses = loss(l1,l2) return losses def L1_loss(l1,l2): loss = nn.L1Loss() losses = loss(l1,l2) return losses def cosine(l1,l2): loss = nn.CosineSimilarity() losses = loss(l1,l2) return losses
StarcoderdataPython
1968457
"""Switch for Cozytouch.""" import logging from cozytouchpy.constant import DeviceType from homeassistant.components.switch import SwitchEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import CONF_COZYTOUCH_ACTUATOR, COORDINATOR, DOMAIN _LOGGER = logging.getLogger(__name__) ...
StarcoderdataPython
8059873
<filename>my_slackclient.py import subprocess from slackclient import SlackClient import requests from requests.packages.urllib3.exceptions import InsecurePlatformWarning from requests.packages.urllib3.exceptions import SNIMissingWarning requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) requests.pack...
StarcoderdataPython
6427569
<gh_stars>10-100 import pytest from wh_habitica import default API_STATUS_UP = {default.JSON_STATUS: default.JSON_UP} LOCAL_NAME = '<NAME>' FACEBOOK_NAME = 'John Facebook' FACEBOOK_ID = '1337' GOOGLE_NAME = '<NAME>' USER_EMAIL = '<EMAIL>' API_USER = { default.JSON_ID: 42, default.JSON_AUTH: { default....
StarcoderdataPython
6565310
import numpy as np import json def dump_beautiful_json(annotation, path: str): def convert(o): if isinstance(o, np.generic): return o.item() raise TypeError # now write output to a file json_file = open(path, "w") # magic happens here to make it pretty-printed json_fil...
StarcoderdataPython
3285357
<reponame>wzh99/GSL from typing import Optional, List from tvm import transform import rule from gsl import attr, pat, op, spec, Workload, Subst from gsl.util import Timer class AlgCmp: def create_workload(self) -> Workload: raise NotImplementedError() def get_pass(self) -> Optional[transform.Pass]...
StarcoderdataPython
3494660
from sklearn.cluster import KMeans from .kmeans_torch import kmeans_torch import torch import numpy as np def localize_kmeans_sklearn(threshold=120, tol=1e-4): def localize(image, prev_location): n_flies = prev_location.shape[0] fly_pixels = torch.nonzero(image < threshold).type(torch.float32) ...
StarcoderdataPython
3526293
from unittest import TestCase from funpy.fundict import FunDict from logging_config_for_tests import logging_config logging_config() class TestFunDict(TestCase): def test_fundict(self): def filter_gr_1(k: str, v: str) -> bool: return k != '3' d = FunDict({1: 2, 2: 3, 3: 4}) ...
StarcoderdataPython
5104170
from __future__ import unicode_literals from django import forms from django.views.generic import TemplateView, DetailView from django.views.generic.edit import FormMixin from django.http import HttpResponseRedirect from multipageforms.forms.multiform import MultiForm from multipageforms.forms.multipageform import Mu...
StarcoderdataPython
1732234
<reponame>JasonLearning/dzdp_spider class ValidationFailure(RuntimeError): """ Raised by :meth:`Model.validate()` when the value given for a particular field is not valid. :ivar field_name: The value of the field's ``name`` attribute. :ivar description: A description of the failure. """ d...
StarcoderdataPython
1932934
<filename>examples/example_deviceiocontrol/processes.py from process_base import * from targets import * import subprocess import os class ProcessDeviceIo(ProcessBase): def __init__(self, Controller, crashdump_folder, breakpoint_handler, pid, ph, unique_identifier, verbose, logger): # Specific options self.path...
StarcoderdataPython
4828442
# Generated by Django 2.2.12 on 2020-05-29 12:15 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('video_pipeline', '0003_...
StarcoderdataPython
5110816
<filename>synced_side_bar_watcher.py import os import sublime import sublime_plugin isNotSyncedSideBarEnabled = True class SyncedSideBarRevealInSideBarCommand(sublime_plugin.WindowCommand): def run(self): self.window.run_command ("reveal_in_side_bar") def is_visible(self): # print( 'isNot...
StarcoderdataPython
1784990
from socket import * import threading from threading import Thread import tkinter import pyaudio import time def Receive(): while True: try: msg = client_socket.recv(BuffferSize).decode("utf8") if msg[0:12] == "{modifyList}": setNameList(msg[12:]) else: msg_list.insert(tkinter.END, msg) except OS...
StarcoderdataPython
11307105
<reponame>vyvojer/django-chatbot import logging from django_chatbot.models import Update from testapp.models import Note log = logging.getLogger(__name__) def default(update: Update): update.message.reply("I don't understand you :( /help") def start(update: Update): update.message.reply(""" Command list: ...
StarcoderdataPython
12852277
<reponame>dcdanko/MetaSUB_CAP<filename>scripts/alpha_diversity_stats.py #! /usr/bin/env python3 import sys import math import argparse as ap from json import dumps as jdumps from random import choices class LevelNotFoundException(Exception): pass def checkLevel(taxon, level): if level == 'species': ...
StarcoderdataPython
4856670
<reponame>fusion-research/TrajectoryNet<gh_stars>10-100 from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import math import numpy as np import tensorflow as tf from sklearn import preprocessing import os import inspect import sys import datetime im...
StarcoderdataPython
5086433
<filename>examples/cp/basic/house_building.py # -------------------------------------------------------------------------- # Source file provided under Apache License, Version 2.0, January 2004, # http://www.apache.org/licenses/ # (c) Copyright IBM Corp. 2015, 2016 # ----------------------------------------------------...
StarcoderdataPython
1852492
# Part 1 my_tuple = 1, my_tuple my_tuple[1] = 2 # Part 2 - Will Throw an Error # TypeError: 'tuple' object does not support item assignment person = ('Jim', 29, 'Austin, TX') name, age, hometown = person name age hometown
StarcoderdataPython
1706681
<reponame>danielroa98/mariAI import retro # Create the enviroment env = retro.make('SuperMarioBros-Nes', 'Level1-1') env.reset() # We need to loop while not DONE done = False while not done: # See whats happenin env.render() # Call a random button press from the controller # action = env.action_space...
StarcoderdataPython
9634480
from . import mass, redshift, spin
StarcoderdataPython
1605723
<reponame>Willtech/DistributedUrandom #!/usr/bin/python ## Distributed Urandom Increment Global CoOperative # DUIGCO API # entropy.py script # Source Code produced by Willtech 2021 # v0.1 hand coded by HRjJ ## setup dependencies import requests import time ##URL for delay from API *should be on local system* api_url ...
StarcoderdataPython
9724220
<filename>base/utils.py from django.contrib.auth.models import User from .models import SystemConfig def get_admin_config(): admin_users = User.objects.filter(is_superuser=True) system_config = SystemConfig.objects.all() if admin_users.count() == 0: raise RuntimeError('Please create a superuser!')...
StarcoderdataPython
8123650
<filename>fdk_client/platform/models/CompanyProfileValidator.py """Class Validators.""" from marshmallow import fields, Schema from marshmallow.validate import OneOf from ..enums import * from ..models.BaseSchema import BaseSchema class CompanyProfileValidator: class updateCompany(BaseSchema): ...
StarcoderdataPython
8127925
<reponame>GuangC-iScience/rnn-viscoelasticity #!/usr/bin/env python #! author: GC @ 11/25/2020 customized class for stacked RNN layers import numpy as np import tensorflow as tf import tensorflow.keras.backend as K from tensorflow.keras.models import load_model from tensorflow.keras.layers import LSTM, Dense, T...
StarcoderdataPython
3595597
<reponame>acocuzzo/python-pubsub # Copyright 2017, Google LLC 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 # # Unles...
StarcoderdataPython
5050960
import math import scipy import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy import stats from sklearn import metrics from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection i...
StarcoderdataPython
6497854
import torch import torch.nn as nn from torchdiffeq import odeint_adjoint as odeint from .wrappers.cnf_regularization import RegularizedODEfunc __all__ = ["CNF"] class CNF(nn.Module): def __init__(self, odefunc, T=1.0, train_T=False, regularization_fns=None, solver='dopri5', atol=1e-5, rtol=1e-5): supe...
StarcoderdataPython
3562406
# Copyright 2018 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
StarcoderdataPython
12841084
import torch from torch import Tensor from torch.nn.utils.rnn import pad_sequence from typing import List, Optional __all__ = [ 'to_tensor', 'truncate', 'add_token', ] def to_tensor(input: List[List[int]], padding_value: Optional[int] = None) -> Tensor: if padding_value is None: output = torc...
StarcoderdataPython
6447173
<filename>src/LP/solver/solution.py """ <NAME> - March 2021 Solution analyzer of the optimized model """ # Reads instances from the solver and creates plots # you can check the example that used networkx. although it is not very helpful import matplotlib.pyplot as plt import networkx as nx def print_solution_x(x): ...
StarcoderdataPython
377622
""" Holds all global app variables. """ SUPPLIER_DEFAULT_INVENTORY_INTERVAL = 86400 THK_VERSION_NUMBER = "2.0.0" THK_VERSION_NAME = "Arrakis" THK_CYCLE_PID = "ThunderhawkCycle" THK_CYCLE_LAST_POSITION = "thunderhawk cycle last position" """ Collections. """ MONGO_USERS_COLLECTION = "Users" MONGO_SUPPLIER_REGISTER_CO...
StarcoderdataPython
11246135
""" BACON = Building Autama's Core Overall Nature This file contains a class to handle generating an Autama's personality. """ from itertools import chain from random import choice, randint, seed from Nucleus.utils import get_dataset from Nucleus.tools import read_pickle class Bacon: def __init__(self): ...
StarcoderdataPython
74739
from fastapi import FastAPI from models import User, db app = FastAPI() db.init_app(app) @app.get("/") async def root(): # count number of users in DB return {"hello": "Hello!"} @app.get("/users") async def users(): # count number of users in DB return {"count_users": await db.func.count(User.id)....
StarcoderdataPython
1789099
from pacman.model.routing_tables.multicast_routing_table import \ MulticastRoutingTable from pacman.model.routing_tables.multicast_routing_tables import \ MulticastRoutingTables from spinn_machine.multicast_routing_entry import MulticastRoutingEntry from spinn_machine.utilities.progress_bar import ProgressBar...
StarcoderdataPython
1815925
from typing import List import attr from . import helpers from .action_test_summary_identifiable_object import ( ActionTestSummaryIdentifiableObject, ) @attr.s class ActionTestSummaryGroup(ActionTestSummaryIdentifiableObject): subtests: List[ActionTestSummaryIdentifiableObject] = attr.ib() @classmethod...
StarcoderdataPython
1718927
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2022 Osyris contributors (https://github.com/osyris-project/osyris) from common import arrayclose, arraytrue, arrayequal from osyris import Array, units from copy import copy, deepcopy import numpy as np from pint.errors import DimensionalityError import pytest ...
StarcoderdataPython
9648453
""" Test for quest load/save handling system """ import pytest from semver import VersionInfo # type: ignore from tick import TickType from quest import Quest, Difficulty, QuestDefinitionError, DEBUG_QUEST_NAME from quest.stage import DebugStage from quest.loader import all_quests from quest.content.debug import De...
StarcoderdataPython
285184
import sys import os def main(argv): print("") infile = "..\\days\\day3.txt" outfile = os.path.splitext(infile)[0] + '.dat' output = "day3_input:" + chr(10) with open(infile, 'r', encoding='utf-8-sig') as f: for line in f: line = line.strip() output += " dc.b\t'...
StarcoderdataPython
4834327
import logging import re import shutil from chibi.file import Chibi_path from chibi_dl.site.base.site import Site logger = logging.getLogger( "chibi_dl.sites.manga_plus.episode" ) class Episode( Site ): def download( self, path ): logger.info( "iniciando la descarga de las {} imagenes del ...
StarcoderdataPython
8002986
import os from itertools import filterfalse from typing import Iterable from . import strings from .utils import is_python_module def validate_paths(paths: Iterable[str]) -> None: non_existent_paths = list(filterfalse(os.path.exists, paths)) if not non_existent_paths: return non_existent_paths_...
StarcoderdataPython
11318003
# -*- coding: utf-8 -*- """QCDF-1.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/18Dia-C1cambzheRZ2fzIf1EAO0fte_0F """ !unzip "Captain Tsubasa.zip" import pandas as pd train = pd.read_csv('train.csv') train f = open("output.txt", "w") f.write...
StarcoderdataPython
3470429
from django.db import models from django.conf import settings from django.apps import apps from django.contrib.auth.hashers import make_password, check_password class UserPasswordHistory(models.Model): DEFAULT_PASSWORD_COUNT = 5 user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) ...
StarcoderdataPython
1745537
from ps4a import * # # Test code # You don't need to understand how this test code works (but feel free to look it over!) # To run these tests, simply run this file (open up in your IDE, then run the file as normal) def test_getWordScore(): """ Unit test for getWordScore """ failure = False # di...
StarcoderdataPython
11270940
<filename>nascd/ImprovedFishes/keras_baseline.py import time import tensorflow as tf import numpy as np from nascd.ImprovedFishes.load_data import load_data import matplotlib.pyplot as plt from sklearn.metrics import r2_score (X_train, y_train), (X_valid,y_valid)= load_data() class MyModel(tf.keras.Model): def _...
StarcoderdataPython
3470865
import pandas as pd from splinter import Browser from bs4 import BeautifulSoup def init_browser(): executable_path = {"executable_path":"/usr/local/bin/chromedriver"} return Browser("chrome", **executable_path, headless=False) url = "https://mars.nasa.gov/news/?page=0&per_page=40&order=publish_date+desc%2Cc...
StarcoderdataPython
8034612
<filename>torchwisdom/core/metrics/__init__.py from .metrics import *
StarcoderdataPython
1700709
<filename>setup.py from setuptools import setup, find_packages setup( name='currency-wallet', version='0.1.0', description="Track investment returns in multiple currencies through the National Bank of Poland's API.", packages=find_packages(include=['currency_wallet']), python_requires='>=3.6', ...
StarcoderdataPython
1776163
from __future__ import print_function, absolute_import, division from gi.repository import Gtk, cairo from toga.cassowary.widget import Container as CassowaryContainer class GtkContainer(Gtk.Fixed): def __init__(self, layout_manager): super(GtkContainer, self).__init__() self.layout_manager = la...
StarcoderdataPython
1855232
import numpy as np import pytest from qflow.hamiltonians import HarmonicOscillator from qflow.samplers import ImportanceSampler from qflow.wavefunctions import SimpleGaussian, Dnn from qflow.wavefunctions.nn.layers import DenseLayer from qflow.wavefunctions.nn.activations import ( sigmoid, tanh, relu, ...
StarcoderdataPython
5094894
<reponame>goerz-testing/pypkg_bintray_01 """Tests for `pypkg_bintray_01` package.""" import pytest from pkg_resources import parse_version import pypkg_bintray_01 def test_valid_version(): """Check that the package defines a valid ``__version__``.""" v_curr = parse_version(pypkg_bintray_01.__version__) ...
StarcoderdataPython
227452
<reponame>FarsetLabs/farset-nadine import os import time import urllib from datetime import datetime, timedelta, date import sys import tempfile import shutil import traceback from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from django.conf import settings ...
StarcoderdataPython
9712352
""" Tests for Year, Quarter, and Month-based DateOffset subclasses """ import pytest import pandas as pd from pandas.tseries.offsets import ( BMonthBegin, BMonthEnd, BQuarterBegin, BQuarterEnd, BYearBegin, BYearEnd, MonthBegin, MonthEnd, QuarterBegin, QuarterEnd, YearBegin,...
StarcoderdataPython
5149479
<filename>npt/search/__init__.py """ Query USGS/ODE API for image data products """ from npt import log def ode(dataset: str, bbox: dict, match: str = 'intersect', bbox_ref:str='C0'): """ Return GeoDataFrame with found data products as features Input: - dataset: name of the dataset (see `npt.datasets...
StarcoderdataPython
4869612
import os import uuid from decouple import config # Django from django.conf import settings from django.contrib import messages from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render, redirect from django.template import Context from django.template.loader import render_to_stri...
StarcoderdataPython
6608169
# Copyright (c) 2022 Food-X Technologies # # This file is part of foodx_backup_source. # # You should have received a copy of the MIT License along with # foodx_backup_source. If not, see <https://opensource.org/licenses/MIT>. import pathlib import typing import click import pytest from click.testing import CliRu...
StarcoderdataPython
213851
<gh_stars>1-10 # coding=utf-8 from tornado.web import authenticated from handlers.base_handler import BaseHandler from tornado.log import access_log as weblog from handlers.Project.project_manage_handler import get_project_list, get_user_list class TaskManageHandler(BaseHandler): @authenticated def get(self):...
StarcoderdataPython
5198866
<gh_stars>1-10 """ LLNotifyMixin """ from functools import partial from appdaemon import adbase as ad METHODS = ["success", "warning", "error", "alert", "confirm", "notify", "message"] METHODS_NO_MSG = ["dismiss_all", "ping"] class LLNotifyMixin(ad.ADBase): """ Helper function to make it easy to call add al...
StarcoderdataPython
3434024
resnext101_32_path = 'resnext_101_32x4d.pth'
StarcoderdataPython
186887
<filename>Desenv_Web/Desenv_Web/views.py from django.shortcuts import render from django.http import HttpResponse def index(request): return render(request, 'index.html') def contato(request): if request.method == 'GET': return render(request, 'login.html') else: print('Acesso vi...
StarcoderdataPython
6685098
<filename>ldt/tests/dicts/morphology/test_wordnet.py # -*- coding: utf-8 -*- import unittest import os os.environ["TESTING_LDT"] = "TRUE" import ldt from ldt.helpers.ignore import ignore_warnings class Tests(unittest.TestCase): """ The tests in this block inspect the WordNet morphological functions: lemm...
StarcoderdataPython
4984331
from django.contrib.auth.mixins import AccessMixin from django.core.exceptions import ImproperlyConfigured from django.utils import six class GroupRequiredMixin(AccessMixin): group_required = None def get_required_group(self): if self.group_required is None: raise ImproperlyConfigured( ...
StarcoderdataPython
1681057
a=1000 b=1000 c=30 if a>b and a>c: print (a) elif b>a and b>c: print (b) elif c>a and c>b: print(c)
StarcoderdataPython
5185919
#!/usr/bin/env python3 # ===================== # Зависнуть над маркером # ===================== from turtle import circle import numpy as np import rospy import cv2 import cv2.aruco as aruco from sensor_msgs.msg import Image from cv_bridge import CvBridge from aruco_calibration import Calibration as clb from drone_a...
StarcoderdataPython
6648692
opt = { "no_cuda": True, "task": "internal:blended_skill_talk,wizard_of_wikipedia,convai2,empathetic_dialogues", "multitask_weights": [ 1.0, 3.0, 3.0, 3.0 ], "init_model": "./data/models/blender/blender_90M/model", "dict_fil...
StarcoderdataPython
6424244
#https://github.com/MerosCrypto/Meros/issues/106. Specifically tests elements in Blocks (except MeritRemovals). #Types. from typing import Dict, List, IO, Any #Sketch class. from PythonTests.Libs.Minisketch import Sketch #Blockchain classes. from PythonTests.Classes.Merit.Blockchain import Block from PythonTests.Cla...
StarcoderdataPython
3339213
<reponame>khalili-itelligence/basic<gh_stars>0 # import argparse # parse = argparse.ArgumentParser(description="ForTest!") # parse.add_argument('integers', type=int) # print(parse.parse_args()) import sys print("Result:", sys.argv)
StarcoderdataPython
5047630
import matplotlib ''' To use the Agg backend ''' matplotlib.use('Agg') from pandas_datareader.data import DataReader import matplotlib.pyplot as plt import urllib.request import re import datetime '''gets historical prices from pandas datareader''' def getdata(ticker): data = DataReader(ticker, 'yahoo') retur...
StarcoderdataPython