text stringlengths 1 927k |
|---|
import network3
from network3 import Network
from network3 import ConvPoolLayer, FullyConnectedLayer, SoftmaxLayer
training_data, validation_data, test_data = network3.load_data_shared()
mini_batch_size = 10
net = Network([
ConvPoolLayer(image_shape=(mini_batch_size, 1, 28, 28),
filter_sh... |
from flask import Blueprint
gis = Blueprint('gis', __name__)
from . import views |
# Copyright 2019-present MongoDB, 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 wri... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... |
import requests as req
from bs4 import BeautifulSoup as bs
import os
def clearConsole():
command = 'clear'
if os.name in ('nt', 'dos'): # If Machine is running on Windows, use cls
command = 'cls'
os.system(command)
def soup_recover(url):
request = req.get(url)
return bs(request.text,featu... |
#!/usr/bin/env python3
import logging
import sys
import subprocess
from taupage import configure_logging, get_config
def main():
"""Configure custom sysctl parameters
If a sysctl section is present, add the valid parameters to sysctl and reloads.
"""
CUSTOM_SYSCTL_CONF = '/etc/sysctl.d/99-custom.co... |
# standard library
from subprocess import run, PIPE
from typing import List
RUN_CMD_ONFAIL_EXITCODE = 22
def run_cmd(cmd: List[str]):
"""A wrapper around subprocess.run that nicely fails on a non-zero exit code"""
if len(cmd) == 0:
raise ValueError('cmd has to be a non-empty list')
res = run(cm... |
import traceback
from _pydevd_bundle.pydevd_breakpoints import LineBreakpoint, get_exception_name
from _pydevd_bundle.pydevd_constants import get_thread_id, STATE_SUSPEND, dict_contains, dict_iter_items, dict_keys, JINJA2_SUSPEND
from _pydevd_bundle.pydevd_comm import CMD_SET_BREAK, CMD_ADD_EXCEPTION_BREAK
from _pydevd... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('C6A', ['C8pro'])
Monomer('BaxA', ['BaxM', 'BaxA_1', 'BaxA_2', 'SmacM'])
Monomer('Ligand', ['Receptor'])
Monomer('C6pro', ['C3A'])
Monome... |
"""Native adapter for serving CherryPy via its builtin server."""
import logging
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import cherrypy
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil
from cherrypy import wsgiserver
class ... |
from state.machine import BaseState
from helper import *
import state
class GoHomeState(BaseState):
def action(self, game_state):
my_pos = game_state_helper.get_my_position(game_state)
poids, next_move = game_state_helper.get_home(game_state)
if not next_move:
vector = game_... |
# -*- coding: utf-8 -*-
# Copyright 2022 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... |
""" CLI logger """
from __future__ import unicode_literals
import logging
import coloredlogs
import requests
def init_logger(log_requests=False):
""" Initialize the logger """
logger = logging.getLogger(__name__.split(".")[0])
for handler in logger.handlers: # pragma: nocover
logger.removeHand... |
import copy
import math
import pprint
import unittest
import pytest
from pint import Context, DimensionalityError, UnitRegistry
from pint.compat import np
from pint.testsuite import QuantityTestCase, helpers
from pint.unit import UnitsContainer
from pint.util import ParserHelper
ureg = UnitRegistry()
class TestIss... |
#!/usr/bin/python2
import argparse
import atexit
import logging
import os
import signal
import subprocess
import sys
import tempfile
import time
from mininet.node import UserSwitch, OVSSwitch
from mininet.link import Link, TCIntf
import mininet.term
import Pyro4
import threading
import traceback
from MaxiNet.tools ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ : stray_camel
# __description__ : trans_0_1
# __REFERENCES__ : https://blog.csdn.net/qq_42544196/article/details/106468658;https://docs.python.org/3/library/logging.html
# __date__: 2020/12/11 15
import datetime
import logging
from pathlib import Path
import random... |
# coding=utf-8
# Copyright 2019 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... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""Tests for autosave.py"""
# Standard library imports
import ast
import os.path as osp
# Third party imports
import pytest
# Local imports
from spyder.plugins.editor.utils.autosave import (AutosaveFor... |
from rocon_client_sdk_py.virtual_core.actions.base import Action
import asyncio
import pydash
from rocon_client_sdk_py.virtual_core.path_planner import PathPlanner
class Dock(Action):
def __init__(self):
self.name = 'Dock'
self.func_name = 'dock'
async def on_define(self, context):
pr... |
from django.conf import settings
from django.db import models
class ForwardedMessage(models.Model):
"Generated Model"
message = models.ForeignKey(
"chat.Message",
on_delete=models.CASCADE,
related_name="forwardedmessage_message",
)
forwarded_by = models.ForeignKey(
"cha... |
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
import os
dataPath = '../../Willll/' # Relative path of homework data
# r=root, d=directories, f = files
DocList = []
QueryList = []
DocData = []
QueryData = []
def articleParser... |
import cv2
import numpy as np
import os
subjects = ["","Mama","Samin","Delwar"]
def detect_faces(colored_img, scaleFactor=1.06):
img_copy = colored_img.copy()
gray = cv2.cvtColor(img_copy, cv2.COLOR_BGR2GRAY)
f_cascade = cv2.CascadeClassifier('data/lbpcascade_frontalface.xml')
faces = f_cascade.dete... |
"""Auto-generated file, do not edit by hand. 883 metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_883 = PhoneMetadata(id='001', country_code=883, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='51\\d{7}(?:\\d{3})?', possible_length... |
from abc import ABC, abstractmethod
from mycloud.common import sha256_file
from mycloud.constants import VERSION_HASH_LENGTH
class CalculatableVersion(ABC):
@abstractmethod
def calculate_version(self):
raise NotImplementedError()
class BasicStringVersion(CalculatableVersion):
def __init__(sel... |
#
# Copyright 2018 Analytics Zoo 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... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def canAttendMeetings(self, intervals):
"""
:type intervals: List[Interval]
:rtype: bool
"""
if len(intervals) ... |
import os
import torch
import torch.nn.functional as F
import glob
import numpy as np
from torch.optim import Adam
from utils.utils import soft_update, hard_update
from utils.model import GaussianPolicy, QNetwork, DeterministicPolicy
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, In... |
import pytest
from ai.backend.client.exceptions import BackendAPIError
from ai.backend.client.session import Session
# module-level marker
pytestmark = pytest.mark.integration
@pytest.mark.asyncio
async def test_list_images_by_admin():
with Session() as sess:
images = sess.Image.list()
image = i... |
"""Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "366df11a35392c946678f1af94038945c23f06c8"
LLVM_SHA256 = "cd720387229e8ee74cc9d7d685a298c709fb2bdb2063301e509f40dacbdbaaea"
tf_http_archive(
... |
import operator
from importlib import resources
from typing import List, Tuple, Generator
from pyswip import Prolog # type: ignore
from mockdown.constraint import ConstraintKind
from mockdown.constraint.factory import ConstraintFactory
from mockdown.model import Attribute, IView, IAnchor, AnchorID
from mockdown.cons... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def isPalindrome(self, head: ListNode) :
num = []
temp = head
isPalin = True
# if head is not None and head.next is N... |
"""
Code to support database helper scripts (create_db.py, manage_db.py, etc...).
"""
import argparse
import logging
import os
import sys
from migrate.versioning.shell import main as migrate_main
from galaxy.util.path import get_ext
from galaxy.util.properties import find_config_file, get_data_dir, load_app_propertie... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... |
import csv
import time
from collections import defaultdict
from scapy.sessions import DefaultSession
from scapy.all import wrpcap
from .features.context.packet_direction import PacketDirection
from .features.context.packet_flow_key import get_packet_flow_key
from .flow import Flow
EXPIRED_UPDATE = 40
MACHINE_LEARNIN... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import Aut... |
# -*- coding: utf-8 -*-
import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.autograd import Variable
from tqdm import tqdm
from models.protonet_embedding import ProtoNetEmbedding
from models.R2D2_embedding import R2D2Embedding
from models.ResNet12_embeddin... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2016 Xue Can <xuecan@gmail.com> and contributors.
# Licensed under the MIT license: http://opensource.org/licenses/mit-license
"""
Celery 应用程序生成器
Celery 应用程序的配置众多,这里提供一个快速的生成器,避免经常需要查阅手册。
本模块根据 Celery 4.0.0rc4 重新编写。配置详情请参考:
* http://docs.celeryproject.org/en/master/userg... |
import torch
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModel
import logging
from torch.nn import ConstantPad3d, ConstantPad2d
from layers.utils import set_model_device, set_tensor_device
'''
tutorial4 tokenization
https://mccormickml.com/2019/07/22/BERT-fine-tuning/
how to use clinical bert... |
import dash_bootstrap_components as dbc
layout = dbc.Jumbotron(["404 - Not Found"], className="h4 text-danger") |
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.views.decorators.cache import never_cache
# from django.contrib.auth import login,logout,authenticate
from django.contrib.auth.views import LoginView as login
from dj... |
# -*- coding: utf-8 -*-
#
# Apworks documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 25 15:41:49 2017.
#
# 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.
#
# A... |
#!/usr/bin/env python3
import socket
# CONSTANTS
OUTBOUND_HOST = "127.0.0.1"
OUTBOUND_PORT = 8001
OUTBOUND_BUFFER_SIZE = 1024
PAYLOAD_URL = "www.google.com"
PAYLOAD = f"GET / HTTP/1.0\r\nHost: {PAYLOAD_URL}\r\n\r\n"
def main():
# Create a socket object
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as... |
import os
import re
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
import commonware.log
from olympia import amo
from olympia.accounts.views import fxa_error_message
... |
#!/usr/bin/env python
import rospy
from scipy.spatial import KDTree
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classifi... |
##############################################################################
# Copyright (c) 2016 Intel 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.... |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import test.support
from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
import re
import encodings
import urllib.re... |
"""Configurable optimizers from JAX."""
import gin
from jax.example_libraries import optimizers
@gin.configurable
def optimizer(value):
return value
gin.external_configurable(optimizers.adam)
gin.external_configurable(optimizers.momentum)
gin.external_configurable(optimizers.nesterov)
gin.external_configurable(o... |
# -*- coding: utf-8 -*-
import functools
import os
from anima.env.mayaEnv.animation import Animation
from anima.env.mayaEnv.general import General
from anima.env.mayaEnv.modeling import Modeling
from anima.env.mayaEnv.previs import Previs
from anima.env.mayaEnv.reference import Reference
from anima.env.mayaEnv.render... |
import numpy as np
from numpy.testing import assert_allclose, assert_equal
import unittest
from pb_bss.distribution import VonMisesFisher
from pb_bss.distribution import VonMisesFisherTrainer
class TestGaussian(unittest.TestCase):
def test_shapes(self):
samples = 10000
mean = np.ones((3,))
... |
#!/usr/bin/env python3
# -*-encoding: utf-8-*-
# created: 25.11.2019
# by David Zashkolny
# 3 course, comp math
# Taras Shevchenko National University of Kyiv
# email: davendiy@gmail.com
TEXT = 0
IMAGE = 1
AUDIO = 2
VIDEO = 3
DOCUMENT = 4
MESSAGE_TYPES = {
TEXT,
IMAGE,
AUDIO,
VIDEO,
DOCUMENT,
}
... |
import numpy as np
import tensorflow as tf
from model import Model
from common.shared_functions import glorot_variance, make_tf_variable, make_tf_bias
class HighwayLayer(Model):
vertex_embedding_function = {'train': None, 'test': None}
def __init__(self, shape, next_component=None, next_component_2=None):
... |
#
# Utility to check availability and location of fonts
# for pygame
#
import pygame
pygame.font.init() # Required or SysFont will break
candidates = [
"Helvetica",
"helvetica",
# "helvetica.ttf",
"Avenir Next",
"AvenirNext"
]
default = pygame.font.get_default_font()
print("System defau... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C18243580
# Test Case Title : Check that fixed joint constrains 2 bodies
# fmt: off
class Te... |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("Ridge" , "RandomReg_100" , "sqlite") |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, T... |
"""
Copyright 2020 The OneFlow 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 law or agr... |
"""Gosper's algorithm for hypergeometric summation. """
from sympy.core import S, Dummy, symbols
from sympy.core.compatibility import is_sequence
from sympy.polys import Poly, parallel_poly_from_expr, factor
from sympy.solvers import solve
from sympy.simplify import hypersimp
def gosper_normal(f, g, n, polys=True):
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2020, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distributed with certa... |
from pymclevel import alphaMaterials, MCSchematic, MCLevel, BoundingBox
from pymclevel.box import Vector
from mcplatform import *
from tqdm import tqdm
inputs = (
("Selection Material Counter", "label"),
("Creator: Colan Biemer", "label")
)
DATA_DIRECTORY = "/home/colanbiemer/work/projects/mcedit_data/extract... |
# !/usr/bin/python
# -*- coding:utf-8 -*-
import subprocess, time, sys
from subprocess import Popen
from typing import Optional
TIME = 3600
CMD = "run.py"
class Auto_Run():
def __init__(self, sleep_time, cmd):
if sys.version_info < (3, 6):
print("only support python 3.6 and later version")
... |
import os
import sys
import json
import numpy as np
import threading
import time
import copy
import random
import glob
import shutil
import pickle
from termcolor import colored
from sacred import Ingredient, Experiment
from alfred.env.thor_env import ThorEnv
from alfred.gen import constants
from alfred.gen.utils impo... |
# Copyright 2020 William José Moreno Reyes
#
# 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... |
import numpy as np
def pad_sequences(seqs, maxlen=None, dtype='int32'):
"""
Pad each sequence to the same lenght:
the lenght of the longuest sequence.
If maxlen is provided, any sequence longer
than maxlen is truncated to maxlen.
"""
lengths = [len(s) for s in seqs]
n... |
import pyshopee
import re
import pandas as pd
from pprint import pprint
def _builder_attributes(attributes_resp, brand_option = None, default_brand_option = "自有品牌"):
'''select mandatory attr.
attributes = [
{
'attributes_id': 1365,
'va... |
#!/usr/bin/python
# coding=utf-8
"""
@version:
@author: Dong Linhao
@license: Apache Licence
@contact: donglinhao2015@ia.ac.cn
@site:
@software: PyCharm Community Edition
@file: batchmk.py
@time: 09/04/17 21:10
"""
import src.io.fea as fea
import tensorflow as tf
import numpy as np
import time
LONGEST_FRMS = 2000
c... |
__author__ = 'Antony Cherepanov'
def diff_ways_to_equality_check():
print("\ndiff_ways_to_equality_check()")
l1 = l2 = [1, 2, 3]
print("Our lists: " + str(l1) + ", " + str(l2) + ". They reference to the same object")
print("l1 == l2 ? : ", l1 == l2)
print("l1 is l2 ? : ", l1 is l2)
l3 = [1, ... |
from unittest.mock import patch
from django.contrib.auth.models import User
from django.test import TestCase
from login.forms import CFGOVPasswordChangeForm, UserCreationForm, UserEditForm
from login.tests.test_password_policy import TestWithUser
@patch("login.forms.send_password_reset_email")
class UserCreationFor... |
from __future__ import absolute_import, print_function, division
from .scala_kernel import SpylonKernel
from .scala_magic import ScalaMagic
from .init_spark_magic import InitSparkMagic
from .scala_interpreter import get_scala_interpreter
def register_ipython_magics():
"""For usage within ipykernel.
This wil... |
from typing_extensions import Final
from wemake_python_styleguide.visitors.tokenize import (
comments,
conditions,
primitives,
statements,
syntax,
)
#: Used to store all token related visitors to be later passed to checker:
PRESET: Final = (
comments.WrongCommentVisitor,
comments.ShebangVi... |
'''
Copyright (c) 2012-2015, Matthieu Nué
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 conditions and the fol... |
#!/usr/bin/env python
import codecs
import os
import re
import sys
from setuptools import setup
DESCRIPTION = 'UI-level acceptance test framework'
def load_requirements(*requirements_paths):
"""
Load all requirements from the specified requirements files.
Requirements will include any constraints fro... |
import os
from time import time
import pathlib
from typing import Dict, Union
import glob
import numpy as np
import xarray as xr
from pyschism.mesh.base import Gr3
def combine(var, shape, l2g, name):
values = np.full(tuple(shape), np.nan)
local_ids = list(l2g.keys())
for i, data in enumerate(var):
... |
#!/usr/bin/env python
__doc__ = '''Merge lookup and feature aliases into TypeTuner feature file'''
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2019 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ =... |
""" Train RelBERT model. """
import argparse
import logging
import relbert
def config(parser):
# optimization
parser.add_argument('-s', '--softmax-loss', help='softmax loss', action='store_true')
parser.add_argument('-n', '--in-batch-negative', help='in batch negative', action='store_true')
parser.add... |
# PanedWidget
# a frame which may contain several resizable sub-frames
import string
import sys
import types
import Tkinter
import Pmw
class PanedWidget(Pmw.MegaWidget):
def __init__(self, parent = None, **kw):
# Define the megawidget options.
INITOPT = Pmw.INITOPT
optiondefs = (
('command', ... |
# 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 ... |
def latin() -> [str]:
"""[A-Z]"""
return list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
def safe_latin() -> [str]:
"""[A-Z] excluding (O, I, L)"""
return list("ABCDEFGHJKMNPQRSTUVWXYZ") |
from .combos.combos import CombosModel, get_combo_tables |
import os
import sys
from datetime import datetime
class GenerateStructure:
def __init__(self, number_of_lectures, number_of_labs, number_of_homework, number_of_sections,
number_of_advanced_sections, folders,
default_directory, default_directory_lectures, default_directory_lectur... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Bot-or-not tweet LSA/LSI model ."""
from __future__ import division, print_function, absolute_import, unicode_literals
from builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
... |
#!/usr/bin/env python3
import argparse
from os.path import expanduser
import glob
import json
import os
import re
import shutil
import subprocess
import tempfile
from termcolor import cprint, colored
class TestRunner:
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def __init__(self, options):
... |
# Automatically created by: shub deploy
from setuptools import setup, find_packages
setup(
name='project',
version='1.0',
packages=find_packages(),
entry_points={'scrapy': ['settings = scraper.settings']},
) |
from flask import Blueprint, request
bp = Blueprint("debug", __name__)
@bp.route("/api/v1/debug", methods=["DELETE", "GET", "POST"])
def debug():
if request.method == "DELETE":
raise Exception
if request.method != "POST":
return request.args
return request.get_data() |
import vtk
from numpy import random
import numpy as np
import vtk.util.numpy_support as converter
import time
import cv2
import itertools
class VtkText:
def __init__(self, text, pos):
self.text = text
self.pos = pos
def get_vtk_text(self):
txt = vtk.vtkTextActor()
txt.SetInput... |
import cloudpickle as pickle
def save(sol_set=None, ocp=None, bvp=None, filename='data.beluga'):
save_dict = {}
if sol_set is not None:
save_dict['solutions'] = sol_set
if ocp is not None:
save_dict['ocp'] = ocp
if bvp is not None:
save_dict['bvp'] = bvp
with open(file... |
#
# Copyright 2020 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 in w... |
import os
import jinja2
import yaml
# get environment parameters
VERSION = os.environ.get("VERSION", "latest")
# load versions files from release repository
with open("/release/%s/base.yml" % VERSION, "rb") as fp:
versions = yaml.load(fp, Loader=yaml.FullLoader)
with open("/release/etc/images.yml", "rb") as f... |
# Copyright 2019 The Bazel 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 wr... |
# coding: utf-8
import requests
from urllib.parse import urlencode
class APIClient(object):
def __init__(self):
self.status = 0
self.reason = ''
self.HEADERS = {}
def urlencode(self, **kwargs):
return urlencode(kwargs)
def request(self, method, url, params=None, headers=None):
if not headers:
heade... |
from mirage.libs import io
import sys
class ArgParser:
'''
This class allows to easily parse parameters from command line.
'''
def __init__(self,appInstance=None):
'''
This constructor allows to keep a pointer on the main Application instance.
:param appInstance: instance of the main Application (core.app... |
#!/usr/bin/env python
#
# Create a Configuration from marlin_config.json
#
import json
import sys
import shutil
import re
opt_output = '--opt' in sys.argv
output_suffix = '.sh' if opt_output else '' if '--bare-output' in sys.argv else '.gen'
try:
with open('marlin_config.json', 'r') as infile:
conf = json.load(inf... |
"""
molecool
A Python package for analyzing and visualizing xyz files.
"""
# Add imports here
from .functions import canvas
from .measure import calculate_angle, calculate_distance
from .visulize import draw_molecule, bond_histogram
from .molecule import build_bond_list, calculate_molecular_mass
from . import io
# H... |
import re
import datetime
from django.db.migrations import operations
from django.db.migrations.migration import Migration
from django.db.migrations.questioner import MigrationQuestioner
class MigrationAutodetector(object):
"""
Takes a pair of ProjectStates, and compares them to see what the
first would ... |
from flask import Flask,render_template,request,redirect
import socket
app = Flask(__name__)
cedula=""
ip='192.168.1.130'
# persona1[cedula][nombre] ="jorge"
# persona1[cedula][nombre] = valor_del_form
persona1 ={
"5591945": {
"nombre":"Mauricio",
"apellido":"Acosta",
... |
"""Aliases for products, to enable the finding of product with different specifiers.
** Might be deprecated, if this information is included in the CSW database **
"""
product_aliases = [
{
'product_id': 's2a_prd_msil1c',
'aliases': [
"s2a_prd_msil1c",
"sentinel2",
... |
import os
from collections import OrderedDict
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from orchestra.core import validators
from orchestra.utils.functional import cached
from . import settings
from .directives import Sit... |
"""Test configdialog, coverage 94%.
Half the class creates dialog, half works with user customizations.
"""
from idlelib import configdialog
from test.support import requires
requires('gui')
import unittest
from unittest import mock
from idlelib.idle_test.mock_idle import Func
from tkinter import (Tk, StringVar, IntVa... |
# TASKS is a list of lists. Each sublist follows this structure:
# [
# <string of background information to print>,
# <string of question text>,
# <list of answer keywords>,
# <dictionary of prerequisite conditions>
# ]
"""
empty object for copy-paste:
[
"", # background info
"", # question
[], # l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.