code stringlengths 1 199k |
|---|
from ..i18n import trstring_factory
COMP_ID = 'layer'
_ = trstring_factory(COMP_ID) |
from time import sleep
from random import randint
from argparse import ArgumentParser
""" Exemplo de retorno de carro e passagem de argumentos. """
parser = ArgumentParser(description='Exemplo de retorno de carro e passagem de argumentos')
parser.add_argument('-s',
action='store',
... |
__problem_title__ = "Counting rectangles"
__problem_url___ = "https://projecteuler.net/problem=85"
__problem_description__ = "By counting carefully it can be seen that a rectangular grid " \
"measuring 3 by 2 contains eighteen rectangles: Although there exists " \
"no... |
import time
import csv
def report(ob):
#Create log file
log_file_report = ob.file_destination + "/" + "Parameters_Results.log"
log_report = file(log_file_report, 'a' )
#Print parameters
#Batch or single file
log_report.write("\nRun type: %s" % ob.runtype)
if ob.ru... |
from os.path import join
from math import pi
from math import sqrt
from math import radians
import cv2
import numpy as np
from numpy import dot
from scipy.optimize import minimize
from scipy.optimize import differential_evolution
import matplotlib.pyplot as plt
from prototype.utils.euler import euler2rot
from prototype... |
from sys import stdin as sin
list_index=[]
list=dict()
def fn(n):
f=1
#check if a value less that that has already been calculated
for i in range(1,n+1):
f*=i
return f
t=int(input())
for i in range(t):
n=int(sin.readline().rstrip())
print(fn(n)) |
from typing import List, Optional, Sequence, Union
from decksite.data import achievements, deck, preaggregation, query
from decksite.data.models.person import Person
from decksite.database import db
from shared import dtutil, guarantee, logger
from shared.container import Container
from shared.database import sqlescape... |
import cv2
import random
from moviepy.editor import VideoFileClip
"""
def pipeline_yolo(img):
img_undist, img_lane_augmented, lane_info = lane_process(img)
output = vehicle_detection_yolo(img, img_lane_augmented, lane_info)
return output
def process_image(img):
output = vehicle_only_yolo(img)
return... |
import re
import vim
import sys
def echoerr(errorstr):
sys.stderr.write("TeX-9: {0}\n".format(str(errorstr)))
def echomsg(msgstr):
sys.stdout.write("TeX-9: {0}\n".format(str(msgstr)))
def get_latex_environment(vim_window):
"""Get information about the current LaTeX environment.
Returns a dictionary with... |
from core import *
import codebase
import poplib
import email
import email.header
import sched, time
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
orders = []
log = []
e = str(raw_input('Enter the email id :'))
p = str(raw_input('Enter the password : '))
def send_email... |
"""
"""
__version__ = "$Id$"
import tarfile
import time
t = tarfile.open('example.tar', 'r')
for filename in [ 'README.txt', 'notthere.txt' ]:
try:
info = t.getmember(filename)
except KeyError:
print 'ERROR: Did not find %s in tar archive' % filename
else:
print '%s is %d bytes' % (i... |
from semeval import helper as helper
from semeval.lstms.LSTMModel import LSTMModel
import numpy
from keras.models import Sequential
from keras.layers import Dense, Activation, Bidirectional, LSTM, Dropout
from keras.callbacks import EarlyStopping
class EarlyStoppingLSTM(LSTMModel):
'''Model that can train an LSTM a... |
from __future__ import absolute_import
from celery import shared_task
import praw
from .commonTasks import *
from .models import Redditor, RedditorStatus, Status
@shared_task
def test(param):
return 'The test task executed with argument "%s" ' % param
@shared_task
def update_user(redditor):
update_user_status(r... |
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import pandas as pd
import sys
import os
import matplotlib as mpl
from matplotlib import ticker
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.dates as md
from matplotlib.collec... |
from .gameserver import Game
from .example import TicTacToe |
from .net import Net |
"""
Given Style Rules, create an SLD in XML format add it to a layer
"""
if __name__=='__main__':
import os, sys
DJANGO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(DJANGO_ROOT)
os.environ['DJANGO_SETTINGS_MODULE'] = 'geonode.settings'
import logging
import os
from ... |
from openerp import api, fields, models, _
from . import exceptions
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
enable_datev_checks = fields.Boolean('Perform Datev Checks', default=True)
@api.multi
def is_datev_validation_active(self):
self.ensure_one()
return self.e... |
from collections import defaultdict
from functools import partial
from itertools import count
import json
import networkx as nx
from networkx.algorithms import weakly_connected_component_subgraphs
from numpy import subtract
from numpy.linalg import norm
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, ... |
import datetime
import logging
import time
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail.message import EmailMultiAlternatives
from django.core.management.base import BaseCommand
from django.db.models import Q
from django.template.loader import render_to_string
from... |
import frappe
def flat_item_group_tree_list(item_group, result=None):
if not result:
result = [item_group]
child_groups = frappe.get_list(
"Item Group",
filters={"parent_item_group": item_group},
fields=["name"]
)
child_groups = [child.name for child in child_groups if child not in result]
if len(child_gro... |
import rospy
from std_msgs.msg import String
from std_msgs.msg import Int32MultiArray
import pyaudio
from rospy.numpy_msg import numpy_msg
import numpy as np
import time
import signal
import os
import sys
CHUNK = 3200
FORMAT = pyaudio.paInt16
CHANNELS = 4
RATE = 16000
DEV_IDX = 5
p = pyaudio.PyAudio()
pub_mic_array = r... |
import pytest
import os.path
from diffoscope.config import Config
from diffoscope.comparators.macho import MachoFile
from diffoscope.comparators.missing_file import MissingFile
from utils.data import data, load_fixture
from utils.tools import skip_unless_tools_exist
obj1 = load_fixture('test1.macho')
obj2 = load_fixtur... |
"""
Forms and validation code for user registration.
Note that all of these forms assume Django's bundle default ``User``
model; since it's not possible for a form to anticipate in advance the
needs of custom user models, you will need to write your own forms if
you're using a custom model.
"""
from __future__ import u... |
from odoo import models, fields, api
class fixing_issues_view(models.Model):
_inherit = 'project.issue' |
from django.contrib import admin
from .models import *
class ProductAdmin(admin.ModelAdmin):
list_display = ('id', 'prd_process_id', 'prd_name',
'prd_display_name', 'prd_owner', 'prd_product_id', 'prd_date',
'prd_class', 'prd_filter', 'prd_is_public', 'prd_is_permanent',)
... |
from django import forms
from ..models import BaseDemographic
class BaseDemographicForm(forms.ModelForm):
class Meta:
model = BaseDemographic
fields = ['first_name','last_name','phone','dob'] |
from mock import patch
from .test_helper import raises
from kiwi.exceptions import KiwiPrivilegesError
from kiwi.privileges import Privileges
class TestPrivileges(object):
@raises(KiwiPrivilegesError)
@patch('os.geteuid')
def test_check_for_root_permiossion_false(self, mock_euid):
mock_euid.return_v... |
import logging
import ssl
from typing import List # pylint: disable=unused-import
import aiohttp
import certifi
import trio_asyncio
from aiohttp.http_exceptions import HttpProcessingError
from .base import BufferedFree, Limit, Sink, Source
logger = logging.getLogger(__name__)
class AiohttpClientSessionMixin:
def i... |
import spear
tool = spear.tools.ISVTool
n_gaussians = 512
iterk = 25
iterg_train = 25
end_acc = 0.0001
var_thd = 0.0001
update_weights = True
update_means = True
update_variances = True
norm_KMeans = True
ru = 100 # The dimensionality of the subspace
relevance_factor = 4
n_iter_train = 10
n_iter_enrol = 1
iterg_enrol =... |
from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from jinja2 import Environment
from albums.models import Album, Artist, RecordLabel
def get_spotify_search_url(term):
return 'https://open.spotif... |
import os
from glob import glob
from itertools import chain
from typing import Iterable
import json
import jinja2
import shutil
from bank_wrangler import schema
def _generate_data_json(transactions, accounts):
transactions = [list(map(str, row))
for row in transactions]
return json.dumps({
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('siteapp', '0041_project_tags'),
('controls', '0045_auto_20210228_1431'),
]
operations = [
migrations.AddField(
model_name='element',
name='tags',
fie... |
class orbitalWidget(QGroupBox):
def __init__(self):
super(QGroupBox, self).__init__()
self.initUI()
def initUI(self):
table= orbitalTable(0, 3)
table.horizontalHeader().setResizeMode(QHeaderView.Stretch)
btn_active = QPushButton('Active', self)
btn_active.setStyle... |
"""SocialNewspaper URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
C... |
"""
PyRC module: pyrc_irc_abstract.irc_server
Purpose
=======
Establish and maintain a connection to an IRC server, generating events as
they occur, and sending data as required.
Legal
=====
All code, unless otherwise indicated, is original, and subject to the terms of
the GPLv2, which is provided in COPYING.
(C) ... |
import squeakspace.common.util as ut
import squeakspace.common.util_http as ht
import squeakspace.proxy.server.db_sqlite3 as db
import squeakspace.common.squeak_ex as ex
import config
def post_handler(environ):
query = ht.parse_post_request(environ)
cookies = ht.parse_cookies(environ)
user_id = ht.get_requi... |
import os
from PyQt4 import QtCore, QtGui
from Extensions.Global import sizeformat
class SearchWidget(QtGui.QLabel):
def __init__(self, parent):
QtGui.QLabel.__init__(self, parent)
self._parent = parent
self.setStyleSheet("""background: rgba(0, 0, 0, 50); border-radius: 0px;""")
self... |
"""
Copyright (C) 2015 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
W... |
"""template_III URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Clas... |
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.upd... |
class GameMenu(object):
def __init__(self, menu_name, **options):
self.menu_name = menu_name
self.options = options |
from collections import OrderedDict
def parse_geste(infile_name):
"""
Parses a GESTE file and retuns an OrderedDict with:
{"Population_name":[Freq_ref_allele_on SNP_1,Freq_ref_allele_on SNP_2,...]}
"""
infile = open(infile_name, "r")
pop_freqs = OrderedDict()
pop_starter = "[pop]="
popna... |
from qtaste import *
import time
javaguiMI = testAPI.getJavaGUI(INSTANCE_ID=testData.getValue("JAVAGUI_INSTANCE_NAME"))
subtitler = testAPI.getSubtitler()
importTestScript("TabbedPaneSelection")
def step1():
"""
@step Description of the actions done for this step
@expected Description of the expected ... |
from __future__ import unicode_literals
from django import forms
from .settings import MARTOR_ENABLE_LABEL
from .widgets import MartorWidget
class MartorFormField(forms.CharField):
def __init__(self, *args, **kwargs):
# to setup the editor without label
if not MARTOR_ENABLE_LABEL:
kwargs... |
import random
from pybugger import myaixterm
color = myaixterm
color.aix_init()
def string_constructor(args, foreground="normal", background="normal"):
if foreground != "rainbow":
foreground = "" if foreground == "normal" else color.aix_fg(foreground)
background = "" if background == "normal" else c... |
"""
.. module:: scoopy.oauth
.. moduleauthor:: Mathieu D. (MatToufoutu) <mattoufootu[at]gmail.com>
"""
import os
from time import time
from urllib import urlencode
try:
from urlparse import parse_qsl
except ImportError:
from cgi import parse_qsl
try:
import cPickle as pickle
except ImportError:
import p... |
"""
The Bugs model package provides bugs and their specific behaviour.
"""
from net.cadrian.microcosmos.model.bugs.antFemales import AntFemale, Target as AntFemaleTarget
from net.cadrian.microcosmos.model.bugs.antQueens import AntQueen
from net.cadrian.microcosmos.model.bugs.antSoldiers import AntSoldier
from net.cadri... |
import importlib, os
from glob import glob
from cStringIO import StringIO
from common import write_if_changed
def discover():
# find packages
packages = {'horton': []}
for fn in glob('../horton/*/__init__.py'):
subpackage = fn.split('/')[2]
if subpackage == 'test':
continue
... |
import smtplib, os, sys
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
from_address = 'EMAIL_FROM_ADDRESS'
to_address = ['EMAIL_TO_ADDRESS']
email_subject = 'Alert!!... |
"""
Validators for UI
@author: Jan Gabriel
@contact: jan.gabriel@tul.cz
"""
from enum import Enum
from PyQt5.QtGui import QColor
from PyQt5 import QtWidgets
class ValidationColors(Enum):
"""
Holds colors for form validation.
"""
white = QColor("#ffffff")
red = QColor("#f6989d")
grey = QColor("#A... |
import os
import time
import json
TIME_FORMAT="%b %d %Y %H:%M:%S"
MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n"
if not os.path.exists("/var/log/ansible/hosts"):
os.makedirs("/var/log/ansible/hosts")
def log(host, category, data):
if type(data) == dict:
if 'verbose_override' in data:
# a... |
from gem.api import Location
from enum import Enum
LOG_TAG = "player"
def player_position_update(player, location, warped):
profile = player.profile
profile.location = location |
import sys
import os
from distutils.core import run_setup
from distutils.command.build_ext import build_ext as _build_ext
from setuptools import setup, Extension, find_packages
PKG_NAME = "piqueserver"
extra_args = sys.argv[2:]
with open('README.rst') as f:
long_description = f.read()
here = os.path.abspath(os.path... |
import unittest
import time
import os
import shutil
import sys
import json
from multiprocessing import Pipe
from datetime import datetime
from datetime import timedelta
from mock import patch, Mock
from kivy.clock import Clock
from nose.plugins.attrib import attr
from utils.process import Process
def worker_func(con):
... |
"""autogenerated by genpy from nasa_r2_common_msgs/JointStatusArray.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import nasa_r2_common_msgs.msg
import std_msgs.msg
class JointStatusArray(genpy.Message):
_md5sum = "db132c4fff9528f41c0236d435100eda"... |
import unittest
import os
import sys
import random
import struct
import binascii
import time
from PyQt5.QtCore import (
Qt, QAbstractItemModel, QModelIndex,)
from PyQt5.QtXml import QDomDocument
from nxsconfigtool.ComponentModel import ComponentModel
from nxsconfigtool.ComponentItem import ComponentItem
IS64BIT = (... |
"""Tests for qutebrowser.misc.msgbox."""
import pytest
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMessageBox, QWidget
from qutebrowser.misc import msgbox
from qutebrowser.utils import utils
@pytest.fixture(autouse=True)
def patch_args(fake_args):
fake_args.no_err_windows = False
def test_attributes(qt... |
"""This module contains the classes that represent Telegram InlineQueryResultMpeg4Gif."""
from telegram import InlineQueryResult
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
"""
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the
Telegram servers. By defa... |
from django import template
from django.core.urlresolvers import reverse
from django.utils.http import urlquote_plus
from apps.cms.models import Content
register = template.Library()
@register.simple_tag (takes_context=True)
def cms_content (context, key):
request = context['request']
can_edit = request.user.ha... |
from datetime import datetime, timedelta, tzinfo
from math import sin, cos, asin, acos, sqrt
import time, calendar
import ctypes,os, fcntl, errno
from RMUtilsFramework.rmLogging import log
ZERO = timedelta(0)
Y2K38_MAX_YEAR = 2037
Y2K38_MAX_TIMESTAMP = 2147483647
class timespec(ctypes.Structure):
_fields_ = [
... |
from pprint import pprint
import sys,os
import random
import json
import gzip
import random
import boto3
session = boto3.Session(
region_name='cn-north-1',
aws_access_key_id='xxxxxxxxxxxxxx',
aws_secret_access_key='xxxxxxxxxxxxxxxxxxxxxx'
)
sns = session.resource('sns')
sns_client = session.client('sns')
A=... |
from tasty.types.driver import TestDriver
__params__ = {'la': 32, 'lb': 32}
driver = TestDriver()
def protocol(client, server, params):
la = params['la']
lb = params['lb']
client.a = Unsigned(bitlen=la).input(src=driver, desc='a')
client.b = Unsigned(bitlen=lb).input(src=driver, desc='b')
client.ga ... |
import sys,sqlite3,os
if __name__ == "__main__":
if len(sys.argv) != 3:
print ("usage: update_database database_name division")
print ("\t\tdatabase_name = any database name that will be referred to later")
print ("\t\tdivision = the division as recognized by NCBI (used for downloading)")
print ("\t\t\texample... |
"""Tests for `gwsumm.data`
"""
import os.path
import operator
import tempfile
import shutil
from collections import OrderedDict
from urllib.request import urlopen
import pytest
from numpy import (arange, testing as nptest)
from lal.utils import CacheEntry
from glue.lal import Cache
from gwpy.timeseries import TimeSerie... |
import lal
import numpy
from numpy import sqrt, log, float128
from pycuda.elementwise import ElementwiseKernel
from pycbc.libutils import pkg_config_header_strings
from pycbc.types import FrequencySeries, zeros, Array, complex64
preamble = """
"""
phenomC_text = """
/* ********* Main paper : Phys Rev D82, 064016 (2... |
"""
Basic image builder using vmdebootstrap.
"""
import json
import logging
import shutil
import subprocess
logger = logging.getLogger(__name__)
class VmdebootstrapBuilderBackend():
"""Build an image using vmdebootstrap tool."""
def __init__(self, builder):
"""Initialize the builder."""
self.bui... |
"""
RESTx: Sane, simple and effective data publishing and integration.
Copyright (C) 2010 MuleSoft Inc. http://www.mulesoft.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... |
import bpy
from collections import defaultdict
from contextlib import ExitStack
import functools
from pathlib import Path
from ..helpers import TemporaryObject
from ..korlib import ConsoleToggler
from PyHSPlasma import *
from . import animation
from . import camera
from . import decal
from . import explosions
from . im... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('waterlevel', '0004_auto_20160531_1218'),
]
operations = [
migrations.AlterModelOptions(
name='watergate',
options={'get_latest_by': 'pk',... |
from math import *
testing_number = int(1)
sum_of_logs = log(2)
n = int(input('Choose a number: '))
while testing_number < n:
testing_number = testing_number + 2
for checking_number in range(2, testing_number):
if testing_number % checking_number == 0:
break
else:
sum_of_logs = s... |
"""
@file CSV2polyconvertXML.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-07-17
@version $Id: CSV2polyconvertXML.py 22608 2017-01-17 06:28:54Z behrisch $
Converts a given CSV-file that contains a list of pois to
an XML-file that may be read by POLYCONVERT.
SUMO, Simulation of Urban MObility... |
import sys,os
sys.path.append('/usr/local/lib/python2.7/site-packages/')
sys.path.append('/usr/local/lib64/python2.7/site-packages/')
import math
from playerc import *
robot = playerc_client(None, 'localhost',6665)
if robot.connect():
raise Exception(playerc_error_str())
sonarProxy = playerc_ranger(robot,0)
if sonarPr... |
from django.shortcuts import render,HttpResponse
from .models import Employee
from .models import Record
import datetime
import calendar
def wage_list(request):
return render(request,'app/wage_list.html',{})
def get_data(request):
date_from_user = str(request.POST.get('datepicker'))
date_from_user = date_from_user.s... |
from datetime import datetime
import inspect
import os
from pathlib import Path
import re
import sys
from nbconvert.preprocessors import Preprocessor
import nbsphinx
from setuptools_scm import get_version
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
sys.path.insert(0, os.path.abspath(os.path.pa... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def plot_decision_regions(X, y, clf, res=0.02):
x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1
y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, res),
np.arange... |
"""
segmentation-fold can predict RNA 2D structures including K-turns.
Copyright (C) 2012-2016 Youri Hoogstrate
This file is part of segmentation-fold and originally taken from
yh-kt-fold.
segmentation-fold is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as p... |
import sys
import os
import shlex
sys.path.insert(0, os.path.abspath('..'))
from setup import get_distribution_info
project_metadata = get_distribution_info()
needs_sphinx = '1.5'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcod... |
from common.common_consts.telem_categories import TelemCategoryEnum
from infection_monkey.telemetry.base_telem import BaseTelem
class ScanTelem(BaseTelem):
def __init__(self, machine):
"""
Default scan telemetry constructor
:param machine: Scanned machine
"""
super(ScanTelem,... |
from django.contrib.auth import get_user_model
from model_bakery import baker
from tenant_schemas.test.cases import TenantTestCase
from tenant_schemas.test.client import TenantClient
from hackerspace_online.tests.utils import ViewTestUtilsMixin
from djcytoscape.models import CytoScape
User = get_user_model()
class View... |
from flask import g
from flask.ext.restplus import Namespace, reqparse, marshal
from app.api.attendees import TICKET
from app.api.microlocations import MICROLOCATION
from app.api.sessions import SESSION
from app.api.speakers import SPEAKER
from app.api.sponsors import SPONSOR
from app.api.tracks import TRACK
from app.h... |
import sys
import signal
from ReText import *
from ReText.window import ReTextWindow
def main():
app = QApplication(sys.argv)
app.setOrganizationName("ReText project")
app.setApplicationName("ReText")
RtTranslator = QTranslator()
for path in datadirs:
if RtTranslator.load('retext_'+QLocale.system().name(), path+... |
"""
Tests for user models.
"""
from django.contrib.auth.models import User, Group
from django.test import TestCase
from weblate.accounts.models import AutoGroup
class AutoGroupTest(TestCase):
@staticmethod
def create_user():
return User.objects.create_user('test1', 'noreply@weblate.org', 'pass')
def... |
import locale
import os
import re
import subprocess
import sys
import platform
import time
PROGRAM_DIR = os.path.dirname(os.path.normpath(os.path.abspath(os.path.join(__file__, os.pardir))))
LIBS_DIR = os.path.join(PROGRAM_DIR, 'libs')
sys.path.insert(0, LIBS_DIR)
SYS_ARGV = sys.argv[1:]
APP_FILENAME = sys.argv[0]
APP_... |
import yaml
class IncorrectConfig(Exception): pass
class BareConfig:
def __init__(self):
self.config = {}
self.required_list = []
def add_parameter(self, name, required=False, description='',
default=None, typ=str):
if required:
self.required_list.append... |
"""
Copyright (C) 2017 João Barroca <joao.barroca@tecnico.ulisboa.pt>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This progr... |
"""
Unit tests for nyx.panel.graph.
"""
import datetime
import unittest
import stem.control
import nyx.curses
import nyx.panel.graph
import test
from test import require_curses
from mock import patch
EXPECTED_BLANK_GRAPH = """
Download:
0 b
0 b
5s 10 15
""".rstrip()
EXPECTED_ACCOUNTING = """
Accounting (awa... |
import time
import bluetooth
from h7PolarDataPoints import h7PolarDataPoint
from h7PolarDataPointReader import h7PolarDataPointReader
if __name__ == '__main__':
h7PolarDataPointReader = h7PolarDataPointReader()
h7PolarDataPointReader.start()
while(True):
dataPoint = h7PolarDataPointReader.readNextDa... |
"""
This Code tests module import from SEAS
"""
import os
import sys
DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(DIR, '../..'))
import SEAS_Utils.common_utils.data_plotter as plt
from SEAS_Utils.common_utils.timer import simple_timer
import SEAS_Utils.common_utils.db_management2 as ... |
__version__ = '0.1'
import xml.dom.minidom
import dom, http
import os.path
class OsmXapi:
def __init__(self, api = "www.overpass-api.de", base="api", debug = False):
self.debug = debug
self.base = os.path.join('/', base, 'xapi')
self.http = http.Http(api, debug)
#.
def nodeGet(self, ... |
"""
NLTK Parsers
Classes and interfaces for producing tree structures that represent
the internal organization of a text. This task is known as "parsing"
the text, and the resulting tree structures are called the text's
"parses". Typically, the text is a single sentence, and the tree
structure represents the syntacti... |
"""
@author: Manuel F Martinez <manpaz@bashlinux.com>
@organization: Bashlinux
@copyright: Copyright (c) 2012 Bashlinux
@license: GNU GPL v3
"""
import usb.core
import usb.util
import serial
import socket
from .escpos import *
from .constants import *
from .exceptions import *
class Usb(Escpos):
""" Define USB prin... |
"""
crate_anon/linkage/bulk_hash.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify
it under the terms of the GNU General ... |
import zope.deprecation
zope.deprecation.moved(
'zope.annotation.attribute',
"Zope 3.5",
) |
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.contrib.auth.models import User
from application.serializers import UserSerializer, ApplicationSerializer, ApplicationListSerializer
from rest_framework import viewsets, status
from application.models import Applicat... |
from .sample_filter import SampleFilter, GtFilter
from .sv_gt_filter import SvGtFilter
import logging
from collections import OrderedDict, defaultdict
class FamilyFilter(object):
'''
Determine whether variants/alleles fit given inheritance
patterns for families.
'''
def __init__(self, ped, v... |
from gnuradio import gr, gr_unittest
from gnuradio import blocks, digital
import pmt
import numpy as np
import sys
def make_length_tag(offset, length):
return gr.python_to_tag({'offset': offset,
'key': pmt.intern('packet_len'),
'value': pmt.from_long(length)... |
__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "4.1"
__date__ = "13 Nov 2016"
import bpy
from . import muv_props
PHI = 3.1415926535
def debug_print(*s):
"""
Print message to console in debugging mode
"""
if muv_props.DEBUG:
print(s)
def check_version(major, ... |
from testtools.matchers import Equals
from testtools import TestCase
from snapcraft.plugins.v2.meson import MesonPlugin
class MesonPluginTest(TestCase):
def test_schema(self):
schema = MesonPlugin.get_schema()
self.assertThat(
schema,
Equals(
{
... |
all( {% include "LinkedInObject.IsInstance.py" with variable="element" type=type.name|add:"."|add:type.name only %} for element in {{ variable }} ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.