text string | size int64 | token_count int64 |
|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | 2,174 | 690 |
"""
This script adds tables needed for Galaxy cloud functionality.
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
now = datetime.datetime.utcnow
log = logging.getLogger( __name__ )
metadata = MetaDa... | 8,396 | 2,034 |
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2021 ronyman.com
"""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from apps.user import views as user_views
from.views im... | 1,524 | 487 |
# Generated by Django 2.0.3 on 2018-09-14 12:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0002_project'),
]
operations = [
migrations.RenameField(
model_name='project',
old_name='file_path',
... | 533 | 172 |
#! /usr/bin/env python
import cv2
import matplotlib.pyplot as plt
import skimage
import skimage.io
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.pyplot import cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy import ... | 30,844 | 11,044 |
import pygame.font
import copy
class Text:
"""Draws a text to the screen."""
def __init__(self, rect, size, color, screen, text):
self.screen = screen
self.rect = copy.deepcopy(rect)
self.text = text
self.color = color
self.font = pygame.font.SysFont(None, size)
... | 825 | 253 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 5,702 | 1,856 |
# coding: utf-8
#
# a Geometry class contains the list of patches and additional information about
# the topology i.e. connectivity, boundaries
# For the moment, it is used as a container, that can be loaded from a file
# (hdf5)
from itertools import product
from collections import abc
import numpy as np
import string
... | 21,307 | 6,695 |
__author__ = 'Jiri Fajtl'
__email__ = 'ok1zjf@gmail.com'
__version__= '2.2'
__status__ = "Research"
__date__ = "28/1/2018"
__license__= "MIT License"
import os
import numpy as np
import glob
import subprocess
import platform
import sys
import pkg_resources
import torch
import PIL as Image
try:
import cv2
except:... | 6,098 | 2,016 |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
import flatbuffers
class Slice(object):
__slots__ = ["_tab"]
# Slice
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# Slice
def Start(self):
return self._... | 1,823 | 619 |
import axelrod as axl
from .test_player import TestPlayer
C, D = axl.Action.C, axl.Action.D
class TestMyStrategy(TestPlayer):
name = "MyStrategy"
player = axl.mystrategy
expected_classifier = {
"memory_depth": 1,
"stochastic": False,
"long_run_time": False,
"inspects_sour... | 1,075 | 367 |
#FILE NAME: BannerTool.py
#created by: Ciro Veneruso
#purpose: banner localization
#last edited by: Ciro Veneruso
#INSTALL: BeautifulSoup
#TODO: this code is a blob, must be refactorized!!!!
import re
import mechanize
import socket
import urllib
from tools import BaseTool
from bs4 import BeautifulSoup
from pprint i... | 4,516 | 1,978 |
from .ise import ISE
from .vivado import Vivado
| 49 | 18 |
# Copyright 2020 EraO Prosopagnosia Helper Dev Team, Liren Pan, Yixiao Hong, Hongzheng Xu, Stephen Huang, Tiancong Wang
#
# Supervised by Prof. Steve Mann (http://www.eecg.toronto.edu/~mann/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with th... | 12,725 | 3,529 |
import math
from point2d import Point2D
def to_point(rads, dist):
x = math.cos(rads) * dist
y = math.sin(rads) * dist
return Point2D(x, y)
class Slice(object):
def __init__(self, begin, end):
self.__begin = begin
self.__end = end
self.__begin_rad = math.radians(self.__begin... | 1,403 | 449 |
import concurrent
import os
import re
import shutil
import xml.etree.ElementTree as ET # TODO do we have this as requirement?
from concurrent.futures import as_completed
from concurrent.futures._base import as_completed
from pathlib import Path
import ffmpeg
import pandas as pd
import webrtcvad
from audio_korpora_pi... | 37,056 | 10,988 |
import matplotlib.pyplot as plt
import math
import shutil
import torch
from accelerate import Accelerator
from tensorboardX import SummaryWriter
from cli import parse_args
from dataset import SvbrdfDataset
from losses import MixedLoss, MixedLoss2, MixedLoss3
from models import MultiViewModel, SingleViewModel
from pathl... | 14,085 | 5,224 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from .engines import do_train, do_inference
from .lstr.lstr_trainer import *
from .lstr.lstr_inference import *
| 220 | 79 |
# Copyright 2017 NOKIA
# All Rights Reserved.
from netaddr import IPNetwork
import testtools
from tempest.common import waiters
from tempest.lib import exceptions
from tempest.scenario import manager
from tempest.test import decorators
from nuage_tempest_plugin.lib.test.nuage_test import NuageAdminNetworksTest
from ... | 64,469 | 20,188 |
''' Advent of code 2019 Day 11 - Space police '''
from typing import NamedTuple
from enum import Enum
INPUT_FILE=__file__.replace('.py', '.dat')
def to_number(digits: list) -> int:
return int(''.join(map(str, digits)))
def to_list(number: int) -> list:
return [int(i) for i in str(number)]
... | 8,924 | 2,965 |
description = 'Mezei spin flipper using TTI power supply'
group = 'optional'
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(
dct1 = device('nicos.devices.entangle.PowerSupply',
description = 'current in first channel of supply (flipper current)',
tangodevice = tango_base + 't... | 814 | 285 |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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... | 16,817 | 5,535 |
import re
from wikipedia_parser.infobox import clean_text as clean_help
from wikipedia_parser.infobox import wikitext_helpers as wtext_help
from wikipedia_parser.third_party_adapters import parserfromhell_adapter as adapter
__author__ = 'oswaldjones'
def get_simple_text(wtext, key, clean=True):
text = None
... | 2,157 | 667 |
from .GraphQLClient import GraphQLClient
from Jumpscale import j
JSConfigs = j.baseclasses.object_config_collection
class GraphQLFactory(JSConfigs):
__jslocation__ = "j.clients.graphql"
_CHILDCLASS = GraphQLClient
| 227 | 77 |
from os import getenv as e
from kombu import Queue
CELERY_APP_NAME = 'video_transcoding'
VIDEO_TRANSCODING_CELERY_CONF = {
'broker_url': e('VIDEO_TRANSCODING_CELERY_BROKER_URL',
'amqp://guest:guest@rabbitmq:5672/'),
'result_backend': e('VIDEO_TRANSCODING_CELERY_RESULT_BACKEND', None),
... | 1,339 | 543 |
from collections import defaultdict
from nltk.tokenize import sent_tokenize
from nltk.corpus import wordnet as wn
from nltk.corpus import semcor as sc
from nltk.corpus import stopwords
import mywordtokenizer
class SenseContextWordDict:
def __init__(self):
self.dictionary = self._create_dictionary()
d... | 5,104 | 1,405 |
import decimal
from unittest import mock
from django.conf import settings
from django.test import modify_settings
from rest_framework import test
from rest_framework.reverse import reverse
import stripe
from restshop import serializers
from restshop.models import Order
from paymentmethods.stripejs.models import Strip... | 3,138 | 944 |
from tnnt.settings import UNIQUE_DEATH_REJECTIONS, UNIQUE_DEATH_NORMALIZATIONS
import re
def normalize(death):
# Given a death string, apply normalizations from settings.
for regtuple in UNIQUE_DEATH_NORMALIZATIONS:
death = re.sub(regtuple[0], regtuple[1], death)
return death
def reject(death):
... | 1,684 | 512 |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | 9,887 | 3,078 |
# comments------------------
def a(x):
print x
if True:
a(10) | 83 | 31 |
"""
Hull objects of localization data.
Submodules:
-----------
.. autosummary::
:toctree: ./
hull
alpha_shape
"""
from locan.data.hulls.alpha_shape import *
from locan.data.hulls.hull import *
__all__ = []
__all__.extend(hull.__all__)
__all__.extend(alpha_shape.__all__)
| 286 | 114 |
import pytest
from daisy.workflow import build_combinations
def test_one_option():
assert build_combinations(
{"option1": ["value1", "value2"]}) == \
[{'option1': 'value1'},
{'option1': 'value2'}]
def test_two_options():
assert build_combinations(
{'option1': ["value1", "val... | 9,183 | 3,444 |
# class Encoder:
# pass
# class Decoder:
# pass
# class VariationAutoEncoder:
# pass
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import pickle
import logging
from glob import glob
import numpy as np
from time import time
from datetime import datetime
from PIL import Image
import matplotlib.pyplot ... | 8,473 | 3,039 |
import time
from config import get_password, get_username
from playwright.sync_api import Page
def login(page: Page, url: str, landing_url: str):
raise RuntimeError("default login not supported")
def login_kenan_flagler(page: Page, url: str, landing_url: str) -> None:
page.goto(url)
page.wait_for_load_... | 1,351 | 444 |
import asyncio
import json
import os
import pty
import shutil
import sys
import tty
import termios
import time
import threading
import tornado.iostream
from tornado.ioloop import IOLoop
from tornado.websocket import websocket_connect
ioloop = tornado.ioloop.IOLoop.instance()
SSH_LOGIN = "root"
SSH_PASSWORD = "algor... | 5,233 | 1,712 |
import abc
import logging
from typing import Any, Dict, List, Optional
from homeassistant.components.water_heater import WaterHeaterEntity
from homeassistant.const import (
TEMP_FAHRENHEIT,
TEMP_CELSIUS
)
from gehomesdk import ErdCode, ErdMeasurementUnits
from ...const import DOMAIN
from .ge_erd_entity import ... | 1,265 | 400 |
import json
from scrapy.item import BaseItem
from scrapy.http import Request
from scrapy.exceptions import ContractFail
from scrapy.contracts import Contract
# contracts
class UrlContract(Contract):
""" Contract to set the url of the request (mandatory)
@url http://scrapy.org
"""
name = 'url'
... | 2,790 | 838 |
from keras import backend as K
import tensorflow as tf
import numpy as np
def custom_dice_coefficient(y_true, y_pred, recall_weight=0.3):
recall_weight = tf.Variable(recall_weight, dtype=tf.float32)
regular_dice = dice_coefficient(y_true, y_pred)
recall = lession_recall(y_true, y_pred)
recall = tf.cas... | 3,258 | 1,360 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exceptions import DropItem
from hashlib import md5
from scrapy import log
from twisted.enterprise import adbapi
fro... | 2,193 | 680 |
import click
import pickle
import numpy as np
from collections import defaultdict
from utils import reset_seeds, get_dataset, load_embeddings
from mlp_multilabel_wrapper import PowersetKerasWrapper, MultiOutputKerasWrapper
from mlp_utils import CrossLabelDependencyLoss
def get_random_sample(dataset_name='bbc', train_... | 2,726 | 953 |
#!/usr/bin/env python
# encoding: utf-8
"""
evaluate.py
Created by Shuailong on 2016-12-2.
Evaluate model accuracy on test set.
"""
from __future__ import print_function
from time import time
from keras.models import load_model
import os
from utils import true_accuracy
from dataset import get_data
from train imp... | 1,268 | 429 |
#!/usr/bin/env python
# Copyright (c) 2013, Digium, Inc.
# Copyright (c) 2014-2016, Yelp, Inc.
import os
from setuptools import setup
import bravado
setup(
name="bravado",
# cloudlock version, no twisted dependency
version=bravado.version + "cl",
license="BSD 3-Clause License",
description="Lib... | 1,283 | 425 |
# Copyright 2013 - Red Hat, 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 writ... | 4,691 | 1,328 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2018-08-02 07:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0002_enable_compression'),
]
operations... | 562 | 199 |
from agility.usc.enumeration import uscSerialMode, ChannelMode, HomeMode
from agility.usc.reader import BytecodeReader
class UscSettings:
def __init__(self):
self.servosAvailable = 6
self.servoPeriod = 156
self.miniMaestroServoPeriod = 80000
self.servoMultiplier = 1
self.se... | 1,379 | 447 |
from .dbApiInterface import DbApiTableInterface
from .dbApiTableInterface import DbApiTableInterface
from .cacheInterface import CacheInterface
from .loggerInterface import LoggerInterface
from .envReaderInterface import EnvReaderInterface
from .driverInterface import DriverInterface
from .jobsInterface import JobsInte... | 476 | 100 |
import sys
import csv
import os
sys.path.append('../../')
import h_lib
import h_lib_noSeqSearch
in_strFastaFilename = '{!s}/data/protein/18mix/18mix_db_plus_contaminants_20081209.fasta'.format(os.environ.get('HOME'))
in_strPeptideFilename = '{!s}/data/protein/18mix/18_mixtures_peptide_identification.txt'.format(os.en... | 1,123 | 460 |
# for normalization we need to have the maxima of x and y values with the help of which
# we can normalise the given values
import csv
filename = "values.csv"
fields = []
rows = []
with open(filename,'r') as csvfile:
reader = csv.reader(csvfile)
fields = next(reader)
for row in reader:
... | 700 | 249 |
from pygdp import _execute_request
from pygdp import _get_geotype
from owslib.util import log
def submitFeatureWeightedGridStatistics(geoType, dataSetURI, varID, startTime, endTime, attribute, value, gmlIDs,
verbose, coverage, delim, stat, grpby, timeStep, summAttr, weighted, WF... | 3,477 | 1,133 |
import sys
import socket
conn = socket.create_connection(('0.0.0.0', 8080))
msgs = [
# 0 Keep-Alive, Transfer-Encoding chunked
'GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n',
# 1,2,3 Close, EOF "encoding"
'GET / HTTP/1.1\r\n\r\n',
'GET / HTTP/1.1\r\nConnection: close\r\n\r\n',
'GET / HTTP/... | 1,180 | 592 |
# -*- coding: utf-8 -*-
from odoo import models
class PlannerInventory(models.Model):
_inherit = 'web.planner'
def _get_planner_application(self):
planner = super(PlannerInventory, self)._get_planner_application()
planner.append(['planner_inventory', 'Inventory Planner'])
return plan... | 324 | 107 |
#WIZARD BOT IS LIVE
import calendar
import discord as dc
from discord.ext.commands import Bot
from discord.ext import commands
from functools import partial
import asyncio as aio
import time
from random import randint
from datetime import datetime
from discord.ext import commands
from guildconfig import GuildConfig
f... | 45,861 | 13,598 |
class Stack:
def __init__(self):
self.stack = []
self.minMaxStack = []
# O(1) time | O(1) space
def peek(self):
if (len(self.stack)):
return self.stack[-1]
return None
# O(1) time | O(1) space
def pop(self):
if (len(self.stack)):
sel... | 1,167 | 385 |
"""
Django settings for TusPachangas project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import django
import dj_database_url
# Build paths inside the project li... | 2,775 | 1,082 |
# Copyright 2017 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... | 1,169 | 343 |
import time
import pyautogui
import win32gui
def get_screen_rect(caption='CheesyBullets'):
hwnd = win32gui.FindWindow(None, caption)
rect = win32gui.GetWindowRect(hwnd)
screen_rect = (rect[0], rect[1], rect[2] - rect[0], rect[3] - rect[1])
return rect
class Timer():
def __init__(self):
sel... | 1,150 | 363 |
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
import re
import graph_refine.syntax as syntax
import graph_refine.problem as problem
import graph_refine.stack_logic as stack_logic
from graph_refine.syntax import true_term, false_term, mk_not
from graph_refine.check i... | 19,876 | 7,183 |
# Copyright (c) 2010-2017 Samuel Abels
#
# 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,301 | 731 |
BIG_CONSTANT = "YES"
def group_by(xs, grouper):
groups = {}
for x in xs:
group = grouper(x)
if group not in groups:
groups[group] = []
groups[group].append(x)
return groups
print(group_by([1, 2, 3, 4, 5, 6], lambda x: "even" if x % 2 == 0 else "odd"))
| 308 | 126 |
# Copyright 2019 StreamSets 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 writi... | 3,721 | 1,244 |
import os
# Use this as a package level setup
def load_tests(loader, standard_tests, pattern):
if os.environ.get('TERRA_UNITTEST', None) != "1":
print('WARNING: Running terra tests without setting TERRA_UNITTEST will '
'result in side effects such as extraneouse log files being '
'generated'... | 950 | 285 |
# -*- coding: utf-8 -*-
from gi.repository.GdkPixbuf import Pixbuf
from os import makedirs
def main():
for size in (16, 22, 24, 32, 48, 64, 128, 256, 512):
icon = Pixbuf.new_from_file_at_scale("formiko.svg", size, size, True)
makedirs("%dx%d" % (size, size))
icon.savev("%dx%d/formiko.png"... | 392 | 177 |
# Generated by Django 3.2.8 on 2021-11-21 12:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("currencies", "0002_initial"),
]
operations = [
migrations.AddField(
model_name="payment",
name="completed",
... | 545 | 167 |
from typing import Optional
import pandas as pd
from ruptures import Binseg
from ruptures.base import BaseCost
from sklearn.linear_model import LinearRegression
from etna.transforms.base import PerSegmentWrapper
from etna.transforms.decomposition.change_points_trend import BaseEstimator
from etna.transforms.decomposi... | 5,778 | 1,612 |
import xarray as xr
import pytest
import warnings
import argopy
from argopy import IndexFetcher as ArgoIndexFetcher
from argopy.errors import InvalidFetcherAccessPoint, InvalidFetcher, ErddapServerError, DataNotFound
from . import (
AVAILABLE_INDEX_SOURCES,
requires_fetcher_index,
requires_connected_erddap... | 4,027 | 1,368 |
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_HOST, CONF_NAME
from .acthor import test_connection
from .const import DEVICE_NAME, DOMAIN
class ACThorConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(self, user_input: dict = None) ... | 968 | 271 |
NOTES = {
'notes': [
{'date': '2014-05-22T00:00:00Z', 'note': 'Second Note'},
{'date': '2014-05-21T14:02:45Z', 'note': 'First Note'}
]
}
SUBJECT = {
"subject": ['HB1-3840', 'H']
}
OWNER = {
"owner": "Owner"
}
EDITORIAL = {
"editor_group": "editorgroup",
"editor": "associate"
}... | 356 | 175 |
""" docnado.py
A rapid documentation tool that will blow you away.
"""
import os
import re
import sys
import csv
import glob
import time
import signal
import shutil
import urllib
import base64
import hashlib
import argparse
import tempfile
import datetime
import threading
import traceback
import subprocess
import pl... | 46,397 | 13,944 |
def fatorial(n):
f = 1
while n != 0:
f *= n
n -= 1
return f
def dobro(n):
n *= 2
return n
def triplo(n):
n *= 3
return n
| 171 | 77 |
from decimal import Decimal as D
from django.core import exceptions
from django.test import TestCase
from oscar.test import factories
from oscar.test.basket import add_product, add_products
from django_redis import get_redis_connection
from oscarbluelight.offer.models import (
Range,
Benefit,
BluelightCount... | 15,155 | 5,151 |
# Moving around directories with pushd & popd
# You can save directries to go back to later. These can be built up in a stack.
#pushd i/like/icecream
# current stack: ~temp/i/like/icecream
#pushd i/like
# current stack: ~temp/i/like ~temp/i/like/icecream
#popd
# PS ~temp/i/like
#popd
# PS ~temp/i/like/icecre... | 435 | 154 |
# -*- coding: utf-8 -*-
import json
from nose.tools import eq_, ok_
from rest_framework.exceptions import ParseError
from django.contrib.auth.models import AnonymousUser
from django.test.client import RequestFactory
from django.test.utils import override_settings
import mkt
from mkt.constants.applications import DEV... | 15,577 | 4,905 |
# MIT License
#
# Copyright (c) 2019 Johan Brichau
#
# 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, mer... | 3,206 | 1,099 |
# Generated by Django 3.1.6 on 2021-02-12 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessments', '0002_auto_20210212_1904'),
]
operations = [
migrations.AlterField(
model_name='country',
name='region... | 536 | 194 |
import nox
SOURCE_FILES = (
"setup.py",
"noxfile.py",
"elastic_workplace_search/",
"tests/",
)
@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8"])
def test(session):
session.install(".")
session.install("-r", "dev-requirements.txt")
session.run("pytest", "--record-mode=none"... | 668 | 275 |
# !/usr/bin/env python
import rospy
import numpy as np
from gazebo_msgs.srv import SpawnModel, SpawnModelRequest, SpawnModelResponse
from copy import deepcopy
from tf.transformations import quaternion_from_euler
sdf_cube = """<?xml version="1.0" ?>
<sdf version="1.4">
<model name="MODELNAME">
<static>0</static... | 17,241 | 5,990 |
from output.models.ms_data.regex.re_l32_xsd.re_l32 import (
Regex,
Doc,
)
__all__ = [
"Regex",
"Doc",
]
| 121 | 58 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 4,291 | 864 |
import math
def is_prime_number(number):
if number < 2:
return False
if number == 2 or number == 3:
return True
if number % 2 == 0 or number % 3 == 0:
return False
number_sqrt = math.sqrt(number)
int_number_sqrt = int(number_sqrt) + 1
for d in range(6, int_number_sq... | 644 | 227 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Minimal example of the CEFBrowser widget use. Here you don't have any controls
(back / forth / reload) or whatsoever. Just a kivy app displaying the
chromium-webview.
In this example we demonstrate how the cache path of CEF can be set.
"""
import os
from kivy.app im... | 1,265 | 413 |
#!/usr/bin/python3
# If F(a) is any function that can be defined as composition of bitwise XORs, ANDs and left shifts
# Then the dynac system x_(n+1) = F(x_n) is Turing complete
# Proof by simulation (rule110)
a = 1
while a:
print(bin(a))
a = a ^ (a << 1) ^ (a & (a << 1)) ^ (a & (a << 1) & (a << 2))
| 312 | 133 |
from abc import (
abstractmethod,
)
from typing import (
Any,
Callable,
cast,
FrozenSet,
Generic,
Type,
TypeVar,
)
from cancel_token import (
CancelToken,
)
from p2p.exceptions import (
PeerConnectionLost,
)
from p2p.kademlia import Node
from p2p.peer import (
BasePeer,
... | 5,543 | 1,560 |
"""
Test to verify performance of PVC creation and deletion
for RBD, CephFS and RBD-Thick interfaces
"""
import time
import logging
import datetime
import pytest
import ocs_ci.ocs.exceptions as ex
import threading
import statistics
from concurrent.futures import ThreadPoolExecutor
from uuid import uuid4
from ocs_ci.fr... | 18,488 | 5,599 |
#!/usr/bin/python3
from jinja2 import Environment, FileSystemLoader
def spacenone(value):
return "" if value is None else str(value)
results = [
dict(
description="Noodles and Company steak Stromboli",
comment="",
size="small",
cals=530,
carbs=50,
fat=25,
... | 1,233 | 421 |
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from payments.models import Invoice, RazorpayKeys
from payments.razorpay.razorpay_payments import RazorpayPayments
from payments.models import Payment, Order
import json
@csrf_exempt
def webhook(request):
if request.method ... | 2,146 | 620 |
import configparser
import os
import sys
from time import localtime, strftime, mktime
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from net import Net
from geo_helper import store_image_bounds
from image_helper import CLASSES
from image_helper import save_image
f... | 6,541 | 1,967 |
import tkinter as tk
from tkinter import filedialog
import csv
import matplotlib.pyplot as plt
root = tk.Tk(screenName=':0.0')
root.withdraw()
file_path = filedialog.askopenfilename()
lastIndex = len(file_path.split('/')) - 1
v0 = [0, 0, 0]
x0 = [0, 0, 0]
fToA = 1
error = 0.28
errorZ = 3
t = []
time... | 3,035 | 1,341 |
# Generated by Django 2.2.3 on 2019-07-15 19:24
from django.db import migrations, models
def backpopulate_incomplete_profiles(apps, schema):
"""Backpopulate users who don't have a profile record"""
User = apps.get_model("users", "User")
Profile = apps.get_model("users", "Profile")
for user in User.o... | 2,647 | 774 |
from __future__ import division
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import sys
import os
import time
#
# TORCH INSTALLATION: refer to https://pytorch.org/get-started/locally/
#
def update_progress(job_t... | 33,743 | 15,357 |
"""
OSR (LOTFP) stat generator.
"""
import random
def d(num_sides):
"""
Represents rolling a die of size 'num_sides'.
Returns random number from that size die
"""
return random.randint(1, num_sides)
def xdy(num_dice, num_sides):
""" represents rolling num_dice of size num_sides.
Re... | 2,827 | 937 |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
import cohesity_management_sdk.models.alert
class HealthTile(object):
"""Implementation of the 'HealthTile' model.
Health for Dashboard.
Attributes:
capacity_bytes (long|int): Raw Cluster Capacity in Bytes. This is not
usable ca... | 4,178 | 1,184 |
import os
import sys
import copy
import collections
import nltk
import nltk.tokenize
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import pagerank
'''
textrank.py
-----------
This module implements TextRank, an unsupervised keyword
significance scoring algorithm. TextRank builds a... | 4,149 | 1,185 |
import logging
import os
import random
import string
import time
import unittest
import neurolib.utils.paths as paths
import neurolib.utils.pypetUtils as pu
import numpy as np
import pytest
import xarray as xr
from neurolib.models.aln import ALNModel
from neurolib.models.fhn import FHNModel
from neurolib.models.multim... | 10,472 | 3,462 |
# -*- coding: utf-8 -*-
'''
Module offering 2 functions, encode() and decode(), to transcode between
IRCv3.2 tags and python dictionaries.
'''
import re
import random
import string
_escapes = (
("\\", "\\\\"),
(";", r"\:"),
(" ", r"\s"),
("\r", r"\r"),
("\n", r"\n"),
)
# make the possibility of... | 3,568 | 1,240 |
from django import forms
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
# from .models import RegionModel
# from .models import SERVICE_CHOICES, REGION_CHOICES
from django.contrib.auth import authenticate
# from django.contrib.auth.forms import UserCreationForm, UserChangeForm
# from .models i... | 2,646 | 719 |
# newly added libraries
import copy
import wandb
import time
import math
import csv
import shutil
from tqdm import tqdm
import torch
import numpy as np
import pandas as pd
from client import Client
from config import *
import scheduler as sch
class FedAvgTrainer(object):
def __init__(self, dataset, model, device... | 28,019 | 8,492 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import cv2
import matplotlib.pyplot as plt
import numpy as np
from progress.bar import Bar
import torch
import pickle
import motmetrics as mm
from lib.opts import opts
from lib.logger im... | 15,539 | 4,968 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import shutil
import subprocess
import tempfile
from pathlib import Path
from threading import Lock
from typing import Iterable,... | 8,796 | 2,630 |
__author__ = "Daniel Winklehner"
__doc__ = "Find out if a number is a power of two"
def power_of_two(number):
"""
Function that checks if the input value (data) is a power of 2
(i.e. 2, 4, 8, 16, 32, ...)
"""
res = 0
while res == 0:
res = number % 2
number /= 2.0
prin... | 444 | 165 |
from viewdom import html, render, use_context, Context
expected = '<h1>My Todos</h1><ul><li>Item: first</li></ul>'
# start-after
title = 'My Todos'
todos = ['first']
def Todo(label):
prefix = use_context('prefix')
return html('<li>{prefix}{label}</li>')
def TodoList(todos):
return html('<ul>{[Todo(lab... | 535 | 212 |