src stringlengths 721 1.04M |
|---|
# -*- coding: 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):
# Changing field 'Alarm.last_checked'
db.alter_column(u'ddsc_core_alarm', 'last_checked', self.gf('django.d... |
""" Test starting and stopping iohub server
"""
from builtins import object
from psychopy.tests.utils import skip_under_travis
from psychopy.tests.test_iohub.testutil import startHubProcess, stopHubProcess, skip_not_completed
from psychopy.iohub import Computer
from psychopy.core import getTime
@skip_under_travis
clas... |
"""
get_tweets.py
usage: get_tweets.py [-h] [--sarcastic_path SARCASTIC_PATH]
[--non_sarcastic_path NON_SARCASTIC_PATH]
[--log_path LOG_PATH]
Query twitter API for tweets over last 7 days
optional arguments:
-h, --help show this help message and exit
--sarcast... |
##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... |
import json
import datetime
import sys
import random
a =json.load(open(sys.argv[1],'rb'))
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
# BOARDS
boards = {}
for board in a['lists'... |
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier, BaggingClassifier
from sklearn.metrics import classification_report, accuracy_score
from sklearn.model_selection import train_test_split
def ... |
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.corbaserver.rbprm.rbprmfullbody import FullBody
from hpp.gepetto import Viewer
import omniORB.any
import stair_bauzil_hrp2_path_noRamp as tp
import time
from hpp.corbaserver.rbprm.rbprmstate import State,StateHelper
from display_tools import *
from constr... |
"""
MagPy
Auxiliary input filter - WIC/WIK
Supports USB temperature loggers, RCS files, old Caesium data and SG data
Written by Roman Leonhardt June 2012
- contains test and read function, toDo: write function
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicod... |
# -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.conf import settings
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.utils import ti... |
# Copyright (c) 2018 VMware
#
# 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, so... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
# 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 ... |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hotmail brute forcer
# programmer : gunslinger_
# Inspired by mywisdom
# This program is only for educational purposes only.
import sys, time, msnp
__Author__ = "Gunslinger_ - Modified by Leleobhz"
__Version__ = "1.0"
__Date__ = "Mon, 22 Feb 2010 13:13:43 +0700 "
log = "... |
# encoding: utf-8
# module future_builtins
# from /usr/lib/python2.7/lib-dynload/future_builtins.so
# by generator 1.130
"""
This module provides functions that will be builtins in Python 3.0,
but that conflict with builtins that already exist in Python 2.x.
Functions:
ascii(arg) -- Returns the canonical string repre... |
from argparse import ArgumentParser
import numpy as np
from types import SimpleNamespace
from mflow_nodes.stream_tools.mflow_forwarder import MFlowForwarder
def generate_frame_data(frame_shape, frame_number):
"""
Generate a frame that is filled with the frame number value.
:param frame_shape: Shape of t... |
#!/usr/bin/env python
#
# Problem: Travel Plan
# Language: Python
# Author: KirarinSnow
# Usage: python thisfile.py <input.in >output.out
for case in range(int(raw_input())):
n = int(raw_input())
x = map(int, raw_input().split())
f = int(raw_input())
x.sort()
if 2*(x[n-1]-x[0]) > f:
... |
from random import randint
from tests.sharepoint.sharepoint_case import SPTestCase
from office365.sharepoint.files.file import File
from office365.sharepoint.recyclebin.recycleBinItemCollection import RecycleBinItemCollection
class TestSharePointRecycleBin(SPTestCase):
target_file = None # type: File
@cla... |
#
# BitBake XMLRPC Server
#
# Copyright (C) 2006 - 2007 Michael 'Mickey' Lauer
# Copyright (C) 2006 - 2008 Richard Purdie
#
# 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 Foundation.
#
# This p... |
import os
import platform
import time
from mock import Mock
from spec import Spec, eq_, ok_, skip
from invoke import run, Local, Context, ThreadException
from invoke.util import ExceptionHandlingThread
from _util import assert_cpu_usage
PYPY = platform.python_implementation() == 'PyPy'
class Runner_(Spec):
de... |
#!/usr/bin/env python
import csv, json, os, traceback, datetime, time, praw, requests, pafy, logging, sys, sqlite3
from BeautifulSoup import BeautifulSoup
from pprint import pprint
from logging.config import dictConfig
logging_config = dict(
version = 1,
formatters = {
'f': {'format':
'%(... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018, CRS4
#
# 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 limitation the rights to
# use, copy, modify... |
"""api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... |
from itertools import permutations
import pytest
from sokoenginepy import (
DEFAULT_PIECE_ID,
BoardManager,
CellAlreadyOccupiedError,
SokobanBoard,
SokobanPlus,
)
class DescribeBoardManager:
def it_memoizes_pushers(
self, board_manager, pushers_positions, invalid_pusher_position
... |
__author__ = 'thor'
import ut as ms
import re
import requests
from bs4 import BeautifulSoup
import os
import ut.pfile.to
def get_multiple_template_dicts(source):
templates = dict()
if isinstance(source, str):
if not re.compile('\n|\t').match(source) and len(source) < 150: # assume it's a filepath or... |
#!/usr/bin/env python3
# Copyright 2014 Jussi Pakkanen
# 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... |
import csv
import os
import tempfile
import unittest
import warnings
from requests import exceptions
from kbcstorage.buckets import Buckets
from kbcstorage.tables import Tables
class TestFunctionalBuckets(unittest.TestCase):
def setUp(self):
self.buckets = Buckets(os.getenv('KBC_TEST_API_URL'),
... |
#############################################################################
# ParaMark: A Parallel/Distributed File Systems Benchmark
# Copyright (C) 2009,2010 Nan Dun <dunnan@yl.is.s.u-tokyo.ac.jp>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publi... |
from funktional.layer import Layer, Dense, StackedGRU, StackedGRUH0, Convolution1D, \
Embedding, OneHot, clipped_rectify, sigmoid, steeper_sigmoid, tanh, CosineDistance,\
last, softmax3d, params, Attention
import funktional.context as context
from funkt... |
# Copyright 2013 NEC 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
from copy import copy
from flask import jsonify
from flask import request
from sqlalchemy import and_
from sqlalchemy import asc
from sqlalchemy import desc
from sqlalchemy.exc import StatementError
from sqlalchemy.ext.associationproxy import AssociationProxy
from database import db, fast_count
from helpers.filters.ma... |
# Copyright 2020 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... |
from subprocess import Popen, PIPE
import fcntl
import os
import time
import signal
class Process(object):
"""
open a process with non-blocking stdin
unlike commuinicate() will allow interactive communication without
waiting for the process to exit
"""
def __init__(self, exe):
self.exe = exe
self.process = ... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... |
import matplotlib
import pytest
matplotlib.use('Agg')
import shap # pylint: disable=wrong-import-position
def test_random_force_plot_mpl_with_data():
""" Test if force plot with matplotlib works.
"""
RandomForestRegressor = pytest.importorskip('sklearn.ensemble').RandomForestRegressor
# train model
... |
import logging
import datetime
from bottle import route, request
import models
log = logging.getLogger(__name__)
@route('/api/single/',method='GET')
def single_item():
id = request.GET.get('id')
session = models.DBSession()
bill = session.query(models.Bill).get(id)
data = serialize_bill(bill)
re... |
from copy import deepcopy, copy
import os.path
import urllib.parse
import urllib.request
import hashlib
import json
import setuptools.archive_util
import shutil
import collections
import re
from functools import partial
from glob import glob
def addDefaults(config, defaults):
queue = [(config, defaults)]
whi... |
import sys
import os
import os.path
from jinja2 import Template
try:
from ConfigParser import ConfigParser # py2
except:
from configparser import ConfigParser # py3
import StringIO
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_prop... |
#!/usr/bin/env python
"""
Add Dash docs anchor tags to html source.
"""
import argparse
import os
import re
import sys
import urllib
parser = argparse.ArgumentParser()
parser.add_argument('filename',
help=('The file to add dash doc anchors to.'))
parser.add_argument('-v', '--verbose',
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SelectByLocation.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... |
"""
Test suite for the config.views module
"""
import pytest
from html import escape
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.messages.storage.fallback import FallbackStorage
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.urls im... |
import importlib
import json
import sys
from mock import MagicMock
from mock import patch
from tendrl.node_agent.tests import mock_gluster_state
sys.modules['tendrl_gluster'] = mock_gluster_state
sys.modules['collectd'] = MagicMock()
utils = importlib.import_module(
"tendrl.node_agent."
"monitoring.collectd.c... |
from unittest.mock import MagicMock, patch
from django.test import override_settings
from integrations.tasks import notify_new_submission, switchable_task
def test_notify_new_submission():
with patch("integrations.slack.send_message") as m1:
notify_new_submission(
"test_title",
"t... |
# 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... |
# 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) 2020, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this ... |
# -*- coding: utf-8 -*-
"""Tests for the family module."""
#
# (C) Pywikibot team, 2014-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
from pywikibot.family import Family, SingleSiteFamily
from pywikibot.exceptions import Unkno... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
A Sphinx extension used to write multilingual user documentation
for a Lino application.
.. rst:directive:: lino2rst
Execute Python code and process the output as reStructuredText
source code. This is ... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "heatmapgl.legendgrouptitle"
_path_str = "heatmapgl.legendgrouptitle.font"
_valid_props = {"col... |
#!/usr/bin/env python
#
# Copyright 2007 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... |
# 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 logging
import os
from telemetry import decorators
from telemetry.core.platform.profiler import android_prebuilt_profiler_helper
import telemetry.cor... |
'''tests for langauge detection transform
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2015 Diffeo, Inc.
'''
from __future__ import absolute_import
import os
import pytest
import streamcorpus_pipeline
from streamcorpus_pipeline._clean_html import clean_html
from streamcorpus_pip... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateMode... |
# -*- coding: utf-8 -*-
import json
import pytest
def test_cookies_fixture(testdir):
"""Make sure that pytest accepts the `cookies` fixture."""
# create a temporary pytest test module
testdir.makepyfile(
"""
# -*- coding: utf-8 -*-
def test_valid_fixture(cookies):
as... |
# Author: Martin McBride
# Created: 2018-10-22
# Copyright (C) 2018, Martin McBride
# License: MIT
import cairo
import generativepy.utils
import numpy as np
# Text align
CENTER = 0
MIDDLE = 0
LEFT = 1
RIGHT = 2
TOP = 3
BOTTOM = 4
BASELINE = 5
# Fill rule
EVEN_ODD=0
WINDING=1
## Line cap/join
MITER = 0 # join
ROU... |
# from https://github.com/pifantastic/python-rison
# encode a json payload in rison
# used in kibana urls
import re
IDCHAR_PUNCTUATION = '_-./~'
NOT_IDCHAR = ''.join([c for c in (chr(i) for i in range(127))
if not (c.isalnum() or c in IDCHAR_PUNCTUATION)])
# Additionally, we need to distinguis... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 Àngel Àlvarez - NaN (http://www.nan-tic.com)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... |
"""
@author(s): Nathan Heidt, Jean Nassar
This is the primary program for detecting and logging Meteors. Running
`python meteor_tracker.py` is sufficient.
Make sure the parameters specified in the config.ini file are correct.
"""
import configparser
from . import camera
from . import find_events
from . import save_... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-12-10 07:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20171207_0148'),
]
operations = ... |
from __future__ import absolute_import, unicode_literals
import datetime
import os
from decimal import Decimal
from django import forms
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import ValidationError
from django.db import connection
from django.db.models.query import E... |
# Copyright 2013-2015 University of Warsaw
#
# 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 agree... |
from django.db.models.sql import compiler
from datetime import datetime
import re
from django.db.models.base import Model
REV_ODIR = {
'ASC': 'DESC',
'DESC': 'ASC'
}
SQL_SERVER_8_LIMIT_QUERY = \
"""SELECT *
FROM (
SELECT TOP %(limit)s *
FROM (
%(orig_sql)s
ORDER BY %(ord)s
) AS %(table)s
ORDER... |
import datetime
from os import path
from pprint import pprint
from unittest import TestCase
from build_config import config
from persistent_state import PersistentStateParser, SailOpeningState
class PersistentStateTest(TestCase):
def test_parse_generated_state(self):
state_file = path.join(con... |
from django import template
from django.core.urlresolvers import reverse, NoReverseMatch
from zenaida.contrib import hints
from zenaida.contrib.hints.models import Dismissed
from zenaida.contrib.hints.forms import DismissHintForm
register = template.Library()
@register.tag("hint")
def hint(parser, token):
"""
... |
##############################################################################
# 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 tornado.web
from tornado import gen
from tornado.log import enable_pretty_logging
from tornado.options import define, options
import logging
import os
PROCESSES_PER_CPU = 2
WEB_SERVER_PORT=8888
define("port", default=WEB_SERVER_PORT, help="run on the given port", type=int)
import MadisInstance
from MadisInsta... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
import django.dispatch
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django_enumfield import enum
import celery.states
from common.utils import build_absolute_uri
from te... |
#coding=utf-8
# -------------------------------------
#$PYTHONHOME/bin/online2.py
onlinePy='''
#coding=utf-8
import os,sys
from fabric.api import env,run,put,output
env.hosts=['{}']
env.password='{}'
output['running']=False
output['status']=False
output['aborts']=True
env.output_prefix=False
pyhome=os.popen('echo $PY... |
# -*- coding: utf-8 -*-
# Copyright 2014-2018 Rumma & Ko Ltd
# License: BSD, see LICENSE for more details.
"""
Defines the :rst:dir:`sigal_image` directive.
.. rst:directive:: sigal_image
.. _picsel: https://github.com/lsaffre/picsel
.. _Shotwell: https://en.wikipedia.org/wiki/Shotwell_%28software%29
.. _digiKam: ht... |
from django.contrib.contenttypes.models import ContentType
from rest_framework import viewsets
from rest_framework.permissions import IsAdminUser
from tools.models import Agent, Credential
from tools.serializers import AgentSerializer, CredentialSerializer
class CredentialViewSet(viewsets.ModelViewSet):
queryset ... |
import matplotlib.pyplot as plt
import pandas as pd
import pandas.io.data as web
from collections import defaultdict
names = ['AAPL', 'GOOG', 'MSFT', 'DELL', 'GS', 'MS', 'BAC', 'C']
def get_px(stock, start, end):
return web.get_data_yahoo(stock, start, end)['Adj Close']
#
px = pd.DataFrame({n: get_px(n, '1/1/2... |
#!/usr/bin/env python
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
import twisted.internet.error
import sys
import ConfigParser
CONFIG_CONF = "setup.conf"
PORT=8000
class Echo(Protocol):
def dataReceived(self, data):
"""
As soon as any data is rece... |
import uuid
from datetime import datetime
import portality.notifications.application_emails as emails
from portality.core import app
from portality import models, constants, app_email
from portality.lib.formulaic import FormProcessor
from portality.ui.messages import Messages
from portality.crosswalks.application_form... |
# Generator of fuzzed qcow2 images
#
# Copyright (C) 2014 Maria Kustova <maria.k@catit.be>
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ace2fasta.py
# From ACE format to FASTA format
# Eric Normandeau
# 2010 04 15
# Create an output_file.fasta containing contig sequences alignements from
# an input_file.ace
# Clean each contig by removing insertions '*' in the contig consensus and
# all the sequences i... |
#
# The BSD License
#
# Copyright (c) 2008, Florian Noeding
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# li... |
# coding=utf-8
"""
stream.varint
~~~~~~~~~~~~~
Encode and decode an integer up to 64 bit to/from 'Varint'. See Google
Protobuf library documentation for more details about Varints.
:copyright: (c) 2017 by Ali Ghaffaari.
:license: MIT, see LICENSE for more details.
"""
import sys
import clic... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (t... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
################################################################################
# purejinmeiyo Copyright (C) 2012 Suizokukan
# Contact: suizokukan _A.T._ orange dot fr
#
# This file is part of purejinmeiyo.
# purejinmeiyo is free software: you can redistribute it ... |
#
# 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
# ... |
# 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
#
# Unless required by applica... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
import models as models
class AskForm(forms.Form):
title = forms.CharField(max_length=255)
text = forms.CharField(widget=forms.Textarea)
user = User()
def clean_title(self):
... |
import os
from setuptools import find_packages, setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
for line in open(os.path.join(os.path.dirname(__file__), fname)):
yield line.strip()
setup(
name="mwpersistence",
version="0.2.... |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,sys
from waflib.TaskGen import feature,after_method,taskgen_method
from waflib import Utils,Task,Logs,Options
from waflib.Tools import ccroot
testlock=Utils.threading.Lock()
SCRIPT_TEMPLATE... |
#!/usr/bin/env python
# ---------------------------------------------------------
# Filename: Points.py
# ---------------------------------------------------------
# 2D Point Class with elementary functions
#
# v1.0
# F.Stern 2014
# ---------------------------------------------------------
class Point(object):
__slot... |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
# 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 ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TextMessage'
db.create_table(u'communications_textmessage... |
# -*- coding: utf-8 -*-
# Copyright 2007, 2008,2009 by Benoît Chesneau <benoitc@e-engura.org>
#
# 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... |
import unittest
from Util import Path, Position
__author__ = 'Simon Bouchard'
A_START = Position(100, 200)
A_TARGET = Position(123, -456)
A_PATH = Path(start=A_START, target=A_TARGET)
A_START_ARRAY = A_START.array
A_TARGET_ARRAY = A_TARGET.array
A_LIST_OF_POSITION = [Position(0, 0),
Position... |
# coding: utf-8
import numpy as np
import pandas as pd
import time
from datetime import datetime, timedelta, date
from time import sleep, gmtime, strftime
from pandas import DataFrame, Series, read_csv
from salesforce_bulk_api import SalesforceBulkJob
from SalesforceBulkQuery import *
from simple_salesforce import *
... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SeaIceData
A QGIS plugin
Downloads sea ice concentration data from NSIDC
-------------------
begin : 2014-10-02
copyrig... |
import math
import numpy as np
from numpy import linalg
import itertools
from callhaskell import *
class Queue(object):
def __init__(self, items=None):
if items is None:
self.items = []
else:
self.items = list(reversed(items))
def dequeue(self):
return self.items.pop()
class VarId(objec... |
#!/usr/bin/env python
import cmd
import locale
import os
import shlex
import sys
import json # Alt: pprint (http://docs.python.org/2/library/pprint.html)
import itertools # For compress()
from dropbox import client, rest
# Set the application specific details here
APP_KEY = 'nxc6d8rghbaf0kn'
APP_SECRET = ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_measure_units(apps, schema_editor):
MeasureUnit = apps.get_model('ingredient', 'MeasureUnit')
db_alias = schema_editor.connection.alias
MeasureUnit.objects.using(db_alias).bulk_create([
... |
__author__ = 'jenkins'
import logging
from subprocess import Popen, PIPE, STDOUT
import json
import itertools
from g11pyutils import IndexedDictList, StopWatch
import sys
import argparse
import time
LOG = logging.getLogger("ec2")
class ec2:
"""A base class for EC2 tools, including utility functions, and also a m... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
import conveyor
def read(file):
with open(os.path.abspath(os.path.join(os.path.dirname(__file__), file))) as f:
result = f.read()
f.closed
... |
# -*- coding: utf-8 -*-
from datetime import datetime
import pytz
from mygeotab import dates
class TestGetUtcDate:
def test_naive_datetime_to_utc(self):
date = datetime(2015, 3, 12, 2, 45, 34)
utc_date = dates.localize_datetime(date, pytz.utc)
assert utc_date.tzinfo is not None
... |
import thread
import threading
import os.path
ALL_JOBS={}
JOBS_COUNT={
'pending': 0,
'working': 0,
'error': 0,
'done': 0,
'source': 0
}
JOBS_LOCK=thread.allocate_lock()
JOBS_COND=threading.Condition()
class Job(object):
def __init__(self, job_type, dest, depends, args=None):
... |
# Generated from java-escape by ANTLR 4.5
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2")
buf.write(u"!\u00fa\b\1\4\2\t\2\4\3\t\3\4\4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.