text stringlengths 2 999k |
|---|
"""Functions for Pulling data from ES and unpacking into a table
"""
import pandas as pd
import json
from uptasticsearch.clients import uptasticsearch_factory
def es_search(es_host, es_index, query_body="{}", size=10000, max_hits=None, scroll="5m"):
"""Execute a query to elasticsearch and get a DataFrame back
... |
#
# 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 us... |
#!/usr/bin/python
import os, sys, re, json, shutil, multiprocessing
from subprocess import Popen, PIPE, STDOUT
# Definitions
INCLUDES = ['btBulletDynamicsCommon.h', os.path.join('BulletCollision', 'CollisionShapes', 'btHeightfieldTerrainShape.h'), os.path.join('BulletCollision', 'CollisionDispatch', 'btGhostObject.h... |
import os
import random
# 负责加载辅导员的所有学生照片路径,
# 滚动时随机访问路径,停止时获取当前选中学生的学号
class roll_photo:
def __init__(self):
self.fdy_selected = ""
self.all_fdy_student = []
self.current_selected_student = 0
self.img_path = 'photos'
# 每次换辅导员的所有预加载动作
def reset(self, fdy):
self.all_f... |
# 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... |
"""This module contains helper functions when working with sklearn (scikit-learn) objects;
in particular, for evaluating models"""
# pylint: disable=too-many-lines
import math
import warnings
from re import match
from typing import Tuple, Union, Optional, List, Dict
import numpy as np
import pandas as pd
import scipy.... |
"""Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipula... |
import os
import numpy as np
from subprocess import call
from collections import Counter
################################################################################################
### read 2d array
def read2d_array(filename,dtype_used):
data=open(filename,'r')
data0=[]
for records in data:
tmp = [x.strip() ... |
import io
import os
from setuptools import setup
dir = os.path.dirname(__file__)
with io.open(os.path.join(dir, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pytrends',
version='4.7.5',
description='Pseudo API for Google Trends',
long_description=long_description... |
#!/usr/bin/env python2
"""
Copyright (c) 2013-2016 Ben Croston
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, me... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... |
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file
from exec_util import exec_cmd
import os
import sys
if sys.platform == 'win32':
# Force use of the git version bundled with depot_to... |
from django import forms
from django.core.exceptions import ValidationError
import ipaddr
from cyder.base.constants import IP_TYPES, IP_TYPE_4, IP_TYPE_6
from cyder.cydhcp.network.models import Network, NetworkKeyValue
from cyder.cydhcp.site.models import Site
from cyder.cydhcp.vlan.models import Vlan
from cydns.ip.m... |
import numpy as np
import unittest
import ray
import ray.rllib.agents.dqn as dqn
from ray.rllib.utils.test_utils import (
check,
check_compute_single_action,
check_train_results,
framework_iterator,
)
class TestDQN(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
ray.init... |
import os
import numpy as np
from Vector_Extractor import img2rgb
from PIL import Image
import matplotlib.pyplot as plt
#calc mean and variance of RGB dataset
def viewFlow(flow_array, dimx, dimy):
colormap = img2rgb(flow_array, dimx, dimy)
im = Image.fromarray(colormap)
fig, ax = plt.subplots(1)
ax.i... |
from src.vm import VirtualMachine
class TestVM:
def test_sample_program(self):
char = 'G'
program = "9,32768,32769,4,19,32768".split(',')
vm = VirtualMachine(interactive=False)
for i, val in enumerate(program):
vm.memory[i] = int(val)
vm.registers[1] = ord(char... |
# Copyright 2016-2021 The Meson development team
# 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 agree... |
#!/usr/bin/env python3
"""
NAME.py
Module Name:
NAME
Author:
YOU <you@email.com>
Description:
DESCRIPTION
"""
import dataclasses
# include any other networking imports needed!
from brute.core.protocol import ProtocolBruteforce
@dataclasses.dataclass
class MOD(ProtocolBrutefor... |
#
# 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 us... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
from django.conf import settings
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates an... |
from .test_end_to_end import * |
"""
Various http lib classes
"""
__author__ = 'VMware, Inc.'
__copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved. -- VMware Confidential' # pylint: disable=line-too-long
import six
class HTTPRequest(object):
"""
This class represents an HTTP Request
:type method: :class:`vmware.vapi.proto... |
from dataclasses import dataclass
from bindings.gmd.abstract_dq_thematic_accuracy_type import (
AbstractDqThematicAccuracyType,
)
__NAMESPACE__ = "http://www.isotc211.org/2005/gmd"
@dataclass
class DqNonQuantitativeAttributeAccuracyType(AbstractDqThematicAccuracyType):
class Meta:
name = "DQ_NonQuant... |
# # Comparing Search Strategies
#
# This example compares the performance of [RandomSearch](/api/autogoal.search/#RandomSearch)
# and [PESearch](/api/autogoal.search/#PESearch) on a toy problem.
# The full source code can be found [here](https://github.com/autogoal/autogoal/blob/main/docs/examples/comparing_search_stra... |
# -*- coding: utf-8 -*-
from doodle.config import CONFIG
from doodle.core.models.article import Article, ArticleHitCount
from doodle.core.models.comment import ArticleComments
from ..base_handler import BaseHandler
class HomeHandler(BaseHandler):
def get(self):
articles, next_cursor = Article.get_articl... |
class Path(object):
@staticmethod
def db_root_dir(dataset):
if dataset == 'occ5000':
return '/home/kidd/kidd1/Occ5000'
elif dataset == 'pascal':
return '/home/kidd/kidd1/VOCtrainval_11-May-2012/VOCdevkit/VOC2012/' # folder that contains VOCdevkit/.
elif dataset =... |
"""Players spreadsheet table"""
import re
from discord.ext import commands
from .base_spreadsheet import BaseSpreadsheet
from common.api.spreadsheet import (
find_corresponding_cell_best_effort_from_range,
find_corresponding_cells_best_effort_from_range,
Cell,
from_letter_base,
)
class PlayersSpreads... |
# Copyright 2017 The Forseti Security 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 ap... |
# -*- coding: utf-8 -*-
#
# This class was auto-generated from the API references found at
# https://support.direct.ingenico.com/documentation/api/reference/
#
from ingenico.direct.sdk.data_object import DataObject
class ExternalTokenLinked(DataObject):
__computed_token = None
__gts_computed_token = None
... |
"""
Taken from orobix
https://github.com/orobix/Prototypical-Networks-for-Few-shot-Learning-PyTorch/blob/master/src/protonet.py
"""
import torch.nn as nn
def conv_block(in_channels, out_channels):
'''
returns a block conv-bn-relu-pool
'''
return nn.Sequential(
nn.Conv2d(in_channels, out_chann... |
from typing import Type
from solutions.day18.parsers import ExprNode, BaseParser
from solutions.day18.tokenizer import tokenize
def execute_expression(expression: str, parser: Type[BaseParser]) -> int:
return execute_node(parser.parse_expression(tokenize(expression)))
def execute_node(expr_node: ExprNode) -> i... |
#!/usr/bin/env python3
__author__ = "pyd4nt1c"
__version__ = 1.0
__license__ = "MIT License"
# -- Imports --
import hashlib
import json
import mimetypes
import os.path
import sys
import time
from datetime import datetime
from typing import Optional
from fastapi import FastAPI, File, Form, HTTPException, Request, Up... |
from flask import current_app, request, Blueprint, Response
import json
# This is the blueprint object that gets registered into the app in blueprints.py.
general = Blueprint('general', __name__)
@general.route("/health")
def check_status():
return Response(response=json.dumps({
"app": current_app.config... |
N, M = list(map(int, input().split()))
cidades = [[] for i in range(M - 1)]
for i in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
cidades[A].append((B, C))
cidades[B].append((A, C))
inicio = 0
fim = N - 1
custo = [float('inf') for i in range(M)]
custo[inicio] = ... |
"""
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.conf import settings
from django.core.exceptions import FieldError
from django.db import connections
from django.db.models.constants import LOOKUP_SEP
from django.db.models.fields import DateField, DateTimeField, Field... |
from PlayingCard import PlayingCardNodePath
import PlayingCardGlobals
from pandac.PandaModules import NodePath, Vec3
from direct.interval.IntervalGlobal import LerpHprInterval, Parallel, SoundInterval
class PairingGameCard(PlayingCardNodePath):
DoIntervalDefault = True
FlipTime = 0.25
UseDifferentCardColor... |
#--------------------------------------------------------------------
#
# PyGUI - Menu - Win32
#
#--------------------------------------------------------------------
import win32ui as ui, win32con as wc
from GUI import export
from GUI.WinMenus import win_command_to_id
from GUI.GMenus import Menu as GMenu
class Men... |
from unittest.mock import patch
import pytest
from eppy.exceptions import EppLoginError
from registrobrepp.breppclient import BrEppClient
class TestBrEppClient:
def test_login(self, objuris, extraexturis, eppresponsecode1000):
registrobr = BrEppClient()
username = 'user'
password = '123... |
import yaml
import boto3
import logging
from Crypto.PublicKey import RSA
import urllib.request
import os
logging.basicConfig(filename='%s.log' % ("deploy"), filemode='w', format='%(name)s - %(levelname)s - %(message)s')
setupUserScript = """#!/bin/bash
"""
createGroupPerms = """
groupadd datagrp
chgrp datagrp /data
... |
#! /usr/bin/env python3
import subprocess
import json
import struct
import copy
import base64
subprocess.run("./build.sh")
with open("./res/context.json", 'r') as f:
context = json.load(f)
def call(method_name, input=None):
tmp_context = copy.deepcopy(context)
if input is not None:
tmp_context['... |
# Copyright (C) 2020 Adek Maulana.
# All rights reserved.
# Ported by @mrismanaziz
# FROM Man-Userbot
# Recode by @Pocongonlen
"""
Heroku manager for your userbot
"""
import math
import os
import aiohttp
import heroku3
import urllib3
from userbot import BOTLOG, BOTLOG_CHATID
from userbot import C... |
"""
Common settings and globals.
"""
import random
import os
""" NAMES CONFIGURATION """
APP_NAME = "odm2admin" # This has to match the name of the folder that the app is saved
VERBOSE_NAME = "ODM2 Admin"
SITE_HEADER = "ODM2 Admin"
SITE_TITLE = "ODM2 Admin"
""" END NAMES CONFIGURATION """
""" PATH CONFIGURATION ""... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... |
"""
audfprint_analyze.py
Class to do the analysis of wave files into hash constellations.
2014-09-20 Dan Ellis dpwe@ee.columbia.edu
"""
from __future__ import print_function
import os
import numpy as np
import scipy.signal
# For reading/writing hashes to file
import struct
# For glob2hashtable, localtester
impor... |
# -*- coding: utf-8 -*-
import random
import string
from covador.compat import bstr
_BOUNDARY_CHARS = string.digits + string.ascii_letters
def encode_multipart(fields, boundary=None):
def escape_quote(s):
return bstr(s).replace(b'"', b'\\"')
if boundary is None:
boundary = ''.join(random.ch... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle
from regions import PixCoord
from gammapy.datasets import SpectrumDatasetOnOff
from gammapy.maps import RegionGeom, RegionNDMap, WcsNDMap
from gammapy.ut... |
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from datumaro.components.extractor import *
conf_thresh = 0.02
def _match_confs(confs, detections):
matches = [-1] * len(detections)
queries = {}
for i, det in enumerate(detections):
queries.setdefault(int(det[1]), []).app... |
"""
Copyright (c) 2015 SONATA-NFV and Paderborn University
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 ap... |
# https://www.codehaven.co.uk/misc/python/using-arrow-keys-with-inputs-python/
import curses
import matplotlib.pyplot as plt
from envs.lehnert_gridworld import LehnertGridworld
env = LehnertGridworld()
screen = curses.initscr()
curses.noecho()
curses.cbreak()
screen.keypad(True)
try:
while True:
action ... |
# -*- coding: utf-8 -*-
"""
Assets database models
--------------------
"""
# from flask import current_app
from functools import total_ordering
import pathlib
from app.extensions import db, HoustonModel
from app.utils import HoustonException
from PIL import Image
import uuid
import logging
log = logging.getLogger... |
import json
import requests
def complex_rephrase(query, span, target_span):
url = 'http://172.16.13.25:9009'
headers = {'apikey': '9212c3f48ad1766bcf63535710686d07'}
params = {'query': query,
'span': span,
'target': target_span}
r = requests.get(url, params=params, headers=... |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.10.1'
version = '1.10.1'
full_version = '1.10.1'
git_revision = 'f769c64026f5ff993ec1e28cbd9f39b8da75347d'
release = True
if not release:
version = full_version
|
LV_HOR_RES = 240
LV_VER_RES = 240
def ta_event_cb(ta,event):
if event == lv.EVENT.VALUE_CHANGED:
txt = ta.get_text()
pos = ta.get_cursor_pos()
# find position of ":" in text
colon_pos= txt.find(":")
# if there are more than 2 digits before the colon, remove the last one ent... |
# Unit Tests for the PyDMLabel Widget
import pytest
import numpy as np
import logging
from ...utilities import is_pydm_app
from ...widgets.label import PyDMLabel
from ...widgets.base import PyDMWidget
from ...widgets.display_format import parse_value_for_display, DisplayFormat
from qtpy.QtWidgets import QApplicatio... |
import urllib
import urllib2
import json
import re
import sys
from botomatic import TBot
class NarroReadMe(TBot):
debug_mode = False
def __init__(self):
handle = "narroreadme"
self.query = "read this article"
super(NarroReadMe, self).__init__(handle)
def run(self):
# fin... |
from energenie import switch_on, switch_off
from time import sleep
# turn all plug sockets on and off
switch_on()
switch_off()
# turn a plug socket on and off by number
switch_on(1)
switch_off(1)
switch_on(2)
switch_off(2)
|
# Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2022 NLTK Project
# Author: Yoav Goldberg <yoavg@cs.bgu.ac.il>
# Steven Bird <stevenbird1@gmail.com> (minor edits)
# URL: <https://www.nltk.org>
# For license information, see LICENSE.TXT
"""
S-Expression Tokenizer
``SExprTokenizer`` is used to fin... |
from sklearn.metrics import roc_auc_score
from keras.callbacks import Callback
class roc_callback(Callback):
def __init__(self,training_data,validation_data):
self.x = training_data[0]
self.y = training_data[1]
self.x_val = validation_data[0]
self.y_val = validation_data[1]
def... |
from __future__ import print_function
from __future__ import absolute_import
import sys
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
if __name__ == "__main__":
# --job_endpoint argument supplied by the Flink entry point
args = [
"--runner=PortableRunner"... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Brian Towles
#
# 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, ... |
from chatbot.common.chat_share_data import ShareData
import logging
class RuleIntentAnalyzer(ShareData):
def __init__(self, intent_conf):
self.intent_conf = intent_conf
def parse(self, share_data):
if (share_data.get_intent_id() != ""):
logging.info("■■■■■■■■■■ 의도 존재 : " + share_d... |
from os import environ
CACHE_STORE = environ.get('CACHE_STORE', '/tmp/cache')
|
# Copyright (C) 2020 azrim.
# All rights reserved.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
from bitlyshortener import Shortener
from re import match
from userbot import bot, CMD_HELP, BITLY_TOKEN, BOTLOG, BOTL... |
"""Organization: a University, College, School, or other institution."""
from collections import OrderedDict
from google.appengine.api import memcache, taskqueue
from google.appengine.ext import ndb
import json
import logging
import random
import string
import organization_tasks
from gae_models import DatastoreModel... |
from django.urls import path
from .views import ShowProfilePageView, UserRegisterView, CreateProfilePageView, UserEditView, PasswordsChangeView, EditProfilePageView
#from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('register/', UserRegisterView.as_view(), name='register'... |
import datetime
import logging
from flask import Blueprint, request, Response
from common import exception
from ecommerce.ali1688 import ali1688
from ecommerce.vova import vova
from util import json_util
goods = Blueprint('goods', __name__)
@goods.route('/list_all_category/<platform>', methods=['GET'])
def list_al... |
from PIL import Image as Im
from PIL.ExifTags import TAGS
import os.path
from .exceptions import *
class Image:
def isfile(self, filename):
result = os.path.exists(filename) # checking if file exist
if result == False:
raise FileNotFound(f"file not found: {filename}") # file except... |
from typing import Set
# CONSTANTS
# TLS VERSIONS
SSL_V3: str = "SSLv3"
TLS_1: str = "TLS_1"
TLS_1_1: str = "TLS_1.1"
TLS_1_2: str = "TLS_1.2"
TLS_1_3: str = "TLS_1.3"
ALLOWED_TLS_VERSIONS: Set[str] = {
SSL_V3,
TLS_1,
TLS_1_1,
TLS_1_2,
TLS_1_3,
}
# CIPHER LISTS
ALL: str = "ALL"
NO_1_3: str = "NO1.... |
from django.core.management.base import BaseCommand, CommandError
from utils.data_io import parseAccessionFile, convertAccessionsToJson, parse_country_map
import json
class Command(BaseCommand):
help = 'Retrieve Accessions data and create fixture'
def add_arguments(self, parser):
parser.add_argument... |
import pandas as pd
from src.utils.utils import get_project_dir
import logging
logger = logging.getLogger(__name__)
DATA_FOLDER = get_project_dir() / 'data'
DUMP_FOLDER = DATA_FOLDER / 'dumps'
DUMP_ORDERS_FPATH = DUMP_FOLDER / 'orders_dump.csv'
DUMP_PRICES_FPATH = DUMP_FOLDER / 'prices_dump.csv'
def load_orders_dat... |
'''
Manage Windows users with the net user command
NOTE: This currently only works with local user accounts, not domain accounts
'''
def __virtual__():
'''
Set the user module if the kernel is Windows
'''
return 'user' if __grains__['kernel'] == 'Windows' else False
def add(name, uid=None, gid=None... |
#!/usr/bin/python3
'''
Created on 3 sty 2020
@author: spasz
'''
import json
import os
import logging
def jsonRead(filename):
data = []
if os.path.isfile(filename):
with open(filename, 'r') as f:
data = json.load(f)
else:
logging.debug('(JsonModule) File not exists!')
return... |
'''
04 - Cumulative statistics
Cumulative statistics can also be helpful in tracking summary statistics
over time. In this exercise, you'll calculate the cumulative sum and cumulative
max of a department's weekly sales, which will allow you to identify what the total
sales were so far as well as what the highes... |
"""
ASGI config for autosaloon project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
from random import choice
from world.dataHandler.pluginManager.Plugin import Plugin
class Join(Plugin):
"""
A plugin that enables joining the server and rooms.
"""
def __init__(self, users, config, packet):
super(Join, self).__init__(users, config, packet)
# Events
def join_server(... |
from zipf import Zipf
from utils import fail_empty
def test_empty_var():
errors = fail_empty(Zipf.var)
assert not errors, "errors occured:\n{}".format("\n".join(errors))
|
#!/usr/bin/python
# encoding: utf-8
"""
@author: Ian
@contact:yongguiluo@hotmail.com
@file: __init__.py.py
@time: 2019/2/22 13:00
""" |
# Copyright 2012 Nebula, 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 agree... |
# Generated by Django 2.1 on 2018-11-22 18:22
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organisation', '0009_auto_20181022_1607'),
]
operations = [
migrations.AlterField(
model_name='colle... |
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class User(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
company_name = models.CharField(max_length=50)
city = models.CharField(max_length=50)
... |
from __future__ import unicode_literals
from django.contrib import admin
from taggit.models import Tag, TaggedItem, TagGroup
class TaggedItemInline(admin.StackedInline):
model = TaggedItem
class TagAdmin(admin.ModelAdmin):
inlines = [
TaggedItemInline
]
list_display = ["user", "name", "slug... |
#!/usr/bin/env python3
# coding: utf-8
import os
import argparse
from executor import Executor
from bottle import run, post, request
@post('/executor')
def execute():
task_id = request.forms.get('id')
entrypoint = request.forms.get('entrypoint')
fileupload = request.files.get('tarfile')
logs = executo... |
# Copyright 2019-2020 the ProGraML authors.
#
# Contact Chris Cummins <chrisc.101@gmail.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... |
BASE_URL = "https://statsapi.web.nhl.com"
HEADSHOT_URL = "https://nhl.bamcontent.com/images/headshots/current/168x168/{}.jpg"
CONFIG_ID = 13457745779
TEAMS = {
"Anaheim Ducks": {
"away": "#F95602",
"conference": "Western",
"division": "Pacific",
"emoji": "AnaheimDucks:381568940108939... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import assert_equal, assert_allclose, assert_
from scipy._lib._numpy_compat import suppress_warnings
from pytest import raises as assert_raises
import pytest
from scipy.interpolate import (BSpline, BPoly, PPoly, mak... |
# Copyright (c) 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import unittest
import numpy as np
from coremltools._deps import _HAS_ONNX, MSG_ONNX_NOT_FOUND
if _HAS_O... |
def crearArchivo(input, instfuncion):
archivo = ''
f = open("team29/ui/codigo3D.py", "w")
file1 = open("salida/header.txt", "r")
archivo += file1.read()
archivo += 'def funcionIntermedia(): \n'
archivo += '\tglobal lista\n'
archivo += '\tentrada = lista.pop()\n'
archivo += '\treturn an... |
'''
BSD 2-Clause License
Copyright (c) 2018, Po-Han Huang
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 conditi... |
import random
from urllib.request import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __init__ that takes ... |
import logging
import sys
import uuid
from redash.query_runner import *
from redash.utils import json_dumps, json_loads
logger = logging.getLogger(__name__)
try:
import pymssql
enabled = True
except ImportError:
enabled = False
# from _mssql.pyx ## DB-API type definitions & http://www.freetds.org/tds.h... |
import argparse
import os
from util import util
import torch
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
self.initialized = False
def initialize(self):
self.parser.add_argument('--dataroot', req... |
# --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import io
import os
import time
import torch.distributed as dist
import ... |
import gc, sys, os, json
from itertools import product, combinations
from typing import Iterable, Iterator, Dict, Tuple, Union, Any, Set
from abc import ABCMeta, abstractmethod
from .condition import Container
mainfile = os.path.split(sys.argv[0])[0]
def structure(cls: "GranularMeta", json: bool = False) -> D... |
# -*- coding: utf-8 -*-
# Copyright 2018 New Vector
#
# 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... |
"""Module contain logic of overload object implementation."""
|
""" ImageConverter class
Convert an image to JPEG using CoreImage --
for example, RAW to JPEG. Only works if Mac equipped with GPU. """
# reference: https://stackoverflow.com/questions/59330149/coreimage-ciimage-write-jpg-is-shifting-colors-macos/59334308#59334308
import pathlib
import objc
import Metal
imp... |
# coding: utf-8
"""
Transaction Management Bus (TMB) API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: V3.2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import a... |
import os
import gc
import pathlib
import warnings
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ..column import _parse_tdisp_format, _fortran_to_python_format, \
python_to_tdisp
from .. import HDUList, PrimaryHDU, BinTableHDU
from ... import fits
from .... import units as u
f... |
# Copyright 2018/2019 The Rlgraph 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 appli... |
'''
This module reads JSON files and acts as a
placeholder for the data
'''
import json
import os
JSON_FILES = sorted(os.listdir('inputdata'))
def read_json_data(json_file):
'''
:param json_file: the input json file
'''
with open('inputdata/'+json_file, 'r') as file:
return json.load(file... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.