text
stringlengths
2
999k
""" Transforms data into the final output data """ import json import logging LOGGER = logging.getLogger(__name__) def transform(data): """ Applies simple transformation to the data Expects data: raw_data = { "intValue": "42", "floatValue": "3.14159265358979", "...
""" WSGI config for server project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTIN...
from Assembler.InstructionTable import * from Base.ZeroBase import * from GameData.ItemNameMap import * def GetOpCode(fs): return fs.ReadByte() def WriteOpCode(fs, op): return fs.WriteByte(op) edao_op_table = InstructionTable(GetOpCode, WriteOpCode, DefaultGetLabelName, CODE_PAGE) InstructionNam...
# rfc1751.py : Converts between 128-bit strings and a human-readable # sequence of words, as defined in RFC1751: "A Convention for # Human-Readable 128-bit Keys", by Daniel L. McDonald. # # Part of the Python Cryptography Toolkit # # Written by Andrew M. Kuchling and others # # =================================...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2017 Rackspace, US 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 a...
import pandas as pd import numpy as np import re def format_books(data_books: pd.DataFrame): """ nettoyer et formatter des données fournant par dataframe: books afin d'avoir un df books tout prête à insérer dans BD *** Params: data_books: dataframe étant chargé de fichier de d...
import argparse from collections import defaultdict, namedtuple from datetime import datetime import gzip import json import logging from operator import itemgetter import pathlib import re from statistics import median DEFAULT_CONFIG_PATH = './config.json' """Default configuration file path""" DEFAULT_CONFIG = { ...
# terrascript/resource/archive.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:11:52 UTC) # # For imports without namespace, e.g. # # >>> import terrascript.resource.archive # # instead of # # >>> import terrascript.resource.hashicorp.archive # # This is only available for 'official' and 'partner'...
print("Let's practice everything.") print('You\'d need to know \'bout escapes with \\ that do:') print('\n new lines and \t tabs') poem = """ \tThe lovely world with logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\twhere there is none. ""...
import base64 import boto3 import json import os import random import re import moto.cognitoidp.models import requests import hmac import hashlib import uuid # noinspection PyUnresolvedReferences import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError, ParamValidationError fro...
# Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
import unittest from codalab.lib.server_util import * import time class ServerUtilTest(unittest.TestCase): def test_rate_limit_not_exceeded(self): sentinel = 23948 @rate_limited(3600) def limited_function(arg): return arg for _ in range(3600): self.asser...
# # (c) 2016 Red Hat Inc. # # 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 d...
import tensorflow as tf from lingvo import model_imports from lingvo import model_registry import numpy as np import scipy.io.wavfile as wav import generate_masking_threshold as generate_mask from tool import Transform, create_features, create_inputs import time from lingvo.core import cluster_factory from absl import ...
# Generated by Django 2.0.2 on 2018-04-24 15:36 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('simple_tracker', '0003_auto_20180424_1234'), ] operations = [ migrations.AlterField( model_name='course', name='code...
import boto3 import pytest import uuid acm = boto3.client("acm") def certificate(): name = "test-%s.binx.io" % uuid.uuid4() alt_name = "test-%s.binx.io" % uuid.uuid4() certificate = acm.request_certificate( DomainName=name, ValidationMethod="DNS", SubjectAlternativeNames=[alt_name] ) retu...
# # PyDBG # Copyright (C) 2006 Pedram Amini <pedram.amini@gmail.com> # # $Id: memory_breakpoint.py 194 2007-04-05 15:31:53Z cameron $ # # This program 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 versi...
from django.urls import path from user import views # Create your views here. app_name = 'user' urlpatterns = [ path('create/', views.CreateUserView.as_view(), name='create'), path('token/', views.CreateTokenView.as_view(), name='token'), path('me/', views.ManageUserView.as_view(), name='me'), ]
''' Query on gender (uncoded) ''' # IMPORTS import sys import json from fasp.search import DiscoverySearchClient def main(argv): searchClient = DiscoverySearchClient('https://ga4gh-search-adapter-presto-public.prod.dnastack.com') query = """select id, patient from kidsfirst.ga4gh_tables.patient where j...
import sys import os sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import lib as bluzelle import time import distutils.util from dotenv import load_dotenv load_dotenv() d = os.getenv('DEBUG', 'false') debug = d == 'm' # 🤔 try: debug = distutils.util.strtobool(d) except Exceptio...
from __future__ import print_function # http://www.packtpub.com/article/writing-a-package-in-python #from builtins import str from future import standard_library standard_library.install_aliases() from setuptools import setup, Command # adapted from Apache libcloud setup.py class DocsCommand(Command): d...
# coding=utf-8 import os import platform import textwrap import pytest import six from conans import tools from conans.client.command import ERROR_INVALID_CONFIGURATION, SUCCESS from conans.tools import Version from conans import __version__ as conan_version from tests.utils.test_cases.conan_client import ConanClient...
# -*- coding: utf-8 -*- """ Mimetypes-related utilities # TODO: reexport stdlib mimetypes? """ import collections import io import logging import re import zipfile __all__ = ['guess_mimetype'] _logger = logging.getLogger(__name__) # We define our own guess_mimetype implementation and if magic is available we # use ...
import nltk nltk.download('punkt') nltk.download('cmudict') nltk.download('stopwords')
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # 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 re...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import frappe.utils import json, jwt import base64 from frappe import _ from frappe.utils.password import get_decrypted_password from six import string_types class ...
import re import codecs fileone = codecs.open("F:/Dropbox/Master/Plenarprotokolle/Annotiert/GermaNER/09036-f-noAnhang-noConll.conll", "r", "utf-8") TextString = fileone.read() #print(TextString) TextList = TextString.splitlines() #print(TextList[28]) # if TextList[28] == "": # print("XS") # a = re.split(" ", TextL...
import unittest import requests class UnitTestsIbanfoxAPI(unittest.TestCase): # https://ibanfox.com/docs/api-reference/#operation/validateIban def test_get_validateIban(self): print('test_get_validateIban') headers = { 'x-api-key': '', } response = requests.get('h...
############################################################################### # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # # LLNL-CODE-716457 # # All rights reserved. # # This file is part of Ascent. # # For details, see: http://asc...
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy, sys import moveit_commander from moveit_commander import MoveGroupCommander from geometry_msgs.msg import Pose from copy import deepcopy class MoveItCartesianDemo: def __init__(self): # 初始化move_group的API moveit_commander.roscpp_initialize...
import inspect, os, sys, yaml import simplejson as json import reddit.connection import app.controllers.front_page_controller import app.controllers.subreddit_controller import app.controllers.comment_controller import app.controllers.moderator_controller import app.controllers.stylesheet_experiment_controller import a...
import numpy as np def intersection_over_union(pred, true): """ Calculates intersection and union for a batch of images. Args: pred (torch.Tensor): a tensor of predictions true (torc.Tensor): a tensor of labels Returns: intersection (int): total intersection of pixels ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
import numpy as np from os.path import join def plot_weight_scatter(harn): """ Draw a scatter plot of the initial weights versus the final weights of a network. Example: >>> import netharn as nh >>> harn = nh.FitHarn.demo() >>> harn.run() Ignore: >>> from netharn....
#!/usr/bin/env python # # Example of two process Ray program, worker sends values to parameter # server on a different machine # # Run locally: # ./ray_two_machines.py # # Run on AWS: # ./ray_two_machines.py --aws # Example timings # c5.18xlarge over network: over network: 63.0 ms: 1586.76 MB/second # c5.9xlarge over...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: import asyncio except ImportError: import trollius as asyncio import logging import math import socket import sys import time from . import msg from .msg import gz_string_pb2 from .msg import gz_string_v_pb2 from .msg import packet_pb2 from .msg import publi...
#!/usr/bin/env python3 from utils import arguments from utils import metasploiter from utils import masscanner from utils import mkdir from utils import nmapper from utils import richard as r from utils import sqlite as db from utils import xmlparser from configparser import ConfigParser import os import r...
# Copyright (C) 2018 Łukasz Langa from setuptools import setup import sys assert sys.version_info >= (3, 6, 0), "black requires Python 3.6+" from pathlib import Path # noqa E402 CURRENT_DIR = Path(__file__).parent sys.path.insert(0, str(CURRENT_DIR)) # for setuptools.build_meta def get_long_description() -> str: ...
from django.contrib import admin from oauth2_provider.models import ( get_access_token_admin_class, get_access_token_model, get_application_admin_class, get_application_model, get_grant_admin_class, get_grant_model, get_id_token_admin_class, get_id_token_model, get_refresh_token_adm...
import json from flask import request from redash import models from redash.handlers.base import BaseResource, get_object_or_404 from redash.serializers import serialize_visualization from redash.permissions import (require_admin_or_owner, require_object_modify_permission, ...
# Imports import pygame import random import sys # Init pygame.init() # Initial Variables screenColor = (0, 0, 0) screenDimension = (600, 600) fontColor = (255, 255, 255) font = pygame.font.SysFont("hack", 35) clock = pygame.time.Clock() # Snake Values snakeColor = (34, 139, 34) x = screenDimension[0] / 2 y = screen...
name = input("Enter a name: ") date = input("Enter a date: ") plural_noun = input("Enter a plural noun: ") plural_noun = input("Enter another plural noun: ") verb = input("Enter a verb: ") celebrity = ("Enter the name of a celebrity: ") noun = input("Enter a noun: ") ing = input("Enter a verb ending in 'ing': ") plural...
from augmentts.augmenters.vae import LSTMVAE, VAEAugmenter import numpy as np data = np.random.normal(size=(40, 1, 100)) vae = LSTMVAE(series_len=100) augmenter = VAEAugmenter(vae) augmenter.fit(data, epochs=50, batch_size=32) samples = augmenter.sample(n=10) print(samples.shape)
from .data import Data from ..utils import run_if_any_none class Function(Data): """Approximate a function via a network. Args: geometry: The domain of the function. Instance of ``Geometry``. function: The function to be approximated. A callable function takes a NumPy array as the input and r...
# GENERATED BY KOMAND SDK - DO NOT EDIT from .action import GetPatchDeploymentTemplateId
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
from flask import Flask from kerberos_tgs.database import init_db def create_app(): app = Flask(__name__) app.config.from_envvar('TGS_CONFIG_FILE') # Setup database app.config["MONGO_URI"] = "mongodb://localhost:27017/kerberos_tgs_db" init_db(app) # Register blueprints from kerberos_tg...
# -*- coding: utf-8 -*- import os import numpy as np import cv2 import imgproc # borrowed from https://github.com/lengstrom/fast-style-transfer/blob/master/src/utils.py def get_files(img_dir): imgs, masks, xmls = list_files(img_dir) return imgs, masks, xmls def list_files(in_path): img_files = [] mas...
#!/usr/bin/python3 from brownie import swap_volumegauge, volumegaugetracker, accounts, Contract def main(): accounts.load('tester') trackercontract = volumegaugetracker.deploy({"from": accounts[0]}) gaugecontract = swap_volumegauge.deploy(["0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", "0x39AA39c021dfbaE8fa...
# # Copyright 2018-2019 IBM Corp. 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...
from model.contact import Contact import string import random import os.path import jsonpickle #библиотека для чтения опций командной строки import getopt #библиотека для использования опций командной строки import sys try: opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ cobra ~~~~~ Implements cobra main :author: BlBana <635373043@qq.com> :homepage: https://github.com/WhaleShark-Team/cobra :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2018 Feei. All rights reserved """ import...
from django.test import TestCase from manager.models import Entry, CryptoEngine, Category import random class CryptoEngineTest(TestCase): def setUp(self): self.engine = CryptoEngine(master_key='mykeyisawesome!') self.block_length = 32 self.texts = CryptoEngineTest._generate_texts(100) ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# -*- coding: utf-8 -*- # ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS) # # This program is free software; you can redistribute it and/or modify it under # the t...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- encoding:utf-8 -*- from __future__ import unicode_literals MESSAGES = { "%d min remaining to read": "%d minuta preostalo za čitanje", "(active)": "(aktivno)", "Also available in:": "Također dostupno i u:", "Archive": "Arhiva", "Authors": "", "Categories": "Kategorije", "Comments": "Ko...
#! /usr/bin/python # -*- coding: utf-8 -*- import os import random import subprocess import sys import time from collections import Counter from sys import exit as _exit from sys import platform as _platform import numpy as np import tensorflow as tf from sklearn.metrics import accuracy_score, confusion_matrix, f1_sc...
"""Salesforce customizations of VCR Hides session IDs and OrgIDs. Generally hides all request and response headers to save space in our repo. Records transactions if there is an org specified and does not if there is not. """ import re from enum import Enum from functools import partial from pathlib import Path imp...
class ICAPResponse (object): def __init__ (self, version, code, status, headers, icap_header, http_header): self.version = version self.code = code self.status = status self.headers = headers self.icap_header = icap_header self.http_header = http_header @property def pragma (self): return self.header...
""" Module: 'ds18x20' on micropython-esp32-1.14 """ # MCU: {'ver': '1.14', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.14.0', 'name': 'micropython', 'mpy': 10757, 'version': '1.14.0', 'machine': 'ESP32 module (spiram) with ESP32', 'build': '', 'nodename': 'esp32', 'platform': 'esp32', 'famil...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
# -*- coding: utf-8 -*- """ Domain model implementation """ __author__ = 'Samir Adrik' __email__ = 'samir.adrik@gmail.com' from .expenses import Expenses from .currency import Currency from .address import Address from .percent import Percent from .family import Family from .entity import Entity from .person import...
#!/usr/bin/python2.7 '''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' #python jetdual.py --save dualn2200 --network nnn2 --pt 200 --epoch 50 --stride 2 --gpu 3 #python jetdua...
from flask import Flask, request import flask_restful as rest from sms_directions.directions import get_directions from sms_directions.sms import send_sms def init_rest_api(app): api = rest.Api(app) class GetDirections(rest.Resource): def get(self): caller_number = request.args.get('msis...
#!/usr/bin/env python # pylint: disable=missing-docstring # flake8: noqa: T001 # ___ ___ _ _ ___ ___ _ _____ ___ ___ # / __| __| \| | __| _ \ /_\_ _| __| \ # | (_ | _|| .` | _|| / / _ \| | | _|| |) | # \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____ # | \ / _ \ | \| |/ _ \_ _| | __| \_ ...
import collections from unittest import TestCase from MIDIEvents import Chord, ChordProgression class TestChordProgression(TestCase): def setUp(self) -> None: # Just some chords that are available self.c1 = Chord.from_ident("A1 Major") self.c2 = Chord.from_ident("A2 Major") self.c...
from ..rfb_logger import rfb_log from . import shadergraph_utils from .property_utils import BlPropInfo, __LOBES_ENABLE_PARAMS__ from ..rman_constants import NODE_LAYOUT_SPLIT from .. import rman_config from .. import rfb_icons import bpy import re def draw_indented_label(layout, label, level): for i in range(leve...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 25 14:17:29 2018 @author: Niccolo' Dal Santo @email : niccolo.dalsanto@epfl.ch """ import pyorb_core.error_manager as em import pyorb_core.error_manager as em class external_engine( ): def __init__( self, _engine_type, _library_path, _interfa...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: release-1.19 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import si...
Real = float(input('Quanto dinheiro você tem na carteira? R$: ')) dolar = float(input('Qual a cotação do dólar? U$: ')) Euro = float(input('Qual a cotação do Euro: €$: ')) v1 = (Real/dolar) v2 = (Real/Euro) print('Na cotação atual com {} você tem {:.2f} dólares e {:.2f} Euros.'.format(Real, v1, v2))
from .client import Client from .consts import * class SwapAPI(Client): def __init__(self, api_key, api_seceret_key, passphrase, use_server_time=False): Client.__init__(self, api_key, api_seceret_key, passphrase, use_server_time) def get_position(self): return self._request_without_params(GE...
import sqlite3 db = sqlite3.connect('mock_data.db') SELECT_STATEMENT = """ SELECT device_id, temperature FROM tutorial WHERE location_id=?; """ location = (77, ) data1 = db.execute(SELECT_STATEMENT, location).fetchone() print(data1) print() data2 = db.execute(SELECT_STATE...
#!/usr/bin/env python3 import pyglet import glooey class MyForm(glooey.Form): custom_alignment = 'center' class Label(glooey.EditableLabel): # custom_padding = 2 custom_width_hint = 200 class Base(glooey.Background): # custom_outline = 'green' class Focused(glooey.Background...
from __init__ import * class none(object): def __init__(self, hostname, port): self.host = (socket.gethostbyname(hostname), int(port)) self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.requestid = 1337 self.socket.settimeout(4) self.socket.connect(self.host) class hl2(...
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-06-23 23:52 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('players', '0003_auto_20170623_2329'), ] operations = [ migrations.RenameField( ...
import torch import torch.nn as nn from torchseq.utils.functional import softmax_mask class Encoder(nn.Module): def __init__(self, n_tokens, embed_dim, hidden_dim, n_layers, dropout): super(Encoder, self).__init__() self.n_tokens = n_tokens self.embed_dim = embed_dim self.hidden_dim...
from ndx_experimenters import NWBFile from pynwb import NWBHDF5IO from datetime import datetime from numpy.testing import assert_array_equal session_start_time = datetime.now().astimezone() nwb = NWBFile('session_description', 'identifier', session_start_time, experimenters=['a', 'b']) with NWBHDF5IO('test_experime...
descriptor = ' {:<30} {}' message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape') message_help_required_login_username = descriptor.format('', 'required: add a login username') message_help_required_login_password = descriptor.format('', 'required: add a login password') message_help...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# # -*- coding: utf-8 -*- # Wireshark tests # By Gerald Combs <gerald@wireshark.org> # # Ported from a set of Bash scripts which were copyright 2005 Ulf Lamping # # SPDX-License-Identifier: GPL-2.0-or-later # '''Text2pcap tests''' import pprint import re import subprocesstest import json import fixtures testin_txt = ...
def intersection(head1, head2): node1 = head1 node1_len = 0 node1_tail = None while node1: node1_len += 1 if not node1.next: node1_tail = node1 node1 = node1.next node2 = head2 node2_len = 0 node2_tail = None while node2: node2_len += 2 ...
"""This program takes temperature input from users in celsius and converts it to fahrenheit""" temp = input('Enter temperature (celsius): ') try: fahr = int(temp) cel = (fahr - 32.0) * 5.0 / 9.0 print(cel) except: print('Please enter a valid temp in integers') pass
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "learning_joy" PROJECT_SPACE_DIR = "/h...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.utils.timezone import utc import datetime class Migration(migrations.Migration): dependencies = [ ('messaging', '0005_message_encrypt'), ] operations = [ migrations.AddFi...
import os from instauto.api.client import ApiClient from instauto.api.actions import post as ps from instauto.api.actions import search as se if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(use...
__app_name__ = "fast" __version__ = "0.0.1"
import unittest class Solution: # dp[i][j] means whether or not it's panlindrome from i to j(including a[j]) def longestPalindrome(self, s: str) -> str: if not s or len(s) == 1: return s n = len(s) dp = [[False for _ in range(n)] for _ in range(n)] # Initialize for i ...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If exte...
from git import Git class MyGit(): def __init__(self, path): self.g = Git(path) def update_force(self, config=None): """ 强制更新 buckets """ if 'http.proxy' in config: info_1 = self.g.config("--global", "http.proxy", config['git']['http.proxy']) ...
""" Fixer to remove function annotations """ from lib2to3 import fixer_base from lib2to3.pgen2 import token from lib2to3.fixer_util import syms warning_text = "Removing function annotations completely." def param_without_annotations(node): return node.children[0] class FixAnnotations(fixer_base.BaseFix): w...
""" loginpass.github ~~~~~~~~~~~~~~~~ Loginpass Backend of GitHub (https://github.com). Useful Links: - Create App: https://github.com/settings/developers - API documentation: https://developer.github.com/v3/ :copyright: (c) 2018 by Hsiaoming Yang :license: BSD, see LICENSE for more ...
import os import numpy as np import pandas as pd import datetime as dt import rec.model as model import gzip from rec.dataset.dataset import Dataset PATH_TO_ORIGINAL_DATA = 'data/rsc15/raw/' PATH_TO_PROCESSED_DATA = 'data/dataset/rsc15/' sessions_jsonl = PATH_TO_PROCESSED_DATA + 'sessions.jsonl' sessions_gz = sessio...
# Generated by Django 2.2 on 2019-04-25 20:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('courses', '0011_course_active'), ] operations = [ migrations.AlterField( model_name='mycourses', name='courses', ...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2015 clowwindy # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to u...
import time import os import socket def net_is_used(port, ip='0.0.0.0'): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((ip, port)) s.shutdown(2) print('Error: %s:%d is used' % (ip, port)) return True except: #print('%s:%d is unused' % (ip, por...
from django.db import connection from django.test import TestCase from .models import A01, A02, B01, B02, C01, C02, Managed1, Unmanaged2 class SimpleTests(TestCase): def test_simple(self): """ The main test here is that the all the models can be created without any database errors. We can...
# -*- coding: utf-8 -*- # # Copyright 2014 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...