content stringlengths 5 1.05M |
|---|
from flask import Flask, abort, request
from flask_cors import CORS
import redis as red
import serial, serial.tools.list_ports
import json, struct, sys, time
import threading
####* DEFAULT ARGUMENTS *####
try:
sys.argv[1]
except IndexError:
baudrate = 115200
else:
baudrate = sys.argv[1]
try:
sys.argv[... |
def decode(data):
strings = [x for x in data.split('\n') if len(x) > 0]
pairs = [l.split('->') for l in strings]
pairs = [[i.strip() for i in x] for x in pairs]
pairs = [tuple([tuple([int(i) for i in j.split(',')]) for j in x]) for x in pairs]
return pairs
def print_map(map):
if len(map) > 0:
... |
import os
import torch
import onnxruntime as ort
import pandas as pd
import numpy as np
import os
import time
import torch.nn.functional as F
import onnx
import getpass
from transformers import AutoTokenizer
import time
import pyarrow.parquet as pq
from glob import glob
import os
import numpy as np
import argparse
impo... |
# -*- coding: utf-8 -*- #
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
import pandas as pd
from datetime import datetime, timedelta
from comet_utils.processor.processor import Processor as p
from time import sleep
from comet_utils.analyzer.entry_strategy import EntryStrategy
from comet_utils.analyzer.exit_strategy import ExitStrategy
import pickle
class Backtester(object):
@classmet... |
# Copyright (c) 2013, Kevin Greenan (kmgreen2@gmail.com)
# 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 c... |
from __future__ import absolute_import
from sentry.tasks.signals import signal
from sentry.testutils import TestCase
class SignalTest(TestCase):
def test_task_persistent_name(self):
assert signal.name == "sentry.tasks.signal"
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import nltk.data
def getNGrams(n, text):
ngram_set = set()
text_length = len(text)
max_index_ngram_start = text_length - n
for i in range (max_index_ngram_start + 1):
ngram_set.add(tuple(text[i:i+n]))
#ngram_set.add(text[i])
r... |
'''Crie um programa que leia vรกrios nรบmeros inteiros pelo teclado.
No final da execuรงรฃo, mostre a mรฉdia entre todos os valores e qual foi o maior e o menor valores lidos.
O programa deve perguntar ao usuรกrio se ele quer ou nรฃo continuar a digitar valores.'''
n = 0
med = 0
cont = 0
soma = 0
maior = 0
menor = 0
continuar... |
"""Test pyscripts test module."""
from custom_components.pyscript.state import State
from pytest_homeassistant_custom_component.async_mock import patch
from homeassistant.core import Context
from homeassistant.helpers.state import State as HassState
async def test_service_call(hass):
"""Test calling a service us... |
# /*
# * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# *
# * Licensed under the Apache License, Version 2.0 (the "License").
# * You may not use this file except in compliance with the License.
# * A copy of the License is located at
# *
# * http://aws.amazon.com/apache2.0
# *
# * or i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""File with mock classes."""
class MockRepo(object):
"""MockClass to represent a GitRepository."""
def __init__(self, full_name, description):
"""Constructor.
:param full_name: Name of the repository.
:param description: Description of the ... |
import gnssShadowing
import pytest
import numpy as np
def test_MapNode():
a=gnssShadowing.MapNode()
assert a.x == 0
assert a.y == 0
assert type(a.x) == int
assert type(a.y) == int
a=gnssShadowing.MapNode(1,2)
assert a.x == 1
assert a.y == 2
a.x = 3
a.y = 4
assert a.x == 3
... |
'''
In this exercise, assume that you are looking to start a business in the city of Chicago. Your perfect idea is to start a company that uses goats to mow the lawn for other businesses. However, you have to choose a location in the city to put your goat farm. You need a location with a great deal of space and relativ... |
import numpy as np
from mvn import *
from utils import kernel_covariance
class FactorGP:
"""
Latent factor Gaussian process model for multivariate time series
Data: n epochs, t time points, q dimensional, r latent factors
Parameters: loading matrix (r x q), variance vector (q), length scale (r)
Pr... |
#!/usr/bin/env python
import os
import sys
import time
import datetime
from numpy import base_repr
from PIL import Image
#Argparse
import argparse
# beautiful soup
import bs4 as bs
# Selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriv... |
# Copyright 2022 Quantapix 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 l... |
# manos.py
"""
td - todos diferentes
1p - 1 par
2p - 2 pares
tercia - 3 iguales
full - 1 trio y 1 par
poker - 4 iguales
quintilla - todos iguales
"""
probabilidad = {'td':0.30240, '1p':0.50400, '2p':0.10800, 'tercia':0.07200, 'full':0.00900, 'poker':0.00450, 'quintilla':0.00010}
def quintilla(numero):
digito1 = num... |
"""
# This files originate from the "PyPipes" project:
# https://github.com/ZENULI/PyPipes
# Created by ZENULI at University Paul Sabatier III :
# https://github.com/BastienKovac
# https://github.com/Ulynor
# https://github.com/seb2s
# License:
# MIT License Copyright (c) 2022 ZENULI
"""
import sys
sys.path.... |
minNum = int(input('What\'s your minimum number? '))
maxNum = int(input('What\'s your maximum number? '))
def myNumbers(minNum, maxNum):
myList = []
for num in range(minNum, maxNum + 1):
myList.append(num)
print(myList)
myNumbers(minNum, maxNum)
|
# -*- coding: utf-8 -*-
"""
Created on Tue May 16 18:25:31 2017
@author: nchitta
"""
import visa, matplotlib.pyplot as plt,time, csv
#Lets Initialize our resource manager to speak with the devices
rm=visa.ResourceManager()
#We want to do this just to check out spool results for reference later on.
rm.list_re... |
"""This module provides test for the pca task."""
import pandas as pd
import numpy as np
from fractalis.analytics.tasks.pca.main import PCATask
# noinspection PyMissingTypeHints
class TestPCATask:
task = PCATask()
def test_correct_output(self):
features = [
pd.DataFrame([[101, 'foo', 5... |
# -*- coding: utf-8 -*-
import torch
import numpy as np
from linearlayers import cmultiply
import sys
import os
def random_point_on_disk(N):
r = torch.rand(N)
t = torch.rand(N)*2*np.pi
output=torch.empty(N+tuple([2]))
output[...,0] = torch.sqrt(r)*torch.cos(t)
output[...,1] = torch.sqrt(r)*t... |
# Generated by Django 3.1.1 on 2021-04-03 18:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("charity", "0010_auto_20210403_1729"),
]
operations = [
migrations.CreateModel(
name="CCEWCharity",
fields=[
... |
from unittest.mock import MagicMock
from mpf.platforms.interfaces.driver_platform_interface import PulseSettings
from mpf.core.platform import SwitchSettings, DriverSettings
from mpf.tests.MpfTestCase import MpfTestCase
class TestKickback(MpfTestCase):
def get_config_file(self):
return 'config.yaml'
... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
import multiprocessing
import sys
def worker_with(lock, f):
with lock:
fs = open(f, 'a+')
n = 10
while n > 1:
fs.write("Locked acquired via with\n")
n -= 1
fs.close()
def worker_no_with(lock, f):
lock.acquire()
try:
fs = open(f, 'a+')
... |
import pickle
import json
import spacy
import random
from spacy.util import minibatch, compounding
from pathlib import Path
import os
import training.config as config
def custom_nlp_train(filename, output_dir):
with open(filename, 'rb') as fp:
doc = pickle.load(fp)
## Creating a blank spacy mode... |
from arekit.common.data import const
from arekit.common.data.input.providers.columns.base import BaseColumnsProvider
class SampleColumnsProvider(BaseColumnsProvider):
"""
[id, label, text_a] -- for train
[id, text_a] -- for test
"""
def __init__(self, store_labels):
super(SampleColumnsPro... |
from rest_framework.exceptions import APIException
from django.utils.encoding import force_text
from rest_framework import status
class CustomValidation(APIException):
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
default_detail = 'A server error occurred.'
def __init__(self, detail, field, status_... |
"""Script used to split the UrbanSound8K dataset by class into separate folders"""
import os
import shutil
FOLDS = ['9', '10'] # the folds to be split
csv = open("../data/UrbanSound8K.tar/UrbanSound8K/metadata/UrbanSound8K.csv")
csv.readline()
for line in csv.readlines():
split = line.split(",")
slice_file_... |
from sklearn.linear_model import Perceptron
from import_data import import_raw_data, get_features_and_target
from data_cleaning import complete_cleaning
train_chunks = import_raw_data('train', by_chunk=True)
model = Perceptron(penalty='l2',
alpha=0.0001,
fit_intercept=True,
... |
import time
class Simulator():
__sample_rate: float
__time_step: float # sample_rate converted for time.
__simulating: bool
def __init__(self, sample_rate: float = 1):
self.__sample_rate = sample_rate
self.__time_step = 1 / sample_rate
def __execute(self):
print("simulate"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayBusinessOrderCancelResponse(AlipayResponse):
def __init__(self):
super(AlipayBusinessOrderCancelResponse, self).__init__()
self._merchant_order_no = None
... |
'''
Miscellaneous functions for SpiralDraw.py
Developed by Richie Zhang for the 2016 IB Math SL Internal Assessment.
The class 'SpiralDrawMisc' was mostly used for testing during development
but was also used occasionally when writing the IA.
MIT Licensed, Copyright (c) 2016 Richie Zhang
'''
import turtle
class Spi... |
# encoding: utf-8
from http import HTTPStatus
from flask_restx import Resource
from hash_chain.app.modules.auth.decorators import admin_token_required
from hash_chain.app.modules.ledger.ddl.dto import DdlDto
from hash_chain.app.modules.ledger.ddl.services import DdlServices
from hash_chain.app.modules.ledger.paramete... |
##########################################################################################################
#Author: Amit Shinde
#Date: 30 March 2020
#Desc: This paython code is based on AI, code will Accepts a text file as an argument and generates questions from it.
#Type: Supervisied Learni... |
import numpy as np
from .track import Track
from .linear_assignment import LinearAssignment, iou_distance, cosine_distance
class Tracker(object):
def __init__(self,
metric,
min_distance=0.5,
n_init=6,
max_disappeared=5,
max_age=8... |
import sys, os
path - os.path.dirname(__file__)
sys.path.append(path)
from core import src
if __name__ == "__main":
src.run() |
#!/usr/bin/env python3
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Update the firebase project hosting the Super Size UI."""
import os
import shutil
import subprocess
import sys
import tempfile
imp... |
from __future__ import print_function
from CGAL.CGAL_Kernel import Point_3
from CGAL.CGAL_Kernel import Plane_3
from CGAL import CGAL_Convex_hull_3
from CGAL.CGAL_Polyhedron_3 import Polyhedron_3
pts = []
pts.append(Point_3(0, 0, 0))
pts.append(Point_3(0, 1, 0))
pts.append(Point_3(1, 1, 0))
pts.append(Point_3(1, 0, 0)... |
"""
@brief test log(time=1s)
You should indicate a time in seconds. The program ``run_unittests.py``
will sort all test files by increasing time and run them.
"""
import unittest
from pyquickhelper.pycode import ExtTestCase
from csharpy.cparts import version_c
from csharpy import __version__
class TestCModule(E... |
#
# Copyright (C) 2008, Brian Tanner
#
#http://rl-glue-ext.googlecode.com/
#
# 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 requir... |
import random
from main_lib.AppointmentSchedule import AppointmentSchedule
from main_lib.Appointment import Appointment
from main_lib.Doctor import Doctor
from main_lib.HealthcareProfessional import HealthcareProfessional
from main_lib.Nurse import Nurse
from main_lib.Patient import Patient
from main_lib.Prescription ... |
#!/usr/bin/env python
"""
Network server to receive GfxTables events based
on version 1 of this network tablet protocol.
https://github.com/rfc2822/GfxTablet/blob/master/doc/protocol.txt
Version 1
---------
GfxTablet app sends UDP packets to port 40118 of the destination host.
Packet structure, uses network byte or... |
import json
from ..tobject import TObject
class Base(TObject):
@property
def as_json(self):
return json.dumps(self.__dict__)
@classmethod
def from_json(cls, *args, **kargs):
cls(json.loads(args))
|
#Import Packages
import tkinter
import random
from random import randint
from tkinter import Button
import matplotlib.pyplot as plt
import numpy as np
#Interface layout
root = tkinter.Tk()
root.title('Basic GUI for Machines 2')
root.geometry("400x200")
correct_result = 0
correct_answers = 0
total_questions = 0
incorre... |
#!/usr/bin/env python
'''
given tumour and normal vcf pairs, explore msi status
'''
import argparse
import csv
import logging
import sys
def main(vep_header):
logging.info('starting...')
vep_fields = vep_header.split('|')
header = None
writer = csv.writer(sys.stdout, delimiter='\t')
for row_count, row in... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lift_zone.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.protobuf import reflection as _ref... |
# Copyright (c) 2020, Huawei Technologies.All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law... |
# Constants for console colors
W = '\033[0m' # white (normal)
R = '\033[1;41m' # red
G = '\033[1;42m' # green
O = '\033[1;33m' # orange
B = '\033[1;34m' # blue
P = '\033[1;35m' # purple
|
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import math
import warnings
import weakref
import numpy as np
from jax import lax, ops, tree_flatten, tree_map, vmap
from jax.dtypes import canonicalize_dtype
from jax.flatten_util import ravel_pytree
from jax.nn import softplus
impo... |
๏ปฟ# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
"""Contain logic to help format logging messages in a consistent way."""
from datetime import datetime
import logging, os
from typing import Callable, Dict, Option... |
# Copyright 2018 Google Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from rest_framework.response import Response
from rest_framework import status
class ResponseFail(Response):
def __init__(self, data=""):
data = {"code":200, "error":True, "status": "fail", "result": data}
self.__init__ = super().__init__(data, status=200)
class ResponseSuccess(Response):
de... |
import sys, logging
from socketserver import ThreadingMixIn
from http.server import HTTPServer
import socket, ssl
import config, features
import handlers
# _SERVICES = [ 'ksp', handlers.TODO, handlers.CDE, handlers.FIRS, handlers.FIRS_TA ]
class Server (ThreadingMixIn, HTTPServer):
"""
actual HTTP server, though ... |
import Levenshtein
from math import sqrt
import sys
l_distance = Levenshtein.distance
match = {"inv-match", "sub-match", "sub-match-norm"}
def e_s(x, is_eu):
if is_eu:
return x**2
else:
return x
def e_f(x, is_eu):
if is_eu:
return sqrt(x)
else:
return x
def dista... |
from django.apps import AppConfig
class DescriptionConfig(AppConfig):
name = 'description'
|
def add(x, y):
return x+y
def subtract(x, y):
return abs(x-y)
|
# -*- coding: utf-8 -*-
"""
Conversion extensions for basic LOD models
"""
from datetime import datetime
class ConvertBase:
"""
Common convert extension for basic LOD models
"""
__index_sort_import__ = None
__index_sort_export__ = None
__load_from_file__ = True
__load_to_file__ = True
... |
from django.http import HttpResponse
from rnk.forms import LinkForm
from django.shortcuts import render
from rnk.classifier import callit
from rq import Queue
#import gc
def index(request):
return render(request, 'test.html')
def result(request):
link = "No Link"
#cls = ""
#prb = 0.0
if request.... |
#!/usr/bin/env python
import argparse
import commands
import getpass
import os
import os.path
import sys
import time
from env import gidgetConfigVars
import miscIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
def getFeatureIndex(indexString, featureMatrixFile):
print " <%s>... |
from __future__ import absolute_import, division, print_function
# XXX most of this code is unused when run from the command line, but the
# PHENIX GUI includes a simple frontend that uses the phil interface.
import libtbx.phil
import libtbx.phil.command_line
from libtbx.utils import Sorry
#from libtbx import easy_ru... |
from django.http import HttpResponse
import logging
logger = logging.getLogger(__name__)
# Create your views here.
def helloworld(request):
logging.error('Hello world DJ4E in the log...')
print('Hello world f231f210 DJ4E in a print statement...')
visits = request.session.get('visits', 0) + 1
reques... |
# -*- coding: utf-8 -*-
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '')
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
# built in
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.content... |
from __future__ import print_function
import tensorflow as tf
# Explicitly create a computation graph
graph = tf.Graph()
with graph.as_default():
# Declare one-dimensional tensors (vectors)
input1 = tf.constant([1.0, 2.0])
input2 = tf.constant([3.0, 4.0])
# Add the two tensors
output = tf.add(inpu... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import os
from datadog_checks.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
COMPOSE = os.path.join(HERE, 'compose')
ROOT = os.path.dirname(os.path.dirname(HERE))
C... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import math
import random
#y^2=x^3+ax+b mod n
prime=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, ... |
import random
import json
import pickle
import numpy as np
import nltk
from nltk.sten import WordNetLemmatizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers Dense, Activation, Dropout
from tensorflow.optimizers import SGD
lemmatizer = WordNetLemmatizer()
intents = json.loads(open('int... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
def content_file_name(instance, filename):
return '/'.join(['pics', instance.user.username, filename])
class appField(models.Model):
appField = models.CharField(max_length=30)
def __str__(self):
... |
# -*- coding: utf-8 -*-
"""`sphinx_minoo_theme` on `Github`_.
.. _github: https://github.com/saeiddrv/SphinxMinooTheme
"""
from setuptools import setup
from sphinx_minoo_theme import __version__
setup(
name = "sphinx_minoo_theme",
version = __version__.info(),
url = "https://github.com/saeiddrv/SphinxMi... |
"""Lovelace04_PartB.py"""
"""Licensed Under the MIT License: CHECK IN REPO: https://github.com/Rongmario/FoP-T1-Assignment-2020"""
__author__ = "Rongmario"
def main(expression: str): # Expects user's input in the function (string)
if len(expression) == 0:
return "Empty string." # Output when user... |
'''ips .txt'''
def ip_ok(ip):
ip = ip.split('.')
for byte in ip:
if int(byte) > 255:
return False
return True
arq=open('ips.txt')
validos=open('vรกlidos.txt','w')
invalidos=open('invรกlidos.txt','w')
for linha in arq.readlines():
if ip_ok(linha):
validos.write(linha)
else:... |
import sys
import random
import os
import re
import time
def set_option(option):
if option == 'R': return 'โ - Rock'
if option == 'P': return 'โฎ - Paper'
if option == 'S': return 'โ - Scissors'
return 'x'
def user_won(result):
if result:
print('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ')
print('โ ๐ ๐ ... |
import requests
import bs4
import jk_pypiorgapi
from errors.errors_api import UrlNotFound, SiteError
from errors.errors_pack import MultiplePackageFound, PackageNotFound
EXT_BUILD = {"bdist_wheel": "whl", "sdist": ("tar.gz", "zip")}
URL_SIMPLE_PYPI = "https://pypi.org/simple/"
URL_PYPI = "https://pypi.org/"
get_... |
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# uu.formlibrary package
import sys
import logging
from zope.i18nmessageid import MessageFactory
PKGNAME = 'uu.formlibrary'
_ = MessageFactory(PKGNAME)
product_log = logging.getLogger(PKGNAME)
product_log.addHandler(logging.StreamHandler(sys.stderr))
|
from bar_simulation.person import Person
def main():
p1 = Person()
print("Number of instances in Person:", Person.get_no_instances())
p2 = Person()
p3 = Person()
print("Number of instances in Person:", Person.get_no_instances())
del p3
print("Number of instances in Person:", Person.get_no_... |
import json
def get_dso_id(data, dso_name):
for index, keys in enumerate(data['features']):
if dso_name == keys['id']:
return index
return -1
def add_dso_to_catalog(catalog, dso_id, source_catalog_name):
# Search if the object already is on the catalog
for dso in catalog:
... |
from factory import Factory, Faker
from pss_project.api.models.rest.metadata.JenkinsMetadata import JenkinsMetadata
class JenkinsMetadataFactory(Factory):
class Meta:
model = JenkinsMetadata
jenkins_job_id = Faker('pystr_format', string_format='###')
|
import sqlalchemy as sa
from sqlalchemy.orm import relationship
import geoalchemy2 as ga
from .database import Base
from api.schemas import Gender, InterestedIn
class User(Base):
__tablename__ = "users"
id = sa.Column(sa.String, primary_key=True, index=True)
gender = sa.Column(sa.Enum(Gender, name="gender_e... |
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is d... |
#!/usr/bin/python3
''' Interface principal do Candida '''
from arguments import parse_arguments
# processo a entrada e o help
cli_arguments = parse_arguments()
print("*** Candida ***")
if cli_arguments.a != None:
print("* Procurando por '%s' *" % cli_arguments.a)
else:
print("Use -a to say what software you want... |
# Generated by Django 3.2.4 on 2021-06-17 14:09
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("geneinfo", "0023_materialized_view_geneidinhpo_fix"),
]
operations = [
migrations.AlterField(
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from pymongo import MongoClient
conn = MongoClient('127.0.0.1', 27017)
db = conn.mydb
my_set = db.test_set
my_set.insert({"name":"joe001","age":3})
my_set.insert({"name":"joe002","age":4})
my_set.insert({"name":"joe003","age":5})
for i in my_set.find():
print(i) |
# AUTHOR: Sanket Khadse
# Python3 Concept: Find first and last positions of an element in a sorted array
# GITHUB: https://github.com/edusanketdk
def sol_1(ar: list, x: int) -> tuple:
"""using index function"""
return (ar.index(x), len(ar)-ar[::-1].index(x)-1) if x in ar else (-1, -1)
def sol_2(ar: list, x:... |
import versioneer
import os
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
# Dependencies.
with open('requirements.txt') as f:
requirements = f.readlines()
install_requires = [t.strip() for t in requirements]
with open(os.path.join(here, 'README.md'), encoding='utf-... |
# Copyright 2020 Marcello Yesca
#
# 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=C0103,W0703
"""
yaml_check.py
Check if there is syntax error in YAML file. If it's good, do a pretty printing in JSON format.
"""
import sys
import os
import argparse
import json
import yaml
parser: argparse.ArgumentParser = argparse.ArgumentParser(... |
# Generated by Django 2.2.2 on 2019-06-28 18:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('oracle_db', '0002_auto_20190627_1541'),
]
operations = [
migrations.AlterModelOptions(
name='xxtmp_po_headers',
options={'ma... |
# -*- coding: utf-8 -*-
import urllib, urllib2, json
def coord(address):
params = {
'address' : address,
'sensor' : 'false',
}
url = 'https://maps.googleapis.com/maps/api/geocode/json?' + urllib.urlencode(params)
response = urllib2.urlopen(url)
result = json.load(response)
tr... |
#
# PySNMP MIB module BDCOM-QOS-PIB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BDCOM-QOS-PIB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:36:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
# coding: utf-8
# /*##########################################################################
# MIT License
#
# Copyright (c) 2018 DAXS developers.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwar... |
from setuptools import setup
with open('README.rst', 'r') as file:
long_desc = file.read()
version = __import__('django_mediamosa').get_version()
setup(
name='django-mediamosa',
version=version,
author='UGent Portaal Team',
author_email='portaal-tech@ugent.be',
packages=['django_mediamosa', '... |
from .logic_adapter import LogicAdapter
from .closest_match import ClosestMatchAdapter
from .closest_meaning import ClosestMeaningAdapter
from .time_adapter import TimeLogicAdapter
from .multi_adapter import MultiLogicAdapter
from .no_knowledge_adapter import NoKnowledgeAdapter
from .mathematical_evaluation import Math... |
import sys
# Add your fancy code here
print(f"Running with argument {sys.argv[1]}") |
# -*- coding: utf-8 -*-
'''
##########################
Acme::MetaSyntactic::screw
##########################
****
NAME
****
Acme::MetaSyntactic::screw - The screw drives theme
***********
DESCRIPTION
***********
This theme lists different screw drive types.
See `https://en.wikipedia.org/wiki/Screw_drive <https... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.builtins import *
import time
import contextlib
import numpy as np
class Measurement(object):
"""Abstract base class defining the heat capacity measurement interface.
... |
"""
IP Types
"""
import logging
from ipaddress import ip_address
from socket import AF_INET, AF_INET6
from vpp_papi import VppEnum
from vpp_object import VppObject
try:
text_type = unicode
except NameError:
text_type = str
_log = logging.getLogger(__name__)
class DpoProto:
DPO_PROTO_IP4 = 0
DPO_P... |
import os
import tensorflow as tf
import numpy as np
'''Explaining how to custom input for tensorflow models.
'''
def input_pipe_fn(session):
dataset = tf.contrib.data.Dataset.from_tensor_slices(
tf.reshape(np.arange(200), [-1, 2])
)
dataset = dataset.batch(4)
iterator = dataset.make_init... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.