text stringlengths 1 927k |
|---|
#
# Copyright 2013 Rackspace Hosting.
#
# Author: Monsyne Dragon <mdragon@rackspace.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
#
... |
import adodbapi
import config
def main():
con_str = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};'.format(config.PATH_ACCDB)
conn = adodbapi.connect(con_str)
cur = conn.cursor()
cur.execute("select item_name from item")
for c in cur.fetchall():
print(c[0]) #=> `ringo`, `みかん
... |
import socket
if __name__ == "__main__":
print("[+] Connecting with server")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.0.11", 8085))
run_bot = True
while run_bot:
communicate_bot = True
while communicate_bot:
msg = s.recv(1024)
... |
"""The Minecraft Server integration."""
from __future__ import annotations
import asyncio
from datetime import datetime, timedelta
import logging
from typing import Any
from mcstatus.server import MinecraftServer as MCStatus
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HO... |
import json
import typing
from enum import Enum
import importlib
__all__ = [
'to_json_str', 'deserializer', 'ByFieldValueParserSwitcher', 'parser', 'AbstractTypeParserSwitcher', 'register'
]
primitive_types = (int, str, bool, float)
type_parser_map = {}
def register(clz: type, parser_clz, force: bool = False):
... |
"""Module to communicate with the SecuritySpy API."""
import logging
import asyncio
import sys
import xml.etree.ElementTree as ET
from typing import Optional
from aiohttp import ClientSession, ClientTimeout
from aiohttp.client_exceptions import ClientError
from base64 import b64encode
from pysecurityspy.const import ... |
from flask import Flask, render_template, redirect
from flask_pymongo import PyMongo
import scrape_mars
# Create an instance of Flask
app = Flask(__name__)
# Use PyMongo to establish Mongo connection
app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app"
mongo = PyMongo(app)
# Route to render index.html te... |
import app.controllers.interfaces as interfaces
class MessageHolder(interfaces.MessageHolder):
def __init__(self, event):
self.items = []
self.event = event
@property
def isEmpty(self):
return self.items == []
is_empty = isEmpty
def put(self, item):
self.items.ins... |
import pickle
from os.path import join, isfile
import JarbasModelZoo
import nltk
import requests
from JarbasModelZoo import LOG
from xdg import BaseDirectory as XDG
MODEL2URL = {
"questions52_EN":
"https://github.com/OpenJarbas/little_questions/releases/download/0.7.0a1/questions52_svm_EN_0.7.0a1.pkl",
... |
import asyncio
from weakref import ref
from decimal import Decimal
import re
import threading
import traceback, sys
from typing import TYPE_CHECKING, List, Optional
from kivy.app import App
from kivy.cache import Cache
from kivy.clock import Clock
from kivy.compat import string_types
from kivy.properties import (Objec... |
from src.modelo.Asignatura import Asignatura
from src.modelo.Profesor import Profesor
from src.modelo.Estudiante import Estudiante, Escala
from src.modelo.declarative_base import Session, engine, Base
from src.logica.coleccion import Coleccion
def anadir_estudiante (nombre , ciclo , apellido , escala) :
# Crea la ... |
"""
Title: 0004 - Median of Two Sorted Arrays
Tags: Array
Time: O(log(min(m, n)))
Space: O(n)
Source: https://leetcode.com/problems/median-of-two-sorted-arrays/
Difficulty: Hard
"""
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
nums1.extend(nums2)
nu... |
import os
from video_search_client import VideoSearchClient
from video_search_client.models import VideoPricing, VideoLength, VideoResolution, VideoInsightModule
from azure.core.credentials import AzureKeyCredential
SUBSCRIPTION_KEY = None
ENDPOINT = "https://api.bing.microsoft.com"+ "/v7.0/"
def video_search(subsc... |
from kubernetes import client, config
import json
config.load_kube_config()
resource_config = json.load(open("./nginx-deployment.json"))
api_instance = client.AppsV1Api()
response = api_instance.create_namespaced_deployment(body=resource_config, namespace="default")
print("add new deployment, status={}".format(respon... |
#!/usr/bin/env python
"""
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");... |
# Copyright 2018 The TensorFlow 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 applica... |
# -*- coding: utf-8 -*-
import nota_credito_proveedor |
from django.test import TestCase
from .models import Image,Category,Location
class CategoryTestClass(TestCase):
def setUp(self):
self.category_name = Category(category_name='FOOD')
self.category_name.save()
def tearDown(self):
category_name.objects.all().delete()
def test_instanc... |
import datetime
class Session():
def __init__(self, name, description, survey_url):
self.sessionJson = {
"createdTimezone" : "America/New_York",
"allowInSessionInvitees": 'true',
"guestRole": "presenter",
"openChair": 'true',
"sessionExitUrl": s... |
import pandas as pd
def get_clean_df_index(df):
if isinstance(df.index, pd.core.index.MultiIndex):
return df.index.remove_unused_levels()
else:
return df.index
def get_feature_size_by_class(df, class_col, features, normalize="class"):
"""
Given pandas.DataFrame, class column name, an... |
# model settings
fp16 = dict(loss_scale=512.)
model = dict(
type='HybridTaskCascade',
pretrained='/mnt/truenas/scratch/czh/others/pretrain_models/resnext101_32x4d-a5af3160.pth',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
o... |
# -*- coding: utf-8 -*-
import pytest
import f
test_cases = (
('', None, ''),
('', {'a': 5}, ''),
('a', None, 'a'),
('a', {'a': 5}, 'a'),
('#{a}', None, '2'),
('hello #{a}', None, 'hello 2'),
('#{a} hello', None, '2 hello'),
('hello #{a} world', None, 'hello 2 world'),
('#{a}', {'... |
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU, BatchNorm1d, GRU
import torch_geometric
from torch_geometric.nn import (
Set2Set,
global_mean_pool,
global_add_pool,
global_max_pool,
NNConv,
DiffGroupNorm
)
from torch_scatter im... |
'''
Filename: decoder.py
Project: models
File Created: Wednesday, 11th July 2018 3:37:09 pm
Author: xiaofeng (sxf1052566766@163.com)
--------------------------
Last Modified: Sunday, 2nd December 2018 4:09:59 pm
Modified By: xiaofeng (sxf1052566766@163.com)
---------------------------
Copyright: 2018.06 - 2018 OnionMat... |
# Generated by Django 3.2.9 on 2021-12-06 11:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('clickbay', '0009_remove_... |
# -*- coding: utf-8 -*-
from gluon import current
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
RC = {"organisation_type.name" : "Red Cross / Red Crescent"}
# ============================================================================... |
from typing import cast, Sequence
from pytest import deprecated_call, raises # type: ignore
from graphql_relay import (
connection_from_array,
connection_from_array_slice,
cursor_for_object_in_connection,
Connection,
Edge,
PageInfo,
)
# noinspection PyProtectedMember
from graphql_relay impor... |
import logging
from env import ENDPOINT, ACCESS_ID, ACCESS_KEY, USERNAME, PASSWORD
from tuya_iot import (
TuyaOpenAPI,
AuthType,
TuyaOpenMQ,
TuyaDeviceManager,
TuyaHomeManager,
TuyaDeviceListener,
TuyaDevice,
TuyaTokenInfo,
TUYA_LOGGER
)
TUYA_LOGGER.setLevel(logging.DEBUG)
# Init
op... |
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Daniel Kratzert <dkratzert@gmx.de> wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is wo... |
# -*- coding: utf-8 -*-
class AbstractUploadBackend(object):
BUFFER_SIZE = 10485760 # 10MB
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def setup(self, request, filename, *args, **kwargs):
"""Responsible for doing any pre-processing needed before the upload
starts.... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
#blobs
n_samples = 1500
blobs = datasets.make_blobs(n_samples=n_samples, centers=4, random_state=3)
# plt.scatter(blobs[0][:,0],blobs[0][:,1])
# plt.show()
cluster_0_points = []
cluster_1_points = []
cluster_2_points = []
cluster_3_points... |
#!/usr/bin/env python
from strip import Strip
import random
import time
import signal
import logging
logger = logging.getLogger(__name__)
def init_logging(log_level):
logging.basicConfig(level=log_level)
# catch signals for tidy exit
_exiting = False
def signal_handler(signal, frame):
global _exiting
_... |
from urgent.parser_gen import *
from urgent import ast
from rbnf_rts.rts import Tokens, State
from rbnf_rts.routine import DQString
__all__ = ['parse']
co = mk_parser.__code__
requires = co.co_varnames[:co.co_argcount]
ctx = {}
ctx['DQString'] = DQString
for each in requires:
if each not in ctx:
ctx[each... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class P... |
# Copyright (c) 2019, UC Berkeley
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the f... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
#!/usr/bin/env python
from fastai.text import *
from fastai.datasets import *
from pathlib import Path
import pandas as pd
from fastai.metrics import *
from fastai.train import *
from fastai.imports import nn, torch
from fastai.callbacks import *
from fastai import *
from fastai.text import *
import random
import m... |
# coding=utf-8
# Copyright (C) 2019 ATHENA AUTHORS; Xiangang Li; Shuaijiang Zhao
#
# 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 sys
import unittest
sys.path.append('.')
import marionette_tg.dsl
class Tests(unittest.TestCase):
def test1(self):
mar_format = """connection(tcp, 80):
start downstream NULL 1.0
downstream upstream http_get 1.0
upstream end http_ok 1.0
... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from flask import Blueprint, redirect, url_for, jsonify, render_template
from framework.api.oauth import mastodon
from .group.common import user_groups
site = Blueprint("site", __name__)
@site.route("/")
def index():
if not mastodon.authorized:
return render_template("login.html")
print(mastodon.a... |
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1,0"
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import argparse
from torch.autograd import Variable
import torch.utils.data as data
from data import COCODetection, VOCDetection, detectio... |
# coding: utf-8
import math
import struct
import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.utils.data as data
import torchvision
import torchvision.models as tvmodel
import torchvision.transforms as transforms
import torchvision.datasets as datase... |
coordinates_00EBFF = ((47, 184),
(47, 185), (47, 186), (47, 187), (47, 188), (47, 189), (47, 190), (47, 191), (47, 192), (48, 180), (48, 182), (48, 183), (48, 191), (49, 184), (49, 185), (49, 186), (49, 187), (49, 188), (49, 189), (49, 191), (50, 178), (50, 181), (50, 182), (50, 183), (50, 184), (50, 185), (50, 186),... |
import pandas as pd
def catbind(a, b):
"""
Concatenates two pandas categoricals.
Parameters
----------
a : pandas.core.arrays.categorical.Categorical
A pandas categorical.
b : pandas.core.arrays.categorical.Categorical
A pandas categorical that you wish to concatenate to a.
R... |
# coding=utf-8
# Copyright (c) 2019, 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 re... |
import hashlib,binascii
import argparse
import binascii
import hashlib
parser = argparse.ArgumentParser()
parser.add_argument('--ess', help='NTLMv1 ESS Hash in responder format', required=True)
args = parser.parse_args()
hashsplit = args.ess.split(':')
srvchallenge = hashsplit[5]
ntresp = hashsplit[4]
ct3 = ntresp[3... |
from flask import Flask
from config import config_options
from flask_bootstrap import Bootstrap
bootstrap = Bootstrap()
#Initializing the application
def create_app(config_name):
app = Flask(__name__)
#Setting up configurations
app.config.from_object(config_options[config_name])
#Initializing flask extensi... |
import unittest
import tests.io.generate_pazy_udpout as gp
import os
import shutil
class TestPazyCoupledStatic(unittest.TestCase):
"""
Test Pazy wing static coupled case and compare against a benchmark result.
As of the time of writing, benchmark result has not been verified but it
serves as a backward... |
# encoding: utf-8
"""Implementations for various useful completers.
These are all loaded by default by IPython.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team.
#
# Distributed under the terms of the BSD License.
#
# The full ... |
# 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... |
import sys
from setuptools import setup
from setuptools import find_packages
version = '0.15.0.dev0'
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme=={0}'.format(version),
'certbot=={0}'.format(version),
'mock',
'python-digitalocean>=1.11',
# For... |
from __future__ import annotations
import vapoursynth as vs
from typing import Any, cast, Iterator, List, Mapping, Type, TypeVar, OrderedDict, Generic
from PyQt5.QtCore import Qt, QModelIndex, QAbstractListModel
from ..core import main_window, QYAMLObject, VideoOutput, AudioOutput, try_load
T = TypeVar('T', VideoO... |
"""Attention networks."""
import logging
import torch
import torch.nn as nn
import bootleg.utils.model_utils
from bootleg.layers.helper_modules import MLP, AttnBlock, NormAndSum, SelfAttnBlock
from bootleg.symbols.constants import (
BERT_WORD_DIM,
DISAMBIG,
KG_BIAS_LOAD_CLASS,
MAIN_CONTEXT_MATRIX,
)
f... |
"""
Handles opening files from the Python "VFS".
The VFS is the same file space that Python modules are imported from, so the
module spam.eggs comes from spam/eggs.py, and you can load spam/foo.png that
lives next to it.
"""
import logging
from pathlib import Path
import sys
try:
import importlib.resources as impr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
from... |
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
func_code = 'aq'
func_name = 'test_one_moving_one_stationary_distlimit_touch_at_limit'
def setup_fig01():
fig, ax, renderer = create_newfig('{}01'.format(func_code), ylim=(-1, 7))
create_moving_polygon(fig, ax, render... |
##########################################################
# Dear PyGui User Interface (MODIFIED FOR READTHEDOCS)
# ~ Version: master
#
# Notes:
# * This file is automatically generated.
#
# Resources:
# * FAQ: https://github.com/hoffstadt/DearPyGui/discussions/categories/frequently-asked-question... |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
impo... |
from pathlib import PurePath
import os.path
import glob
from trivia import trivia_questions
from discord.ext import commands
from trivia.trivia_manager import TriviaManager
TOKEN = os.environ.get('DISCORD_TOKEN')
bot_name = "Temflix"
custom_commands = ["find", "commands", "popular", "findactor", "findactress", "findmo... |
import asyncio
import os
import time
import zipfile
from FIREX.utils import admin_cmd, edit_or_reply, sudo_cmd
@bot.on(admin_cmd(pattern="compress ?(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="compress ?(.*)", allow_sudo=True))
async def _(event):
if event.fwd_from:
return
input_str = event.pa... |
from sagemaker_rl.coach_launcher import SageMakerCoachPresetLauncher
class MyLauncher(SageMakerCoachPresetLauncher):
def default_preset_name(self):
"""This points to a .py file that configures everything about the RL job.
It can be overridden at runtime by specifying the RLCOACH_PRESET hyperparame... |
"""0.10.0 create new schedule tables
Revision ID: 493871843165
Revises: 942138e33bf9
Create Date: 2021-01-13 14:43:03.678784
"""
from dagster.core.storage.migration.utils import create_0_10_0_schedule_tables
# revision identifiers, used by Alembic.
revision = "493871843165"
down_revision = "942138e33bf9"
branch_labe... |
"""CrowdStrike Falcon Threat Intelligence API interface class.
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|... |
import pytest
from DataStructures.LRUCache.lru_cache_ddl import LRUCacheDDL
@pytest.fixture()
def lru_cache():
return LRUCacheDDL(2)
class TestLRUCacheDDL:
def test_put_and_get(self, lru_cache):
key = 2
val = 1
lru_cache.put(key, val)
result = lru_cache.get(key)
as... |
import sqlite3
conn = sqlite3.connect('emaildb.sqlite')
cur = conn.cursor()
cur.execute('''
DROP TABLE IF EXISTS Counts''')
cur.execute('''
CREATE TABLE Counts (org TEXT, count INTEGER)''')
fname = raw_input('Enter file name: ')
if ( len(fname) < 1 ) : fname = 'mbox.txt'
fh = open(fname)
for line in fh:
if not ... |
from collections import defaultdict
from cle.loader import MetaELF
from cle.backends import Section, Segment
import pyvex
import claripy
from ..engines.light import SimEngineLight, SimEngineLightVEXMixin
from . import register_analysis
from .analysis import Analysis
from .forward_analysis import FunctionGraphVisitor,... |
from Object.PotionList import PotionList
from Object.Potion import Potion
from Object.PotionColor import PotionColor
from Object.PotionSign import PotionSign
from Object.Ingredient import Ingredient
from Object.IngredientProperties import IngredientProperties
class PotionCombinations:
def distinct_potions_list(potio... |
#!/bin/usr/pyhton3
"""Test Review"""
import unittest
from models.base_model import BaseModel
from models.review import Review
class TestReview(unittest.TestCase):
"""Test review"""
def test_class(self):
"""Test class"""
self.assertEqual(Review.place_id, "")
self.assertEqual(Review.us... |
from alpyro_msgs import RosMessage, string
from alpyro_msgs.geometry_msgs.pose import Pose
from alpyro_msgs.std_msgs.header import Header
class InteractiveMarkerPose(RosMessage):
__msg_typ__ = "visualization_msgs/InteractiveMarkerPose"
__msg_def__ = "c3RkX21zZ3MvSGVhZGVyIGhlYWRlcgogIHVpbnQzMiBzZXEKICB0aW1lIHN0YW1... |
# Copyright 2008-2011 Nokia Networks
# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors
# Copyright 2016- Robot Framework Foundation
#
# 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 Licens... |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Copyright (C) 2014 Numenta
#
# 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.... |
"""A command line interface for some of the package's functionality.
It can be used by invoking nnf as a module (``python3 -m nnf``) or by
running the ``pynnf`` script installed with the package.
"""
import argparse
import contextlib
import subprocess
import sys
import time
import typing as t
from types import Simpl... |
from pyvotecore.stv import STV
import sys
import json
class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
return json.JSONEncoder.default(self, obj)
class TestSTV():
# STV, example from Wikipedia
# http://en.wikipedia.org/wiki/... |
libpath = ""
def _set_lib_path(p_path):
global libpath
if libpath != "":
libpath += " -L%s" % p_path
else:
libpath += "-L%s" % p_path
def _get_lib_path():
return libpath
libs = ""
def _add_lib(p_lib):
global libs
if libs != "":
libs += " -l%s" % p_lib
else:... |
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from selenium import webdriver
import timeit
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_condition... |
import argparse
from version_shared import get_packages, set_version_py, set_dev_classifier
DEFAULT_SDK_PATH = "../../sdk/"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Increments version for a given package name based on the released version')
parser.add_argument('--sdk-path', de... |
# Copyright 2021 The TensorFlow 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 applica... |
__version__ = "1.2.5"
import kivymd_extensions.akivymd.factory_registers # NOQA |
import os
import shutil
def process():
key = 1000
bin_dirname = "/home/data_ti5_c/wangdq/data/ema/data/split_docs/bin/" + str(key)
raw_dirname = "/home/data_ti5_c/wangdq/data/ema/data/split_docs/"
new_dirname = "/home/data_ti5_c/wangdq/data/ema/data/select/" + str(key)
filelist = set(os.listdir(bi... |
# Copyright 2015 The TensorFlow 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 applica... |
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.contrib.auth import get_user_model
from challenge.users.forms import UserChangeForm, UserCreationForm
User = get_user_model()
@admin.register(User)
class UserAdmin(auth_admin.UserAdmin):
form = UserChangeForm
a... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-24 23:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import oauth2client.contrib.django_util.models
class Migration(migrations.Migration):
depend... |
# Copyright (c) 2017-2020 Wenyi Tang.
# Author: Wenyi Tang
# Email: wenyitang@outlook.com
# Update: 2020 - 2 - 16
import os
import unittest
if not os.getcwd().endswith('Tests'):
os.chdir('Tests')
try:
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, cli... |
# Copyright 2018 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 in the 'license' file acc... |
from populous.inlines.base import Inline, ModelInline
from populous.inlines.forms import InlineForm, ForeignKeyRawIdWidget
from populous.inlines.models import RegisteredInline, RegisteredInlineField
from populous.inlines.fields import InlineField
__all__ = ['Inline', 'ModelInline', 'InlineForm', 'ForeignKeyRawIdWidget... |
# Copyright © 2017, 2019 by Shun Huang. All rights reserved.
# Licensed under MIT License.
# See LICENSE in the project root for license information.
"""An example of supervised learning uses the Iris data set.
https://archive.ics.uci.edu/ml/datasets/Iris
Attribute Information:
0. sepal length in cm
1. sepal width in... |
from __future__ import annotations
import asyncio
import pytest
from coredis import PureToken
from tests.conftest import server_deprecation_warning, targets
@targets(
"redis_basic",
"redis_basic_raw",
"redis_basic_resp3",
"redis_basic_raw_resp3",
"redis_cluster",
"redis_cluster_raw",
"r... |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
class MockRedis(object):
... |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... |
#!/usr/bin/env python
import os
import sys
import time
import os.path as osp
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import xarray as xr
from mpi4py import MPI
from .load_sim_tigress_xco import LoadSimTIGRESSXCOAll
from ..util.split_container import... |
import sys
from collections import defaultdict
if __name__ == "__main__":
in_path = sys.argv[1]
out_path = sys.argv[2]
group_count = defaultdict(int)
with open(in_path) as in_file:
for line in in_file:
args = line.strip().split()
for arg in args[1:]:
grou... |
MAP = {
"identifier": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic",
"fro": {
'urn:mace:dir:attribute-def:aRecord': 'aRecord',
'urn:mace:dir:attribute-def:aliasedEntryName': 'aliasedEntryName',
'urn:mace:dir:attribute-def:aliasedObjectName': 'aliasedObjectName',
'urn:mace:d... |
import getpass
import click
from kili.authentication import KiliAuth
from kili.playground import Playground
@click.command()
@click.option('--api_endpoint', default='https://cloud.kili-technology.com/api/label/graphql',
help='Endpoint of GraphQL client')
def main(api_endpoint):
email = input('Ente... |
# 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 ... |
"""Add signature for st
Revision ID: 38a1521607b5
Revises: 2fd64f1e524c
Create Date: 2015-01-04 15:40:04.177104
"""
from alembic import op
import sqlalchemy as sa
import base64
import pkg_resources
# revision identifiers, used by Alembic.
revision = '38a1521607b5'
down_revision = '2fd64f1e524c'
def upgrade():
... |
# Loosely derived from https://github.com/jzbontar/pixelcnn-pytorch/blob/master/main.py
# and moreso derived from https://github.com/rampage644/wavenet/blob/master/wavenet/models.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import tqdm
#... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010, Monash e-Research Centre
# (Monash University, Australia)
# Copyright (c) 2010, VeRSI Consortium
# (Victorian eResearch Strategic Initiative, Australia)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are per... |
"""
Django settings for config project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
from... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check that it's not possible to start a second cheesecoind instance using the same datadir or wallet."""
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.