text stringlengths 2 999k |
|---|
import unittest
from plugins.onetv import OneTV
class TestPluginPerviyKanal(unittest.TestCase):
def test_can_handle_url(self):
regex_test_list = [
"https://media.1tv.ru/embed/ctcmedia/ctc-che.html?start=auto",
"https://media.1tv.ru/embed/ctcmedia/ctc-dom.html?start=auto",
... |
#!/usr/bin/env python3
"""
this is a bot
"""
def main():
"""
There are many like it but this one is mine
"""
print("Stubby stub!")
if __name__ == "__main__":
main()
|
"""
A non-blocking container resource for WSGI web applications.
"""
import os, threading
import Queue
from zope.interface import implements
from twisted.internet import defer
from twisted.python import log, failure
from twisted.web2 import http
from twisted.web2 import iweb
from twisted.web2 import server
from twist... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
https://pymotw.com/3/asyncio/synchronization.html
'''
import asyncio
async def worker(condition, n):
print("Worker ", n)
async with condition:
print("worker is waiting ", n)
await condition.wait()
print("Worker %d ending" % n)
async def... |
import numpy as np
import os
from sklearn.preprocessing import LabelEncoder
def get_dataset():
list_folder = os.listdir('data/')
list_images = []
for i in xrange(len(list_folder)):
images = os.listdir('data/' + list_folder[i])
for x in xrange(len(images)):
image = [list_fol... |
# 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 ... |
# --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2015, 2016, 2017, 2018
# --------------------------------------------------------------------------
# Author: O... |
def calculate(x, y):
total = x + y # 새로운 값이 할당되어 함수내 total은 지역변수가 됨
print ("In Function")
print ("a:", str(a), "b:", str(b), "a+b:", str(a+b), "total :", str(total))
return total
a = 5 # a와 b는 전역변수
b = 7
total = 0 # 전역변수 total
print ("In Program - 1")
print ("a:", str(a), "b:", str(b), "a+b:", str(... |
from __future__ import print_function
import sys
sys.path.append("../../tests/python")
import xgboost as xgb
import numpy as np
import unittest
from nose.plugins.attrib import attr
from sklearn.datasets import load_digits, load_boston, load_breast_cancer, make_regression
import itertools as it
rng = np.random.Random... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Setup scr... |
import logging
from gym.envs.registration import register
logger = logging.getLogger(__name__)
# discrete action cache
register(
id='Cache-v0',
entry_point='gym_cache.envs:CacheEnv',
kwargs={
'InputData': 'data/ANALY_MWT2_UCORE_processed',
'CacheSize': 100 * 1024 * 1024 * 1024
},
#... |
import enum
from construct import (
Adapter,
Byte,
Construct,
Enum,
FlagsEnum,
GreedyBytes,
GreedyRange,
Int32ub,
IntegerError,
Optional,
PascalString,
Prefixed,
PrefixedArray,
Struct,
Switch,
)
from construct.core import (
byte2int,
singleton,
st... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 14 13:15:03 2016
@author: jcrpda & ls
"""
import re
import nltk
rfile = raw_input("Enter a .txt file to convert to .csv: ")
ofile = raw_input("Enter the output file name: ")
f = open(file)
sent_list = f.readlines()
word_list = []
def rep(string):
# strip the slas... |
# 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 ... |
import sys
n = int(input())
s = input()
if (n%2!=0):
print("No")
sys.exit(0)
l = n//2
if s[:l] == s[l:]:
print("Yes")
else:
print("No")
|
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# Generated by Django 2.0 on 2020-02-15 13:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('post', '0001_initial'),
('core', '0001_initial'),
]
operations = [
migrations.Add... |
name = input('name')
excluded = 0
class_year = 1
grades_sum = 0
while True:
if excluded > 1:
break
if class_year > 12:
break
grade = float(input())
if grade >= 4:
class_year += 1
grades_sum += grade
else:
excluded += 1
if excluded > ... |
import os
__tests_location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__))
)
|
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_0.models.id_reso... |
# Django Library
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from dal import autocomplete
# Localfolder Library
from ..models import PyCurrency
from .web_father import (
FatherCreateView, Fath... |
from django.contrib import admin
from .models import Expense,Budget,Profile
# Register your models here.
admin.site.register(Expense)
admin.site.register(Budget)
admin.site.register(Profile)
|
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... |
"""
백준 13985번 : Equality
"""
print('YES' if eval(input().replace('=', '==')) else 'NO') |
# from django.core.checks import register, Warning
"""
To run checks for this app, install "ar-healthchecks" and run "manage.py check activeusers"
"""
"""
A list of apps that need to be listed in INSTALLED_APPS.
Checks raise an error if a dependency is missing
"""
CHECK_INSTALLED_APPS = [
# 'some_dependency',
]... |
"""
Using Audrius' models from flask browser.
This file contains models that are used with SQLAlchemy.
Note: some things done in methods written in classes rely on the querying module adding extra information to classes,
so these will not work in a normal context outside the framework.
"""
from __future__ imp... |
import arxiv
from flask import Flask, request, redirect, url_for, flash, jsonify
import pymysql
import pandas as pd
import datetime
import time
import mysql_config
import sys
import logging
MAX_ARTICLES = 10000
def make_entry(d):
""" Create database entry from query result"""
id_ = d['id']
updated = dateti... |
# ------------------------------------------------
# Name: Cylon / KnightRider Lights
#
# History
# 2017-0529 PePo: adopted for neopixel, using generic leds and pattern()
# 2017_0514 PePo refactor sequenceCycle() and made demos cylon, knightrider and police
# Police pattern: https://www.instructables.com/id/Police-L... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
# coding=utf-8
"""
This module adds capabilities to argparse by patching a few of its functions. It also defines a parser
class called Cmd2ArgumentParser which improves error and help output over normal argparse. All cmd2 code uses
this parser and it is recommended that developers of cmd2-based apps either use it or wr... |
# Future
from __future__ import annotations
# Standard Library
import time
# Packages
import aiohttp
# My stuff
from spotipy import exceptions, values
from spotipy.typings.objects import ClientCredentialsData, UserCredentialsData
__all__ = (
"ClientCredentials",
"UserCredentials"
)
class ClientCredential... |
# Python modules
# 3rd party modules
import numpy as np
# Our modules
import vespa.common.constants as common_constants
import vespa.common.minf_parabolic_info as minf
import vespa.common.util.generic_spectral as util_spectral
def funct_optimize_phase0(rad, info):
"""
Optimization function used optimiz... |
import pytest
from test_compare_reads import FakeRead, bamread_to_fakeread
import kbbq.main
from kbbq import recalibrate
from kbbq import compare_reads
import pysam
import numpy as np
def test_find_corrected_sites(simple_fastq_reads):
for r in simple_fastq_reads:
r2 = pysam.FastxRecord(name = r.name, seque... |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
from kivy.config import Config
from kivy.uix.switch import Switch
import random
from kivy.lan... |
"""
WSGI config for drftest project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
# rubik.py
# Author: Ronald L. Rivest
# Modified: Michael Lieberman
# Last updated: October 24, 2008
#
# Routines to work with Rubik's 2x2x2 cube
"""
We'll call the six sides, as usual:
Front Back Up Down Left Right
or F, B, U, D, L, R.
Permutations:
We'll number the cubie positions starting
at 0, front to ba... |
"""
create histogram table
Revision ID: a7b01b0429ff
Revises:
Create Date: 2020-07-09 10:03:15.932674
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine.reflection import Inspector
# revision identifiers, used by Alembic.
revision = 'a7b01b0429ff'
down_revision = None
branch_labels = None
dep... |
#!/usr/bin/python
#
# Copyright 2010 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 b... |
from apps.api.views import competition_views as views
from apps.api.views import storage_views as storage_views
from django.conf.urls import url
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'competition/(?P<competition_id>\d+)/participants', views.CompetitionParticipantAPIViewS... |
import sys
from collections import defaultdict as d
import gzip
from optparse import OptionParser, OptionGroup
from bisect import bisect_left as BL
#Author: Martin Kapun
######################################################### HELP #########################################################################
usage=... |
from pybrain.rl.agents.linearfa import LinearFA_Agent
from pybrain.rl.experiments import EpisodicExperiment
from environment import Environment
from tasks import LinearFATileCoding3456GoToTask
from training import LinearFATraining
from learners import SARSALambda_LinFA_ReplacingTraces
task = LinearFATileCoding3456Go... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Finds android browsers that can be started and controlled by telemetry."""
from __future__ import absolute_import
import contextlib
import logging
import... |
#!/usr/bin/env python2.7
# Copyright 2015, VIXL authors
# 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 l... |
#!/usr/bin/python
#
# Copyright 2020 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 ag... |
import argparse
import json
from os import path
from pathlib import Path
from rich.console import Console
from rich.table import Table
IGNORE_KEYS = set([
"python_version",
"program_command",
"agent_class",
"packages",
"git",
"start_time",
])
def main():
parser = argparse.ArgumentPar... |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
serializer_class = UserSeria... |
#! Replace With Alphabet Position
def square_of_squares(x):
return True if x**0.5 - round(x**0.5, 0) == 0 else False
print(square_of_squares(4))
print(square_of_squares(400))
print(square_of_squares(2669375556))
print(square_of_squares(266937555))
print(square_of_squares(14))
print(square_of_squares... |
# -*- coding: utf-8 -*-
"""
Created on Mon, March 23 13:13:13 2020
@author: Ahmad H. Mirza
scriptVersion = 1.0..0
"""
import os
"""
Directory Names
"""
DATABASE_DIR_NAME = "Database"
WORKSPACE_DIR_NAME = "Workspaces"
USER_UPLOADS_DIR_NAME = "User_Uploads"
USER_FILES_DIR_NAME = "User_Files"
USER_TF_DIR... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Microsoft Public License. A
# copy of the license can be found in the License.html file at the root of this... |
#!/usr/bin/python
from smfishHmrf.HMRFInstance import HMRFInstance
from smfishHmrf.DatasetMatrix import DatasetMatrix, DatasetMatrixSingleField, DatasetMatrixMultiField
from smfishHmrf.spatial import rank_transform_matrix, calc_silhouette_per_gene
import sys
import os
import math
import subprocess
import numpy as np
im... |
''' Language specification for the WoW Macro language.
Options.
'''
from macro.language.base import LanguagePart
from macro.interpret.assemble_functions import *
# Class describing Options
class Option(LanguagePart):
''' Class describing option characteristics. In addition to
fields in LanguagePart, the foll... |
"""
Source: PCP Notebooks (https://www.audiolabs-erlangen.de/PCP)
Module: LibPCP.complex
Author: Meinard Mueller, International Audio Laboratories Erlangen
License: The MIT license, https://opensource.org/licenses/MIT
"""
import os
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import Li... |
import asyncio
import threading
from queue import Queue
from random import randint
from ibapi.client import EClient # type: ignore
from ibapi.wrapper import EWrapper # type: ignore
from ibapi.order import Order # type: ignore
from aat.exchange import Exchange
from aat.config import EventType, TradingType
from aat.... |
# Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration.
#
# 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 req... |
import os
import logging
import csv
import pandas as pd
from collections import OrderedDict
from bs4 import BeautifulSoup
DUMMY_ANTECEDENT = None
#####################
# GLOBAL PARAMETERS
#####################
# Path "./data/*" assumes you are running from root folder, i.e. (python /src/baseline.py)
# Use path "../d... |
"""
Implementation of a Modbus Client Using Twisted
--------------------------------------------------
Example run::
from twisted.internet import reactor, protocol
from pymodbus.client.asynchronous import ModbusClientProtocol
def printResult(result):
print( "Result: %d" % result.bits[0])
def... |
# -*- coding: utf-8 -*-
"""
Module for preprocessing utilities. These are supposed to complement
the preproessing utilities that are available with MNE.
"""
import numpy as np
from math import ceil
from anlffr.utils import logger, verbose
from mne import pick_channels
from mne.filter import filter_data
@verbose
def... |
cfg = {
"api_id":1234567890,
"api_hash":'1q2we3e4t67h78jh88io9o00'
} |
# Copyright (c) 2020 PaddlePaddle 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... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... |
import json
import unittest
from stix_shifter_utils.stix_translation.src.json_to_stix import json_to_stix_translator
from stix_shifter_modules.sumologic.entry_point import EntryPoint
from stix_shifter_utils.stix_translation.src.utils.transformer_utils import get_module_transformers
MODULE = "sumologic"
entry_point = E... |
import os
is_prod = os.environ.get('IS_PROD')
if is_prod:
try:
from .settings_prod import *
except Exception as e:
raise
print('Using production environment settings.')
else:
try:
from .settings_dev import *
except Exception as e:
raise
print('Using development e... |
# 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 ... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.db.models import ConversationUserData
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
import json
import logging
class PPOpe... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... |
import pymysql
db = pymysql.connect("localhost","root","c1o0l0d8","EstusFlask" )
cursor = db.cursor()
cursor.execute("SELECT * FROM hospital")
hospital_data = cursor.fetchall()
db.commit()
cursor.execute("SELECT * FROM diagnosis")
diagnosis_data = cursor.fetchall()
db.commit()
cursor.execute("SELECT * FROM pati... |
"""Utility scripts to provide a filterbank and spectrogram generator.
The filterbank utilizes filter functions defined in gumpy.signal.
To ensure a consistent spectrogram size, either cropping or scaling can be
used. Just change the corresponding lines in the specGen.process function.
"""
import math
import numpy... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import binascii
from cryptography.hazmat.backends import default... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2022 Andriel Ferreira <https://github.com/AndrielFR>
from typing import List, Tuple
from . import conn
async def get_all_words() -> List[Tuple]:
cursor = await conn.execute("SELECT * FROM words")
rows = await cursor.fetchall()
await cursor.close()
retur... |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import unittest
import sys
import itertools
import logging
import tempfile
import codecs
import os
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
from streamsx.topology.context import ConfigParams
imp... |
from string import Template
import pytest
import unipixel
from . import resources
from . import utils
def test_fill(test_strip, capsys):
test_strip, params = test_strip
if params["pixel_order"] == unipixel.RGB:
test_data = zip(resources.RGB, resources.RGB)
elif params["pixel_order"] == unipix... |
import sys
import traceback
from titration.utils import analysis, constants, interfaces, routines
def run():
"""Main driver for the program. Initializes components and queries the user for next steps"""
try:
# initialize components
initialize_components()
# output prompt to LCD scree... |
# Lint as: python3
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
#
# Copyright (c) 2017. EPAM Systems
#
# 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 writi... |
"""
See https://bittrex.com/Home/Api
"""
import time
import hmac
import hashlib
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
try:
from Crypto.Cipher import AES
except ImportError:
encrypted = False
else:
import getpass
import ast
import json
... |
#!/usr/bin/env python
"""
Evaluation of local planning performance
"""
import rospy
import time
import math
import carla
import atexit
from nav_msgs.msg import Odometry
from nav_msgs.msg import Path
from geometry_msgs.msg import PoseStamped
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point
f... |
"""
LogClient class is the main class in the SDK. It can be used to communicate with
log service server to put/get data.
:Author: Aliyun
"""
import json
import requests
import six
import time
import zlib
from datetime import datetime
import logging
import locale
from itertools import cycle
from .acl_r... |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
import pytest
## PYTEST
from ch02_math.solutions.ex12_primefactors import calc_prime_factors, calc_prime_factors_optimized
def value_and_prime_factors():
return [(8, [2, 2, 2]),
(14, [2, 7]),
(42, [2, ... |
import numpy as np
import pytest
from napari._tests.utils import check_layer_world_data_extent
from napari.layers import Labels
from napari.layers.labels._labels_constants import LabelColorMode
from napari.utils import Colormap
def test_random_labels():
"""Test instantiating Labels layer with random 2D data."""
... |
import os.path
from jinja2 import FileSystemLoader
from jinja2.environment import Environment
class BaseObject(object):
@property
def version(self):
try:
with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as fin:
return fin.readline().strip()
except:
... |
from lib.logger import get_logger
from collections import OrderedDict
from tasks.hierarchy import DenormalizedHierarchy, GetParentsFunction, \
Hierarchy, HierarchyInfoUnion, HierarchyChildParentsUnion, \
HierarchyChildParent, LevelHierarchy, LevelInfo
from tasks.uk.cdrc import OutputAreas
from tasks.uk.census.o... |
# pylint: disable=undefined-variable
from .aiida import *
__all__ = aiida.__all__ # noqa
|
# Copyright 2014 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 ... |
numeros = [17, 24, 7, 39, 8, 51, 92]
print(list(filter(lambda x: x % 2 == 0, numeros)))
|
# Copyright 2016 Nokia
#
# 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... |
# -*- coding: utf-8 -*-
"""
Tests for the vim modeline feature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments import modeline
def test_modelines():
for buf in [
'vi: ft=py... |
import sys
from fractions import Fraction
from math import ceil
from typing import cast, List, Optional, Sequence
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol # pragma: no cover
class Edge(Protocol):
"""Any object that defines an edge (such as L... |
from django.urls import path
from .views import PostAPIView, PostAPIDetailView
urlpatterns = [
path('', PostAPIDetailView.as_view(), name='api_detail'),
path('<int:pk>', PostAPIView.as_view(), name='list'),
] |
"""
A data class representing a conan remote
"""
from dataclasses import dataclass
import deserialize
@dataclass
@deserialize.default("verify_ssl", True)
@deserialize.default("priority", 0)
@deserialize.default("force", False)
@deserialize.default("login", False)
class Remote:
name: str
url: str
verify_s... |
"""
wagtail.core.models is split into submodules for maintainability. All definitions intended as
public should be imported here (with 'noqa' comments as required) and outside code should continue
to import them from wagtail.core.models (e.g. `from wagtail.core.models import Site`, not
`from wagtail.core.models.sites i... |
from __future__ import absolute_import
import itertools
import logging
import random
import time
from django.utils.encoding import force_bytes
logger = logging.getLogger(__name__)
class RetryException(Exception):
def __init__(self, message, exception):
self.message = message
self.exception = e... |
import tensorflow as tf
import os
W = tf.Variable(tf.zeros([4,3]), name="weights")
b = tf.Variable(tf.zeros([3]), name="bias")
def combine_inputs(x):
return tf.matmul(x, W), b
def inference(x):
return tf.nn.softmax(combine_inputs(x))
def loss(x, y):
return tf.reduce_mean(tf.nn.sparse_softmax_cross_entr... |
import torch
import numpy as np
class DepthGTLoss(torch.nn.Module):
"""
A simple L1 loss, but restricted to the cropped center of the image.
It also does not count pixels outside of a given range of values (in target).
Additionally, there is also an L1 loss on the gradient.
"""
def __init__(se... |
import pickle
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from main import clf
def test_accuracy():
# Load test data
with open("data/test_data.pkl", "rb") as file:
test_data = pickle.load(file)
# Unpack the tuple
X_test, y_test = test_data
# Co... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# Ejercicio 1
def sumArray1(array): #* Solución 1
# Escribir una función que tenga como parámetro de entrada un array y retorne la suma de los mismos
return sum(array)
def sumArray2(array): #* Solución 2
# Escribir una función que tenga como parámetro de entrada un array y retorne la suma de los mism... |
sentence = "This is the sentence."
print(sentence)
print(sentence)
sentence = "This is another sentence."
print(sentence) |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_pavillion_1_static_deed.iff"
result.attribut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.