text stringlengths 2 999k |
|---|
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... |
#!/usr/bin/env python3
# ! -*- coding: utf-8 -*-
from multiprocessing import Process
import os
# 子进程要执行的代码
def run_proc(name):
print('Run child process %s (%s)...' % (name, os.getpid()))
if __name__ == '__main__':
print('Parent process %s.' % os.getpid())
p = Process(target=run_proc, args=('test',))
... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
import git
repo = git.Repo('./')
tags = sorted(repo.tags, key=lambda t: t.commit.committed_datetime)
version = tags[-1] if len(tags) > 0 else "0.0.0-TEST"
setuptools.setup(
name="EuroPy",
version=str(version),
author="M... |
from .add import *
from .admin import *
from .advisory import *
from .copy import *
from .delete import *
from .edit import *
from .error import *
from .index import *
from .login import *
from .show import *
from .stats import *
from .todo import *
from .user import *
|
from telegram import ReplyKeyboardRemove
from telegram_bot.handlers.utils.decorators import write_logs, send_typing, \
remember_new_user
from telegram_bot.handlers.utils.menu_entries import MenuEntry
@write_logs
@send_typing
@remember_new_user
def handle_plot(bot, update) -> int:
chat_id = update.message.cha... |
import base64
import json
import uuid
from os import path
from typing import Any, Callable, List
import cloudpickle
import yaml
import prefect
from prefect.client import Secret
from prefect.environments.execution import Environment
from prefect.environments.storage import Docker
class DaskKubernetesEnvironment(Envi... |
# import math
from math import trunc
num = float(input('Digite um número real: '))
print('A parte inteira do número {} é {}'.format(num, trunc(num)))
# print('A parte inteira do número {} é {}'.format(num, math.trunc(num)))
# print('A parte inteira do número {} é {}'.format(num, int(num)))
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
"""
KBase handlers for authentication in the Jupyter notebook.
"""
__author__ = 'Bill Riehl <wjriehl@lbl.gov>'
from tornado.escape import url_escape
from notebook.base.handlers import IPythonHandler
from traitlets.config import Application
from notebook.auth.login import LoginHandler
from notebook.auth.logout import L... |
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from frappe.utils import update_progress_bar
from whoosh.index import create_in, open_dir, EmptyIndexError
from whoosh.fields import TEXT, ID, Schema
from whoosh.qparser import MultifieldParser, FieldsPlugin... |
# -*- coding: utf-8 -*-
# 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... |
"""
WSGI config for mall_demo 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/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... |
import json
import sys
import yaml
DIRECTORY = "example/"
LINKS = "links.yaml"
LAYOUT = "layout.yaml"
CSS = "templates/style.css"
HTML_TEMPLATE = "templates/template.html"
HTML_FINAL = "startpage.html"
def import_links(directory=DIRECTORY, file_name=LINKS):
"""Imports the YAML data file."""
with open(direct... |
# Copyright 2018 Iguazio
#
# 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, softwa... |
from __future__ import print_function
import numpy as np
from collections import defaultdict
from openpyxl import load_workbook
from os.path import basename
from time import time
from importer import _TrajImporter
class RamanImporter(_TrajImporter):
driver = None
file_ext = '.txt'
pkey_field = 'spectrum_... |
default_app_config = "drnalpha.tracker.apps.TrackerConfig"
|
#########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... |
import tensorflow as tf
from model.common import conv2d_bn_mish
def spp(x):
pool_sizes = [5, 9, 13]
pooling_results = [tf.keras.layers.MaxPooling2D((pool_size,pool_size), strides=(1, 1),padding='same')(x) for pool_size in pool_sizes]
spp_result = tf.keras.layers.Concatenate()(pooling_results+[x])
spp_... |
from .assessment_factory import AssessmentFactoryXBlock
|
"""An interface for extending pandas with custom arrays.
.. warning::
This is an experimental API and subject to breaking changes
without warning.
"""
import operator
from typing import Any, Callable, Optional, Sequence, Tuple, Union
import numpy as np
from pandas.compat import PY3, set_function_name
from pan... |
def some_func():
return None
|
import atexit
import collections
import datetime
import errno
import grpc
import json
import logging
import os
import random
import signal
import socket
import subprocess
import sys
import tempfile
import threading
import time
import traceback
from typing import Optional, Dict
from collections import defaultdict
impo... |
import pytest
@pytest.fixture(name="create_accompanying_arg_for_parameter", scope="session", params=[(1, "input_df", {}, {}, {})])
def create_accompanying_arg_for_parameter(request):
return {"node_id": request.param[0], "input_dfs": [request.param[1]], "shared_function_set": request.param[2], "additional_local_cod... |
# Copyright 2019 Red Hat, 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... |
import sys
import os
import csv
from django.core.management.base import BaseCommand, CommandError
from django.contrib.gis.utils import LayerMapping
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.geos import MultiPolygon
from django.core.exceptions... |
import sys
a, b, c = sys.stdin.readline().split()
def main():
return "YES" if a[-1] == b[0] and b[-1] == c[0] else "NO"
if __name__ == "__main__":
ans = main()
print(ans)
|
#!/usr/bin/env python
#
# Copyright 2006, 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... |
from ...typecheck import*
from ...settings import Settings
from ...import core
from ...import dap
import socket
import shutil
def version_tuple(v):
return tuple(v.split('.'))
def get_node_path(adapter_type: str) -> str:
return Settings.node or shutil.which('node') or 'node'
async def get_and_warn_require_node(ada... |
import argparse
import collections
import multiprocessing
import os
import numpy as np
import six
if six.PY2:
import cPickle as pickle
else:
import pickle
import gzip
import random
import json
import time
import torch.utils.data
from program_synthesis.algolisp.dataset import data
Schema = collections.named... |
# These tests are all based on the tutorial at http://killer-web-development.com/
# if registration is successful this may work but lets
# try and get user logged in first
from functional_tests import FunctionalTest, ROOT, USERS
import time
from selenium.webdriver.support.ui import WebDriverWait
class AddBasicQuesti... |
#!/usr/bin/python
#Import libraries
import MySQLdb
import sys
import Adafruit_BMP.BMP085 as BMP085
#Set sensor
sensor = BMP085.BMP085(mode=BMP085.BMP085_ULTRAHIGHRES)
#Grab readings from sensor and set variables
temperature = format(sensor.read_temperature())
pressure = format(sensor.read_pressure())
# Open databas... |
#!/usr/bin/env python
"""Singleton for the library's communication with the Earth Engine API."""
from __future__ import print_function
# Using lowercase function naming to match the JavaScript names.
# pylint: disable=g-bad-name
# pylint: disable=g-bad-import-order
import contextlib
import json
import time
import... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... |
from setuptools import find_packages, setup
with open("README.md") as f:
long_description = f.read()
def local_scheme(version):
"""Skip the local version (eg. +xyz of 0.6.1.dev4+gdf99fe2)
to be able to upload to Test PyPI"""
return ""
setup(
name="pypistats",
description="Python interface t... |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Fetch values from the Ska engineering telemetry archive.
"""
from __future__ import print_function, division, absolute_import
import sys
import os
import time
import contextlib
import logging
import operator
import fnmatch
import... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import public
import bisect
import numpy
import matplotlib.pylab as plt
from functools import reduce
@public.add
def plot_err(scores, utility_mean, utility_err, color=None, label=None, alpha=0.5):
plt.plot(scores, utility_mean, color=color)
plt.fill_between(scores, *utility_err, alpha=alpha, color=color, lab... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
app.config["SECRET_KEY"] = "123456790"
# Create in-memory database
app.config["SQLALCHEMY_DATAB... |
import pymarc
class VufindFormatter:
"""VufindFormatter is a utility class for creating vufind records.
To use this class, use the create_record method. See documentation below.
"""
@staticmethod
def create_record(cid, records):
"""The create_record method produces a formatted VuFind re... |
from app.api import api_router
from app.config import settings
from app.metrics import metrics_router
from fastapi import FastAPI
from starlette_prometheus import PrometheusMiddleware
app = FastAPI(title=settings.PROJECT_NAME,
openapi_url=f'{settings.API_V1_STR}/openapi.json',
docs_url=f'{... |
import numpy as np
import tensorflow as tf
import h5py
from sklearn.preprocessing import OneHotEncoder
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import time
import scipy.io
# Functions for initializing neural nets parameters
def weight_variable(shape, var_name):
initial = ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from ... import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .get_maintenance_configuration import *... |
# Copyright (c) 2014 Ahmed H. Ismail
# 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... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: timeGraphsImportStar.py
# Purpose: time how long it takes to import music21, and report biggest offenders
#
# Authors: Michael Scott Cuthbert
# Christopher Ariza
#
# Copyr... |
# 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 ... |
from __future__ import annotations
from typing import Any, Union, Sequence, Optional, Callable, Dict, Tuple, List
from enum import Enum
from functools import reduce, cmp_to_key
import operator
import torch
# nvFuser imports are conditional on CUDA being available
if torch.cuda.is_available():
from torch._C._nvfu... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "moveit_core;pluginlib;roscpp;tf_conversions".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NA... |
from kedro.pipeline import Pipeline, node
from typing import Dict
from .nodes import (
get_data_by_wf,
add_new_cols,
input_missing_values,
select_best_NWP_features,
clean_outliers,
fix_negative_values,
split_data_by_date,
export_data,
)
def create_pipeline(**kwargs):
... |
from fabric.api import *
from fabric.contrib.files import exists
from fabric.utils import abort
import string, random
def setup_webspace():
"""
Make live web space (e.g., www) and backup web space (e.g. www.backup) as root user
"""
# Change the permissions to match the correct user and group
sudo(... |
import re
import uuid
from django.db import models
from django.conf import settings
from django.db.models import Q
from django.urls import reverse
from django.contrib.contenttypes.fields import GenericRelation
from model_utils import Choices
from model_utils.models import TimeStampedModel
from django.utils import timez... |
# Copyright 2018 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... |
# -*- coding: utf-8 -*-
#############################
# UNINSTALL TAYLOR BOT SISTEM #
#############################
import os, sys, time, platform
if platform.system() == 'Linux':
clear = 'clear'
else:
clear = 'cls'
try:
import pyfiglet
except:
os.system('pip install pyfiglet')
os.system('CL... |
import os
import pickle
import pandas as pd
pd.options.display.max_rows = 100
pd.options.display.max_columns = 10
# import .pkl'd objects
def import_obj(pkl_path):
"""
Imports objects that have been saved as .pkl files.
Example:
>>> import packerlabimaging as pkg
>>> trialobj = pkg.import_obj(pk... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... |
import os
import unittest
import coverage
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from app import blueprint
from app.main import create_app, db
# Models
from app.main.model import user, folder
app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')
app.register_blueprint(... |
"""Support for Bond covers."""
from typing import Any, Callable, List, Optional
from bond import DeviceTypes
from homeassistant.components.cover import DEVICE_CLASS_SHADE, CoverEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity im... |
import csv
FILENAME= "customers.csv"
class Customer:
def __init__(self, ID, firstName, lastName, company, address, city, state, zip):
self.ID=ID
self.firstName=firstName
self.lastName=lastName
self.company=company
self.address=address
self.city=city
self.... |
# Install the Python library from https://pypi.org/project/amadeus
from amadeus import Client, ResponseError
amadeus = Client(
client_id='YOUR_AMADEUS_API_KEY',
client_secret='YOUR_AMADEUS_API_SECRET'
)
traveler = {
'id': '1',
'dateOfBirth': '1982-01-16',
'name': {
'firstName': 'JORGE',
... |
import base64
import os
import smtplib
import time
from typing import Any, Callable, Dict, List, Mapping, Tuple
from unittest.mock import MagicMock, patch
import orjson
from django.conf import settings
from django.test import override_settings
from zerver.lib.email_mirror import RateLimitedRealmMirror
from zerver.lib... |
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import override_settings
from rest_framework.test import APITestCase
from documents.models import DocumentType
from documents.tests import TEST_DOCUMENT_TYPE, TEST_SMAL... |
import requests
import json
import random
def get_random_integer(number):
"""
This function takes in a number and returns a random integer between 0 and that number
"""
return random.randint(0, number)
def get_meme(keyword):
"""
This function takes in a keyword and returns a url of a meme
... |
# Generated by Django 2.2.24 on 2021-08-05 17:21
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('home', '0001_load_initial_data'),
]
operations = [
migrations.CreateModel(
name='CustomText',
f... |
"""Convert files from `graph6` format to edge lists."""
import argparse
import math
import os
import networkx as nx
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('INPUT', help='Input file', type=str)
parser.add_argument(
'-o', '--output',
type=str,
... |
# circular doubly linked list
#
# by Greg Hazel
import random
class Link(object):
__slots__ = ['prev', 'data', 'next']
def __init__(self, data):
self.prev = self
self.data = data
self.next = self
def __str__(self):
p = id(self.prev)
n = id(self.next)
... |
from __future__ import division
import glob
import json
import sys
import os
import os.path
sys.path.append('/Users/rodrigobresan/Documents/dev/github/anti_spoofing/spoopy')
import numpy as np
from keras.applications import VGG16, VGG19
from sklearn.ensemble import BaggingClassifier
from sklearn.metrics import accur... |
import numpy as np
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC, BUTTON_STATES, CarControllerParams
def get_mqb_pt_can_parser(CP, can... |
# Volatility
# Copyright (c) 2008-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as
# published by the Free Software Foundation. You may not use, modify or
# distribu... |
# Copyright 2020 The DDSP 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 or agreed to in wri... |
from maya import cmds
import pyblish.api
import openpype.api
class ValidateYetiRenderScriptCallbacks(pyblish.api.InstancePlugin):
"""Check if the render script callbacks will be used during the rendering
In order to ensure the render tasks are executed properly we need to check
if the pre and post rende... |
from app import app
if __name__ == '__main__':
app.run(debug=True, use_reloader=False) |
# Exploit Title: Keycloak 12.0.1 - 'request_uri ' Blind Server-Side Request Forgery (SSRF) (Unauthenticated)
# Date: 2021-10-13
# Exploit Author: Mayank Deshmukh
# Author Twitter: ColdFusionX_
# Vendor Homepage: https://www.keycloak.org/
# Software Link: https://www.keycloak.org/archive/downloads-12.0.1.html
# Ve... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import asyncio
import io
import logging
import os
import warnings
import weakref
from datetime import datetime, timedelta
from glob import has_magic
from azure.core.exceptions import (
ClientAuthenticationError,
HttpRes... |
from __future__ import absolute_import, print_function, unicode_literals
import math
import re
import urllib
from functools import wraps
from .jstypes import Global, Hook, JSArray, Undefined
@Global.hook('encodeURI', 'return')
def encodeURI(this, args, callee):
return (urllib.quote(args[0].as_str().encode('utf-... |
import sys, os, json
class ManageJson(object):
def __init__(self):
self.dir = 'data/'
if self.readJson() == "Not exist":
self.createJson()
self.data = self.readJson()
def search(self, valeur, keyDict):
for i in self.data:
if valeur == i.get(keyDict):
... |
'''
Description:
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7... |
#! /usr/bin/env python
#
# File Name : generate_grid_mrf_model.py
# Created By : largelymfs
# Creation Date : [2016-01-20 14:42]
# Last Modified : [2016-01-20 14:50]
# Description : the pyscripts to generate mrf grid model
#
def output_2d... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1PciHos... |
from django.conf import settings
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_save, post_save, pre_delete
from django.dispatch import receiver
from proso.django.models import ModelDiffMixin
from proso.django.models import disable_for_loaddata
from proso.django.req... |
# -*- coding: utf-8 -*-
import logging
import datetime
import torch
import torch.cuda
from beaver.data import build_dataset
from beaver.infer import beam_search
from beaver.loss import WarmAdam, LabelSmoothingLoss
from beaver.model import NMTModel
from beaver.utils import Saver
from beaver.utils import calculate_bleu... |
"""Exception hierarchy for abd user and system errors."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_exception
#
# Public Classes:
# AbdBaseException
# AbdUserException
# AbdSyste... |
import magma.simulator.mdb
from .python_simulator import PythonSimulator
|
# This file processes our queries, runs them through OpenSearch against the BBuy Products index to fetch their "rank" and so they can be used properly in a click model
import ltr_utils as lu
import numpy as np
import pandas as pd
import query_utils as qu
from opensearchpy import RequestError
from collections import de... |
from sys import float_info
from jax.scipy.linalg import solve, expm
from optimism.JaxConfig import *
from optimism.phasefield.PhaseFieldMaterialModel import MaterialModel
from optimism.material.J2Plastic import compute_flow_direction
from optimism.material import Hardening
from optimism import TensorMath
# index en... |
import json
import logging
import posixpath
from funcy import cached_property
from .errors import ObjectFormatError
from .file import HashFile
from .stage import get_file_hash
logger = logging.getLogger(__name__)
class Tree(HashFile):
PARAM_RELPATH = "relpath"
def __init__(self, *args, **kwargs):
... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from core import models
class UserAdmin(BaseUserAdmin):
ordering = ['id']
list_display = ['email', 'name']
fieldsets = (
(None, {'fields': ('email', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This module contains abstract class IGraph represents graphs interface and
class Graph (based on IGraph) which implements undirected graph.
Examples
--------
Create simple graph with 4 nodes.... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... |
def last_digit(n1, n2):
|
"""
wrapanapi.entities
"""
from __future__ import absolute_import
from .template import Template, TemplateMixin
from .vm import Vm, VmState, VmMixin
from .instance import Instance
from .physical_container import PhysicalContainer
from .stack import Stack, StackMixin
from .server import Server, ServerState
__all__ = [... |
from ground.base import (Context,
Orientation)
from ground.hints import Point
from reprit.base import generate_repr
class Edge:
@classmethod
def from_endpoints(cls,
left: Point,
right: Point,
interior_to_left: bool,
... |
class MyHashSet:
def __init__(self):
"""
Initialize your data structure here.
"""
self.val = [-1] * 1000001
def add(self, key: int) -> None:
if self.val[key] == -1:
self.val[key] = 1
def remove(self, key: int) -> None:
self.val[key] = -1
de... |
from compas_fab.sensors import SerialSensor
from compas_fab.sensors.exceptions import ProtocolError
FRAME_HEAD = '{%s,%s,%s'
FRAME_TAIL = '%s%s}'
def format_command(address, command, data=None):
data = data + ',' if data else ''
frame = FRAME_HEAD % (address, command, data)
return FRAME_TAIL % (frame, ca... |
#www.stuffaboutcode.com
#Raspberry Pi, Minecraft Snake
#import the minecraft.py module from the minecraft directory
import mcpi.minecraft as minecraft
#import minecraft block module
import mcpi.block as block
#import time, so delays can be used
import time
#import random module to create random number
import random
... |
# Generated by Django 3.2 on 2021-09-18 07:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('produc... |
#########################################################################
# Copyright (C) 2007, 2008, 2009
# Alex Clemesha <alex@clemesha.org> & Dorian Raymer <deldotdr@gmail.com>
#
# This module is part of codenode, and is distributed under the terms
# of the BSD License: http://www.opensource.org/licenses/bsd-li... |
#!/usr/bin/env python2
"""
Usage:
python -m test.regrtest [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
If no arguments or options are provided, finds all files matching
the pattern "test_*" in the Lib/test subdirectory and runs
them in alphabeti... |
import socket
class Proxy:
""" Class for wrapping a shared resource object and getting
notified when it's deleted
"""
def __init__(self, object, **kwargs):
self.object = object
self.on_delete = kwargs.get('on_delete', None)
def __del__(self):
if self.on_delete:
... |
class SpecialFuncs(object):
@classmethod
def make_body(cls, func):
key = 'make_body_' + func.funcname
if key in cls.__dict__:
return cls.__dict__[key].__get__(None, SpecialFuncs)(func)
@staticmethod
def make_body_MemoryContextAllocZeroImpl(func):
return """
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.c... |
import jnettool.tools.elements.NetworkElement \
jnettool.tools.Routing \
jnettool.tools.RouteInspector
ne = jnettool.tools.elements.NetworkElement('127.0.0.1')
try:
routing_table - ne.getRoutingTable() # fetch table
except jnettool.tools.elements.MissingVar:
# record table fault
logging.exc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.