content
stringlengths
0
894k
type
stringclasses
2 values
from asyncio.events import AbstractEventLoop import inspect from typing import Any, Coroutine, List, Tuple, Protocol, Union from xml.etree.ElementTree import Element, XML from aiohttp import web import xml.etree.ElementTree as ET import socket XMLRPCValue = Any #TODO FIXME def parse_args(params: List[Element]): a...
python
from abc import ABC from abc import abstractmethod from dataclasses import dataclass from dataclasses import field from io import IOBase from numpy import integer from syntax import SyntaxBlock from syntax import SyntaxStatement from syntax import SyntaxTerm from typing import Dict from typing import List from typing i...
python
from flask import render_template_string from datetime import datetime from actions.action import BaseAction from models import ISTHISLEGIT_SVC from models.email import EmailResponse from models.event import EventReportResponded from models.template import Template from services.email import email_provider def get_t...
python
from account.conf import settings from account.models import Account def account(request): ctx = { "account": Account.for_request(request), "ACCOUNT_OPEN_SIGNUP": settings.ACCOUNT_OPEN_SIGNUP, } return ctx
python
def create_info_2dfaces(cellid:'int[:,:]', nodeid:'int[:,:]', namen:'int[:]', vertex:'double[:,:]', centerc:'double[:,:]', nbfaces:'int', normalf:'double[:,:]', mesuref:'double[:]', centerf:'double[:,:]', namef:'int[:]'): from numpy import double, zeros, sqrt ...
python
import datetime import hashlib import json from typing import Dict import uuid class Utility(object): @staticmethod def make_json_serializable(doc: Dict): """ Make the document JSON serializable. This is a poor man's implementation that handles dates and nothing else. This method modi...
python
image_directory = "./images/"
python
# coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- try: ...
python
from abc import ABC, abstractmethod import pandas as pd class ReducerAbstract(ABC): @abstractmethod def transform(self, df: pd.DataFrame) -> pd.DataFrame: ...
python
import difflib import json import re from itertools import zip_longest try: import html except ImportError: html = None def _mark_text(text): return '<span style="color: red;">{}</span>'.format(text) def _mark_span(text): return [_mark_text(token) for token in text] def _markup_diff(a, ...
python
project = "Programmation en Python" copyright = "2020, Dimitri Merejkowsky" author = "Dimitri Merejkowsky - Contenu placé sous licence CC BY 4.0" version = "0.3" language = "fr" copyright = "CC BY 4.0" templates_path = ["_templates"] exclude_patterns = [] keep_warnings = True extensions = [ "notfound.extension"...
python
""" Implements a decorator that counts the number of times a function was called, and collects statistics on how long it took to execute every single function call. """ from time import time from sys import stderr, stdout import numpy as np class FunctionLogger(object): """ stores two dictionaries: - ...
python
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
python
from .walker import RandomWalker class Node2Path: def __init__(self, graph, walk_length, num_walks, p=1.0, q=1.0, workers=1): self.graph = graph self.walk_length = walk_length self.num_walks = num_walks self.p = p self.q = q self.workers = workers def get_path...
python
#!/usr/bin/env python import json import argparse import docker # A Simple module that returns stats for given ids. def get_nested_elements(info, elements): # Function to traverse dictionaries and print when value is # not a dict (instead it's a str) # pdb.set_trace() if isinstance(elements, str): ...
python
from pyspark.sql import SparkSession from pyspark.ml import Pipeline from pyspark.ml.feature import VectorAssembler from pyspark.ml.regression import LinearRegression from pyspark.ml.evaluation import RegressionEvaluator import matplotlib.pyplot as plt import numpy as np def read_data(file_path): cars_df = spark....
python
from collections import OrderedDict from typing import Optional from queryfs.db.schema import Schema class File(Schema): table_name: str = "files" fields: OrderedDict[str, str] = OrderedDict( { "id": "integer primary key autoincrement", "name": "text", "hash": "text...
python
#!/usr/bin/env python2.7 import os import sys sys.path.append(os.path.realpath(__file__ + '/../../../../lib')) import udf from udf import useData, expectedFailure class GetpassTest(udf.TestCase): def setUp(self): self.query('CREATE SCHEMA getpass', ignore_errors=True) self.query('OPEN SCHEMA get...
python
from scipy.io import netcdf import numpy as np import numpy.matlib tave = 900 basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/2nd_deriv/T1/' basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/2nd_deriv/rho_scan2/r0.001/' basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/fg_drive/r...
python
"""Data structures supporting the who wrote this news crawler. ---- Copyright 2019 Data Driven Empathy LLC 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 ...
python
""" Module for controlling motors. """ __all__ = [ "stepper", ]
python
from rest_framework import serializers from .models import CrashCourse, CourseChapter, ChapterSection class CrashCourseSerializer(serializers.ModelSerializer): no_of_chapter = serializers.SerializerMethodField() class Meta: model = CrashCourse fields = ('id', 'title', 'slug', 'no_of_chapter') ...
python
#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow. from mosq_test_helper import * rc = 1 keepalive = 60 connect_packet = mosq_test.gen_connect("test-helper", keepalive=keepalive) connack_packet = mosq_test.gen_connack(rc=0) mid = 128 publish_packet = mosq_test....
python
import time class Logger: def __init__(self) -> None: pass def log(self, message: str) -> None: print(f'{time.ctime()}: {message}')
python
# coding: utf-8 from enum import Enum from six import string_types, iteritems from bitmovin_api_sdk.common.poscheck import poscheck_model from bitmovin_api_sdk.models.av1_adaptive_quant_mode import Av1AdaptiveQuantMode from bitmovin_api_sdk.models.av1_key_placement_mode import Av1KeyPlacementMode from bitmovin_api_sdk...
python
#!/usr/bin/env python # 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 # # Unle...
python
import hassapi as hass # # App to turn lights on and off at sunrise and sunset # # Args: # # on_scene: scene to activate at sunset # off_scene: scene to activate at sunrise class OutsideLights(hass.Hass): def initialize(self): # Run at Sunrise self.run_at_sunrise(self.sunrise_cb) # Run ...
python
#Hello World python script print("Hello World") for i in range(0, 100, 5): print(i**2) # y = 'Hello' # y * 5 # y * 5.0 w = 5 / 3 x = 5.0 / 3 y = 5.0 // 3.0 z = 5 % 3 print(w, x, y, z) # Variable points to the "object" (unlike C it does not hold the value) # y = 'Hello' # z = 'hello' # print(id(y), id(z)) # a...
python
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import sys from destination_google_sheets import DestinationGoogleSheets if __name__ == "__main__": DestinationGoogleSheets().run(sys.argv[1:])
python
PK
python
import uuid import os from django.db import models from django.urls import reverse from django.utils import timezone from django.conf import settings from django.utils.translation import gettext_lazy as _ from .utils import auto_delete_filefields_on_delete class File(models.Model): name = models.CharField(max_len...
python
from aiomotorengine import StringField, IntField, BooleanField, FloatField, DateTimeField, ReferenceField, ListField from xt_base.document.source_docs import InfoAsset from xt_base.document.base_docs import Project from dtlib.aio.base_mongo import MyDocument from dtlib.tornado.account_docs import Organization from dtl...
python
<caret>a = 1 # surprise! b = 2
python
# VNA_characteristics_classes_creators from enum import enum print "U R in VnaEnums" # Flag 4 debug SweepType = enum(LINEAR=1, LOG=2, SEGM=3, POW=4) SParameters= enum(S11=1, S12=2, S21=3, S22=4) CalType = enum(OPEN=1, SHORT=2, THRU=3, FULL_2PORT=4, FULL_1PORT=5, TRL_2PORT=6) DataFormat = enum(LOG=1, LIN=2, LIN_PHASE=...
python
from mongoengine import ( DateTimeField, IntField, EmbeddedDocument, StringField, EmbeddedDocumentListField, BooleanField, ) from mongoengine import Document class UserEvent(EmbeddedDocument): event_id = StringField() type = StringField() timestamp = DateTimeField() state = Str...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.TimePeriodRule import TimePeriodRule from alipay.aop.api.domain.TimePeriodRule import TimePeriodRule class VoucherTemplateInfo(object): def __init__(self): self._amou...
python
""" Script for generating AE examples. """ import argparse import importlib import numpy as np import os from PIL import Image import shutil import sys import torch from tqdm import tqdm from apfv21.attacks.tidr import TIDR from apfv21.attacks.afv import AFV from apfv21.utils import img_utils, imagenet_utils import ...
python
import csv import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import math pd.options.display.max_columns = None pd.options.display.max_rows = None # Load the pre-processsed dataset df = pd.read_hdf('pre-processed.h5') # Shuffling the dataset df = df.sample(frac=1).reset_inde...
python
import matplotlib.pyplot as plt import cv2 as cv from color_component import get_channel, remove_channel img = cv.imread('color_img.png') plt.subplot(3, 1, 1) imgRGB = img[:, :, ::-1] plt.imshow(imgRGB) ch = 1 imgSingleChannel = get_channel(img, ch) imgRGB = cv.cvtColor(imgSingleChannel, cv.COLOR_BGR2RGB) plt.subp...
python
# Generated by Django 3.0 on 2020-01-06 16:21 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('content', '0001_initial'), migrations.swappable_dependency(settin...
python
from django.shortcuts import render from django.http import HttpResponse from .models import Pizza def index(request): messages = ['Welcome Pizza Lovers', 'Our currently available Pizzas are:'] for pizza in Pizza.objects.all(): messages.append(str(pizza)) for topping in pizza.topping_set.all...
python
import time import traceback import logging import os import matplotlib.pyplot as plt log = logging.getLogger(__name__) log.setLevel(logging.INFO) from pycqed.analysis import analysis_toolbox as a_tools class AnalysisDaemon: """ AnalysisDaemon is a class that allow to process analysis in a separate pytho...
python
# Copyright (c) 2015 Scott Christensen # # This file is part of htpython modified from condorpy # # condorpy/htpython is free software: you can redistribute it and/or modify it under # the terms of the BSD 2-Clause License. A copy of the BSD 2-Clause License # should have be distributed with this file. from collection...
python
#!/usr/bin/env python # landScraper.py -v 1.7 # currently designed for python 3.10.2 # Author- David Sullivan # # Credit to Michael Shilov from scraping.pro/simple-email-crawler-python for the base for this code # # As a reminder, web scraping for the purpose of SPAM or hacking is illegal. This tool has been provided f...
python
""" Dailymotion OAuth2 support. This adds support for Dailymotion OAuth service. An application must be registered first on dailymotion and the settings DAILYMOTION_CONSUMER_KEY and DAILYMOTION_CONSUMER_SECRET must be defined with the corresponding values. User screen name is used to generate username. By default ac...
python
import sys import urllib2 import zlib import time import re import xml.dom.pulldom import operator import codecs from optparse import OptionParser nDataBytes, nRawBytes, nRecoveries, maxRecoveries = 0, 0, 0, 3 def getFile(serverString, command, verbose=1, sleepTime=0): global nRecoveries, nDataBytes, nRawBytes if s...
python
from WonderPy.core.wwConstants import WWRobotConstants from .wwSensorBase import WWSensorBase _rcv = WWRobotConstants.RobotComponentValues _expected_json_fields = ( _rcv.WW_SENSOR_VALUE_DISTANCE, ) class WWSensorWheel(WWSensorBase): def __init__(self, robot): super(WWSensorWheel, self).__init__(robo...
python
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------------------------------------------...
python
from ..check import Check from ..exceptions import CheckError def is_number(check_obj): try: assert isinstance(check_obj._val, check_obj.NUMERIC_TYPES) return check_obj except AssertionError: raise CheckError('{} is not a number'.format(check_obj._val)) def is_not_number(check_obj): ...
python
import os import json import time import torch from torch import optim import models from utils import reduce_lr, stop_early, since _optimizer_kinds = {'Adam': optim.Adam, 'SGD': optim.SGD} class SimpleLoader: def initialize_args(self, **kwargs): for key, val in kwargs.i...
python
# -*- coding: utf-8 -*- # # This file is part of File Dedupe # Copyright (C) 2015 Lars Holm Nielsen. # # File Dedupe is free software; you can redistribute it and/or # modify it under the terms of the Revised BSD License; see LICENSE # file for more details. """Small utility for detecting duplicate files.""" import o...
python
#!/usr/bin/env python3 from bs4 import BeautifulSoup as bf import requests import json import random import webbrowser import os import urllib import time if not os.path.exists('images'): os.mkdir('images') ls = [] def huluxia(id=250): _key = '6BD0D690D176C706DA83A5D9222E52AEF3708C7537DC1E7AEA069811D93CF42CCDEC8CF...
python
import rawTAspectrum import tkinter as tk from tkinter import ttk from tkinter import Entry, filedialog, messagebox from threading import Thread from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg, NavigationToolbar2Tk) # Implement the default Matplotlib key bindings. from matplotlib.backend_b...
python
from django.db import models import reversion class Dois(models.Model): texto = models.TextField(blank=False) versao = models.PositiveIntegerField(default=1) def save(self, force_insert=False, force_update=False, using=None, update_fields=None): # if self.id: # anterior = Dois.object...
python
from django.urls import path from . import views urlpatterns = [ path("", views.index, name="index"), path("component", views.component, name="component"), path("page1", views.page1, name="page1"), path("page2", views.page2, name="page2"), ]
python
from pywikiapi import wikipedia from helpers import clean_api, chunker import os, pymysql, json, re # Connect to English Wikipedia class WikidataAPI: site = None def __init__(self): self.site = wikipedia('www', 'wikidata') def get_item_data(self, wd_items, raw=False, attributes = ['sitelinks', 'cla...
python
# -*- coding: utf-8 -*- # vim:ts=4:sw=4:expandtab 2 # Copyright 2016, 2017 juga (juga at riseup dot net), MIT license. version = "0.8.5"
python
# SPDX-License-Identifier: MIT """Views in the context of rendering and compilation of layouts.""" # Python imports from datetime import date from logging import getLogger # Django imports from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import redirect...
python
from tabulate import tabulate from ..helpers.resource_matcher import ResourceMatcher try: from IPython.core.display import display, HTML get_ipython def display_html(data): display(HTML(data)) except (NameError, ImportError): def display_html(data): print(data) def _header_print(head...
python
from hashmap.hashmap import HashMap, LinearHashMap __all__ = ['HashMap', 'LinearHashMap']
python
# -*- coding: utf-8 -*- """ Same as calc_velocity.py, but calls mpi with changa to allow many nodes NOTE. mpirrun must be already loaded. Also, should do export MX_RCACHE=0 before loading python Created on Wed Apr 9 15:39:28 2014 @author: ibackus """ import numpy as np import pynbody SimArray = pynbody.array.SimA...
python
class Country: def __init__(self, name, capital, population, continent): self.__name = name self.__capital = capital self.__population = population self.__continent = continent my_country = Country('France', 'Paris', 67081000, 'Europe') print(my_country._Country__name) print(my_country._Country__cap...
python
from . import utils
python
import torch from torch import nn class WeightComputer(nn.Module): def __init__(self, mode="constant", constant_weight=1.0, consistency_fn=None, consistency_neigh=1, logits=False, device="cpu", min_weight=0.0): """ :param mode: in {'constant', 'balance_gt', 'pred_entropy', 'pred_consistency', 'pre...
python
# import the module, psqlwrapper is a class defined inside the postgresqlwrapper module from sqlwrapper import psqlwrapper #create a db object db = psqlwrapper() #let's connect to our postgres server #remember to start your postgres server, either by using pgadmin interface or command line db.connect('dbname', 'us...
python
import logging from pathlib import Path from typing import Optional from genomics_data_index.storage.MaskedGenomicRegions import MaskedGenomicRegions from genomics_data_index.storage.io.mutation.NucleotideSampleData import NucleotideSampleData from genomics_data_index.storage.io.mutation.SequenceFile import SequenceFi...
python
'''Approach : 1. Create a new list "temp" containing a empty list node, i.e. value is None, as the head node 2. Set the next pointer of the head node to the node with a smaller value in the given two linked lists. For example l1's head node is smaller than l2's then set the next pointer of the new list's head node to ...
python
import os import sys import unittest from shutil import copyfile from unittest.mock import MagicMock, patch import fs import pytest from moban.core.definitions import TemplateTarget try: from StringIO import StringIO except ImportError: from io import StringIO class TestCustomOptions(unittest.TestCase): ...
python
# -*- coding: utf-8 -*- # Multilingual support postpone indefinitely. Only Help has a language option. # (Making `app` method that handles all strings that should contain property `lang` which comes from config", # doesn't work either because `app` doesn't exist when widgets are initialized.) """ Besides differences ...
python
from django.core.management.base import BaseCommand from pages.models import Invite import csv class Command(BaseCommand): def handle(self, *args, **options): print('Loading CSV') csv_path = './academy_invites_2014.csv' with open(csv_path, 'rt') as csv_file: csv_reader = csv.Di...
python
import logging from django.urls import reverse from rest_framework.test import APIClient from rest_framework import status from galaxy_api.api import models from galaxy_api.auth import models as auth_models from galaxy_api.api import permissions from .base import BaseTestCase from .x_rh_identity import user_x_rh_id...
python
from __future__ import absolute_import, division, print_function import numpy as np import iminuit as minuit import time import functools import logging from .processing import build_trigger_windows from scipy import optimize as op from collections import OrderedDict from copy import deepcopy from scipy.special import ...
python
import BaseHTTPServer import time import sys import SocketServer, os import md5 try: import json except: import simplejson as json HOST_NAME = '' PORT_NUMBER = 8000 SERVER_VERSION = '1.0.1' SSDP_PORT = 1900 SSDP_MCAST_ADDR = '239.255.255.250' savedDescription = {} delay = {} counter = {} us...
python
''' In this exercise, you'll use the Baby Names Dataset (from data.gov) again. This time, both DataFrames names_1981 and names_1881 are loaded without specifying an Index column (so the default Indexes for both are RangeIndexes). You'll use the DataFrame .append() method to make a DataFrame combined_names. To distingu...
python
#!/usr/bin/env python3 import os telamon_root = os.path.realpath("../../") tuning_path = os.path.realpath(".") setting_path = tuning_path + "/settings/" spec = { "log_file": str, "num_workers": int, "stop_bound": float, "timeout": float, "distance_to_best": float, "algorithm": { "type"...
python
#-*-coding:utf-8-*- from pyspark.sql.types import IntegerType, TimestampType from pyspark.sql.functions import * from base import spark from utils import uuidsha columns = [ col('docu_dk').alias('alrt_docu_dk'), col('docu_nr_mp').alias('alrt_docu_nr_mp'), col('docu_orgi_orga_dk_responsavel').alias('alrt_...
python
from .base import BaseCLItest class TestCliPush(BaseCLItest): """ askanna push We expect to initiate a push action of our code to the AskAnna server """ verb = "push" def test_command_push_base(self): assert "push" in self.result.output self.assertIn("push", self.result.outpu...
python
"""Class performing under-sampling based on the neighbourhood cleaning rule.""" # Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com> # Christos Aridas # License: MIT from __future__ import division, print_function from collections import Counter import numpy as np from ..base import BaseMulticlassSample...
python
import unittest import numpy as np from pavlidis import pavlidis class TestPavlidis(unittest.TestCase): def test_pixel(self): case = np.zeros((3, 4), np.uint8) case[1, 2] = True result = pavlidis(case, 1, 2) self.assertEqual(len(result), 1) self.assertEqual(result[0, 0], 1)...
python
import urllib.parse from agent import source, pipeline from agent.pipeline.config.stages.source.jdbc import JDBCSource class SolarWindsScript(JDBCSource): JYTHON_SCRIPT = 'solarwinds.py' SOLARWINDS_API_ADDRESS = '/SolarWinds/InformationService/v3/Json/Query' def get_config(self) -> dict: with op...
python
from logging import getLogger import multiprocessing from pathlib import Path import random import traceback from typing import Union import networkx as nx from remake.remake_exceptions import RemakeError from remake.special_paths import SpecialPaths from remake.task import Task from remake.task_control import TaskCo...
python
#!/usr/bin/env python # # Copyright 2015 Google 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 o...
python
# Copyright (c) 2012 Qumulo, 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, sof...
python
GRAPH_ENDPOINT = 'https://graph.facebook.com/v10.0/' INSIGHTS_CSV = 'insta_insights.csv' HTML_FILE = 'index.html' CSS_FILE = 'style.css' HTML_TEMPLATE = 'index.html.template' ID_COL = 'id' IMPRESSIONS_COL = 'impressions' ENGAGEMENT_COL = 'engagement' REACH_COL = 'reach' TIMESTAMP_COL = 'timestamp' HOUR_COL = 'hour' D...
python
"""Module with git related utilities.""" import git class GitRepoVersionInfo: """ Provides application versions information based on the tags and commits in the repo """ def __init__(self, path: str): """ Create an instance of GitRepoVersionInfo :param path: The path to search...
python
from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.views.generic.list_detail import object_list from django.views.generic.create_update import * from app.models import Carrier def index(request): return object_list(request, Carrier.all().order('-li...
python
import tweepy import requests import json import os import sys import random import datetime from time import sleep # Import relevant files import twitter import retquote as rq import tweetq as tq #Insert tweet in database def insert_tweet(tweet,client): """ Inserting tweets in a different collection just for lo...
python
# -*- coding: utf-8 -*- """ Created on Thu Mar 11 22:14:51 2021 @author: Allectus """ import os import re import copy import pandas as pd import tkinter as tk import plotly.io as pio import plotly.express as px from tkinter import filedialog from lxml import etree #=================================================...
python
import requests import json def heapify(n, i, ll = []): #heapify function for heapsort smallest = i left = 2*i+1 right = 2*i+2 if left < n and ll[smallest][1] > ll[left][1]: smallest = left if right < n and ll[smallest][1] > ll[right][1]: smallest = right if i != smallest: ...
python
class JobError(RuntimeError): def __init__(self, jobId): message = "Job Failed: " + jobId super(JobError, self).__init__(message)
python
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import List, Tuple, Union import torch from pytext.config import ConfigBase from pytext.models.module import create_module from .bilstm_doc_slot_attention import BiLSTMDocSlotAttention from .jointcnn_rep import ...
python
from collections import namedtuple, defaultdict, Counter import dbm from datetime import datetime, timedelta import json from wit import Wit from darksky import forecast from apis.utils import load_parameter # time is a unix timestamp CacheKey = namedtuple('CacheKey', ['lat', 'lon', 'time', 'granularity']) def cach...
python
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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 l...
python
"""manage BaoAI Backend Main File PROJECT: BaoAI Backend VERSION: 2.0.0 AUTHOR: henry <703264459@qq.com> WEBSITE: http://www.baoai.co COPYRIGHT: Copyright © 2016-2020 广州源宝网络有限公司 Guangzhou Yuanbao Network Co., Ltd. ( http://www.ybao.org ) LICENSE: Apache-2.0 """ import os from flask_migrate import Migrate, MigrateComm...
python
r""" ================================================ CLPT (:mod:`compmech.stiffener.models`) ================================================ .. currentmodule:: compmech.stiffener.models """ module_names = [ 'bladestiff1d_clt_donnell_bardell', 'bladestiff2d_clt_donnell_bardell', 'tstiff...
python
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors # For information on the respective copyright owner see the NOTICE file # # 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 # #...
python
"""This module contains the general information for SuggestedStorageControllerSecurityKey ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class SuggestedStorageControllerSecurityKeyConsts: pass class SuggestedStorageContr...
python
from django.shortcuts import render, render_to_response, redirect from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.http import HttpResponseRedirect, HttpResponse from django.template import RequestContext from django.core.urlresolvers import reverse fro...
python
# ## https://leetcode.com/problems/palindrome-number/ # ## -2147483648 <= x <= 2147483647 # class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False if int(str(x)[::-1]) > 2147483647 or int(str(x)[::-1]) != x: return False re...
python
from socket import * def main(): # Cria host e port number host = "" port = 5000 # Cria socket server = socket(AF_INET, SOCK_DGRAM) # Indica que o servidor foi iniciado print("Servidor iniciado") # Bloco infinito do servidor while True: # Recebe a data e o endereço da con...
python