src stringlengths 721 1.04M |
|---|
import json
import logging.config
import os
import sys
import tempfile
from flask import Flask, render_template
from flask_webpack import Webpack
from flask_mail import Mail
import flask_login
from raven.conf import setup_logging
from raven.contrib.flask import Sentry
from raven.handlers.logging import SentryHandler
im... |
import functools
import inspect
def identity(value):
return value
def not_(value):
return not value
def raise_(exception=None):
if exception is None:
raise
else:
raise exception
def try_(func, handle):
def try_func(arg):
try:
return func(arg)
excep... |
#!/usr/bin/env python
from copy import deepcopy
import cPickle
import logging
import os
import re
import sys
from pymachine.construction import VerbConstruction
from pymachine.sentence_parser import SentenceParser
from pymachine.lexicon import Lexicon
from pymachine.utils import ensure_dir, MachineGraph, MachineTraver... |
"""Estimate F0 and formants using Praat
"""
# Licensed under Apache v2 (see LICENSE)
# Based on VoiceSauce files func_PraatPitch.m (authored by Yen-Liang Shue
# and Kristine Yu) and func_PraatFormants.m (authored by Yen-Liang Shue and
# Kristine Yu)
from __future__ import division
import os
import numpy as np
from... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
#!/usr/bin/env python
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import sys, os, random, fnmatch
# Our parent path might contain a ... |
#!/usr/bin/env python
#
#
# Copyright (C) 2006 Oracle. All rights reserved.
#
# 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) any later ver... |
"""
Module docstring
"""
from collections import defaultdict
import re
def parse_doc_arg(line):
"""
parse a section of argument annotations
returns a dict with all values found
"""
assert isinstance(line, str)
info = dict()
pattern = re.compile(r"(.*?)(?:\((.*)\))?\s*:((?:.*\n?.+)+)... |
import numpy as np
print("loading test data")
id_test = np.load("id_all.npz")['arr_0']
label_test = np.load("label_all.npz")['arr_0'].T
err_test = np.load("errs_all.npz")['arr_0'].T
npix_test = np.load("npix_all.npz")['arr_0']
# when a fit fails, I set the error to -9999
print("loading test errs")
teff_err_test = np.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from multiprocessing import Process
from threading import Thread
def is_armstrong(n):
a, t = [], n
while t > 0:
a.append(t % 10)
t //= 10
k = len(a)
return sum(x**k for x in a) == n
def find_armstrong(a, b):
print(a, b)
... |
from django.db import models
from django.contrib.auth.models import User
class MTGSet(models.Model):
label = models.CharField(max_length=75, unique=True)
display_name = models.CharField(max_length=75)
magiccards_info = models.CharField(max_length=10, null=True)
created = models.DateTimeField(auto_now_a... |
#!/usr/bin/env python
# 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
# "L... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
from acli.output import (output_ascii_table, output_ascii_table_list, dash_if_none)
from colorclass import Color, Windows
Windows.enable(auto_colors=True, reset_atexit=True)
def get_tag(name=None, tags=None):
if tag... |
"""
Copyright (c) 2015 by Stefan Lehmann
"""
import os
import sys
import re
import logging
from qtpy.QtCore import QModelIndex, Qt, QAbstractItemModel, QMimeData, \
QByteArray, QDataStream, QIODevice, QPoint
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QTreeView, QItemDelegate, QSpinBox, \
QDou... |
#!/usr/bin/env python
"""Usage: timepick [second|minute|hour|day|week]
A filter that picks a single line from stdin based on the current time.
This has an advantage over random selection in that it's cyclical and
thus no clustering or repetition of the selections; seems 'more random'
to people.
"""
import os
import ... |
import cv2
import numpy as np
from plantcv import print_image
### Find Objects Partially Inside Region of Interest or Cut Objects to Region of Interest
def roi_objects(img,roi_type,roi_contour, roi_hierarchy,object_contour, obj_hierarchy, device, debug=False):
# img = img to display kept objects
# roi_type = 'cutto'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# webclient_gateway
#
# Copyright (c) 2008-2014 University of Dundee.
#
# 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... |
from smbus import SMBus
from sys import exit
import os
import time
class MPL3115A2(object):
#I2C ADDRESS/BITS
ADDRESS = (0x60)
#REGISTERS
REGISTER_STATUS = (0x00)
REGISTER_STATUS_TDR = 0x02
REGISTER_STATUS_PDR = 0x04
REGISTER_STATUS_PTDR = 0x08
REGISTER_PRESSURE_MSB = (0x01)
... |
from __future__ import absolute_import
from rest_framework import permissions
from sentry.auth.superuser import is_active_superuser
class NoPermission(permissions.BasePermission):
def has_permission(self, request, view):
return False
class ScopedPermission(permissions.BasePermission):
"""
Perm... |
"""Convenience module for the end-user
The goal of this module is to provide as high-level utilities
as possible for users who wish to have as little knowledge as
possible about Open Folder.
Target audience leans towards Technical Directors or
fellow scripters in any DCC.
"""
from __future__ import absolute_import
... |
# -*- coding: utf-8 -*-
#
# backuppurge: Selectively purge daily full backups
#
# Copyright (c) 2013, 2015 Thomas Perl <m@thp.io>
# 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. Redistrib... |
# -*- coding: utf-8 -*-
from flask import flash
from flask_wtf import Form
from wtforms import StringField, TextAreaField, PasswordField, TextField
from model import User
from wtforms.validators import DataRequired, ValidationError
class QuestionForm(Form):
title = StringField(u"Заголовок вопроса", validators=[Da... |
# -*- coding: utf-8 -*-
import time
from ..base.addon import BaseAddon
class Interface:
def __init__(self, address):
self.address = address
self.history = {}
def last_plugin_access(self, plugin_name, account):
if (plugin_name, account) in self.history:
return self.histor... |
#!/bin/env python
import pygame.midi
import soundvalue
class Player:
def __init__(self):
instrument = 22
port = 2
self.button2sound = {'a':(60,61), 's':(62,63), 'd':(64,65) }
self.buttons = self.button2sound.keys()
self.volume = 127
pygame.midi.init()
... |
import numpy as np
"""
Generate data sets for testing Cox proportional hazards regression
models.
After updating the test data sets, use R to run the survival.R script
to update the R results.
"""
# The current data may not reflect this seed
np.random.seed(5234)
# Loop over pairs containing (sample size, number of ... |
from butler_offline.viewcore.state import persisted_state
from butler_offline.core import time
from butler_offline.viewcore import request_handler
from butler_offline.viewcore import viewcore
from butler_offline.core.report import ReportGenerator
from butler_offline.viewcore.converter import datum_to_string
def _hand... |
# Copyright (C) 2013-2015 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Fox Wilson
#
# 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 ve... |
# Copyright (c) 2021, Manfred Moitzi
# License: MIT License
import ezdxf
from ezdxf import zoom
from ezdxf.math import Vec3
from ezdxf.lldxf import const
from ezdxf.tools.text_layout import lorem_ipsum
def create_doc(filename: str, dxfversion: str):
def add_mtext_columns(msp):
insert = Vec3(0, 0, 0)
... |
# -*- coding: utf-8 -*-
# ****************************************************************************
# Copyright © 2013 Jan Erik Breimo. All rights reserved.
# Created by Jan Erik Breimo on 2013-10-22.
#
# This file is distributed under the Simplified BSD License.
# License text is included with the source distributi... |
from wtforms.widgets import HTMLString
from datetime import datetime, timedelta
class MatchDateTimeWidget(object):
MonthOptions = [
( 1, u'January'),
( 2, u'February'),
( 3, u'March'),
( 4, u'April'),
( 5, u'May'),
( 6, u'June'),
(... |
"""
Tests common to genericpath, macpath, ntpath and posixpath
"""
import genericpath
import os
import sys
import unittest
import warnings
from test import support
def safe_rmdir(dirname):
try:
os.rmdir(dirname)
except OSError:
pass
class GenericTest:
common_attributes = ['commonprefix'... |
#------------------------------------------------------------------------------
# Get the dominant colors for an image in the catalog.
# GET /v1/catalog/{catalog_name}/dominant_colors/{id}/{image_id}
#------------------------------------------------------------------------------
import os
import json
import requests
f... |
from argparse import ArgumentParser
import datetime
import time
from surfaceimagecontentgap.imagegap import isthereanimage
from surfaceimagecontentgap.bot import SurfaceContentGapBot
def last_rc_time(site):
"""Datetime of last change."""
rc = site.recentchanges()
last_rev = rc.next()
return datetime... |
import subprocess, re, shutil
## Grep all the files for MODID
cmd="find . -iname '*.java' | xargs grep 'MODID = ' -h"
regex = "\"(.*)\""
result = subprocess.run(cmd.split(), stdout=subprocess.PIPE, shell=True)
lines = result.stdout.decode("utf-8").split("\r\n")
mod_ids = []
for line in lines:
match = re.sear... |
import json
from collections import defaultdict
from openspending.model.dataset import Dataset
from openspending.lib import solr_util as solr
from openspending.lib import util
class Browser(object):
def __init__(self,
q='',
filter=None,
page=1,
... |
#!/usr/bin/env python
'''
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")... |
"""
Copyright (c) 2015, 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import
import json
import os
import pytest
from osbs.constants import DEFAULT_NAMESPACE
from osbs.cli... |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2017-09-20 10:31:11
# @Last modified by: José Sánchez-Gallego (gallegoj@uw.edu)
# @Last modified time: 2018-08-04 13:22:38
from __future__ import absolute_import, division, print_function
im... |
# 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... |
#!/usr/bin/python
"""
Utilities for processing the parsed email output of messages sent through the smtp server
"""
import re
from lxml import html as lxml_html
from config import pass_through_mailboxes, action_mailboxes, default_mailbox
from rfc_822_email_address_validator import is_valid_email_address
def valid... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
#!/usr/bin/env python
#
# Copyright (C) 2014 Dave Schaefer
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import tornado.web
from pkg_resources import resource_filename as rs_fn
import ujson
import pymongo.cursor
SCHEMA_PATH = 'schemas'
SCHEMA_NAMES = {'analysis_header': 'analysis_header.json',
'an... |
#
# Copyright 2010 the Melange 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 ... |
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
try:
fro... |
from django.views.generic import TemplateView
from django.views.generic.edit import FormView
from blog.models import Article
from django.core.mail import send_mail
from {{project_name}}.forms import ContactForm
class HomePageView(TemplateView):
template_name="index.html"
def get_context_data(self, **kwargs):
... |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
#!/usr/bin/env python
# Copyright (c) 2013 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/LICENSE-2.0
#
# Unle... |
# -*- coding: utf-8 -*-
#
# build configuration file, created by
# sphinx-quickstart on Fri Mar 27 15:46:28 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration value... |
"""
Module for classes to simplify MLPs for NICE training.
"""
import pylearn2
import pylearn2.models
import nice
import nice.pylearn2.models.mlp
from pylearn2.models.mlp import MLP
from pylearn2.models.mlp import Linear
from pylearn2.models.mlp import RectifiedLinear
from nice.pylearn2.models.mlp import CouplingLayer... |
# 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, software
# d... |
from itertools import combinations
from math import factorial
from six import PY2
from random import shuffle
from ._search import _Search
from ._result import _Result
from ..core.linalg import get_projector, projection_distance, subspace_distance
from ..stabilizers import get_stabilizer_states
from numba import njit
... |
from collections import defaultdict
from django.db import models
from vote.models import Category, Option
class Watch(models.Model):
category = models.ForeignKey(Category)
def evaluate(self):
results = dict((wo.option, 0) for wo in self.watchoption_set.all())
for ballot_category in self.category.ballot... |
# 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 may ... |
# Copyright (c) 2021 Charles University, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2021 Tomas Machalek <tomas.machalek@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publis... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Max Oberberger (max@oberbergers.de)
#
# 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... |
import ConfigParser
import os
import sys
#### import postgresql and mysql package
import MySQLdb
import psycopg2
from sqlalchemy import create_engine
global_conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'global_conf.cfg')
def get_database_connection(ip_address,user,paswd,database):
con = ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
An 'echo bot' – simple client that just confirms any presence subscriptions
and echoes incoming messages.
"""
import sys
import logging
from getpass import getpass
import argparse
from pyxmpp2.jid import JID
from pyxmpp2.message import Message
from pyxmpp2.presence impor... |
# -*- 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... |
class AngularCustomJavascript:
def __init__(self, jsinjector):
self.version = 0.1
self.jsinjector = jsinjector
self.jsinjector.add_help_topic('wn_showAngularAppName()', 'Show AngularJS Main Application Name')
self.jsinjector.add_js_file('libs/angular/js/app-name.js')
self.jsinjector.add_help_topic('wn_sho... |
#!/usr/bin/env python
import time
import threading
import sys
def Traverse(rootDir):
fileNo=0
for lists in os.listdir(rootDir):
path = os.path.join(rootDir, lists)
#print path
if os.path.isdir(path):
Traverse(path)
elif os.path.isfile(path):
file =... |
"""
sentry.web.forms.accounts
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import datetime
import pytz
from django import forms
from django.conf import settin... |
from flask import request, session as sess
from flask_login import current_user
from tincan import Statement, ActivityList, \
Extensions, Context, ContextActivities
from compair.core import impersonation
from .actor import XAPIActor
from .activity import XAPIActivity
from .context import XAPIContext
from compair... |
from battle import *
from weapon import *
import maps
import random
class Game():
def __init__(self, map):
self.map = map
self.player_location = 0
self.character = None
def print_map(self):
'''printing the map'''
self.update_location()
for row in range(maps.ROW... |
import pytest
from pactum.route import Route
def test_basic_route():
route = Route('/test/', actions=[])
assert route.path == '/test/'
assert len(route.actions) == 0
assert route.parameters == []
def test_route_class_definition():
class TestRoute(Route):
path = '/test/'
actions... |
import csv
from unittest import mock
import synapse.common as s_common
import synapse.telepath as s_telepath
import synapse.tests.utils as s_t_utils
import synapse.tools.csvtool as s_csvtool
csvfile = b'''ipv4,fqdn,notes
1.2.3.4,vertex.link,malware
8.8.8.8,google.com,whitelist
'''
csvstorm = b'''
for ($ipv4, $... |
# -*- coding: utf-8 -*-
'''
Manage users with the useradd command
'''
# Import python libs
import re
try:
import grp
import pwd
except ImportError:
pass
import logging
import copy
# Import salt libs
import salt.utils
from salt.modules import state_std
from salt._compat import string_types
log = logging.... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: metagriffin <mg.github@metagriffin.net>
# date: 2014/05/27
# copy: (C) Copyright 2014-EOT metagriffin -- see LICENSE.txt
#-------------------------------------------------------------------------... |
from __future__ import absolute_import
import unittest
from telegram.ext import CommandHandler
from telegram.ext import Filters
from telegram.ext import MessageHandler
from telegram.ext import Updater
from ptbtest import ChatGenerator
from ptbtest import MessageGenerator
from ptbtest import Mockbot
from ptbtest impor... |
"""A WSGI application that simply serves up files from the file system.
.. warning::
This is an early version of this module. It has no tests, limited
documentation, and is subject to major changes.
Configuration Options::
[wsgi_fs]
call = brim.wsgi_fs.WSGIFS
# path = <path>
# The request ... |
from model import LocationFiles, MetaWrapper
from hubspace.utilities.image_preview import create_image_preview
import os
import StringIO
from sqlobject import AND
import logging
applogger = logging.getLogger("hubspace")
def save_file(location, fd, height=None, width=None, upload_dir=''):
"""here we will need to ge... |
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... |
'''
Extracts the 5-a-day data from the different excel spreadsheets, and
saves it all in one big spreadsheet.
Created on 14 Nov 2014
@author: chris
'''
def main():
base_dir = '/home/chris/Projects/Cookit/family-food-datasets/'
import xlwt
workbook = xlwt.Workbook()
from pickle_this imp... |
"""
Django settings for users project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... |
#!/usr/bin/python3
'''
This program was created by Adailton Braga Júnior in July/2015.
Its main purpose is to allow the user to control the Arduino's PWM ports.
'''
from tkinter import *
import serial
from time import sleep
class Serialport(object):
'''This class takes care of the arduino connection using the ser... |
import enum
import logging
from itertools import groupby
from typing import List, Optional
from injector import Module, ProviderOf, inject
from sqlalchemy import Boolean, Column, DateTime, Enum, Index, Integer, String, and_, func
from sqlalchemy.orm import Session, relationship
from rep0st.config.rep0st_database impo... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""Definition of Jacobi polynomial class"""
import numpy
from utils.poly.Polynomial import Polynomial
from utils.poly.jacobi_operations import jacobi_... |
#!/usr/local/sci/bin/python
# PYTHON3
#
# Author: Kate Willett
# Created: 16 October 2015
# Last update: 20 July 2020
# Location: /data/local/hadkw/HADCRUH2/UPDATE2014/PROGS/PYTHON/
# GitHub: https://github.com/Kate-Willett/Climate_Explorer/tree/master/PYTHON/
# -----------------------
# CODE PURPOSE AND OUTPUT
# ---... |
# -*- coding:utf-8 -*-
# --
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
from nagare import log
try:
import ldap
except ImportError:
ldap ... |
# -*- coding: utf-8 -*-
#
# 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, soft... |
# 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, software
# distributed under t... |
# Spanish verb conjugations
from collections import namedtuple, OrderedDict
# Spanish has two forms of the sps familiar - 'tú' and 'vos'
SpanishCategory = namedtuple('SpanishCategory', 'fps sps spsv tps fpp spp tpp')
_PRONOUNS = SpanishCategory('yo', 'tú', 'vos', 'él/ella/usted',
'nosotros/... |
from rest_framework import serializers
from rest_framework.relations import RelatedField
class TaggedItemRelatedField(serializers.PrimaryKeyRelatedField):
"""
A custom field to use for the `tagged_object` generic relationship.
"""
def __init__(self, **kwargs):
self.pk_field = kwargs.p... |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Mathew Odden <locke105@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:... |
import json
import ssl
from urllib import request
VAULT_TIMEOUT = 20
_handler = None
def getCredentials( value ):
if value is None:
return None
return _handler.get( value )
def setup( config ):
global _handler
vault_type = config.get( 'credentials', 'type', fallback=None )
if not vault_type: # ... |
import unittest
class RecoveryTestCase(unittest.TestCase):
path = ''
def setUp(self):
import os
from os import path
self.path = path.join(path.abspath(path.dirname(__file__)),
'mrec_temp')
if not os.path.exists(self.path):
os.mkdir(s... |
import os
from FileState import FileStateLocal
class Remote(object):
def __init__(self): pass
def create(self): pass
def update(self): pass
def modified(self): pass
def delete(self): pass
class RepositoryState(object):
"""Manages the sync information, this includes the local root, ingnor... |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...utils.copyutils import do_copy
import numpy as np
from ..nduncertainty_stddev import StdDevUncertainty
from ..nduncertainty_var import ... |
# some imports we use
import numpy
import random
import math
from scipy import optimize
# matplot lib
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
# our data dimension (*xyz), we are using megabase resolution
NUMBER_CONTACTS = 157
NUMBER_CONTACTS_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#VirToCut - Controlsoftware for a dynamical Plate-Saw-Machine
#Copyright (C) 2016 Benjamin Hirmer - hardy at virtoreal.net
#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 Fr... |
import readall
import gensim
import nltk
import numpy as np
import pickle
# we need to extract some features, now we make it easy now to just use the word2vec, one turn previous turn.
#
model = gensim.models.Word2Vec.load('/tmp/word2vec_50_break')
all_v1 = readall.readall('/home/ubuntu/zhou/Backend/rating_log/v1')
all... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# dfs, post order, no global variable
def longestConsecutive(self, root):
"""
:type root: TreeNode
:rtype: in... |
import scrapy
import logging
import shutil
from scrapy import Selector, Request
from scraper.helpers import vendor_helpers, inspection_helpers
from scraper.helpers.scoring import Scoring
from scraper.items import VendorItemLoader, InspectionItemLoader
from urllib import parse
logger = logging.getLogger('Healthspace Sp... |
#!/usr/bin/env python
"""
demandfs.py - mount and umount sources on demand
Copyright (C) 2013 Sebastian Meyer <s.meyer@drachenjaeger.eu>
Based upon the the xmp.py-FS Example in the fuse-python distribtion:
Copyright (C) 2001 Jeff Epler <jepler@unpythonic.dhs.org>
Copyright (C) 2006 Csaba Henk <csa... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... |
import project
class Repo_Rev(project.Revset):
@staticmethod
def find_repo(repo_finder):
return repo_finder.project.manifest_repo
class Repo(object):
valid_repo = project.Project.valid_project
rev_class = Repo_Rev
def __init__(self, repo_dir, output_buffer=None):
from project import Project
self.project =... |
''''''''''''''''''''''''''' imports '''''''''''''''''''''''''''''
# Built ins
import sys
# Computer files
sys.path.append('../../Modules')
from _1__elementaryGates import *
from _2__arithmeticGates import *
from _3__clock import *
from _4__flipFlops import *
''''''''''''''''''''''''' helpers '''''''''''''''''''''''... |
"""
Django settings for comerciodigital project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.