text stringlengths 1 927k |
|---|
# Copyright 2016 NTT DATA
# 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 a... |
# 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, overload
from ... import _utilities
fro... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-11 16:40
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):
dependencies = [
('main', '0015_v330_blank_st... |
# MINLP written by GAMS Convert at 05/15/20 00:50:46
#
# Equation counts
# Total E G L N X C B
# 34 22 3 9 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
from logging import getLogger
from nipype.interfaces.utility import Merge
from nipype.interfaces.fsl import (
TOPUP, ApplyTOPUP, BET, FUGUE, Merge as FslMerge)
from nipype.interfaces import fsl
from nipype.interfaces.utility import Merge as merge_lists
from nipype.interfaces.fsl.epi import PrepareFieldmap
from nipy... |
"""Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it. This string is used
to call the step in "*.feature" file.
"""
import wrappers
from behave import when, then
from textwrap import dedent
@when('we create table')
def step_create_table(context):
"""S... |
# Generated by Django 2.2 on 2019-04-12 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_dapp', '0004_auto_20190412_2138'),
]
operations = [
migrations.AddField(
model_name='application',
name='defaul... |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... |
from django.urls import path
from . import views
urlpatterns = [
path('get_all', views.get_all)
] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 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... |
import pyjd # dummy in pyjs
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.TextArea import TextArea
from pyjamas.ui.Label import Label
from pyjamas.ui.Button import Button
from pyjamas.ui.HTML import HTML
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.HorizontalPanel import HorizontalPa... |
from typing import List, Optional, Dict, Any, Union, Callable
import logging
import multiprocessing
from pathlib import Path
from collections import defaultdict
from time import perf_counter
import torch
from haystack.modeling.data_handler.data_silo import DataSilo, DistillationDataSilo
from haystack.modeling.data_ha... |
import numpy as np
from .utils import _checkTime
from .vectors import calcNae
from .vectors import calcDelta
from .vectors import calcXae
from .vectors import calcXa
from .vectors import calcNhat
from .vectors import calcR1
from .vectors import calcR2
from .projections import cartesianToGnomonic
from .coordinates impo... |
#!/usr/bin/env python
#
# Copyright 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 law o... |
import unittest
from ParserTest.TestUtil import *
class TestParserMethods(unittest.TestCase):
DIRECT_KOs_ID = 2
PASSIVE_KOs_ID = 3
DEATHS_ID = 4
def test_direct_KO(self):
pokemon_data = {
"Raichu-Alola": ["p1", "Stokin' Dude!"],
"Magikarp": ["p2", "A Karp"]
}
... |
import os
import glob
import torch
import torchvision.utils as vutils
import webrtcvad
from mfcc import MFCC
from utils import voice2face
from tqdm import tqdm
import sys
from parse_config import get_model
import importlib
# initialization
vad_obj = webrtcvad.Vad(2)
mfc_obj = MFCC(nfilt=64, lowerf=20., upperf=7200., s... |
from datetime import datetime
import discord
from discord.ext import commands, tasks
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_option, create_choice
from json import loads
from itertools import cycle
from random import choice
from urllib import request
... |
""" Functions related to writing to and retrieving from cache files
"""
import os
import numpy as np
from log_yatsm import logger
_image_ID_str = 'image_IDs'
def get_line_cache_name(dataset_config, n_images, row, nbands):
""" Returns cache filename for specified config and line number
Args:
datase... |
# -*- coding: utf-8 -*-
"""
=============================
Grouping data by category
=============================
When plotting, its useful to have a way to color points by some category or
variable. Hypertools does this using the `hue` kwarg, which takes a list
of string category labels or numerical values. If text... |
#!/usr/bin/env python
# coding=utf-8
#
# Python Script
#
# Copyleft © Manoel Vilela
#
#
WIDTH,HEIGHT = 2,3
from random import shuffle, randrange
def make_maze(w=WIDTH, h=HEIGHT):
vis = [[0] * w + [1] for _ in range(h)] + [[1] * (w + 1)]
nowalls = []
def walk(x, y):
vis[x][y] = 1
d =... |
#!/usr/bin/env python
#
# (c) 2016 -- onwards Georgios Gousios <gousiosg@gmail.com>, Rik Nijessen <riknijessen@gmail.com>
#
from __future__ import print_function
import pickle
import random
import urllib
import numpy as np
import argparse
from config import *
from code_tokenizer import CodeTokenizer
from my_tokeniz... |
#!/usr/bin/env python3
# Copyright (c) 2017-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.
"""Test various fingerprinting protections.
If a stale block more than a month old or its header are requ... |
"""gardenator_backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'polkitex.ui'
##
## Created by: Qt User Interface Compiler version 6.2.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##################... |
#!/usr/bin/env python
import os
import argparse
from pymatflow.structure.neb import interpolate
from pymatflow.cmd.structflow import read_structure
from pymatflow.cmd.structflow import write_structure
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--images", type=str, nargs=2,
... |
from collections import namedtuple
from itertools import groupby
from pathlib import Path
from typing import List, Optional
from urllib.parse import unquote, urlparse
from loguru import logger
from flexget import plugin
from flexget.components.ftp.sftp_client import SftpClient, SftpError
from flexget.config_schema im... |
import falcon
import json
from .base import BaseResource
class ConfigResource(BaseResource):
'''Falcon resource to get form entries'''
def __init__(self, *args, **kwargs):
super(ConfigResource, self).__init__(*args, **kwargs)
def on_get(self, req, resp):
'''Get configuration page to crea... |
# FractureProof
## Value Based Healthcare Project
### Outcome
#### CMS Hospital Wiide Readmission Rate 2018
### Predictors
#### BEA 2018 County wide Economic Measures
### Table Key
#### State County FIPS
### Set working directory to project folder
os.chdir("C:/Users/drewc/GitHub/allocativ") # Set wd to project repos... |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Copyright (c) 2016, raspberrypi.com.tw
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# paino_buzzer.py... |
from functools import reduce
from sklearn.preprocessing import MinMaxScaler, MaxAbsScaler, StandardScaler
from optimus.engines.base.columns import BaseColumns
from optimus.helpers.columns import parse_columns, name_col
from optimus.helpers.constants import Actions
from optimus.helpers.raiseit import RaiseIt
class D... |
# pylint: disable=arguments-differ
"""Base class for PyStan wrappers."""
from ..data import from_pystan
from .base import SamplingWrapper
class PyStanSamplingWrapper(SamplingWrapper):
"""PyStan sampling wrapper base class.
See the documentation on :class:`~arviz.SamplingWrapper` for a more detailed
desc... |
import functools
from flask import Flask, request, make_response, jsonify
from flask_restful import Resource, Api, abort
from project.server.models import User
def login_required(method):
@functools.wraps(method)
def wrapper(self):
auth_header = request.headers.get('Authorization')
if auth_head... |
from codecs import open
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
long_description = f.read()
with open(os.path.join(here, 'pycroscopy/__version__.py')) as f:
__version__ = f.read().split("'")[1]
... |
from collections import defaultdict
from dataclasses import dataclass, replace
from typing import Dict, Iterator, Set
from plotter.full_node.mempool_check_conditions import mempool_check_conditions_dict
from plotter.types.blockchain_format.coin import Coin
from plotter.types.blockchain_format.sized_bytes import bytes3... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .sample.multi_pose import MultiPoseDataset
from .sample.landmark import LandmarkDataset
from src.lib.datasets.dataset.coco_hp import COCOHP
from src.lib.datasets.dataset.coco_body import COCOBODY
datase... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-10 13:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('genres', '0001_initial'),
('hob... |
# -*- coding: utf-8 -*-
import re
import datetime
import math
import numpy as np
a = "赞[123]"
a_re = re.compile("赞.*")
print a_re.findall(a)
a = "今天"
if a == "今天":
print "yes"
print ((datetime.datetime.now() - datetime.timedelta(minutes=2)).strftime("%Y-%m-%d %H:%M"))
a = u"评论[10]"
a_re = re.compile(u'^评论\[\d+\]$... |
#!/usr/bin/env python
import numpy as np
from randomPlayer import RandomPlayer
import game
import play
# Run MCTS with MC to estimate the rest of the game.
# http://mcts.ai/about/index.html
# http://ccg.doc.gold.ac.uk/wp-content/uploads/2016/10/browne_tciaig12_1.pdf
class UCT:
def __init__(self, c):
sel... |
# -*- coding: utf-8 -*-
"""
tests.controllers.test_api_controller
"""
import jsonpickle
from .controller_test_base import *
from moesifapi.models import *
from datetime import *
class ApiControllerTests(ControllerTestBase):
@classmethod
def setUpClass(cls):
super(ApiControllerTests, cls).setUp... |
#!/usr/bin/env python3
# Arg1 - ruleset file that contains all rulesets
# Arg2 - cleaned, sorted single file with all transactions
#
# Transforms a given file - Arg2 - into the column set form below
# with the rulesets written and applied for the given financial
# source - Arg1
import re
import sys
if len(sys.argv) ... |
r"""
Unitary Groups `GU(n,q)` and `SU(n,q)`
These are `n \times n` unitary matrices with entries in
`GF(q^2)`.
EXAMPLES::
sage: G = SU(3,5)
sage: G.order()
378000
sage: G
Special Unitary Group of degree 3 over Finite Field in a of size 5^2
sage: G.gens()
(
[ a 0 0] [... |
from typing import List, Optional
from dataclasses import dataclass
UserID = str
BotID = str
ChannelID = str
@dataclass
class Channel:
"""
https://api.slack.com/types/channel
"""
id: ChannelID
name: str
is_archived: bool
is_member: bool
@staticmethod
def from_json(json: dict):
... |
from pyradioconfig.parts.ocelot.phys.Phys_Studio_LongRange import PHYS_OQPSK_LoRa_Ocelot
from pyradioconfig.calculator_model_framework.decorators.phy_decorators import do_not_inherit_phys
@do_not_inherit_phys
class PHYS_Studio_LongRange_Sol(PHYS_OQPSK_LoRa_Ocelot):
# Owner: Casey Weltzin
# Jira Link: https://... |
# 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... |
# -*- coding: utf-8 -*-
"""
Datary python sdk Datasets test file
"""
import mock
from datary.test.test_datary import DataryTestCase
from datary.test.mock_requests import MockRequestResponse
class DataryDatasetsTestCase(DataryTestCase):
"""
DataryDatasets Test case
"""
@mock.patch('datary.requests.re... |
from game import Game
game = Game("Pygame with Box2d Template")
game.run() |
import requests
class TwitchApiPy():
def __init__(self):
self.ClientID = ""
self.OAuth = ""
"""
You don't really use this its for other requests
"""
def GetUserID(self,name):
r = requests.get(url = "https://api.twitch.tv/helix/users?login={}".format(name), headers = {'Clien... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2019-01-22.
# 2019, SMART Health IT.
from . import domainresource
class MedicationRequest(domainresource.DomainResource):
"""
O
r
d
e
r
... |
"""Constants for Synology DSM."""
from __future__ import annotations
from synology_dsm.api.surveillance_station.const import SNAPSHOT_PROFILE_BALANCED
from homeassistant.const import Platform
DOMAIN = "synology_dsm"
ATTRIBUTION = "Data provided by Synology"
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.BUTT... |
from django.apps import AppConfig
class BooksConfig(AppConfig):
name = 'books' |
#!/usr/bin/python
import random, sys, string, csv, argparse, subprocess
parser=argparse.ArgumentParser(
description='''This script generates the HTML code for the timeline boxes''',
epilog="""Have fun!""")
parser.add_argument('-i', default='movies.csv', dest='inputFile', help='Name of the csv file. Default is... |
def set_conditional_tape(self, awg_nr, tape_nr, tape):
'''
set the conditional tape content for an awg
@param awg : the awg of the dac, (0,1,2).
@param tape_nr : the number of the tape, integer ranging (0~6)
@param tape : the array of entries, with a maximum number of entries 512.
Every ent... |
import unittest
from securityheaders.checkers.cors import AccessControlExposeHeadersSensitiveChecker
class AccessControlExposeHeadersSensitiveCheckerTest(unittest.TestCase):
def setUp(self):
self.x = AccessControlExposeHeadersSensitiveChecker()
def test_checkNoHeader(self):
nox = dict()
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ProsperDatareader documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 31 09:30:33 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... |
# 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... |
class Solution:
def getSkyline(self, buildings: 'List[List[int]]') -> 'List[List[int]]':
"""
Divide-and-conquer algorithm to solve skyline problem,
which is similar with the merge sort algorithm.
"""
n = len(buildings)
# The base cases
if n == 0:
r... |
# Copyright 2017 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... |
# coding=utf-8
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
#
# OtterTune - parser.py
#
# Copyright (c) 2017-18, Carnegie Mellon University Database Group
#
'''
Created on Dec 12, 2017
@author: dvanaken
'''
from website.models import DBMSCatalog
from website.types import DBMSType
from .myrocks import MyRocks56Parser
from .mysql import MySql57Parser
from .postgres import Pos... |
from .imports import *
from sklearn_pandas import DataFrameMapper
from sklearn.preprocessing import LabelEncoder, Imputer, StandardScaler
from pandas.api.types import is_string_dtype, is_numeric_dtype
from sklearn.ensemble import forest
from sklearn.tree import export_graphviz
def set_plot_sizes(sml, med, big):
... |
from typing import Union
import torch
import torch.nn as nn
import torch.utils.data
from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau
from torch.optim.optimizer import Optimizer
from mighty.loss import LossPenalty
from mighty.models import AutoencoderLinear
from mighty.monitor.monitor import Monito... |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class ManagephpConfig(AppConfig):
name = 'managePHP' |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2019-04-29 17:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0008_userprofile_job'),
]
operations = [
migrations.AddField(
... |
class Solution(object):
def removeDuplicates(self, nums: List[int]) -> int:
i = 0
for j in range(len(nums)):
if (i == 0 or nums[i - 1] < nums[j]):
nums[i] = nums[j]
i += 1
return i
class Solution2:
def removeDuplicates(self, nums: Li... |
from distutils.dir_util import copy_tree
import shutil
import os
def prepare_directory(path):
shutil.rmtree(path, ignore_errors=True) # remove existing folder
if not os.path.isdir(path): # create folder
os.mkdir(path)
# copy resulting files into correct folders
print 'Copying files...',
in_out_dirs = [['./cpp', '... |
import numpy as np
from matrices.ConfusionMatrix import ConfusionMatrix
class ConfusionMatrixUnitOfWork:
def go(self):
cm = ConfusionMatrix(4)
cm.loadRow([70, 10, 15, 5])
cm.loadRow([8, 67, 20, 5])
cm.loadRow([0, 11, 88, 1])
cm.loadRow([4, 10, 14, 72])
cm.p... |
import pytest
from core.models import UL_ORG_ADMIN
from sushi.models import CounterReportType, SushiCredentials
from organizations.tests.conftest import organizations # noqa
from publications.tests.conftest import platforms # noqa
from logs.tests.conftest import report_type_nd # noqa
@pytest.fixture()
def counter... |
import copy
import inspect
from typing import Any, List, Dict, Optional, Union # noqa
from chalice.app import Chalice, RouteEntry, Authorizer, CORSConfig # noqa
from chalice.app import ChaliceAuthorizer
from chalice.deploy.planner import StringFormat
from chalice.deploy.models import RestAPI # noqa
from chalice.ut... |
# 계산기 예제. 오버라이드의 활용.
class Cal(object):
_history = []
def __init__(self, v1, v2):
if isinstance(v1, int):
self.v1 = v1
if isinstance(v2, int):
self.v2 = v2
def add(self):
result = self.v1+self.v2
Cal._history.append("add : %d+%d=%d" % (self.v1, sel... |
import argparse
import datetime
import glob, os, re
from filter_utils import *
if __name__=="__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--startDate",
default=aWeekAgo(),
help="specify the starting date to check, default is a week ago")
parser.add_argument("-e... |
#!/usr/bin/env python
'''
Run this script inside of src/ and it will look for all the files
that were changed this year that still have the last year in the
copyright headers, and it will fix the headers on that file using
a perl regex one liner.
For example: if it finds something like this and we're in 2014
// Copyr... |
"""A pypi demonstration vehicle.
.. moduleauthor:: Andrew Carter <andrew@invalid.com>
"""
from .statisticalAnalysis import *
__all__ = ['compare_methods'] |
# 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... |
# coding: utf-8
import os
import jinja2
ROOT = os.path.abspath(os.path.join(__file__, '..'))
DEFAULT_CTXT = {
'topic': 'topic',
'collectives': ['mcollective', 'sub1'],
'maincollective': 'mcollective',
'root': ROOT,
'loglevel': 'debug',
'daemonize': 0,
'identity': 'mco1',
'securityprovi... |
from nltk.corpus.reader.api import SyntaxCorpusReader
from nltk.corpus.reader import xmldocs
from nltk import tree
from nltk.util import LazyMap, LazyConcatenation
from nltk.corpus.reader.util import concat
def parsed(element):
"""Converts a 'sentence' XML element (xml.etree.ElementTree.Element) to
an NLTK tr... |
import os
import re
import subprocess
import base64
import os.path as osp
import pickle as pickle
import inspect
import hashlib
import sys
from contextlib import contextmanager
import errno
from rllab.core.serializable import Serializable
from rllab import config
from rllab.misc.console import mkdir_p
from rllab.misc... |
from collections import defaultdict
from billy.scrape.legislators import Legislator, LegislatorScraper
import lxml.html
class KYLegislatorScraper(LegislatorScraper):
jurisdiction = 'ky'
latest_only = True
def scrape(self, chamber, year):
if chamber == 'upper':
leg_list_url = 'http:... |
import xml.etree.ElementTree as ET
import os
import codecs
import logging
import sys
import argparse
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
program = os.path.basename(sys.argv[0])
logger = logging.getLogger(program)
def convert_ami(ami_root_dir, txt_output_dir):
... |
import logging
import os
from ebooklib import epub
logger = logging.getLogger('EPUB_BINDER')
def make_intro_page(crawler):
html = '<div style="padding-top: 25%; text-align: center;">'
html += '<h1>%s</h1>' % (crawler.novel_title or 'N/A')
html += '<h3>%s</h3>' % (crawler.novel_author or 'N/A').replace('... |
import pandas
from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.callbacks import TensorBoard
# load dataset
from sklearn.model_selection import train_test_split
import pandas as pd
dataset = pd.read_csv("framingham.csv", header=None).values
import numpy as np
X_train, X_te... |
from copy import copy
import graphene
from django.core.exceptions import ValidationError
from graphql_jwt.decorators import staff_member_required
from graphql_jwt.exceptions import PermissionDenied
from ....account import events as account_events, models, utils
from ....account.thumbnails import create_user_avatar_th... |
class Events:
def __getattr__(self, name):
if hasattr(self.__class__, '__events__'):
assert name in self.__class__.__events__, \
"Event '%s' is not declared" % name
self.__dict__[name] = ev = _EventSlot(name)
return ev
def __repr__(self):
retur... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""This module contains additional behavior that can be attached to any given
package.
"""
import collections
import os
i... |
import os
import sys
import importlib
from unittest import mock
import importlib_metadata
import pytest
import mlflow
from mlflow.utils.requirements_utils import (
_is_comment,
_is_empty,
_is_requirements_file,
_strip_inline_comment,
_join_continued_lines,
_parse_requirements,
_prune_packa... |
import torch
from torch import nn
import torch.nn.functional as F
import sys
from .backbones.resnet import ResNet
sys.path.append('.')
EPSILON = 1e-12
def weights_init_kaiming(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
nn.init.kaiming_normal_(m.weight, a=0, mode='fan_ou... |
# Copyright 2017 trivago N.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# Generated by Django 3.2.8 on 2022-01-25 18:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit', '0002_auto_20220125_1727'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='name',
... |
import http.server
import socketserver
class TCPServer(socketserver.TCPServer):
allow_reuse_address = True
def serve(root, port):
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=root, **kwargs)
print("Listen... |
import datetime
import logging
import sys
from speedtest import Speedtest
from conntestd.db import get_db_session
from conntestd.db import SpeedTestResult
from conntestd.config import DB_CONN
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
level=logging.INFO,
... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import mock
import logging
import copy
import pytest
import simplejson as json
import requests
from datadog_checks.openstack_controller.api import ApiFactory, SimpleApi, Authenticator, Credential
from datadog_checks.o... |
from flask import Flask, render_template, flash, request
from flask_bootstrap import Bootstrap
from flask_appconfig import AppConfig
from flask_wtf import Form, RecaptchaField
from flask_wtf.file import FileField
from wtforms import TextField, HiddenField, ValidationError, RadioField,\
BooleanField, SubmitField, In... |
import multiprocessing
import os
import random
import shutil
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union, cast
from unittest import TestLoader, TestSuite, mock, runner
from unittest.result import TestResult
from django.conf import settings
from django.d... |
#!/usr/bin/env python
from pip.req import parse_requirements
from setuptools import setup, find_packages
try:
with open('VERSION.txt', 'r') as v:
version = v.read().strip()
except FileNotFoundError:
version = '0.0.0.dev0'
with open('DESCRIPTION', 'r') as d:
long_description = d.read()
# Require... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ArviZ documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 11 18:33:59 2018.
#
# 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
# auto... |
from .datasets import (
get_data_dir,
clear_data_dir,
fetch_x5, fetch_lenta,
fetch_criteo, fetch_hillstrom,
fetch_megafon
)
__all__ = [
'get_data_dir',
'clear_data_dir',
'fetch_x5', 'fetch_lenta',
'fetch_criteo', 'fetch_hillstrom',
'fetch_megafon'
] |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/kaiodt/kaio_ros_ws/install/include".split(';') if "/home/kaiodt/kaio_ros_ws/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "message_runtime;actionlib_msgs".replace(';', ' ')
PKG_CONFIG_L... |
import argparse
import json
import os
import sys
import requests
from tqdm import tqdm
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--download_dir", type=str, default="/root/downloads/")
parser.add_argument("--bert", action="store_true", help="download a bert model (defa... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
from dal import autocomplete
from django import forms
from .models import Project
class ProjectForm(forms.ModelForm):
class Meta:
model = Project
fields = ('__all__')
widgets = {
'client': autocomplete.ModelSelect2(
url='projects:client-autocomplete'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb
_connectedDb = None
_dbCursor = None
def ConnectToDb(self, userID, userPassword):
if self._connectedDb is not None:
DisconnectDb(self)
self._connectedDb = MySQLdb.connect(host="localhost", user = userID, passwd=userPassword)
self._dbCursor = self._co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.