content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
from .alaska_temperature import AlaskaTemperature from .bmi import AlaskaTemperatureBMI __all__ = ["AlaskaTemperature", "AlaskaTemperatureBMI"]
[ 6738, 764, 282, 8480, 62, 11498, 21069, 1330, 12926, 42492, 198, 6738, 764, 65, 11632, 1330, 12926, 42492, 33, 8895, 628, 198, 834, 439, 834, 796, 14631, 2348, 8480, 42492, 1600, 366, 2348, 8480, 42492, 33, 8895, 8973, 198 ]
3.74359
39
import re t = int(input()) for i in range(0, t): chars = input() m1, m2 = [None] * len(chars), [None] * len(chars) for j in range(0, len(chars)): m1[j] = "3" if chars[j] == "4" else chars[j] m2[j] = "1" if chars[j] == "4" else "0" s1 = ''.join(m1) s2 = ''.join(m2) print("Case #{}: {} {}".format(i + 1, s1, re.sub(r'^0*', '', s2)))
[ 11748, 302, 198, 198, 83, 796, 493, 7, 15414, 28955, 220, 198, 1640, 1312, 287, 2837, 7, 15, 11, 256, 2599, 198, 220, 220, 220, 34534, 796, 5128, 3419, 198, 220, 220, 220, 285, 16, 11, 285, 17, 796, 685, 14202, 60, 1635, 18896, ...
1.843902
205
#!/usr/bin/env python # coding: utf-8 # Scraper movies data from Imdb # In[ ]: import csv import pandas as pd # Year range to collect data. # In[ ]: startYear=int(input("startYear: ")) finishYear=int(input("finishYear: ")) # File path to save. Ex: C:\Users\User\Desktop\newFile # In[ ]: filePath = input("File path: "+"r'")+("/") # Create csv and set the titles. # In[ ]: with open(filePath+str(startYear)+"_"+str(finishYear)+".csv", mode='w', newline='') as yeni_dosya: yeni_yazici = csv.writer(yeni_dosya, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) yeni_yazici.writerow(['Title'+";"+'Film'+";"+'Year']) yeni_dosya.close() # Download title.basics.tsv.gz from https://datasets.imdbws.com/. Extract data.tsv, print it into csv. # In[ ]: with open("data.tsv",encoding="utf8") as tsvfile: tsvreader = csv.reader(tsvfile, delimiter="\t") for line in tsvreader: try: ceviri=int(line[5]) if(ceviri>=startYear and ceviri<=finishYear and (line[1]=="movie" or line[1]=="tvMovie")): print(line[0]+";"+line[3]+";"+line[5]+";"+line[1]) line0=line[0].replace("\"","") line5=line[5].replace("\"","") with open(filePath+str(startYear)+"_"+str(finishYear)+".csv", mode='a', newline='') as yeni_dosya: yeni_yazici = csv.writer(yeni_dosya, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) yeni_yazici.writerow([line0+";"+line[3]+";"+line5]) yeni_dosya.close() except: pass
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 2, 1446, 38545, 6918, 1366, 422, 1846, 9945, 198, 198, 2, 554, 58, 2361, 25, 628, 198, 11748, 269, 21370, 198, 11748, 19798, 292, 355, 279...
1.993939
825
""" @author: magician @file: descriptor_demo.py @date: 2020/1/14 """ from weakref import WeakKeyDictionary # class Exam(object): # """ # Exam # """ # def __init__(self): # self._writing_grade = 0 # self._math_grade = 0 # # @staticmethod # def _check_grade(value): # if not(0 <= value <= 100): # raise ValueError('Grade must be between 0 and 100') # # @property # def writing_grade(self): # return self._writing_grade # # @writing_grade.setter # def writing_grade(self, value): # self._check_grade(value) # self._writing_grade = value # # @property # def math_grade(self): # return self._math_grade # # @math_grade.setter # def math_grade(self, value): # self._check_grade(value) # self._math_grade = value if __name__ == '__main__': galileo = Homework() galileo.grade = 95 # first_exam = Exam() # first_exam.writing_grade = 82 # first_exam.science_grade = 99 # print('Writing', first_exam.writing_grade) # print('Science', first_exam.science_grade) # # second_exam = Exam() # second_exam.writing_grade = 75 # second_exam.science_grade = 99 # print('Second', second_exam.writing_grade, 'is right') # print('First', first_exam.writing_grade, 'is wrong') first_exam = Exam() first_exam.writing_grade = 82 second_exam = Exam() second_exam.writing_grade = 75 print('First ', first_exam.writing_grade, 'is right') print('Second ', second_exam.writing_grade, 'is right')
[ 37811, 198, 31, 9800, 25, 42055, 198, 31, 7753, 25, 220, 220, 43087, 62, 9536, 78, 13, 9078, 198, 31, 4475, 25, 220, 220, 12131, 14, 16, 14, 1415, 198, 37811, 198, 6738, 4939, 5420, 1330, 28788, 9218, 35, 14188, 628, 198, 198, 2, ...
2.302023
692
import torch import numpy as np import torch.nn.functional as F def masked_softmax(x, m=None, axis=-1): ''' x: batch x time x hid m: batch x time (optional) ''' x = torch.clamp(x, min=-15.0, max=15.0) if m is not None: m = m.float() x = x * m e_x = torch.exp(x - torch.max(x, dim=axis, keepdim=True)[0]) if m is not None: e_x = e_x * m softmax = e_x / (torch.sum(e_x, dim=axis, keepdim=True) + 1e-6) return softmax
[ 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 628, 198, 4299, 29229, 62, 4215, 9806, 7, 87, 11, 285, 28, 14202, 11, 16488, 10779, 16, 2599, 198, 220, 220, 220, 705, 7061, 198, 2...
2.059829
234
# -*- coding: utf-8 -*- """ create on 2019-03-20 04:17 author @lilia """ from sklearn.neighbors import KNeighborsClassifier from analysis_llt.ml.cv.base import BaseCV
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 17953, 319, 13130, 12, 3070, 12, 1238, 8702, 25, 1558, 198, 198, 9800, 2488, 75, 17517, 198, 37811, 198, 6738, 1341, 35720, 13, 710, 394, 32289, 1330, 509, ...
2.615385
65
import threading from zds_client.oas import schema_fetcher
[ 11748, 4704, 278, 198, 198, 6738, 1976, 9310, 62, 16366, 13, 78, 292, 1330, 32815, 62, 34045, 2044, 628, 628 ]
3.15
20
""" Display tools for TTrees. """ from __future__ import annotations import dataclasses import functools from pathlib import Path from typing import Any, Dict import uproot from rich.console import Console from rich.markup import escape from rich.text import Text from rich.tree import Tree console = Console() __all__ = ("make_tree", "process_item", "print_tree", "UprootItem", "console") def make_tree(node: UprootItem, *, tree: Tree | None = None) -> Tree: """ Given an object, build a rich.tree.Tree output. """ if tree is None: tree = Tree(**node.meta()) else: tree = tree.add(**node.meta()) for child in node.children: make_tree(child, tree=tree) return tree # pylint: disable-next=redefined-outer-name def print_tree(entry: str, *, console: Console = console) -> None: """ Prints a tree given a specification string. Currently, that must be a single filename. Colons are not allowed currently in the filename. """ upfile = uproot.open(entry) tree = make_tree(UprootItem("/", upfile)) console.print(tree)
[ 37811, 198, 23114, 4899, 329, 26653, 6037, 13, 198, 37811, 198, 198, 6738, 11593, 37443, 834, 1330, 37647, 198, 198, 11748, 4818, 330, 28958, 198, 11748, 1257, 310, 10141, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 19720, 1330, 4377, ...
2.878238
386
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from apps.core.models import BaseModel from apps.core.utils import HASH_MAX_LENGTH, create_hash, truncate from django.utils.encoding import python_2_unicode_compatible from django.utils import timezone from django.db.models import F import datetime TODO = 'TODO' DOING = 'DOING' BLOCKED = 'BLOCKED' DONE = 'DONE' PROGRESS = ( (TODO, 'To Do'), (DOING, 'Doing'), (BLOCKED, 'Blocked'), (DONE, 'Done'), ) # method for updating
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 13, 12683, 874, 1330, 1281, 62, 21928, 198, 6738, 42625, 14208, 13, 6381,...
2.811321
212
# Copyright 2019 Elasticsearch BV # # 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 the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # File called _pytest for PyCharm compatability import numpy as np from pandas.util.testing import assert_almost_equal from eland.tests.common import TestData
[ 2, 220, 15069, 13130, 48567, 12947, 347, 53, 198, 2, 198, 2, 220, 220, 220, 220, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 220, 220, 220, 220, 220, 345, 743, 407, 779, 428, ...
3.246914
243
# Copyright 2021 Roots # # 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 the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration from launch_ros.actions import ComposableNodeContainer from launch_ros.actions import PushRosNamespace from launch_ros.descriptions import ComposableNode
[ 2, 15069, 33448, 34341, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257...
4.056338
213
import logging from sqlalchemy import create_engine, event from configuration import config as cnf from helpers.DbHelper import on_connect, db_session, assert_database_type from models import Base, Flow # from models.depreciated import Metric logging.basicConfig() logging.getLogger('sqlalchemy.engine').setLevel(logging.ERROR)
[ 11748, 18931, 198, 198, 6738, 44161, 282, 26599, 1330, 2251, 62, 18392, 11, 1785, 198, 198, 6738, 8398, 1330, 4566, 355, 269, 77, 69, 198, 6738, 49385, 13, 43832, 47429, 1330, 319, 62, 8443, 11, 20613, 62, 29891, 11, 6818, 62, 48806, ...
3.553191
94
from tests.utils import W3CTestCase
[ 6738, 5254, 13, 26791, 1330, 370, 18, 4177, 395, 20448, 628 ]
3.363636
11
# AARD: function: __main__ # AARD: #1:1 -> :: defs: %1 / uses: [@1 4:1-4:22] { call } 'value: {}'.format(3) # AARD: @1 = constant_attribute.py
[ 2, 317, 9795, 25, 2163, 25, 11593, 12417, 834, 198, 198, 2, 317, 9795, 25, 1303, 16, 25, 16, 4613, 220, 220, 7904, 220, 825, 82, 25, 4064, 16, 1220, 3544, 25, 220, 685, 31, 16, 604, 25, 16, 12, 19, 25, 1828, 60, 220, 1391, 8...
2.054795
73
from tensorflow.python.keras.layers import Layer from tensorflow.python.keras import backend as K
[ 6738, 11192, 273, 11125, 13, 29412, 13, 6122, 292, 13, 75, 6962, 1330, 34398, 198, 6738, 11192, 273, 11125, 13, 29412, 13, 6122, 292, 1330, 30203, 355, 509, 628 ]
3.413793
29
from typing import Container from asts.typed import Name as TypedName from asts import base, visitor, types_ as types PREDEFINED_TYPES: Container[str] = ( ",", "->", "Bool", "Float", "Int", "List", "String", "Unit", ) def resolve_type_vars( node: base.ASTNode, defined_types: Container[str] = PREDEFINED_TYPES, ) -> base.ASTNode: """ Convert `TypeName`s in the AST to `TypeVar`s using `defined_types` to determine which ones should be converted. Parameters ---------- node: ASTNode The AST where `TypeName`s will be searched for. defined_types: Container[str] = PREDEFINED_TYPES If a `TypeName` is inside this, it will remain a `TypeName`. Returns ------- ASTNode The AST but with the appropriate `TypeName`s converted to `TypeVar`s. """ resolver = TypeVarResolver(defined_types) return resolver.run(node)
[ 6738, 19720, 1330, 43101, 198, 198, 6738, 257, 6448, 13, 774, 9124, 1330, 6530, 355, 17134, 276, 5376, 198, 6738, 257, 6448, 1330, 2779, 11, 21493, 11, 3858, 62, 355, 3858, 198, 198, 4805, 1961, 36, 20032, 1961, 62, 9936, 47, 1546, ...
2.498667
375
# -*- coding: utf-8 -*- """ cdist-plugin implementation. Author: Andrea Cervesato <andrea.cervesato@mailbox.org> """ import pytest from cdist import __version__ from cdist.redis import RedisResource from cdist.resource import ResourceError def pytest_addoption(parser): """ Plugin configurations. """ parser.addini( "cdist_hostname", "cdist resource hostname (default: localhost)", default="localhost" ) parser.addini( "cdist_port", "cdist resource port (default: 6379)", default="6379" ) parser.addini( "cdist_autolock", "Enable/Disable configuration automatic lock (default: True)", default="True" ) group = parser.getgroup("cdist") group.addoption( "--cdist-config", action="store", dest="cdist_config", default="", help="configuration key name" ) def pytest_configure(config): """ Print out some session informations. """ config.pluginmanager.register(Plugin(), "plugin.cdist")
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 10210, 396, 12, 33803, 7822, 13, 198, 198, 13838, 25, 198, 220, 220, 220, 23174, 327, 11184, 5549, 1279, 392, 21468, 13, 66, 11184, 5549, 31, 4529, 3524, 1...
2.424036
441
# Copyright 2015 Rackspace, 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, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from superironic import colors from superironic import config def get_envs_in_group(group_name): """ Takes a group_name and finds any environments that have a SUPERIRONIC_GROUP configuration line that matches the group_name. """ envs = [] for section in config.ironic_creds.sections(): if (config.ironic_creds.has_option(section, 'SUPERIRONIC_GROUP') and config.ironic_creds.get(section, 'SUPERIRONIC_GROUP') == group_name): envs.append(section) return envs def is_valid_environment(env): """Check if config file contains `env`.""" valid_envs = config.ironic_creds.sections() return env in valid_envs def is_valid_group(group_name): """ Checks to see if the configuration file contains a SUPERIRONIC_GROUP configuration option. """ valid_groups = [] for section in config.ironic_creds.sections(): if config.ironic_creds.has_option(section, 'SUPERIRONIC_GROUP'): valid_groups.append(config.ironic_creds.get(section, 'SUPERIRONIC_GROUP')) valid_groups = list(set(valid_groups)) if group_name in valid_groups: return True else: return False def print_valid_envs(valid_envs): """Prints the available environments.""" print("[%s] Your valid environments are:" % (colors.gwrap('Found environments'))) print("%r" % valid_envs) def warn_missing_ironic_args(): """Warn user about missing Ironic arguments.""" msg = """ [%s] No arguments were provided to pass along to ironic. The superironic script expects to get commands structured like this: superironic [environment] [command] Here are some example commands that may help you get started: superironic prod node-list superironic prod node-show superironic prod port-list """ print(msg % colors.rwrap('Missing arguments')) def rm_prefix(name): """ Removes ironic_ os_ ironicclient_ prefix from string. """ if name.startswith('ironic_'): return name[7:] elif name.startswith('ironicclient_'): return name[13:] elif name.startswith('os_'): return name[3:] else: return name
[ 2, 15069, 1853, 37927, 13200, 11, 3457, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2,...
2.676995
1,065
#!/usr/bin/python # -*- coding: utf-8 -*- from cloudshell.cli.service.cli_service_impl import CliServiceImpl from cloudshell.huawei.cli.huawei_cli_handler import HuaweiCli, HuaweiCliHandler from cloudshell.huawei.wdm.cli.huawei_command_modes import ( WDMConfigCommandMode, WDMEnableCommandMode, )
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 6279, 29149, 13, 44506, 13, 15271, 13, 44506, 62, 15271, 62, 23928, 1330, 1012, 72, 16177, 29710, 198, 6738, 6279, 29149...
2.75
112
# Generated by Django 2.2.7 on 2019-11-20 14:10 from django.conf import settings from django.db import migrations, models import django.db.models.deletion
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 22, 319, 13130, 12, 1157, 12, 1238, 1478, 25, 940, 198, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 198, 11748, 42625, 142...
3.019231
52
# 4 LED 0-11 6 LED 0-59 # # LED 0 1 # # # # 3:25 # # n LED # # : # # : n = 1 # : ["1:00", "2:00", "4:00", "8:00", "0:01", "0:02", "0:04", "0:08", "0:16", "0:32"] # # # : # # # 01:00 1:00 # 10:2 10:02 # # # LeetCode # https://leetcode-cn.com/problems/binary-watch # from typing import List if __name__ == '__main__': s = Solution() res = s.numOfBin(4, 2) print(res)
[ 2, 220, 604, 220, 12365, 657, 12, 1157, 718, 220, 12365, 657, 12, 3270, 198, 2, 198, 2, 220, 12365, 220, 657, 220, 352, 198, 2, 198, 2, 198, 2, 198, 2, 220, 513, 25, 1495, 198, 2, 198, 2, 220, 299, 12365, 220, 198, 2, 198, ...
1.7713
223
from __future__ import division, print_function, absolute_import import numpy as np import torch, sys import os.path as osp from torchreid import metrics from torchreid.losses import TripletLoss, CrossEntropyLoss from torchreid.losses import ClassMemoryLoss from ..engine import Engine from ..pretrainer import PreTrainer # Required for new engine run defination import time, datetime from torch import nn from torchreid.utils import ( MetricMeter, AverageMeter, re_ranking, open_all_layers, Logger, open_specified_layers, visualize_ranked_results ) from torch.utils.tensorboard import SummaryWriter from torchreid.utils.serialization import load_checkpoint, save_checkpoint
[ 6738, 11593, 37443, 834, 1330, 7297, 11, 3601, 62, 8818, 11, 4112, 62, 11748, 201, 198, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 11748, 28034, 11, 25064, 201, 198, 11748, 28686, 13, 6978, 355, 267, 2777, 201, 198, 6738, 2803...
3.193694
222
from setuptools import setup setup( name="cartotools", version="1.2.1", description="Making cartopy suit my needs", license="MIT", packages=[ "cartotools", "cartotools.crs", "cartotools.img_tiles", "cartotools.osm", ], author="Xavier Olive", install_requires=['pandas'] )
[ 6738, 900, 37623, 10141, 1330, 9058, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 2625, 26674, 313, 10141, 1600, 198, 220, 220, 220, 2196, 2625, 16, 13, 17, 13, 16, 1600, 198, 220, 220, 220, 6764, 2625, 23874, 6383, 11081, 6050, 61...
2.202614
153
""" Functional testing for /models/* endpoints. """ import os import json import importlib import logging import pytest from pytest_bdd import scenario, given, then, when from fastapi.testclient import TestClient import app.main from app.tests import load_sqlalchemy_response_from_json from app.tests import load_json_file logger = logging.getLogger(__name__) def _patch_function(monkeypatch, module_name: str, function_name: str, json_filename: str): """ Patch module_name.function_name to return de-serialized json_filename """ monkeypatch.setattr(importlib.import_module(module_name), function_name, mock_get_data)
[ 37811, 44224, 4856, 329, 1220, 27530, 15211, 886, 13033, 13, 198, 37811, 198, 11748, 28686, 198, 11748, 33918, 198, 11748, 1330, 8019, 198, 11748, 18931, 198, 11748, 12972, 9288, 198, 6738, 12972, 9288, 62, 65, 1860, 1330, 8883, 11, 1813,...
3.37037
189
from django.contrib import admin from Module_DeploymentMonitoring import views from django.urls import path,re_path urlpatterns = [ path('instructor/ITOperationsLab/setup/awskeys/',views.faculty_Setup_GetAWSKeys,name='itopslab_setup_AWSKeys'), path('instructor/ITOperationsLab/monitor/',views.faculty_Monitor_Base,name='itopslab_monitor'), path('student/ITOperationsLab/deploy/',views.student_Deploy_Base,name='itopslab_studeploy'), path('student/ITOperationsLab/deploy/<str:course_title>/2',views.student_Deploy_Upload,name='itopslab_studeployUpload'), path('student/ITOperationsLab/monitor/',views.student_Monitor_Base,name='itopslab_stumonitor'), # For adding deployment packages into system path('instructor/ITOperationsLab/setup/deployment_package/',views.faculty_Setup_GetGitHubLinks,name='dp_list'), path('instructor/ITOperationsLab/setup/deployment_package/create/', views.faculty_Setup_AddGitHubLinks, name='dp_create'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/<str:pk>/update/', views.faculty_Setup_UpdateGitHubLinks, name='dp_update'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/<str:pk>/delete/', views.faculty_Setup_DeleteGitHubLinks, name='dp_delete'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/delete/all/', views.faculty_Setup_DeleteAllGitHubLinks, name='dp_delete_all'), # For retrieving and sharing of AMI path('instructor/ITOperationsLab/setup/',views.faculty_Setup_Base,name='itopslab_setup'), path('instructor/ITOperationsLab/setup/ami/get/',views.faculty_Setup_GetAMI,name='itopslab_setup_AMI_get'), path('instructor/ITOperationsLab/setup/ami/accounts/get/',views.faculty_Setup_GetAMIAccounts,name='itopslab_setup_AMI_Accounts_get'), path('instructor/ITOperationsLab/setup/ami/accounts/share/',views.faculty_Setup_ShareAMI,name='itopslab_setup_AMI_Accounts_share'), # For standard student deployment page path('student/ITOperationsLab/deploy/standard/',views.student_Deploy_Standard_Base,name='itopslab_studeploy_standard'), path('student/ITOperationsLab/deploy/standard/deployment_package/',views.student_Deploy_Standard_GetDeploymentPackages,name='dp_list_student'), path('student/ITOperationsLab/deploy/standard/account/',views.student_Deploy_Standard_AddAccount,name='itopslab_studeploy_standard_AddAccount'), path('student/ITOperationsLab/deploy/standard/server/',views.student_Deploy_Standard_GetIPs,name='server_list'), path('student/ITOperationsLab/deploy/standard/server/create/',views.student_Deploy_Standard_AddIPs,name='server_create'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/<str:pk>/update/',views.student_Deploy_Standard_UpdateIPs,name='server_update'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/<str:pk>/delete/',views.student_Deploy_Standard_DeleteIPs,name='server_delete'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/delete/all/',views.student_Deploy_Standard_DeleteAllIPs,name='server_delete_all'), ]
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 19937, 62, 49322, 434, 35479, 278, 1330, 5009, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 11, 260, 62, 6978, 198, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, ...
2.860783
1,099
if __name__=="__main__": obj=Akash() obj.question_answer()
[ 198, 361, 11593, 3672, 834, 855, 1, 834, 12417, 834, 1298, 198, 220, 26181, 28, 33901, 1077, 3419, 198, 220, 26181, 13, 25652, 62, 41484, 3419, 198 ]
2.37037
27
from django.contrib.auth.models import User from django.db import models from mainapp.functions.search import params_to_search_string, search_string_to_params from mainapp.functions.search_notification_tools import ( params_to_human_string, params_are_equal, )
[ 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 198, 6738, 1388, 1324, 13, 12543, 2733, 13, 12947, 1330, 42287, 62, 1462, 62, 12947, 62, 8841, 11, 2989, 62, 884...
3.114943
87
#!/usr/bin/env python # # fatdisk.py - Unit test cases for COT.helpers.fatdisk submodule. # # March 2015, Glenn F. Matthews # Copyright (c) 2014-2017 the COT project developers. # See the COPYRIGHT.txt file at the top-level directory of this distribution # and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt. # # This file is part of the Common OVF Tool (COT) project. # It is subject to the license terms in the LICENSE.txt file found in the # top-level directory of this distribution and at # https://github.com/glennmatthews/cot/blob/master/LICENSE.txt. No part # of COT, including this file, may be copied, modified, propagated, or # distributed except according to the terms contained in the LICENSE.txt file. """Unit test cases for the COT.helpers.fatdisk module.""" import os import re from distutils.version import StrictVersion import mock from COT.helpers.tests.test_helper import HelperTestCase from COT.helpers.fatdisk import FatDisk from COT.helpers import helpers # pylint: disable=missing-type-doc,missing-param-doc,protected-access
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 3735, 39531, 13, 9078, 532, 11801, 1332, 2663, 329, 327, 2394, 13, 16794, 364, 13, 17359, 39531, 850, 21412, 13, 198, 2, 198, 2, 2805, 1853, 11, 17551, 376, 13, 22233, 1...
3.241692
331
#!/usr/bin/env python import baxter_interface import rospy if __name__ == '__main__': rospy.init_node("set_left_arm_py") names = ['left_e0', 'left_e1', 'left_s0', 'left_s1', 'left_w0', 'left_w1', 'left_w2'] joints = [-0.8022719520640714, 1.7184419776286348, 0.21399031991001521, 0.324436936637765, 2.5862916083748075, -0.5825292041994858, -0.3566505331833587] combined = zip(names, joints) command = dict(combined) left = baxter_interface.Limb('left') left.move_to_joint_positions(command) print "Done"
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 275, 40864, 62, 39994, 198, 11748, 686, 2777, 88, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 686, 2777, 88, 13, 15003, 62, 17...
2.217213
244
#------------------------------------------------------------------------------ # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # SessionCallbackPLSQL.py # # Demonstrate how to use a session callback written in PL/SQL. The callback is # invoked whenever the tag requested by the application does not match the tag # associated with the session in the pool. It should be used to set session # state, so that the application can count on known session state, which allows # the application to reduce the number of round trips to the database. # # The primary advantage to this approach over the equivalent approach shown in # SessionCallback.py is when DRCP is used, as the callback is invoked on the # server and no round trip is required to set state. # # This script requires cx_Oracle 7.1 and higher. #------------------------------------------------------------------------------ from __future__ import print_function import cx_Oracle import SampleEnv # create pool with session callback defined pool = cx_Oracle.SessionPool(SampleEnv.GetMainUser(), SampleEnv.GetMainPassword(), SampleEnv.GetConnectString(), min=2, max=5, increment=1, threaded=True, sessionCallback="pkg_SessionCallback.TheCallback") # truncate table logging calls to PL/SQL session callback conn = pool.acquire() cursor = conn.cursor() cursor.execute("truncate table PLSQLSessionCallbacks") conn.close() # acquire session without specifying a tag; the callback will not be invoked as # a result and no session state will be changed print("(1) acquire session without tag") conn = pool.acquire() cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a tag; since the session returned has no tag, # the callback will be invoked; session state will be changed and the tag will # be saved when the connection is closed print("(2) acquire session with tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=SIMPLE") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying the same tag; since a session exists in the pool # with this tag, it will be returned and the callback will not be invoked but # the connection will still have the session state defined previously print("(3) acquire session with same tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=SIMPLE") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a different tag; since no session exists in the # pool with this tag, a new session will be returned and the callback will be # invoked; session state will be changed and the tag will be saved when the # connection is closed print("(4) acquire session with different tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=FULL;TIME_ZONE=UTC") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a different tag but also specifying that a # session with any tag can be acquired from the pool; a session with one of the # previously set tags will be returned and the callback will be invoked; # session state will be changed and the tag will be saved when the connection # is closed print("(4) acquire session with different tag but match any also specified") conn = pool.acquire(tag="NLS_DATE_FORMAT=FULL;TIME_ZONE=MST", matchanytag=True) cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session and display results from PL/SQL session logs conn = pool.acquire() cursor = conn.cursor() cursor.execute(""" select RequestedTag, ActualTag from PLSQLSessionCallbacks order by FixupTimestamp""") print("(5) PL/SQL session callbacks") for requestedTag, actualTag in cursor: print("Requested:", requestedTag, "Actual:", actualTag)
[ 2, 10097, 26171, 198, 2, 15069, 357, 66, 8, 13130, 11, 18650, 290, 14, 273, 663, 29116, 13, 1439, 2489, 10395, 13, 198, 2, 10097, 26171, 198, 198, 2, 10097, 26171, 198, 2, 23575, 47258, 6489, 17861, 13, 9078, 198, 2, 198, 2, 7814,...
3.712363
1,189
"""Reward wrapper that gives rewards for positive change in z axis. Based on MOPO: https://arxiv.org/abs/2005.13239""" from gym import Wrapper
[ 37811, 48123, 29908, 326, 3607, 11530, 329, 3967, 1487, 287, 1976, 16488, 13, 198, 220, 220, 13403, 319, 337, 3185, 46, 25, 3740, 1378, 283, 87, 452, 13, 2398, 14, 8937, 14, 14315, 13, 1485, 23516, 37811, 198, 198, 6738, 11550, 1330, ...
3.288889
45
import matplotlib.pyplot as plt import numpy as np import cv2 from thresholding import * # list of lists img = cv2.imread("challenge_video_frames/02.jpg") #""" colorspace1 = cv2.cvtColor(img, cv2.COLOR_BGR2Luv) channels1 = [ ("L", colorspace1[:, :, 0]), ("u", colorspace1[:, :, 1]), ("v", colorspace1[:, :, 2]) ] #""" """ colorspace2 = cv2.cvtColor(img, cv2.COLOR_BGR2Lab) channels2 = [ ("L", colorspace2[:, :, 0]), ("a", colorspace2[:, :, 1]), ("b", colorspace2[:, :, 2]) ] colorspace3 = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) channels3 = [ ("H", colorspace3[:, :, 0]), ("S", colorspace3[:, :, 1]), ("V", colorspace3[:, :, 2]) ] colorspace4 = cv2.cvtColor(img, cv2.COLOR_BGR2HLS) channels4 = [ ("H", colorspace4[:, :, 0]), ("L", colorspace4[:, :, 1]), ("S", colorspace4[:, :, 2]) ] """ rgb_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) gradx = gradient_thresh(rgb_img, orient="x", sobel_kernel=7, thresh=(8, 16)) grady = gradient_thresh(rgb_img, orient="y", sobel_kernel=3, thresh=(20, 100)) sobel_grads = [ ("gray", cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)), ("gX", gradx), ("gY", grady) ] mag_thresh_img = mag_thresh(rgb_img, sobel_kernel=3, mag_thresh=(20, 200)) mean_gX = cv2.medianBlur(gradx, 5) dir_thresh_img = dir_threshold(rgb_img, sobel_kernel=3, thresh=(np.pi/2, 2*np.pi/3)) others = [ ("Og Img", rgb_img), ("mag", mag_thresh_img), ("mean_gx", mean_gX) ] plot_images_along_row([others, channels1, sobel_grads]) #plot_images_along_row([channels1, channels2, channels3, channels4])
[ 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 269, 85, 17, 198, 6738, 11387, 278, 1330, 1635, 198, 198, 2, 1351, 286, 8341, 628, 198, 9600, 796, 269, 85, 17, 13, 320, 961, ...
2.075
760
import signal import ConfigParser # HUP signal.signal(signal.SIGHUP, update_config) # ctrl+c signal.signal(signal.SIGINT, ctrl_c) print("test signal") get_config() while True: pass
[ 11748, 6737, 198, 11748, 17056, 46677, 628, 628, 198, 198, 2, 367, 8577, 198, 12683, 282, 13, 12683, 282, 7, 12683, 282, 13, 50, 18060, 8577, 11, 4296, 62, 11250, 8, 198, 2, 269, 14859, 10, 66, 198, 12683, 282, 13, 12683, 282, 7, ...
2.43038
79
#!/usr/bin/env python # coding: utf-8 # In[ ]: import flask from flask import request, jsonify import time import sqlite3 import random # import the necessary packages from keras.preprocessing.image import img_to_array from keras.models import load_model from keras import backend from imutils import build_montages import cv2 import numpy as np from flask_cors import CORS import io app = flask.Flask(__name__) CORS(app) conn = sqlite3.connect('database.db') print("Opened database successfully") conn.execute('CREATE TABLE IF NOT EXISTS Patients (id INTEGER PRIMARY KEY,firstName TEXT, lastName TEXT, ins_ID TEXT, city TEXT, dob TEXT)') conn.execute('CREATE TABLE IF NOT EXISTS Spiral (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') conn.execute('CREATE TABLE IF NOT EXISTS Wave (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') conn.execute('CREATE TABLE IF NOT EXISTS Malaria (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') app.run() # In[ ]:
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 2, 554, 58, 2361, 25, 628, 198, 11748, 42903, 198, 6738, 42903, 1330, 2581, 11, 33918, 1958, 198, 11748, 640, 198, 11748, 44161, 578, 18, ...
3.067073
328
from django.shortcuts import render from django.http import HttpResponseRedirect from django.contrib.auth.models import User from rest_framework import permissions, status from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.views import APIView from .serializers import UserSerializer, UserSerializerWithToken, MessageSerializer from core.models import Message from rest_framework import viewsets
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 7738, 1060, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 1334, 62, 30604, 1330, 21627, ...
4.125
112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from .filter_tweets import filter_tweets_from_directories from .filter_tweets import filter_tweets_from_files from .download_tweets import get_tweets_by_user from .embed_tweets import SentenceEncoder from .embed_tweets import embed_tweets_from_file from .embed_tweets import embed_tweets_from_directories
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 764, 24455, 62, 83, 732, 1039, 1330, 8106, 62, 83, 732, 1039, 62, 6738, 62, 12942, 1749, 198, 6738, 764, ...
2.728682
129
from django.db import models from scenarios.models import ScenarioData # Create your models here.
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 13858, 13, 27530, 1330, 1446, 39055, 6601, 198, 198, 2, 13610, 534, 4981, 994, 13, 198 ]
3.96
25
import logging from flask import Flask, render_template, request, redirect, flash, session, jsonify from flask_sqlalchemy import SQLAlchemy from flask_login import UserMixin, LoginManager, login_user, logout_user from datetime import datetime from passlib.hash import sha256_crypt import msnotifier.bot.siteMonitor as siteMonitor import threading import msnotifier.messenger as messenger app = Flask(__name__) app.config['SECRET_KEY'] = 'xDDDDsupresikretKEy' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///notifayy.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) # Login Handling login_manager = LoginManager() login_manager.login_view = 'auth.login' login_manager.init_app(app) # User_ID = Primary Key # ------------------------- # - Database Structure - # ALERT TABLE # +----+-------------+-----------------+-------------------+---------------+---------------+ # | ID | TITLE (str) | PAGE (url) | DATE_ADDED (date) | USER_ID (key) | APPS_ID (key) | # +----+-------------+-----------------+-------------------+---------------+---------------+ # | 1 | My Site | http://site.com | 07.06.2020 | 2 | 4 | # | 2 | (...) | (...) | (...) | (...) | (...) | # +----+-------------+-----------------+-------------------+---------------+---------------+ # > APPS_ID -> Key, which is: Primary Key in APPS Table # > USER_ID -> Key, which is: Primary Key in USER Table # APPS TABLE # +----+----------------+-----------------+------------------+--------------+ # | ID | Discord (bool) | Telegram (bool) | Messenger (bool) | Email (bool) | # +----+----------------+-----------------+------------------+--------------+ # | 4 | true | false | true | true | # | 5 | (...) | (...) | (...) | (...) | # +----+----------------+-----------------+------------------+--------------+ # > ID -> Primary Key, which is: Referenced by ALERTS TABLE (APPS_ID) # USER TABLE # +----+----------------+-----------------------+------------------+--------------------+--------------+ # | ID | Email (str) | Passowrd (str hashed) | Discord_Id (int) | Messenger_Id (str) | Logged (int) | # +----+----------------+-----------------------+------------------+--------------------+--------------+ # | 2 | cool@gmail.com | <hash> | 21842147 | ??? | 1 | # | 3 | (...) | (...) | (...) | (...) | | # +----+----------------+-----------------------+------------------+--------------------+--------------+ # > ID -> Primary Key, which is: Referenced by ALERTS TABLE (USER_ID) # ------------------------------- # - Database Classes Tables - class Alert(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) page = db.Column(db.String(100), nullable=False) date_added = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) user_id = db.Column(db.Integer, nullable=False) apps_id = db.Column(db.Integer, nullable=False) class ChangesForDiscord(db.Model): id = db.Column(db.Integer, primary_key=True) alert_id = db.Column(db.Integer, nullable=False) content = db.Column(db.String(200), nullable=False) class Apps(db.Model): id = db.Column(db.Integer, primary_key=True) discord = db.Column(db.Boolean, nullable=False, default=False) telegram = db.Column(db.Boolean, nullable=False, default=False) messenger = db.Column(db.Boolean, nullable=False, default=False) email = db.Column(db.Boolean, nullable=False, default=False) class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(100), unique=True) password = db.Column(db.String(100)) discord_id = db.Column(db.Integer, nullable=True) messenger_l = db.Column(db.String(100), nullable=True) messenger_token = db.Column(db.String(100), nullable=True) telegram_id = db.Column(db.String(100), nullable=True) logged = db.Column(db.Integer, nullable=True) def get_items_for_messaging(id): a=Alert.query.filter_by(id=id).first() u=User.query.filter_by(id=a.user_id) bools=Apps.query.filter_by(id=id) return [a,u,bools] def add_to_changes(item): item=ChangesForDiscord(alert_id=item[0],content=item[1]) db.session.add(item) db.session.commit() # -------------------------------- # - Helping Functions for DB - o=Detecting() o.start() # --------------------------------------- # - Helping Functions for Site Walk - # ----------------------- # - Main HREF Routes - # -------------------------------- # - Editing / Deleting Alerts - # Made the alert editing very smooth - everything is handled from mainpage # ----------------------------------------- # - Linking Discord/Messenger/Telegram - # ------------------------------------ # - HREF for Mainpage and Logout - if __name__ == "__main__": app.run(debug=True) # ===== Notice Info 04-06-2020 # First of all, password encryption was added, so: # > pip install passlib (507kb, guys) # # Keep in mind that expanding on existing models in DB # Will caues error due to unexisting columns, so: # Navigate to ./web (here's the app.py) # > python # > from app import db # > db.reflect() # > db.drop_all() # > db.create_all() # ===== Notice Info 05-06-2020 # To surprass all these annoying false-positive warnings with # db.* and logger.*, just do this: # > pip install pylint-flask (10 KB) # Then in .vscode/settings.json (if you are using vscode), add: # > "python.linting.pylintArgs": ["--load-plugins", "pylint-flask"] # ===== Notice Info 06-06-2020 # > app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # ^ This is for the FSADeprecationWarning (adds significant overhead) # and will be disabled by default in the future anyway # # Cleaned up this code a bit, and made it more visual and easy to read # Added linking functionality for all buttons, so you can do w/e you want # with them right now. Also added email bool for alerts
[ 11748, 18931, 198, 6738, 42903, 1330, 46947, 11, 8543, 62, 28243, 11, 2581, 11, 18941, 11, 7644, 11, 6246, 11, 33918, 1958, 198, 6738, 42903, 62, 25410, 282, 26599, 1330, 16363, 2348, 26599, 198, 6738, 42903, 62, 38235, 1330, 11787, 356...
2.764238
2,265
import sys, os import gym import gym_urbandriving as uds import cProfile import time import numpy as np import pickle import skimage.transform import cv2 import IPython import pygame from random import shuffle from gym_urbandriving.agents import KeyboardAgent, AccelAgent, NullAgent, TrafficLightAgent#, RRTAgent from gym_urbandriving.assets import Car, TrafficLight import colorlover as cl
[ 11748, 25064, 11, 28686, 198, 11748, 11550, 198, 11748, 11550, 62, 333, 3903, 380, 1075, 355, 334, 9310, 198, 11748, 269, 37046, 198, 11748, 640, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2298, 293, 198, 11748, 1341, 9060, 13, 356...
3.418803
117
import os import tempfile import time import urllib import urllib.parse import pexpect import maccli.dao.api_instance import maccli.helper.cmd import maccli.helper.simplecache import maccli.helper.metadata from maccli.helper.exception import InstanceDoesNotExistException, InstanceNotReadyException def list_instances(name_or_ids=None): """ List available instances in the account """ instances = [] instances_raw = maccli.dao.api_instance.get_list() if name_or_ids is not None: # if name_or_ids is string, convert to list if isinstance(name_or_ids, str): name_or_ids = [name_or_ids] for instance_raw in instances_raw: if instance_raw['servername'] in name_or_ids or instance_raw['id'] in name_or_ids: instances.append(instance_raw) else: instances = instances_raw return instances def ssh_interactive_instance(instance_id): """ ssh to an existing instance for an interactive session """ stdout = None instance = maccli.dao.api_instance.credentials(instance_id) # strict host check ssh_params = "" maccli.logger.debug("maccli.strict_host_check: " + str(maccli.disable_strict_host_check)) if maccli.disable_strict_host_check: maccli.logger.debug("SSH String Host Checking disabled") ssh_params = "-o 'StrictHostKeyChecking no'" if instance is not None: if instance['privateKey']: """ Authentication with private key """ fd, path = tempfile.mkstemp() try: with open(path, "wb") as f: f.write(bytes(instance['privateKey'], encoding='utf8')) f.close() command = "ssh %s %s@%s -i %s " % (ssh_params, instance['user'], instance['ip'], f.name) os.system(command) finally: os.close(fd) os.remove(path) else: """ Authentication with password """ command = "ssh %s %s@%s" % (ssh_params, instance['user'], instance['ip']) child = pexpect.spawn(command) (rows, cols) = gettermsize() child.setwinsize(rows, cols) # set the child to the size of the user's term i = child.expect(['.* password:', "yes/no", '[#\$] '], timeout=60) if i == 0: child.sendline(instance['password']) child.interact() elif i == 1: child.sendline("yes") child.expect('.* password:', timeout=60) child.sendline(instance['password']) child.interact() elif i == 2: child.sendline("\n") child.interact() return stdout def gettermsize(): """ horrible non-portable hack to get the terminal size to transmit to the child process spawned by pexpect """ (rows, cols) = os.popen("stty size").read().split() # works on Mac OS X, YMMV rows = int(rows) cols = int(cols) return rows, cols def create_instance(cookbook_tag, bootstrap, deployment, location, servername, provider, release, release_version, branch, hardware, lifespan, environments, hd, port, net, metadata=None, applyChanges=True): """ List available instances in the account """ return maccli.dao.api_instance.create(cookbook_tag, bootstrap, deployment, location, servername, provider, release, release_version, branch, hardware, lifespan, environments, hd, port, net, metadata, applyChanges) def destroy_instance(instanceid): """ Destroy the server :param servername: :return: """ return maccli.dao.api_instance.destroy(instanceid) def credentials(servername, session_id): """ Gets the server credentials: public ip, username, password and private key :param instance_id; :return: """ return maccli.dao.api_instance.credentials(servername, session_id) def facts(instance_id): """ Returns facts about the system :param instance_id; :return: """ return maccli.dao.api_instance.facts(instance_id) def log(instance_id, follow): """ Returns server logs :param instance_id; :return: """ if follow: logs = maccli.dao.api_instance.log_follow(instance_id) else: logs = maccli.dao.api_instance.log(instance_id) return logs def lifespan(instance_id, amount): """ Set new instance lifespan :param instance_id; :return: """ return maccli.dao.api_instance.update(instance_id, amount) def update_configuration(cookbook_tag, bootstrap, instance_id, new_metadata=None): """ Update server configuration with given cookbook :param cookbook_tag: :param instance_id: :return: """ return maccli.dao.api_instance.update_configuration(cookbook_tag, bootstrap, instance_id, new_metadata) def create_instances_for_role(root, infrastructure, roles, infrastructure_key, quiet): """ Create all the instances for the given tier """ maccli.logger.debug("Processing infrastructure %s" % infrastructure_key) roles_created = {} maccli.logger.debug("Type role") infrastructure_role = infrastructure['role'] role_raw = roles[infrastructure_role]["instance create"] metadata = maccli.helper.metadata.metadata_instance(root, infrastructure_key, infrastructure_role, role_raw, infrastructure) instances = create_tier(role_raw, infrastructure, metadata, quiet) roles_created[infrastructure_role] = instances return roles_created def create_tier(role, infrastructure, metadata, quiet): """ Creates the instances that represents a role in a given infrastructure :param role: :param infrastructure: :return: """ lifespan = None try: lifespan = infrastructure['lifespan'] except KeyError: pass hardware = "" try: hardware = infrastructure["hardware"] except KeyError: pass environment = maccli.helper.metadata.get_environment(role, infrastructure) hd = None try: hd = role["hd"] except KeyError: pass configuration = None try: configuration = role["configuration"] except KeyError: pass bootstrap = None try: bootstrap = role["bootstrap bash"] except KeyError: pass port = None try: port = infrastructure["port"] except KeyError: pass net = None try: net = infrastructure["net"] except KeyError: pass deployment = None try: deployment = infrastructure["deployment"] except KeyError: pass release = None try: release = infrastructure["release"] except KeyError: pass release_version = None try: release_version = infrastructure["release_version"] except KeyError: pass branch = None try: branch = infrastructure["branch"] except KeyError: pass provider = None try: provider = infrastructure["provider"] except KeyError: pass instances = [] amount = 1 if 'amount' in infrastructure: amount = infrastructure['amount'] for x in range(0, amount): instance = maccli.dao.api_instance.create(configuration, bootstrap, deployment, infrastructure["location"], infrastructure["name"], provider, release, release_version, branch, hardware, lifespan, environment, hd, port, net, metadata, False) instances.append(instance) maccli.logger.info("Creating instance '%s'" % (instance['id'])) return instances
[ 11748, 28686, 198, 11748, 20218, 7753, 198, 11748, 640, 198, 11748, 2956, 297, 571, 198, 11748, 2956, 297, 571, 13, 29572, 198, 198, 11748, 613, 87, 806, 198, 198, 11748, 8352, 44506, 13, 67, 5488, 13, 15042, 62, 39098, 198, 11748, 83...
2.365847
3,414
""" The 'helpers' module provides various helper functions. """ import getpass import json import os import subprocess import sys from odml import fileio from odml.dtypes import default_values from odml.tools.parser_utils import SUPPORTED_PARSERS from .treemodel import value_model try: # Python 3 from urllib.parse import urlparse, unquote, urljoin from urllib.request import pathname2url except ImportError: # Python 2 from urlparse import urlparse, urljoin from urllib import unquote, pathname2url def uri_to_path(uri): """ *uri_to_path* parses a uri into a OS specific file path. :param uri: string containing a uri. :return: OS specific file path. """ net_locator = urlparse(uri).netloc curr_path = unquote(urlparse(uri).path) file_path = os.path.join(net_locator, curr_path) # Windows specific file_path handling if os.name == "nt" and file_path.startswith("/"): file_path = file_path[1:] return file_path def path_to_uri(path): """ Converts a passed *path* to a URI GTK can handle and returns it. """ uri = pathname2url(path) uri = urljoin('file:', uri) return uri def get_extension(path): """ Returns the upper case file extension of a file referenced by a passed *path*. """ ext = os.path.splitext(path)[1][1:] ext = ext.upper() return ext def get_parser_for_uri(uri): """ Sanitize the given path, and also return the odML parser to be used for the given path. """ path = uri_to_path(uri) parser = get_extension(path) if parser not in SUPPORTED_PARSERS: parser = 'XML' return parser def get_parser_for_file_type(file_type): """ Checks whether a provided file_type is supported by the currently available odML parsers. Returns either the identified parser or XML as the fallback parser. """ parser = file_type.upper() if parser not in SUPPORTED_PARSERS: parser = 'XML' return parser def handle_section_import(section): """ Augment all properties of an imported section according to odml-ui needs. :param section: imported odml.BaseSection """ for prop in section.properties: handle_property_import(prop) # Make sure properties down the rabbit hole are also treated. for sec in section.sections: handle_section_import(sec) def handle_property_import(prop): """ Every odml-ui property requires at least one default value according to its dtype, otherwise the property is currently broken. Further the properties are augmented with 'pseudo_values' which need to be initialized and added to each property. :param prop: imported odml.BaseProperty """ if len(prop.values) < 1: if prop.dtype: prop.values = [default_values(prop.dtype)] else: prop.values = [default_values('string')] create_pseudo_values([prop]) def create_pseudo_values(odml_properties): """ Creates a treemodel.Value for each value in an odML Property and appends the resulting list as *pseudo_values* to the passed odML Property. """ for prop in odml_properties: values = prop.values new_values = [] for index in range(len(values)): val = value_model.Value(prop, index) new_values.append(val) prop.pseudo_values = new_values def get_conda_root(): """ Checks for an active Anaconda environment. :return: Either the root of an active Anaconda environment or an empty string. """ # Try identifying conda the easy way if "CONDA_PREFIX" in os.environ: return os.environ["CONDA_PREFIX"] # Try identifying conda the hard way try: conda_json = subprocess.check_output("conda info --json", shell=True, stderr=subprocess.PIPE) except subprocess.CalledProcessError as exc: print("[Info] Conda check: %s" % exc) return "" if sys.version_info.major > 2: conda_json = conda_json.decode("utf-8") dec = json.JSONDecoder() try: root_path = dec.decode(conda_json)['default_prefix'] except ValueError as exc: print("[Info] Conda check: %s" % exc) return "" if sys.version_info.major < 3: root_path = str(root_path) return root_path def run_odmltables(file_uri, save_dir, odml_doc, odmltables_wizard): """ Saves an odML document to a provided folder with the file ending '.odml' in format 'XML' to ensure an odmltables supported file. It then executes odmltables with the provided wizard and the created file. :param file_uri: File URI of the odML document that is handed over to odmltables. :param save_dir: Directory where the temporary file is saved to. :param odml_doc: An odML document. :param odmltables_wizard: supported values are 'compare', 'convert', 'filter' and 'merge'. """ tail = os.path.split(uri_to_path(file_uri))[1] tmp_file = os.path.join(save_dir, ("%s.odml" % tail)) fileio.save(odml_doc, tmp_file) try: subprocess.Popen(['odmltables', '-w', odmltables_wizard, '-f', tmp_file]) except Exception as exc: print("[Warning] Error running odml-tables: %s" % exc) def get_username(): """ :return: Full name or username of the current user """ username = getpass.getuser() try: # this only works on linux import pwd fullname = pwd.getpwnam(username).pw_gecos if fullname: username = fullname except ImportError: pass return username.rstrip(",")
[ 37811, 198, 464, 705, 16794, 364, 6, 8265, 3769, 2972, 31904, 5499, 13, 198, 37811, 198, 198, 11748, 651, 6603, 198, 11748, 33918, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 11748, 25064, 198, 198, 6738, 16298, 4029, 1330, 2393, 95...
2.545898
2,255
# Copyright 2019 Huawei Technologies Co., Ltd # # 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 the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """ This module c_transforms provides common operations, including OneHotOp and TypeCast. """ import numpy as np import mindspore._c_dataengine as cde from .validators import check_num_classes, check_de_type, check_fill_value, check_slice_op from ..core.datatypes import mstype_to_detype
[ 2, 15069, 13130, 43208, 21852, 1766, 1539, 12052, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198...
3.942623
244
import re from CGATReport.Tracker import * from CGATReport.Utils import PARAMS as P # get from config file UCSC_DATABASE = "hg19" EXPORTDIR = "export" ################################################################### ################################################################### ################################################################### ################################################################### # Run configuration script EXPORTDIR = P.get('exome_exportdir', P.get('exportdir', 'export')) DATADIR = P.get('exome_datadir', P.get('datadir', '.')) DATABASE = P.get('exome_backend', P.get('sql_backend', 'sqlite:///./csvdb')) TRACKS = ['WTCHG_10997_01', 'WTCHG_10997_02'] ########################################################################### def linkToUCSC(contig, start, end): '''build URL for UCSC.''' ucsc_database = UCSC_DATABASE link = "`%(contig)s:%(start)i..%(end)i <http://genome.ucsc.edu/cgi-bin/hgTracks?db=%(ucsc_database)s&position=%(contig)s:%(start)i..%(end)i>`_" \ % locals() return link ###########################################################################
[ 11748, 302, 198, 198, 6738, 29925, 1404, 19100, 13, 35694, 1330, 1635, 198, 6738, 29925, 1404, 19100, 13, 18274, 4487, 1330, 29463, 40834, 355, 350, 198, 198, 2, 651, 422, 4566, 2393, 198, 9598, 6173, 62, 35, 1404, 6242, 11159, 796, 3...
3.283668
349
from typing import List
[ 6738, 19720, 1330, 7343, 628 ]
5
5
import csv # Finding States' Laziness Rankings: # dataDict = {} with open('data.csv', 'rU') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: state = row[0] row.pop(0) dataDict[state] = row projectedmeans = [] with open('rafadata.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: projectedmeans.append(row[0]) gdps = [] with open('gdp data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) gdps.append((row[0], float(row[1]))) gdps.sort(key=lambda x: x[0]) obesitylevels = [] with open('Obesity data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) obesitylevels.append((row[0], float(row[1]))) educationlevels = [] with open('education data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) educationlevels.append((row[0], float(row[1]))) educationlevels.sort(key=lambda x: x[0]) projectedmeans = map(float, projectedmeans) meanlist = [] for i in dataDict: i = [i] meanlist.append(i) index = 0 while index < 50: meanlist[index].append(projectedmeans[index]) index +=1 # Add relevant information # meanlist.sort(key=lambda x: x[0]) index = 0 while index<50: meanlist[index].append(gdps[index][1]) meanlist[index].append(obesitylevels[index][1]) meanlist[index].append(educationlevels[index][1]) index +=1 meanlist.sort(key=lambda x: x[1], reverse= True) # Adding rank to each state# index = 0 rank = 10 n = 0 go = True while go: for i in range(0,5): meanlist[index].insert(0, rank) index +=1 rank -=1 if rank ==0: go = False #Finding your laziness ranking: # answers = [] import os os.system('clear') print("Laziness Ranker Version 1.0") print print("Question 1") print print("Which of the following activities is your favorite?") print print("A. Going rock climbing.") print("B. Gardening") print("C. Hanging out with friends") print("D. Playing GTA V") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 2") print print("If you saw a baby drowning in a pool, what would you do FIRST?") print print("A. Jump in immediately to save it.") print("B. Make sure no one else is already diving in before saving it.") print("C. Call 911") print("D. Slowly put down your sweaty cheesburger and wipe the ketchup from your fingers before applying sun lotion to make sure you don't get burnt whilst saving the poor kid") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 3") print print("What is the reminder of 47/2?") print print("A. 1") print("B. 47") print("C. Can I phone a friend?") print("D. I'm skipping this question.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 4") print print("What's your favorite movie?") print print("A. Donnie Darko") print("B. Inception") print("C. The Avengers") print("D. Anything with Adam Sandler.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 5") print print("Approximately how much of your leisure time is spent doing physical activity?") print print("A. 80%") print("B. 50%") print("C. 30%") print("D. 10%") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 6") print print("What would you do if someone ran by and snatched your purse/wallet?") print print("A. Trip the basterd.") print("B. Run after the stealer.") print("C. Call 911") print("D. 'Eh. Wasn't that great of a wallet anyway.'") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 7") print print("What is your favorite nightly activity?") print print("A. Krav Maga.") print("B. Taking the dog for a walk") print("C. Watching TV") print("D. Watching cat videos on Youtube") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 8") print print("Which item is closest to you at your desk in your room?") print print("A. Treadmill") print("B. Stress ball") print("C. Potato chips") print("D. Everything is way too far away for my arm to reach.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 9") print print("What's your favorite animal?") print print("A. Freakin' Tigers") print("B. Hawks") print("C. Turtles") print("D. Sloths") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 10") print print("Why are we here?") print print("A. To understand our world, and help each other out at the same time") print("B. To eat and mate.") print("C. It's way too early in the morning for this type of question.") print("D. It's way too late in the evening for this type of question.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) rank = rank(score(answers)) # Matching you with a group of states # yourstates1 = filter(correctstate, meanlist) yourstates = [] index = 0 while index<len(yourstates1): yourstates.append(yourstates1[index]) index +=1 os.system('clear') print("Based on your level of physical activity, we suggest you move to one of these states:") print returnstates(yourstates, 0) returnstates(yourstates, 1) returnstates(yourstates, 2) returnstates(yourstates, 3) returnstates(yourstates, 4)
[ 11748, 269, 21370, 198, 197, 197, 197, 197, 2, 27063, 1829, 6, 22807, 1272, 40284, 25, 1303, 198, 7890, 35, 713, 796, 23884, 198, 198, 4480, 1280, 10786, 7890, 13, 40664, 3256, 705, 81, 52, 11537, 355, 269, 21370, 7753, 25, 198, 197...
2.893499
2,169
#/bin/python3 import numpy as np from PIL import Image img = Image.open('checker.png') #array = 255 - array #invimg = Image.fromarray(array) #invimg.save('testgrey-inverted.png') img = Image.fromarray(process(img,0,0,0)) img.save("newchecker.png")
[ 2, 14, 8800, 14, 29412, 18, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 350, 4146, 1330, 7412, 628, 198, 198, 9600, 796, 7412, 13, 9654, 10786, 9122, 263, 13, 11134, 11537, 198, 198, 2, 18747, 796, 14280, 532, 7177, 198, 2, 16340...
2.581633
98
import click from esque import validation from esque.cli.autocomplete import list_topics from esque.cli.helpers import edit_yaml, ensure_approval from esque.cli.options import State, default_options from esque.cli.output import pretty_topic_diffs from esque.resources.topic import copy_to_local
[ 11748, 3904, 198, 198, 6738, 1658, 4188, 1330, 21201, 198, 6738, 1658, 4188, 13, 44506, 13, 2306, 42829, 6677, 1330, 1351, 62, 4852, 873, 198, 6738, 1658, 4188, 13, 44506, 13, 16794, 364, 1330, 4370, 62, 88, 43695, 11, 4155, 62, 21064...
3.413793
87
# -*- coding: utf-8 -*- """Main entry point into euporie.""" from euporie.app import App if __name__ == "__main__": App.launch()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 13383, 5726, 966, 656, 304, 929, 19257, 526, 15931, 198, 6738, 304, 929, 19257, 13, 1324, 1330, 2034, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834,...
2.481481
54
# Original work Copyright 2018 Brainwy Software Ltda (Dual Licensed: LGPL / Apache 2.0) # From https://github.com/fabioz/pyvmmonitor-core # See ThirdPartyNotices.txt in the project root for license information. # All modifications Copyright (c) Robocorp Technologies 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 agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Defines a PluginManager (which doesn't really have plugins, only a registry of extension points and implementations for such extension points). To use, create the extension points you want (any class starting with 'EP') and register implementations for those. I.e.: pm = PluginManager() pm.register(EPFoo, FooImpl, keep_instance=True) pm.register(EPBar, BarImpl, keep_instance=False) Then, later, to use it, it's possible to ask for instances through the PluginManager API: foo_instances = pm.get_implementations(EPFoo) # Each time this is called, new # foo_instances will be created bar_instance = pm.get_instance(EPBar) # Each time this is called, the same bar_instance is returned. Alternatively, it's possible to use a decorator to use a dependency injection pattern -- i.e.: don't call me, I'll call you ;) @inject(foo_instance=EPFoo, bar_instances=[EPBar]) def m1(foo_instance, bar_instances, pm): for bar in bar_instances: ... foo_instance.foo """ import functools from pathlib import Path from typing import TypeVar, Any, Dict, Type, Tuple, Optional, Union T = TypeVar("T")
[ 2, 13745, 670, 15069, 2864, 14842, 21768, 10442, 19090, 6814, 357, 36248, 49962, 25, 17370, 6489, 1220, 24843, 362, 13, 15, 8, 198, 2, 3574, 3740, 1378, 12567, 13, 785, 14, 36434, 952, 89, 14, 9078, 14761, 41143, 12, 7295, 198, 2, 4...
3.12462
658
version_info = (0, 5, 2)
[ 9641, 62, 10951, 796, 357, 15, 11, 642, 11, 362, 8, 198 ]
2.083333
12
""" ``hippynn`` currently has interfaces to the following other codes: 1. ``ase`` for atomic simulation 2. ``pyseqm`` for combined ML-seqm models 3. ``schnetpack`` for usage of schnet models in ``hippynn``. This subpackage is not available by default; you must import it explicitly. """
[ 37811, 198, 198, 15506, 71, 3974, 2047, 77, 15506, 3058, 468, 20314, 284, 262, 1708, 584, 12416, 25, 198, 198, 16, 13, 7559, 589, 15506, 329, 17226, 18640, 198, 17, 13, 7559, 9078, 41068, 76, 15506, 329, 5929, 10373, 12, 41068, 76, ...
3.306818
88
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Author: ClarkYAN -*- import requests
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 532, 9, 12, 6434, 25, 11264, 56, 1565, 532, 9, 12, 198, 198, 11748, 7007, 628 ]
2.275
40
""" use of script to create the login method use a fake account! """ from selenium import webdriver from time import sleep from bs4 import BeautifulSoup as bs
[ 37811, 198, 1904, 286, 4226, 284, 2251, 262, 17594, 2446, 198, 1904, 257, 8390, 1848, 0, 198, 37811, 198, 198, 6738, 384, 11925, 1505, 1330, 3992, 26230, 198, 6738, 640, 1330, 3993, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 355,...
3.555556
45
# -*- coding: utf-8 -*- import joblib import torch import numpy as np from ntee.utils.my_tokenizer import RegexpTokenizer from ntee.utils.vocab_joint import JointVocab from ntee.utils.vocab import Vocab class PyTorchModelReader(object): def get_word_vector(self, word, default=None): index = self._vocab.get_word_index(word) if index: return self.word_embedding[index] else: return default def get_entity_vector(self, title, default=None): index = self._vocab.get_entity_index(title) if index: return self.entity_embedding[index] else: return default def get_text_vector(self, text): vectors = [self.get_word_vector(t.text.lower()) for t in self._tokenizer.tokenize(text)] vectors = [v for v in vectors if v is not None] # vectors_numpy = [v.cpu().numpy() for v in vectors if v is not None] # ret_numpy = np.mean(vectors_numpy, axis=0) # ret_numpy = np.dot(ret_numpy, self._W.cpu().numpy()) # ret_numpy += self._b.cpu().numpy() # ret_numpy /= np.linalg.norm(ret_numpy, 2) # return ret_numpy if not vectors: return None ret = torch.zeros(vectors[0].shape) for v in vectors: ret += v ret = ret / len(vectors) ret = torch.matmul(ret, self._W) ret += self._b ret /= torch.norm(ret, 2) return ret
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 1693, 8019, 198, 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 299, 660, 68, 13, 26791, 13, 1820, 62, 30001, 7509, 1330, 797, 25636, 79, 30642...
2.085754
723
from setuptools import setup import importlib version = importlib.import_module('sputr.config').version setup( name='sputr', version=version, description='Simple Python Unit Test Runner', long_description="An intuitive command line and Python package interface for Python's unit testing framework.", author='Matt Wisniewski', author_email='sputr@mattw.us', license='MIT', url='https://github.com/polishmatt/sputr', keywords=['testing'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Testing', 'Topic :: Utilities', ], platforms=['unix','linux'], packages=[ 'sputr' ], install_requires=[ 'click==6.7' ], entry_points={ 'console_scripts': [ 'sputr = sputr.cli:cli' ], }, )
[ 6738, 900, 37623, 10141, 1330, 9058, 198, 11748, 1330, 8019, 198, 198, 9641, 796, 1330, 8019, 13, 11748, 62, 21412, 10786, 82, 1996, 81, 13, 11250, 27691, 9641, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 11639, 82, 1996, 81, 3256, ...
2.590193
571
#!/usr/bin/env python3 # Copyright 2018-2021 VMware, Inc., Microsoft Inc., Carnegie Mellon University, ETH Zurich, and University of Washington # SPDX-License-Identifier: BSD-2-Clause import matplotlib import matplotlib.pyplot as plt import numpy as np import re #import json parse()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 15069, 2864, 12, 1238, 2481, 37754, 11, 3457, 1539, 5413, 3457, 1539, 33976, 49808, 2059, 11, 35920, 43412, 11, 290, 2059, 286, 2669, 198, 2, 30628, 55, 12, 34156, 12, 33...
3.197802
91
# -*- coding: utf-8 -*- """ oy.models.mixins.polymorphic_prop ~~~~~~~~~~ Provides helper mixin classes for special sqlalchemy models :copyright: (c) 2018 by Musharraf Omer. :license: MIT, see LICENSE for more details. """ import sqlalchemy.types as types from sqlalchemy import literal_column, event from sqlalchemy.orm.interfaces import PropComparator from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.declarative import declared_attr from oy.boot.sqla import db
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 197, 198, 220, 220, 220, 35104, 13, 27530, 13, 19816, 1040, 13, 35428, 24503, 291, 62, 22930, 198, 220, 220, 220, 220, 15116, 4907, 628, 220, 220, 220, 47081, 3...
3.053571
168
# 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 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 the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ PyTest configuration module. Add support for a "--tosca-parser" CLI option. For more information on PyTest hooks, see the `PyTest documentation <https://docs.pytest.org/en/latest/writing_plugins.html#pytest-hook-reference>`__. """ import pytest from ...mechanisms.parsing.aria import AriaParser
[ 2, 49962, 284, 262, 24843, 10442, 5693, 357, 1921, 37, 8, 739, 530, 393, 517, 198, 2, 18920, 5964, 11704, 13, 220, 4091, 262, 28536, 2393, 9387, 351, 198, 2, 428, 670, 329, 3224, 1321, 5115, 6634, 9238, 13, 198, 2, 383, 7054, 37, ...
3.804196
286
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test Project Template The code below is derived from several locations: REFERENCES: REF1: https://docs.pytest.org/en/latest/contents.html REF2: https://github.com/hackebrot/pytest-cookies LOCATIONS LOC1: https://github.com/audreyr/cookiecutter-pypackage LOC2: https://github.com/mdklatt/cookiecutter-python-app LOC3: https://github.com/Springerle/py-generic-project """ # ---------------------------------------------------------------------------- # Python Standard Library Imports (one per line) # ---------------------------------------------------------------------------- import sys import shlex import os import sys import subprocess # import yaml import datetime from contextlib import contextmanager if sys.version_info > (3, 2): import io import os else: raise "Use Python 3.3 or higher" # ---------------------------------------------------------------------------- # External Third Party Python Module Imports (one per line) # ---------------------------------------------------------------------------- from cookiecutter.utils import rmtree # from click.testing import CliRunner # ---------------------------------------------------------------------------- # Project Specific Module Imports (one per line) # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- __author__ = 'E.R. Uber (eruber@gmail.com)' __license__ = 'MIT' __copyright__ = "Copyright (C) 2017 by E.R. Uber" # ---------------------------------------------------------------------------- # Module Global & Constant Definitions # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Test Support... # ---------------------------------------------------------------------------- # [LOC1] # [LOC1] # [LOC1] def run_inside_dir(command, dirpath): """ Run a command from inside a given directory, returning the exit status :param command: Command that will be executed :param dirpath: String, path of the directory the command is being run. """ with inside_dir(dirpath): return subprocess.check_call(shlex.split(command)) # [LOC1] def check_output_inside_dir(command, dirpath): "Run a command from inside a given directory, returning the command output" with inside_dir(dirpath): return subprocess.check_output(shlex.split(command)) # [LOC1] def project_info(result): """Get toplevel dir, project_slug, and project dir from baked cookies""" project_path = str(result.project) project_slug = os.path.split(project_path)[-1] project_dir = os.path.join(project_path, project_slug) return project_path, project_slug, project_dir # ---------------------------------------------------------------------------- # Tests... # ---------------------------------------------------------------------------- # [LOC1] # [LOC1] # ["MIT", "BSD3", "ISC", "Apache2", "GNU-GPL-v3", "Not open source"] # ---------------------------------------------------------------------------- if __name__ == "__main__": pass
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 14402, 4935, 37350, 198, 198, 464, 2438, 2174, 318, 10944, 422, 1811, 7064, 25, 628, 220, 220, 220, 4526, ...
3.900238
842
import json from msilib.schema import Directory import pandas as pd import csv with open('./result-#succubus Drawings, Best Fan Art on pixiv, Japan-1647491083659.json', 'r',encoding="utf-8") as f: data = json.load(f) Tags_Directory = {} print(f"{len(data)}tag") n = len(data) for i in range(0,n): #print(f"idNum:{data[i]['idNum']} tag:{len(data[i]['tagsWithTransl'])}") for j in range(0,len(data[i]['tagsWithTransl'])): if (data[i]['tagsWithTransl'][j] in Tags_Directory): Tags_Directory[data[i]['tagsWithTransl'][j]] += 1 else: Tags_Directory[data[i]['tagsWithTransl'][j]] = 1 # print(f"Tags_Directory tags: ") # for key in Tags_Directory.keys(): # print(f"{key} : {Tags_Directory[key]}") pd_Tags_Directory = [] pd_Tags_Directory_ID = {} i = 0 print("") for key in Tags_Directory.keys(): pd_Tags_Directory.append(key) pd_Tags_Directory_ID[key] = i i += 1 with open('./pd_Tags_Directory_ID.json', 'w+',encoding="utf-8") as f: json.dump(pd_Tags_Directory_ID,f) print(f"( {len(Tags_Directory)} tags)") # for i in range(0,n): # for j in range(0,len(data[i]['tagsWithTransl'])): # if (data[i]['tagsWithTransl'][j] in Tags_Directory): # Tags_Directory[data[i]['tagsWithTransl'][j]] += 1 # else: # Tags_Directory[data[i]['tagsWithTransl'][j]] = 1 # k = 0 # times = 1 # print(f":Tags ({k}/{n})") # Count_Tags = {"kEySSS": pd_Tags_Directory} # for key in pd_Tags_Directory_ID: # Count_Tag = [0 for _ in range(len(pd_Tags_Directory_ID))] # for i in range(0,n): # if (key not in data[i]['tagsWithTransl']): # continue # else: # for j in range(0,len(data[i]['tagsWithTransl'])): # Count_Tag[pd_Tags_Directory_ID[data[i]['tagsWithTransl'][j]]] += 1 # Count_Tags[key] = Count_Tag # k += 1 # if (k % (n//100) == 0): # print(f":Tags ({k}/{n}) {times}%") # times += 1 # print(f"!excel") # #print(pd_Tags_Directory) # df = pd.DataFrame(Count_Tags) # df.to_csv('trainning.csv') # print(df)
[ 11748, 33918, 198, 6738, 13845, 22282, 13, 15952, 2611, 1330, 27387, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 269, 21370, 198, 198, 4480, 1280, 7, 4458, 14, 20274, 12, 2, 2385, 535, 549, 385, 15315, 654, 11, 6705, 13836, 3683...
2.248864
880
from abc import abstractmethod from typing import Dict, Tuple from curse_manager import CursesManager from telegram import TelegramBot
[ 6738, 450, 66, 1330, 12531, 24396, 198, 6738, 19720, 1330, 360, 713, 11, 309, 29291, 198, 198, 6738, 17328, 62, 37153, 1330, 327, 46998, 13511, 198, 6738, 573, 30536, 1330, 50203, 20630, 628 ]
4.151515
33
from django import forms from django.utils.encoding import force_text from django.utils.translation import pgettext, ugettext_lazy as _ from fluent_contents.extensions import ContainerPlugin, plugin_pool, ContentItemForm from . import appsettings from .models import BootstrapRow, BootstrapColumn GRID_COLUMNS = appsettings.FLUENTCMS_BOOTSTRAP_GRID_COLUMNS SIZE_CHOICES = _get_size_choices() OFFSET_CHOICES = [('', '----')] + [(i, force_text(i)) for i in range(1, GRID_COLUMNS + 1)] size_widget = forms.Select(choices=SIZE_CHOICES) offset_widget = forms.Select(choices=OFFSET_CHOICES) push_widget = forms.Select(choices=OFFSET_CHOICES)
[ 6738, 42625, 14208, 1330, 5107, 198, 6738, 42625, 14208, 13, 26791, 13, 12685, 7656, 1330, 2700, 62, 5239, 198, 6738, 42625, 14208, 13, 26791, 13, 41519, 1330, 279, 1136, 5239, 11, 334, 1136, 5239, 62, 75, 12582, 355, 4808, 198, 6738, ...
2.967742
217
import logging import json from datetime import datetime, timedelta from getpass import getpass import uuid import requests from Cryptodome.PublicKey import RSA import utils NONE, SIGN, TICKET = 0, 1, 2 SERVER = 'https://appstudentapi.zhihuishu.com' SSL_VERIFY = True TAKE_EXAMS = True SKIP_FINAL_EXAM = False EXAM_AUTO_SUBMIT = True if __name__ == '__main__': logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO) logger = logging.getLogger() logger.info('I love studying! Study makes me happy!') rsa_key = RSA.import_key(open('key.pem', 'r').read()) app_key = utils.md5_digest(str(uuid.uuid4()).replace('-', '')) s = requests.Session() s.headers.update({ 'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 7.1.1; Nexus 5X Build/NOF27B', 'Accept-Encoding': 'gzip', 'App-Key': app_key}) secret = '' ticket = '' try: import userinfo user = userinfo.USER name = userinfo.NAME secret = userinfo.SECRET if input(f'Current user:{user} {name}:[y/n]') != 'y': user, name, secret = login() except: user, name, secret = login() SERVER += '/appstudent' p = {'userId': user} d = post(SIGN, '/student/tutorial/getStudyingCourses', p) course_id, recruit_id, link_course_id = 0, 0, 0 if d is None: logger.info('No studying courses.') exit() for course in d: if input(course['courseName'] + ':[y/n]') == 'y': course_id = course['courseId'] recruit_id = course['recruitId'] link_course_id = course['linkCourseId'] break if course_id == 0: exit() p = {'recruitId': recruit_id, 'courseId': course_id, 'userId': user} chapter_list = post(SIGN, '/appserver/student/getCourseInfo', p)['chapterList'] for chapter in chapter_list: for lesson in chapter['lessonList']: if lesson['sectionList'] is not None: for section in lesson['sectionList']: save_record(section, lesson['chapterId'], lesson['id']) else: save_record(lesson, None, None) logger.info('Videos done.') if TAKE_EXAMS is False: exit() p = {'mobileType': 2, 'recruitId': recruit_id, 'courseId': course_id, 'page': 1, 'userId': user, 'examType': 1, 'schoolId': -1, 'pageSize': 20} # examType=2 is for finished exams exam_list = post(SIGN, '/appserver/exam/findAllExamInfo', p)['stuExamDtoList'] for exam in exam_list: logger.info(exam['examInfoDto']['name']) exam_type = exam['examInfoDto']['type'] if exam_type == 2: # Final exams if SKIP_FINAL_EXAM is True: logger.info('Skipped final exam.') continue exam_id = exam['examInfoDto']['examId'] student_exam_id = exam['studentExamInfoDto']['id'] question_ids = [] p = {'userId': user} rt = post(SIGN, '/student/exam/canIntoExam', p) if rt != 1: logger.info('Cannot into exam.') continue p = {'recruitId': recruit_id, 'examId': exam_id, 'isSubmit': 0, 'studentExamId': student_exam_id, 'type': exam_type, 'userId': user} ids = post(SIGN, '/student/exam/examQuestionIdListByCache', p)['examList'] p.pop('isSubmit') p.pop('type') for exam_question in ids: question_ids.append(str(exam_question['questionId'])) p['questionIds'] = question_ids questions = post(SIGN, '/student/exam/questionInfos', p) for question_id in question_ids: question = questions[question_id] logger.info(question['firstname']) if question['questionTypeName'] == '' or '': answer = question['realAnswer'].split(',') else: EXAM_AUTO_SUBMIT = False continue pa = [{'deviceType': '1', 'examId': str(exam_id), 'userId': str(user), 'stuExamId': str(student_exam_id), 'questionId': str(question_id), 'recruitId': str(recruit_id), 'answerIds': answer, 'dataIds': []}] json_str = json.dumps(pa, separators=(',', ':')) pb = {'mobileType': 2, 'jsonStr': json_str, 'secretStr': utils.rsa_encrypt(rsa_key, json_str), 'versionKey': 1} rt = post(SIGN, '/student/exam/saveExamAnswer', pb) logger.info(rt[0]['messages']) if not EXAM_AUTO_SUBMIT: continue pa = {'deviceType': '1', 'userId': str(user), 'stuExamId': str(student_exam_id), 'recruitId': recruit_id, 'examId': str(exam_id), 'questionIds': question_ids, 'remainingTime': '0', 'achieveCount': str(question_ids.__len__())} json_str = json.dumps(pa, separators=(',', ':')) pb = {'mobileType': 2, 'recruitId': recruit_id, 'examId': str(exam_id), 'userId': user, 'jsonStr': json_str, 'secretStr': utils.rsa_encrypt(rsa_key, json_str), 'type': exam_type, 'versionKey': 1} raw = post(SIGN, '/student/exam/submitExamInfo', pb, raw=True) rt = json.loads(raw.replace('"{', '{').replace('}"', '}').replace('\\', ''))['rt'] logger.info(f'{rt["messages"]} Score: {rt["errorInfo"]["score"]}') logger.info('Exams done.')
[ 11748, 18931, 198, 11748, 33918, 198, 6738, 4818, 8079, 1330, 4818, 8079, 11, 28805, 12514, 198, 6738, 651, 6603, 1330, 651, 6603, 198, 11748, 334, 27112, 198, 11748, 7007, 198, 6738, 15126, 375, 462, 13, 15202, 9218, 1330, 42319, 198, ...
2.129147
2,532
import autogl if autogl.backend.DependentBackend.is_dgl(): from ._base_feature_engineer_dgl import BaseFeatureEngineer else: from ._base_feature_engineer_pyg import BaseFeatureEngineer
[ 11748, 1960, 28678, 198, 198, 361, 1960, 28678, 13, 1891, 437, 13, 35, 8682, 7282, 437, 13, 271, 62, 67, 4743, 33529, 198, 220, 220, 220, 422, 47540, 8692, 62, 30053, 62, 18392, 263, 62, 67, 4743, 1330, 7308, 38816, 13798, 263, 198,...
2.954545
66
import os import urllib.request from flask import Flask, request, redirect, render_template, jsonify from flask import Blueprint, request, current_app as app from controllers.sc_judgment_header_ner_eval import SC_ner_annotation import json from models.response import CustomResponse from models.status import Status ner_annotation_api = Blueprint('ner_annotation_api', __name__)
[ 11748, 28686, 198, 11748, 2956, 297, 571, 13, 25927, 198, 6738, 42903, 1330, 46947, 11, 2581, 11, 18941, 11, 8543, 62, 28243, 11, 33918, 1958, 198, 6738, 42903, 1330, 39932, 11, 2581, 11, 1459, 62, 1324, 355, 598, 198, 6738, 20624, 13...
3.81
100
import sys import os import unittest import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * import logging import numpy as np # # HandGenerator # # # HandGeneratorWidget #
[ 11748, 25064, 220, 198, 11748, 28686, 198, 11748, 555, 715, 395, 198, 11748, 410, 30488, 11, 10662, 83, 11, 269, 30488, 11, 14369, 263, 198, 6738, 14369, 263, 13, 7391, 276, 8912, 540, 26796, 1330, 1635, 198, 11748, 18931, 198, 11748, ...
2.893939
66
from django.urls import path from . import views urlpatterns = [ path('movie/', views.MovieListView.as_view()), path('movie/<int:pk>/', views.MovieDetailView.as_view()), path('review/', views.ReviewCreateView.as_view()), ]
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 198, 6738, 764, 1330, 5009, 628, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, 3108, 10786, 41364, 14, 3256, 5009, 13, 25097, 8053, 7680, 13, 292, 62, 1177, 3419, 828, 198, 22...
2.586957
92
import re import uuid import time from typing import (Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union, Text) def camelcase_to_snakecase(_str: str) -> str: """camelcase_to_snakecase. Transform a camelcase string to snakecase Args: _str (str): String to apply transformation. Returns: str: Transformed string """ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', _str) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() def gen_timestamp() -> int: """gen_timestamp. Generate a timestamp. Args: Returns: int: Timestamp in integer representation. User `str()` to transform to string. """ return int(1.0 * (time.time() + 0.5) * 1000) def gen_random_id() -> str: """gen_random_id. Generates a random unique id, using the uuid library. Args: Returns: str: String representation of the random unique id """ return str(uuid.uuid4()).replace('-', '')
[ 11748, 302, 198, 11748, 334, 27112, 198, 11748, 640, 198, 198, 6738, 19720, 1330, 357, 7149, 11, 4889, 540, 11, 360, 713, 11, 7343, 11, 32233, 11, 309, 29291, 11, 5994, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 22...
2.329493
434
#!/usr/bin/env python3 # Pesquisa binaria # Read num = int(input("Number to find the sqrt of? ")) index = 0 step = num / 2 prox = True while abs(index * index - num) > 1e-10: if (prox): index += step else: index -= step step = step / 2 if (index * index) < num: prox = True else: prox = False print("Result: [", index - 2 * step, ", ", index, "] with percision of +/-", step)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 38434, 421, 9160, 9874, 10312, 198, 2, 4149, 198, 22510, 796, 493, 7, 15414, 7203, 15057, 284, 1064, 262, 19862, 17034, 286, 30, 366, 4008, 198, 198, 9630, 796, 657, 198,...
2.333333
186
import pandas as pd import os import random if __name__ == '__main__': data = MakeDataset(path=r'D:\GitRepos\EIC\MathmaticalModeling\HUST-EIC-MathematicalModeling\final\NerualNetworks\Data\Preprocessed_original.xlsx')
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 28686, 198, 11748, 4738, 628, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1366, 796, 6889, 27354, 292, 316, 7, 6978, 28, 81, 6, 35, ...
2.549451
91
from math import sqrt from numpy import matrix from intpm import intpm A = matrix([[1, 0, 1, 0], [0, 1, 0, 1]]) b = matrix([1, 1]).T c = matrix([-1, -2, 0, 0]).T mu = 100 x1 = 0.5 * (-2 * mu + 1 + sqrt(1 + 4*mu*mu)) x2 = 0.5 * (-mu + 1 + sqrt(1 + mu * mu)) x0 = matrix([x1, x2, 1 - x1, 1 - x2]).T intpm(A, b, c, x0, mu)
[ 6738, 10688, 1330, 19862, 17034, 198, 6738, 299, 32152, 1330, 17593, 198, 6738, 493, 4426, 1330, 493, 4426, 198, 198, 32, 796, 17593, 26933, 58, 16, 11, 657, 11, 352, 11, 657, 4357, 685, 15, 11, 352, 11, 657, 11, 352, 11907, 8, 19...
1.987805
164
import psycopg2 # encoding=utf-8 __author__ = 'Hinsteny' def select_data(conn): ''' :param conn: :return: ''' cur = conn.cursor() cur.execute("SELECT id, name, address, salary from COMPANY ORDER BY id ASC;") rows = cur.fetchall() for row in rows: print("ID = ", row[0]) print("NAME = ", row[1]) print("ADDRESS = ", row[2]) print("SALARY = ", row[3], "\n") print("Operation done successfully") conn.close() pass # Do test if __name__ == "__main__": create_table(get_conn()) insert_data(get_conn()) select_data(get_conn()) update_data(get_conn()) delete_data(get_conn()) pass
[ 11748, 17331, 22163, 70, 17, 198, 198, 2, 21004, 28, 40477, 12, 23, 198, 834, 9800, 834, 796, 705, 39, 8625, 28558, 6, 628, 628, 198, 198, 4299, 2922, 62, 7890, 7, 37043, 2599, 198, 220, 220, 220, 705, 7061, 628, 220, 220, 220, ...
2.296667
300
# # PySNMP MIB module DHCP-Server-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DHCP-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:31:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint") dlink_common_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-common-mgmt") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, ModuleIdentity, Counter32, Counter64, ObjectIdentity, MibIdentifier, IpAddress, NotificationType, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Integer32, iso, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "Counter32", "Counter64", "ObjectIdentity", "MibIdentifier", "IpAddress", "NotificationType", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Integer32", "iso", "TimeTicks") TextualConvention, RowStatus, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "MacAddress", "DisplayString") swDHCPServerMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 12, 38)) if mibBuilder.loadTexts: swDHCPServerMIB.setLastUpdated('200706080000Z') if mibBuilder.loadTexts: swDHCPServerMIB.setOrganization('D-Link Crop.') swDHCPServerCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 1)) swDHCPServerInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 2)) swDHCPServerMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3)) swDHCPServerPoolMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2)) swDHCPServerBindingMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4)) swDHCPServerState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerState.setStatus('current') swDHCPServerPingPktNumber = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPingPktNumber.setStatus('current') swDHCPServerPingTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 2000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPingTimeOut.setStatus('current') swDHCPServerExcludedAddressTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1), ) if mibBuilder.loadTexts: swDHCPServerExcludedAddressTable.setStatus('current') swDHCPServerExcludedAddressEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerExcludedAddressBegin"), (0, "DHCP-Server-MIB", "swDHCPServerExcludedAddressEnd")) if mibBuilder.loadTexts: swDHCPServerExcludedAddressEntry.setStatus('current') swDHCPServerExcludedAddressBegin = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerExcludedAddressBegin.setStatus('current') swDHCPServerExcludedAddressEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerExcludedAddressEnd.setStatus('current') swDHCPServerExcludedAddressStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerExcludedAddressStatus.setStatus('current') swDHCPServerPoolTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1), ) if mibBuilder.loadTexts: swDHCPServerPoolTable.setStatus('current') swDHCPServerPoolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerPoolName")) if mibBuilder.loadTexts: swDHCPServerPoolEntry.setStatus('current') swDHCPServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerPoolName.setStatus('current') swDHCPServerPoolNetworkAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetworkAddress.setStatus('current') swDHCPServerPoolNetworkAddressMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetworkAddressMask.setStatus('current') swDHCPServerPoolDomainName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolDomainName.setStatus('current') swDHCPServerPoolNetBIOSNodeType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("broadcast", 1), ("peer-to-peer", 2), ("mixed", 3), ("hybid", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetBIOSNodeType.setStatus('current') swDHCPServerPoolLeaseState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("predefined", 1), ("infinite", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseState.setStatus('current') swDHCPServerPoolLeaseDay = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 365))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseDay.setStatus('current') swDHCPServerPoolLeaseHour = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 23))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseHour.setStatus('current') swDHCPServerPoolLeaseMinute = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 59))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseMinute.setStatus('current') swDHCPServerPoolBootFile = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolBootFile.setStatus('current') swDHCPServerPoolNextServer = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNextServer.setStatus('current') swDHCPServerPoolStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 12), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerPoolStatus.setStatus('current') swDHCPServerDNSServerAddressTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2), ) if mibBuilder.loadTexts: swDHCPServerDNSServerAddressTable.setStatus('current') swDHCPServerDNSServerAddressEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerDNSServerPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerDNSServerAddressIndex")) if mibBuilder.loadTexts: swDHCPServerDNSServerAddressEntry.setStatus('current') swDHCPServerDNSServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDNSServerPoolName.setStatus('current') swDHCPServerDNSServerAddressIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDNSServerAddressIndex.setStatus('current') swDHCPServerDNSServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerDNSServerAddress.setStatus('current') swDHCPServerDNSServerAddressStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerDNSServerAddressStatus.setStatus('current') swDHCPServerNetBIOSNameServerTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3), ) if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerTable.setStatus('current') swDHCPServerNetBIOSNameServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerNetBIOSNameServerPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerNetBIOSNameServerIndex")) if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerEntry.setStatus('current') swDHCPServerNetBIOSNameServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerPoolName.setStatus('current') swDHCPServerNetBIOSNameServerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerIndex.setStatus('current') swDHCPServerNetBIOSNameServer = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServer.setStatus('current') swDHCPServerNetBIOSNameServerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerStatus.setStatus('current') swDHCPServerDefaultRouterTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4), ) if mibBuilder.loadTexts: swDHCPServerDefaultRouterTable.setStatus('current') swDHCPServerDefaultRouterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerDefaultRouterPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerDefaultRouterIndex")) if mibBuilder.loadTexts: swDHCPServerDefaultRouterEntry.setStatus('current') swDHCPServerDefaultRouterPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDefaultRouterPoolName.setStatus('current') swDHCPServerDefaultRouterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDefaultRouterIndex.setStatus('current') swDHCPServerDefaultRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerDefaultRouter.setStatus('current') swDHCPServerDefaultRouterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerDefaultRouterStatus.setStatus('current') swDHCPServerManualBindingTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3), ) if mibBuilder.loadTexts: swDHCPServerManualBindingTable.setStatus('current') swDHCPServerManualBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerManualBindingPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerManualBindingIpAddress")) if mibBuilder.loadTexts: swDHCPServerManualBindingEntry.setStatus('current') swDHCPServerManualBindingPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerManualBindingPoolName.setStatus('current') swDHCPServerManualBindingIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerManualBindingIpAddress.setStatus('current') swDHCPServerManualBindingHardwareAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 3), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingHardwareAddress.setStatus('current') swDHCPServerManualBindingType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ethernet", 1), ("ieee802", 2), ("both", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingType.setStatus('current') swDHCPServerManualBindingStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingStatus.setStatus('current') swDHCPServerBindingTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4), ) if mibBuilder.loadTexts: swDHCPServerBindingTable.setStatus('current') swDHCPServerBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerBindingPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerBindingIpAddress")) if mibBuilder.loadTexts: swDHCPServerBindingEntry.setStatus('current') swDHCPServerBindingPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingPoolName.setStatus('current') swDHCPServerBindingIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingIpAddress.setStatus('current') swDHCPServerBindingHardwareAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 3), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingHardwareAddress.setStatus('current') swDHCPServerBindingType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("iee802", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingType.setStatus('current') swDHCPServerBindingStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("manual", 1), ("automatic", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingStatus.setStatus('current') swDHCPServerBindingLifeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingLifeTime.setStatus('current') swDHCPServerBindingClearState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("none", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerBindingClearState.setStatus('current') swDHCPServerConflictIPTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5), ) if mibBuilder.loadTexts: swDHCPServerConflictIPTable.setStatus('current') swDHCPServerConflictIPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerConflictIPIPAddress")) if mibBuilder.loadTexts: swDHCPServerConflictIPEntry.setStatus('current') swDHCPServerConflictIPIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPIPAddress.setStatus('current') swDHCPServerConflictIPDetectionMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ping", 1), ("gratuitous-arp", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPDetectionMethod.setStatus('current') swDHCPServerConflictIPDetectionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPDetectionTime.setStatus('current') swDHCPServerConflictIPClearState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("none", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerConflictIPClearState.setStatus('current') mibBuilder.exportSymbols("DHCP-Server-MIB", swDHCPServerPoolName=swDHCPServerPoolName, swDHCPServerExcludedAddressEntry=swDHCPServerExcludedAddressEntry, swDHCPServerExcludedAddressEnd=swDHCPServerExcludedAddressEnd, swDHCPServerBindingMgmt=swDHCPServerBindingMgmt, swDHCPServerNetBIOSNameServerIndex=swDHCPServerNetBIOSNameServerIndex, swDHCPServerPoolTable=swDHCPServerPoolTable, swDHCPServerDefaultRouterStatus=swDHCPServerDefaultRouterStatus, swDHCPServerPoolNetBIOSNodeType=swDHCPServerPoolNetBIOSNodeType, swDHCPServerPoolLeaseState=swDHCPServerPoolLeaseState, swDHCPServerDefaultRouterTable=swDHCPServerDefaultRouterTable, swDHCPServerManualBindingTable=swDHCPServerManualBindingTable, swDHCPServerBindingLifeTime=swDHCPServerBindingLifeTime, swDHCPServerManualBindingType=swDHCPServerManualBindingType, swDHCPServerDNSServerAddress=swDHCPServerDNSServerAddress, swDHCPServerDefaultRouterIndex=swDHCPServerDefaultRouterIndex, swDHCPServerConflictIPTable=swDHCPServerConflictIPTable, swDHCPServerBindingPoolName=swDHCPServerBindingPoolName, swDHCPServerPingTimeOut=swDHCPServerPingTimeOut, swDHCPServerExcludedAddressBegin=swDHCPServerExcludedAddressBegin, swDHCPServerPoolMgmt=swDHCPServerPoolMgmt, swDHCPServerNetBIOSNameServerTable=swDHCPServerNetBIOSNameServerTable, swDHCPServerConflictIPDetectionMethod=swDHCPServerConflictIPDetectionMethod, swDHCPServerNetBIOSNameServerEntry=swDHCPServerNetBIOSNameServerEntry, swDHCPServerExcludedAddressTable=swDHCPServerExcludedAddressTable, swDHCPServerPoolNetworkAddressMask=swDHCPServerPoolNetworkAddressMask, swDHCPServerDNSServerAddressTable=swDHCPServerDNSServerAddressTable, swDHCPServerExcludedAddressStatus=swDHCPServerExcludedAddressStatus, swDHCPServerPingPktNumber=swDHCPServerPingPktNumber, swDHCPServerMgmt=swDHCPServerMgmt, swDHCPServerNetBIOSNameServerPoolName=swDHCPServerNetBIOSNameServerPoolName, swDHCPServerDefaultRouterEntry=swDHCPServerDefaultRouterEntry, swDHCPServerBindingEntry=swDHCPServerBindingEntry, swDHCPServerManualBindingPoolName=swDHCPServerManualBindingPoolName, swDHCPServerDefaultRouter=swDHCPServerDefaultRouter, swDHCPServerManualBindingHardwareAddress=swDHCPServerManualBindingHardwareAddress, swDHCPServerPoolLeaseMinute=swDHCPServerPoolLeaseMinute, swDHCPServerBindingType=swDHCPServerBindingType, swDHCPServerBindingClearState=swDHCPServerBindingClearState, swDHCPServerDNSServerPoolName=swDHCPServerDNSServerPoolName, swDHCPServerManualBindingIpAddress=swDHCPServerManualBindingIpAddress, swDHCPServerBindingHardwareAddress=swDHCPServerBindingHardwareAddress, swDHCPServerConflictIPEntry=swDHCPServerConflictIPEntry, swDHCPServerInfo=swDHCPServerInfo, swDHCPServerState=swDHCPServerState, PYSNMP_MODULE_ID=swDHCPServerMIB, swDHCPServerCtrl=swDHCPServerCtrl, swDHCPServerPoolLeaseHour=swDHCPServerPoolLeaseHour, swDHCPServerDNSServerAddressEntry=swDHCPServerDNSServerAddressEntry, swDHCPServerNetBIOSNameServer=swDHCPServerNetBIOSNameServer, swDHCPServerBindingIpAddress=swDHCPServerBindingIpAddress, swDHCPServerBindingStatus=swDHCPServerBindingStatus, swDHCPServerPoolBootFile=swDHCPServerPoolBootFile, swDHCPServerPoolStatus=swDHCPServerPoolStatus, swDHCPServerPoolDomainName=swDHCPServerPoolDomainName, swDHCPServerManualBindingEntry=swDHCPServerManualBindingEntry, swDHCPServerConflictIPClearState=swDHCPServerConflictIPClearState, swDHCPServerBindingTable=swDHCPServerBindingTable, swDHCPServerManualBindingStatus=swDHCPServerManualBindingStatus, swDHCPServerMIB=swDHCPServerMIB, swDHCPServerPoolNextServer=swDHCPServerPoolNextServer, swDHCPServerConflictIPIPAddress=swDHCPServerConflictIPIPAddress, swDHCPServerNetBIOSNameServerStatus=swDHCPServerNetBIOSNameServerStatus, swDHCPServerDNSServerAddressStatus=swDHCPServerDNSServerAddressStatus, swDHCPServerDefaultRouterPoolName=swDHCPServerDefaultRouterPoolName, swDHCPServerPoolEntry=swDHCPServerPoolEntry, swDHCPServerPoolNetworkAddress=swDHCPServerPoolNetworkAddress, swDHCPServerPoolLeaseDay=swDHCPServerPoolLeaseDay, swDHCPServerConflictIPDetectionTime=swDHCPServerConflictIPDetectionTime, swDHCPServerDNSServerAddressIndex=swDHCPServerDNSServerAddressIndex)
[ 2, 198, 2, 9485, 15571, 7378, 337, 9865, 8265, 43729, 12, 10697, 12, 8895, 33, 357, 4023, 1378, 16184, 76, 489, 8937, 13, 785, 14, 79, 893, 11632, 8, 198, 2, 7054, 45, 13, 16, 2723, 2393, 1378, 14, 14490, 14, 67, 615, 47562, 19,...
2.671547
7,992
from cv_utils.object_detection.dataset.converter import coco_to_yolo from cv_utils.object_detection.dataset.converter import yolo_to_coco ''' COCO --> YOLO This code uses the ultralytics/yolov5 format. The converted dataset will be saved as follow: - {output_folder} - images - {output_set_name} - {image_1} - {image_2} - ... - labels - {output_set_name} - {image_1} - {image_2} - ... - classes.txt ''' for set_name in ["train", "test", "val"]: coco_to_yolo( coco_annotation_path = f"demo/dataset/fasciola_ori/annotations/instances_{set_name}.json", coco_image_dir = f"demo/dataset/fasciola_ori/{set_name}", output_image_dir = f"demo/dataset/fasciola_yolo/images/{set_name}", output_label_dir = f"demo/dataset/fasciola_yolo/labels/{set_name}", output_category_path = f"demo/dataset/fasciola_yolo/classes.txt" ) '''YOLO --> COCO This code uses the ultralytics/yolov5 format: - {yolo_image_dir} - {image_1} - {image_2} - ... - {yolo_label_dir} - {image_1} - {image_2} - ... ''' for set_name in ["train", "test", "val"]: yolo_to_coco( yolo_image_dir = f"demo/dataset/fasciola_yolo/images/{set_name}", yolo_label_dir = f"demo/dataset/fasciola_yolo/labels/{set_name}", yolo_class_file = "demo/dataset/fasciola_yolo/classes.txt", coco_image_dir = f"demo/dataset/fasciola_coco/{set_name}", coco_annotation_path = f"demo/dataset/fasciola_coco/annotations/instances_{set_name}.json" )
[ 6738, 269, 85, 62, 26791, 13, 15252, 62, 15255, 3213, 13, 19608, 292, 316, 13, 1102, 332, 353, 1330, 8954, 78, 62, 1462, 62, 88, 14057, 198, 6738, 269, 85, 62, 26791, 13, 15252, 62, 15255, 3213, 13, 19608, 292, 316, 13, 1102, 332,...
1.954878
820
from django.db import models from django.contrib import admin from .country import Country from .filter import Filter from .setting import Setting from .site import Site
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 198, 6738, 764, 19315, 1330, 12946, 198, 6738, 764, 24455, 1330, 25853, 198, 6738, 764, 33990, 1330, 25700, 198, 6738, 764, 15654, 1330, ...
4.046512
43
# -*- coding: utf-8 -*- # Copyright 2017 Chris Meyers <cmeyers@ansible.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import pytest from ansible import constants as C from ansible.errors import AnsibleError from ansible.plugins.loader import PluginLoader from ansible.compat.tests import mock from ansible.compat.tests import unittest from ansible.module_utils._text import to_bytes, to_native
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 15069, 2177, 5180, 2185, 21200, 1279, 66, 1326, 21200, 31, 504, 856, 13, 785, 29, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 28038, 856, 198, 2, 198, 2, 280...
3.553459
318
import time from flask import render_template, flash, redirect, url_for from flask.globals import request from flask_login.utils import logout_user from werkzeug.urls import url_parse # from flask.helpers import flash # from app import app, db # app initapp from app.forms import LoginForm, RegistrationForm from flask_login import current_user, login_user, login_required from app.models import User
[ 11748, 640, 198, 6738, 42903, 1330, 8543, 62, 28243, 11, 7644, 11, 18941, 11, 19016, 62, 1640, 198, 6738, 42903, 13, 4743, 672, 874, 1330, 2581, 198, 6738, 42903, 62, 38235, 13, 26791, 1330, 2604, 448, 62, 7220, 198, 6738, 266, 9587, ...
3.616071
112
import math from collections import OrderedDict import json from asr_deepspeech.decoders import GreedyDecoder import os from ascii_graph import Pyasciigraph from asr_deepspeech.data.loaders import AudioDataLoader from asr_deepspeech.data.samplers import BucketingSampler from .blocks import * from asr_deepspeech.data.dataset import SpectrogramDataset from argparse import Namespace from zakuro import hub
[ 11748, 10688, 198, 6738, 17268, 1330, 14230, 1068, 35, 713, 198, 11748, 33918, 198, 6738, 355, 81, 62, 22089, 45862, 13, 12501, 375, 364, 1330, 11955, 4716, 10707, 12342, 198, 11748, 28686, 198, 6738, 355, 979, 72, 62, 34960, 1330, 9485...
3.440678
118
n,k = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] arr.sort() total = 0 for i in range(k): if arr[i] < 0: total += -arr[i] print(total)
[ 77, 11, 74, 796, 685, 600, 7, 87, 8, 329, 2124, 287, 5128, 22446, 35312, 3419, 60, 198, 3258, 796, 685, 600, 7, 87, 8, 329, 2124, 287, 5128, 22446, 35312, 3419, 60, 198, 198, 3258, 13, 30619, 3419, 198, 198, 23350, 796, 657, 198...
2.105882
85
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\ensemble\ensemble_interactions.py # Compiled at: 2016-07-13 03:28:12 # Size of source mod 2**32: 1070 bytes from objects.base_interactions import ProxyInteraction from sims4.utils import classproperty, flexmethod
[ 2, 34318, 2349, 21, 2196, 513, 13, 22, 13, 19, 198, 2, 11361, 18022, 8189, 513, 13, 22, 357, 2091, 5824, 8, 198, 2, 4280, 3361, 3902, 422, 25, 11361, 513, 13, 22, 13, 24, 357, 31499, 14, 85, 18, 13, 22, 13, 24, 25, 1485, 66,...
2.751592
157
import socket from typing import Optional, List __version__ = '0.1.0'
[ 198, 11748, 17802, 198, 6738, 19720, 1330, 32233, 11, 7343, 628, 198, 834, 9641, 834, 796, 705, 15, 13, 16, 13, 15, 6, 628, 198 ]
3
25
"""Game map resource manager.""" __all__ = ("get_map_template",) _cache = {} def get_map_template(name: str): """ Get a map template by its ``name``. Returns ``None`` if not found. Loaded :class:`MapTemplate` will be cached until the application exits. :param name: name of the map template. :return: map template object if found """ if name not in _cache: # On-demand import & avoid circular import from game.pkchess.map import MapTemplate _cache[name] = MapTemplate.load_from_file(f"game/pkchess/res/map/{name}") return _cache[name]
[ 37811, 8777, 3975, 8271, 4706, 526, 15931, 198, 834, 439, 834, 796, 5855, 1136, 62, 8899, 62, 28243, 1600, 8, 198, 198, 62, 23870, 796, 23884, 628, 198, 4299, 651, 62, 8899, 62, 28243, 7, 3672, 25, 965, 2599, 198, 220, 220, 220, 3...
2.740909
220
from evaluation_framework.manager import FrameworkManager if __name__ == "__main__": evaluation_manager = FrameworkManager() evaluation_manager.evaluate( "objectFrequencyS.h5", vector_file_format="hdf5", debugging_mode=False )
[ 6738, 12660, 62, 30604, 13, 37153, 1330, 25161, 13511, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 12660, 62, 37153, 796, 25161, 13511, 3419, 198, 220, 220, 220, 12660, 62, 37153, 13, 49786, ...
3.1
80
from django.conf import settings from django.contrib import messages as django_messages from django.urls import reverse_lazy from django.utils.decorators import method_decorator from django.views.decorators.http import require_POST from django.views.generic.base import RedirectView, TemplateView from django.views.generic.edit import CreateView, FormView from raven.contrib.django.raven_compat.models import client as raven_client from common.mixins import PrivateMixin from common.utils import get_source_labels from private_sharing.models import ( ActivityFeed, DataRequestProject, DataRequestProjectMember, id_label_to_project, ) from .forms import ConsentForm from .models import PublicDataAccess, WithdrawalFeedback
[ 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 6218, 355, 42625, 14208, 62, 37348, 1095, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 9575, 62, 75, 12582, 198, 6738, 42625, 14208, 13, 26791, 13,...
3.410959
219
from MakeYourOwnGraph import * #user needs to import this line GraphOfMyAlgo(F1,2,[1,30,2,31]) #user needs to execute this line in his or her algorithm where the first argument is the name of the Algorithm Function, here F1 #the Second argument is the number of arguments that the algorithm of the user inputs #the third argument is an array of ranges, namely beginning value of range, ending value of range_for_first_argument, beginning value of range_for_second_argument, ending value of range_for_second_argument and so on
[ 6738, 6889, 7120, 23858, 37065, 1330, 1635, 1303, 7220, 2476, 284, 1330, 428, 1627, 628, 198, 37065, 5189, 3666, 2348, 2188, 7, 37, 16, 11, 17, 17414, 16, 11, 1270, 11, 17, 11, 3132, 12962, 1303, 7220, 2476, 284, 12260, 428, 1627, 2...
3.046392
194
# The new robopilot training pipeline.
[ 2, 383, 649, 3857, 404, 23439, 3047, 11523, 13 ]
4.222222
9
import sys from PySide2 import QtCore from PySide2 import QtWidgets from shiboken2 import wrapInstance import maya.OpenMayaUI as omui def mayaMainWindow(): """ Get maya main window as QWidget :return: Maya main window as QWidget :rtype: PySide2.QtWidgets.QWidget """ mainWindowPtr = omui.MQtUtil.mainWindow() if mainWindowPtr: if sys.version_info[0] < 3: return wrapInstance(long(mainWindowPtr), QtWidgets.QWidget) # noqa: F821 else: return wrapInstance(int(mainWindowPtr), QtWidgets.QWidget) else: mayaMainWindow()
[ 11748, 25064, 198, 6738, 9485, 24819, 17, 1330, 33734, 14055, 198, 6738, 9485, 24819, 17, 1330, 33734, 54, 312, 11407, 198, 6738, 427, 571, 4233, 17, 1330, 14441, 33384, 198, 11748, 743, 64, 13, 11505, 6747, 64, 10080, 355, 39030, 9019,...
2.404
250
import math from django import template from django.utils.safestring import mark_safe register = template.Library()
[ 11748, 10688, 198, 198, 6738, 42625, 14208, 1330, 11055, 198, 6738, 42625, 14208, 13, 26791, 13, 49585, 395, 1806, 1330, 1317, 62, 21230, 628, 198, 30238, 796, 11055, 13, 23377, 3419, 628, 198 ]
3.666667
33
import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) create_lists_of_users()
[ 11748, 269, 21370, 198, 198, 4480, 1280, 10786, 5239, 82, 13, 40664, 3256, 705, 81, 11537, 355, 277, 25, 198, 220, 220, 220, 9173, 796, 269, 21370, 13, 46862, 7, 69, 8, 198, 220, 220, 220, 13399, 796, 1351, 7, 46862, 8, 198, 198, ...
2.276596
94
""" [1,2,3,4] 16 . [] [1] [1, 2] [1, 2, 3] [1, 2, 3, 4] [1, 2, 4] [1, 3] [1, 3, 4] [1, 4] [2] [2, 3] [2, 3, 4] [2, 4] [3] [3, 4] [4] blank list([]) 0 (subarray sum) 80. , . Input . . Output . Sample Input 1 3 26 -14 12 4 -2 Sample Output 1 928 """ ###################### # sorting step makes it very hard when it comes to computation time. # infact, it wasn't the sorting -- it was the range(n) --> range(i, n) that made a difference # different approach: # just sum it as you iterate arr = list(map(int, input().split())) n = len(arr) total = 0 subarraySum() print(total)
[ 37811, 198, 58, 16, 11, 17, 11, 18, 11, 19, 60, 220, 220, 220, 220, 1467, 764, 198, 198, 21737, 198, 58, 16, 60, 198, 58, 16, 11, 362, 60, 198, 58, 16, 11, 362, 11, 513, 60, 198, 58, 16, 11, 362, 11, 513, 11, 604, 60, 19...
2.147887
284
"""Command line interface to the fastlite package """ import sys import argparse from .fastalite import fastalite, fastqlite, Opener from . import __version__ if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
[ 37811, 21575, 1627, 7071, 284, 262, 3049, 36890, 5301, 198, 198, 37811, 198, 198, 11748, 25064, 198, 11748, 1822, 29572, 198, 6738, 764, 7217, 282, 578, 1330, 3049, 282, 578, 11, 3049, 13976, 578, 11, 8670, 877, 198, 6738, 764, 1330, ...
2.935065
77
""" *Major Key* """ from abc import ABCMeta from ._key import ModedKey
[ 37811, 628, 220, 220, 220, 1635, 24206, 7383, 9, 198, 198, 37811, 198, 198, 6738, 450, 66, 1330, 9738, 48526, 198, 198, 6738, 47540, 2539, 1330, 3401, 276, 9218, 628 ]
2.666667
30
"""Simple python clients for the Gravitate BestBuy Services""" __version__ = "0.1.18" from .fc import get_fc_service from .ims import get_ims_service
[ 37811, 26437, 21015, 7534, 329, 262, 32599, 12027, 6705, 14518, 6168, 37811, 198, 198, 834, 9641, 834, 796, 366, 15, 13, 16, 13, 1507, 1, 198, 6738, 764, 16072, 1330, 651, 62, 16072, 62, 15271, 198, 6738, 764, 12078, 1330, 651, 62, ...
3.282609
46
#!/usr/bin/python3 # -*- coding: utf-8 -*- from libGamePiratesAndFishers import assertIfIsWeelFormat,makeSureThatIsnumberLimited
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 9195, 8777, 46772, 689, 1870, 37, 39116, 1330, 6818, 1532, 3792, 1135, 417, 26227, 11, 15883, 19457, 2504, 3792...
2.804348
46
#!/usr/bin/env python3 """ Author : FabrizioPe Date : 2021-02-10 Purpose: Find and replace vowels in a given text """ import argparse import os # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( description='Apples and bananas', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('str', metavar='str', help='Input text or file') parser.add_argument('-v', '--vowel', help='The vowel to substitute', metavar='str', choices='aeiou', type=str, default='a') args = parser.parse_args() # but will this file remain open? if os.path.isfile(args.str): args.str = open(args.str).read().rstrip() return args # -------------------------------------------------- def main(): """Make a jazz noise here""" args = get_args() text = args.str vowel = args.vowel table = {'a': vowel, 'e': vowel, 'i': vowel, 'o': vowel, 'u': vowel, 'A': vowel.upper(), 'E': vowel.upper(), 'I': vowel.upper(), 'O': vowel.upper(), 'U': vowel.upper()} # apply the transformation defined in the table, to the input text print(text.translate(str.maketrans(table))) # -------------------------------------------------- if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 198, 13838, 1058, 14236, 47847, 952, 6435, 198, 10430, 220, 220, 1058, 33448, 12, 2999, 12, 940, 198, 30026, 3455, 25, 9938, 290, 6330, 23268, 1424, 287, 257, 1813, 2420, 19...
2.325301
664
import pandas as pd from openpyxl import worksheet def format_name(name: str) -> str: """ Limpa espaos antes e depois da palavra Nome em caps lock para evitar case sensitive """ name = name.strip() name = name.upper() return name
[ 11748, 19798, 292, 355, 279, 67, 198, 6738, 1280, 9078, 87, 75, 1330, 2499, 25473, 628, 198, 198, 4299, 5794, 62, 3672, 7, 3672, 25, 965, 8, 4613, 965, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 7576, 8957, 15024, 7495, 18...
2.64
100
from django.core.mail import send_mail from django.http import Http404 from django.shortcuts import render, redirect from django.contrib import messages from django.contrib.auth.models import User from django.utils.datastructures import MultiValueDictKeyError from django.utils import timezone from django.contrib.auth import login, logout from django import urls import copy # from django.contrib.auth.hashers import make_password, check_password, is_password_usable # from datetime import datetime from django.views.generic import DetailView from CheekLit import settings from .utils import get_code, is_administrator, should_show_price from .models import Client, Book, Author, Genre, Basket, Status, SliderImages from .forms import ClientRegisterForm, ClientAuthorizationForm from .settings import time_for_registration # class BookDetailView(DetailView): # queryset = Book.objects.all() # model = Book # context_object_name = 'book' # template_name = 'book_detail.html' # slug_url_kwarg = 'slug' # # def post(self, request, *args, **kwargs): # pass # # context = super().get_context_data(object=self.object) # # return super().render_to_response(context) def register(request): if request.method == 'POST': form = ClientRegisterForm(data=request.POST) if form.is_valid(): client, raw_pass = form.save() confirmation_url = request.META["HTTP_HOST"] + urls.reverse( register_complete) + f'?login={client.user.email}&code={get_code(client.user.email, "abs", 20)}' email_message = f''', {client.user.last_name} {client.user.first_name}! CheekLit. : : {client.user.email} : {raw_pass} ! ! : {confirmation_url} , , {(timezone.localtime() + time_for_registration).strftime('%H:%M %d.%m.%Y')}. . , CheekLit''' send_mail( f' {request.META["HTTP_HOST"]}', email_message, 'CheekLitBot@gmail.com', [client.user.email], fail_silently=False, ) messages.success(request, ' , ') return redirect('home') else: messages.error(request, ' ') else: form = ClientRegisterForm() return render(request, 'register.html', {'form': form, 'genres': Genre.objects.all(), 'authors': Author.objects.all()}) def register_complete(request): try: email = request.GET['login'] code = request.GET['code'].replace(' ', '+') if get_code(email, 'abs', 20) == code: # Delete outdated clients User.objects.filter(date_joined__lt=timezone.localtime() - time_for_registration, is_active=False, is_staff=False, is_superuser=False).delete() try: if User.objects.get(email=email).is_active is True: messages.warning(request, ' ') else: messages.success(request, ' , ') User.objects.filter(email=email).update(is_active=True) return redirect('authorize') except User.DoesNotExist: messages.error(request, ' ') else: messages.error(request, f' code ') except MultiValueDictKeyError as e: messages.error(request, f' {e.args}') return redirect('home') def authorize(request): if request.method == 'POST': form = ClientAuthorizationForm(data=request.POST) if form.is_valid(): client = form.get_user() login(request, client) messages.success(request, f' , {client.last_name} {client.first_name}') return redirect('home') else: messages.error(request, ' ') else: form = ClientAuthorizationForm() return render(request, 'authorize.html', {'form': form, 'genres': Genre.objects.all(), 'authors': Author.objects.all()}) def client_logout(request): logout(request) return redirect('home') def useful_information(request): return render(request, 'useful_information.html') def about_us(request): return render(request, 'about_us.html') def contact(request): return render(request, 'contact.html') def basket(request): if request.user.is_authenticated: if is_administrator(request.user): raise Http404('Administration does not have a basket') client = request.user.client_set.get() current_basket, is_created = client.baskets.get_or_create(status=Status.IN_PROCESS) if not should_show_price(request.user): current_basket.books.clear() if request.method == 'POST': if 'delete_book' in request.GET: current_basket.books.remove(request.GET['delete_book']) if 'clear' in request.GET: saved_basket = copy.copy(current_basket) saved_basket.status = Status.ABANDONED Basket.objects.filter(client=client, status=Status.ABANDONED).delete() saved_basket.save() client.baskets.add(saved_basket) current_basket.books.clear() # client.baskets.create(status=Status.ABANDONED, ) if 'restore' in request.GET: try: client.baskets.get(status=Status.ABANDONED) except Basket.DoesNotExist: raise Http404('Not found abandoned basket') client.baskets.filter(status=Status.IN_PROCESS).delete() client.baskets.filter(status=Status.ABANDONED).update(status=Status.IN_PROCESS) current_basket = client.baskets.get(status=Status.IN_PROCESS) return render(request, 'basket.html', {'BookModel': Book, 'books_in_basket': current_basket.books.all()}) else: raise Http404('User is not authenticated') def order(request): if request.user.is_authenticated and should_show_price(request.user): if is_administrator(request.user): raise Http404('Administration does not have a basket') client = request.user.client_set.get() current_basket, is_created = client.baskets.get_or_create(status=Status.IN_PROCESS) current_basket.status = Status.ON_HANDS current_basket.date_of_taking = timezone.now() current_basket.save() return render(request, 'order.html') else: raise Http404('User is not authenticated')
[ 6738, 42625, 14208, 13, 7295, 13, 4529, 1330, 3758, 62, 4529, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 26429, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 18941, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 62...
2.256674
2,922
def fixAnchorMidroll(newAdDuration=61, oldAdDuration=0): '''For fixing issue #8: https://github.com/critrolesync/critrolesync.github.io/issues/8''' anchor_podcast_episodes = data[1]['episodes'][19:] for ep in anchor_podcast_episodes: if 'timestampsBitrate' in ep: # need to adjust for new bitrate bitrateRatio = 128/127.7 else: # do need to adjust for bitrate bitrateRatio = 1 print(ep['id']) print() print(' "timestamps": [') for i, (youtube, podcast, comment) in enumerate(ep['timestamps']): if i<2: # before break podcast_new = sec2str(str2sec(podcast)*bitrateRatio) else: # after break podcast_new = sec2str((str2sec(podcast)-oldAdDuration+newAdDuration)*bitrateRatio) if i<len(ep['timestamps'])-1: # include final comma print(f' ["{youtube}", "{podcast_new}", "{comment}"],') else: # no final comma print(f' ["{youtube}", "{podcast_new}", "{comment}"]') print(' ]') print() print()
[ 198, 4299, 4259, 2025, 354, 273, 22622, 2487, 7, 3605, 2782, 26054, 28, 5333, 11, 1468, 2782, 26054, 28, 15, 2599, 198, 220, 220, 220, 705, 7061, 1890, 18682, 2071, 1303, 23, 25, 3740, 1378, 12567, 13, 785, 14, 22213, 305, 829, 1336...
1.96732
612
# Adafruit CircuitPython 2.2.0 # Adafruit CircuitPlayground Express import board ; import neopixel; import time pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.2) pixels.fill((0,0,0)) pixels.show() blue(); pixels.show(); time.sleep(0.7); magenta(); pixels.show(); time.sleep(1.4); pixels.fill((0,0,0)); pixels.show()
[ 2, 1215, 1878, 4872, 13588, 37906, 362, 13, 17, 13, 15, 198, 2, 1215, 1878, 4872, 13588, 11002, 2833, 10604, 198, 198, 11748, 3096, 2162, 1330, 497, 404, 7168, 26, 1330, 640, 198, 79, 14810, 796, 497, 404, 7168, 13, 8199, 78, 40809,...
2.601563
128
# Generated by Django 2.1.15 on 2021-03-15 15:04 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 16, 13, 1314, 319, 33448, 12, 3070, 12, 1314, 1315, 25, 3023, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.875
32