src stringlengths 721 1.04M |
|---|
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 Abigail See
#
# 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... |
"""
FoSAPy - TM module
Author: Niklas Rieken
"""
import time
class TM():
""" M = (Q, Sigma, Gamma, delta, q_0, q_f, B) """
Q = []
Sigma = []
Gamma = []
delta = {}
q_0 = None
q_f = None
B = None
def __init__(self, Q, Sigma, Gamma, delta, q_0, q_f, B='B'):
""" Constructor """
self.Q = Q
self.Sigma = Si... |
import numpy as np
from matplotlib import pyplot as plt
from chiffatools.linalg_routines import rm_nans
from chiffatools.dataviz import better2D_desisty_plot
import supporting_functions as SF
from scipy import stats
def quick_hist(data):
plt.hist(np.log10(rm_nans(data)), bins=20)
plt.show()
def show_2d_arra... |
#
# Copyright (c) SAS Institute 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 w... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a previewer widget for HTML, Markdown and ReST files.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QStackedWidget
import Pr... |
from setuptools import setup, find_packages
import os
if os.path.exists('README.rst'):
readme_path = 'README.rst'
else:
readme_path = 'README.md'
setup(
name='pyfootball',
version='1.0.1',
description='A client library for the football-data.org REST API',
long_description=open(readme_path).re... |
from django.db import models
from indexer.manager import IndexManager, BaseIndexManager
__all__ = ('BaseIndex', 'Index')
class BaseIndex(models.Model):
object_id = models.PositiveIntegerField()
column = models.CharField(max_length=32)
value = models.CharField(max_length=128)
objects... |
"""
count number of reads mapping to features of transcripts
"""
import os
import sys
import itertools
# soft imports
try:
import HTSeq
import pandas as pd
import gffutils
except ImportError:
HTSeq, pd, gffutils = None, None, None
from bcbio.utils import file_exists
from bcbio.distributed.transaction... |
#!/usr/bin/env python
from setuptools import setup, find_packages
from spotify_dl.constants import VERSION
with open('README.md') as f:
long_description = f.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='spotify_dl',
version=VERSION,
python_requires=... |
from instal.firstprinciples.TestEngine import InstalSingleShotTestRunner, InstalTestCase
class Permissions(InstalTestCase):
def test_violation_exogenous(self):
runner = InstalSingleShotTestRunner(input_files=["permissions/basic.ial"], bridge_file=None,
domain_f... |
"""
Autor: Lucas Ferreira da Silva
Email: lferreira@inf.ufsm.br
Descricao: Script para download dos dados referentes a cada estacao metereologica
e criacao de uma pequena "base de dados" em formato JSON referente a
todas as estacoes
Execucao (comando): python3 geraBase.py
Saida: Arquivo JSON (e... |
import inspect
from django.db import models
from django.db.models import Q
from django.core.exceptions import ImproperlyConfigured
from avocado.conf import settings
__all__ = ('ModelTree',)
DEFAULT_MODELTREE_ALIAS = 'default'
class ModelTreeNode(object):
def __init__(self, model, parent=None, rel_type=None, re... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-03-21 10:04
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("trans", "0020_auto_20190321_0921")]
operations = [
mig... |
import pytest
import sqlalchemy as sa
from sqlalchemy_utils import i18n
from sqlalchemy_utils.primitives import WeekDays
from sqlalchemy_utils.types import WeekDaysType
from sqlalchemy_utils.types.weekdays import babel
from tests import TestCase
@pytest.mark.skipif('babel is None')
class WeekDaysTypeTestCase(TestCas... |
# -*- coding: utf-8 -*-
#
# Django Achilles documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 9 01:46:37 2013.
#
# 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.... |
# -*- coding: utf-8 -*-
import json
import os
class AliasConfig():
def __init__(self):
config_file = os.path.join('conf', 'alias.conf')
config = self.__load_config(config_file)
self.tw_consumer_key = config.get('tw_consumer_key', '')
self.tw_consumer_secret = config.get('tw_consum... |
#!/usr/bin/env python
import pygame
import sys
import math
SCALE = 0.5
sprite_size = [int(85*SCALE), int(112*SCALE)]
# Initialize the screen
pygame.init()
SCREEN_SIZE = (640, 480)
screen = pygame.display.set_mode(SCREEN_SIZE)
pygame.display.set_caption('Get Off My Head')
#pygame.mouse.set_visible(0)
# Create the ba... |
# ******************************************************************************
# pysimm.cassandra module
# ******************************************************************************
#
# ******************************************************************************
# License
# *************************************... |
"""Hello World API implemented using Google Cloud Endpoints.
Contains declarations of endpoint, endpoint methods,
as well as the ProtoRPC message class and container required
for endpoint method definition.
"""
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remot... |
#-*- coding: utf-8 -*-
from django.db import models, IntegrityError
from django.contrib.auth.models import User
#from sphere_engine import ProblemsClientV3
from django.conf import settings
from django.utils import timezone
import json
import uuid
import code
from logging import Logger
logger = Logger(__file__)
# ... |
# coding=utf-8
# Copyright (c) 2015 EMC 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
#
#... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
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 righ... |
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2016-2021 Scille SAS
import os
import sys
import pytest
from hypothesis.stateful import RuleBasedStateMachine, initialize, rule, run_state_machine_as_test
from hypothesis import strategies as st
# Just an arbitrary value to limit the size of data hypothesis ... |
# 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 python3
# This file is part of dwinelle-tools.
# dwinelle-tools 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.
# dwi... |
from six import StringIO
import doctest
import unittest
from orangecontrib.bio.kegg.entry import parser, fields, DBEntry, entry_decorate
TEST_ENTRY = """\
ENTRY test_id something else
NAME test
DESCRIPTION This is a test's description.
it spans
multiple lines
SUB This... |
# Didn't pass testcase 11, 15
import sys
def dfs(p, s, dic, ind, path):
global cost
global r
global ncr
if r:
return
if len(path) > len(ncr):
ncr = path[:]
if ind == len(p):
delete = 0
add = 0
path.pop(0)
pathcopy = path[:]
stack = [... |
import Timbral_Brightness as bright
import Timbral_Depth as depth
import Timbral_Hardness as hard
import Timbral_Roughness as rough
import os
import numpy as np
import pandas as pd
# High-level descriptors calculation
# Set folders: change source directory
pardir = 'DATASET_PATH'
folder = 'FOLDER_NAME'
# Initialize ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-12 10:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('systems', '0016_auto_20160312_0628'),
]
operations ... |
import biconfigs
import time
import pytest
import datetime
write_count = 0
def test_callbacks_sync():
global write_count
write_count = 0
def before_save(config):
if config.get('abort_save', False):
return False
config = biconfigs.Biconfigs(
before_save=before_save,
... |
from numpy import *
def metropolis(data, model, nlinks, beta=1., keepchain=True, startlink=0):
'''
The "model" object must implement:
p = model.get_params()
-- this must return an *independent copy* of the parameters.
model.set_params(p)
p = model.propose_params()
model.tally(accept, linknumber) accept: ... |
import os
import time as tm
import sys
# Handles the creation of condor files for a given set of directories
# -----------------------------------------------------------------------------
def createCondorFile(dataDir,outDir,run,day,times):
# Condor submission file name convention: run-day-time.condor
with ope... |
"""
disk device support class(es)
http://libvirt.org/formatdomain.html#elementsDisks
"""
from virttest.libvirt_xml import accessors, xcepts
from virttest.libvirt_xml.devices import base, librarian
class Disk(base.TypedDeviceBase):
"""
Disk device XML class
Properties:
device: string, how expos... |
# Copyright Hugh Perkins 2015 hughperkins at gmail
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import Bag2d
# represents a string of contiguous pieces of one c... |
# Copyright (c) 2017 Cisco Systems
# 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... |
#!/usr/bin/python3
import pika
import json
import settings
import time
time.sleep(20)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=settings.RABBITMQ_HOST))
channel = connection.channel()
channel.exchange_declare(exchange=settings.RABBITMQ_EXCHANGE,
exchange_type=se... |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from __future__ import absolute_import, division, print_function
from re import compile
from six.move... |
import logging
from sorl.thumbnail.admin import AdminImageMixin
from django.contrib import admin
from metaphore.baseadmin import PostAdmin
from metaphore.models import *
from metaphore.forms import *
if settings.USE_TINYMCE:
from tinymce.widgets import TinyMCE
class ArticleImageInline(AdminImageMixin, admin.... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... |
import json
import mock
from elasticsearch import TransportError
from tests.helpers import BaseApplicationTest
class TestStatus(BaseApplicationTest):
def test_status(self):
with self.app.app_context():
response = self.client.get('/_status')
assert response.status_code == 200
... |
# 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... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superd... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.test.testcases import SimpleTestCase
from chatterbox.events import BaseChatterboxEvent
from .helpers import MailEventDummyClass, get_test_dict
class BaseChatterboxTests(SimpleTestCase):
def setUp(self):
pass
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'options_dialog_ui.ui'
#
# Created: Fri Nov 18 22:58:31 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def set... |
"""
Testing of admin inline formsets.
"""
import random
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Parent(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
retur... |
#!/usr/bin/env python
#coding: utf-8
__author__ = 'Toshihiro Kamiya <kamiya@mbj.nifty.com>'
__status__ = 'experimental'
import collections
import os
import sys
import datetime
from _utilities import sort_uniq
import asm_manip as am
import ope_manip as om
import precomp_manip as pm
UNTRACKED_CLAZS = frozenset([
... |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import with_statement
from decimal import Decimal
from dja... |
import numpy as np
from SimPEG import (Maps, DataMisfit, Regularization,
Optimization, Inversion, InvProblem, Directives)
def run_inversion(
m0, survey, actind, mesh,
std, eps,
maxIter=15, beta0_ratio=1e0,
coolingFactor=5, coolingRate=2,
upper=np.inf, lower=-np.inf,
use_sen... |
# -*- coding: utf-8 -*-
# Copyright 2016 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 ... |
# Stolen from: http://flask.pocoo.org/snippets/51/
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
from itsdangerous import URLSafeTimedSerializer, BadSignature
class ItsdangerousSession(CallbackDict, SessionMixin):
def __init__(self, initial=None):
... |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render_to_response, redirect
from django.template.context import RequestContext
from producteurs.forms import ProducteurPropositionForm
from gestion.models... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Harvard
#
# Authors:
# Xavier Antoviaque <xavier@antoviaque.org>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as publishe... |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
from __future__ import annotations
import abc
import typing
class CRCAlgorithm(abc.ABC):
"""
Implementations are default-constructible.
"""
@abc.abstr... |
from __future__ import division, absolute_import, print_function
import sys
import os
import re
import itertools
import warnings
import weakref
from operator import itemgetter
import numpy as np
from . import format
from ._datasource import DataSource
from ._compiled_base import packbits, unpackbits
from ._iotools im... |
import datetime
import itertools
import json
import re
import string
import time
from urllib.parse import urlparse
from django import http
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.db import IntegrityError
from nomination.models import Project, Nominator, URL, Value
... |
__author__ = 'Filip Hanes'
import scrapy_sqlite.connection as connection
from scrapy.spider import Spider
from scrapy import signals
from scrapy.exceptions import DontCloseSpider
class SQLiteMixin(object):
""" A SQLite Mixin used to read URLs from a SQLite table.
"""
table = None
def __init__(self... |
##+"""
##+ Main function of the client with GUI
##+ Author: Ex7755
##+"""
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from random import randint
import time
import socket, select, string, sys, ssl, pprint
from Protocol import MessageHandler
ssl_certfile = "./keys/server.crt"
class ClientThre... |
#!/usr/bin/env python
"""
Simulate the MICE experiment
This will simulate MICE spills through the entirety of MICE using Geant4, then
digitize and reconstruct TOF and tracker hits to space points.
"""
import io # generic python library for I/O
import MAUS # MAUS libraries
def run():
""" Run the macro
""... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Worklist series member table.
"""
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy impo... |
import os
import re
import numpy as np
import scipy.io
import theano
import theano.tensor as T
import codecs
import cPickle
from utils import shared, set_values, get_name
from nn import HiddenLayer, EmbeddingLayer, DropoutLayer, LSTM, forward
from optimization import Optimization
class Model(object):
"""
Net... |
""" Bayesian Determinisitc Policy Gradient evaluated on th
didactic "chain" environment
"""
import tensorflow as tf
from gym import Wrapper
from tensorflow.python.layers.utils import smart_cond
from tensorflow.python.ops.variable_scope import get_local_variable
import chi
from chi import Experiment
from chi import ex... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return nothing
def reorderList(self, head):
if not head or not head.next:
return head
fast = head
s... |
from flask import session
from flask_login import UserMixin
from mongoengine import DoesNotExist
from Norman.models import Hospital, Service, UserModel, Notification
class HospitalUtil(UserMixin):
def __init__(self, email=None, password=None, active=True, name=None, hospital_id=None):
self.hospital_id = ... |
# Copyright (c) 2001-2016, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public t... |
#!/usr/bin/env python
# coding=utf-8
# Mathieu Courtois - EDF R&D, 2013 - http://www.code-aster.org
"""
When a project has a lot of options the 'waf configure' command line can be
very long and it becomes a cause of error.
This tool provides a convenient way to load a set of configuration parameters
from a local file ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Feedback',
fields=[
... |
from django.conf import settings
from django.conf.urls import *
from django.views.generic import TemplateView
if getattr(settings, 'INVITATION_USE_ALLAUTH', False):
from allauth.account.forms import BaseSignupForm as RegistrationFormTermsOfService
reg_backend = 'allauth.account.auth_backends.AuthenticationBac... |
"""
Functions for working with broadcast database
Copyright 2015, Outernet Inc.
Some rights reserved.
This software is free software licensed under the terms of GPLv3. See COPYING
file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt.
"""
import sqlite3
import datetime
import sqlize as sql
f... |
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Classes for simpler handling of PGP signed email messages."""
__metaclass__ = type
__all__ = [
'SignedMessage',
'signed_message_from_string',
'strip_pgp_signa... |
#!/bin/bash
"exec" "`dirname $0`/../python_env/bin/python" "$0" "$@"
#"exec" "python" "$0" "$@"
# ^^^
# the cmd above ensures that the correct python environment is
# selected to execute this script.
# The correct environment is the one belonging to uap, since all
# neccessary python modules are installed there.
# f... |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.uix.checkbox import CheckBox
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from electroncash_gui.kivy.i18n import _
Builder.load_string('''
<Question@Popup... |
# -*- coding: utf-8 -*-
#
# Scapy documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 07 19:02:35 2018.
#
# 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... |
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import os
import sys, _socket, mmap
from struct import unpack, pack
DataFileName = "qq_ip_database.Dat"
def _ip2ulong(ip):
'''ip(0.0.0.0) -> unsigned long'''
return unpack('>L', _socket.inet_aton(ip))[0]
def _ulong2ip(ip):
'''unsigned long -... |
#!/usr/bin/env python
# coding=UTF-8
import geoserverapirest.ext.sld.core as core, geoserverapirest.ext.sld.color as color
import geoserverapirest.ext.sld.ranges as ranges
"""
This set of classes works as helpers to construct SLD and should be the only entry point to this module.
They are designed to work supplying d... |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.test import TestCase
from django.template import Context, Template
class DateFormatterTest(TestCase):
# todo: Add test with localization parameters
def setUp(self):
now = datetime.now()
date_previous_in_day = now ... |
# -*- coding: utf-8 -*-
'''
This file is part of Habitam.
Habitam is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Habitam is distr... |
# ./npoapi/xml/media.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:aaac8a39e00bcd1804b49bf5b5b8b83fb686b430
# Generated 2021-06-13 22:15:50.850058 by PyXB version 1.2.6 using Python 3.8.2.final.0
# Namespace urn:vpro:media:2009 [xmlns:media]
from __future__ import unicode_literals
import pyxb
import pyxb.binding
i... |
'''
Created on 2012-09-29
A simple script that reads a WRF netcdf-4 file and displays a 2D field in a proper geographic projection;
application here is plotting precipitation in the inner WRF domain.
@author: Andre R. Erler
'''
## includes
# matplotlib config: size etc.
import numpy as np
import matplotlib.pylab as ... |
#emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the PTSA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### #... |
"""Read all matched data and make some plotting
"""
import os
from glob import glob
import numpy as np
from matchobject_io import (readCaliopImagerMatchObj,
CalipsoImagerTrackObject)
import matplotlib.pyplot as plt
from utils.get_flag_info import (get_semi_opaque_info_pps2014,
... |
import requests
import os
import urlparse
import psycopg2
def get_posts(cur):
r = requests.get('http://reddit.com/r/todayilearned/hot.json')
content = r.json()
articles = cur.execute("SELECT id FROM REDDIT")
for child in content["data"]["children"]:
if int(child["data"]["ups"]) > 1000 and child["data"]["id"] no... |
# -*- coding: utf-8 -*-
# Neuronal - Framework for Neural Networks and Artificial Intelligence
#
# Copyright (C) 2012 dddddd <dddddd@pyphiverses.org>
# Copyright (C) 2012 Notxor <gnotxor@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... |
from typing import Set, Dict
from enum import Enum
class SetupAssistantStep(Enum):
"""This enumeration contains all possible steps of Setup Assistant that can be skipped.
See Also:
- `DEP Web Services: Define Profile <https://developer.apple.com/library/content/documentation/Miscellaneous/Reference... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-16 20:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... |
#!/usr/bin/env python
#
# Copyright (c) 2011-2013, Shopkick Inc.
# All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ---
# Author: John Egan <jw... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dhaval Patel
# Copyright (C) 2011 - TODAY Denero Team. (<http://www.deneroteam.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... |
"""
NOWT field check, compare with SDSS DR12 catalog
"""
import MySQLdb
#from matplotlib import pyplot as plt
#%matplotlib inline
import math
import time
if __name__ == "__main__" :
conn = MySQLdb.connect("localhost", "uvbys", "uvbySurvey", "surveylog")
cur = conn.cursor()
sql_f = "select field_id, ... |
import numpy as np
from positioning.entities.fingerprint_data import FingerprintData
from positioning.links import Base
class ToVectorsWithStats(Base):
def __init__(self, vectorisation, **kwargs):
self.vectorisation = vectorisation
def calculate(self, fingerprints, **kwargs):
fingerprint_vec... |
import os
from setuptools import setup, find_packages
import sys
here = os.path.abspath(os.path.dirname(__file__))
import codecs
requires = ['Django']
if sys.version_info < (2, 7):
requires += ['ordereddict']
setup(
name='django-leaflet',
version='0.18.1.dev0',
author='Mathieu Leplatre',... |
#-*- coding: utf-8 -*-
import cv2
import numpy as np
import progressbar
import digit_detector.region_proposal as rp
class Extractor:
def __init__(self, region_proposer, annotator, overlap_calculator):
"""
overlap_calculator : OverlapCalculator
instance of OverlapCalculator class
... |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Jul 12 2017)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################################
impo... |
import pytest
from cfme.physical.provider.lenovo import LenovoProvider
from cfme.utils.rest import assert_response
pytestmark = [
pytest.mark.tier(3),
pytest.mark.provider([LenovoProvider], scope='module')
]
@pytest.fixture(scope="module")
def physical_server(setup_provider_modscope, appliance):
physica... |
import logging
import time
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
import re
import urllib # Russian messages support
from sets import Set
logging.basicConfig(filename="/root/mitm.log",level=logging.DEBUG)
class VK_user:
def __init__(self):
self.id = ""
... |
#!/usr/bin/env python2
# Copyright (c) 2015 The Deuscoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
fro... |
from . import layers, loaders, definitions, DPPModel
import numpy as np
import tensorflow.compat.v1 as tf
import os
import datetime
import time
import warnings
import copy
from tqdm import tqdm
class ClassificationModel(DPPModel):
_supported_loss_fns = ['softmax cross entropy']
_supported_augmentations = [def... |
# Orbotor - arcade with orbit mechanics
# Copyright (C) 2014 mr555ru
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
#!/usr/bin/env python
# Copyright (C) 2011 Woelfware
from bluetooth import *
import blumote
import cPickle
from glob import glob
import os
import sys
import time
class Blumote_Client(blumote.Services):
def __init__(self):
blumote.Services.__init__(self)
self.addr = None
def find_blumote_pods(self, pod_name = N... |
"""
organization/intrastructure-specific things
DESCRIPTION
Things commonly involved with what a little website is used for but that
involve organization/infrastructure-specific things. E.g. specific
greeting messages, getting user account attributes, the text of error
messages, etc.
This file is intended t... |
#
# Copyright 2013-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FW... |
"""Test data for add_apt_repository package driver (in add_apt_repository.py). Used by
engage.tests.driver_tests.
We test using a specific resource that is installed via pip.
"""
resource_id = "__zeromq_apt_ppa__any__15"
_install_script = """
[
{ "id": "__zeromq_apt_ppa__any__15",
"key": {"name": "zeromq-apt-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.