text stringlengths 1 927k |
|---|
# Number amount of names
from __future__ import print_function
from operator import add
from functools import reduce
import timeit
import os
start = timeit.default_timer()
def euler_22():
with open(os.path.abspath('').strip('py_solutions_21-30') +
'/euler_txt/names1.tx... |
import numbers
from warnings import catch_warnings, simplefilter, warn
import threading
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.sparse import issparse
from scipy.sparse import hstack as sparse_hstack
from joblib import Parallel, delayed
from sklearn.base import ClassifierMixin, Regressor... |
from copy import deepcopy
from os import environ
from pprint import pprint
import yaml
from kubernetes import client, config
from kubernetes.client.rest import ApiException
_mpijob_template = {
'apiVersion': 'kubeflow.org/v1alpha1',
'kind': 'MPIJob',
'metadata': {
'name': '',
'namespace': 'default-tenant'... |
from django.urls import include, path
from rest_framework import routers
from profiles_api import views
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
path(''... |
# Generated by Django 2.2.11 on 2020-03-23 10:08
from django.db import migrations, models
def update_default_credentials(apps, schema_editor):
from device_registry.models import RecommendedActionStatus
from device_registry.recommended_actions import AuditdNotInstalledAction
RecommendedActionStatus.update... |
import collections
import os
import sys
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
import numpy as np
data = os.path.join(os.path.realpath(__file__), '..', '..', '..', 'data', 'larson_et_al')
sys.path.append(data)
import ce_expansion.npdb.db_inter
DEFAULT_DPI = 600 # Dots per inch
DEFAULT_POIN... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.9.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
import logging
from rest_framework import serializers
from baserow.api.serializers import get_example_pagination_serializer_class
from baserow.api.utils import get_serializer_class
from baserow.contrib.database.fields.registries import field_type_registry
from baserow.contrib.database.rows.registries import row_metad... |
import dash
import dash_html_components as html
import os
import config
STATIC_PREFIX = '/{}/static/'.format(config.DASH_APP_NAME)
app = dash.Dash()
app.layout = html.Div([
html.Img(src='{}my-image.png'.format(STATIC_PREFIX))
])
# Static routes for on-premise are a little bit different than local
# because th... |
N = input()
if "9" in N:
print("Yes")
else:
print("No") |
from django import template
from baselinecore.models import BlogPage
register = template.Library()
@register.simple_tag(takes_context=True)
def get_latest_posts(context):
context.update(
{'latest_blog_posts': BlogPage.objects.live().order_by('-datetime')[:5]}
)
return "" |
# USAGE
# python auto_canny_practice.py --images images
# import the necessary packages
import numpy as np
import argparse
import glob
import cv2
def auto_canny(image, sigma=0.33):
# compute the median of the single channel pixel intensities
v = np.median(image)
# apply automatic Canny edge detection usin... |
"""The lookin integration."""
from __future__ import annotations
from datetime import timedelta
import logging
import aiohttp
from aiolookin import (
LookInHttpProtocol,
LookinUDPSubscriptions,
MeteoSensor,
SensorID,
start_lookin_udp,
)
from homeassistant.config_entries import ConfigEntry
from ho... |
from flask.ext.bcrypt import generate_password_hash, \
check_password_hash
def authenticate_user(password, user):
return not user.locked and checkpw(password, user.password)
def hashpw(password):
return generate_password_hash(password, 10).decode('utf-8')
def checkpw(password, hashed_password):
re... |
"""
MIT License
Copyright (c) 2017 Sadeep Jayasumana
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, publ... |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
from collections import Counter
from copy import deepcopy
from datetime import datetime as dt
import os.path as op
imp... |
"""
This file offers the methods to automatically retrieve the graph Polaribacter sp. HelI88.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protei... |
# Copyright (c) 2019, NVIDIA 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 required by applicable law or agreed to... |
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Font(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.scene.yaxis.title"
_path_str = "layout.scene.yaxis.title.font"
_valid_props = {"colo... |
import cv
import time
from pydmtx import DataMatrix
import numpy
import sys
import math
def absnorm8(im, im8):
""" im may be any single-channel image type. Return an 8-bit version, absolute value, normalized so that max is 255 """
(minVal, maxVal, _, _) = cv.MinMaxLoc(im)
cv.ConvertScaleAbs(im, im8, 255 /... |
from typing import Any, Dict
from sympy.testing.pytest import raises
from sympy import (symbols, sympify, Function, Integer, Matrix, Abs,
Rational, Float, S, WildFunction, ImmutableDenseMatrix, sin, true, false, ones,
sqrt, root, AlgebraicNumber, Symbol, Dummy, Wild, MatrixSymbol)
from sympy.combinatorics impo... |
from .mesh_config import get_mesh_config
from .scene_config import get_scene_config
from .atoms import get_atom_array
from .bonds import get_bond_array
__all__ = [
'get_mesh_config',
'get_scene_config',
'get_atom_array',
'get_bond_array',
] |
#%%
import math
import os
print("Hello world!")
#%%
# From before
abool = True # boolean
azero = 0 # int
aint = 35 # int
afloat = -2.8 # float
anumbzerostr = "0" # str
aemptystr = "" # str
aletter = 'a' # str
astr = "three-five" # str
# list / array
alist = [1,'person',1,'heart',10,'fi... |
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'item_tax_template')
item_tax_template_list = frappe.get_list('Item Tax Template')
for template in item_tax_template_list:
doc = frappe.get_doc('Item Tax Template', template.name)
... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""This mo... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from profiles_api import serializers
class HelloApiView(APIView):
"""Test API View"""
serializer_class = serializers.HelloSerializer
def get(self, re... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright (c) 2020
#
# See the LICENSE file for details
# see the AUTHORS file for authors
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# ----------... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.forms.models import BaseInlineFormSet
from simple_history.admin import SimpleHistoryAdmin
from ajax_select.admin import AjaxSelectAdmin
fro... |
# -*- coding: utf-8 -*-
"""
test_simple_decompression
~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for decompression of single chunks.
"""
import brotlicffi
import pytest
def test_decompression(simple_compressed_file):
"""
Decompressing files returns their original form using decompress.
"""
with open(simple_com... |
# -*- coding: utf-8 -*-
u"""ファイル操作関連"""
from __future__ import absolute_import, division, print_function
from squid.vendor.Qt import QtGui
import os
_SIZE_SUFFIXES = ["B", "KB", "MB", "GB", "TB", "PB"]
_FILE_PROTOCOL = "file:///"
def convert_readable_file_size(nbytes):
u"""HumanReadableなファイルサイズを返す
Args:
... |
"""Campdown
Usage:
campdown <url>
[--output=PATH]
[--sleep=NUMBER]
[--quiet]
[--short]
[--no-art]
[--no-id3]
[--no-missing]
campdown (-h | --help)
campdown (-v | --version)
Options:
-h, --help ... |
#!/usr/bin/python3
import RPi.GPIO as GPIO
import threading
import queue
import time
import distance, motors, speak
gettingCloseSpoken = False
turningAroundSpoken = False
def calculateManeuvers(objDist):
global gettingCloseSpoken
global turningAroundSpoken
if(objDist < 10): #Turn around
speedLeft = 25
spe... |
"""Unit tests dla collections.defaultdict."""
zaimportuj os
zaimportuj copy
zaimportuj pickle
zaimportuj tempfile
zaimportuj unittest
z collections zaimportuj defaultdict
def foobar():
zwróć list
klasa TestDefaultDict(unittest.TestCase):
def test_basic(self):
d1 = defaultdict()
self.assertE... |
from spiops import spiops
import spiceypy
#def test_ckdiff():
#
# resolution = 1000000
# tolerance = 0.0001 # deg
# spacecraft_frame = 'ROS_LANDER'
# target_frame = 'J2000'
# mk = 'data/SPICE/ROSETTA/mk/ROS_CKDIFF_TEST.TM'
# ck1 = 'data/SPICE/ROSETTA/mk/ROS_CKDIFF_TEST.TM'
# ck2 = 'data/SPICE/ROS... |
#!/home/shello/Documents/BioMixer/biomixer-venv/bin/python
# Author:
# Contact: grubert@users.sf.net
# Copyright: This module has been placed in the public domain.
"""
man.py
======
This module provides a simple command line interface that uses the
man page writer to output from ReStructuredText source.
"""
import ... |
import urllib.parse
from datetime import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from dfirtrack_main.models import (
Analysisstatus,
Case,
Company,
Contact,
Dnsname,
Domain,
Ip,
Location,
Os,
Osarch... |
# -*- coding: utf-8 -*-
from datetime import datetime
from flask import g, jsonify, request
from flask_httpauth import HTTPBasicAuth
from app import app, db
from app.models import User, Post
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(username, password):
user = db.session.query(User).filt... |
#!/usr/bin/env python
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Prints a short log from HEAD (or [end]) to a pseudo revision number."""
__version__ = '1.0'
import optparse
import subp... |
import numpy as np
import operator, os, itertools
from abc import ABC, abstractmethod
import numexpr as ne
ne.set_num_threads(20)
def rmtxt(s):
if s.endswith(".txt"):
s=os.path.splitext(s)[0]
return s
def get_reader(inputfilename):
basename=os.path.basename(inputfilename)
reader=None
if ba... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import torch
from fvcore.common.file_io import PathManager
from detectron2.data import MetadataCatalog
from detectron2.data import detection_utils as utils
from detectron2.data import transforms as T
from .stru... |
#!/usr/bin/python
import sys, getopt
import re
import ast
def column_sub(file1="", file2=""):
infile1 = open(file1, "r+")
infile2 = open(file2, "r+")
outfile = open("diff.res", "w+")
inlines1 = infile1.readlines()
inlines2 = infile2.readlines()
diffed = False
linenum = 0;
for l0,l1 ... |
from utils import update_alert_messages
from utils import clear_expired_alerts
# TODO:
# when alert expires, delete from db
# when a device updates location - update it's FIPS automatically (IFTTT)
# what happens if a device moves, and it still has the old alert_id?
#
print "running..."
# monitor length of script r... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__version__ = '0.0.1'
import frappe
from frappe import _
from frappe.config import desktop
def get_frappe_data():
return [
# Administration
{
"module_name": "Desk",
"category": "Administration",
"label": _("Tools"),
"color": "#FFF5A7",
... |
# *- encoding: utf-8 -*-
"""
nistats version, required package versions, and utilities for checking
"""
# Author: Bertrand Thirion
# License: simplified BSD
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admi... |
# Copyright (C) 2013 Ion Torrent Systems, Inc. All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
#20130514 change log:
# 1) delete all chip entries to switch to using initial data load
class Migration(SchemaMigratio... |
"""
Credits:
This file was adopted from: https://github.com/pydata/xarray # noqa
Source file: https://github.com/pydata/xarray/blob/1d7bcbdc75b6d556c04e2c7d7a042e4379e15303/xarray/backends/rasterio_.py # noqa
"""
import contextlib
import os
import re
import threading
import warnings
import numpy as np
import raster... |
import logging
import discord
from discord.ext import commands
from core.state import global_state as gstate
from core import (
bot_utility as utility,
consts,
timers,
play_requests
)
from core.play_requests import PlayRequestCategory
from riot import riot_utility
logger = logging.getLogger('events')... |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="funnel", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceEducateCampusExamineQueryRequest(object):
def __init__(self, biz_model=None):
self._biz_model = biz_model
self._versio... |
import socket
import gevent
import cv2.cv as cv
def main():
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
while True:
img = cv.QueryFrame(capture)
"""
im_gray = cv.CreateImage(cv.GetSize(img),cv.IPL_DEPTH_8U,1)
cv.CvtColor(img,im_gray,cv.CV_RGB2GR... |
import boto3
from botocore.exceptions import ClientError
import json
import os
import time
import datetime
from dateutil import tz
from lib.account import *
from lib.common import *
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logging.getLogger('botocore').setLevel(logging.WARNING)
loggi... |
"""
DRS Registration device resource package.
Copyright (c) 2018-2019 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
... |
# Copyright (C) 2013-2014 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or dist... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-06 07:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... |
from datetime import datetime
from kivy.app import App
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import Screen
from kivy.properties import ObjectProperty
from kivy.properties import StringProperty
from cilantro_audit import globals
from cilantro_audit.constants import PROD_DB
from cilantro_audit.c... |
import pytest
from app.request_schemes.deregister_request_data import DeregisterRequestData
pytestmark = pytest.mark.asyncio
@pytest.mark.usefixtures('unstub')
class TestDeregisterRequestData:
@pytest.mark.parametrize("data", [
{'eventType': ''},
{'eventType': '', 'jobName': ''},
{'event... |
"""
discriminator model
"""
import torch
import torch.nn as nn
import torchvision.models as models
import json
from easydict import EasyDict as edict
from graphs.weights_initializer import weights_init
class EncoderModel(nn.Module):
def __init__(self,config):
super(EncoderModel, self).__init__()
... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
r"""
*Based on Google's TF Privacy:* https://github.com/tensorflow/privacy/blob/master/tensorflow_privacy/privacy/analysis/rdp_accountant.py.
*Here, we update this code to Python 3, and optimize dependencies.*
Functionality ... |
"""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
@Time : 2022/3/26 16:58
@File : miniflow.py
"""
"""
Implement the backward method of the Sigmoid node.
"""
import numpy as np
class Node(object):
"""
Base class for nodes in the network.
Arguments:
`inbound_nodes`: A list of nod... |
#!/usr/bin/python
#
# Test for full IK solutions of know robot(s)
# Copyright 2017 University of Washington
# Developed by Dianmu Zhang and Blake Hannaford
# BioRobotics Lab, University of Washington
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that th... |
"""
MIT License
Copyright (c) 2022 Mykola Bubelich
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, publis... |
from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ('celery_app',) |
from typing import List
from functools import partial
import torch
from .core import DecoderSpec
from ..blocks.core import _get_block
from ..blocks.psp import PSPBlock
from ..abn import ABN
class PSPDecoder(DecoderSpec):
def __init__(
self,
in_channels: List[int],
in_strides: List[int],
... |
#!/usr/bin/python
# Copyright (c) 2017-2018 ARM Limited
#
# SPDX-License-Identifier: Apache-2.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-... |
# Generated by Django 3.0.8 on 2020-07-30 06:55
from django.db import migrations, models
import kcss.models
class Migration(migrations.Migration):
dependencies = [
('kcss', '0004_auto_20200729_2327'),
]
operations = [
migrations.RemoveField(
model_name='conference',
... |
# coding: utf-8
"""
Domain Group API V1
Provides public access to Domain's microservices # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class DomainPublicAdapterWebApiModelsV1Listin... |
"""Test the colors module of the logger."""
from simber.colors import ColorFormatter
from colorama import Fore
def test_color_formatter():
"""Test the color_formatter method of the class"""
s = "%gnana%"
output = Fore.GREEN + "nana" + Fore.RESET
assert ColorFormatter().format_colors(s) == output, "S... |
import sqlite3
con = sqlite3.connect(":memory:")
con.row_factory = sqlite3.Row
cur = con.cursor()
cur.execute("select 'John' as name, 42 as age")
for row in cur:
assert row[0] == row["name"]
assert row["name"] == row["nAmE"]
assert row[1] == row["age"]
assert row[1] == row["AgE"] |
# 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 pulumi
import pulumi.runtime
class LoadBalancer(pulumi.CustomResource):
"""
Manages a V2 loadbalancer resource within O... |
import builtins
import warnings
import numpy as np
from aesara import config, printing
from aesara import scalar as aes
from aesara.gradient import DisconnectedType
from aesara.graph.basic import Apply, Variable
from aesara.graph.op import COp, Op
from aesara.graph.params_type import ParamsType
from aesara.graph.type... |
import re
import pwd
import grp
import ldap.asyncsearch
import ldap.filter
import ldap.dn
from ldapauthkeys.util import *
from ldapauthkeys.logging import get_logger
from ldapauthkeys.config import array_merge_unique
# List of paths where we'll search for an authmap
authmap_paths = [
'./authmap',
'/etc/openssh... |
"""Common functions script
This script will be appended to each server script before being executed.
Please notice that to add custom common code, add it to the CommonServerUserPython script.
Note that adding code to CommonServerUserPython can override functions in CommonServerPython
"""
from __future__ import print_fu... |
import logging
import os
from functools import wraps
from timeit import default_timer as timer
def setup_logs(save_file):
## initialize logger
logger = logging.getLogger("HomeCredit")
logger.setLevel(logging.INFO)
## create the logging file handler
fh = logging.FileHandler(save_file)
## create the loggin... |
import abc
import os
from ferramentas_produtos import *
from ferramentas_usuarios import *
class Usuario(abc.ABC):
licenca = None # Atributo de classe.
def __init__(self, login, senha):
self.login = login
self.senha = senha
self.licenca = Usuario.licenca
def cadastra_produto(sel... |
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the terms fo... |
# coding: utf-8
from __future__ import division, unicode_literals, print_function
import math
import os
import subprocess
import tempfile
import logging
import numpy as np
from monty.dev import requires
from monty.json import jsanitize
from monty.os import cd
from monty.os.path import which
from scipy.constants impo... |
# class that's used to open the local wave file, that's generated as spoken answer
import socket
class fileOpener():
def __init__(self):
pass
def openFile(self, uri):
# TODO: set the IP to the one that's currently used by Loomo (find it by accessing Loomo's settings)
LoomoIP = "192.16... |
from dca.DCA import DelaunayGraph
from dca.schemes import DelaunayGraphVisualizer
import numpy as np
import os
import matplotlib as mpl
if not "DISPLAY" in os.environ:
print("no display found. Using non-interactive Agg backend")
mpl.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D... |
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
data = pd.read_csv(path)
data.rename(columns={"Total":"Total_Medals"}, inplace=True)
data.head(10)
#Code starts here
# --------------
#Code starts here
data['Better_Event'] = np.wher... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
"""
Verify that derived descriptors get harvested correctly
"""
def test():
# get the descriptor package
from pyre import descriptors
# get the base metaclass
from pyre.patterns... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server_guardian', '0004_remove_server_logging'),
]
operations = [
migrations.RemoveField(
model_name='server',
... |
#!/usr/bin/env python2
import employees
import json
import sys
import urllib2
import pygame
import time
scoring_host='scoring.csc.uaf.edu'
#scoring_host='127.0.0.1:8081'
database=[]
index=3
def authorize(department,id,issue,flag_id):
global database
global scoring_host
lookup=employees.search(database,[id],True)
... |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello from Azure!'
if __name__ == '__main__':
app.run() |
# "elif", es una forma más corta de else-if.
#Se usa para verificar más de una condición,
#y para detener cuando se encuentra la primera declaración verdadera.
print("Selecciona una de las siguientes opciones:")
print("1. El Clima es bueno hoy")
print("2. Hay boletos disponibles en el Cine")
print("3. Hay mesas libres... |
from apscheduler.schedulers.background import BackgroundScheduler
from flask import Flask, request
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
import os
import os.path as path
import json
import csv
from scraper import scrape
from geocoder import get_lat_long
from ... |
import json
import logging
from markupsafe import escape as escape_html
from sqlalchemy import and_, false, or_, true
import tool_shed.grids.util as grids_util
import tool_shed.repository_types.util as rt_util
import tool_shed.util.shed_util_common as suc
from galaxy.web.framework.helpers import grids
from galaxy.web... |
import chain_flow
import datetime
import time
class Execute_Cf_Environment():
def __init__(self,cf ):
self.cf = cf
def execute(self):
time_stamp = datetime.datetime.today()
old_day = time_stamp.day
old_hour = time_stamp.hour
old_minute = time_stamp.minute
old_second = time_s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
header_template = '''\
#!/usr/bin/env python
import os
import sys
join = os.path.join
bin_dir = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
target_dir = os.path.dirname(bin_dir)
base = os.path.dirname(target_dir)
sys.path[0:0] = [
{path}
]
'''
... |
# Copyright (c) 2015, Disney Research
# All rights reserved.
#
# Author(s): Sehoon Ha <sehoon.ha@disneyresearch.com>
# Disney Research Robotics Group
import pydart2 as pydart
if __name__ == '__main__':
pydart.init()
print('pydart initialization OK')
world = pydart.World(0.0002, './data/skel/shapes.skel')
... |
# -*- coding: utf-8 -*-
from __future__ import print_function
__all__ = [
'is_token_expired',
'SpotifyClientCredentials',
'SpotifyOAuth',
'SpotifyOauthError'
]
import base64
import json
import os
import sys
import time
import requests
# Workaround to support both python 2 & 3
import six
import six.... |
#!/usr/bin/python
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of ... |
# -*- coding: utf-8 -*-
import sys
import numpy as np
import pytest
import scipy as sp
from pygam import *
def test_LinearGAM_prediction(mcycle_X_y, mcycle_gam):
"""
check that we the predictions we get are correct shape
"""
X, y = mcycle_X_y
preds = mcycle_gam.predict(X)
assert(preds.shape... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Fisher'] , ['MovingMedian'] , ['Seasonal_Hour'] , ['MLP'] ); |
from model_blender import important_gene_mask
from sklearn.metrics import log_loss
import numpy as np
def gene_weight_finder(model, X_train, X_test, y_train, y_test):
"""
function that returns the most important features, weights and # of features
inputs
-------
model: tree based model
X_train... |
# Copyright 2017 Joachim van der Herten
#
# 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 wr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.