text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
#
# Authors: Toni Ruottu, Finland 2013
# Tomi Jylhä-Ollila, Finland 2013-2018
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or ne... |
#%%
import pandas as pd
import numpy as np
from matchbook.apiclient import APIClient
api = APIClient('DOG2018', '07C18125')
def get_client():
if not api.session_token:
api.login()
return api
# %%
|
import requests
from config import API
from Utils import Logger
def send_stat(servers: int, shards: int, users: int):
sended = requests.get(
url=f"https://boticord.top/api/stats?servers={servers}&shards={shards}&users={users}",
headers={"Authorization": API['BotiCord']}
)
try:
... |
from django.db import models
from django.contrib.auth.models import User
class Feedback(models.Model):
FEEDBACK_TYPE_CHOICES = (
('b', "Bug Report"),
('r', "Suggestion / Request"),
('f', "Feedback / Other"),
)
type = models.CharField(max_length=1, choices=FEEDBACK_TYPE_CHOICES)
... |
#!/usr/bin/env python
import sys
import urllib.request
import json
def get_info(adress):
print("************************************************")
api = "http://freegeoip.net/json/" + adress
try:
result = urllib.request.urlopen(api).read()
result = str(result)
result = result[2:le... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.3 Python SDK
Pure Storage FlashBlade REST 1.3 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.3
Contact: i... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'connect.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_IDAngrConnectDialog(object):
def setupUi(self, IDAngrConnectDialog)... |
from hummingbot.core.event.events import (
BuyOrderCompletedEvent,
SellOrderCompletedEvent
)
from hummingbot.pmm_script.pmm_script_base import PMMScriptBase
class PingPongPMMScript(PMMScriptBase):
"""
Demonstrates how to set up a ping pong trading strategy which alternates buy and sell orders.
If ... |
class NamedMonkeyPanel: pass |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from PyBall.models.base_model import BaseModel
class Sport(BaseModel):
_fields = {
'id': {'default_value': None, 'field_type': int},
'link': {'default_value': None, 'field_type': str},
'name': {'default_value': None, 'field_type': str},
}
|
#!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... |
import pylab as plt
import numpy as np
itrt=101
nm=input("File name: ")
num_lines = sum(1 for line in open(nm))
li=np.sqrt(num_lines/2)
print(li)
x,y,z= np.loadtxt(nm, delimiter='\t').T
yb,xb,zb=[],[],[]
yf,xf,zf=[],[],[]
for i in range(itrt):
for j in range(itrt):
k = (2 * i + 1) * 101 + j
zb.inse... |
# coding: utf-8
"""
NetBox API
API to access NetBox # noqa: E501
OpenAPI spec version: 2.8
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class WritableCable(object):
"""NOTE: This class is auto generated by the swa... |
# -*- coding: utf-8 -*-
from copy import copy
from decimal import Decimal, Context, setcontext
from math import asin
from math import atan2
from math import cos
from math import pi
from math import pow
from math import sin
from math import sqrt
from math import radians
MULTIPLIER = {
"KM": Decimal(1.852),
"M... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from nameparser import HumanName
from restclients_core import models
class Position(models.Model):
RETIREE = "retiree"
department = models.CharField(max_length=250)
title = models.CharField(max_length=250)
is_prima... |
# Copyright (c) 2015 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, ... |
import os
from serum import Context, match
from serum.exceptions import UnknownEnvironment
import pytest
@pytest.fixture()
def environ():
yield os.environ
os.environ.pop('TEST_ENV', None)
def test_match_returns_correct_env(environ):
env1 = Context()
env2 = Context()
environ['TEST_ENV'] = 'ENV1'... |
import os
from medium_scraper import *
# TO RUN THIS FILE YOU NEED SELENIUM, BEAUTIFULSOUP, PANDAS, DATETIME, REGEX, AND OS
# JUST GO TO THE COMMAND LINE AND
# SET WORKING DIRECTORY TO THE DIRECTORY WITH BOTH MEDIUM_SCRAPER.PY AND SCRAPE_MASTER.PY
# THEN ENTER COMMAND "$python scrape_master.py"
# ADD THE TA... |
""" RecordingManager class definition. """
import os
import itertools
import time
from six import iteritems
from openmdao.core.mpi_wrap import MPI, debug
trace = os.environ.get('OPENMDAO_TRACE')
class RecordingManager(object):
""" Object that routes function calls to all attached recorders. """
def __init... |
"""
This file was adapted from mock_autogen/tests/test_public_api.py and modified.
"""
from tests.examples.code_snippets import os_remove_wrap, process_and_zip
from tests.test_utils import safe_assert_clipboard
MOCKED_DEPENDENCIES_HEADER = "# mocked dependencies\n"
MOCKED_FUNCTIONS_HEADER = "# mocked functions\n"
MOCK... |
# Написать алгоритм на любом языке программирования для вывода степеней 2-ки до n
if __name__ == "__main__":
n = int(input("Введите число n: "))
for i in range(1, n + 1):
print("2 **", i, "=", 2 ** i)
|
# -*- coding: utf-8 -*-
import re, json, inspect
import requests
from mattermost_bot.bot import listen_to
from mattermost_bot.bot import respond_to
from mattermost_bot.utils import allow_only_direct_message
from mm_bot_settings import AUTH_TOKEN, MA_SERVER_URL, PLUGIN_SETTINGS
@listen_to('.*', re.IGNORECASE)
def list... |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"Also available in": "También disponible en",
"Archive": "Archivo",
"Categories": "Categorías",
"LANGUAGE": "Español",
"More posts about": "Más posts sobre",
"Newer posts": "Posts posteriores",
"Next post": "Sigui... |
# coding=utf-8
import os
import platform
import unittest
import pytest
from nose.plugins.attrib import attr
from parameterized import parameterized
from conans import MSBuild, tools
from conans.client.runner import ConanRunner
from conans.test.utils.mocks import MockSettings, MockConanfile, TestBufferConanOutput
fro... |
'''
Created by auto_sdk on 2015.09.11
'''
from top.api.base import RestApi
class BaichuanUserLogindoublecheckRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.name = None
def getapiname(self):
return 'taobao.baichuan.user.logindoublechec... |
"""Integration between SQLAlchemy and BigQuery."""
from __future__ import absolute_import
from __future__ import unicode_literals
import operator
from google import auth
from google.cloud import bigquery
from google.cloud.bigquery import dbapi
from google.cloud.bigquery.schema import SchemaField
from google.cloud.bi... |
#!/usr/bin/env python
# Copyright 2019 Sophos Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License.
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/polybench/polybench-code/stencils/fdtd-2d/kernel.c')
destination('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/fdtd-2d/tmp_files/13.c')
procedure('kernel_fdtd_2d')
loop(0)
known(' nx > 1 ')
known(' ny > 1 ')
tile... |
#!/opt/local/bin/python
__author__ = "Andrew G. Clark"
__date__ = "2015"
__copyright__ = "Copyright 2015, Andrew Clark"
__maintainer__ = "Andrew G. Clark"
__email__ = "andrew.clark@curie.fr"
__status__ = "Production"
""" Custom widget for displaying and interacting with
images using PyQT4 for invasion segmentation
v... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
from collections import OrderedDict, namedtuple
import itertools
import warnings
import functools
import torch
from ..parameter import Parameter
import torch.utils.hooks as hooks
from torch import Tensor, device, dtype
from typing import Union, Tuple, Any, Callable, Iterator, Set, Optional, overload, TypeVar, Mapping... |
from typing import Dict
import requests
class DeezerAPIException(Exception):
"""Base exception for API errors."""
class DeezerRetryableException(DeezerAPIException):
"""A request failing with this might work if retried."""
class DeezerHTTPError(DeezerAPIException):
"""Specialisation wrapping HTTPErro... |
from JumpScale import j
import datetime
##############################################
# Generic Hooks to be run on namespace level #
# For all objects in this namespace
##############################################
def pre_create(items):
"""
Auto generate guid if already does not exist
"""
for item... |
from datetime import timedelta
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.contrib.auth.password_validation import validate_password, get_password_validators
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from d... |
#!/usr/bin/python
print ("Hello, Python!“)
#
# $ chmod +x test.py
# $./test.py
# or
# $python ./test.py
|
#!/usr/bin/env python
import platform
from EPPs.common import SendMailEPP
class DataReleaseTrigger(SendMailEPP):
"""Notifies the bioinformatics team to release data for a project."""
def _run(self):
if len(self.projects) > 1:
raise ValueError('More than one project present in step. Only o... |
import requests
from productiveware import config, encryption
from PySide6 import QtCore
base_url = "http://productiveware.objectobject.ca:3000"
login_url = f"{base_url}/api/auth/login"
def get_headers():
return {
"Cookie": f"connect.sid={config.get_cookie()}"
}
def login(username, password):
response = request... |
"""
Test sending SIGINT to the embedded Python REPL.
"""
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import PExpectTest
class TestCase(PExpectTest):
mydir = TestBase.compute_mydir(__file__)
def start_python_repl(self):
... |
import random
import time
loginUrls = {
'normal': {
'index':{
'url': r'https://www.12306.cn/index/',
'method': 'GET',
'headers': {
'Accept': r'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Upgrade-Insecure-Requests': '1... |
# Generated by Django 3.1.1 on 2020-10-24 10:29
import django.contrib.auth.models
import django.contrib.auth.validators
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("auth", "0012_alter_user_first_name_m... |
#!/usr/bin/env python3
from flask import Flask, request, jsonify
import os
import sys
import json
import subprocess
# Download trivy cache
TRIVY_CACHE = ["trivy", "-q", "-f", "json", "fs", "/app"]
trivy_cache_result = (
subprocess.check_output(TRIVY_CACHE).decode("UTF-8")
)
admission_controller = Flask(__name__)
... |
import numpy as np
from sklearn.preprocessing import normalize
from mercs.algo.inference import compute
VERBOSITY = 0
class CompositeModel(object):
"""
Builds a model from the diagram generated by the inference algorithm.
Sets the desc and targ ids, feature imps, classes and prediction methods.
"""
... |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.urls import reverse
from processmap.models import MapAreaLink
register = template.Library()
map_area_reverse = dict((v, k) for k, v in MapAreaLink.MAP_AREA_CHOICES)
@registe... |
import os
import textwrap
import pytest
import tpi
from dvc.cli import main
from dvc.ui import ui
from tests.utils import console_width
from .conftest import BASIC_CONFIG
@pytest.mark.parametrize(
"slot,value",
[
("region", "us-west"),
("image", "iterative-cml"),
("spot", "True"),
... |
from classes.user import User
from classes.privileges import Privileges
class Admin(User):
"""Modelo de perfil de administrador
Methods:
__init__ -> Inicializa os atributos da classe pai e da própria classe
describe_user -> Imprime as informações do perfil
greet_user -> Imprime uma ... |
""" Model for output of PV data """
import logging
from nowcasting_dataset.data_sources.datasource_output import DataSourceOutput
logger = logging.getLogger(__name__)
class PV(DataSourceOutput):
"""Class to store PV data as a xr.Dataset with some validation"""
__slots__ = ()
_expected_dimensions = ("t... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: hub.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf im... |
import matplotlib.pyplot as plt
def plot_image(image):
plt.figure(figsize=(12, 4))
plt.imshow(image, cmap='gray')
plt.axis('off')
plt.show()
def plot_result(*args):
number_images = len(args)
fig, axis = plt.subplots(nrows=1, ncols = number_images, figsize=(12, 4))
names_lst = ['image {}'.... |
# Copyright 2020 nunopenim @github
#
# Licensed under the PEL (Penim Enterprises License), v1.0
#
# You may not use this file or any of the content within it, unless in
# compliance with the PE License
try:
# >= 4.0.0
from userbot.version import VERSION as hubot_version
except:
# <= 3.0.4
from userbot... |
import unittest
import os
from dotenv import load_dotenv
import numpy as np
from nlpaug.util import AudioLoader
import nlpaug.augmenter.spectrogram as nas
class TestTimeMasking(unittest.TestCase):
@classmethod
def setUpClass(cls):
env_config_path = os.path.abspath(
os.path.join(os.path.di... |
"""Tests for ``cubi_tk.snappy.varfish_upload``."""
import pathlib
from biomedsheets.io_tsv import read_germline_tsv_sheet
from biomedsheets.naming import NAMING_ONLY_SECONDARY_ID
from cubi_tk.snappy.varfish_upload import yield_ngs_library_names
def test_yield_ngs_library_names():
"""Tests yield_ngs_library_name... |
import numpy as np
import unittest
import torch
import os
import heat as ht
if os.environ.get("DEVICE") == "gpu" and torch.cuda.is_available():
ht.use_device("gpu")
torch.cuda.set_device(torch.device(ht.get_device().torch_device))
else:
ht.use_device("cpu")
device = ht.get_device().torch_device
ht_device =... |
import pickle
from datetime import timedelta
from uuid import uuid4
from redis import StrictRedis as Redis
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
class RedisSession(CallbackDict, SessionMixin):
def __init__(self, initial=None, sid=None, new=Fals... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
#!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
FELPY
__author__ = "Trey Guest"
__credits__ = ["Trey Guest"]
__license__ = "EuXFEL"
__version__ = "0.2.1"
__maintainer__ = "Trey Guest"
__email__ = "trey.guest@xfel.eu"
__status__ = "Developement"
"""
import numpy as np
from felpy.model.beamlines.exfel_spb.exfel_sp... |
# Generated by Django 3.2.12 on 2022-05-13 02:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wormil', '0003_auto_20220513_0208'),
]
operations = [
migrations.RenameField(
model_name='specimen',
old_name='finder',
... |
import torch
from torch_geometric.data import DataLoader
import torch.optim as optim
import torch.nn.functional as F
from torchvision import transforms
from gnn import GNN
from tqdm import tqdm
import argparse
import time
import numpy as np
import pandas as pd
import os
### importing OGB
from ogb.graphproppred import... |
from setuptools import setup
setup(name='aimnet',
version='0.1',
description='Atoms In Molecules Neural Network Potential',
url='https://github.com/aiqm/aimnet.git',
author='Roman Zubatyuk',
license='MIT',
packages=['aimnet'],
include_package_data=True,
zip_safe=False)
|
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This module contains classes for analyzing the texts of a corpus to accumulate
statistical information about word occurrences."""
im... |
# 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.
# --------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.core.exceptions import ValidationError
import os
from decimal import Decimal
from .models import Company, Contact, ManufacturerPart, SupplierPart
from .models import rename_company_image
from part.models impo... |
"""hmod_app_34373 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... |
# Generated by Django 3.2.9 on 2021-11-20 08:31
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CpuUsage',
fields=[
('id', models.BigAutoFi... |
# -*- python -*-
load("@drake//tools/workspace:github.bzl", "github_archive")
def lcmtypes_bot2_core_repository(
name,
mirrors = None):
github_archive(
name = "lcmtypes_bot2_core",
repository = "openhumanoids/bot_core_lcmtypes",
commit = "9974c813bf746851067bb7b9adf86816c50... |
#!/usr/bin/env python
# Copyright 2019 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
import c... |
#
# Copyright (c) 2021 HopeBayTech.
#
# This file is part of Tera.
# See https://github.com/HopeBayMobile for further info.
#
# 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.... |
import datetime
import io
import os
import re
import shutil
import time
import urllib
from io import StringIO
from unittest import mock
from unittest.mock import patch
import botocore.exceptions
import ujson
from django.conf import settings
from django.utils.timezone import now as timezone_now
from django_sendfile.uti... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bilibili/app/wall/v1/wall.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
f... |
import os
from setuptools import setup, find_packages
base_packages = []
dev_packages = [
'pytest',
'flake8',
'mypy'
]
base_packages.append("click")
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='decoPlanner',
packages=find_packages(where='... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
from rdflib.graph import ConjunctiveGraph
from rdflib.term import Literal, URIRef
def test_escaping_of_triple_doublequotes():
"""
Issue 186 - Check escaping of multiple doublequotes.
A serialization/deserialization roundtrip of a certain class of
Literals fails when there are both, newline characters ... |
import unittest
from django.utils.functional import cached_property, lazy
class FunctionalTestCase(unittest.TestCase):
def test_lazy(self):
t = lazy(lambda: tuple(range(3)), list, tuple)
for a, b in zip(t(), range(3)):
self.assertEqual(a, b)
def test_lazy_base_class(se... |
from google.appengine.ext import ndb
import ndbTools
class SellingMethod(ndb.Model):
name = ndb.StringProperty(choices=['Ebay', 'Direct-to-Consumer'])
fees = ndb.FloatProperty(repeated=True)
totalFees = ndb.ComputedProperty(lambda self: ComputeTotalFees(self))
paymentMethod = ndb.KeyProperty(kind='Pa... |
"""
WSGI config for photofolio 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/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... |
# PURPOSE: anonmyize dicom data
import os
import glob
from subprocess import call
from nilearn.image import new_img_like
from nibabel.nicom import dicomreaders
import nibabel as nib
import numpy as np
from rtCommon.readDicom import readDicomFromBuffer, readRetryDicomFromFileInterface
from rtCommon.fileClient import Fi... |
import logging
import sqlite3
import pytest
from airtunnel.operators.sql.sqloperator import SQLOperator
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def test_param_check(test_db_hook):
with pytest.raises(AssertionError):
x = SQLOperator(
sql_hook=test_db_hook, script_f... |
from django.urls import path, include
import views
# In this example, we've separated out the views.py into a new file
urlpatterns = [
path('', views.index, name="home"),
path('about', views.about, name="about"),
path('github', views.github, name="github"),
path('contact', views.contact, name="contact"... |
# -*- coding: utf-8 -*-
'''
Utility functions for salt.cloud
'''
# Import python libs
from __future__ import absolute_import
import os
import sys
import stat
import codecs
import shutil
import hashlib
import socket
import tempfile
import time
import subprocess
import multiprocessing
import logging
import pipes
import ... |
from psutil import process_iter
from os import system
version = 1.0
author = 'Ivan Perzhinsky'
roblox = 'RobloxPlayerBeta.exe'
trx = 'TRX.exe'
roblox_kill_command = f'taskkill /F /IM {roblox}'
def get_processes_names():
return [proc.name() for proc in process_iter()]
def kill_roblox():
for... |
import os
import sys
import uuid
import datetime
import random
import json
import copy
import yaml
from jinja2 import Template
from job import Job
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../utils"))
from config import config
from osUtils import mkdirsAsUser
class DistPodTemplate():
... |
# Copyright 2019 Zuru Tech HK Limited. 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 la... |
from django import template
from oscar.core.utils import format_timedelta
register = template.Library()
@register.filter
def timedelta(td):
"""
Return formatted timedelta value
"""
return format_timedelta(td)
|
"""``AbstractRunner`` is the base class for all ``Pipeline`` runner
implementations.
"""
import logging
from abc import ABC, abstractmethod
from concurrent.futures import (
ALL_COMPLETED,
Future,
ThreadPoolExecutor,
as_completed,
wait,
)
from typing import Any, Dict, Iterable
from pluggy import Pl... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... |
from requests.cookies import cookiejar_from_dict
from aiorequests.content import content, json_content, text_content
# TODO: almost deprecated with the aiohttp native response
class _Response(object):
def __init__(self, original, cookiejar):
self.original = original
self._cookiejar = cookiejar
... |
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack Foundation
# 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.... |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#if __name__ == "__main__":
# print "Hello World"
from WorkingWithWorksheets import RemovingWorksheetsusingSheetName
import jpype
import os.... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# coding=utf-8
"""
Protein-Ligand Interaction Profiler - Analyze and visualize protein-ligand interactions in PDB files.
test_basic_functions.py - Unit Tests for basic functionality.
Copyright 2014-2015 Sebastian Salentin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except ... |
import csv
import urllib
import names
import requests
import yaml
with open('../maps/azuremaps_config.yml', encoding="utf8") as file:
configs = yaml.load(file, Loader=yaml.FullLoader)
url = "https://atlas.microsoft.com/search/address/json?"
i = 900
addresses = {}
with open("hosp_and_others.csv", "rt", encoding=... |
from django.apps import AppConfig
class DnsConfig(AppConfig):
name = 'dns'
|
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Main(Component):
"""A Main component.
Main is a wrapper for the <main> HTML5 element.
For detailed attribute info see:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main
... |
#!/usr/bin/env python
import logging
import mock
import testify as T
from pushmanager.core import auth
class TestAuthenticaton(T.TestCase):
def test_authenticate(self):
with mock.patch.object(logging, "exception"):
T.assert_equal(auth.authenticate("fake_user", "fake_password"), False)
|
"""config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
# -*- coding: utf-8 -*-
import requests
import logging
import paramiko
import socket
from ..errors import GenerateTokenError, GenerateResourceIdError
LOG = logging.getLogger(__name__)
def exec_remote_command(server, username, password, command, output={}):
try:
LOG.info(
"Executing command [... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2019-01-04 17:03
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.