text stringlengths 2 999k |
|---|
def solution(A):
if len(A) < 1:
return A
count_dict = {}
for val in A:
if val in count_dict:
count_dict[val] += 1
else:
count_dict[val] = 1
for val in count_dict:
if count_dict[val] % 2 != 0:
return val
|
'''
Created on 09 Jun 2011
@author: elias
'''
import SPmodules2 as SP
class generate_paths(object):
def __init__(self,info):
self.info = info
self.piEst = info.spPreD
self.servicearcs = []
self.deadheadarcs = []
def genarclists(self, path):
... |
# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import gym
from copy import copy
import numpy as np
from gym import spaces
from gym.utils import seeding
from gym import register
def generate_race(**game_params):
if game_params is None:
game_params = {}
return Race(**game_params)
class Race(gym.Env):
def __init__(self, gamma=0.95, horizon=55,... |
# coding=utf-8
# Copyright 2022 The Google Research 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
###########################################################################
# Created by: Hang Zhang
# Email: zhang.hang@rutgers.edu
# Copyright (c) 2017
###########################################################################
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.func... |
def test_main(mocker):
app = mocker.patch("openapi_python_client.cli.app")
# noinspection PyUnresolvedReferences
from openapi_python_client import __main__
app.assert_called_once()
|
import base64
import json
import re
import requests
from bs4 import BeautifulSoup
from requests import request
URL_API = '/v2/api'
URL_LOGIN = f'{URL_API}/auth/login'
URL_DASHBOARD = f'{URL_API}/student/dashboard/dashboard'
URL_CALENDAR = f'{URL_API}/calendar/student'
URL_GRADES = f'{URL_API}/student/all_subjects'
UR... |
from objc import *
from Quartz.CoreGraphics import CGRectMake, CGAffineTransformMakeScale
from _UIKit import UIApplicationMain
from Scene import *
#import classes
NSObject = lookUpClass("NSObject")
UIApplication = lookUpClass("UIApplication")
UIWindow = lookUpClass("UIWindow")
UIAlertController = lookUpClass("UIAlertC... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
import os
import os.path
import string
import utility
class Infos:
def __init__(self):
if sys.platform in ( 'win32' ):
self.ccfxFname = 'ccfx.exe'
elif sys.platform in ( 'linux2' ):
self.ccfxFname = 'ccfx'
... |
import collections
import re
from collections import Counter
import operator
import pickle
import math
import json
path='C:/Users/rahul/Desktop/CSCI 544/HW 2/op_spam_train/'
#path=sys.argv[1]
badWordList = ['and','the','was','for']
RE=r'\b[^\W\d_]+\b'
# NEGATIVE TWEETS
c=collections.Counter()
NT="negativeTweets.txt/... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... |
from SemiBin.utils import get_must_link_threshold
from hypothesis import given, strategies as st
def slow_get_must_link_threshold(contig_len):
"""
calculate the threshold length for must link breaking up
"""
import numpy as np
basepair_sum = 0
threshold = 0
whole_len = np.sum(contig_len)
... |
from .exif_trainer import EXIF_Trainer1, EXIF_Trainer2
|
# Copyright 2017, OpenCensus 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... |
from setuptools import setup, find_packages
description="""
DB-API2 connection pool for Django (for postgresql, mysql and sqlite)
"""
setup(
name = "djorm-ext-pool",
version = '0.8.2',
url = 'https://github.com/djangonauts/djorm-ext-pool',
license = 'BSD',
platforms = ['OS Independent'],
descr... |
from typing import List
import z3
from binaryninja import *
from condition_visitor import ConditionVisitor, make_variable
ARM64_INSTRUCTION_LENGTH = 4
idc = '''
from idc import *
base = 0x4000000
seg_size = 0x400000
address = base
add_segm_ex(base, base + seg_size, 0X1, 2, 1, 2, ADDSEG_NOSREG)
set_segm_name(base, "... |
#
# Copyright 2016 The BigDL 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
#!/usr/bin/env python
#
# Copyright (C) 2009 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 ... |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
class Property:
__slots__ = ('object_id', 'type', 'value')
def __init__(self, object_id, type, value):
self.object_id = object_id
self.type = type
self.value = value
def __eq__(self, other):
return (self.__class__ == other.__class__ and
all(getattr(self, n... |
"""Configuration - Static vars"""
import boto3
import os
ASG_CONFIG = boto3.client('autoscaling', region_name='eu-west-1')
EC2_CONFIG = boto3.client('ec2', region_name='eu-west-1')
WEBHOOK_URL = os.environ.get('WEBHOOK_URL')
SAWMILL_DEVELOPER_LOGS = os.environ.get('SAWMILL_DEVELOPER_LOGS')
SAWMILL_PB_MODE = os.enviro... |
from dataclasses import dataclass
@dataclass
class Response:
code: int
body: dict or None
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""build query for doclistview and return results"""
import frappe, json
import frappe.defaults
import frappe.permissions
from frappe.utils import flt
from frappe import _
cl... |
"""
Carlos Barona
Agile UNO Module 5
Strings and Lists
"""
from sys import exit # Import 'exit' from the 'sys' library
import sys # Import the 'sys' library
import requests # Import the 'requests' library
site_data = {} # Setting an empty dictionary
with open("sites.csv", "r") as infile: # Using a context manager t... |
from goodreads import apikey
from goodreads.client import GoodreadsClient
from goodreads.author import GoodreadsAuthor
from goodreads.book import GoodreadsBook
class TestAuthor():
@classmethod
def setup_class(cls):
cls.client = GoodreadsClient(apikey.key, apikey.secret)
cls.client.authenticate... |
from . import Draft
from .. import TLObject, types, functions
from ... import utils
class Dialog:
"""
Custom class that encapsulates a dialog (an open "conversation" with
someone, a group or a channel) providing an abstraction to easily
access the input version/normal entity/message etc. The library w... |
# coding: utf-8
from __future__ import unicode_literals
import unittest
from textwrap import dedent
from conllu.compat import string_to_file
from conllu.models import Token, TokenList
from conllu.parser import (
DEFAULT_FIELDS, ParseException, head_to_token, parse_comment_line, parse_conllu_plus_fields, parse_dic... |
#!/usr/bin/env python3
# restic wrapper and status checker
# Written by Eric Viseur <eric.viseur@gmail.com>, 2021
# Released under MIT license
# v0.1 - 04/02/21 - Initial release
# v0.2 - In progress - Minor fixes, restic auto-update
# ---- imports ----------------------------------------------------------------
im... |
import socket
import subprocess # nosec: just testing code
import sys
import time
from pathlib import Path
from typing import Generator
from flight_fusion import ClientOptions, FusionServiceClient
try:
import pytest
except ImportError as err:
print(
"\033[31m"
f"Unable to import `{err.name}` ... |
import sys
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from xml.dom import minidom
from lxml import etree
from .ustr import ustr
class PascalVocWriter:
def __init__(
self,
foldername,
filename,
imgSize,
databas... |
from .call_api import CallApi
from datetime import datetime
url = "https://cdn-api.co-vin.in/api/v2"
availability_by_pin_code = f"{url}/appointment/sessions/public/calendarByPin"
availability_by_district = f"{url}/appointment/sessions/public/calendarByDistrict"
DD_MM_YYYY = "%d-%m-%Y"
district_name_with_id = {'nort... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-10 13:44
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):
initial = True
dependencies = [
migrati... |
import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'4',
'-1',
'10',
'16',
'18',
])
def test_case_0(self, input_mock=None):
text_trap = io.Str... |
#!/usr/bin/env python3
#script to (kind of test) python serial comms
from serial_io import SerialIO
import random
import time
r = random.Random()
ard = SerialIO()
ard.start()
print(ard.read('left'))
dirs = ['left', 'right', 'middle']
while 1:
# might need struct packing for actual data
'''
print('le... |
import time
import zmail
from test.base import config
mail = {
'subject': '测试邮件test!',
'content': ['测试内容1_1\n', '测试内容1_2'],
'content_html': '<html> \n<body>\n <h1>标题</h1>\n</body>',
'from': 'ZMAIL',
'to': 'ZMAIL',
'attachments': ['图标.ico', 'favicon.ico']
}
mail_receive_result = {
'subject'... |
from flask import Blueprint, jsonify, request, abort, Response, url_for
from flask_app.models import Course, Hole, Yardage, Tee
from flask_app import db
from sqlalchemy.exc import DBAPIError
import traceback
PAGE_SIZE = 10
course_bp = Blueprint('courses', __name__, url_prefix='/courses')
@course_bp.route('', methods=... |
import time
from turtle import *
from random import *
dis = 100 ; dismod = (2/3,3/4,3/5,7/8) ; c = 2 ; d = 5
ang = 45 ; a = 15 ; b = 45 ; minpix = 10 ; siz = 10 ; wmod = 3/5
w = Screen() ; w.bgcolor("black") ; w.tracer(0) ; w.setup(800, 1000, 600, 0)
t = Turtle() ; t.col... |
import pickle
import torch
def load_example_data(directory = "./"):
flh = open(directory + "example.pkl", "rb")
inp = pickle.load(flh)
inp = {k: v.float().round() for k, v in zip(inp.keys(), inp.values())}
return inp |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: gdaltransform testing
# Author: Even Rouault <even dot rouault @ mines-paris dot org>
#
##########################################################################... |
import pandas as pd
crime_90_15 = pd.read_csv(
'/Users/salma/Studies/Research/Criminal_Justice/research_projects/main_census_merge/data/crime_data/Crime_1990_2015_Req_Vars_Unique_Crosswalk_Merged_Arngd.csv')
crime_90_15_req_vars = crime_90_15[['ORI', 'AGENCY', 'Govt_level', 'place_fips', 'STATEFP']]
crime_90_15_r... |
#Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
# (If you don’t know what a divisor is, it is a number that divides evenly into another number.
# For example, 13 is a divisor of 26 because 26 / 13 has no remainder.)
import sys
try:
num = int(input("E... |
# -*- coding: utf-8 -*-
#
# google-cloud-logging documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values t... |
import CloudFlare
import os
from loguru import logger
def update(docker_records_list, ip):
ttl = os.getenv('TTL', 60)
zones = _get_zones()
logger.info('INFO: got list of all zones')
for zone in zones:
zone_id = zone['id']
controlled_records = []
control_record_id = None
... |
import gym
from gym import envs
from agents import TabularSarsaAgent
from agents import ApproximatedSarsaLambdaAgent
from agents import HAApproximatedSarsaLambdaAgent
import numpy as np
from model.maze_model import maze_model
import matplotlib.pyplot as plt
import pickle
from gym_maze.envs.maze_env import *
... |
from django.shortcuts import render
from django.http import HttpResponse
from .models import sentence
from .models import task
from .models import hit
import re
import json
import random
import string
# from django.views.decorators.csrf import csrf_exempt
def index(request):
return render(request, 'index.html', {}... |
# Copyright 2017-2020 Andreas Thienemann. All rights reserved.
#
# The contents of this file are 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
#
#... |
import csv
import io
import json
from django_select2.forms import Select2Widget
from django import forms
from django.core.exceptions import ValidationError
from django.forms.models import ModelForm
from django.utils.translation import ugettext_lazy as _
from djangocms_charts.consts import get_chartjs_global_options, O... |
import pytest
if __name__ == '__main__':
import example_db
import dismod_tests
else:
from . import example_db
from . import dismod_tests
print ('Case 6: Location and group fixed and random effects with group covariate prior.')
file_name = 'example.db'
use_group_mulcov = False
config = {'sex_effect': ... |
import re
from project.server.main.matcher import Matcher
from project.server.main.utils import FRENCH_STOP, remove_ref_index
DEFAULT_STRATEGIES = [
[['rnsr_id']],
[['rnsr_code_number', 'rnsr_supervisor_acronym', 'rnsr_supervisor_name', 'rnsr_zone_emploi'], ['rnsr_code_number', 'rnsr_supervisor_acronym', 'rns... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import DataRequired, Email, EqualTo
from wtforms import ValidationError
from flask_wtf.file import FileField, FileAllowed
from flask_login import current_user
from BlogDemo.models import User
class Regi... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import base64
import csv
import json as json_lib
import time
import zlib
from abc import ABC, abstractmethod
from io import StringIO
from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Union
from urllib.parse import urljoin
impo... |
from marshmallow import ValidationError
from marshmallow_jsonapi import fields
class CompleteNestedRelationship(fields.Relationship):
def extract_value(self, data):
"""Extract the object with data and validate the request structure."""
errors = []
if 'type' not in data:
errors.... |
from experimental.cpp.lint.clangformat.rules import rules as clangformat_rules
def rules():
return (*clangformat_rules(),)
|
# -*- coding: utf-8 -*-
"""
Kay bulkload management command.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import os.path
import sys
import datetime
import lo... |
from dataset import trainset
from model import ModelDic
import argparse
import glob
import sys
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
import torch.functional as F
import torch.optim as optim
import torch.nn as nn
import torch
import os
import time
save_po... |
"""
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRa... |
"""
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
Adapted for CS294-112 Fall 2018 with <3 by Michael Chang, some experiments by Greg Kah... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.clf()
## mengambil data contoh
raw_data = pd.read_csv("https://storage.googleapis.com/dqlab-dataset/dataset_statistic.csv", sep=';')
## melihat isi dari data
print(raw_data)
plt.figure()
# visualisasi diagram pencar untuk variabel 'Pendapatan... |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2021 all rights reserved
#
class Evaluator:
"""
Mix-in class that computes the value of operator nodes by invoking their evaluator on their
operands
"""
# value management
def getValue(self, **kwds):
"""
... |
# Copyright 2011 by Wibowo Arindrarto (w.arindrarto@gmail.com)
# Revisions copyright 2011-2016 by Peter Cock.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Bio.SeqIO parser for the ABI format.
A... |
# Copyright 2019 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.
from . import StreamEngine
class ProductStreamEngine(StreamEngine):
"""A StreamEngine that forms the non-commutative product of two other
St... |
from setuptools import setup
def readme():
with open('README.md') as fh:
return fh.read()
setup(
name='pghipy',
version='0.1.1',
url='https://github.com/esteticas-latentes/pghipy.git',
author='Laurence Bender, Leonardo Pepino',
author_email='pghipy@gmail.com',
description='STFT/IST... |
__author__ = "paul.tunison@kitware.com"
|
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drf-base.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Impor... |
"""Random variable generators.
integers
--------
uniform within range
sequences
---------
pick random element
pick random sample
pick weighted random sample
generate random permutation
distributions on the real line:
---------------------... |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Implements support for high-level dataset ac... |
from ..diff.PgDiffUtils import PgDiffUtils
class PgTrigger(object):
EVENT_BEFORE = 'BEFORE'
EVENT_AFTER = 'AFTER'
EVENT_INSTEAD_OF = 'INSTEAD OF'
def __init__(self):
self.name = None
self.event = None
self.onInsert = None
self.onUpdate = None
self.onDelete = No... |
# coding=utf8
# Copyright 2018 JDCLOUD.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 required by applicable law or agreed ... |
"""
Process execution model class file.
author: Matthew Casey
© [Digital Content Analysis Technology Ltd](https://www.d-cat.co.uk)
"""
import i18n
from marshmallow import Schema, EXCLUDE
from time import sleep
from fusion_platform.models import fields
from fusion_platform.models.model import Model, ModelError
... |
# Generated by Django 4.0.2 on 2022-02-25 13:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('playlist', '0002_rename_create_at_playlist_created_at'),
]
operations = [
migrations.AlterModelOptions(
name='content',
opti... |
# Generated by Django 2.2.1 on 2019-09-05 09:50
from django.db import migrations, models
import uuid
from ..models import Fresher
def fill_freshers_uuid(apps, schema_editor):
for row in Fresher.objects.all():
row.uuid = uuid.uuid4()
row.save()
class Migration(migrations.Migration):
depend... |
"""Tests for instantiating new synchronized objects."""
# pylint: disable=unused-variable
from dataclasses import dataclass, field
from datafiles import Missing, datafile
from datafiles.utils import logbreak, write
@datafile('../tmp/sample.yml', manual=True)
class SampleWithDefaults:
foo: int = 1
bar: str ... |
# imports bibliographic and item data into sqlite database (files/datastore.db)
import unicodecsv as csv
from datastore import (Bib, Item, session_scope, insert_or_ignore,
Bstatus, Country, Lang, CatSource, CatAgency,
Istatus, Location)
fh = './files/bpl_171220_raw.csv'... |
"""
A sensor platform which detects underruns and capped status from the official Raspberry Pi Kernel.
Minimal Kernel needed is 4.14+
"""
import logging
from rpi_bad_power import new_under_voltage
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
)
from homeassist... |
import sys
import typing
import numba as nb
import numpy as np
@nb.njit((nb.i8[:, :], ), cache=True)
def solve(dc: np.ndarray) -> typing.NoReturn:
m = len(dc)
d, c = dc[:, 0], dc[:, 1]
s = np.sum(d * c)
l = c.sum()
a = l * 9 + s
q, r = divmod(a, 9)
q -= 1
print(q)
... |
#!/usr/bin/env python3
"""
This script finds the user/pr creator responsible for labeling a PR by a commit SHA. It is used by the workflow in
'.github/workflows/pr-labels.yml'. If there exists no PR associated with the commit or the PR is properly labeled,
this script is a no-op.
Note: we ping the user only, not the r... |
#!/usr/bin/env python3
"""
database.py
A series of functions to leverage the (node, edge) schema of
json-based nodes, and edges with optional json properties,
using an atomic transaction wrapper function.
"""
import sqlite3
import json
from itertools import tee
from graphviz import Digraph
def atomic(db_file, cur... |
import datetime
import ipaddress
import json
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import pika
import pyshark
def connect_rabbit(host='messenger', port=5672, queue='task_queue'):
params = pika.ConnectionParameters(host=host, port=port)
connection = pika.BlockingC... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import importlib
from lib.keys_wrapper import PublicKey, PrivateKey
from lib.exceptions import FactorizationError
from lib.utils import print_results
from lib.fdb import send2fdb
from Crypto.Util.number import bytes_to_long, long_to_bytes
import inspect
fro... |
from jumbo.utils.settings import JUMBODIR
from jumbo.utils.checks import valid_cluster
from jumbo.utils import session as ss
import subprocess
import time
import os
@valid_cluster
def cmd(cmd, *, cluster):
"""Run a command in the vagrantfile folder and print output
"""
ss.load_config(cluster)
ss.dum... |
from __future__ import (
absolute_import,
unicode_literals,
)
from pysoa.common.transport.local import (
LocalClientTransport,
LocalServerTransport,
)
__all__ = (
'LocalClientTransport',
'LocalServerTransport',
)
|
# Copyright 2016 Google Inc. 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 law or ag... |
from wagtail.core import blocks
from .base_field_block import BaseFieldBlock
class CheckboxFieldBlock(BaseFieldBlock):
choices = None
help_text = blocks.CharBlock(
max_length=255,
required=False,
)
html = None
default_value = None
display_side_by_side = None
empty_la... |
#!/usr/bin/env python
import sys
from setuptools import setup, find_namespace_packages
if sys.version_info < (3, 7):
print('Error: Soda SQL requires at least Python 3.7')
print('Error: Please upgrade your Python version to 3.7 or later')
sys.exit(1)
package_name = "soda-sql-postgresql"
package_version = '... |
import os
import argparse
import json
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from asteroid.models import ConvTasNet
from asteroid.engine.optimizers import make_optimizer
from asteroid.eng... |
# Copyright 2013 Institut Mines-Telecom - Telecom SudParis
#
# 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 applicab... |
import matplotlib
import io
import urllib, base64
def printfigs(name="fig", size=None, ending=".png"):
images = []
if len(matplotlib.pyplot.get_fignums()) == 1:
num = matplotlib.pyplot.get_fignums()[0]
fig = matplotlib.pyplot.figure(num)
buf = io.BytesIO()
fig.savefig(buf, ... |
###
# Copyright 2019 Hewlett Packard Enterprise, Inc. 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 ... |
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
from setuptools.command.test import test as TestCommand
# Package meta-data.
NAME = 'WizardHat'
DESCRIPTION = ('Real-time processing and plotting of data streamed over LSL, '
+ 'with a focus on... |
from app import app
#home page
@app.route("/")
def home():
return "<h1>I made a website!!!!!</h1>"
@app.route("/imsocoolbecauseimadeawebsite")
def about():
return "<h1>About Me: I Made a Website</h1> <br> Hello everyone I made this website I am very cool" |
import pytest
from django.conf import settings
from django.test import RequestFactory
from jamstargram.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL:
ret... |
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.datasets as dsets
# datasets
train_dataset = dsets.MNIST(root='../../../_data', train=True, transform=transforms.ToTensor(), download=True)
test_dataset = dsets.MNIST(root='../../../_data', train=False, transform=transfor... |
from os import system
from time import sleep
c = 0
p = 0
while p < 10:
for c in range(0, 18):
print()
print()
print()
if c == 0:
print("""
● ● ● ◌
◌ ◌
◌ ◌
◌ ◌
◌ ◌
◌ ◌
... |
import logging
import os
import sys
import math
from datetime import datetime, timedelta, timezone, time
from zoneinfo import ZoneInfo
import dateparser
import hjson
import pandas as pd
import psutil
import redis
import shortuuid
from dotenv import load_dotenv
from faker import Faker
from sqlalchemy import create_engin... |
import msgpack
import requests
from intake.source.base import DataSource, Schema
from . import serializer
from ..compat import unpack_kwargs
from intake import __version__
class RemoteSource(DataSource):
"""Base class for all DataSources living on an Intake server"""
version = __version__
def __init__(se... |
def swap_case(s):
new = ""
for i in s:
if i.isupper() :
new += i.lower() # when upper swap to lower
else:
new += i.upper() # else swap to upper
return new
|
from __future__ import print_function
import unittest
import tc1_pbt
import pbt_utils
import numpy as np
import keras
from keras.optimizers import Adam
from keras import backend as K
class TestPBT(unittest.TestCase):
def testTruncate(self):
data = []
for i in range(0, 11):
data.append... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.