id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3232048
number_of_transactions=int(input()) transactions_made=0 account_balance=0 while transactions_made < number_of_transactions: transaction_value=float(input()) if transaction_value<0: print(f'Invalid operation') break account_balance +=transaction_value transactions_made+=1 pr...
StarcoderdataPython
4811077
<reponame>kayoon/starsea from flask import Flask,jsonify,render_template,request app = Flask(__name__) class aa(object): def js(self,data='hellow'): return data @app.route('/login') def login(): return render_template('login.html') @app.route('/index') def index(): return render_template('index...
StarcoderdataPython
1707953
import torch import torch.nn as nn import torch.nn.functional as F from model_submission.model.base_network import BaseNetwork from model_submission.model.utils import gen_conv, gen_deconv from model_submission.model.splitcam import ReduceContextAttentionP1, ReduceContextAttentionP2 class TwostagendGenerator(BaseNetw...
StarcoderdataPython
3220856
<gh_stars>0 import re import pandas as pd from tqdm import tqdm def get_strophe_amount(text, pattern): text.replace("\r", "") return len(re.findall(pattern, text)) def get_verse_amount(text): return sum(1 for line in text.splitlines() if line.strip()) def get_word_amount(text): return len(text.spli...
StarcoderdataPython
4821439
<reponame>vaziozio/sentiment-analysis-app import datetime #json to count tweets_count = {0:{'Negativo':0,'Neutro':0,'Positivo':0}, 1:{'Negativo':0,'Neutro':0,'Positivo':0}, 2:{'Negativo':0,'Neutro':0,'Positivo':0}, 3:{'Negativo': 0, 'Neutro': 0, 'Positivo': 0}, ...
StarcoderdataPython
1695317
<reponame>Waifu-im/waifu-api import os import urllib from typing import Set import asyncpg from fastapi import APIRouter, Request, HTTPException, Depends, Query from fastapi.responses import Response from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from fastapi_limiter.depends import RateL...
StarcoderdataPython
1715902
# -*- coding: utf-8 -*- """ hashing handlers exceptions module. """ from pyrin.core.exceptions import CoreException, CoreBusinessException class HashingHandlerException(CoreException): """ hashing handler exception. """ pass class HashingHandlerBusinessException(CoreBusinessException, ...
StarcoderdataPython
39005
<filename>level_3/challenge_2.py ''' Compute a digest message ''' def answer(digest): ''' solve for m[1] ''' message = [] for i, v in enumerate(digest): pv = message[i - 1] if i > 0 else 0 m = 0.1 a = 0 while m != int(m): m = ((256 * a) + (v ^ pv)) / 129.0 ...
StarcoderdataPython
83846
<filename>respa_exchange/__init__.py<gh_stars>10-100 __version__ = "0.1.0" default_app_config = 'respa_exchange.apps.RespaExchangeAppConfig'
StarcoderdataPython
3222123
<reponame>WesGtoX/agro-digital<gh_stars>0 from django.urls import reverse from django.contrib.auth import get_user_model from rest_framework import status from rest_framework.authtoken.models import Token from rest_framework.test import APITestCase, APIClient from .fixture import RegiaoFactory User = get_user_model(...
StarcoderdataPython
1633093
<filename>tests/base.py import unittest from mock import MagicMock from elasticmagic import Cluster, Index class BaseTestCase(unittest.TestCase): maxDiff = None def setUp(self): self.client = MagicMock() self.cluster = Cluster(self.client) self.index = Index(self.cluster, 'test') ...
StarcoderdataPython
3305485
#<NAME>, zadanie 3- rysowanie wykresow funkcji x^2+5 import matplotlib.pyplot as plt import numpy as np def function(x): return x**2+5 x1 = np.linspace(-1,1) x2 = np.linspace(-6,6) x3 = np.linspace(0,5) fig, ax = plt.subplots(3,1) fig.set_size_inches(6, 18) y1 = function(x1) ax[0].plot(x1, y1, label = 'x^2+5') ...
StarcoderdataPython
40857
# (C) Copyright 2021 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
StarcoderdataPython
6262
from terra_sdk.exceptions import LCDResponseError from terrakg import logger # Logging from terrakg.client import ClientContainer logger = logger.get_logger(__name__) class Rates: """ Access the most recent rates. """ def __init__(self, client: ClientContainer): self.client = client de...
StarcoderdataPython
1771788
for k in range(int(input())): X = int(input()) if X == 0: print("NULL") continue res = "EVEN " if X%2 == 0 else "ODD " res += "POSITIVE" if X > 0 else "NEGATIVE" print(res)
StarcoderdataPython
110065
from .block_nbt import Block_nbt from .item import Item containers = {'chest': 26, 'trapped_chest': 26, 'dispenser': 8, 'furnace': 2, 'brewing_stand': 4, 'hopper': 4, 'dropper': 8, 'shulker_box': 26, 'barrel': 26, 'smoker': 2, 'blast_furnace': 2, 'campfire': 3, 'soul_campfire': 3, 'lectern': 0} class Container(): ...
StarcoderdataPython
91777
import os import requests import tarfile import urllib.request import zipfile from tqdm import tqdm def maybe_download_from_url(url, download_dir): """ Download the data from url, unless it's already here. Args: download_dir: string, path to download directory url: url to download from ...
StarcoderdataPython
183762
#!/usr/bin/env python # -*- encoding: utf-8 -*- import sys import splunk from splunk import rest from random import choice import re from re import search import time import logging import xml.dom.minidom import xml.sax.saxutils import os import json import requests from requests import get import socket import csv fro...
StarcoderdataPython
1640174
<reponame>marcelcaraciolo/nextgen-pipeline import os import subprocess import re import sys def runCommand(message, command): subprocess.check_call(command, shell=True) def splitPath(path): (prefix, base) = os.path.split(path) (name, ext) = os.path.splitext(base) return (prefix, name, ext) def make_s...
StarcoderdataPython
130518
import telebot from telebot import types from loguru import logger import settings from Bot.UserManager import UserManager, User @logger.catch def Bot(bot : telebot.TeleBot): UM = UserManager() @bot.message_handler(commands = ['start']) @UM.Wraps @logger.catch def start_func(message : types.Message, user ...
StarcoderdataPython
3298238
import torch.nn as nn import torch def conv3x3(in_channels, out_channels, stride=1): return nn.Conv2d(in_channels=in_channels, out_channels=out_channels, stride=stride, padding=1, kernel_size=3, bias=False) class BasicBlock(nn.Module): def __init__(self, in_channels, out_channels, downsample=None, ...
StarcoderdataPython
1646043
from django.db import models # Create your models here. from register.models import Proveedor, Colegio, PersonalColegio, ProveedorColegio from utils.models import ActivoMixin, CreacionModificacionFechaMixin, CreacionModificacionUserMixin from utils.middleware import get_current_colegio from income.models import obtene...
StarcoderdataPython
3251697
#!/usr/bin/python3 # -*- coding: utf-8 -*- # from trainer import Trainer import pyximport pyximport.install() from cython_train.trainer_cython import Trainer from ssd_v2 import SSD300v2 import keras import argparse def main(): parser = argparse.ArgumentParser(description="Training ssd model with keras") pars...
StarcoderdataPython
3310044
#!/usr/bin/env python import matplotlib import numpy as np matplotlib.use('Agg') # Required for headless operation. from matplotlib import pyplot as plt # noqa: E402 isort:skip # Vertices. Ys = np.array([ [-2.0, 0.6], [-1.5, 0.0], [-0.5, 0.3], [+0.5, 0.3], [+1.5, 0.0], [+2.0, 0.6], ]) # Ed...
StarcoderdataPython
3270921
<filename>cogs/lichess.py from discord.ext import commands class Lichess(commands.Cog): def __init__(self, bot): self.bot = bot @commands.group(brief='Commands for using Lichess', invoke_without_command=True) async def lichess(self, ctx): await ctx.send_help(ctx.command) def setup(bot...
StarcoderdataPython
3334787
from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import tensorflow as tf import tensorflow_hub as hub from modeling import tf_utils import bert.bert_modeling as bert_modeling import bert.bert_models as bert_models import models.coqa_layers as ...
StarcoderdataPython
4822898
<reponame>ChrisWeaver1/enigma<gh_stars>0 import argparse from .m3.data import rotors, reflectors from .m3.enigma import enigma from .m3.settings import settings from .common import character_arrays from .web import start refs = reflectors().names rots = rotors().names def run(): parser = setup_parser() ...
StarcoderdataPython
1696568
import sys import re import os.path replfile = sys.argv[1] if not os.path.isfile(replfile): exit(0) raw_paths = sys.stdin.read() ymlfiles = raw_paths.split('\n') ymlfiles = [path.strip() for path in ymlfiles if len(path.strip()) > 0] mapping = [] with open(replfile) as f: for line in f.readlines(): ...
StarcoderdataPython
183898
<reponame>og2701/C-3PO<filename>library/cogs/rss_feed.py<gh_stars>1-10 from discord.ext.commands import Cog, command from discord.ext import tasks from discord import Embed, Client from feedparser import parse client = Client() class RSS(Cog): def __init__(self, bot): self.bot = bot self.SWnews.start() @tas...
StarcoderdataPython
3227645
""" Reference: - Discord.py API Reference: https://discordpy.readthedocs.io/en/latest/api.html# - Get TOKEN of your bot: https://discord.com/developers/applications, select APP -> Bot -> reveal/create Token """ import asyncio from abc import ABC, abstractmethod from dataclasses import dataclass from pathlib import Pat...
StarcoderdataPython
3327019
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException...
StarcoderdataPython
101757
<filename>attention-xml/deepxml/dataset.py<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 """ Created on 2018/12/10 @author yrh """ import numpy as np import torch from torch.utils.data import Dataset from scipy.sparse import csr_matrix from tqdm import tqdm from typing import Sequence, Optional, Union __...
StarcoderdataPython
35997
<filename>nbody/setup.py from distutils.core import setup from Cython.Build import cythonize setup(name="nbody", ext_modules=cythonize("nbody.pyx"))
StarcoderdataPython
165839
import sys from datetime import datetime from jinja2.loaders import FileSystemLoader from typing import Dict, Any, List from pdb import set_trace import toml from jinja2 import Environment def usage(): print("""python render.py FILENAME""") quit() def content_or_blank(local_config:Dict[str, Any], keys:List...
StarcoderdataPython
1756964
import pytest import os from web3.utils.compat import ( Timeout, ) from ethereum import tester import sign from fixtures import ( create_contract, contract, token_contract, channels_contract, save_logs, print_logs, get_gas_used, print_gas_used, get_balance_message, decimals...
StarcoderdataPython
1689955
<filename>docs/examples/container/rancher/deploy_container.py from libcloud.container.types import Provider from libcloud.container.providers import get_driver from libcloud.container.base import ContainerImage driver = get_driver(Provider.RANCHER) connection = driver( "MYRANCHERACCESSKEY", "MYRANCHERSECRETKE...
StarcoderdataPython
3378257
from __future__ import print_function from functools import wraps from functools import partial import imp import sys import pytest # import pytest.runner from compat import PY2, PY3, exec_ PYPY = '__pypy__' in sys.builtin_module_names OBJECTS_CODE = """ class TargetBaseClass(object): "documentation" class Tar...
StarcoderdataPython
144785
# coding: utf-8 # In[1]: import math import torch from torch.nn.parameter import Parameter import torch.nn.functional as F import torch.nn as nn Module = nn.Module import collections from itertools import repeat # In[2]: def _ntuple(n): def parse(x): if isinstance(x, collections.Iterable): ...
StarcoderdataPython
35253
#!/usr/bin/env python # -*- coding: utf-8 -*- from functools import update_wrapper, wraps def disable(func): """ Disable a decorator by re-assigning the decorator's name to this function. For example, to turn off memoization: >>> memo = disable """ return func def decorator(decorator_func...
StarcoderdataPython
3308080
<filename>src/graph-algo/benchmark_schedule_quality.py ''' Created on January 19, 2014 @author: aousterh ''' import random import sys import unittest sys.path.insert(0, '../../bindings/graph-algo') import structures import structuressjf import admissible import admissiblesjf import fpring import genrequests class p...
StarcoderdataPython
1644264
# # snimpy -- Interactive SNMP tool # # Copyright (C) <NAME> <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "A...
StarcoderdataPython
174887
""" gevent_tasks ~~~~~~~~~~~~ Tasks executing in ``gevent`` Pool .. note:: You need to apply gevent monkey-patch yourself, see `docs <http://www.gevent.org/gevent.monkey.html>`_ """ from concurrent import futures from gevent.pool import Pool import gevent from .tasks import Task,...
StarcoderdataPython
3240392
import json import os import settings #todo move to file*.py class FilterAppendRule(object): # decoder encoder todo # switch selector/parser automatically todo def json_dict_parse(self, string): #from json to dict return json.loads(string) def dict_selector(self, current_...
StarcoderdataPython
107169
<gh_stars>10-100 import komand from .schema import SearchWhoisInput, SearchWhoisOutput # Custom imports below from komand_passivetotal.util import util class SearchWhois(komand.Action): def __init__(self): super(self.__class__, self).__init__( name="search_whois", description="Sea...
StarcoderdataPython
4839230
# Generated by Django 2.1 on 2018-11-14 16:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('filestorage', '0006_file_hashed'), ] operations = [ migrations.AddField( model_name='file', name='mimetype', ...
StarcoderdataPython
3205987
<reponame>LITTOMA/fontgen import os import struct from os.path import join from zlib import crc32 from PIL import Image class IconEntry(object): def __init__(self, name, data): self.name, self.data = name, data self.crc = crc32(self.name) % (1 << 32) self.offset = 0 def encode_image(pat...
StarcoderdataPython
1690453
<filename>python/cudf/cudf/utils/dtypes.py import numpy as np import pandas as pd from pandas.api.types import pandas_dtype from pandas.core.dtypes.dtypes import CategoricalDtype, CategoricalDtypeType def is_categorical_dtype(obj): """Infer whether a given pandas, numpy, or cuDF Column, Series, or dtype is a ...
StarcoderdataPython
150686
""" Base Message types to be used to construct ace messages. """ from edx_ace.message import MessageType from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers class BaseMessageType(MessageType): # lint-amnesty, pylint: disable=missing-class-docstring def __init__(self, *args,...
StarcoderdataPython
3222195
import json import re from urllib.parse import urlparse import scrapy from scrapy.selector import Selector from locations.items import GeojsonPointItem from locations.hours import OpeningHours class GoldsGymSpider(scrapy.Spider): name = "goldsgym" item_attributes = { 'brand': "Gold's Gym" } allowed_domai...
StarcoderdataPython
3290897
<gh_stars>0 #Add code to the above program to figure out who has the most messages in the file. #After all the data has been read and the dictionary has been created, #look through the dictionary using a maximum loop (see Chapter 5: Maximum and minimum loops) # to find who has the most messages and print how many me...
StarcoderdataPython
3368770
# ---------------------------------------------------------------------- # | # | LibraryModificationHelpers.py # | # | <NAME> <<EMAIL>> # | 2017-09-11 07:35:58 # | # ---------------------------------------------------------------------- # | # | Copyright <NAME> 2017-18. # | Distributed under ...
StarcoderdataPython
1697050
""" https://portswigger.net/web-security/ssrf/lab-ssrf-filter-bypass-via-open-redirection """ import sys import requests site = sys.argv[1] if 'https://' in site: site = site.rstrip('/').lstrip('https://') s = requests.Session() stock_url = f'https://{site}/product/stock' page = '/product/nextProduct' paramete...
StarcoderdataPython
3396149
class Solution: def XXX(self, digits): """ :type digits: List[int] :rtype: List[int] """ prev = 1 i = 1 while(i <= len(digits)): if digits[-i] + prev == 10: prev = 1 digits[-i] = 0 i += 1 ...
StarcoderdataPython
3388841
from pathlib import Path import argparse from utils.tokenizer import Tokenizer from utils.dataset import ChestXrayDataSet, collate_fn from torchvision import transforms import torch from trainer import Trainer from generator import Generator from models.model_base import EncoderDecoderModel from models.transfo...
StarcoderdataPython
3247202
<reponame>LongTailBio/pangea-django from django.urls import path from .views import get_redirect urlpatterns = [ path('<name>', get_redirect, name='get-redirect'), ]
StarcoderdataPython
3359953
# -*- coding: utf-8 -*- from collections import deque from functools import partial from math import sqrt from ..errors import ArgumentError, InternalError, ModelError from .. import compat __all__ = [ "CALCULATED_AGGREGATIONS", "calculators_for_aggregates", "available_calculators", "aggregate_calcul...
StarcoderdataPython
1745928
<filename>DatabaseServer/database_server.py from __future__ import print_function, absolute_import, division, unicode_literals # This file is part of the ISIS IBEX application. # Copyright (C) 2012-2016 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it w...
StarcoderdataPython
131480
<reponame>shatgupt/getmycourses import email.message import json import logging import os import re import shutil import smtplib import urllib.request from http.cookiejar import CookieJar import lxml.html from flask import Flask, abort, jsonify from google.cloud import storage from lxml.cssselect import CSSSelector C...
StarcoderdataPython
150144
<filename>ratelimiter.py import logging import time from functools import wraps from flask import request, jsonify import redis r = redis.StrictRedis(host='localhost', port=6379, db=0) logger = logging.getLogger(__name__) def rate_limit(limit=10, interval=60, shared_limit=True, key_prefix="rl"): def rate_limit_...
StarcoderdataPython
1635888
import requests import html from dateutil.parser import parse from bs4 import BeautifulSoup from urllib.parse import urlparse, parse_qs from webcache.utils import same_url class Google(object): @staticmethod def download_cache(url): """ Download cache from a cache url """ r = r...
StarcoderdataPython
110744
<filename>exp/exception_handling_dynamic_creation.py a = type('a_fyerr', (Exception,), {}) try: raise a('aa') except Exception as e: print(type(e))
StarcoderdataPython
3216513
<filename>hypernets/utils/param_tuning.py # -*- coding:utf-8 -*- __author__ = 'yangjian' """ """ import copy import time import pandas as pd from hypernets.conf import configure, Configurable, String, Int as cfg_int from hypernets.core import TrialHistory, Trial, EarlyStoppingError from hypernets.core.ops import Iden...
StarcoderdataPython
89042
<gh_stars>0 from django.contrib import admin from .models import Product, Point, Transaction, Category, SubCategory, Manufacturer class SubCategoryInline(admin.TabularInline): model = SubCategory extra = 0 class SubCategoryAdmin(admin.ModelAdmin): model = SubCategory list_display = ('name','category...
StarcoderdataPython
3273357
""" MIT License Copyright (c) 2021 TheHamkerCat 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, modify, merge, publish, di...
StarcoderdataPython
175773
import unittest, sys, os, io, copy import numpy as np import cctk if __name__ == '__main__': unittest.main() class TestOrca(unittest.TestCase): def test_write(self): read_path = "test/static/test_peptide.xyz" path = "test/static/test_peptide.inp" new_path = "test/static/test_peptide_co...
StarcoderdataPython
61299
import sqlite3 from typing import Union, Any, List import re mydb = sqlite3.connect("Routing") cursor = mydb.cursor() cursor_2 = mydb.cursor() route_tables = [] def get_db_tables_with_data() -> list: """Gets database tables. If table is empty pass""" full_dbs = [] get_tables = cursor.execu...
StarcoderdataPython
58832
<reponame>faisalarkan21/TensorFlow-Examples import tensorflow as tf const = tf.constant(2.0) # b and c should using tf.global_variables_initializer() b = tf.Variable(2.0) c = tf.Variable(1.0) d = tf.add(b, c) e = tf.add(c, const) a = tf.multiply(d, e) # for init Variable not constant init_op = tf.global_variables_i...
StarcoderdataPython
3399142
# -*- coding: utf-8 -*- #微信支付配置 获取收款二维码 # ========支付相关配置信息=========== import random import time import hashlib from random import Random from bs4 import BeautifulSoup import requests import setting import qrcode import setting APP_ID = setting.WeinXin.APP_ID # 你公众账号上的appid MCH_ID = setting.WeinXin.MCH_ID...
StarcoderdataPython
21395
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import ...
StarcoderdataPython
3330845
class TableItems(object): def __init__(self, table=None, max_recursion_create=5): self.table = table self.max_recursion_create = max_recursion_create def generate_key(self, item=None, hash_attr=None, range_attr=None): key = {} if item is not None: key.update(self.get...
StarcoderdataPython
3214345
from distutils.core import setup import py2exe setup(console=['EyeTribe_Matlab_server.py'], options={'py2exe':{"bundle_files":1}}, zipfile=None)
StarcoderdataPython
1773375
<reponame>verejnedigital/verejne.digital<gh_stars>10-100 """Functions reporting status of our data (source and prod). These functions are primarily invoked by server hooks of our backend application data. """ import collections import datetime import os from db.db import DatabaseConnection import utils def _get_ta...
StarcoderdataPython
176021
<reponame>Bootsmaat/Mimic<gh_stars>100-1000 #!usr/bin/env python # -*- coding: utf-8 -*- """ Functions that actually make mFIZ work. """ try: import pymel.core as pm MAYA_IS_RUNNING = True except ImportError: # Maya is not running pm = None MAYA_IS_RUNNING = False # General Imports from collections...
StarcoderdataPython
1604611
# -*- coding: utf-8 -*- from setuptools import setup, find_packages setup( name='cron-rest', version='1.0.0', description='A simple Cron REST API', url='https://github.com/eug/cron-rest', author='<NAME>', author_email='<EMAIL>', license='MIT', classifiers=[ 'Development Status :...
StarcoderdataPython
21599
<reponame>habibmuhammadthariq/iq_gnc<gh_stars>0 #! /usr/bin/env python #ros library #import rospy #import the API #from iq_gnc.py_gnc_functions import * #print the colours #from iq_gnc.PrintColours import * # Importing Point message from package geometry_msgs. #from geometry_msgs.msg import Point #import opencv library...
StarcoderdataPython
3301156
<gh_stars>0 class stack: def __init__(self): self.__items=[] def push(self,elem): self.__items.append(elem) def pop(self): return self.__items.pop() def isEmpty(self): return self.__items==[] def size(self): return len(self.__items) def peek(se...
StarcoderdataPython
3333820
from typing import Text, Dict, Any from slack import WebClient import os import logging class Message(object): def __init__(self): self.__logger = logging.getLogger(__name__) def __get_template(self) -> Dict[str, Any]: return { "channel": None, "blocks": [{ ...
StarcoderdataPython
2449
<gh_stars>0 __all__ = ['EnemyBucketWithStar', 'Nut', 'Beam', 'Enemy', 'Friend', 'Hero', 'Launcher', 'Rotor', 'SpikeyBuddy', 'Star', 'Wizard', 'EnemyEquipedRotor', 'CyclingEnemyObject', ...
StarcoderdataPython
3318356
from MCPM import utils from MCPM.cpmfitsource import CpmFitSource if __name__ == "__main__": # We want to extract the light curve of ob160795 channel = 52 campaign = 91 ra = 271.001083 dec = -28.155111 half_size = 2 n_select = 10 l2 = 10**5.35 t_0_a = 7512.6 u_0_a = .12 t_...
StarcoderdataPython
3387413
<reponame>tolyadouble/sqlibrist # -*- coding: utf8 -*- import sqlibrist import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='sqlibri...
StarcoderdataPython
150077
<gh_stars>1-10 from tottle.api import API from .abc import ABCRouter from ..views import MessageView class BotRouter(ABCRouter): views = {"message": MessageView()} async def route(self, event: dict, api: "API"): for view in self.views.values(): if not await view.processor(event): ...
StarcoderdataPython
3280899
# This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
StarcoderdataPython
4803681
<filename>test_gamer_pytest.py from gamer import Gamer class Test_gamer: def setup(self): self.gamer = Gamer('Valery') def teardown(self): pass def test_init(self): assert self.gamer.name == 'Valery' assert self.gamer.cards == [] def test_get_name(self): asser...
StarcoderdataPython
2424
<reponame>lvwuyunlifan/crop import os from PIL import Image, ImageFilter import matplotlib.pyplot as plt import matplotlib.image as mpimg # import seaborn as sns import pandas as pd import numpy as np import random train_path = './AgriculturalDisease_trainingset/' valid_path = './AgriculturalDisease_validationset/' ...
StarcoderdataPython
46742
<gh_stars>1-10 from django.apps import AppConfig from django.utils.importlib import import_module class OffersConfig(AppConfig): name = 'commercia.offers' verbose_name = "Offers" def ready(self): import_module('commercia.offers.collections') import_module('commercia.offers.signals')
StarcoderdataPython
8331
<gh_stars>0 # 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 writing, sof...
StarcoderdataPython
1735175
from random import shuffle import glob import sys import numpy as np import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras.models import model_from_json from tensorflow.keras.optimizers import Adam dirsep = '/' csvdelim = ',' pathData='./ogle/data' pathWeight = './models/cnn.h5' # Th...
StarcoderdataPython
183880
<gh_stars>1-10 from ..predefined_components import PredefinedComponent from control_block_diagram.components import Box class Divide(PredefinedComponent): """ Rectangular divide block """ def __init__(self, position, size: (tuple, list) = (0.4, 0.8), inputs: str = 'left', input_space=0.4, ...
StarcoderdataPython
1795318
# Data Preprocessing # Importing the libraries from sklearn.preprocessing import Imputer import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Data.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 3].values # Taking care of missing data imputer...
StarcoderdataPython
3271418
from pathlib import Path import numpy as np import pytest import bmds @pytest.fixture(scope="session") def vcr_config(): return { "filter_headers": [("authorization", "<omitted>")], } @pytest.fixture(scope="session") def data_path(): return Path(__file__).parent.absolute() / "data" @pytest.f...
StarcoderdataPython
3294630
<gh_stars>0 import argparse import os import glob from collections import defaultdict from split import load_dataset # compares `original_test_filename` with `model_predicted_filename` under all paths, and merge the results # paths could be like ['splitted_0/fold-0', 'splitted_0/fold-1', ..., 'splitted_1/fold-0'...] ...
StarcoderdataPython
4831098
<gh_stars>0 from models import Yolov4 import torch from tool.utils import post_processing, plot_boxes_cv2 from dataset import resize_image import cv2 import numpy as np def plot_lines(image, boxes): width = img.shape[1] height = img.shape[0] angled = np.sqrt(width ** 2 + height ** 2) for box in boxes:...
StarcoderdataPython
3399732
# Generated by Django 3.1.3 on 2020-11-17 17:14 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('network', '0006_auto_20201116_1705'), ] operations = [ migrations.AddField...
StarcoderdataPython
3297829
####### # getMeanSdEro.py: calculate the time lapse of all events recorded, mean and standard diviation of all # of the replay, and error of the above two # argv[1]: recordedEvents.txt # argv[2]: replayTimeSet.txt ####### import math import sys from utils import round_up # function to calculate the mean and standard ...
StarcoderdataPython
1617546
session.forget() response.menu = [['home', False, '/%s/default/index' % request.application], ['docs', True, '/%s/global/vars' % request.application]] def vars(): """the running controller function!""" if not request.args: ( doc, keys, ...
StarcoderdataPython
111952
import pywhatkit as kit #installpywhatkit import os kit.sendwhatmsg("Enter your friends phone no. and add country code","Enter Your Message",24,00) #at the end enter time in 24 hours format os.system("taskkill /im chrome.exe /f") #it will close the browser os.system("shutdown /s /t 1") #it will shutdown the pc
StarcoderdataPython
4829591
<reponame>Jerrynicki/stalkbot-rewrite import threading import json import tkinter as tk import time class App(): def __init__(self, bot, config, features_toggle, command_log, blacklist): self.bot = bot self.config = config self.features_toggle = features_toggle self.command_log = command_log self.user_black...
StarcoderdataPython
125223
<gh_stars>10-100 from .PresetsProvider import PresetsProvider
StarcoderdataPython
3303943
<reponame>QuantLet/EmbeddingPortfolio<filename>dl_portfolio/config/ae_config_dataset1.py import tensorflow as tf from dl_portfolio.constraints import NonNegAndUnitNorm from dl_portfolio.regularizers import WeightsOrthogonality dataset = 'dataset1' show_plot = False save = True nmf_model = "./final_models/nmf/dataset1/...
StarcoderdataPython
71845
<reponame>Congliang0229/kkFileView """ParenMatch -- An IDLE extension for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to parentheses, square brackets, and curly braces. """ from idlelib.HyperParser imp...
StarcoderdataPython