text stringlengths 2 999k |
|---|
"""
FieldOverride that forces Show Answer values that use Past Due logic to
new Show Answer values that remove the Past Due check (keeping the rest intact)
"""
from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.cap... |
import unittest
'''
the file in /tests/homework/b_in_proc_out/tests_in_proc_out
has the test functions
'''
from tests.homework.e_functions import tests_functions
suite = unittest.TestLoader().loadTestsFromModule(tests_functions)
unittest.TextTestRunner(verbosity=2).run(suite)
|
localStartText = """
Welcome to debug terminal, if you have problem with script - type helpdebug to see commands.
Goodluck, User!
"""
def startTerminalText():
print(localStartText) |
import matplotlib.pyplot as plt
from colored import fg, attr
from dictionary import Dictionary
from utils import *
from experiments import getTimes, getComps
DATADIR = './data/'
FULL_COMB_SEARCH = 1
BIN_SEARCH = 2
SEGM_SEARCH = 3
def printInfo():
print("Сравнение алгоритмов поиска в словаре")
def printAuthor... |
import json
from django.http import HttpResponseBadRequest, JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.base import View
from telegram import Update
from .handler import bot, dispatcher
class UpdateHandler(View):
... |
from abc import ABC, abstractmethod
from collections import defaultdict, deque
from enum import Enum
import asyncio
import copy
import datetime
import httpx
import inspect
import json
import logging
import tda
import urllib.parse
import websockets.legacy.client as ws_client
from websockets.extensions.permessage_defla... |
# Copyright 2021 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
from customSearchEngine import CustomSearchEngine
from cryptoConverter import CryptoConverter
from stockInfo import StockInfo
import dataContainers
import globalSettings
import datetime
import random
import logging
_logger = logging.getLogger()
#This class is mainly a way to keep the code clean
#So any functions req... |
# Copyright 2019 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 agreed to in writing, ... |
class Question():
def __init__(self, text, answer):
self.text = text
self.answer = answer
|
from donations.forms import DonationForm
class FixedDonationForm(DonationForm):
amounts = [1, 5, 10, 10000]
|
import os
import numpy as np
import psutil
def calculate_ETA(last_epoch_times, current_iteration, max_iterations):
"""Calculates remaining training time in seconds
Args:
last_epoch_times (list/deque): Running time of last epochs
current_iteration (int): current iteration number
max_i... |
import yt
import trident
import numpy as np
import pandas as pd
from spectacle.fitting import LineFinder1D
from numpy.linalg import norm
import astropy.units as u
from astropy.table import QTable
from yt.data_objects.static_output import \
Dataset
from salsa.utils.functions import ion_p_num
from salsa.utils.def... |
from random import randint
from core.Planificador import Planificador
from math import ceil
class RoundRobin(Planificador):
def __init__(self,log,quantum,procesos):
Planificador.__init__(self,log,quantum,procesos)
def iniciar_planificador(self):
self.mostrar_procesos()
self.planific... |
from .start import StartScreen as start
from .about import AboutScreen as about
from .loading import LoadingScreen as loading
from .auth import AuthScreen as auth
from .two_factor import TwoFactorScreen as two_factor
from .captcha import CaptchaScreen as captcha
from .game import GameScreen as game
from .game im... |
# -*- coding: utf-8 -*-
from typing import Dict, Text, Any, List, Union
import json
from datetime import date
from datetime import datetime
from rasa_core_sdk import ActionExecutionRejection, Action
from rasa_core_sdk import Tracker
from rasa_core_sdk.events import SlotSet
from rasa_core_sdk.executor import Collect... |
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Mixed bag of utilities."""
import binascii
import datetime
import functools
import hashlib
import inspect
import json
import logging
import os... |
#!/usr/bin/env python
#
# wandbox-compilerlist-diff.py
#
import sys
if __name__ == '__main__':
lastfile = 'last.txt'
listfile = 'wandbox-compilers.txt'
if len(sys.argv) > 2:
lastfile = sys.argv[1]
listfile = sys.argv[2]
old_list = []
new_list = []
with open(lastfile) as fp:
... |
from ui import View,Label,delay
from keyboard import get_input_context,set_view,get_selected_text
from math import *
# Python accessible eval from pythonista's PyKeys
class Out_View(View):
def __init__(self):
# Grap all the methods of View
super().__init__(self)
# Label for outputs
self.label=Label(frame=self... |
from pytest import fixture
from can import Message
from uds.transmission_attributes import TransmissionDirection, AddressingType
from uds.can import CanAddressingFormat
from uds.segmentation import CanSegmenter
# Common
@fixture(params=[(0x00, 0xFF, 0xAA, 0x55), [0x00], (0xFF, ), [0x12, 0xFF, 0xE0, 0x1D, 0xC2, 0x... |
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from gamestonk_terminal.cryptocurrency.discovery import dappradar_view
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
}
@pytest.mark.vcr
@pytest.mark.record_st... |
'''IOSXR implementation for shutnoshut triggers'''
# import python
import logging
# import pyats
from pyats import aetest
# Genie Libs
from genie.libs.sdk.libs.utils.mapping import Mapping
from genie.libs.sdk.triggers.shutnoshut.shutnoshut import \
TriggerShutNoShut as CommonShutNoShut
from p... |
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from typing import List, Optional
from xdrlib import Packer, Unpacker
from .claim_predicate_type import ClaimPredicateType
from .int64 import Int64
from ..exceptions import ValueError
__all__ = ["ClaimPredicate"]... |
"""Test cases for datahandling."""
import unittest
import torch
from dfadetect.datasets import AudioDataset
from dfadetect.utils import find_wav_files
from tests.utils import REAL_PATH, load_real, load_special
class TestAudioDataset(unittest.TestCase):
def test_loading_audio(self):
dataset = load_real(... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import importlib
import os
from .fairseq_decoder import FairseqDecoder
from .fairseq_encoder import FairseqEncoder
from .fair... |
# Stdlib
import inspect
# Sayonika Internals
from framework.objects import logger
from framework.route import Route
from framework.sayonika import Sayonika
__all__ = ("RouteCog",)
class RouteCog:
"""
Similar to a discord.py cog, this holds several routes with unified concept
"""
def __init__(self, ... |
# Sync content of this file with devtools/ya/core/error/__init__.py
TEMPORARY_ERROR_MESSAGES = [
'Connection reset by peer',
'Connection timed out',
'Function not implemented',
'I/O operation on closed file',
'Internal Server Error',
'Network connection closed unexpectedly',
'Network is unr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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... |
#!/usr/bin/env python
# pylint: disable=C0116,W0613
# This program is dedicated to the public domain under the CC0 license.
"""
Simple Bot to reply to Telegram messages.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the b... |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import date
from corehq.apps.userreports.specs import EvaluationContext
from custom.intrahealth.tests.utils import TestDataSourceExpressions
LOGISTICIEN_DATA_SOURCE = 'yeksi_naa_reports_logisticien.json'
class TestLogistici... |
import os
from pathlib import Path
import pytest
from flair.data import Corpus, Token
from flair.models import SequenceTagger
from ner_sample.models.flair_ner import FlairNERModel
from tests.mocks import MockDataLoader
def test_flair_inference_ner_mock_data(pretrained_model, dataset_loader):
_, test = dataset_l... |
import os
import json
import random as rn
class Process_pr:
def __init__(self, pr_number, pr_author):
self.__pr_number = pr_number
self.__pr_author = pr_author
def author(self):
return self.__pr_author
def pr_number(self):
return self.__pr_number
def command(self, cm... |
api = "https://api.telegram.org/bot"
class Config(object):
def __init__(self):
pass
def load_settings(self, settings):
self.commands = settings['commands']
self.timeout = settings['timeout']
self.interval = settings['interval']
self.uri = api + settings['token']
conf... |
import numpy as np
from agents import DiffAgentBase
class DiffAgent(DiffAgentBase.DiffAgentBase):
def prediction(self, observation):
self.diff = []
self.noise_reduction = []
for dimension in self.space.spaces:
self.diff.append(np.random.randint(0, dimension.n))
se... |
"""
evoke app server script
this is for serving a single app
"""
import os
import sys
# Set the encoding to utf-8
reload(sys) # needed to expose setdefaultencoding
sys.setdefaultencoding('utf-8')
# fix the path
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(1, os.path.abspath('../..'))
from twisted.app... |
from ..DiffusionModel import DiffusionModel
import numpy as np
__author__ = "Alina Sirbu"
__email__ = "alina.sirbu@unipi.it"
class MajorityRuleModel(DiffusionModel):
"""
"""
def __init__(self, graph):
"""
Model Constructor
:param graph: A networkx graph object
... |
# from attendees.persons.models import Relationship
class FolkService:
@staticmethod
def destroy_with_associations(folk, attendee):
"""
No permission check.
if family have more than one FamilyAttendees:
only delete the FamilyAttendees, and reset non-blood Relationships. Pl... |
from dataclasses import asdict
from typing import List, Optional, Union
import requests
from ...auth.models import Session
from ...common import *
from ...exceptions import *
from .models import AuctionEntry, KubrowAuction, LichAuction, RivenAuction
__all__ = [
"create_auction",
# "get_item",
]
def create_... |
import subprocess
import sys
tagger = subprocess.Popen(
'java -Xmx500m -jar ark-tweet-nlp/target/bin/ark-tweet-nlp-0.3.2.jar --decoder viterbi --output-format conll --model model.20120919',
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
for line in open(sys.argv[1]):
tagger.stdin.write... |
import math
#Class for Popularity based Recommender System model
class popularity_recommender_py():
def __init__(self):
self.train_data = None
self.user_id = None
self.popularity_recommendations = None
def smooth_user_preference(self, x):
return math.log(1 + x, 2)
#Create ... |
# optimizer
optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[8, 11])
total_epochs = 12
|
#!/usr/bin/env python
#coding:utf-8
import sys
import os
import glob
import platform
import re
import random
import string
print('''
--------------------------------
TeamViewer ID Changer for MAC OS
--------------------------------
''')
if platform.system() != 'Darwin':
print('This script can be run only on MAC ... |
#coding:utf-8
# 1.Hello World!
print('Hello World!')
# 2.数学求和
num1 = input('输入第一个数字:')
num2 = input('输入第二个数字:')
sum1 = float(num1) + float(num2)
print('数字 {0} 和 {1} 相加结果为: {2}'.format(num1, num2, sum1))
# 3.平方根
num3 = float(input('请输入一个数字:'))
num3_sqrt = num3 ** 0.5
print('%0.3f 的平方根为 %0.3f'%(num3, num3_sqrt))
# 计算... |
version_info = (0, 2, 1)
# format:
# ('spinup_major', 'spinup_minor', 'spinup_patch')
def get_version():
"Returns the version as a human-format string."
return "%d.%d.%d" % version_info
__version__ = get_version()
|
"""
This file offers the methods to automatically retrieve the graph Lysobacter tolerans.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein as... |
# coding: utf-8
from otcbtc_client.base import OTCBTCAPIBase
class TestBase(object):
@property
def base(self):
return OTCBTCAPIBase(api_key='xxx', api_secret='yyy')
def test_build_payload(self):
base = self.base
assert base.build_payload('GET', '/api/v2/users/me', dict(access_key... |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.37
工具: python == 3.7.3
"""
"""
思路:
用栈,把 k 个数压入栈中,然后弹出来的顺序就是翻转的
注意:
第一,剩下的链表个数够不够 k 个(因为不够 k 个不用翻转)
第二,已经翻转的部分要与剩下链表连接起来
链接:
https://leetcode-cn.com/problems/reverse-nodes-in-k-group/solution/kge-yi-zu-fan-zhuan-... |
9999999999999999 |
import inspect
from typing import Any, Dict, List, Type
from duck_orm.model import Model
from duck_orm.sql.fields import Column, ActionsEnum
from duck_orm.sql.condition import Condition
from duck_orm.utils.functions import get_dialect
class ForeignKey(Column):
def __new__(cls, **kwargs):
return super()._... |
from abaqusConstants import *
from ..Part.PartBase import PartBase
class RegionPartBase(PartBase):
"""The following commands operate on Part objects. For more information about the Part
object, see Part object.
Notes
-----
This object can be accessed by:
.. code-block:: python
... |
from get_objects import get_objects
fields = {
"whitelist": ["^name$", "^tags$", "^color$", "^comments$"],
"blacklist": ["uid"],
"translate": [
# (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
]
}
if __name__ == "__main__":
get_object... |
# Copyright 2014 Big Switch Networks, 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... |
from django.apps import AppConfig
class NewsDigestConfig(AppConfig):
name = "zzr_mailer.news_digest"
verbose_name = "Новостной дайджест"
verbose_name_plural = "Новостные дайджесты"
|
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
# Copyright 2010-2011 OpenStack Foundation
# 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... |
#!/usr/bin/env python3
# Copyright (c) 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 dclrcoind aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delete th... |
from connection import Connection
import viewer.page
def general_information(url: str) -> dict:
con = Connection()
soup = con.get(url).soup
return {
'Imslp Link': url,
'Genre Categories': viewer.page.genre_categories(soup),
'Work Title': viewer.page.work_title(soup),
'Name ... |
"""
Copyright (C) 2016, Blackboard Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis... |
from os import system, name
def clear():
if name == 'nt':
_ = system('cls')
clear()
class Dog():
species = 'mammal'
def __init__(self, breed, name, spots):
self.breed = breed
self.name = name
self.spots = spots
def bark(self):
print('Woof! My name... |
import copy
from dlgo.gotypes import Player, Point
from dlgo.scoring import compute_game_result
from dlgo import zobrist
from dlgo.utils import MoveAge
__all__ = [
'Board',
'GameState',
'Move',
]
neighbor_tables = {}
corner_tables = {}
def init_neighbor_table(dim):
rows, cols = dim
new_table = {... |
class HashableList(object):
"""
A structure that stores a list of str()-able items,
but can also be used as a key in a dict.
This is not a very good general purpose data structure.
It has a very specific use in DetailsCompatibilityChecker.
"""
def __init__(self, delimiter=","):
self... |
"""
With these settings, tests run faster.
"""
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = False
# https://docs.djangoproject.com/en/dev/ref/settings/#se... |
# Big O complexity
# O(log2(n))
# works only on sorted array
# recursive
def binary_search_recursive(arr, arg, left, right):
if right >= left:
middle = left + (right - left) // 2
if arr[middle] == arg:
return middle
elif arr[middle] > arg:
return binary_search_recu... |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='size',
parent_name='scatterpolar.marker.colorbar.titlefont',
**kwargs
):
super(SizeValidator, self).__init__(
plotly_name... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: filter_condition_group.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goog... |
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.otpbase import OTPGlobals
from otp.friends.PlayerFriendsManager import PlayerFriendsManager
from pirates.friends.PCFriendPlayerInfo import PCFriendPlayerInfo
class PCP... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-19 11:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
("peeringdb_server", "0018_set_ixf_ixp_import_enabled"),
... |
import heapq
class Solution(object):
def smallestDistancePair(self, nums, k):
h=[]
d = {}
for n in nums:
if n not in d:
d[n] = 0
d[n] += 1
for n in d:
if d[n] > 1:
cnt = ((d[n]*d[n]-1)/2)
if cnt >= k:... |
from pathlib import Path
import tarfile
import requests
from rich import print as rprint
from bg_atlasapi import utils, config, core, descriptors
COMPRESSED_FILENAME = "atlas.tar.gz"
def _version_tuple_from_str(version_str):
return tuple([int(n) for n in version_str.split(".")])
def _version_str_from_tuple(... |
import spikeextractors as si
import os
import time
import numpy as np
from os.path import join
from subprocess import Popen, PIPE
import shlex
def spyking_circus(
recording,
output_folder=None, # Temporary working directory
probe_file=None,
file_name=None,
detect_sign=-1, # -... |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# Code Reference: (https://github.com/dolphin-zs/Doc2EDAG)
import logging
import os
import re
from collections import defaultdict, Counter
import numpy as np
import torch
from .dee_metric import measure_event_table_filling
from .event_type import event_type2event_class, BaseEvent, event_type_fields_list, common_field... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2015-2016, Hewlett Packard Enterprise Development Company LP
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = '''
---
module: baremetal_inspect
short_description: Explicitly triggers baremetal node introspection in... |
from .model import TreeNode
"""
Space : O(n)
Time : O(n)
"""
class Solution:
def preorder(self, root: TreeNode) -> List[int]:
s = []
if root:
s.append(root.val)
s += self.preorder(root.left)
s += self.preorder(root.right)
else:
return ... |
from ..constants import *
from ..utils import error
from .tcp_file_receiver import TCPFileReceiver
from .tcp_message_receiver import TCPMessageReceiver
from .udp_file_receiver import UDPFileReceiver
from .udp_message_receiver import UDPMessageReceiver
class Receiver:
@staticmethod
def get_receiver(port=PORT, ... |
import numpy as np
from scipy.ndimage import gaussian_filter, convolve
def local_structure_tensor(img: np.ndarray,
si: float = 0.8,
so: float = 1.6,
slope_method: str = 'eigen',
grad_method: str = None,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import defaultdict
from operator import itemgetter
import argparse
import os
import sys
# google-api-python-client dependencies
import apiclient.discovery
import googleapiclient.errors
import httplib2
import oauth2cl... |
import os
import pytest
from vcr import VCR
from sentry_youtrack.youtrack import YouTrackClient
PROJECT_ID = 'myproject'
vcr = VCR(path_transformer=VCR.ensure_suffix('.yaml'),
cassette_library_dir=os.path.join('tests', 'cassettes'))
@pytest.fixture
def youtrack_client():
with vcr.use_cassette('yout... |
# -*- coding: utf-8 -*-
# WPA2-Enterprise tests
# Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import base64
import binascii
import time
import subprocess
import logging
logger = logging.getLogger()
import os
i... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HER... |
from server.data_access_layer.abstract_classes.options_info_dao import OptionsInfoDAO
from server.custom_exceptions.option_not_found import OptionNotFound
from server.entities.option import Option
from yahoo_fin import options
from yahoo_fin import stock_info
import pandas
stock_not_found = "Your stock was not able ... |
from django.test import TestCase
from tests.test_app.models import ExampleModel
class ModelTest(TestCase):
def setUp(self) -> None:
super().setUp()
# =======================================================================
# ./manage.py test tests.test_app.tests.test_models.ModelTest --settings=... |
from django.contrib import admin
from .models import database, doc_DB, Report
from import_export.admin import ImportExportModelAdmin
from django.contrib import admin
class ReportAdmin(admin.ModelAdmin):
readonly_fields = ('created',)
class databaseAdmin(ImportExportModelAdmin, admin.ModelAdmin):
pass
class doc... |
# soultion reference:
# http://stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal
import collections
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
s_list = list(s)
t_list = list(t)
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 22 12:22:46 2019
@author: KY-Coffee
"""
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
def plot_KMeans(k_data,n=14, title="", margins=True):
model = KMeans(n)
model.fit(k_data[0])
y_kmeans = model.predict(k_data[0])
plt.figure(fi... |
from django.db import models
from django_pandas.managers import DataFrameManager
# Create your models here.
class Promoters154CellsBinarized(models.Model):
index = models.TextField(blank=True, primary_key=True) # Auto-generated had: , null=True
adipocyte_breast = models.BigIntegerField(db_column='Adipocyte -... |
from typing import List
from cucco import Cucco
from fastpunct import FastPunct
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
class PunctuationWithRules(SentenceOperation):
"""
This class offers method for punctuation restoration and to transform the text ba... |
# -*- coding: utf-8 -*-
def isURL(url):
if not url or not isStr(url): return False
try:
r=urlparse(urljoin(url, '/'))
return r.scheme and r.netloc and r.path and ('.' in r.netloc)
except Exception:
return False
def cropURL(t):
if(t[:7]=='http://'): t=t[7:]
if(t[:8]=='https://'): t=t[8... |
# Copyright 2015 IBM Corp.
#
# 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, s... |
# -*- coding: utf-8 -*-
"""
----------Phenix Labs----------
Created on Sun Jan 24 00:45:47 2021
@author: Gyan Krishna
Topic:
"""
def fact(n):
if(n == 0):
return 1;
else:
return fact(n-1)*n
n = int(input("enter x :: "))
x = int(input("enter n :: "))
sign = 1
p = 1
sum = 0
for i in range(n)... |
from verifier_base import Verifier
class Verifier1(Verifier):
def __init__(self, id, iota_host, seed, push=False):
super(Verifier1, self).__init__(id, iota_host, seed, push)
def verification(self, topic, value):
# Write any logic here to verify value for topic.
# What is returned from... |
import operator
import numpy as np
from VC import VCModule
from time import sleep
class AIModule():
vc = None
def __init__(self):
print("init aimodule")
self.vc = VCModule()
#################################################################################
# MÉTODOS PÚBLICO
###########... |
#appModules/instantbird.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2013 NV Access Limited
"""App module for Instantbird
"""
import appModuleHandler
import NVDAObjects.IAccessible.mozilla
import controlTy... |
# encoding: utf-8
# module cython_runtime
# from C:\Python27\lib\site-packages\pandas\io\msgpack\_packer.pyd
# by generator 1.147
# no doc
# no imports
# no functions
# no classes
|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'YerSorguu2.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, Q... |
from joerd.mkdir_p import mkdir_p
from joerd.plugin import plugin
from os import link
from contextlib2 import contextmanager
import os.path
class CacheStore(object):
"""
Every tile that gets generated requires ETOPO1. And most require a GMTED
tile, which are pretty large and cover much of the world. Rathe... |
import pytest
import numpy as np
from dizoo.classic_control.cartpole.envs import CartPoleEnv
@pytest.mark.unittest
class TestCartPoleEnv:
def test_naive(self):
env = CartPoleEnv({})
env.seed(314, dynamic_seed=False)
assert env._seed == 314
obs = env.reset()
assert obs.shap... |
# Copyright (c) 2021, 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 required by appli... |
# Copyright 2021 Sony Semiconductors Israel, 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.