text
stringlengths
475
200k
from tech.models import Article import os,time def _query_and_write_last_update(file_path,last_update_file): """Checking the last added Article, and saving the timestamp into file (yes yes, Memcached, I know)""" last_event = Article.objects.latest('added_at') result = last_event.added_at.strftime('%Y-%m-%d...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from measurements import blink_style from telemetry import decorators from telemetry.unittest_util import options_for_unittests from telemetry.unittest_util...
import logging import asyncio from ..utils import load_plugins, invoke_plugins from ..config import config from .base import RetrieverError, RetrieverSoftError, RetrieverHardError, RetrieverAborted, RetrieverAbortedSoft, RetrieverAbortedHard log = logging.getLogger('stagehand.retrievers') plugins, broken_plugins = l...
from django.test import TestCase from django.contrib.gis.geos import LineString from django.db import connections, DEFAULT_DB_ALIAS from django.contrib.gis.geos import fromstr class SmartMakelineTest(TestCase): def smart_makeline(self, lines): assert lines > 0 if isinstance(lines[0], basestring):...
# -*- coding: utf-8 -*- ############################################################################### # # GetFileMetadata # Retrieves metadata for a specific file. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
# coding: utf-8 # (c) 2015-09-26 Teruhisa Okada import matplotlib.pyplot as plt import numpy as np import romspy import his def _convert_address(filename): return filename.replace('/home/okada', 'Z:') if __name__ == '__main__': import os romspy.cmap('jet') mapfile = '/home/okada/Dropbox/Maps/deg_O...
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from tapi_server.models.base_model_ import Model from tapi_server.models.tapi_photonic_media_otsi_capability_pac import TapiPhotonicMediaOtsiCapabilityPac # noqa: F401...
""" GNU GENERAL PUBLIC LICENSE Version 2 Created on Mon Oct 13 18:56:19 2014 @author: Wasit """ import numpy as np #from scdataset_spiral import dataset #import imp class engine: def __init__(self,dset): self.bag=None self.queue=None self.dset=dset # self.dsetname=dsetname # ...
from __future__ import unicode_literals from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from mezzanine.core.views import direct_to_template from mezzanine.conf import settings admin.autodiscover() # Add the urlpatterns for any cus...
""" .. testsetup:: import io import nbtlib from nbtlib import * The library supports reading and writing nbt data in all its forms and treats everything as uncompressed big-endian nbt by default. You can load nbt files with the :func:`load` function. .. doctest:: >>> nbtlib.load("docs...
""" This file is part of gempy. gempy 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. gempy is distributed in the h...
# Copyright (C) 2010-2011 Mark Burnett # # 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 version 3 of the License, or # (at your option) any later version. # # This prog...
""" Run Processes in parallel. Requires Python 3.5 or greater """ import asyncio import configparser from TM1py.Services import TM1Service config = configparser.ConfigParser() # storing the credentials in a file is not recommended for purposes other than testing. # it's better to setup CAM with SSO or use keyring to...
# -*- coding: utf-8 -*- # (c) 2008 Canonical Ltd. # Author: Martin Pitt <[EMAIL]> # License: GPL v2 or later import re, os.path, logging, subprocess from jockey.handlers import Handler # dummy stub for xgettext def _(x): return x class SlModem(Handler): def __init__(self, backend): Handler.__init__(self...
#!/usr/bin/python # # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "Li...
#!/usr/bin/env python3 # Example 1: # Input: "bcabc"Output: "abc" # Example 2: # Input: "cbacdcbc" # Output: "acdb" # My thinking process # The first night, my first thought is to move a letter backward # If the letter immediately after it is smaller than it, e.g. # bab, we should move the 1st b back # The difficulti...
from collections import defaultdict from distutils.version import StrictVersion from django_bulk_update.helper import bulk_update from django.conf import settings as django_settings from django.db import transaction from django.db.models import F, Q from django.http import JsonResponse from django.contrib.contenttypes...
# This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2016 Rami Ali # # 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 res...
import numpy as np from pele.utils.hessian import sort_eigs __all__ = ["normalmode_frequencies", "normalmodes", "logproduct_freq2"] class NormalModeError(Exception): """raised if the normal mode results are not as expected this typically means that a minimum is actually a transition state, or a transit...
import pytest import responses from prometheus_client import generate_latest, CollectorRegistry from azure_costs_exporter.allocated_vm_collector import AzureAllocatedVMCollector @pytest.fixture() def enable_login(): responses.add( method='POST', url='https://login.microsoftonline.com/tenant_id/o...
""" This is a Python version of the ForestMoon Dynamixel library originally written in C# by Scott Ferguson. The Python version was created by Patrick Goebel (mailto:[EMAIL]) for the Pi Robot Project which lives at http://www.pirobot.org. The original license for the C# version is as follows: This software ...
#!/usr/bin/python2.7 #coding:utf-8 import os import sys import json import MySQLdb import requests from pprint import pprint from dummy import BASEDIR from mysql_class import MySQLHelper from common import addslashes # ---------------------------------------------------------------------------------------------------- ...
#========================================================================= # mesh_net_CL_v1.py #========================================================================= from pymtl import * from NetObject import NetObject from pclib.ifcs import InValRdyBundle, OutValRdyBundle #, NetMsg from pclib.cl im...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe import frappe.defaults from frappe.utils import flt from erpnext.accounts.utils import get_balance_on from erpnext.accounts.report.financi...
from orderedset import OrderedSet from structurizr.model import tags from structurizr.model.element import Element, CANONICAL_NAME_SEPARATOR from structurizr.model.location import Location class Person(Element): def __init__(self): super().__init__() self._location = Location.UNSPECIFIED de...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2010 C Sommer, C Straehle, U Koethe, FA Hamprecht. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are # permitted provided that the following conditions are met: # # 1. Redistributions of...
# -*- coding: utf-8 -*- import copy from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from django.db import models from django.utils.functional import LazyObject, empty from polymorphic.models import PolymorphicModelBase from shop.conf import app_settings class Defer...
import cadquery as cq # These can be modified rather than hardcoding values for each dimension. plate_radius = 2.0 # The radius of the plate that will be extruded hole_pattern_radius = 0.25 # Radius of circle where the holes will be placed thickness = 0.125 # The thickness of the plate that will be...
# 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...
# -*- coding: utf-8 -*- """ OCR Utility Functions @copyright: 2009-2012 (c) Sahana Software Foundation @license: MIT 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 ...
# Data for IMMA attachment 1 - icoads # IMMA documentation is at http://icoads.noaa.gov/e-doc/imma class IMMAIcoads: attachment = 'icoads' number = 1 # List of parameters in icoads section # In the order they are in on disc parameters = ('BSI','B10','B1','DCK','SID','PT','DUPS','DUPC','TC', 'PBWX'...
# encoding: utf-8 # Copyright 2011 Tree.io Limited # This file is part of Treeio. # License www.tree.io/license # encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding...
# -*- coding: utf-8 -*- # Copyright (C) 2013-2016 Avencall # # 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 version 3 of the License, or # (at your option) any later version. # # This p...
# # Copyright 2012 New Dream Network, LLC (DreamHost) # # Author: Doug Hellmann <[EMAIL]> # # 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 #...
# # Copyright (c) 2015 Juniper Networks, Inc. All rights reserved. # from gevent.queue import Queue as GQueue import os, json, sys, subprocess, time, gevent from tempfile import NamedTemporaryFile, mkdtemp import cPickle as pickle from snmpuve import SnmpUve class Controller(object): def __init__(self, config): ...
# testing/requirements.py # Copyright (C) 2005-2017 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Global database feature support policy. Provides decorators to mark test...
import datetime from spindrift.micro import Micro PORT = 12345 PATH = '/test/coerce' ID = 123 DATE = datetime.date(2018, 12, 13) def to_date(ts): return datetime.datetime.strptime(ts, '%Y-%m-%d').date() def coerce(request, id, when): assert id == ID return when.isoformat() def on_coerce(rc, result)...
#!/usr/bin/env python # # Copyright 2016 Google 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 requir...
from pywr.recorders import Aggregator from pywr.recorders._recorders import _agg_func_lookup import numpy as np import pytest npy_funcs = { "min": np.min, "max": np.max, "mean": np.mean, "sum": np.sum, "median": np.median, "product": np.product, "all": np.all, "any": np.any } def cus...
import functools import random import re import string from enum import Enum import PIL import asyncio import cachetools import pkg_resources from PIL import Image from PIL import ImageDraw from PIL import ImageFont from plumeria import config from plumeria.command import CommandError, commands, channel_only from plu...
# -*- coding: utf-8 -*- ########################################################################## # # # Eddy: a graphical editor for the specification of Graphol ontologies # # Copyright (C) 2015 Daniele Pantaleone <[EMAIL]> # # ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Project.whitelisted' db.delete_column('projects_project', 'whitelisted') def backwards(sel...
import tensorflow as tf import gailtf.baselines.common.tf_util as U from gailtf.baselines import logger from tqdm import tqdm from gailtf.baselines.common.mpi_adam import MpiAdam import tempfile, os from common.statistics import stats import ipdb def evaluate(env, policy_func, load_model_path, stochastic_policy=False,...
#!/usr/bin/python ''' This is a simplistic Diffie-Hellman key exchange implementation. For demonstration use only. Before implementing your own crypto in production, read this: https://www.schneier.com/essays/archives/1999/03/cryptography_the_imp.html ''' from os import urandom from rfcprime import dfgetprime # my li...
# -*- coding: utf-8 -*- # ------------------------------------------------------------ # pelisalacarta 4 # Copyright 2015 [EMAIL] # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ # # Distributed under the terms of GNU General Public License v3 (GPLv3) # http://www.gnu.org/licenses/gpl-3.0.html # ---------------...
# -*- coding: utf-8 -*- # # This file is part of NINJA-IDE (http://ninja-ide.org). # # NINJA-IDE 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 # any later version. # # NIN...
# -*- coding: utf-8 -*- # # BitcoinLib - Python Cryptocurrency Library # BlockstreamClient client # © 2019 November - 1200 Web Development <http://1200wd.com/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pu...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging from odoo import api, models, fields from odoo.addons.phone_validation.tools import phone_validation from odoo.tools import html2plaintext, plaintext2html _logger = logging.getLogger(__name__) class Ma...
from rest_framework import viewsets, serializers from rest_assured.testcases import BaseRESTAPITestCase from tests.models import Stuff class MockObject(object): pass class MockFactory(object): @classmethod def create(cls): return MockObject() class StuffFactory(object): @classmethod d...
# -*- coding: utf-8 -*- # # Copyright © 2012 - 2019 Michal Čihař <[EMAIL]> # # This file is part of Weblate <https://weblate.org/> # # 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 versio...
""" Cisco_IOS_XE_bgp_oper This module contains a collection of YANG definitions for monitoring BGP information.Copyright (c) 2016\-2017 by Cisco Systems, Inc.All rights reserved. """ import re import collections from enum import Enum from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict...
#!/usr/bin/env python """ Parse assay data from PubChem BioAssay (PCBA). """ __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "BSD 3-clause" import argparse import numpy as np from vs_utils.utils import write_pickle from vs_utils.utils.target_utils import PcbaParser ...
# -*- coding: iso-8859-1 -*- #------------------------------------------------------------ # streamondemand - XBMC Plugin # Lista de vídeos favoritos # http://blog.tvalacarta.info/plugin-xbmc/streamondemand/ #------------------------------------------------------------ import urllib import os import sys import download...
# -*- coding: utf8 -*- u""" Mathics: a general-purpose computer algebra system Copyright (C) 2011-2013 The Mathics Team 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 ver...
import os.path import sys import tempfile from textwrap import dedent from flexmock import flexmock import pytest import docker_build.cli from docker_build.image.api import BaseImageLayer class Stdin(object): def __init__(self): self._original = sys.stdin def __enter__(self): sys.stdin = se...
#!/usr/bin/env python # # Copyright 2014,2019 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ TXs a waveform (either from a file, or a sinusoid) in a frequency-hopping manner. """ import argparse import numpy import pmt from gnuradio import gr fr...
# -*- coding: utf-8 -*- """ S3 Workflow Engine Data Model @copyright: 2012-2014 (c) Sahana Software Foundation @license: MIT 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 ...
# Copyright 2015 Open vStorage NV # # 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 writ...
import sys class Board(object): def __init__(self, size=3, test_board = False): self.empty_cells = [] self.next_player = 'X' self.winner_msg = '' if test_board: self.size = len(test_board) else: self.size = size self.fields = [] for ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from collections import OrderedDict from odoo import http from odoo.exceptions import AccessError from odoo.http import request from odoo.tools.translate import _ from odoo.addons.portal.controllers.portal import get_re...
# =============================================================================== # Copyright 2012 Jake Ross # # 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/licens...
import logging logger = logging.getLogger(__name__) class StillReferenced(Exception): """ Thrown whenever an action is taken towards an element that is still referenced by another that would compromise the relationship like deleting the referenced object """ def __init__(self, msg: str): ...
import subprocess import os import sys #defines the two arguments as the class and editor vClass = int(sys.argv[1]) vEditorNum = int(sys.argv[2]) vDate = str(sys.argv[3]) sem = "Semester_1" #reads the db_home variable and defines it as "dropbox" dropbox = str(os.getenv('DB_HOME')) #Sets the clasis variable based on ...
""" Support for Zwave cover components. For more details about this platform, please refer to the documentation https://home-assistant.io/components/cover.zwave/ """ # Because we do not compile openzwave on CI # pylint: disable=import-error import logging from homeassistant.components.cover import DOMAIN from homeassi...
""" classic-server - A basic Minecraft Classic server. Copyright (C) 2015 SopaXorzTaker 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 version 3 of the License, or (a...
# Copyright (c) 2015 OpenStack Foundation. # # 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...
# -*- coding: utf-8 -*- import unittest from datetime import datetime, timedelta from copy import deepcopy from iso8601 import parse_date from time import sleep from logging import getLogger from openprocurement.chronograph import TZ from openprocurement.chronograph.scheduler import planning_auction from openprocureme...
# Copyright 2016 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. # This file is licensed to you under the AWS Customer Agreement (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at http://aws.amazon.com/agreement/ . # This file...
from EmailM import * from FilterM import * from SmartVacationResponderM import * import json #This is our smart responder! myResponder = SmartVacationResponder() myResponder.setGeneralResponse("I'm on a vacation!\n(This is a general response.)"); #Use Case 1---------------Response to a classmate--------------------...
import os import itertools from cv_core.database import CardvaultDB from cv_core.util import CoreConfig, CoreConstants, CoreUtilities class CardvaultEngine: def __init__(self, config_file=False): """ Create a new cv_core instance :param config_file: File path of the configuration file """...
""" Acceptance tests for discussion component in studio """ from common.test.acceptance.tests.studio.base_studio_test import ContainerBase from common.test.acceptance.fixtures.course import XBlockFixtureDesc from common.test.acceptance.pages.studio.container import ContainerPage from common.test.acceptance.pages.studio...
'''Splitter ====== .. versionadded:: 1.5.0 .. image:: images/splitter.jpg :align: right The :class:`Splitter` is a widget that helps you re-size it's child widget/layout by letting you re-size it via dragging the boundary or double tapping the boundary. This widget is similar to the :class:`~kivy.uix.scrollview....
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from blinkpy.web_tests.models import testharness_results class TestHarnessResultCheckerTest(unittest.TestCase): def test_is_all_pass_...
#!/usr/bin/env python2.7 # Nest thermostat controller # # https://github.com/scotte/nestcontrol # Licensed under GNU GPL 3.0. See the LICENSE. import argparse import json from nest.nestcontrol import NestControl if __name__ == '__main__': argparser = argparse.ArgumentParser(description="Nest thermostat controll...
#!/usr/bin/env python # -*- coding: utf-8 -*- ## Copyright 2011, IOActive, Inc. All rights reserved. ## ## AndBug is free software: you can redistribute it and/or modify it under ## the terms of version 3 of the GNU Lesser General Public License as ## published by the Free Software Foundation. ## ## AndBug is distr...
from __future__ import division from math import log, ceil, floor import os import re from subprocess import Popen, PIPE import sys from tempfile import TemporaryFile from warnings import warn try: import audioop except ImportError: import pyaudioop as audioop if sys.version_info >= (3, 0): basestring =...
"""empty message Revision ID: bb9f97cf66d7 Revises: c8161cd56b29 Create Date: 2016-07-06 18:39:13.479086 """ # revision identifiers, used by Alembic. revision = 'bb9f97cf66d7' down_revision = 'c8161cd56b29' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy.typ...
from pyramid.response import Response from pyramid.view import view_config from sqlalchemy.exc import DBAPIError from .models import ( DBSession, User, Address, ) from datatables import ColumnDT, DataTables conn_err_msg = """\ Pyramid is having a problem using your SQL database. The problem might...
"""this module holds the classes applicable for working with general rigid body systems. i.e. those that do not necessarily have a representation as a set of atomistic coords. see rigidbody.py for those classes which derive from these. """ import numpy as np from pele.utils import rotations from pele.angleaxis import...
''' Created on Apr 17, 2014 @author: sstober @deprecated: replaced by scripts in run/ that use more YAML ''' import time; import logging; import os; import numpy as np; log = logging.getLogger(__name__); from deepthought.experiments.ismir2014.util import load_config; from deepthought.util.yaml_util import load_ya...
# Developer: SpatialDev # Company: Spatial Development International # standard library import os from datetime import datetime from itertools import takewhile # third-party import arcpy import numpy as np # ETL utils from etl_utils import FTPDownloadManager, UnzipUtils class TRMMExtractValidator(object): ...
# Base folder support # Copyright (C) 2002-2015 John Goerzen & contributors # # 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 version 2 of the License, or # (at your option) a...