text
string
size
int64
token_count
int64
#!/usr/bin/python3 # # Project: build # Description: this is a very simple build tool which imitates from Bazel # import subprocess import argparse import shutil import glob import sys import os from core import * from languages import * from plugins import * class Build(Plugin): def __init__(self, root, rebuil...
9,337
2,484
import cv2 import sys import numpy as np from scipy.io import loadmat def convert(): labels = loadmat('tmp/data/devkit/cars_meta.mat') car_labels = [] for label in labels['class_names'][0]: car_labels.append(label[0]) labels_file = open("tmp/data/devkit/car_labels.txt", "w") labels_file.w...
414
147
import yaml def read_yaml(file_name) -> dict: with open(file_name, "r") as stream: yaml_dict = yaml.safe_load(stream) return yaml_dict
154
59
def titulo(txt): #criando linha com texto print('_'*30) print(txt) print('_'*30) def soma(a, b): #somando 2 numeros s = a + b print('~~'*15) print(f'A soma A + B = {s}') print('~~'*15) def contador(*num): #inserindo varios numeros em uma tupla tam = len(num) print(f'Recebi os valo...
707
293
# https://leetcode.com/problems/single-number-ii/ # # Given an array of integers, every element appears three times except for one. Find that single one. # # Note: # Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? class Solution(object): def singleNumber(s...
581
180
import os import uuid from datetime import datetime import mock import pytz from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from utils.widget import quill from wiki.models import wikipage, wikisection from wiki.models.wikipag...
5,347
1,804
# Generated by Django 2.2.17 on 2021-01-27 14:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("flags", "0010_flaggingrule_excluded_values"), ("applications", "0045_remove_denialmatchonapplication_denial"), ] operations = [ mig...
524
172
# -*- coding: utf-8 -*- """ Created on Thu Jun 20 13:26:46 2019 @author: LENOVO """ import pandas as pd filename = r"C:\Users\LENOVO\Downloads\Tweets.csv" df = pd.read_csv(filename,encoding="unicode_escape") all_data = df.drop_duplicates(keep='first', inplace=False) cleaned_data = all_data.dro...
2,205
820
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def forwards(apps, schema_editor): if not schema_editor.connection.alias == "default": return ActivityState = apps.get_model("pinax_lms_activities", "ActivityState") ActivitySessionState = apps.get_mo...
909
280
""" The list of ingredient choices is quite large, so this module provides lazy loaded widgets which help reducing loading times. """ from django import forms class LazyWidget(): """ Base class for lazy loaded, choice based widgets. offloads option generation to the client, relies on correct endpoint ...
2,430
654
import struct import subprocess from abc import ABCMeta from functools import lru_cache from typing import Union, Tuple, Optional from .base import Header, Protocol from .constants import * ETH_TYPE_IP = 0x0800 ETH_TYPE_ARP = 0x0806 ETH_TYPE_RARP = 0x8035 ETH_TYPE_SNMP = 0x814c ETH_TYPE_IPV6 = 0x086dd ETH_TYPE_MPLS_U...
6,830
2,463
for i in range(10): pass j = 0 while j < 10: j += 1
60
32
from utils.conf import args def tau_scheduler(acc): return args.tau # if acc > 0.95: # return 0.1 # elif acc > 0.9: # return 0.5 # elif acc > 0.8: # return 1.0 # else: # return args.tau
238
99
from datetime import datetime, date from isodate import datetime_isoformat from bson import ObjectId from json import JSONEncoder class MongoJSONEncoder(JSONEncoder): def default(self, output): if isinstance(output, (datetime, date)): return datetime_isoformat(output) if isinstance(ou...
408
106
from flask import Flask, render_template import random, datetime as dt, requests app = Flask(__name__) # Jinja = templating language @app.route('/') def home(): random_number = random.randint(1,3) return render_template("index.html", random_number = random_number, year = dt.datetime.now().year) @app.route('...
893
309
import pygame import random import time import numpy as np WHITE = 255, 255, 255 BLACK = 0, 0, 0 size = width, height = 480, 320 row = 32 col = 48 cell_width = (width//col) cell_height = (height//row) font_size = 60 FPS = 30 LIVE_P_MAX = 0.5; LIVE_P_MIN = 0.01; _grid = np.full((row, col), None) screen = None refr...
3,041
1,102
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
794
192
"""Python implementation of the 2DM card parser.""" from typing import IO, List, Optional, Tuple, Union from ..errors import CardError, FormatError, ReadError _MetadataArgs = Tuple[ int, # num_nodes int, # num_elements int, # num_node_strings Optional[str], # name Optional[int], # num_materi...
8,551
2,718
import sublime, sublime_plugin from ...libs import util class RefactorPreview(): view = None title = None window = None def __init__(self, title): self.title = title self.window = sublime.active_window() self.view = None for v in self.window.views(): if v.name() == self.title: se...
1,024
336
import re instruction_regex = re.compile(r'(nop|acc|jmp) ([+-][0-9]+)') program = [] try: while True: name, arg = instruction_regex.match(input()).groups() program.append([name, arg, 0]) except EOFError: pass pc = 0 accu = 0 while program[pc][2] == 0: program[pc][2] = 1 if program[p...
583
226
# Generated by Django 4.0 on 2022-01-14 13:45 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('aulas', '0016_alter_planejamento_data_envio_alter_resposta_data'), ] operations = [ migrations.AlterField( model_n...
736
272
''' A LeNet-5 in PyTorch. Reference: Yann LeCun et al, 1998. Gradient-Based Learning Applied to Document Recognition. [Paper] Available at: <http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf> [Accessed 26 December 2021]. ''' import torch.nn as nn import torch.nn.functional as F # Defining the Network (LeNet-5) c...
5,018
1,676
import sys sys.path.insert(0, '..') import numpy as np import pandas as pd from itertools import combinations from scipy.stats import binom import scipy.special import matplotlib.pyplot as plt import matplotlib.patches as mpatches from IPython.display import display, HTML #sys.path.append("../") from FrameBuilder.eige...
7,228
2,787
from person import Person class Population: def __init__(self, family_info, null_parent_value='0'): self.persons = {} # Initialize the persons data structure with Person objects for fid in family_info: self.persons[fid] = {} for iid in family_info[fid]: info = family_info[fid][iid] ...
1,562
502
if __name__ == "__main__": # export GOOGLE_APPLICATION_CREDENTIALS="trentiemeciel.json" # get the token using postman from dotenv import load_dotenv load_dotenv() import main freshdesk_token = main.convert_auth0_token_to_freshdesk_token("gtxiNvJMjuDGec7GUziM2qSupsnCu74I") print(f"freshdesk...
348
145
''' Convolutional autoencoder on MNIST dataset using Keras functional API ''' from keras.datasets import mnist from keras.models import Model from keras.layers import Activation, Input, BatchNormalization from keras.layers import Conv2D, Conv2DTranspose from keras.callbacks import TensorBoard from keras.optimizers ...
4,040
1,559
from bfg9000.languages import Languages known_langs = Languages() with known_langs.make('c') as x: x.vars(compiler='CC', flags='CFLAGS') with known_langs.make('c++') as x: x.vars(compiler='CXX', flags='CXXFLAGS') def mock_which(*args, **kwargs): return ['command'] def mock_execute(args, **kwargs): ...
499
182
x = "X" y = "Y" z = "Z" xx = "XX" h = "H" cnot = "CNOT" s_phi = "S_phi" identity = "Identity"
93
54
from unittest import TestCase from flake8diff import flake8 class Flake8DiffTestCase(TestCase): def test_flake8diff(self): flake8.Flake8Diff("", {})
164
62
# coding: utf-8 import matplotlib.pyplot as plt import numpy as np N = 200 X = np.linspace(0, 10, N * 2) noise = np.random.normal(0, 0.5, X.shape) Y = X * 0.5 + 3 + noise def calcLoss(train_X, train_Y, W, b): return np.sum(np.square(train_Y - (train_X * W + b))) def gradientDescent(train_X, train_Y, W, b, lea...
1,266
509
import os import boto3 import email import logging import json import re import uuid s3 = boto3.client("s3") workmail_message_flow = boto3.client('workmailmessageflow') logger = logging.getLogger() def lambda_handler(event, context): logger.error(json.dumps(event)) destination_bucket = os.environ.get('destinatio...
6,343
1,842
#!/usr/bin/env python import argparse import sys import os import shutil DBG = 1 __home = os.getcwd() __fbench_home = '/home/pfernando/filebench' #binary __empty = '' __micro_rread = 'micro_rread' __workload_l = [] __workload_l.append(__micro_rread) parser = argparse.ArgumentParser(prog="runscript", description="...
1,757
672
'''The dagster-airflow operators.''' import ast import datetime import json import logging import os from contextlib import contextmanager from airflow.exceptions import AirflowException from airflow.models import BaseOperator, SkipMixin from airflow.operators.docker_operator import DockerOperator from airflow.operat...
12,685
3,774
import os """ This file contains configurations for receiver service. The configurations can be over-ridden with Environment Variables during run time. """ OUTPUT_DIR = os.getenv("OUTPUT_DIR", "/usr/src/app-receiver/output") DECRYPTION_KEY = os.getenv("DECRYPTION_KEY", "/tmp/decryption_key")
293
94
# Copyright 2021 The CGLB 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 applicable la...
908
297
"""Collection of functions related to navigating directories """ ########## # Imports ########## import os from typing import Union from pathlib import Path from logger.select_chall import logging import constants from domains import problem_domains from git import Repo ########## # Subdomain dir_name ########## ...
5,361
1,722
# NLP written by GAMS Convert at 04/21/18 13:51:45 # # Equation counts # Total E G L N X C B # 2 2 0 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
2,581
1,523
'''OpenGL extension NV.geometry_program4 The official definition of this extension is available here: http://oss.sgi.com/projects/ogl-sample/registry/NV/geometry_program4.txt Automatically generated by the get_gl_extensions script, do not edit! ''' from OpenGL import platform, constants, constant, arrays from OpenGL...
3,790
1,499
class AndroidNotification: def __init__(self, header, body, application, package, id_num): self.application = application self.body = body self.package = package self.header = header self.id = id_num
244
63
from ..constant import Service as Service_Key from .base import Service import logging class LoggerService(Service): def init(self, services): config_service = services.get_service(Service_Key.CONFIG_LOCAL) self.date_format = config_service.get_config_value( "LOGGER", "DateFormat") ...
1,158
329
import numpy as np def perturbed_x(q, z, z_c, k): return (q - (1.0 + z_c) / (1.0 + z) * np.sin(k * q) / k) def perturbed_v_x(q, z, z_c, k, H_0): return (-H_0 * (1.0 + z_c) * np.sqrt(1.0 + z) * np.sin(k * q) / (k)) def get_scale_factor(z): return 1.0 / (1.0 + z) def get_redshift(a): return 1.0 / a - ...
324
174
"""Tests multi-database support""" import contextlib import io import sys from django.core.management import call_command import django.test import pgtrigger import pgtrigger.tests.models as test_models @contextlib.contextmanager def capture_stdout(): old_stdout = sys.stdout sys.stdout = out = io.StringIO(...
10,441
3,632
# Copyright (c) 2021, Anthony Emmanuel, github.com/mymi14ss and Contributors # See license.txt # import frappe import unittest class TestAtlanticFluidConfiguration(unittest.TestCase): pass
192
67
# Settings file for use with travis-ci # Include all the default settings. from settings import * # Use the following lines to enable developer/debug mode. DEBUG = False TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # Set the external URL context here FORCE_SCRIPT_NAME = '/' USE_X_FORWARDED_HOST = True ALLOWED_HOSTS = [...
1,224
406
f1 = 'intentionally_not_thinking_about_upsetting_things' f2 = 'substance_abuse' f3 = 'denial_of_unhappiness' f4 = 'excessive_rationality_and_control' f5 = 'suppression_of_anger' f6 = 'psychosomatic_symptoms' f7 = 'denial_of_memories' f8 = 'withdrawal_from_people' f9 = 'avoidance_through_sleep_and_lack of energy' f10 = ...
1,316
763
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import numpy as np from ...messages import Message class WSStreamMessage(Message): """ A message representing data that was/will be communicated to WebSocket. """ samples: np.float64 stream_name: str stream_i...
327
101
# code to estimate world surface elevation and EKF yaw error from # image direct pose informaation. # - trianglulate image features (in 3d) based on camera poses # - use essential/fundamental matrix + camera pose to estimate yaw error # - use affine transformation + camera pose to estimate yaw error import cv2 import...
11,400
4,434
from django.urls import path from notification import views urlpatterns = [ path('notifications/<int:id>/', views.notification_view, name='notifications'), ]
162
45
"""empty message Revision ID: 4b1e5b7b69eb Revises: 13d1c714823a Create Date: 2017-01-19 12:36:55.339537 """ # revision identifiers, used by Alembic. revision = '4b1e5b7b69eb' down_revision = '13d1c714823a' import re from alembic import op import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from porta...
3,229
1,036
from tadataka.visual_odometry import VisualOdometry from tadataka.camera import CameraParameters
97
26
import datetime import pandas as pd import pandas.testing as tm print(pd.__version__) df = pd.DataFrame( { "A": ["X", "Y"], "B": [ datetime.datetime(2005, 1, 1, 10, 30, 23, 540000), datetime.datetime(3005, 1, 1, 10, 30, 23, 540000), ], } ) print(df) print(df....
639
298
from django.conf.urls import url from investment_report.views import utils urlpatterns = [ url('preview/(?P<lang>[\w-]+)/(?P<market>[\w-]+)/(?P<sector>[\w-]+)/pdf', utils.investment_report_pdf, {'moderated': False}, name='preview_investment_report_pdf'), url('current/(?P<lang>[\w-]+)/...
1,090
430
# coding=utf-8 from docc.exceptions import APIError class Image(object): """Represent an Image object (name and distribution information)""" def __init__(self, identifier, name, distribution): self.id = identifier self.name = name self.distribution = distribution def __repr__(se...
2,823
736
#!/usr/bin/env python import argparse fwmap = {'tensorflow':1,'caffe':2,'sensetime':3,'ncnn':4,'other':5,'mxnet':6,'uls':7,'mace':8,'tflite':9} def printres(th, res): th.append('sum') print "%15s"%(" "), for i in th: print i, print "" for use in res: print "%15s"%(use), fwre...
1,607
600
import os import requests class RestApi: def __init__(self, base_url: str, api_key: str): self.url = base_url self.headers = {'X-API-Key': api_key} def patch_json(self, path, json): resp = requests.patch(self.url + path, headers=self.headers, json=json) resp.raise_for_status() ...
595
198
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2020-02-03. # 2020, SMART Health IT. import sys from dataclasses import dataclass, field from typing import ClassVar, Optional, List from .backboneelement import Backbo...
1,660
491
""" test for lc """ import pytest import numpy as np from jaxsot.core.weight import comp_weight, comp_omega from jaxsot.core.lc import gen_lightcurve from jaxsot.io.earth import binarymap def test_lc(): mmap=binarymap(nside=16,show=False) nside=16 inc=0.0 Thetaeq=np.pi zeta=np.pi/3.0 Pspin=23...
717
363
from typing import Any, Dict from squad.config import config from squad.exceptions import FrozenError class BodyParameters: """ Storage class for (static) body data/parameters. """ __slots__ = ( "_frozen", "body_length_units", "body_angle_units", "l_body", "w_...
4,057
1,387
# -*- coding: utf-8 -*- # Copyright 2019 Licheng Xiao. 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 requi...
2,833
853
from message.models import Message, DeletedMessage, TextContent from user.tests.utils import create_active_user from conversation.tests.utils import create_private_chat def create_text_content(text='hello') -> TextContent: return TextContent.objects.create(text=text) def create_message(sender=None, chat=None, ...
984
274
""" Replace the comment in the following code with a while loop. numXs = int(input('How many times should I print the letter X? ')) toPrint = " #concatenate X to toPrint numXs times print(toPrint) """ numXs = int(input('How many times should I print the letter X? ')) toPrint = "" while numXs > 0: toPrint += "X" ...
350
125
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: temperature_bands.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.pr...
7,784
2,967
from . import exchange_controller from . import exchange_client
63
14
from unittest import mock from django.core.management import call_command import pytest from app1.models import TestModel from datavalidation.models import Validator from datavalidation.results import Status from datavalidation.runners import ModelValidationRunner, ObjectValidationRunner def test_model_runner_with_...
2,265
676
#to create the flask page #import flask #flask library was installed in the command line/computer terminal first #Source: PythonHow https://pythonhow.com/python-tutorial/flask/How-making-a-website-with-Python-works/ #Python assigns the name "__main__" to the script when the script is executed. #The debug parameter...
2,479
839
from settings import MOZDNS_BASE_URL from gettext import gettext as _ from string import Template class DisplayMixin(object): # Knobs justs = { 'pk_just': 10, 'rhs_just': 1, 'ttl_just': 1, 'rdtype_just': 4, 'rdclass_just': 3, 'prio_just': 1, 'lhs_just': ...
3,152
1,039
from ibmcloudant.cloudant_v1 import CloudantV1, Document from ibm_cloud_sdk_core.authenticators import IAMAuthenticator CLOUDANT_URL="https://apikey-v2-1mfs4kqo2nmnc2sdtgp9ji8myznbgm6mivk0o93pfopt:f70c9a73c52d287d3271ddc3dba6a30a@dc1a5ff5-996b-475c-8b7e-da87f4bf33a3-bluemix.cloudantnosqldb.appdomain.cloud" CLOUDANT_AP...
2,361
992
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-04-23 18:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0011_auto_20170422_1917'), ] operations = [ migrations.AlterModelOp...
1,782
540
# GENERATED BY KOMAND SDK - DO NOT EDIT from .create_feed.action import CreateFeed from .get_feed_details.action import GetFeedDetails from .get_report_document.action import GetReportDocument from .list_all_feeds.action import ListAllFeeds from .list_user_feeds.action import ListUserFeeds from .search.action import Se...
478
142
import uuid from urllib.parse import urljoin from django.core.exceptions import FieldError from multiselectfield import MultiSelectField from rdkit import Chem from django.db import models from resolver import defaults from inchi.identifier import InChIKey, InChI class Inchi(models.Model): id = models.UUIDFiel...
9,913
3,128
# # ---------------------------------------------------------------------------------------------------- # DESCRIPTION # ---------------------------------------------------------------------------------------------------- ## @package content @brief [ PACKAGE ] - Content. ## @dir content ...
2,995
777
### IMPORTS ### ================================ from Combatant import Combatant # Robot. Implementation of the Combatant class class Robot(Combatant): def __init__(self, name, weapon): self.equipped_weapon = weapon super().__init__(name, self.equipped_weapon.attack_power) ### M...
681
193
# -*- coding: utf-8 -*- """内核方法 Copyright 2018-2019 Sean Feng(sean@FantaBlade.com) """ import os import re from concurrent import futures from multiprocessing import cpu_count from urllib.parse import urlparse import pafy import requests class Core: def log(self, message): print(message) def __in...
5,143
1,516
# Generated by Django 3.1.6 on 2021-04-09 19:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('home', '0021_auto_20210409_1118'), ] operations = [ migrations.AddField( model_name='blog', name='show', ...
727
244
# -*- coding: utf-8 -*- """ /*************************************************************************** MOPA An independet project Método de Obtenção da Posição de Atirador ------------------- begin : 2018-12-21 git sha ...
2,586
677
from pathlib import Path import numpy as np from PIL import Image, ImageSequence import matplotlib.pyplot as plt import tensorflow as tf import tensorflow_io as tfio from scipy.ndimage import rotate from src.data.monuseg import get_dataset, tf_random_rotate, tf_random_crop ds = get_dataset() def random_crop(image,...
1,953
646
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-08 05:45 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('amqp_2phase', '0001_create_events_table'), ] atomic = False operations = [ migrati...
526
185
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import ckeditor_uploader.fields class Migration(migrations.Migration): dependencies = [ ('weunion', '0001_initial'), ('investmap', '0003_auto_20161205_1926'), ] operations = [ ...
870
263
import click from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor from align.aligner import Aligner @click.command() @ocrd_cli_options def cis_ocrd_align(*args, **kwargs): # kwargs['cache_enabled'] = False return ocrd_cli_wrap_processor(Aligner, *args, **kwargs)
290
100
import pytest import numpy as np from ..helpers import osipi_parametrize from . import SI2Conc_data from src.original.OG_MO_AUMC_ICR_RMH.ExtendedTofts.DCE import dce_to_r1eff from src.original.OG_MO_AUMC_ICR_RMH.ExtendedTofts.DCE import r1eff_to_conc # All tests will use the same arguments and same data... arg_name...
1,567
628
# DO NOT EDIT: Autogenerated by src/docker_composer/_utils/generate_class.py # for docker-compose version 1.25.0, build unknown from typing import List, Optional import attr from docker_composer.base import DockerBaseRunner @attr.s(auto_attribs=True) class DockerComposeUp(DockerBaseRunner): """ Builds, (re...
3,559
992
# Import from system libraries from flask import Flask from flask_bcrypt import Bcrypt from flask_cors import CORS from flask_jwt_extended import JWTManager from flask_restful import Api # Import from application modules from errors import errors from models.User import User from models.db import initialize_db from ro...
1,415
419
"""OpenAPI core validation util module""" from yarl import URL def get_operation_pattern(server_url, request_url_pattern): """Return an updated request URL pattern with the server URL removed.""" if server_url[-1] == "/": # operations have to start with a slash, so do not remove it server_url ...
509
153
"""Mostly helper functions to help with the driver.""" import json import os import pathlib import sqlite3 import arrow # type: ignore def sql_db(): """Open a SQL connection and perform a query.""" db_path = pathlib.Path(os.getcwd()) db_path = pathlib.Path(db_path/'sql'/'portfolio.sqlite3') con = sql...
2,071
706
import subprocess import sys import os import math # This code is meant to manage running multiple instances of my KMCLib codes at the same time, # in the name of time efficiency numLambda = 256 sysSize = 5 numVecs = 1 dataLocation = "exactSolns/thesisCorrections/low" lambdaMin = 10.0**(-4) lambdaMax = 10.0**(4) rate...
1,053
392
from time import strftime, gmtime class ShedCounter( object ): def __init__( self, model ): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.model = model self.generation_time = strftime( "%b %d, %Y", gmtime() ) ...
3,997
1,038
''' ''' from typing import Dict, Optional # classes # ------- class BoundingBox(): ''' Class to manipulate a bounding box (bbox). A bounding box is a rectangle aligned with the coordinate system. The bounding box are defined on coordinate system with x pointing toward east and y pointing toward north...
2,461
737
import dash from dash_google_charts import PieChart app = dash.Dash() app.layout = PieChart( height="500px", data=[ ["Task", "Hours per Day"], ["Work", 11], ["Eat", 2], ["Commute", 2], ["Watch TV", 2], ["Sleep", 7], ], options={"title": "My Daily Activit...
378
139
#!/usr/bin/env python3 # Written by mohlcyber v.0.1 (15.04.2020) # Edited by filippostz v.0.2 (24.09.2021) import random import sys import socket import requests import json import re import smtplib from datetime import datetime from urllib.parse import urljoin from email.mime.text import MIMEText from email.mime.mult...
4,183
1,304
#parameters accumulated_weight = 0.5 detector_u = 50 detector_b = 350 detector_r = 300 detector_l = 600 message_x = 10 message_y = 400 date_x = 0 date_y = 450 threshold_min=22 rate = 0.8 RGB_INT_MAX = 255 RGB_INT_MIN = 0 RGB_FLT_MAX = 255.0 RGB_FLT_MIN = 0.0 Blur_value = 7 text_color = (200,50,150) rectangle_color = (0...
518
276
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython Genere una matriz de 25 x 40 con números decimales al azar entre 0 y 1. Mostrar los numeros del perimetro y calcularlo. """ from random import random from prototools import show_matrix def solver_a(): """ >>> solver_a() [1, 2, 3, 4, 5, 16, 17...
1,309
663
from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.utils.translation import gettext_lazy as _ from .models import ( ...
5,941
2,066
# import modules import os import re import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from wordcloud import WordCloud class Analyse: # Data Cleaning Function def raw_to_df(self, file, key): global df # Time formatting split_form...
4,698
1,466
#!/usr/bin/python3 """ rdp Python implementation of the Ramer-Douglas-Peucker algorithm. """ import sys import numpy as np #from math import sqrt #from functools import partial from math import radians, cos, sin, asin, sqrt if sys.version_info[0] >= 3: xrange = range def pl_dist(point, start, end): """ C...
2,857
1,009
import unittest import requests from assertpy import assert_that from requests.exceptions import Timeout from unittest.mock import Mock, patch from src.Api import Api from src.todos import todos class TestApiMonkeyPatch(unittest.TestCase): @patch('src.Api.Api', autospec=True) def test_method_api_get_by_id_...
7,655
2,729
from typing import List from spark_auto_mapper_fhir.generator.fhir_xml_schema_parser import ( FhirXmlSchemaParser, FhirCodeableType, ) def test_generator_get_types_for_codeable_concepts() -> None: print("") codeable_types: List[ FhirCodeableType ] = FhirXmlSchemaParser.get_types_for_codea...
361
132
#!/usr/bin/env python # Lastfm loved tracks to Google Music All Access playlist. As noted in the comments you do need the All Access subscription thing otherwise it will always find 0 songs. # # Written by Tim Hutt, tdhutt@gmail.com, based on this script: # # https://gist.github.com/oquno/3664731 # # Today is the 15th...
3,112
1,076
# Copyright 2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # 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 requi...
5,560
1,784
"""Authentication middleware This module provides one piece of middleware named ``authkit.authenticate.middleware`` which is used to intercept responses with a specified status code, present a user with a means of authenticating themselves and handle the sign in process. Each of the authentication methods supported...
23,124
6,090
from http.server import HTTPServer, BaseHTTPRequestHandler from urllib.parse import parse_qs import requests import ssl import sys import tdameritrade.auth #added as40183 import urllib import urllib3 #as40183 from sys import argv import pymysql.cursors import datetime import dateutil.relativedelta import ...
11,398
4,285