text string | size int64 | token_count int64 |
|---|---|---|
import torch
from torch import nn
from modules.commons.layers import Embedding
from modules.commons.nar_tts_modules import EnergyPredictor, PitchPredictor
from modules.tts.commons.align_ops import expand_states
from modules.tts.fs import FastSpeech
from utils.audio.cwt import cwt2f0, get_lf0_cwt
from utils.audio.pitch.... | 5,355 | 1,967 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import tensorflow as tf
import i3d, i3d_v2, r3d
FLAGS = tf.flags.FLAGS
networks_map = {'i3d_v1': i3d.I3D,
'i3d_v2': i3d_v2.I3D_V2,
'r3d_50': r3d.resnet_v1_50,
... | 1,626 | 569 |
from .utils import *
from .path_based import toolong_tooshort, opt_p
from .graph_based import holes_marbles, opt_g
from .pixel_based import corr_comp_qual
from .junction_based import opt_j | 188 | 62 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'guis/card.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class QLabelClickable(QtWidgets.QLabel):
clicked = QtCore.pyqtSignal()... | 2,882 | 986 |
from django.shortcuts import render,get_object_or_404, redirect
from .models import Category, Tag, Post
from game.models import GameCategory, Game
from comment.forms import BlogCommentForm,SubBCommentForm
from comment.models import BlogComment,SubBComment
from .forms import PostForm
def index(request):
posts = Pos... | 2,826 | 861 |
#!/usr/bin/env python
"""Cloudflare API via command line"""
from __future__ import absolute_import
import sys
from .cli4 import cli4
def main(args=None):
"""Cloudflare API via command line"""
if args is None:
args = sys.argv[1:]
cli4(args)
if __name__ == '__main__':
main()
| 302 | 105 |
class CouldntSerialize(Exception): pass | 40 | 12 |
import inspect
from collections import namedtuple
import numpy as np
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.model_selection import train_test_split
from sklearn.exceptions import NotFittedError
from uq360.algorithms.posthocuq import PostHocUQ
class MetamodelRegression(PostHocUQ):
"""... | 8,942 | 2,585 |
# Copyright 2022 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 5,641 | 1,809 |
def test_example():
num1 = 1
num2 = 3
if num2 > num1:
print("Working")
| 91 | 37 |
import logging
import subprocess
from threading import Thread
from ulauncher.api.client.Extension import Extension
from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent, \
PreferencesEvent, PreferencesUpdateEvent
from ulauncher.api.shared.action.ExtensionCustomAction import \
ExtensionCustomA... | 3,026 | 705 |
class Node:
def __init__(self,v):
self.next=None
self.prev=None
self.value=v
class Deque:
def __init__(self):
self.front=None
self.tail=None
def addFront(self, item):
node=Node(item)
if self.front is None: #case of none items
se... | 2,295 | 605 |
# pylint: disable=redefined-outer-name
# pylint: disable=too-many-lines
import itertools
import pytest
from buzzard.test.tools import assert_tiles_eq
from buzzard.test import make_tile_set
ANY = 42
PARAMS1 = {
'extend',
'overlap',
'exclude',
'exception',
'shrink',
}
PARAMS2 = {'br', 'tr', 'tl',... | 14,288 | 5,672 |
"""Combine ar* functional data in along their 4th axes.
usage: combined_func_redgreen datadir
"""
import sys
import os
from roi.pre import combine4d
from roi.io import read_nifti, write_nifti
# Process the argv
if len(sys.argv[1:]) != 1:
raise ValueError('Only one argument allowed')
datadir = sys.argv[1]
# Name ... | 946 | 353 |
'''
Copyright 2020, Amazon Web Services Inc.
This code is licensed under MIT license (see LICENSE.txt for details)
Python 3
Provides a buffer object that holds log lines in Elasticsearch _bulk
format. As each line is added, the buffer stores the control line
as well as the log line.
Employs an line_buffer to hold lo... | 3,857 | 1,080 |
import unittest
from collections import defaultdict
import numpy as np
import pandas as pd
from ife.io.io import ImageReader
class TestMomentFeatures(unittest.TestCase):
def test_moment_output_type(self) -> None:
features = ImageReader.read_from_single_file("ife/data/small_rgb.jpg")
moment = fe... | 1,529 | 489 |
"""The database models and form based on the timesheet model"""
import datetime
from django.db import models
from django.forms import ModelForm, ValidationError
# Create your models here.
class Task(models.Model):
"""Used to support Timesheet class"""
type = models.CharField(max_length=25)
class Meta:... | 4,116 | 1,342 |
'''
Created on Mar 11, 2009
@author: schimaf
'''
import gpib_instrument
class Keithley2700Multimeter(gpib_instrument.Gpib_Instrument):
'''
classdocs
'''
def __init__(self, pad, board_number = 0, name = '', sad = 0, timeout = 13, send_eoi = 1, eos_mode = 0):
'''
Constructor
'... | 972 | 345 |
"""Early stopping."""
import typing
import torch
import numpy as np
class EarlyStopping:
"""
EarlyStopping stops training if no improvement after a given patience.
:param patience: Number fo events to wait if no improvement and then
stop the training.
:param should_decrease: The way to judg... | 2,482 | 785 |
import numpy as np
from math import pi
import torch
from pykeops.torch import LazyTensor
from plyfile import PlyData, PlyElement
from helper import *
import torch.nn as nn
import torch.nn.functional as F
# from matplotlib import pyplot as plt
from pykeops.torch.cluster import grid_cluster, cluster_ranges_centroids, fr... | 33,552 | 11,513 |
import pytest
from test.conftest import *
@pytest.mark.run(after='test_create_article_for_user')
@post('/article/{}/comment', {"comment": "shit posting #1"})
def test_post_comment_to_article(result=None, url_id=['article_id']):
assert result.status_code == 200
assert result.json()['content'] == 'shit posting ... | 324 | 114 |
# =============================================================================
# MISC HELPER FUNCTIONS
# =============================================================================
def push_backslash(stuff):
""" push a backslash before a word, dumbest function ever"""
stuff_url = ""
if stuff i... | 1,426 | 414 |
from random import randint, seed
import numpy as np
from os import path, mkdir
from maze_utils import generate_grid
seed_number = 69
training_folder = "training"
testing_folder = "testing"
tot_elem_training = 100 # numero di matrici da generare
tot_elem_testing = 20 # numero di matrici da generare
max_w = 10 ... | 2,243 | 774 |
"""create tables
Revision ID: 6fb351569d30
Revises: 4f72de1ff38b
Create Date: 2019-05-06 21:59:43.998735
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6fb351569d30'
down_revision = '4f72de1ff38b'
branch_labels = None
depends_on = None
def upgrade():
# ... | 13,980 | 4,754 |
from apps.user.filters.basicinfor_filters import * | 50 | 15 |
"""Shapes and shape-fetching functions for common use across tasks."""
import numpy as np
from moog import sprite
from spriteworld import shapes
# A selection of simple shapes. Elements in SHAPES can be looked up from their
# string keys in sprite.Sprite, i.e. you can give a string key as the `shape`
# argument to sp... | 7,414 | 2,486 |
import prettytable as pt
#Load and Store are special
class BasicRs(object):
def __init__(self, Type):
self.Type = Type
self.clear()
#judge if the RS is busy
def isBusy(self):
return self.busy
def clear(self):
self.op = ""
self.reg_value = -1
self... | 5,097 | 1,692 |
import json
from collections import namedtuple
from unittest import mock
import pytest
import requests
from globus_sdk.response import GlobusHTTPResponse, IterableResponse
_TestResponse = namedtuple("_TestResponse", ("data", "r"))
def _response(data=None, encoding="utf-8", headers=None):
r = requests.Response(... | 5,215 | 1,662 |
"""Hparams"""
import argparse as ap
import tensorflow as tf
from pathlib import Path
HOME = str(Path.home())
HPARAM_CHOICES= {
"model": ["cpdb", "copy", "bdrnn", "cpdb2", "cpdb2_prot"],
"optimizer": ["adam", "sgd", "adadelta"],
"unit_type": ["lstm", "lstmblock", "nlstm", "gru"],
"train... | 9,007 | 3,059 |
from kivy.lang import Builder
from kivy.metrics import dp
from kivy import properties as p
from kivy.animation import Animation
from kivymd.app import MDApp as App
from kivymd.uix.screen import MDScreen
class HomeMainScreen(MDScreen):
bg_pos = p.NumericProperty(0)
def toggle_bg_pos(self):
bg_pos... | 660 | 241 |
from typing import Tuple
class BaseTimer:
"""
A timer controls the time passed into the the render function.
This can be used in creative ways to control the current time
such as basing it on current location in an audio file.
All methods must be implemented.
"""
@property
... | 1,792 | 505 |
from django.shortcuts import render
from django.views.generic import CreateView
from django.urls import reverse_lazy
from accounts.forms import UserCreateForm
# Create your views here.
class Signup(CreateView):
form_class = UserCreateForm
success_url = reverse_lazy('login')
template_name = "accounts/signu... | 327 | 92 |
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
for i in nums:
if i == 0:
nums.append(i)
nums.remove(i) | 260 | 78 |
# def draw_nx(g, labels=None):
# import matplotlib.pyplot as plt
# if labels is not None:
# g = nx.relabel_nodes(g, labels)
# pos = nx.kamada_kawai_layout(g)
# nx.draw(g, pos, with_labels=True)
# plt.show()
#
# def draw_nx_attributes_as_labels(g, attribute):
# # import pylab
# impo... | 3,045 | 1,188 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOverseasRemitFundInitializeModel(object):
def __init__(self):
self._bc_remit_id = None
self._compliance_mid = None
self._extend_info = None
self._quote_route... | 10,680 | 3,289 |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from .settings import TAGGED_ITEM_MODEL, TAG_MODEL
class TagCanvasListView(ListView):
template_name = 'taggit_templatetags2/tagcanvas_list.html'
model = TAGGED_ITEM_MODEL
... | 863 | 277 |
##########################
# Nicola Altini (2020)
# V-Net for Hippocampus Segmentation from MRI with PyTorch
##########################
# python run/validate_torchio.py
# python run/validate_torchio.py --dir=logs/no_augm_torchio
# python run/validate_torchio.py --dir=path/to/logs/dir --verbose=VERBOSE
################... | 4,292 | 1,313 |
#!/usr/bin/env python3
import nltk, json, os, sys, operator, argparse, copy
from nltk.tokenize import word_tokenize, sent_tokenize
from tqdm import tqdm
from nltk.corpus import stopwords
sys.path.append('../')
from utils import *
# List of stopwords to excldue from text
stop_words = set(stopwords.words('english'))
de... | 4,833 | 1,630 |
# Copyright 2016 Open Source Robotics Foundation, 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... | 2,614 | 899 |
import atexit
import contextlib
import time
from typing import Any, List, Type
from unittest import mock
import pytest
import region_profiler.global_instance
import region_profiler.profiler
from region_profiler import RegionProfiler, func
from region_profiler import install as install_profiler
from region_profiler imp... | 6,840 | 2,571 |
#!/usr/bin/env python
import datetime
import logging
import time
from threading import Thread
import requests
from requests.auth import HTTPBasicAuth
import settings
def update_notiwire(data=None, relative_url=''):
URL = settings.API_URL + settings.NAME + '/'
if not data:
data = {}
data['api_key... | 4,326 | 1,234 |
class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
m, n = len(matrix), len(matrix[0])
col_zero = any(matrix[i][0] == 0 for i in range(m))
row_zero = an... | 858 | 284 |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
urlpatterns=[
url('^$',views.index,name = 'index'),
url(r'^profile/(\d+)',views.profile,name = "profile"),
url(r'^create/post',views.new_post, name = "new-post"),
url(r'^foll... | 708 | 254 |
from chart.models import *
from chart.controllers import ai, get_data
import key
from pathlib import Path
import os
from django_pandas.io import read_frame
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
import logging
logger = logging.getLogger(__name__)... | 15,779 | 5,245 |
import tensorflow as tf
import numpy as np
import math
"""
Exercise 1.1: Diagonal Gaussian Likelihood
Write a function which takes in Tensorflow symbols for the means and
log stds of a batch of diagonal Gaussian distributions, along with a
Tensorflow placeholder for (previously-generated) samples from those
distri... | 2,071 | 687 |
from pyrouge.base import Doc, Sent
from pyrouge.rouge import Rouge155 | 69 | 27 |
from unittest.mock import MagicMock
from unittest.mock import patch
import aiofiles
from aiofiles import threadpool
async def test_unit_get_current_version_both_files_dont_exist(mock_hub, hub, tmp_path):
"""
SCENARIO #1
- override_version_file DOES NOT EXIST
- main_version_file DOES NOT EXIST
"""... | 6,982 | 2,039 |
import setuptools
setuptools.setup(
name="fakeokpy",
version='0.1',
url="https://github.com/yuvipanda/fakeokpy",
author="Yuvi Panda",
author_email="yuvipanda@gmail.com",
license="BSD-3-Clause",
packages=setuptools.find_packages(),
)
| 262 | 102 |
# coding: utf-8
# $ \newcommand{\cat}[2][\phantom{i}]{\ket{C^{#2}_{#1\alpha}}} $
# $ \newcommand{\ket}[1]{|#1\rangle} $
# $ \newcommand{\bra}[1]{\langle#1|} $
# $ \newcommand{\braket}[2]{\langle#1|#2\rangle} $
# $\newcommand{\au}{\hat{a}^\dagger}$
# $\newcommand{\ad}{\hat{a}}$
# $\newcommand{\bu}{\hat{b}^\dagger}$
# ... | 3,889 | 1,531 |
# Written by Sherif Abdelkarim on Jan 2020
import numpy as np
import pandas as pd
import json
import os.path as osp
# import seaborn as sns # not critical.
import matplotlib.pylab as plt
# In[9]:
import os
import re
def files_in_subdirs(top_dir, search_pattern): # TODO: organize project as proper
join = os.p... | 18,253 | 6,850 |
def coding_problem_41(flights_db, starting_airport):
"""
Given an unordered list of flights taken by someone, each represented as (origin, destination) pairs, and a
starting airport, compute the person's itinerary. If no such itinerary exists, return null. If there are multiple
possible itineraries, ret... | 965 | 348 |
import itertools
import pytest
from iterators.invalid_iter import InvalidIter
def _grouper_to_keys(grouper):
return [g[0] for g in grouper]
def _grouper_to_groups(grouper):
return [list(g[1]) for g in grouper]
@pytest.mark.parametrize("keyfunc, data, expected_keys", [
(lambda x: x, [], []),
(lambd... | 2,763 | 1,195 |
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle 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
#
... | 7,733 | 2,303 |
import serialio
class Serial(object):
def __init__(self, port, baudrate, timeout):
self.port = port
self.baudrate = baudrate
self.timeout = timeout
self._openPort()
def _openPort(self):
self.hComm = serialio.Serial(self.port, self.baudrate) # Opening the port
def read(self):
data = seria... | 528 | 234 |
import random
from pandac.PandaModules import Point3
from direct.gui.DirectGui import DirectFrame, DirectLabel
from direct.fsm import FSM
from direct.interval.IntervalGlobal import *
from pirates.audio import SoundGlobals
from pirates.audio.SoundGlobals import loadSfx
import RepairGlobals
MIN_SCALE = 1.5
MAX_SCALE_ADD ... | 5,054 | 1,809 |
import numpy as np
def euclidean_norm(vectorList, listP, listQ):
"""Calculates the euclidean norm (distance) of two array-like objects, in this case vectors
Args:
listP (integer list): List of indices of the reference vector of the\
array.
list_comp (integer list): list of indi... | 738 | 222 |
import os
import time
import joblib
import numpy as np
import os.path as osp
import tensorflow as tf
from baselines import logger
from collections import deque
from baselines.common import explained_variance
import pickle
class Model(object):
def __init__(self, policy, ob_space, ac_space, nbatch_act, nbatch_trai... | 15,067 | 5,317 |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\visualization\spawner_visualizer.py
# Compiled at: 2020-08-11 18:25:53
# Size of source mod 2**32: 2... | 2,045 | 683 |
'''
A package to manipulate and display some random structures,
including meander systems, planar triangulations, and ribbon tilings
Created on May 8, 2021
@author: vladislavkargin
'''
'''
#I prefer blank __init__.py
from . import mndrpy
from . import pmaps
from . import ribbons
''' | 288 | 93 |
#!/usr/bin/python3
'''Day 9 of the 2017 advent of code'''
def process_garbage(stream, index):
"""Traverse stream. Break on '>' as end of garbage,
return total as size of garbage and the new index
"""
total = 0
length = len(stream)
while index < length:
if stream[index] =... | 2,007 | 667 |
DRB1_1227_9 = {0: {'A': -999.0, 'E': -999.0, 'D': -999.0, 'G': -999.0, 'F': -0.99657, 'I': -0.003434, 'H': -999.0, 'K': -999.0, 'M': -0.003434, 'L': -0.003434, 'N': -999.0, 'Q': -999.0, 'P': -999.0, 'S': -999.0, 'R': -999.0, 'T': -999.0, 'W': -0.99657, 'V': -0.003434, 'Y': -0.99657}, 1: {'A': 0.0, 'E': 0.1, 'D': -1.3, ... | 2,168 | 1,734 |
import lfa
def convert_radec(radec, partial=False):
# Convert RA, DEC. Try : first and then space.
ra, rva = lfa.base60_to_10(radec, ':', lfa.UNIT_HR, lfa.UNIT_RAD)
if rva < 0:
ra, rva = lfa.base60_to_10(radec, ' ', lfa.UNIT_HR, lfa.UNIT_RAD)
if rva < 0:
raise RuntimeError("could not understand ra... | 744 | 336 |
import numpy as np
class NumpyDynamic:
def __init__(self, dtype, array_size=(100,)):
self.data = np.zeros(array_size, dtype)
self.array_size = list(array_size)
self.size = 0
def add(self, x):
if self.size == self.array_size[0]:
self.array_size[0] *= 2
... | 567 | 196 |
from rest_framework import serializers
from api.models import RouteModel
class RouteDistanceSerializer(serializers.ModelSerializer):
km = serializers.FloatField(source='distance', read_only=True)
class Meta:
model = RouteModel
fields = ('route_id', 'km')
| 282 | 75 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
from common import *
from pycsp import *
from pycsp.plugNplay import *
from pycsp.net import *
@process
def test1():
print("Test1")
waitForSignal()
c = getNamedChannel("foo1")
print("- Trying to write to channel")
print("-", c.write("I'm here"))
p... | 1,369 | 464 |
from discord.errors import HTTPException
from discord.ext import commands
from os import getenv
from discord import Embed
from dotenv import load_dotenv
from requests.models import HTTPError
from riotwatcher import LolWatcher
from json import load
load_dotenv(dotenv_path="config")
prefix = getenv("PREFIX")
class list... | 3,653 | 1,129 |
import struct
import select
import socket
import sys
import binascii
import getopt
import time
import quantities as pq
from collections import deque
import numpy as np
import datetime
import typer
from typing import Optional
from pprint import pprint
from olfactometer.smell_engine import SmellEngine
from olfactometer... | 10,988 | 3,088 |
import numpy as np
from abc import ABCMeta, abstractmethod
class Node(object):
"""Represents state in MCTS search tree.
Args:
state (object): The environment state corresponding to this node in the search tree.
Note:
Node object is immutable. Node is left without exit edges (empty dict)... | 4,051 | 1,118 |
import os
import random
from sklearn.metrics import mean_squared_error as mse
from core.composer.chain import Chain
from core.composer.composer import ComposerRequirements, DummyChainTypeEnum, DummyComposer
from core.models.data import OutputData
from core.models.model import *
from core.repository.dataset_t... | 3,892 | 1,116 |
import os
import re
import shutil
def svnLockFiles(files):
fileStr = ' '.join(files)
print('Locking files: ', fileStr)
os.system('svn lock ' + fileStr)
def svnUnlockFiles(files):
fileStr = ' '.join(files)
print('Unlocking files: ', fileStr)
os.system('svn unlock ' + fileStr)
... | 1,596 | 531 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
python3.5开始,PEP484为python引入了类型注解(type hints)
typing模块:
1. 类型检查,防止运行时出现参数和返回值类型不符合。
2. 作为开发文档附加说明,方便使用者调用时传入和返回参数类型。
3. 该模块加入后并不会影响程序的运行,不会报正式的错误,只有提醒pycharm目前支持typing检查,参数类型错误会黄色提示。
基本类型:
int,long,float:整型,长整形,浮点型;
bool,str:布尔型,字符串类型;
List,... | 995 | 612 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import h5py
import sys
import time
import seaborn as sns
import pandas as pd
import cupy as cp
from tomo_encoders import Patches
from tomo_encoders.misc import viewer
from tomo_encoders import DataF... | 3,941 | 1,690 |
import numpy as np
import time
import pytest
import jax.numpy as jnp
import jax.config as config
import torch
import tensorflow as tf
from tensornetwork.linalg import linalg
from tensornetwork import backends
from tensornetwork.backends.numpy import numpy_backend
from tensornetwork.backends.jax import jax_backend
#pyli... | 5,352 | 2,021 |
"""Pygments entities for highlighting and tokenizing Ansible things."""
| 72 | 18 |
name = input('Please enter your name:\n')
age = int(input("Please enter your age:\n"))
color = input('Enter your favorite color:\n')
animal = input('Enter your favorite animal:\n')
print('Hello my name is' , name , '.')
print('I am' , age , 'years old.')
print('My favorite color is' , color ,'.')
print('My favorite... | 352 | 111 |
#!/usr/bin/env python3
"""
:mod: `authenticator.py` -- Common authentication helpers
================================================================================
module:: authenticator
:platform: Unix, Windows
:synopsis: This module contains classes and helper functions that are common for
authen... | 2,083 | 578 |
"""main.py file representingcomparison statistics for Pyrunc module"""
# Python module(s)
from timeit import timeit
# Project module(s)
from Pyrunc import Pyrunc
def main():
"""Main Method"""
pr_c = Pyrunc()
# --------------------------------------------------------------------------------
# ----... | 2,696 | 964 |
import unittest
from easysparql import easysparqlclass, cacher
import logging
ENDPOINT = "https://dbpedia.org/sparql"
albert_uri = "http://dbpedia.org/resource/Albert_Einstein"
albert_name = "Albert Einstein"
scientist = "http://dbpedia.org/ontology/Scientist"
foaf_name = "http://xmlns.com/foaf/0.1/name"
logger = log... | 2,918 | 1,082 |
import sys
import numpy as np
import scipy.misc
import scipy.ndimage as nd
import os.path
import scipy.io as sio
saliency_path = '/media/VOC/saliency/raw_maps/' # the path of the raw class-specific saliency maps, created by create_saliency_raw.py
save_path = '/media/VOC/saliency/thresholded_saliency_images/' # the... | 1,728 | 616 |
from django.urls import reverse_lazy, reverse
from django.views.generic import TemplateView
from exporter.applications.services import post_applications, post_open_general_licences_applications
from exporter.apply_for_a_licence.forms.open_general_licences import (
open_general_licence_forms,
open_general_licen... | 4,610 | 1,425 |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/vis-02-curtailment.ipynb (unless otherwise specified).
__all__ = ['get_wf_ids', 'flatten_list', 'get_curtailed_wfs_df', 'load_curtailed_wfs',
'add_next_week_of_data_to_curtailed_wfs']
# Cell
flatten_list = lambda list_: [item for sublist in list_ for item in ... | 2,532 | 1,006 |
import logging
import numpy as np
import time
import warnings
from qcodes.instrument.base import Instrument
from qcodes.utils import validators as vals
from pycqed.measurement import detector_functions as det
from qcodes.instrument.parameter import ManualParameter
from pycqed.utilities.general import gen_sweep_pts
fr... | 91,809 | 25,878 |
#!/usr/bin/env python3
import numpy as np
import pandas as pd
import librosa
import os
import sys
import time
from datetime import datetime
from pathlib import Path
from src.python.audio_transforms import *
from src.python.model_predict import *
from src.python.graphics import plot_graph
# Hardcoding a few variable... | 3,384 | 1,148 |
from pprint import pformat
from TwitterBot import TwitterBot
from utils import *
from BinanceBot import BinanceBot
from time import *
import logging
class AutoTrader(TwitterBot, BinanceBot):
"""[summary]
:param TwitterBot: [description]
:type TwitterBot: [type]
:param BinanceBot: [description]
:t... | 4,581 | 1,255 |
import socket
import struct
import json
import time
import os
import platform
from optparse import OptionParser
import sys
import xml.etree.ElementTree as ET
import config
from device_config import BASE_CONST
MCAST_GRP = '239.255.254.253'
MCAST_PORT = 8427
DEFAULT_DCID_XML = '/Applications/Shure Update Utility.ap... | 5,208 | 1,785 |
import fastai
from neptune.new.integrations.fastai import NeptuneCallback
from fastai.vision.all import *
import neptune.new as neptune
run = neptune.init(
project="common/fastai-integration", api_token="ANONYMOUS", tags="basic"
)
path = untar_data(URLs.MNIST_TINY)
dls = ImageDataLoaders.from_csv(path)
# Log all... | 506 | 192 |
import unittest
import numpy as np
from xcube.webapi.controllers.time_series import get_time_series_info, get_time_series_for_point, \
get_time_series_for_geometry, get_time_series_for_geometry_collection
from ..helpers import new_test_service_context
class TimeSeriesControllerTest(unittest.TestCase):
def ... | 14,079 | 4,298 |
# setup.py - distutils packaging
#
# Copyright (C) 2003-2010 Federico Di Gregorio <fog@debian.org>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at... | 17,011 | 5,123 |
from django.shortcuts import render,redirect
from django.views.generic import View
from django.contrib.auth.models import User
from .forms import LoginUser,RegisterUser
from django.http import HttpResponse,Http404
from django.contrib.auth import authenticate,login,logout
class UserLogin(View):
form_class = LoginUs... | 1,864 | 505 |
from math import sqrt
from math import atan2
from math import asin
beta = 0.1
sampleFreq = 10.0
#Fastest implementation in python for invsqrt
def invsqrt(number):
return number ** -0.5
def update_IMU( gx, gy, gz, ax, ay, az, q0, q1, q2, q3):
gx = gx * 0.0174533
gy = gy * 0.0174533
gz = gz * 0.017453... | 6,266 | 3,816 |
import setuptools
if __name__ == '__main__':
setuptools.setup(
name='Name',
version='0.1',
# this automatically detects the packages in the specified
# (or current directory if no directory is given).
packages=setuptools.find_packages(exclude=['tests', 'docs']),
# ... | 3,991 | 970 |
import os
from django.core.files.base import ContentFile
from django.template.loader import render_to_string
from django.utils.encoding import smart_unicode
from compressor.cache import get_hexdigest, get_mtime
from compressor.conf import settings
from compressor.exceptions import CompressorError, UncompressableFileE... | 8,312 | 2,265 |
"""Test generating SQL conditions."""
import pytest
from binder.util import build_conditions
from .logging_setup import setup_logger
setup_logger()
def test_condition():
"""Test condition generation."""
assert (
build_conditions(
**{
"a": 5,
}
)
... | 1,324 | 425 |
# Copyright 2019 Google LLC. 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... | 11,697 | 3,806 |
import torch
class Vocab:
def __init__(self, alphabet) -> None:
self.stoi = {}
self.itos = {}
for i, alphabet in enumerate(alphabet):
self.stoi[alphabet] = i
self.itos[i] = alphabet
class TokenizerWrapper:
def __init__(self, vocab, dummy_process):
self.v... | 2,199 | 754 |
from enum import Enum
from typing import List, Union
from didcomm.common.types import VerificationMethodType, VerificationMaterialFormat
from didcomm.core.serialization import json_str_to_dict
from didcomm.did_doc.did_doc import VerificationMethod
from didcomm.errors import DIDCommValueError
from didcomm.secrets.secre... | 5,388 | 1,997 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'DialogCalibrate.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogCalibrate(object):
def setupUi(self, DialogCalibrate):... | 4,886 | 1,847 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAppQrcodeCreateResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAppQrcodeCreateResponse, self).__init__()
self._qr_code_url = None
self... | 1,544 | 552 |
#Análisis de Algoritmos 3CV2
# Alan Romero Lucero
# Josué David Hernández Ramírez
# Práctica 3 Divide y vencerás
# Este es el algoritmo usado en merge, ya que los datos que devuelve no son los mismos usados en merge sort
# Esto lo hice para fines prácticos y ahorro de tiempo
import globalvariables as gb
def onlymerge... | 1,112 | 399 |
"""
# Interaction Tracker
# @license http://www.apache.org/licenses/LICENSE-2.0
# Author @ Jamil Hussain, Zaki
"""
from analytics.models import (Log, ActionLog)
from rest_framework import serializers
class LogSerializer(serializers.ModelSerializer):
class Meta:
model = Log
fields = ('app','ap... | 1,068 | 318 |