src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio 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... |
import asyncio
import dataManagement
from enum import Enum, unique
import html
import json
import threading
import websockets
dataStor = None
def start(port, data):
global dataStor
dataStor = data
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
coro = websockets.server.se... |
from artiq import *
class PhotonHistogram(EnvExperiment):
"""Photon histogram"""
def build(self):
self.setattr_device("core")
self.setattr_device("dds_bus")
self.setattr_device("bd_dds")
self.setattr_device("bd_sw")
self.setattr_device("bdd_dds")
self.setattr_d... |
""" Implements a fully blocking kernel client.
Useful for test suites and blocking terminal interfaces.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# ... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... |
#!/usr/bin/env python
# test_homeutils.py vi:ts=4:sw=4:expandtab:
#
# Scalable Periodic LDAP Attribute Transmogrifier
# Author:
# Nick Barkas <snb@threerings.net>
#
# Copyright (c) 2007 Three Rings Design, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modific... |
#! /usr/bin/env python
from __future__ import print_function
# https://opcfoundation.org/UA/schemas/OPC%20UA%20Schema%20Files%20Readme.xls
resources = [
'https://opcfoundation.org/UA/schemas/1.04/Opc.Ua.Types.xsd',
'https://opcfoundation.org/UA/schemas/1.04/Opc.Ua.Services.wsdl',
'https://opcfoundation.or... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
tests_require = [
'assertpy'
]
def install_r_packages():
"""Installs required R packages"""
from rpy2.robjects import packages as rpackages, r
# Install R packages... |
from PySide.QtGui import (QApplication, QDialog, QMessageBox, QListWidgetItem, QFont)
from PySide.QtCore import (SIGNAL)
# from Ui_ServerListDlg import Ui_ServerListDlg
from guru.Ui_ServerListDlg import Ui_ServerListDlg
# from EditSageServerDlg import EditSageServerDlg
from guru.EditSageServerDlg import EditSageServer... |
from collections import defaultdict
from os import chmod, rename
from os.path import dirname
from tempfile import NamedTemporaryFile
from django.core.management.base import BaseCommand, CommandError
from django.db.models import F
from candidates.csv_helpers import list_to_csv
from candidates.models import PersonExtra... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import ITlib, sys, bitarray, cPickle, os
if __name__ == '__main__':
mode, inputFilePath, outputFilePath = (sys.argv[1], sys.argv[2], sys.argv[3])
if mode == "compress":
method = sys.argv[4]
f = open(inputFilePath) # read the input file
text = f.rea... |
import numpy as np
import time
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
#we are going to calculate pi with an integration of
#arctan(x)' between 0 and 1 (that calculates pi/4)
def darctan(x) : # we introduce the arctan(x)'function
result = 1/(1+x**2)
return result
def pi(n) : # n will be ... |
"""
#header
"""
from urlparse import urlparse
from hamcrest import assert_that, contains_string, is_
from pylons import url
from joj.tests import TestController
from joj.services.dataset import DatasetService
from joj.services.model_run_service import ModelRunService
from joj.utils import constants
class TestModelRun... |
"""Cloud browser views.py tests."""
from django.test import TestCase
import mock
from cloud_browser.cloud import errors
from cloud_browser.cloud.base import CloudContainer
from cloud_browser.common import ROOT
from cloud_browser import views
class TestBrowserRedirect(TestCase):
"""Tests for browser_redirect."""... |
#-------------------------------------------------------------------------------
# Name: oldLady.py
# Purpose: Demo of program control, loops, branches, etc.
#
# Author: Konrad Roeder, adapted from the nusery rhyme
# There was an Old Lady song from the
# Secret History of Nurse... |
import unittest
from base64 import b64encode
from binascii import unhexlify
from hextobase64 import hextobase64
# Run tests with python -m unittest file.py
class HexToBase64Tests(unittest.TestCase):
def test_HexToBase64_HexInUppercase_Succeeds(self):
test_input = "0xAB12CD"
expected_result = b64en... |
import discord
from discord.ext import commands
from cogs.utils.dataIO import dataIO, fileIO
from collections import namedtuple, defaultdict
from datetime import datetime
from random import randint
from copy import deepcopy
from .utils import checks
from __main__ import send_cmd_help
import os
import time
im... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
x, y = np.random.rand(2, 200)
fig, ax = plt.subplots()
circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
ax.add_patch(circ)
ax.plot(x, y, alpha=0.2)
line, = ax.plot(x, y, alpha=1.0, clip_path=circ)
class EventHand... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-04 17:07
from __future__ import unicode_literals
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("product", ... |
# coding=utf-8
#
# Copyright 2017 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#!/usr/bin/env python
"""
helloglwidgetplugin.py
A simple OpenGL custom widget plugin for Qt Designer.
Copyright (C) 2006 David Boddie <david@boddie.org.uk>
Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Gen... |
# -*- coding: utf-8 -*-
__version__ = '0.0.1'
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
import logging
from pyramid.config import Configurator
from caliopen.base.config import Configuratio... |
# -*- coding: utf-8 -*-
#!/usr/bin/python
#
# This is derived from a cadquery script for generating PDIP models in X3D format
#
# from https://bitbucket.org/hyOzd/freecad-macros
# author hyOzd
# This is a
# Dimensions are from Microchips Packaging Specification document:
# DS00000049BY. Body drawing is the same as QFP ... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class InternalMail(models.Model):
user = models.ForeignKey(User)
Ticketid = models.CharField(max_length=50, null=True, blank=True)
From = models.CharField(max_length=50, null=True, blank=True)
FromEma... |
#! /usr/bin/env python
# encoding: utf-8
# to be put in your experiment's directory
import os
from waflib.Configure import conf
def options(opt):
opt.add_option('--ros', type='string', help='path to ros', dest='ros')
@conf
def check_ros(conf):
if conf.options.ros:
includes_check = [conf.options.ros + '/incl... |
# Copyright 2017 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 or agreed to in writing, ... |
import numpy as np
from os import path
# import network
# import network_full as network
import network
from random import random
from matplotlib import pyplot as plt
from pylab import rcParams
rcParams['figure.figsize'] = 12, 7
# ################################################################
# Network specific inp... |
import sys
import argparse
from collections import deque
def parseArgument():
# Parse the input
parser = argparse.ArgumentParser(description = "Get pairs of peak summits corresponding to each loop base")
parser.add_argument("--summitPairsFileName", required=True, help='Loop summit pairs sorted by the start position... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-21 00:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flatpages', '0002_auto_20160221_0006'),
]
operations = [
migrations.CreateMo... |
#!/usr/bin/python
# This file is part of GNUnet.
# (C) 2010 Christian Grothoff (and other contributing authors)
#
# GNUnet 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, or (a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.SignalType)
class SignalTypeAdmin(admin.ModelAdmin):
list_display = ['name', 'slug']
search_fields = ['name', 'slug']
prepopulated_fie... |
from media_tree import settings as media_types
from media_tree import media_types
from media_tree.models import FileNode
from media_tree.widgets import FileNodeForeignKeyRawIdWidget
from media_tree.forms import FileNodeChoiceField, LEVEL_INDICATOR
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from djan... |
# mssql/zxjdbc.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Support for the Microsoft SQL Server database via the zxjdbc JDBC
connector.
JDBC ... |
#!/usr/bin/python
# 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... |
import os
import shutil
from click.testing import CliRunner
from pyqtcli.cli import pyqtcli
from pyqtcli.qrc import read_qrc
from pyqtcli.test.qrc import QRCTestFile
from pyqtcli.test.verbose import format_msg
from pyqtcli import verbose as v
def test_simple_addqres(config, test_resources):
runner = CliRunner()... |
"""
Ducks problem with quackologists (observers)
Author: m1ge7
Date: 2014/03/24
"""
from abc import ABCMeta, abstractmethod
###############################################################################
#
###############################################################################
class QuackObservable:
_... |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
from django.core.exceptions import ImproperlyConfigured
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from limbo.context import PageContext
class GenericDatatableAjaxView(ListView):
datatable = None
response_type='json'
is_ajax=True
template_name='da... |
#! /usr/bin/python
from __future__ import with_statement
import logging
from .state import State
import numpy as np
import os
import re
class Score(object):
logger = logging.getLogger(name='Score')
commentSymbol = '#' # used for comments in state.annot
lineSeparator = ',' # used as separators i... |
from __future__ import print_function
import logging
import sys
import traceback
from datetime import datetime
from time import sleep
import requests
from utils import run_completed
from csv_to_config import csvToConfig
from utils import get_dyndb_table
host = 'taurus'
port = 5000
# Local DynamoDB instance
dynamod... |
#!/usr/bin/env python
# Copyright (c) 2014, Paessler AG <support@paessler.com>
# 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 not... |
#coding:utf8
import numpy as np, scipy
import pylab as pl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
from matplotlib import cm
from matplotlib import mlab
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from itertools import *
import collections
from multiproces... |
import numpy as np
from datasets import Joints
from pairwise_relations import from_dataset
def generate_fake_locations(num, means, stddev=5):
"""Generate a matrix with four rows (one for each "point") and three
columns (x-coord, y-coord and visibility). Means is a 3x2 matrix giving
mean locations for eac... |
import unittest
import os
import shutil
import subprocess
from client import const
class BaseIntegrationTest(unittest.TestCase):
def setUp(self):
"""
Clears out old temporary test directories, then
creates a new one.
"""
self.TMPDIR = "tmp-grabrc-test"
self.BACKUP_... |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... |
import io
import logging
import os
import mako.exceptions
import mako.lookup
import mako.runtime
import mako.template
logger = logging.getLogger(__name__)
def run_templating(module_data):
module_data["cfg"] = BuildArgs(
sources=[],
include_dirs=[],
extra_compile_args=[],
librarie... |
#
# Copyright (C) 2013 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
# Some custom decorators that can be used by unittests
# Most useful is skipUnlessPassed which can be used for
# creating dependecies between two test methods.
import os
import logging
import sys
import unittest
import threading
import signal... |
from __future__ import print_function
from pySecDec.integral_interface import IntegralLibrary
import sympy as sp
# load c++ library
box1L = IntegralLibrary('box1L/box1L_pylink.so')
# choose integrator
box1L.use_Vegas(flags=2) # ``flags=2``: verbose --> see Cuba manual
# integrate
str_integral_without_prefactor, str_... |
from numpy import asarray
from numpy import argmax
from numpy import argmin
from numpy import zeros
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from compas_plotters.core.utilities import assert_axes_dimension
__all__ = [
'Axes2D', 'Axes3D', 'Bounds', 'Box', 'Cloud2D', 'Cloud3D', 'Hull',
]
class Ax... |
import botconfig
#####################################################################################
PING_WAIT = 300 # seconds #
PING_MIN_WAIT = 30 # amount of time between first !join and !pi... |
import PyPDF2
src_pdf = PyPDF2.PdfFileReader('data/src/pdf/sample1.pdf')
dst_pdf = PyPDF2.PdfFileWriter()
dst_pdf.cloneReaderDocumentRoot(src_pdf)
with open('data/temp/sample1_no_meta.pdf', 'wb') as f:
dst_pdf.write(f)
print(PyPDF2.PdfFileReader('data/temp/sample1_no_meta.pdf').documentInfo)
# {'/Producer': 'Py... |
# 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... |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from types import NoneType
from trytond.model.fields.field import Field
from trytond.model.fields.many2many import Many2Many
from trytond.pool import Pool
class One2One(Many... |
import dj_database_url, os
from django.core.exceptions import ImproperlyConfigured
def get_env_variable(var_name):
try:
return os.environ[var_name]
except:
error_msg = 'Set the {} environment variable'.format(var_name)
raise ImproperlyConfigured(error_msg)
# Paths
BASE_DIR = os.path... |
# Code for the selection of images for autoindexing - selecting lone images
# from a list or wedges from a list, for XDS.
import logging
logger = logging.getLogger("xia2.Modules.Indexer.IndexerSelectImages")
def index_select_images_lone(phi_width, images):
"""Select images close to 0, 45 and 90 degrees from th... |
__source__ = 'https://leetcode.com/problems/next-closest-time/'
# Time: O(1)
# Space: O(1)
#
# Description: Leetcode # 681. Next Closest Time
#
# Given a time represented in the format "HH:MM",
# form the next closest time by reusing the current digits.
# There is no limit on how many times a digit can be reused.
#
# ... |
import splunktaforpuppetenterprise_declare
from splunktaucclib.rest_handler.endpoint import (
field,
validator,
RestModel,
DataInputModel,
)
from splunktaucclib.rest_handler import admin_external, util
from splunk_aoblib.rest_migration import ConfigMigrationHandler
util.remove_http_proxy_env_vars()
... |
from book_classification import book
import os
from nose.tools import *
path_to_books = os.path.dirname(__file__)
def equals_mybook(aBook):
aBookPath = os.path.join(path_to_books, "pg1465.txt")
contents = open(aBookPath, "rU").read()
eq_(aBook.author(), "Charles Dickens")
eq_(aBook.title(), "The Wreck of the Gol... |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/barcharts.py
__version__=''' $Id: barcharts.py 3761 2010-09-02 14:40:46Z damian $ '''
__doc__="""This module defines a variety of B... |
#!/usr/bin/python
import collections
import mraa
import os
import sys
import time
# Import things for pocketsphinx
import pyaudio
import wave
import pocketsphinx as ps
import sphinxbase
my_dir = os.path.dirname(__file__)
dict_name = 8670
# Parameters for pocketsphinx
LMD = "{0}/dict/{1}.lm".format(my_dir, dict_nam... |
from threading import Thread
from conpaas.core.expose import expose
from conpaas.core.manager import BaseManager
from conpaas.core.https.server import HttpJsonResponse, HttpErrorResponse
from conpaas.services.helloworld.agent import client
class HelloWorldManager(BaseManager):
# Manager states - Used by the fr... |
# occiput
# Stefano Pedemonte
# Harvard University, Martinos Center for Biomedical Imaging
# Dec. 2014, Boston, MA
# April. 2014, Boston, MA
import occiput as __occiput
import nibabel as __nibabel
import warnings as __warnings
with __warnings.catch_warnings():
__warnings.simplefilter("ignore")
import nipy... |
from urllib.parse import urlparse
import induce
import collections
import random
import accesslog
random.seed(0)
def test_accesslog1():
content_lines = '''
1.1.1.1 - - [21/Feb/2014:06:35:45 +0100] "GET /robots.txt HTTP/1.1" 200 112 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
'''... |
from __future__ import division
import nltk, re, pprint
from urllib import urlopen
# WORD CLASSES
# Belajar mengklasifikasikan kata (kata benda, kata sifat, dkk)
# POS Tagging
# Merupakan mekanisme untuk menandai (tag) kata dengan suatu kelas tertentu pada proses NLP
# Menjadi suatu kelas kata atau kategori leksikal
... |
import os
import subprocess
import json
import shlex
import math
import nuke
def probeFile(file):
cmd = "ffprobe -v quiet -print_format json -show_streams"
# find video duration
# ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1
# find video frame rate (no... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Zhibo Liu'
import time,uuid
from transwarp.db import next_id # 直接from Import会出错 必须在那个目录下建立__init__.py 文件!!!!!!!!
from transwarp.orm import Model, StringField, BooleanField, FloatField, TextField
class User(Model):
__table__ = 'users'
id = StringF... |
# leitet SMS-Nachricht an MQTT-Broker weiter
# SIM-Modul an ttyS1
# Ansteuerung mit AT-Befehlen
# SMS-Format topic:payload
# initpin() einmal zu Beginn
import serial
import time
import paho.mqtt.client as mqtt
port=serial.Serial("/dev/ttyS1",9600)
#port.open()
client=mqtt.Client()
# MQTT-Server
client.connect("x.x.x.... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 11 10:41:32 2016
Program to run through the calibrations folders and queue all data for analysis
It isn't yet smart enough to check which ones are done already
@author: cheetham
"""
import naco_ispy,subprocess,os,argparse,glob
parser = argparse.ArgumentParser(descript... |
"""
Main script for running tissue-specific graph walk experiments, to convergence.
"""
import sys
import argparse
from walker import Walker
def generate_seed_list(seed_file):
""" Read seed file into a list. """
seed_list = []
try:
fp = open(seed_file, "r")
except IOError:
sys.exit("E... |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
"""
Recurrent layers.
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy
import copy
import theano
import theano.tensor as TT
# Nicer i... |
"""
A path/directory class.
"""
from migrate.versioning.base import *
from migrate.versioning.util import KeyedInstance
from migrate.versioning import exceptions
import os
import shutil
class Pathed(KeyedInstance):
"""
A class associated with a path/directory tree.
Only one instance of this class may... |
#!/usr/bin/python3
import argparse
import urllib.request
import json
from bs4 import BeautifulSoup
from urllib.parse import urlencode
from collections import OrderedDict
from get_url import parse_property_page, property_filepath
from slackclient import SlackClient
import os
with open(os.path.join(os.path.dirname(os.p... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-10-19 15:37:46
from six.moves import queue as Queue
import logging
logger = logging.getLogger("result")
class ResultWorker(object):
"""
do ... |
"""Test the not_in validator."""
# first-party
from tcex.validators import ValidationError, not_in
class TestNotIn:
"""Test the not_in validator."""
@staticmethod
def tests_multi_values():
"""Test handling of multiple invalid values."""
validator = not_in(['foo', None])
try:
... |
"""
Revision ID: 0149_add_crown_to_services
Revises: 0148_add_letters_as_pdf_svc_perm
Create Date: 2017-12-04 12:13:35.268712
"""
from alembic import op
import sqlalchemy as sa
revision = '0149_add_crown_to_services'
down_revision = '0148_add_letters_as_pdf_svc_perm'
def upgrade():
op.add_column('services', s... |
import numpy as np
from sklearn.model_selection import *
from sklearn.ensemble import *
def get_dataset():
files = ['./analysis/input/negative_tweets.txt', './analysis/input/neutral_tweets.txt', './analysis/input/positive_tweets.txt']
x = []
for file in files:
s = []
with open(file, 'r') ... |
class TrieNode:
# Initialize your data structure here.
def __init__(self):
self.children = {}
self.is_word = False
class Trie:
def __init__(self):
self.root = TrieNode()
# @param {string} word
# @return {void}
# Inserts a word into the trie.
def insert(self, word):... |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# TODO: remove ignore when we stop invoking Mypy with --py2
# type: ignore
from collections import ChainMap
from contextlib import contextmanager
from ....errors import ConfigurationError
from ... import ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
from django.contrib import auth
from django.core.validators import URLValidator
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ImproperlyConfigured, ValidationError
... |
# -*- coding: utf-8 -*-
"""This module defines I/O routines with CASTEP files.
The key idea is that all function accept or return atoms objects.
CASTEP specific parameters will be returned through the <atoms>.calc
attribute.
"""
from numpy import sqrt, radians, sin, cos, matrix, array, cross, float32, dot
import ase
... |
import string
import sys
import unittest
from collections import namedtuple
from django.template import Context, Template, TemplateSyntaxError
from django.test import TestCase, tag
from django.utils.functional import SimpleLazyObject
from django.utils.html import escape
from faker import Faker
@tag('templatetags')
... |
from pyrevit import HOST_APP, DOCS, PyRevitException
from pyrevit import framework, DB, UI
from pyrevit.coreutils.logger import get_logger
from pyrevit.revit import ensure
from pyrevit.revit import query
__all__ = ('pick_element', 'pick_element_by_category',
'pick_elements', 'pick_elements_by_category',
... |
##################################
# Laboratory Server configuration #
##################################
laboratory_assigned_experiments = {
'exp1:ud-fpga@FPGA experiments':
{
'coord_address': 'experiment_fpga:main_instance@main_machine',
'checkers': ()
... |
# coding: utf8
from __future__ import unicode_literals
import sys
import unittest
PYTHON3 = sys.version_info >= (3,)
V8_0_0 = sys.version_info >= (3, 5)
V10_0_0 = sys.version_info >= (3, 7)
class SmokeTest(unittest.TestCase):
def test_cafe(self):
from pyuca import Collator
c = Collator()
... |
# -*- 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... |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# 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 it will b... |
import inspect, asyncio, sys, json
from aiohttp import web
from utils import get_etree
from asyncio_redis import Connection
from collections import Iterable
API_BASE_URL = 'http://m.mivb.be/api/'
API_DEFAULT_PARAMS = {'lang': 'nl'}
API_LINES_URL = API_BASE_URL + 'getlinesnew.php'
API_ROUTE_URL = API_BASE_URL + 'getiti... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import (nowdate, add_days, get_datetime, get_first_day, get_last_day, date_diff, flt, add_to_date)
from erpnext.loan_mana... |
# Copyright (C) 2020 Christopher Gearhart
# chris@bblanimation.com
# http://bblanimation.com/
#
# 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 opt... |
#!/usr/bin/env python
# Pimp is a highly interactive music player.
# Copyright (C) 2011 kedals0@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 published by
# the Free Software Foundation, either version 3 of the License, or
# ... |
#!/usr/bin/python
#coding=utf-8
#from urllib import urlopen
import urllib2
import socket
#from numpy import *
import string
import time
import matplotlib.pyplot as plt
TIMEVALUE=6.0
URL="http://hq.sinajs.cn/list=AG1512"
xMax=100
yMin=10000
yMax=0
socket.setdefaulttimeout(4)
NowTime=float(int(time.time()))
LastTime=N... |
import os
import asyncio
import hashlib
from urllib import parse
import xmltodict
from boto.s3.connection import S3Connection
from boto.s3.connection import OrdinaryCallingFormat
from boto.s3.connection import SubdomainCallingFormat
from waterbutler.core import streams
from waterbutler.core import provider
from wate... |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... |
import pytest
from unittest.mock import Mock, MagicMock, patch
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
import os
from libvirttestapi.src import exception as exc
from libvirttestapi.src import env_parser
from libvirttestapi.utils import utils
class TestEnvParser():
... |
# -*- coding: utf-8 -*-
"""
Demonstrates use of PlotWidget class. This is little more than a
GraphicsView with a PlotItem placed in its center.
"""
import PyQt4.QtCore as q
import PyQt4.QtGui as qt
import numpy as np
import pyqtgraph as pg
import pyqtgraph.dockarea as dock
import zmq
import msgpack as msg
import m... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright © 2015 Mattia Rizzolo <mattia@mapreri.org>
# Copyright © 2015 Holger Levsen <holger@layer-acht.org>
# Based on various reproducible_* files © 2014-2015 Holger Levsen <holger@layer-acht.org>
# Licensed under GPL-2
#
# Depends: python3
#
# Track the database schema... |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.