text string | size int64 | token_count int64 |
|---|---|---|
#!/usr/bin/env python3
# system imports
import argparse
import sys
# obspy imports
from obspy.clients.fdsn import Client
from obspy import read, read_inventory, UTCDateTime
from scipy import signal
from obspy.signal.cross_correlation import correlate, xcorr_max
from obspy.clients.fdsn.header import FDSNNoDataExceptio... | 11,606 | 3,468 |
import urllib
from cloudbridge.cloud.interfaces.resources import TrafficDirection
from rest_auth.serializers import UserDetailsSerializer
from rest_framework import serializers
from rest_framework.reverse import reverse
from . import models
from . import view_helpers
from .drf_helpers import CustomHyperlinkedIdenti... | 32,810 | 9,433 |
from what_apps.mooncalendar.models import Event
from what_apps.mooncalendar.models import Moon
from django.contrib import admin
class EventAdmin(admin.ModelAdmin):
list_display = 'name',
fieldsets = [
(None, {'fields': ['name']}),
('description', {'fields':['description']}),
('Date info... | 866 | 265 |
from typing import Dict
from typing import Union
from typing import Iterable
from typing import Optional
from datetime import datetime
from datetime import timedelta
import numpy as np
from google.cloud.bigtable.row_data import PartialRowData
from google.cloud.bigtable.row_filters import RowFilter
from . import attri... | 4,019 | 1,192 |
# CircuitPlaygroundExpress_LightSensor
# reads the on-board light sensor and graphs the brighness with NeoPixels
import time
from adafruit_circuitplayground.express import cpx
from simpleio import map_range
cpx.pixels.brightness = 0.05
while True:
# light value remaped to pixel position
peak = map_range(cpx... | 551 | 223 |
"""
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
import os
import sys
import json
import logging
import argparse
import pickle
from tqdm import tqdm
from dataset import read_data, PrefixDataset
from trie import Trie
from metric import calc_rank, calc_partial_rank, mrr_summary, mrl_summary
logging.basicCo... | 3,258 | 1,180 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 18:18:29 2020
@author: xuhuiying
"""
import numpy as np
import matplotlib.pyplot as plt
def plotHistory(history,times,xLabelText,yLabelText,legendText):#η»εΊζ―δΈͺhistory plot each history
history = np.array(history) #historyζ―δΊη»΄ζ°η» history is a 2D... | 813 | 332 |
from .constants import *
from .actions import ACTIONS
| 56 | 18 |
#!/usr/bin/env python
from VMParser import Parser
from VMCodewriter import CodeWriter
from pathlib import Path
import sys
def processDirectory(inputPath):
fileName = str(inputPath.stem)
myWriter = CodeWriter(fileName)
lines = myWriter.initHeader()
for f in inputPath.glob("*.vm"):
lines += proc... | 1,497 | 484 |
import package.data_input as di
import ete3
import math
import package.instance as inst
import package.params as pm
import numpy as np
import matplotlib
try:
import tkinter
except:
matplotlib.use('Qt5Agg', warn=False, force=True)
import matplotlib.pyplot as plt
import palettable as pal
import pprint as pp
impor... | 19,343 | 5,914 |
import inspect
from unittest.mock import Mock
from _pytest.monkeypatch import MonkeyPatch
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.engine.training import fingerprinting
from rasa.nlu.classifiers.diet_classifier import DIETClassifier
from rasa.nlu.selectors.response_selector import ResponseSelector... | 2,435 | 793 |
"""
Command-line driver example for SMIRKY.
"""
import sys
import string
import time
from optparse import OptionParser # For parsing of command line arguments
import smarty
from openforcefield.utils import utils
import os
import math
import copy
import re
import numpy
from numpy import random
def main():
# Cre... | 10,068 | 3,063 |
# -*- coding: utf-8 -*-
import logging
import os
import sys
import unittest
# FIXME Do some tests
| 100 | 37 |
from collections import defaultdict, deque
from datetime import datetime
import pandas as pd
import random
import numpy as np
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from common import Label_DbFields, Synthetic_Category_Group_Names, Other_Synthetic_Group_Names, MultiLabel_Group_... | 9,800 | 3,036 |
# We use a slightly hacked version of the plot.ly js/python library
lddmm_python = __import__(__name__.split('.')[0])
print(lddmm_python)
import lddmm_python.lib.plotly as plotly
import re
from pylab import *
from IPython.html.widgets import interact
from IPython.display import HTML, display
from pprint import pprint
... | 3,385 | 1,565 |
import logging
import http.client as http_client
from flask import url_for, g
from flask.views import MethodView
import marshmallow as ma
from flask_smorest import Blueprint, abort
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from drift.core.extensions.urlregistry import Endpoints
from driftbase.models.db i... | 3,180 | 983 |
import os
import cv2
import jpype
import shutil
import weasyprint
from bs4 import BeautifulSoup
jpype.startJVM()
from asposecells.api import *
def generatePDF(XLSXPath, OutPath):
workbook = Workbook(XLSXPath)
workbook.save(f"sheet.html", SaveFormat.HTML)
with open(f'./sheet_files/sheet001.htm') as f:
... | 1,342 | 489 |
#-*- coding: utf8 -*-
# *************************************************************************************************
# Python API for EJDB database library http://ejdb.org
# Copyright (C) 2012-2013 Softmotions Ltd.
#
# This file is part of EJDB.
# EJDB is free software; you can redistribute it and/or modify i... | 6,912 | 2,402 |
from django.urls import path
from . import views
app_name = 'users'
urlpatterns = [
path('<int:pk>/', views.user_profile, name='user_profile'),
path('messages/<int:pk>/', views.PrivateMessageView.as_view(), name='private_message')
] | 242 | 80 |
#!/usr/bin/env python
def main():
"""Main flow control of vkmz
Read input data into feature objects. Results in dictionaries for samples
and features.
Then, make predictions for features. Features without predictions are removed
by default.
Finally, write results.
"""
from vkmz.ar... | 2,029 | 628 |
#! /usr/bin/env python3
from math import sqrt
from decimal import getcontext, Decimal
description = '''
Square root digital expansion
Problem 80
It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any rep... | 1,076 | 340 |
from .assembler import TsvAssembler
| 36 | 13 |
from keras.layers import Dense
from keras.models import Sequential
from keras.wrappers.scikit_learn import KerasClassifier
from run_binary_classifier import run
from keras import regularizers
def keras_logreg_model():
model = Sequential()
model.add(Dense(units=1,
input_shape=(2,),
... | 971 | 330 |
# Generated by Django 2.1 on 2018-09-06 02:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('phantomapp', '0008_auto_20180904_2102'),
]
operations = [
migrations.CreateModel(
name='Order',
... | 1,910 | 549 |
# flake8: noqa
from .main import DatabaseChoice, ExampleChoice, SessionChoices, StartProject, TemplateChoice
| 109 | 29 |
from . getID import getID
class getPMID(getID):
"""Add the correct query string to only search for PMIDs"""
def __init__(self, id):
self.query = 'ext_id:' + id + ' src:med'
| 178 | 66 |
from sphericalquadpy.levelsymmetric.levelsymmetric import Levelsymmetric
import pytest
def test_levelsymmetric():
Q = Levelsymmetric(order=4)
assert Q.name() == "Levelsymmetric Quadrature"
assert Q.getmaximalorder() == 20
with pytest.raises(Exception):
_ = Levelsymmetric(order=-10)
Q =... | 560 | 208 |
"""
MIT License
Copyright (c) 2022 PaxxPatriot
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, merge, publish, d... | 2,202 | 844 |
from requests import get
from json import loads
from time import time
from uuid import UUID
def username_to_uuid(username, when=int(time())):
url = 'https://api.mojang.com/users/profiles/minecraft/{}?at={}'
r = get(url.format(username, when))
if r.status_code == 200:
data = loads(r.text)
... | 387 | 134 |
GENERIC = [
'Half of US adults have had family jailed',
'Judge stopped me winning election',
'Stock markets stabilise after earlier sell-off'
]
NON_GENERIC = [
'Leicester helicopter rotor controls failed',
'Pizza Express founder Peter Boizot dies aged 89',
'Senior Tory suggests vote could be d... | 329 | 108 |
"""Test Skytap published services API access."""
import json
import os
import time
import sys
sys.path.append('..')
from skytap.Environments import Environments # noqa
from skytap.framework.ApiClient import ApiClient # noqa
environments = Environments()
def test_ps_values():
"""Ensure published service capabi... | 604 | 170 |
class Solution:
def uniqueLetterString(self, S: str) -> int:
idxes = {ch : (-1, -1) for ch in string.ascii_uppercase}
ans = 0
for idx, ch in enumerate(S):
i, j = idxes[ch]
ans += (j - i) * (idx - j)
idxes[ch] = j, idx
for i, j in idxes.values():
... | 396 | 147 |
from time import sleep
print('-=-' * 15)
print('Iremos calcular o preΓ§o da sua viagem (R$)')
print('-=-' * 15)
distancia = float(input('Qual a distΓ’ncia da viagem?\n>'))
print('CALCULANDO...')
sleep(2)
if distancia <= 200:
preco = distancia * 0.50
print(f'O preΓ§o da sua viagem vai custar R${preco:.2f}')
else:... | 411 | 179 |
import logging
from rest_framework import viewsets
from saas_framework.sharing.models import Sharing
from saas_framework.sharing.serializers import SharingSerializer
logger = logging.getLogger(__name__)
class SharingViewSet(viewsets.ModelViewSet):
queryset = Sharing.objects.all()
serializer_class = SharingSe... | 357 | 101 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'yΓ¬fΔng'
CN=u'ηΏ³ι£'
NAME=u'yifeng41'
CHANNEL='sanjiao'
CHANNEL_FULLNAME='SanjiaoChannelofHand-Shaoyang'
SEQ='SJ17'
if __name__ == '__main__':
pass
| 228 | 129 |
class Image_Anotation:
def __init__(self, id, image, path_image):
self.id = id
self.FOV = [0.30,0.60]
self.image = image
self.list_roi=[]
self.list_compose_ROI=[]
self.id_roi=0
self.path_image = path_image
def set_image(self, image):
self.imag... | 2,090 | 712 |
from django.apps import AppConfig
class ProjectofficeConfig(AppConfig):
name = 'projectoffice'
| 106 | 33 |
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
import cv2
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
sys.path.insert(0, os.path.abspath(".."))
from utils import ... | 2,874 | 1,248 |
# Hashcode 2021
# Team Depresso
# Problem - Traffic Signaling
## Data Containers
class Street:
def __init__(self,start,end,name,L):
self.start = start
self.end = end
self.name = name
self.time = L
def show(self):
print(self.start,self.end,self.name,self.time)
class Car:
def __init__(sel... | 1,832 | 751 |
# Databricks notebook source
# MAGIC %run ../_modules/epma_global/functions
# COMMAND ----------
# MAGIC %run ../_modules/epma_global/test_helpers
# COMMAND ----------
from pyspark.sql import functions as F
# COMMAND ----------
dbutils.widgets.text('db', '', 'db')
DB = dbutils.widgets.get('db')
assert DB
dbutils... | 3,178 | 1,189 |
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import StripeProvider
urlpatterns = default_urlpatterns(StripeProvider)
| 164 | 48 |
import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from .build import MODEL_REGISTRY
@MODEL_REGISTRY.register()
class CNNRNN(nn.Module):
def __init__(self, cfg):
super().__init__()
input_dim = 512
... | 1,491 | 552 |
# Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft Corporation
# Copyright 2018 Sonus Networks, Inc. (d.b.a. Ribbon Communications Operating Company)
#
# 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 ... | 5,829 | 1,590 |
from os import environ as env
import json
import utils
import utils.aws as aws
import utils.handlers as handlers
def put_record_to_logstream(event: utils.LambdaEvent) -> str:
"""Put a record of source Lambda execution in LogWatch Logs."""
log_group_name = env["REPORT_LOG_GROUP_NAME"]
utils.Log.info("Fet... | 1,828 | 498 |
import os
from importlib import import_module
from flask import Flask
import ConfigParser
import Printer
class Server:
def __init__(self, generator, comparison, config_file='config.ini'):
# Generator class
self.gen = generator
# Comparison class
self.comp = comparison
cp... | 2,999 | 919 |
from django.urls import path, include
from . import views
urlpatterns = [
path("", views.index, name="index"),
# Authentication
path("accounts/", include("django.contrib.auth.urls")),
path("accounts/register/", views.register, name="register"),
# Test URLs
path("test/wsconn", views.wsconn, na... | 416 | 134 |
import os
from bc import Imitator
import numpy as np
from dataset import Example, Dataset
import utils
#from ale_wrapper import ALEInterfaceWrapper
from evaluator import Evaluator
from pdb import set_trace
import matplotlib.pyplot as plt
#try bmh
plt.style.use('bmh')
def smooth(losses, run=10):
new_losses = []
... | 4,337 | 1,345 |
from IPython import get_ipython
from IPython.display import display
def is_ipynb():
return type(get_ipython()).__module__.startswith('ipykernel.')
| 153 | 49 |
"""Strategic conflict detection Subscription query tests:
- add a few Subscriptions spaced in time and footprints
- query with various combinations of arguments
"""
import datetime
from monitoring.monitorlib.infrastructure import default_scope
from monitoring.monitorlib import scd
from monitoring.monitorlib.scd ... | 8,526 | 3,374 |
# Generated by Django 3.0.4 on 2020-03-27 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnarie', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='questionnaire',
name='email',
... | 516 | 163 |
from .rtree import RTree
from .utils import Point
# EXPORT
class Scene(object):
def __init__(self):
self.entities = {}
self.dynamics = set()
self.statics = set()
self.rtree = RTree()
def add(self, entity):
eid = entity.get_id()
self.entities[eid] = entity
... | 2,250 | 730 |
from django.test import TestCase, Client
from django.urls import reverse
from apps.pages.models import Page
class TestPageView(TestCase):
def setUp(self):
self.client = Client()
Page.objects.create(slug="test_slug")
def test_page_GET(self):
url = reverse("page_app:page", args=["test_... | 1,192 | 385 |
from sequal.ion import Ion
ax = "ax"
by = "by"
cz = "cz"
# calculate non-labile modifications and yield associated transition
# For example "by" would yield a tuple of "b" and "y" transitions.
def fragment_non_labile(sequence, fragment_type):
for i in range(1, sequence.seq_length, 1):
left = Ion(sequence[... | 1,148 | 342 |
import shoulder
class EncodedRtToR9(shoulder.transform.abstract_transform.AbstractTransform):
@property
def description(self):
d = "changing src/dest register for encoded accessors from r0 to r9"
return d
def do_transform(self, reg):
for am in reg.access_mechanisms["mrs_register"]... | 444 | 137 |
import datetime
from sqlalchemy import Column, Integer, String, Boolean, Enum, Text, text
from sqlalchemy.types import TIMESTAMP
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from . import Base
class User(Base):
__tablename__ = 'users'
__table_args__ = {
'... | 1,642 | 514 |
"""
order.py
This module contains classes needed for emulating logistics system. In particular, the following
classes are here:
Item
Vehicle
Order
Location
"""
import copy
from typing import List
class Item:
"""A class used to represent an item for logistics system.
Attributes
----------
name : str... | 4,999 | 1,539 |
"""The ripple component."""
| 28 | 10 |
import os
import json
import shlex
import pprint
import asyncio
import tempfile
import functools
import subprocess
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.lib.cmd as s_cmd
import synapse.lib.cli as s_cli
ListHelp = '''
Lists all the keys underneath a particular key in the hive.
... | 8,362 | 2,422 |
"""
Contains methods to convert hex colors to rgb colors
and to brighten/darken colors.
"""
import numpy as np
def h2r(_hex):
"""
Convert a hex string to an RGB-tuple.
"""
if _hex.startswith('#'):
l = _hex[1:]
else:
l = _hex
return [ a/255. for a in bytes.fromhex(l) ]
def r2h... | 1,888 | 635 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2019-08-19 12:30
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
... | 13,815 | 3,826 |
#!usr/bin/env python3
import os
import requests
os.system("clear")
print("""
βββββ ββββ βββββ ββ βββββ ββββββ ββββ
βββββ ββββ βββββ ββ βββββ ββββββ ββββ
βββββ ββββ βββββ ββ βββββ ββββββ ββββ""")
print("<---------Coded By Copycat---------->")
print("")
url = input("[+] Site Name: ")
shell_name = input("[+] Shell Name:... | 658 | 300 |
from django.conf.urls import url, patterns
urlpatterns = patterns('organization.views',
url(r'^organization/(?P<organization_id>\d+)/job/create/$', 'job_create', name='job_create'),
url(r'^job/create/$', 'job_create_standalone', name='job_create_standalone'),
url(r'^job/(?P<job_id>\d+)/edit/$', 'job_edit'... | 460 | 180 |
from celery.task import Task
from ..notifications.contextmanagers import BatchNotifications
class AsyncBadgeAward(Task):
ignore_result = True
def run(self, badge, state, **kwargs):
# from celery.contrib import rdb; rdb.set_trace()
with BatchNotifications():
badge.actually_possibl... | 337 | 103 |
#
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from ..defs import (task_name_sep, task_state_to_int, task_int_to_state)
from ...util import option_list
from ...io import find... | 5,128 | 1,550 |
NEO_HOST = "seed3.neo.org"
MAINNET_HTTP_RPC_PORT = 10332
MAINNET_HTTPS_RPC_PORT = 10331
TESTNET_HTTP_RPC_PORT = 20332
TESTNET_HTTPS_RPC_PORT = 20331
| 150 | 86 |
#!/opt/local/bin/python
import timeit
import time
import sys
def sieveOfSundaram(n=1000):
# this version returns a dictionary for quick lookup of primes <= n
# this version returns a list for easy identification of nth prime
k = int(( n - 2 ) / 2 )
a = [0] * ( k + 1 )
# primes = {}
primes = []
... | 1,141 | 436 |
# Load in our dependencies
# Forking from http://matplotlib.org/xkcd/examples/showcase/xkcd.html
from matplotlib import pyplot
import numpy
"""
Comments on PRs about style
20 | --------\
| |
| |
| |
| |
1 | \--\
0 | -------
------------------... | 1,895 | 708 |
import yaml
import json
yaml_list = range(5)
yaml_list.append('string1')
yaml_list.append('string2')
yaml_list.append({})
yaml_list[-1]
{}
yaml_list[-1]['critter1'] = 'hedgehog'
yaml_list[-1]['critter2'] = 'bunny'
yaml_list[-1]['dungeon_levels'] = range(5)
yaml_list.append('list_end')
with open("class1_list.yml", "w"... | 457 | 192 |
# first.n.squares.manual.method.py
def get_squares_gen(n):
for x in range(n):
yield x ** 2
squares = get_squares_gen(3)
print(squares.__next__()) # prints: 0
print(squares.__next__()) # prints: 1
print(squares.__next__()) # prints: 4
# the following raises StopIteration, the generator is exhausted,
# a... | 402 | 140 |
import csv
from django.contrib import admin
from django.forms import ModelForm
from django.http import HttpRequest
from products.models import AmazonCategory, AmazonProductListing
from products.tasks import process_inventory_upload
from products.utils import find_price_col_index, save_status, find_identifier_col_inde... | 3,737 | 1,081 |
class binary_tree:
def __init__(self):
pass
class Node(binary_tree):
__field_0 : int
__field_1 : binary_tree
__field_2 : binary_tree
def __init__(self, arg_0 : int , arg_1 : binary_tree , arg_2 : binary_tree ):
self.__field_0 = arg_0
self.__field_1 = arg_1
self.__fi... | 614 | 212 |
class NotEnoughBands(Exception):
pass
| 42 | 14 |
from pyCLI.config import Config
from pyCLI.logging import logger
def main(config: Config):
print(config.pycli_message)
logger.debug("If you enter 'pyCLI -v', you will see this message!")
| 197 | 60 |
import pytest
from analyzer.config import LATE_MERGING, SKIP_FAILING_TESTS, SLOW_BUILD, BROKEN_RELEASE
@pytest.fixture(scope='module')
def antipattern_data_hd():
"""
Happy day antipattern data
:return: happy day antipattern data
"""
return {
LATE_MERGING: {},
SKIP_FAILING_TESTS: {}... | 3,164 | 1,172 |
# Generated by Django 3.0.7 on 2020-07-03 15:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('taskker', '0012_auto_20200703_1529'),
]
operations = [
migrations.AlterField(
model_name='task',
name='priority',
... | 513 | 187 |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/SpecimenDefinition
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from... | 21,498 | 5,537 |
import logging
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from networkx import DiGraph
from torch import Tensor, nn as nn
from torch.autograd.variable import Variable
from binlin.data.ud import index_data
from binlin.model.nn_utils import get_embed_matr... | 8,415 | 3,026 |
from plotter import load_data
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Stampa il dataframe passatogli come istogramma
def plot_coordinata(data: pd.DataFrame, coordinata: str, alpha_value=1.0, title="Grafico 1"):
data = data[[coordinata,'color']]
rosse = data[data['color'] == ... | 1,563 | 554 |
######## map
# Transform each object of list
# i.e. multiple each object by 3 in [0,1,2,3]
x = range(5)
print(list(x))
y = map(lambda x: x*3,x)
def multiply_5(num):
return num*5
print(list(y))
y = map(multiply_5,x)
print(list(y))
######## filter
# Removed items from list based on condition
y = fi... | 1,281 | 593 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
# Copyright: (c) 2021 Felix Fontein <felix@fontein.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass... | 10,781 | 3,062 |
import pytest
@pytest.mark.order(4)
def test_four():
pass
@pytest.mark.order(3)
def test_three():
pass
| 115 | 49 |
## This script will define the functions used in the locate lane lines pipeline
## The end of this script will process a video file to locate and plot the lane lines
import pickle
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from moviepy.editor import VideoFileClip
imp... | 31,890 | 11,218 |
# -*- coding: utf-8 -*-
'''
Created on 2017. 12. 22.
@author: HyechurnJang
'''
import boto3
from datetime import datetime, timedelta
class AWS:
def __init__(self):
self.ec2 = boto3.resource('ec2')
self.cw = boto3.client('cloudwatch')
def getVMs(self):
aws ... | 3,772 | 1,056 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | 1,700 | 603 |
from typing import List
from wai.json.object import StrictJSONObject
from wai.json.object.property import ArrayProperty, OneOfProperty, BoolProperty
from .field import *
from .logical import *
from ._FilterExpression import FilterExpression
from ._OrderBy import OrderBy
class FilterSpec(StrictJSONObject['FilterSpec... | 1,201 | 314 |
# encoding: utf-8
# flake8: noqa
from sdsstools import get_package_version
NAME = "sdss-basecam"
__version__ = get_package_version(__file__, "sdss-basecam") or "dev"
from .camera import *
from .events import *
from .exceptions import *
from .exposure import *
from .notifier import *
| 290 | 103 |
from temboo.Library.Wordnik.Account.GetAuthToken import GetAuthToken, GetAuthTokenInputSet, GetAuthTokenResultSet, GetAuthTokenChoreographyExecution
from temboo.Library.Wordnik.Account.GetKeyStatus import GetKeyStatus, GetKeyStatusInputSet, GetKeyStatusResultSet, GetKeyStatusChoreographyExecution
from temboo.Library.Wo... | 571 | 161 |
from transpose import *
import alsaseq
import alsamidi
import random
# Requires https://github.com/ppaez/alsaseq package.
alsaseq.client("pyTranspose", 0, 1, True)
class IntervalsGame(Game):
"""
IntervalsGame(name=None, autosave=True, **settings) : Game
A game to practice recognizing asceending, descendi... | 9,691 | 2,859 |
import os
import sys
from collections import defaultdict
import re
import pandas as pd
import matplotlib.pyplot as plt
class InstanceResult:
"""Represents the result of one instance run"""
def __init__(self):
# General info, name of the instance, run ID, time, memory und time for reductions
se... | 9,585 | 2,895 |
#! /usr/bin/env python3
# -*- coding: utf-8; -*-
#
# vtkToolsGUI - VTK/Tk/Python interface by RoBo - modified by vidot
# - modified by MM to create a distributable exe independent of Metafor
# jan 2019:
# F:\src\VTK-7.1.0\Wrapping\Python\vtk\tk\vtkLoadPythonTkWidgets.py
# change "vtkCommonCorePython" => "vtk.vtkComm... | 100,242 | 32,525 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 17 14:03:42 2018
@author: Darin
"""
import numpy as np
from matplotlib.patches import Polygon
class Element:
"""
Functions avaiable in this class
--------------------------------
__init__ : constructor
_Get_GP : Gets the Gauss points
... | 45,013 | 16,235 |
"""Sanity test environment setup."""
import os.path
from django.conf import settings
from django.test import TestCase
class EnvTestCase(TestCase):
"""Environment test cases."""
def test_env_file_exists(self):
"""Test environment file exists."""
env_file = os.path.join(settings.DEFAULT_ENV_PA... | 372 | 110 |
import math
import random
from typing import Tuple
import cv2
import numpy as np
def np_free_form_mask(
max_vertex: int, max_length: int, max_brush_width: int, max_angle: int, height: int, width: int
) -> np.ndarray:
mask = np.zeros((height, width), np.float32)
num_vertex = random.randint(0, max_vertex)... | 1,705 | 683 |
# Copyright (c) 2019 Intel Corporation
# 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... | 2,393 | 777 |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-USB-USBHUB
GUID : 7426a56b-e2d5-4b30-bdef-b31815c1a74a
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.... | 31,503 | 16,465 |
from django.db import models
from django.db.models import Count, F, Max
from binder.models import BinderModel
class Caretaker(BinderModel):
name = models.TextField()
last_seen = models.DateTimeField(null=True, blank=True)
# We have the ssn for each caretaker. We have to make sure that nobody can access this ssn in... | 678 | 235 |
import threading
# Create threads for each SSH connection
def create_threads(list, function):
threads = []
for ip in list:
th = threading.Thread(target = function, args = (ip,))
th.start()
threads.append(th)
for th in threads:
th.join() | 292 | 85 |
import cv2
from darkflow.net.build import TFNet
import numpy as np
import glob
import matplotlib.pyplot as plt
options = {
'model': 'cfg/yolo-v2.cfg',
'load':8375,
'gpu':0.8,
'threshold':0.1
}
count = 1
tfnet = TFNet(options)
color = [0, 255, 0]
files_path = glob.glob('data_from_imd' + "\\*.jpg")
for file in files_path... | 1,129 | 394 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class WeiboVMblogsItem(scrapy.Item):
domain = scrapy.Field()
uid = scrapy.Field()
mblog_id = scrapy.Field()
mblog_content = scrapy.Field... | 1,421 | 496 |
r"""
Vibro-acoustic problem
3D acoustic domain with 2D perforated deforming interface.
*Master problem*: defined in 3D acoustic domain (``vibro_acoustic3d.py``)
*Slave subproblem*: 2D perforated interface (``vibro_acoustic3d_mid.py``)
Master 3D problem - find :math:`p` (acoustic pressure)
and :math:`g` (transversal... | 4,284 | 1,929 |