id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
6524933
#coding=utf-8 import smtplib, mimetypes from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.image import MIMEImage from email.utils import COMMASPACE #mailto = ['<EMAIL>'] def sendMail(mailfrom='<EMAIL>', mailto='<EMAIL>', subject='x日志分析平台后台', content='...
StarcoderdataPython
3579015
import dash import dash_core_components as dcc import dash_html_components as html from fbprophet import Prophet import utils.AlphaVantageUtils as av import utils.PostgresUtils as pg import utils.ModelUtils as mdl df_prices = pg.get_prices_with_features(av._TIC_MICROSOFT, av._INT_DAILY) name = pg.get_symbol_name(av....
StarcoderdataPython
392725
<filename>main.py """ Created by Epic at 9/5/20 """ from color_format import basicConfig import speedcord from speedcord.http import Route, HttpClient, LockManager from os import environ as env from logging import getLogger, DEBUG from aiohttp import ClientSession from aiohttp.client_ws import ClientWebSocketResponse,...
StarcoderdataPython
3231300
"""`AlphaIMS`, `AlphaAMS`""" import numpy as np from collections import OrderedDict from .base import DiskElectrode, ElectrodeArray, ElectrodeGrid, ProsthesisSystem class AlphaIMS(ProsthesisSystem): """Alpha IMS This class creates an AlphaIMS array and places it on the retina such that the center of the ...
StarcoderdataPython
5015155
<reponame>Max-astro/A2Project basePath = '/Raid1/Illustris/TNG/' import numpy as np from illustris_python.snapshot import loadSubhalo from illustris_python.groupcat import loadSubhalos def specific_angular_momentum(x, v, m): """ specific angular momentum of a group of particles Parameters ...
StarcoderdataPython
11203633
from .app import get_application app = get_application()
StarcoderdataPython
6401489
<filename>setup.py from setuptools import find_packages, setup setup(name='transfer-contacts', version='0.1.0', description="Helps extract notes from a certain contact database program.", author="<NAME>", url='https://github.com/juharris/transfer-contacts', license="MIT", packages=f...
StarcoderdataPython
1664380
<filename>lib/__init__.py import sys from pathlib import Path from pathlib import Path lib_dir = (Path(__file__).parent).resolve() if str(lib_dir) not in sys.path: sys.path.insert(0, str(lib_dir))
StarcoderdataPython
3285248
<reponame>KonstantinosAng/CodeWars # see https://www.codewars.com/kata/5266876b8f4bf2da9b000362/train/python from TestFunction import Test def likes(names): if len(names) < 1: return "no one likes this" if len(names) == 1: return f"{names[0]} likes this" if len(names) == 2: return f"{names[0]} and {names[1]} li...
StarcoderdataPython
12850443
<filename>src/worker/worker.py """Worker application. It calls an external slow task and send its output, line by line, as "log" events through SocketIO. The web page will then print the lines. """ # Disable the warning because eventlet must patch the standard library as soon # as possible. from communication import (...
StarcoderdataPython
142493
<gh_stars>0 """ Reference implementation of the MP3 correlation energy utilizing antisymmetrized spin-orbitals from an RHF reference. Requirements: SciPy 0.13.0+, NumPy 1.7.2+ References: Equations from [Szabo:1996] """ __authors__ = "<NAME>" __credits__ = ["<NAME>", "<NAME>"] __copyright__ = "(c) 2014-2017, T...
StarcoderdataPython
5114819
class FbsIterateItem(): def __init__(self, formula, parent, step, inv_nf): self.formula = formula self.parent = parent self.step = step self.inv_nf = inv_nf self.remained = 1 self.childs = []
StarcoderdataPython
8156173
<filename>sidewalkify/cli.py """Handle data fetching/cleaning tasks automatically. Reads and writes from a pseudo-database in the filesystem, organized as ./cities/<city>/ """ import click # TODO: Add type hints for geopandas import geopandas as gpd # type: ignore from . import graph from . import draw @click.co...
StarcoderdataPython
3359183
<gh_stars>1-10 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
StarcoderdataPython
5161276
import numpy as np from holoviews.core import (HoloMap, GridSpace, Layout, Empty, Dataset, NdOverlay, DynamicMap, Dimension) from holoviews.element import Curve, Image, Points, Histogram from holoviews.streams import Stream from .testplot import TestBokehPlot, bokeh_renderer try: from...
StarcoderdataPython
4862717
<reponame>Lenus254/password-locker from credentials import Credentials import unittest user_credentials = [] class TestCredentials(unittest.TestCase): def tearDown(self): ''' this test clears the credentialss list after every test ''' Credentials.user_credentials = [] def set...
StarcoderdataPython
4927197
<gh_stars>0 # LookWell v0.0 # srl from lookwell import ItemList, Mill def get_list0(): list = ItemList({ "items": [ { "tags": ["upc/0001", "food/organic/apple"], "desc": "2# bag of fuji apple", "unit": { "unit": "pound", ...
StarcoderdataPython
3558175
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api', '0115_auto_20160323_0756'), ] operations = [ migrations.RenameField( model_name='card', old_na...
StarcoderdataPython
8196801
import copy import time import numpy import theano import theano.tensor as T import lasagne from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils import check_random_state, check_array, check_X_y from sklearn.utils.validation import check_is_fitted from sklearn.metrics import f1_score, roc_auc_sc...
StarcoderdataPython
4977918
#!/usr/bin/env python3 ############################################################ # Usage: piScanner.py # Imports barcode and date from sshScript to create the filename # for a picture that is taken from a Raspberry Pi camera. # This script is used in conjuncture with sshScript. ####################################...
StarcoderdataPython
6487040
from hazma.parameters import alpha_em, qe from hazma.parameters import charged_pion_mass as mpi from hazma.parameters import electron_mass as me from hazma.parameters import muon_mass as mmu from cmath import sqrt, log, pi import numpy as np class VectorMediatorFSR: def __dnde_xx_to_v_to_ffg(self, egam, Q, f): ...
StarcoderdataPython
11281250
from pygccxml import declarations from pybindx.writers import base_writer class CppConsturctorWrapperWriter(base_writer.CppBaseWrapperWriter): """ Manage addition of constructor wrapper code """ def __init__(self, class_info, ctor_decl, class_decl, ...
StarcoderdataPython
341715
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # <NAME>. aïvázis # orthologue # (c) 1998-2019 all rights reserved # """ Instantiate a simple mutable record using raw data """ def test(): import pyre.records class record(pyre.records.record): """ A sample record """ sku = p...
StarcoderdataPython
6579762
<filename>model/layers.py """Creates the layers for a BiMPM model architecture.""" import torch import torch.nn as nn import torch.nn.functional as F class CharacterRepresentationEncoder(nn.Module): """A character embedding layer with embeddings that are learned along with other network parameters during tra...
StarcoderdataPython
12821962
<reponame>CitrineInformatics/pypif-sdk #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from pypif_sdk.func import * from pypif_sdk.func.calculate_funcs import _expand_formula_, _expand_hydrate_, _create_compositional_array_, _consolidate_elemental_array_, _calculate_n_atoms_, _add_...
StarcoderdataPython
12848069
from functools import wraps from flask import current_app, request from flask_restful import abort def auth_simple_token(func): @wraps(func) def wrapper(*args, **kwargs): token = request.headers.get('x-simple-auth') if current_app.config['API_KEY'] == token: return func(*args, **kw...
StarcoderdataPython
3427959
import numpy as np import keras from keras.models import model_from_json from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv3D, MaxPooling3D from keras import backend as K def get_liveness_model(): model = Sequential() model.add(Conv3D(32, kerne...
StarcoderdataPython
8017872
<filename>machines/worker/code/home/management/commands/cache_movie_images.py from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Caches all the movie images available in the system for faster reloading at a later point' def handle(self, *args, **options): ...
StarcoderdataPython
11214065
<reponame>farzanaaswin0708/Data-Science-Projects #!/usr/bin/env python import mnist import numpy as np import sys """ a simple nn classifier using L1 distance """ class nn_classifier: def __init__(self, dataset): self.images, self.labels = dataset[0], dataset[1]; """ predict label of the give...
StarcoderdataPython
12837854
# _*_ coding:utf-8 _*_ # 作者:hungryboy # @Time: 2021/1/28 # @File: class01.py print("欢迎来到hungryboy的python世界!") def test(): print("这是一个函数,在Demo类外面") class Demo: print("this is a demo") def demo(self): print("这是Demo类中的方法!")
StarcoderdataPython
6595794
<gh_stars>1-10 import turtle t = turtle.Pen() def settings(width=1, speed=2, pencolor='red', fillcolor='yellow'): t.width(width) t.speed(speed) t.pencolor(pencolor) t.fillcolor(fillcolor) def square(a, pen='blue', fill='green'): t.fillcolor(fill) t.pencolor(pen) t.begin_fill() for i ...
StarcoderdataPython
1921250
import torch import time from torch import nn from torch.nn import functional as F from torch.utils.data import DataLoader import pytorch_lightning as pl from torch.utils.data import Dataset import torch.autograd.functional as AGF from pytorch_lightning.callbacks import EarlyStopping import torch.linalg as linalg from ...
StarcoderdataPython
6619543
import os.path activate_this = os.path.join(os.path.dirname(__file__), '../env/bin/activate_this.py') with open(activate_this) as f: exec(f.read(), {'__file__': activate_this}) import examples.voice.assistant_library_with_local_commands_demo as assistant assistant.main()
StarcoderdataPython
1984964
from django.urls import path from . import api_views, views urlpatterns = [ path('', views.pm_inbox, name='personal_messages-inbox'), path('sentbox/', views.pm_sentbox, name='personal_messages-sentbox'), path('compose/', views.pm_compose, name='personal_messages-compose'), path('<int:pk>/', views.pm_detail, name='per...
StarcoderdataPython
5123384
<filename>testplan/cli/utils/command_list.py """ Implements command list type. """ from typing import List, Callable import click class CommandList: """ Utility class, used for creating, storing, and registering Click commands. """ def __init__(self, commands: List[click.Command] = None) -> None: ...
StarcoderdataPython
9695267
<filename>tests/integration/routes/test_status.py from tests.integration.integration_test_case import IntegrationTestCase class TestStatus(IntegrationTestCase): def test_status_page(self): self.get("/status") self.assertStatusOK() self.assertTrue("version" in self.getResponseData())
StarcoderdataPython
3497970
<filename>doc/example/convert_config.py import os import tempfile # set up the config to convert the notebooks to html output_dir = os.path.join(tempfile.gettempdir(), 'notebooks') notebooks = sorted([os.path.join(output_dir, f) for f in os.listdir(output_dir) if f.endswith('.ipynb')]) c.NbConvertApp.notebooks = notebo...
StarcoderdataPython
8110303
<gh_stars>0 #!/usr/bin/env python3 from autobahn.asyncio.websocket import WebSocketServerProtocol, \ WebSocketServerFactory from Translatron.DocumentDB import YakDBDocumentDatabase, documentSerializer from nltk.tokenize.regexp import RegexpTokenizer from nltk.tokenize import word_tokenize try: import simplejson...
StarcoderdataPython
1945936
from mantid.simpleapi import * from matplotlib import pyplot as plt import sys thisdir = os.path.abspath(os.path.dirname(__file__)) if thisdir not in sys.path: sys.path.insert(0, thisdir) def detector_position_for_reduction(path, conf, SNAP_definition_file, saved_file_path): sim=Load(path) AddSampleLog(...
StarcoderdataPython
1848298
import torch import functools import numpy as np import librosa import online_scd.data as data class InputFrameGenerator(object): def __init__(self, blocksize, stepsize): self.blocksize = blocksize self.stepsize = stepsize self.buffer = None def frames(self, frames): if self...
StarcoderdataPython
3237787
import argparse import sqlite3 from urllib.parse import urlparse, parse_qsl, unquote, quote import lxml.html import requests def create_connection(db_file): try: connection = sqlite3.connect(db_file) return connection except Exception as e: print(e) return None if __name__ == '...
StarcoderdataPython
3303987
from __future__ import print_function import time import redis import logging import traceback from django.conf import settings from .models import CountBeansTask from django_task.job import Job from rq import get_current_job class CountBeansJob(Job): @staticmethod def execute(job, task): params = ta...
StarcoderdataPython
58717
class _EventTarget: '''https://developer.mozilla.org/en-US/docs/Web/API/EventTarget''' NotImplemented class _Node(_EventTarget): '''https://developer.mozilla.org/en-US/docs/Web/API/Node''' NotImplemented class _Element(_Node): '''ref of https://developer.mozilla.org/en-US/docs/Web/API/Element'''...
StarcoderdataPython
67052
# Copyright 2013 OpenStack Foundation # Copyright 2013 Rackspace Hosting # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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 co...
StarcoderdataPython
3461813
from datetime import date, datetime from decimal import Decimal from base.models import BaseModel from carteiras.models import CentroCusto from dateutil.relativedelta import relativedelta from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models class Cartao(BaseModel): ...
StarcoderdataPython
11342070
from feedly.feeds.aggregated_feed.base import AggregatedFeed from feedly.serializers.aggregated_activity_serializer import \ NotificationSerializer from feedly.storage.redis.timeline_storage import RedisTimelineStorage import copy import datetime import json import logging logger = logging.getLogger(__name__) cl...
StarcoderdataPython
6616118
<gh_stars>10-100 import tensorflow as tf from tfsnippet.utils import assert_deps from .base import Distribution from .wrapper import as_distribution __all__ = ['BatchToValueDistribution'] class BatchToValueDistribution(Distribution): """ Distribution that converts the last few `batch_ndims` into `values_ndi...
StarcoderdataPython
1805509
<reponame>paulo-raca/python-progressbar<gh_stars>0 import time import pytest import progressbar max_values = [None, 10, progressbar.UnknownLength] def test_widgets_small_values(): widgets = [ 'Test: ', progressbar.Percentage(), ' ', progressbar.Bar(marker=progressbar.RotatingMark...
StarcoderdataPython
4841888
# 1 LAYER , TENSOrflow layers api import tensorflow as tf import gym import numpy as np num_inputs = 4 #4 inputs are the 2 velocities, position , angle num_hidden = 4 num_outputs = 1 # 1 output, either the probability to got left or right initializer = tf.contrib.layers.variance_scaling_initializer() X = tf....
StarcoderdataPython
3525902
<gh_stars>10-100 """ 这是一个仪表图像处理实例,基于k210芯片,歪朵拉开发板。 同级根目录下mnist.kmodel需放置于sd卡,请讲sd卡命名为sd。 TODO: 1、更好的针对印刷体数据集的数据增广; 2、指针自适应特征颜色提取范围; """ from fpioa_manager import fm, board_info from machine import UART import utime fm.register(board_info.PIN9,fm.fpioa.UART2_TX) fm.register(board_info.PIN10,fm.fpioa.UART2_RX)...
StarcoderdataPython
99126
import itertools # combine iterators it = itertools.chain([1, 2, 3], [4, 5, 6]) # repeat a value it = itertools.repeat("hello", 3) print(list(it)) # repeat an iterator's items it = itertools.cycle([1, 2]) result = [next(it) for _ in range(10)] print(result) # split an iterator it1, it2, it3 = itertools.tee(["fir...
StarcoderdataPython
4998246
import numpy as np import pandas as pd import scipy.optimize as opt from family import * class FormulaError(Exception): def handle(): return "Something is wrong with your formula..." class lm: def __init__(self, formula, data=None): assert isinstance(data, pd.DataFrame) assert isinst...
StarcoderdataPython
3399601
from karlovic.model_server import model_server
StarcoderdataPython
3488880
<filename>ml-agents/mlagents/trainers/benchmark.py from mlagents.envs.brain import BrainInfo import numpy as np class BenchmarkManager(object): agent_status = [[]] agent_amount = None agent_benchmark_result = [] #[episode_len, cumulative_reward, success_goal] success_threshold = None # agent_benchmark_result = [...
StarcoderdataPython
4967602
<filename>vagrant/main.py #!/usr/bin/env python3 import psycopg2 def get_query_result(query): db = psycopg2.connect(database="news") c = db.cursor() c.execute(query) result = c.fetchall() db.close() return result def print_breaks(): print() print("########============================...
StarcoderdataPython
5046138
<reponame>ceyeoh/fyp_doppler<filename>website/utils.py import numpy as np import pandas as pd from PIL import Image, ImageFilter ALLOWED_EXTENSIONS = {"png", "jpg", "jpeg"} def allowed_file(filename): return "." in filename and filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSIONS def find_y(img, thres, to...
StarcoderdataPython
3375480
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests the AWSCollector.""" from __future__ import unicode_literals import unittest import mock from libcloudforensics.providers.aws.internal import account as aws_account from libcloudforensics.providers.aws.internal import ebs, ec2 from dftimewolf import config from...
StarcoderdataPython
1795705
<reponame>Brndan/decharges-sudeducation from django.views.generic import TemplateView from decharges.decharge.mixins import CheckConfigurationMixin, FederationRequiredMixin from decharges.decharge.models import ( TempsDeDecharge, UtilisationCreditDeTempsSyndicalPonctuel, UtilisationTempsDecharge, ) from de...
StarcoderdataPython
6660528
<filename>hamiltonian/manager.py<gh_stars>0 # Copyright (c) 2020 <NAME> # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Nodes Managers """ import abc import math import numpy as np from collections import defaultdict from .render import animat...
StarcoderdataPython
3592005
import os import uuid from datetime import datetime, timedelta import mock import pytz from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from utils.widget import quill from wiki.forms import wikipageform from wiki.models import wikipage, wikisection from wiki...
StarcoderdataPython
6668069
from typing import Dict, List from src.controller import fields import src.model.person class AddPersons(fields.AddMovieFieldBaseClass): """ Action to add list of persons Kludgy to use fields controller as base class, but given time constraints it'll do. """ def execute(self, person_names: List[...
StarcoderdataPython
6466897
<gh_stars>0 import networkx as network import matplotlib.pyplot as gestor def dibujar(grafo): grafico = network.DiGraph() for index in grafo.getElementos(): vertice = grafo.obtener(index) grafico.add_node(vertice.getId(), nombre=vertice.getNombre()) for arista in vertice.getConectados(...
StarcoderdataPython
1952045
from django import forms class BootstrapFormMixin: fields = {} def _init_bootstrap_form_controls(self): for _, field in self.fields.items(): if not hasattr(field.widget, 'attrs'): setattr(field.widget, 'attrs', {}) if 'class' not in field.widget.attrs: ...
StarcoderdataPython
3425409
#! /usr/bin/env python """ Author: <NAME> Date: graph_helper, plotting output of the network """ import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from termcolor import colored from scipy.stats import gaussian_kde import pandas as pd from copy import deepcopy from termcolor import colored im...
StarcoderdataPython
12825160
import unittest import pandas as pd import geopandas as gpd from shapely.geometry import Polygon, Point import streetmapper class TestJoinBldgsBlocks(unittest.TestCase): def setUp(self): self.blocks = gpd.GeoDataFrame( {'block_uid': [1, 2]}, geometry=[ Polygon(((0,...
StarcoderdataPython
1849601
<reponame>ggabriel96/mapnames import string import unittest as ut from mapnames import string class EditDistanceTest(ut.TestCase): def test_identity(self): for i in range(len(string.digits)): id = string.digits[:i] self.assertEqual(string.wagner_fischer(id, id), 0) def test_...
StarcoderdataPython
4868526
"""Runs integration test on the bot """ import os import unittest import re from tgintegration import BotIntegrationClient from karmabot.responses import START_BOT_RESPONSE, SUCCESSFUL_CLEAR_CHAT, SHOW_KARMA_NO_HISTORY_RESPONSE from karmabot.commands_strings import START_COMMAND, CLEAR_CHAT_COMMAND, SHOW_KARMA_COMMAND,...
StarcoderdataPython
12850594
import autokeras as ak from tensorflow.python.util import nest from tf2cv.models.resnet import ResNet LAYER_OPTIONS = [[1, 1, 1, 1], [2, 1, 1, 1], [2, 2, 1, 1], [2, 2, 2, 1], [2, 2, 2, 2], [3, 3, 3, 3], [3, 4, 6, 3]] class CustomResnetBlock(ak.Block): def __init__(self, in_size=(224, 22...
StarcoderdataPython
3312002
from os.path import exists, dirname from os import makedirs, environ from kivy.factory import Factory as F from kivy.properties import StringProperty from kivy.resources import resource_add_path from ncis_inspector.controller import discover_classes try: from kaki.app import App IS_KAKI_APP = True except Impor...
StarcoderdataPython
3491114
# 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 traverse(self, root, level): if(root): self.max_level = max(level, self.max_level) ...
StarcoderdataPython
156267
############################################################ # -*- coding: utf-8 -*- # # # # # # # # # ## ## # ## # # # # # # # # # # # # # # # ## # ## ## ###### # # # # # # # # # Python-based Tool for interaction with the 10micron mounts # GUI with PyQT5 fo...
StarcoderdataPython
6411317
<reponame>jcazallasc/lana-python-challenge<filename>app/checkout_backend/uses_cases/offers/multi_buy_offer.py from .base_offer import BaseOffer class MultiBuyOffer(BaseOffer): def get_subtotal_amount( self, product_quantity: int, product_price: int, ) -> int: num_free_product...
StarcoderdataPython
6648169
<filename>src/dir_handler.py import pathlib def get_folder(): folder = pathlib.Path.home() / '.intellijournal' folder.mkdir(exist_ok=True) return folder def get_journal(): journal = get_folder() / 'journal.db' journal.touch() return journal def get_config(): config = get_folder() / 'config' config.t...
StarcoderdataPython
399872
<filename>scx11scanner/utils.py ''' Created on 1.11.2016 @author: <NAME> ''' def kbinterrupt_decorate(func): ''' Decorator. Adds KeyboardInterrupt handling to ControllerBase methods. ''' def func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Keybo...
StarcoderdataPython
11246165
import os import logging from logging.handlers import RotatingFileHandler from celery import Celery from flask import Flask from flask_environments import Environments from flask_mongoengine import MongoEngine from celery.signals import before_task_publish, task_prerun, task_success, task_failure import mongoengine fro...
StarcoderdataPython
1933590
<filename>cogs/economy.py import discord from discord.ext import commands from cogs.utils.dataIO import dataIO from collections import namedtuple, defaultdict from datetime import datetime from random import randint from copy import deepcopy from .utils import checks from cogs.utils.chat_formatting import pagify, box f...
StarcoderdataPython
9682486
<gh_stars>0 """ """ import openpyxl xlsx = '../resource/excel/dimensions.xlsx' wb = openpyxl.Workbook() sheet = wb['Sheet'] sheet['A1'] = 'Tall row' sheet['A2'] = 'Wide column' sheet.row_dimensions[1].height = 70 sheet.column_dimensions['B'].width = 20 wb.save(xlsx) print('Generate Success')
StarcoderdataPython
153697
from functools import singledispatch from functools import update_wrapper class singledispatchmethod: """Single-dispatch generic method descriptor. Supports wrapping existing descriptors and handles non-descriptor callables as instance methods. """ def __init__(self, func): if not callabl...
StarcoderdataPython
3469263
from label_cnn import LabelCNN from full_cnn import FullCNN from keras import Model from keras.layers import Activation, Concatenate, Add, Input, Cropping2D, Permute from keras_helpers import BasicLayers, ResNetLayers, InceptionResNetLayer, RedNetLayers class Inceptuous(LabelCNN): def __init__(self, model_name='In...
StarcoderdataPython
6583829
from flask import Flask from flask_restplus import Api, Resource, fields app = Flask(__name__) api = Api(app) a_language = api.model('Language', {'language': fields.String('The language')}) languages = [] python = {'language':'Python'} languages.append(python) @api.route('/language') class Language(Resource): d...
StarcoderdataPython
238027
# Generated by Django 3.2.6 on 2021-08-16 06:36 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("syncing", "0001_initial"), ] operations = [ migrations.AddField( model_name="signup", name="attendance_pending", ...
StarcoderdataPython
3346455
#!/usr/bin/python3 from PIL import Image from imutils.video import VideoStream from imutils.video import FPS from imutils.object_detection import non_max_suppression import numpy as np import argparse import imutils import time import cv2 import pytesseract from pytesseract import Output import os import re def run():...
StarcoderdataPython
4882546
import unittest import json import pandas as pd import numpy as np from assistant_dialog_skill_analysis.utils import skills_util from assistant_dialog_skill_analysis.data_analysis import divergence_analyzer class TestDivergenceAnalyzer(unittest.TestCase): """Test for Divergence Analyzer module""" def setUp(s...
StarcoderdataPython
11332904
from dataclasses import dataclass from shared.paths import RESOURCE_DIR @dataclass(frozen=True) class Edge: src: int dest: int weight: int def find(parent: list[int], x: int) -> int: while x != parent[x]: x = parent[x] return x def union(parent: list[int], rank: list[int], edge: Edge)...
StarcoderdataPython
5094347
# pylint: disable=W0614,wildcard-import """ A hack to be able to load easy_thumbnails templatetags using {% load easy_thumbnails %} instead of {% lead thumbnail %}. The reason for doing this is that sorl.thumbnail and easy_thumbnails both name their templatetag module 'thumbnail' and one gets conflicts. The reason for...
StarcoderdataPython
11212654
#! /usr/local/bin/python import sys import os import re # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This ProcessError.py file as part of tiny-ci will # # Be run for every failed test # # # # It is up to the user to decid...
StarcoderdataPython
1846922
from django.core.management.base import BaseCommand, CommandError from tournaments.models import Tournament import os import csv class Command(BaseCommand): help = 'Load Projected Tournament Winnings' def handle(self, *args, **options): players_tournament_obj = Tournament.objects.get(name = 'The PLAY...
StarcoderdataPython
1793184
<reponame>MateuszG/django_auth import pytest; import tempfile; import os @pytest.fixture() def cleandir(): newpath = tempfile.mkdtemp() # '/tmp/tmpKUnnz2' os.chdir(newpath) @pytest.mark.usefixtures("cleandir") class TestDirectoryInit: def test_cwd_starts_empty(self): assert os.listdir(os.getcwd(...
StarcoderdataPython
3337478
import PIL from PIL import Image import src.pos as pos class ImageMaker: """ This is a class for making Binary PFPs. Attributes: color (str): The color of the PFP. """ def __init__(self): """ Initializes the ImageMaker class. Parameters: None ...
StarcoderdataPython
5137570
import numpy as np import support.data_preprocessing as dpre data = np.array([[18, 11, 5, 13, 14, 9, 9, 22, 26, 24, 19, 0, 14, 15, 8, 16, 8, 8, 16, 7, 11, 10, 20, 18, 15, 14, 49, 10, 16, 18, 8, 5, 9, 7, 13, 0, 7, 4, 11, 10], [11, 14, 15, 18, 11, 13...
StarcoderdataPython
5089033
from collections import defaultdict import json from typing import Any from zipfile import ZipFile import geopandas as gpd import pandera from pandera import DataFrameSchema, Column, Check, Index import pandas as pd def concatenate_local_authority_floor_areas(upstream: Any, product: Any) -> None: dcc = pd.read_e...
StarcoderdataPython
3568832
''' Create a program that reads a number and show its multiplication table ''' number = int(input('Type a number: ')) print('-' * 12) print(f'\033[34m{number}\033[m x \033[34m{1:>2}\033[m = \033[32m{number * 1}\033[m') print(f'\033[34m{number}\033[m x \033[34m{2:>2}\033[m = \033[32m{number * 2}\033[m') print(f'\03...
StarcoderdataPython
1772215
<filename>script.mrknow.urlresolver/lib/urlresolver9/plugins/mailru.py """ OVERALL CREDIT TO: t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway urlresolver XBMC Addon Copyright (C) 2011 t0mm0 This program is free software: you can redistribute it and/or modify it under the ...
StarcoderdataPython
304396
# Copyright (C) 2010 # Author: <NAME> # Contact: <<EMAIL>> __version__ = '1.5.2' __all__ = [ 'OpenSSL', 'ecc', 'cipher', 'hash', ] from .openssl import OpenSSL from .ecc import ECC from .cipher import Cipher from .hash import hmac_sha256, hmac_sha512, pbkdf2
StarcoderdataPython
8138719
<reponame>DazEB2/SimplePyScripts<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: https://github.com/madmaze/pytesseract import re # pip install pillow from PIL import Image # pip install pytesseract # Tesseract.exe from https://github.com/UB-Mannheim/tesseract/w...
StarcoderdataPython
6570224
<filename>blender/2.79/scripts/addons/presets/operator/mesh.primitive_round_cube_add/Capsule.py import bpy op = bpy.context.active_operator op.radius = 0.5 op.arc_div = 8 op.lin_div = 0 op.size = (0.0, 0.0, 3.0) op.div_type = 'CORNERS'
StarcoderdataPython
1843494
from stream_framework.feeds.aggregated_feed.cassandra import CassandraAggregatedFeed from stream_framework.feeds.notification_feed.base import BaseNotificationFeed from stream_framework.storage.redis.lists_storage import RedisListsStorage from lego.apps.feed.activities import Activity, AggregatedActivity, Notification...
StarcoderdataPython
93510
# -*- coding: utf-8 -*- """ threaded_ping_server.py ~~~~~~~~~~~~~~~~~~~~~~~ TCP server based on threads simulating ping output. """ __author__ = '<NAME>' __copyright__ = 'Copyright (C) 2018, Nokia' __email__ = '<EMAIL>' import logging import select import socket import sys import threading import time from contextli...
StarcoderdataPython
343366
# Copyright (c) 2020 PaddlePaddle 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 appli...
StarcoderdataPython
3472700
<filename>preprocess/analyse_data.py # -*- coding:utf-8 -*- import pandas as pd train = pd.read_csv('../data/kaggle/train.tsv', sep="\t") print(train.head(5))
StarcoderdataPython