content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
from meta_agents.samplers.base import Sampler
from meta_agents.samplers.base import SampleProcessor
from meta_agents.samplers.meta_sample_processor import MetaSampleProcessor
from meta_agents.samplers.meta_sampler import MetaSampler
from meta_agents.samplers.single_task_sampler import SingleTaskSampler
from meta_agents... | python |
import xml.etree.ElementTree as etree
tree = etree.parse('file.xml')
root = tree.getroot()
sentences = open('sentences.txt', 'wb')
pluralnouns = open('pluralnouns.txt', 'wb')
for source in root.iter('source'):
sentences.write((source.text + '\n').encode('utf-8'))
mVerb = 0
mConj = 0
for token in root.iter('tok... | python |
import datetime
import decimal
import re
from xml.dom.minidom import parseString
from .generic import PdfObject
from .utils import pypdfUnicode
RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
DC_NAMESPACE = "http://purl.org/dc/elements/1.1/"
XMP_NAMESPACE = "http://ns.adobe.com/xap/1.0/"
PDF_NAMESPACE =... | python |
#
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project sour... | python |
import requests
import shutil
import datetime
from subprocess import Popen, PIPE
import subprocess
import os
import matplotlib.pyplot as plt
import matplotlib as mpl
import cmaps
import numpy as np
base_url = "http://vtapp4aq.zamg.ac.at/wcs?"
service_url = "service=WCS&Request=GetCoverage&version=2.0.1"
coverage_... | python |
# Copyright (c) 2013-2015 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
#... | python |
import io
import json
import logging
import os
import platform
import re
import subprocess
import sys
import tempfile
import urllib.request
import zipfile
from typing import Dict, Any, List
import contextlib
from qhub.utils import timer, run_subprocess_cmd, deep_merge
from qhub import constants
logger = logging.get... | python |
from simon_game import simon
simon.main() | python |
# -*- coding: utf-8 -*-
import scrapy
from scrapy import signals
# from scrapy.xlib.pydispatch import dispatcher
import urllib
from konachan.items import KonachanItem
import logging
import json
import os
class PostSpider(scrapy.Spider):
name = 'post'
page = 1
number = 1
folder = 'tags-'
cache = {}
... | python |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | python |
# =====================================================
# FIDL test fixtures
# =====================================================
import pytest
from idc import *
from idaapi import *
from idautils import *
@pytest.fixture
def calls_in_putty():
"""Simple hardcoded information regarding function
calls abou... | python |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... | python |
"""Zipfile entry point which supports auto-extracting itself based on zip-safety."""
from importlib import import_module
from zipfile import ZipFile, ZipInfo, is_zipfile
import os
import runpy
import sys
PY_VERSION = sys.version_info
if PY_VERSION.major >= 3:
from importlib import machinery
else:
import imp... | python |
#!/usr/bin/python
#client send the video stream via a webcam
import socket
import cv2
import numpy
import re
import numpy as np
import os
from PIL import Image
import pygame
from pygame.locals import *
import sys
from googletrans import Translator
import urllib.request
## google translator
translator =... | python |
# Copyright (c) 2020. Robin Thibaut, Ghent University
import os
import re
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def read_res(file):
"""Reads ABEM type output text files. Lowers the columns and removes special characters."""
data = pd.read_csv... | python |
# Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/.
from os import O_NONBLOCK, O_RDONLY, close as os_close, open as os_open, read as os_read
from pprint import pprint
from shlex import quote as sh_quote
from string import Template as _Template
from sys import stderr, stdin, ... | python |
__title__ = "async_signature_sdk"
__version__ = "0.0.1"
| python |
import os
import random
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import rcParams
from matplotlib.lines import Line2D
from road_damage_dataset import RoadDamageDataset
from utils import roaddamage_label_names
from dataset_utils import load_labels_and_bboxes
rcParams['figure.figsize'] ... | python |
#Desafio: Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou.
#Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols
#feitos durante o campeonato.
... | python |
# -*- coding: UTF-8 -*-
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2016-2018 NV Access Limited, Derek Riemer
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
from ctypes.wintypes import BOOL
from typing import Any, Tuple, Optional
import wx
from c... | python |
# ----------------------------------------------------------------------
# Dashboard Layout
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Third-party... | python |
# Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... | python |
import sqlite3, os, roommates, unittest, tempfile, bcrypt
from datetime import datetime
class RoommatesTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, roommates.app.config['DATABASE'] = tempfile.mkstemp()
roommates.app.config['TESTING'] = True
self.app = roommates.app.test_client()
roommates.init_db... | python |
# encoding: utf-8
import itertools
import logging
from typing import Any, Tuple
import numpy as np
import pandas as pd
from .dataset import Dataset, copy_dataset_with_new_df
from .feature_operations import FeatureOperation, OneHotEncoder, OrdinalEncoder
logger = logging.getLogger(__name__)
NAN_CATEGORY = "Nan"
BIN... | python |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import pytest
from byceps.services.shop.article import service as article_service
from tests.helpers import generate_token
from tests.integration.services.shop.helpers import (
create_article,
create_ord... | python |
"""Task List.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
import json
class TaskList(object):
"""Task List."""
def __init__(self, task_list_dict=None, task_list_json=None):
"""Initialize TaskList Object.
Parameters
----------
task_list_dict : dict
task l... | python |
"""
Copy pin d2 to the on-board LED.
"""
import sys
sys.path.append( "../.." )
import hwpy
led = hwpy.gpo( hwpy.d13 )
button = hwpy.gpi( hwpy.d2 )
print( __doc__ )
while True:
led.write( button.read() ) | python |
def hamming(n, m):
n = bin(n)[2:]
m = bin(m)[2:]
m = m.rjust(max(len(m), len(n)), '0')
n = n.rjust(max(len(m), len(n)), '0')
return sum([1 for (x,y) in zip(m, n) if x != y])
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert h... | python |
"""
Copyright (c) Nikita Moriakov and Jonas Teuwen
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import numpy as np
from typing import Union
def clip_and_scale(
arr: np.ndarray,
clip_range: Union[bool, tuple, list] = False... | python |
from fastapi.routing import APIRoute
from typing import Callable
from fastapi import Request, Response
import time
import datetime
import json
class LoggingContextRoute(APIRoute):
def get_route_handler(self) -> Callable: # type: ignore
original_route_handler = super().get_route_handler()
async d... | python |
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Runs a power flow.
"""
from sys import stdout, stderr
from os.path import dirname, join
from time import time
from numpy import r_, c_, ix_, zeros, pi, ones... | python |
import subprocess
import pytest
def build_project(project_path):
return subprocess.check_output(['idf.py', '-C', project_path, 'build'])
@pytest.mark.parametrize(
'project', [
{
'components': {
'main': {
'dependencies': {
'unit... | python |
import os
from setuptools import setup
def git_version():
return os.system("git rev-parse HEAD")
# This file makes your module installable as a library. It's not essential for running apps with twined.
setup(
name="template-python-fractal",
version=git_version(),
py_modules=["app"],
)
| python |
import pytest
from rotkehlchen.constants.assets import A_BTC
from rotkehlchen.fval import FVal
from rotkehlchen.order_formatting import MarginPosition
from rotkehlchen.tests.utils.accounting import accounting_history_process
from rotkehlchen.tests.utils.history import prices
from rotkehlchen.typing import Timestamp
D... | python |
"""
Copyright (c) IBM 2015-2017. All Rights Reserved.
Project name: c4-system-manager
This project is licensed under the MIT License, see LICENSE
"""
from c4.system.backend import Backend
class Version(object):
@classmethod
def clearVersion(cls):
# FIXME: this only works with the shared SQLite backen... | python |
from .atihelper import Request
| python |
from transitions.extensions import GraphMachine
import time
life_level = 100
sick_level = 0
mood_level = 0
boring_level = 0
hungry_level = 0
money = 100
name = 'Joseph'
class TocMachine(GraphMachine):
def __init__(self, **machine_configs):
self.machine = GraphMachine(
model = self,
... | python |
import datetime
import http.client
import urllib.parse
import ssl
class sms(object):
def __init__(self, username, password, host='https://sms.stadel.dk/send.php', ssl_context=None):
"""Create a new SMS sender"""
self.srv = {
'username': username,
'password': password... | python |
"""Add column for time.
Revision ID: 0936420c5058
Revises: a8271346baba
Create Date: 2021-04-25 17:08:12.555683
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0936420c5058'
down_revision = 'a8271346baba'
branch_labels = None
depends_on = None
def upgrade():... | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-10-31 13:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('neighbourapp', '0002_auto_20191031_1259'),
]
operations = [
migrations.Rename... | python |
#!/usr/bin/env python3
'''
Created on 20180410
Update on 20180410
@author: Eduardo Pagotto
'''
#pylint: disable=C0301
#pylint: disable=C0103
#pylint: disable=W0703
#pylint: disable=R0913
import socket
from datetime import datetime
from flask import Flask, render_template, jsonify, json, request
application = Flask... | python |
# -*- coding: utf-8 -*-
import os
import random
import numpy as np
from pprint import pprint
from tensorflow.python.estimator.estimator import Estimator
from tensorflow.python.estimator.run_config import RunConfig
from tensorflow.python.estimator.model_fn import EstimatorSpec
from bert_encoder.bert.extract_features i... | python |
# 16. Write a program in Python to calculate the volume of a cylinder
r=int(input("Enter radius of the cylinder: "))
h=int(input("Enter height of the cylinder: "))
vol=3.14*(r**2)*h
print("Volume of the cylinder= ",vol)
| python |
# Generated by Django 3.2.9 on 2022-03-06 05:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shoppingapp', '0008_alter_bank_ac_emp_phone'),
]
operations = [
migrations.AlterField(
model_name='bank_ac',
name='a... | python |
# -*- coding: utf-8 -*-
# Автор: Гусев Илья
# Описание: Функции для обработки тегов.
def convert_from_opencorpora_tag(to_ud, tag: str, text: str):
"""
Конвертировать теги их формата OpenCorpora в Universal Dependencies
:param to_ud: конвертер.
:param tag: тег в OpenCorpora.
:param text: токен... | python |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS
Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | python |
from django.db import models
from django.contrib.auth.models import User
class CodeStyle(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
repository = models.CharField(max_length=255)
metrics = models.TextField(default='{}')
calc_status = models.CharField(max_l... | python |
# -*- coding: utf-8 -*-
import logging
import textwrap
from typing import List
from airflow_munchkin.client_parser.docstring_parser.bricks import SectionBrick
from airflow_munchkin.client_parser.docstring_parser.google_docstring_parser import (
GoogleDocstringParser,
)
def parse_docstring(docstring: str) -> List... | python |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic... | python |
from .revision_oriented import Revision
from .diff import Diff
__all__ = [Revision, Diff]
| python |
##!/usr/bin/env python3
import math
import pygame
from primitives import GameObject, Pose
import constants as c
from player import Player
class HighScoreColumn(GameObject):
def __init__(self, game, parent, get_data, align=c.LEFT, width=100, small_font=False):
super().__init__(game)
self.align = ... | python |
"""
project.config
----------------
Defines configuration classes
"""
import os
import logging
from . import BASE_PATH
class Config:
APP_MAIL_SUBJECT_PREFIX = '[PROJECT]'
APP_MAIL_SENDER = 'Project Name <project@example.org>'
APP_ADMINS = ['Admin <admin@example.org>']
SECRET_KEY = os.environ.get('SECR... | python |
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo
# Setup Basic Dialog window for user
class QDialog_Wordpress(QDialog):
def __in... | python |
""".. Ignore pydocstyle D400.
===========
Preparation
===========
.. autoclass:: resolwe.flow.executors.docker.prepare.FlowExecutorPreparer
:members:
"""
import os
from django.conf import settings
from django.core.management import call_command
from resolwe.storage.connectors import connectors
from .. import ... | python |
import string
# convert 5 to base 2 = 101
# encode (5, 2) -> 101
#converting base 10 to whatever base we give it
#loop to do the repeated division, where to stop?
#get the remainders and divisors
#save the remainders
#return the final number result as a string
#deal with hex digits
def encode(number, base... | python |
# coding=utf-8
from collections import Iterable
from typing import Any
from flask import Blueprint, Response, jsonify, render_template
from flask.views import MethodView
from pysite.constants import ErrorCodes
class BaseView(MethodView):
"""
Base view class with functions and attributes that should be commo... | python |
"""
Behavioral pattern:
Chain of responsibility
"""
from abc import ABC, abstractmethod
class AbstractHandler(ABC):
def __init__(self, successor):
self._successor = successor
def handle(self, request):
handled = self.process_request(request)
if not handled:
se... | python |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 14 2020
@author: Maria Kuruvilla
Goal - Code to visualise trajectoies in the tank to know the dimensions of the tank
"""
import sys, os
import pathlib
from pprint import pprint
import numpy as np
from scipy import stats
from scipy.spatial import distance
import matplo... | python |
'''
Created on Mar 29, 2016
@author: dj
'''
my_condition = 1
if my_condition == 0:
print("my_condition =", "Ok")
elif my_condition == 1:
print("my_condition =", "Not bad")
elif my_condition == 2:
print("my_condition =", "Good")
else:
print("my_condition =", "So, so")
print("-" * 40)
... | python |
from django.conf import settings
from django.contrib.auth import login
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from users.models import User
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = (
... | python |
"""
将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。
本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。
示例:
给定有序数组: [-10,-3,0,5,9],
一个可能的答案是:[0,-3,9,-10,null,5],它可以表示下面这个高度平衡二叉搜索树:
0
/ \
-3 9
/ /
-10 5
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# sel... | python |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftTYPECASTrightUMINUSrightUNOTleftMASMENOSleftPOTENCIAleftPORDIVRESIDUOleftANDORSIMBOLOOR2SIMBOLOORSIMBOLOAND2leftDESPLAZAMIENTOIZQUIERDADESPLAZAMIENTODERECHAABS ACOS... | python |
"""Contains source code for sample app for querying open movie database."""
| python |
from kafka import KafkaProducer
from kafka.errors import KafkaError
import ssl
import sys
import json
if len(sys.argv) != 2:
sys.exit("Usage: ./send_message.py text_to_send")
with open('etc/vcap.json') as data_file:
mhProps = json.load(data_file)
bootstrap_servers = mhProps['kafka_brokers_sasl']
sasl_pla... | python |
9368041
9322554
8326151
9321287
8926822
5085897
9129469
7343633
8138255
9209207
7725805
8201648
6410128
9289441
9375654
9158472
9149158
7234167
9015826
7641475
9428047
7739777
7720051
9614878
9139555
9353321
9129885
9411824
9214745
9592599
9017551
9141364
3250303
9292151
9668398
95866... | python |
import numpy as np
from mayavi import mlab
if __name__ == "__main__":
with open("sphere_100.data") as f:
# read first the dimension of the grid
d = np.fromfile(f, np.int32, 1)
print d
# read grid size
gr_dim = np.fromfile(f, np.int32, 3)
print gr_dim
... | python |
#!/usr/bin/env python3
from nettest.sockets import TcpSocket
from nettest.exceptions import NettestError
from nettest.tools.base import MultiSender
import sys
class TcpSender(MultiSender):
def _setup_args(self, parser, need_data=True):
super(TcpSender, self)._setup_args(parser)
parser.add_argument... | python |
text = str(input("Digite o seu nome completo: "))
print("O nome completo com todas as lestras maiúsculas é: {}".format(text.upper()))
print("O nome completo com todas as letras minúsculas é: {}".format(text.lower()))
divido = text.split()
quant = int(len(text) - len(divido) + 1)
print("A quantidade de letras sem esp... | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import nltk
from nltk.corpus import wordnet as wn
NOUNS = ['NN', 'NNS', 'NNP', 'NNPS', 'PRP', 'PRP$']
def extractNouns(sentence):
nouns = []
text = nltk.word_tokenize(sentence)
word_tags = nltk.pos_tag(text)
for word_tag in word_tags:
if word_tag[1] in NOUNS:
... | python |
import numpy as np
import pdb
import pandas as pd
import matplotlib.pyplot as plt
def selection_coefficient_calculator(genotype_freq_file):
output_file = 'temp.csv'
df = pd.read_csv(genotype_freq_file)
with open(output_file,'w') as output_f:
output_f.write('p,A,a\n')
for i in range(len(df)-... | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-12 21:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('event_store', '0005_auto_20170602_1835'),
('event_exim', '0005_auto_20170531_1458'),... | python |
# Generated by Django 4.0.2 on 2022-03-02 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0005_remove_order_payment_status_order_complete'),
]
operations = [
migrations.AddField(
model_name='product',
... | python |
import hashlib
from flask_jwt import JWT
from bson.objectid import ObjectId
from sapia.models.user import User
def authenticate(username, password):
db_user = db.user.find_one({"email": username})
if db_user and bcrypt.check_password_hash(db_user["password"], password):
user = User.short(str(db_user["... | python |
unsorted_array = [5, 6, 0, 1, 2, 7, 6, 5, 1, 10, 11, 12, 67, 2, 6, 9, 32]
class Node():
__slots__ = ['value', 'left', 'right']
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def add(self, x):
if x <= self.value:
if self.left ... | python |
from abc import ABC
from dataclasses import dataclass
from typing import Type, Union, List
from flask import make_response, jsonify
from lab_orchestrator_prototype.app import db
from lab_orchestrator_prototype.kubernetes.api import APIRegistry, NamespacedApi, NotNamespacedApi
from lab_orchestrator_prototype.model imp... | python |
# A library to run imagemagick from Python.
# By MineRobber9000
# Licensed under MIT
import subprocess, shutil
def pairs(o):
for k in o:
yield k,o[k]
def wrapper(cmd,input,output,**kwargs):
command = [cmd,input]
for k,v in pairs(kwargs):
command.extend(["-{}".format(k),str(v)])
command.append(output)
return ... | python |
name = "aiowiki"
from .wiki import *
from .exceptions import *
| python |
# The MIT License (MIT)
#
# Copyright (c) 2018-2020 Frederic Guillot
#
# 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, c... | python |
#ATS:t0 = test(SELF, "--graphics None", label="Periodic boundary unit test -- 1-D (serial)")
#ATS:t1 = test(SELF, "--graphics None", np=2, label="Periodic boundary unit test -- 1-D (parallel)")
#-------------------------------------------------------------------------------
# 1D test of periodic boundaries -- we ... | python |
"""
Given a non-negative number represented as an array of digits,
add 1 to the number ( increment the number represented by the digits ).
The digits are stored such that the most significant digit is at the head of the list.
Example:
If the vector has [1, 2, 3]
the returned vector should be [1, 2, 4]
as 123 + 1 ... | python |
"""
Iterative forms of operations
"""
import warnings
from shapely.errors import ShapelyDeprecationWarning
from shapely.topology import Delegating
class IterOp(Delegating):
"""A generating non-data descriptor.
"""
def __call__(self, context, iterator, value=True):
warnings.warn(
"Th... | python |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 06 20:24:16 2020
@author: sagarmakar
"""
| python |
import requests
import re
import os
from fake_useragent import UserAgent
class crawler(object):
def __init__(self, url, templateUrl):
self.baseUrl = url
self.template = templateUrl
self.counter = 1
self.timeout = 10
ua = UserAgent()
self.header = {'User-Agent': str(... | python |
from django.shortcuts import render
from .models import Committee
# Create your views here.
def about_page_view(request, *args, **kwargs):
committee = Committee.objects.all()
context = {'committee': committee}
return render(request, 'about/about.html', context) | python |
# from distribute_setup import use_setuptools
# use_setuptools()
from setuptools import setup, Extension
# check if cython or pyrex is available.
pyrex_impls = 'Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext'
for pyrex_impl in pyrex_impls:
try:
# from (pyrex_impl) import build_ext
build_e... | python |
import random
list1 = ["0","1","2","3","4","5","6","7","8","9"]
num = random.sample(list1, 4)
ans = "".join(num)
Guess = input("Enter 4 different numbers: ")
while int(Guess) in range(0, 10000):
A = 0
B = 0
if Guess == ans:
print("Bingo! The answer is ", ans)
break
else:
if Gues... | python |
import unittest
from PiCN.Playground.AssistedSharing.IndexSchema import IndexSchema
class test_IndexSchema(unittest.TestCase):
def test_create_empty(self):
# index schema
alice_index_schema = ''.join(("doc:/alice/movies/[^/]+$\n"
" -> wrapper:/irtf/icnrg/fl... | python |
"""Main script to train the doctors.
There are two versions - simple and complex. Depending on which should run, game_version needs to be set
"""
# external imports
import os
import random
import copy
import sys
import json
import time
from numpy.random import permutation
import rl_setup
def train(patient_list,... | python |
import string
def converter(convertin_text):
convertin_text.replace(" ", "-")
convertin_text.replace(".", "")
convertin_text.replace("ž", "z")
convertin_text.replace("Ž", "z")
convertin_text.replace("ý", "y")
convertin_text.replace("Ý", "y")
convertin_text.replace("á", "a")
convertin_tex... | python |
from typing import List
def arraysum(array: List[int]) -> int:
""" Get the sum of all the elements in the array.
arraysum
========
The `arraysum` function takes an array and returns the sum of all of its
elements using divide and concuer method.
Parameters
----------
array: List[int]
... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='bulk-mail-sender',
version='0.1',
description='Send emails in bulk with a CSV listing and a email template.',
author='Clément Martinez',
author_email='clementmartinezdev@gmail.com',
url='https://github.com/... | python |
from typing import List, Optional, Dict
from transmart_loader.transmart import Concept as TLConcept, TreeNode as TLTreeNode, StudyNode as TLStudyNode, \
Study as TLStudy, ConceptNode as TLConceptNode, TreeNodeMetadata
from dicer.mappers.mapper_helper import observed_value_type_to_value_type
from dicer.transmart i... | python |
"""
=====================================
SGDOneClassSVM benchmark
=====================================
This benchmark compares the :class:`SGDOneClassSVM` with :class:`OneClassSVM`.
The former is an online One-Class SVM implemented with a Stochastic Gradient
Descent (SGD). The latter is based on the LibSVM implementa... | python |
# Generated by Django 2.0 on 2020-03-04 05:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('myapp', '0001_initial'),
migrations.... | python |
# coding: utf-8
# In[19]:
import os
import json
import tensorflow as tf
import tensorflow.contrib.slim as slim
from models.nnets import NN
from utils.vocabulary import Vocabulary
from config.config import Config
from models.models import ShowAttendTell
from copy import deepcopy
def update_dict(file_name):
wi... | python |
#################################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Dmitry Sovetov
#
# https://github.com/dmsovetov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... | python |
import numpy as np
from numpy.testing import (assert_equal, assert_array_equal,
assert_array_almost_equal, assert_raises)
import bottleneck as bn
from .reduce_test import (unit_maker as reduce_unit_maker,
unit_maker_argparse as unit_maker_parse_rankdata)
from .util ... | python |
from typing import Any, Dict, List, Union
import boto3
from chaoslib.exceptions import FailedActivity
from chaoslib.types import Configuration, Secrets
from logzero import logger
from chaosaws import aws_client
from chaosaws.types import AWSResponse
__all__ = ["instance_status", "cluster_status", "cluster_membership... | python |
import json
import os
import datetime
import time
import socket
import requests
class ClockModel(object):
def __init__(self):
__location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__)))
with open(os.path.join(__location__, "config.json"), "r") as jsonfile:
C... | python |
# -*- coding: utf-8 -*-
"""Interpreter
======
Interpreter Class
"""
from typing import Tuple
from deepgo.core.pattern.singleton import AbstractSingleton, abstractmethod
from deepgo.shell.command import *
class Parser(AbstractSingleton):
"""Parser Interface
This is an Abstract Singleton Class
"""
@a... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.