src stringlengths 721 1.04M |
|---|
# 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 ... |
import datetime
from time import gmtime, strftime
import pytz
#Humanize time in milliseconds
#Reference: http://stackoverflow.com/questions/26276906/python-convert-seconds-from-epoch-time-into-human-readable-time
def HTM(a, context):
#print "Processing ....", a
b = int(datetime.datetime.now().strftime("%s"))
... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
class Monoalphabetic:
""" Frequency Information:
E 12.51%
T 9.25
A 8.04
O 7.60
I 7.26
N 7.09
S 6.54
R 6.12
H 5.49
L 4.14
D 3.99
C 3.06
U 2.71
M 2.53
F 2.30
P 2.00
... |
# Copyright 2013 IBM Corp
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
import sys
import pandas as pd
import numpy as np
from sklearn.preprocessing import Binarizer, MaxAbsScaler, MinMaxScaler
from sklearn.preprocessing import Normalizer, PolynomialFeatures, RobustScaler, StandardScaler
from sklearn.decomposition import FastICA, PCA
from sklearn.kernel_approximation import RBFSampler, Ny... |
from __future__ import division, absolute_import, print_function
import copy
import pickle
import sys
import platform
import gc
import copy
import warnings
import tempfile
from os import path
from io import BytesIO
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_equa... |
#!/usr/bin/env python
#
# Copyright (C) 2010 Toms Baugis
#
# Original code from Banshee control,
# Copyright (C) 2009-2010 Jason Smith, Rico Tzschichholz
#
# 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 Soft... |
#!/usr/bin/python
# $Id:$
"""checks that certain code snipets are the same across the samples and test
directories.
This is a release helper.
Usage:
uniform_snippet.py [<task_selection>]
Where <task_selection> one of:
--report
list files using a different variation of reference snipet
... |
import signal
from time import monotonic
import stomp
from stomp.listener import TestListener
from .testutils import *
@pytest.fixture()
def testlistener():
yield TestListener("123", print_to_log=True)
@pytest.fixture()
def conn(testlistener):
conn = stomp.Connection11(get_default_host())
conn.set_list... |
# -*- coding: utf-8 -*-
import getpass
import os
import re
import fnmatch
import datetime
import time
import ssl
try:
import configparser
except ImportError:
import ConfigParser as configparser
from txclib.web import *
from txclib.utils import *
from txclib.packages import urllib3
from txclib.packages.urlli... |
import argparse
import sys
import time
from doorbell import SlackDoorbell
from ringer import FaceDetectionDoorbellRinger
from visionapi import VisionAPIClient
def parse_args(argv):
parser = argparse.ArgumentParser()
parser.add_argument(
'--motion-output-dir',
required=True,
type=str,
... |
# denyhosts sync server
# Copyright (C) 2015 Jan-Pascal van Best <janpascal@vanbest.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, o... |
# Copyright (C) 2015 Accuvant, Inc. (bspengler@accuvant.com)
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import tempfile
from zipfile import ZipFile
try:
from rarfile import RarFile
HAS_RARFILE = True
except ImportError:
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SagaAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
from __future__ import absolute_import
# Copyright (c) 2010-2018 openpyxl
## Incomplete!
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
Float,
Integer,
Set,
String,
Bool,
)
from openpyxl.descriptors.excel import Guid, ExtensionList
from ope... |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import os
import collections
import json
class ConfigParser(object):
"""Used to parse the JSON indicator extraction configuration files.
Attributes:
config_dict: the parsed dictionary representati... |
#!/usr/bin/env python3
from __future__ import with_statement, division, print_function, unicode_literals
from collections import defaultdict
import sys, heapq
dte_problem_definition = """
Byte pair encoding, dual tile encoding, or digram coding is a static
dictionary compression method first disclosed to the public by... |
from __future__ import division, print_function
import numpy as np
from .optimizer import LinearScanOptimizer
class PeriodicModeler(object):
"""Base class for periodic modeling"""
def __init__(self, optimizer=None, fit_period=False,
optimizer_kwds=None, *args, **kwargs):
if optimize... |
'''
Bayesian Online Compressed Sensing (2016)
Paulo V. Rossi & Yoshiyuki Kabashima
'''
from collections import namedtuple
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
from numpy.random import normal
from utils import DlnH, DDlnH, G, H, moments
def simulation(method='standard'):
... |
from pyramid.httpexceptions import HTTPError
from seth.tests import UnitTestBase, IntegrationTestBase
from seth.tests.models import SampleModel
from seth import exporting
from seth import filtering
from seth.classy import web
from seth.classy.web import export
class ExporterTestCase(UnitTestBase):
def test_exp... |
import datetime
import logging
import os
import re
import sys
from time import mktime, sleep
import feedparser
import youtube_dl
from .config import Config
from . import db
from .utils import Utils
from .mpdutil import mpd_update, make_playlists
c = Config().conf_vars()
db = db.Database()
ut = Utils()
CONFIGPATH = ... |
# disklabel.py
# Device format classes for anaconda's storage configuration module.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your ... |
# This file is part of Checkbox.
#
# Copyright 2012-2013 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox 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 v... |
# Hello World
#
# A minimal script that tests The Grinder logging facility.
#
# This script shows the recommended style for scripts, with a
# TestRunner class. The script is executed just once by each worker
# process and defines the TestRunner class. The Grinder creates an
# instance of TestRunner for each worker thre... |
from os.path import abspath, dirname, join as path_join
from django.conf import global_settings
BASE_DIR = dirname(dirname(abspath(__file__)))
SRS_FILE_ROOT = path_join(BASE_DIR, "srs")
IMG_PATH = path_join(SRS_FILE_ROOT, "static/img")
MAPS_PATH = path_join(SRS_FILE_ROOT, "static/maps")
REPLAYS_PATH = path_join(SRS_... |
import logging
from JDI.core.logger.log_levels import LogLevels
class JDILogger(object):
def __init__(self, name="JDI Logger"):
self.logger = logging.getLogger(name)
self.__basic_settings()
log_level = {LogLevels.INFO, LogLevels.FATAL}
def info(self, log_msg):
if LogLevels.INFO... |
from collections import Counter
import pygame
from constants import BOX, HEIGHT, WIDTH, SCREEN
class Cell(object):
def __init__(self, pos):
self.color = (255,0,0)
self.neighbors = 0
self.neighbor_list = []
self.pos = pos
self.x = pos[0]
self.y = pos[1]
def... |
#!/usr/bin/env python
import sys
import operator
import pandas as pd
import numpy as np
from sklearn import cross_validation
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import label_binarize
from sklearn.metrics import roc_curve, au... |
'''
Simimple Model Railway Automation
Hall-effect Sensor Support Module
Author : Peter Wallen
Created : 21/1/13
Version 1.0
This code encapulates hardware associated with sensors used to detect the location of trains.
The hardware supported comprises of :
One or more Microchip MCP2301... |
#
# Copyright (C) 2007-2020 by frePPLe bv
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This library is d... |
# -*- coding: utf-8 -*-
from group import Group
from info_contact import Infos
from application import Application
import pytest
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_group(app):
app.login( username="admin", passw... |
# Copyright 2020 Northern.tech AS
#
# 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 a... |
import asyncio
import numpy as np
class ControllerBase:
def __init__(self, raspberry, relay, sample_time, shutdown_temperature):
self._raspberry = raspberry
self._relay = relay
self._stop_controller = False
self._measurement = []
self.sample_time = sample_time
self... |
# -*- coding: utf-8 -*-
"""
This module contains all the default questionnaire models
:subtitle:`Class definitions:`
"""
from django import forms
from django.db import models
from django.utils.translation import ugettext as _
from apps.questionnaire.models import QuestionnaireBase
from core.models import DateField, Ch... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from postgres.orm import Model
from .emails import Emails
from .team import Team
NPM = 'npm' # We are starting with a single package manager. If we see
# traction we will expand.
class Package(... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Micronaet SRL (<http://www.micronaet.it>).
# Copyright (C) 2014 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# This pro... |
from itertools import combinations
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_in
from nose.tools import assert_raises
from nose.tools import assert_true
from nose.tools import ok_
import networkx as nx
from networkx.testing.utils import assert_edges_equal
fro... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 29 14:11:58 2019
@author: roman
"""
from sympy import *
################## Here are the variables you can change to see the effects on the cov matrix ###########################
yaw_init = 0.5
# ground speed in body frame (comes from ekf2)
groun... |
#!/usr/bin/env python2.7
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--nepoch',type=int,default=50)
parser.add_argument('--version',type=int,default=4)
args = parser.parse_args()
from os import path
import extra_vars
from subtlenet.models import singletons as train
train.NEPOCH... |
import os
import sys
# Constant for verify connection
FTRACK_CONNECTED = False
sys.path += ["D:/server/apps/3rdparty/ftrack-python"]
os.environ['FTRACK_SERVER'] = 'https://cas.ftrackapp.com'
os.environ['LOGNAME'] = 'fabianopetroni'
import ftrack
FTRACK_CONNECTED = True
class Connector(object):
"""Class for Co... |
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2015 tknorris
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.
... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of perseo-fe
#
# perseo-fe is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 ... |
import unittest
import time
from contextlib import suppress
from queue import Queue as ThreadQueue
from threading import Thread
from threading import Event as ThreadEvent
import numpy as np
from pdp.base import InterruptableQueue, StopEvent, start_one2one_transformer
DEFAULT_LOOP_TIMEOUT = 0.02
def set_event_after... |
# coding=utf-8
import types
import logging
from tornado.gen import coroutine
from tornado.web import asynchronous
from tornado.web import RequestHandler
from tornado.web import HTTPError
from xiaodi.api.errors import HTTPAPIError
from xiaodi.api.errors import INTERNAL_SERVER_ERROR
from xiaodi.api.errors import BAD_REQ... |
import requests
import re
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker
from .config import (DB_NAME, DB_USER, DB_PASSWORD, WARD_SEARCH_ENDPOINT)
_engine = create_engine("postgresql://%s:%s@localhost/%s"
% (DB_USER, DB_PASSWORD, DB_NAME))
_meta... |
# -*- coding: utf-8 -*-
"""
flaskbb.configs.default
~~~~~~~~~~~~~~~~~~~~~~~
This is the default configuration for FlaskBB that every site should have.
You can override these configuration variables in another class.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more ... |
#
# This file is a part of the normalize python library
#
# normalize is free software: you can redistribute it and/or modify
# it under the terms of the MIT License.
#
# normalize is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FI... |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of inetconf interface for physical router
configuration manager
"""
from lxml import etree
from ncclient import manager
import copy
class PhysicalRouterConfig(object):
# mapping from contrail family names t... |
#! /usr/bin/env python
from __future__ import print_function
import pytest
import sys
import os
import subprocess
PYTEST_ARGS = {
'default': ['tests', '--cov=ukpostcode'],
'fast': ['tests', '-q', '--cov=ukpostcode'],
}
FLAKE8_ARGS = ['ukpostcode', 'tests', '--ignore=E501', '--ignore=E262', '--max-line-lengt... |
from copy import copy
from .util import (
add_args_to_init_call,
add_init_call_hook,
)
def declarative(member_class=None, parameter='members', add_init_kwargs=True, sort_key=None, is_member=None):
"""
Class decorator to enable classes to be defined in the style of django models.
That is, ... |
from collections import defaultdict
import errno
import math
import mmap
import os
import sys
import time
import multiprocessing as mp
from six.moves import range
import numpy as np
from .lib import Bbox, Vec, mkdir
SHM_DIRECTORY = '/dev/shm/'
EMULATED_SHM_DIRECTORY = '/tmp/cloudvolume-shm'
EMULATE_SHM = not os.pa... |
# From https://github.com/piwik/referrer-spam-blacklist/blob/master/spammers.txt - update regularly
referrer_blacklist = """0n-line.tv
100dollars-seo.com
12masterov.com
1pamm.ru
4webmasters.org
5forex.ru
7makemoneyonline.com
acads.net
adcash.com
adspart.com
adventureparkcostarica.com
adviceforum.info
affordablewebsite... |
import unittest
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_allclose
from numdifftools.extrapolation import Dea, dea3, Richardson
class TestRichardson(unittest.TestCase):
def setUp(self):
self.true_vals = {
(1, 1, 1): [-0.9999999999999998, 1.9999999999999998]... |
"""heap.py - implementation of a heap priority queue. """
__author__ = "Caleb Madrigal"
__date__ = "2015-02-17"
import math
from enum import Enum
from autoresizelist import AutoResizeList
class HeapType(Enum):
maxheap = 1
minheap = 2
class Heap:
def __init__(self, initial_data=None, heap_type=HeapType... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import subprocess
from subprocess import PIPE
import time
import os
def check_processes():
r = subprocess.Popen('ps ax | grep python', shell=True, stdout=PIPE).stdout.read()
print r
r2 = """337 ? Sl 223:46 python twfetch.py --auth
11893 ? S 2:12 python datacollection.py --au... |
# Copyright 2013 Donald Stufft and individual contributors
#
# 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... |
#!/usr/bin/python
# file: email-correct.py
# -*- coding: utf-8 -*-
import os
import sys
import email
import email.charset
import email.encoders
from email.header import Header
from email.utils import getaddresses
from email.utils import formataddr
from email.utils import parseaddr
from email.utils import make_msgid
fr... |
# coding: utf-8
# pylint: disable = C0103
"""Plotting Library."""
from __future__ import absolute_import
import warnings
from copy import deepcopy
from io import BytesIO
import numpy as np
from .basic import Booster
from .sklearn import LGBMModel
def check_not_tuple_of_2_elements(obj, obj_name='obj'):
"""check... |
import setpath
import functions
import json
import re
registered=True
'''
Example
drop table if exists mydata;
create table mydata as select 1 as adnicategory_AD, 0 as adnicategory_CN, 0 as adnicategory_MCI , 1 as gender_F ,0 as gender_M, 0.1 as x;
insert into mydata select 1 , 0 , 0 , 0 ,1 , 0.6;
insert into mydata... |
#!/usr/bin/env python
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 r... |
# Copyright 2016 0x1777
# 2016-17 Nick Boultbee
# 2017 Didier Villevalois
# 2017 Muges
# 2017 Eyenseo
# 2018 Joschua Gandert
# 2018 Blimmo
# 2018 Olli Helin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of... |
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from zhiliao.conf import settings
urlpatterns = []
if "django.contrib.admin" in settings.INSTALLED_APPS:
reset_pattern = "^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$"
urlpatterns += patterns("django.contrib.auth.views... |
from drf_yasg.utils import swagger_serializer_method
from rest_framework import serializers
from taggit_serializer.serializers import TaggitSerializer, TagListSerializerField
from dcim.api.nested_serializers import NestedDeviceRoleSerializer, NestedPlatformSerializer, NestedSiteSerializer
from dcim.constants import IF... |
import sys
from local_config import config
locals().update(config)
sys.path.append("../../")
import os
from cv_bridge import CvBridge, CvBridgeError
import sys
import std_msgs.msg
from sensor_msgs.msg import Image
import rospy
import threading
import signal
import cv2
import numpy as np
import configparser
import cs... |
# pydotmailer - A lightweight wrapper for the dotMailer API, written in Python.
# Copyright (c) 2012 Triggered Messaging Ltd, released under the MIT license
# Home page:
# https://github.com/TriggeredMessaging/pydotmailer/
# See README and LICENSE files.
#
# dotMailer API docs are at http://www.dotmailer.co.uk/api/
# T... |
# -*- coding: utf-8 -*-
"""
coqstaticbox.py is part of Coquery.
Copyright (c) 2018 Gero Kunter (gero.kunter@coquery.org)
Coquery is released under the terms of the GNU General Public License (v3).
For details, see the file LICENSE that you should have received along
with Coquery. If not, see <http://www.gnu.org/licen... |
import numpy as np
import netCDF4
import os
import sys
import subprocess
import pyroms
from pyroms_toolbox import jday2date
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
# draw line around map projection limb.
# color background of map projec... |
# stdlib imports
import math
# vendor imports
# local imports
from spgill.printer import commands
class UtilityModule:
"""Mixin for utility functions. Nuff said."""
def progress(self, n, caption=None, zeropad=False, width=None):
"""Write a progress bar with `n` from 0 to 100"""
width = widt... |
#! /bin/env python3
# encoding=utf-8
# author: nickgu
#
# Compitible for python3
#
import sys
import argparse
class ColorString:
TC_NONE ="\033[m"
TC_RED ="\033[0;32;31m"
TC_LIGHT_RED ="\033[1;31m"
TC_GREEN ="\033[0;32;32m"
TC_LIGHT_GREEN ="\033[1;32m"
TC_BLUE ... |
# =============================================================================
# Federal University of Rio Grande do Sul (UFRGS)
# Connectionist Artificial Intelligence Laboratory (LIAC)
# Renato de Pontes Pereira - renato.ppontes@gmail.com
# ============================================================================... |
import os.path
import urlparse
import datetime
import tmpl
from planet import config
def DjangoPlanetDate(value):
return datetime.datetime(*value[:6])
# remap PlanetDate to be a datetime, so Django template authors can use
# the "date" filter on these values
tmpl.PlanetDate = DjangoPlanetDate
def run(script, d... |
import datetime
from Initialization import Initialization
from Data_Controllers.blocks_controller import blocks_controller
from DB_Model import database_helper
from DB_Model.database_tester import database_tester
from DB_Model.database_model import Blocks
from DB_Model.database_model import Users
class blocks_control... |
# coding: utf-8
"""
weasyprint.tests.test_css_properties
------------------------------------
Test expanders for shorthand properties.
:copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_l... |
"""Implements the :py:class:`SearchClient` class."""
from typing import Any, List
from datetime import datetime, timezone
from pymongo.collation import Collation
import pymongo
__all__ = ['SearchClient']
class SearchClient:
"""This class executes search queries."""
def __init__(self, *, db: pymongo.databa... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Enclib v0.1 DEV
http://github.com/exted/enclib/
Copyright 2014 Exted Luo (http://extedluo.com)
This program 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 Founda... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2012 Acysos S.L. (http://acysos.com) All Rights Reserved.
# Ignacio Ibeas <ignacio@acysos.com>
# $Id$
#
# This program i... |
# -*- 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... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, itertools, operator
from functools import partial
from future_builtins import map
from collections import Ordere... |
import numpy as np
from phonopy.api_phonopy import Phonopy
from phonopy.file_IO import parse_BORN, parse_FORCE_SETS, write_FORCE_CONSTANTS, parse_FORCE_CONSTANTS
from phonopy.harmonic.dynmat_to_fc import DynmatToForceConstants
from phonopy.harmonic.force_constants import set_tensor_symmetry_PJ
from phonopy.units import... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from dateutil.parser import parse
import json
import logging
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseBadRequest
from django.utils.decora... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single f... |
#!/usr/bin/env python3
from sys import exit, stderr
from .settings import (common_multichars, fin_consonants, fin_lowercase, fin_symbols, fin_uppercase, fin_vowels,
newword_boundary, optional_hyphen, word_boundary)
def format_copyright_twolc():
return """
! This automatically generated tw... |
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from data_api.models import System, Program, SystemModel, Map, LocalComputer, Command, Signal, Setting, Event, Blob
from django.utils.timezone import now
import json
class TestAPI(TestCase):
def setUp(self):
self.client ... |
#!/usr/bin/env python
# VMware vSphere Python SDK
# Copyright (c) 2008-2021 VMware, 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/lic... |
import os, shutil, tempfile
from ubr import main, utils, file_target, conf
from .base import BaseCase
class TestFileBackup(BaseCase):
def setUp(self):
self.default_opts = conf.DEFAULT_CLI_OPTS
self.expected_output_dir = "/tmp/foo"
def tearDown(self):
if os.path.exists(self.expected_ou... |
from time import sleep
from app.component.modifier.blinker import Blinker
PINS = [0,1,2,3]
DELAY = 0.2
@given('A new Blinker instance provided with a Shifter reference')
def blinker_setup_with_shifter(context):
shifter = context.shifter
blinker = Blinker(shifter)
blinker.set_pins(PINS)
shifter.set_pins = Mag... |
# Copyright 2013 Cloudscaling Group, 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 applicabl... |
# -*- coding: utf-8 -*-
# -*- Channel Vi2.co -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
import re
import base64
from channelselector import get_thumb
from core import htt... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM 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 agreed to in wr... |
from __future__ import division
from util import *
def bin_date(timestamp):
# return timestamp.replace(microsecond=0, second=0, minute=0, hour=0, day=1)
return timestamp.replace(microsecond=0, second=0, minute=0, hour=0)
def extract_binned_posts_replies(log_filename, net_filename=None, core=0, sample_size=-... |
# -*- coding: UTF-8 -*-
# Copyright 2015-2021 Rumma & Ko Ltd
# License: BSD, see LICENSE for more details.
# Usage:
# $ go noi1e
# $ python manage.py run tours/make.py
# import time
from pathlib import Path
# from os.path import dirname
# import traceback
from django.conf import settings
from django.utils import trans... |
from trakt.mapper.core.base import Mapper
class SummaryMapper(Mapper):
@classmethod
def movies(cls, client, items, **kwargs):
if not items:
return None
return [cls.movie(client, item, **kwargs) for item in items]
@classmethod
def movie(cls, client, item, **kwa... |
#from unittest import TestCase
import re
from contextlib import contextmanager
from pydocx.parsers.Docx2Html import Docx2Html
from pydocx.utils import (
parse_xml_from_string,
)
from pydocx.tests.document_builder import DocxBuilder as DXB
from unittest import TestCase
STYLE = (
'<style>'
'.pydocx-insert {... |
# coding=utf-8
import vdebug.ui.interface
import vdebug.util
import vim
import vdebug.log
import vdebug.opts
class Ui(vdebug.ui.interface.Ui):
"""Ui layer which manages the Vim windows.
"""
def __init__(self,breakpoints):
vdebug.ui.interface.Ui.__init__(self)
self.is_open = False
s... |
# Example: calc_abundance()
# determine ionic abundance from observed
# flux intensity for gievn electron density
# and temperature using calc_abundance function
# from proEQUIB
#
# --- Begin MAIN program. ---------------
#
#
import pyequib
import atomneb
import os
import numpy as np
# Locate datasets... |
from direct.gui.DirectGui import *
from panda3d.core import *
from panda3d.direct import *
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from direct.task import Task
import FlowerBase
import FlowerPicker
class FlowerSellGUI(Di... |
# -*- coding: utf-8 -*-
import scrapy
import re
class PaginasamarillasGeriatricosSpider(scrapy.Spider):
name = "paginasamarillas_geriatricos"
allowed_domains = ["www.paginasamarillas.com.ar"]
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like ... |
#!/usr/bin/python3
# bindex/setup.py
""" Setuptools project configuration for bindex. """
from os.path import exists
from setuptools import setup
LONG_DESC = None
if exists('README.md'):
with open('README.md', 'r') as file:
LONG_DESC = file.read()
setup(name='bindex',
version='0.0.24',
autho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.