text string | size int64 | token_count int64 |
|---|---|---|
"""Construit le site Explorer et comprendre l'Univers, incluant les diapositives
et le livre. Le logiciel Pandoc est utilisé pour obtenir des présentations
dans différents formats.
On peut construire tous les fichiers html avec la commande
$ python make.py
"""
import subprocess
import os
import sys
# Dossiers... | 2,600 | 873 |
import os
from pathlib import PurePath
try:
from geosnap import io
except:
pass
path = os.getcwd()
try:
io.store_ltdb(sample=PurePath(path, 'ltdb_sample.zip'), fullcount=PurePath(path, 'ltdb_full.zip'))
io.store_ncdb(PurePath(path, "ncdb.csv"))
except:
pass | 280 | 117 |
import numpy as np
import torch
from tqdm import tqdm
import matplotlib as mpl
# https://gist.github.com/thriveth/8560036
color_cycle = ['#377eb8', '#ff7f00', '#4daf4a',
'#f781bf', '#a65628', '#984ea3',
'#999999', '#e41a1c', '#dede00']
labels_dict = {"ic": "IC",
"prior": ... | 13,370 | 4,723 |
from __future__ import division
from __future__ import print_function
import numpy as np
import cv2
import matplotlib.pyplot as plt
from .face import compute_bbox_size
end_list = np.array([17, 22, 27, 42, 48, 31, 36, 68], dtype=np.int32) - 1
def plot_kpt(image, kpt):
''' Draw 68 key points
Args:
ima... | 4,750 | 1,936 |
# calculate the curverture
import numpy as np
import matplotlib.pyplot as plt
from predusion.tools import curvature
radius = 2
n_point = 10
circle_curve = [[radius * np.sin(t), radius * np.cos(t)] for t in np.linspace(0, 2 * np.pi, n_point, endpoint=False)]
circle_curve = np.array(circle_curve)
#plt.figure()
#plt... | 439 | 179 |
import cocos.device
import cocos.numerics as cn
import numpy as np
import pytest
test_data = [np.array([[1, 2, 3], [4, 5, 6], [7, 8, 20]],
dtype=np.int32),
np.array([[0.2, 1.0, 0.5], [0.4, 0.5, 0.6], [0.7, 0.2, 0.25]],
dtype=np.float32),
np.array([... | 875 | 403 |
"""
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
this is a very long docstring
"""
class A:
"""This is the first class... | 482 | 142 |
import django.dispatch
# signal fired just before calling model.index_search_document
pre_index = django.dispatch.Signal(providing_args=["instance", "index"])
# signal fired just before calling model.update_search_document
pre_update = django.dispatch.Signal(
providing_args=["instance", "index", "update_fields"]
... | 461 | 128 |
from django.db.models.signals import post_save
from django.dispatch import receiver
from communique.utils.utils_signals import generate_notifications
from user.models import NotificationRegistration
from .models import AdverseEvent
@receiver(post_save, sender=AdverseEvent)
def post_adverse_event_save_callback(sender... | 528 | 138 |
# -*- coding: iso-8859-1 -*-
# Maintainer: joaander
import hoomd
hoomd.context.initialize()
import unittest
class analyze_callback_tests(unittest.TestCase):
def setUp(self):
sysdef = hoomd.init.create_lattice(unitcell=hoomd.lattice.sq(a=2.0),
n=[1,2]);
s... | 1,117 | 403 |
import cStringIO
import StringIO
from xml.sax import make_parser, ErrorHandler, SAXParseException
from xml.sax import InputSource as SaxInput
from xml.dom.minidom import parseString as domParseString
from xml.parsers.expat import ExpatError
from lxml import etree
from cheshire3.baseObjects import Parser
from cheshir... | 7,145 | 2,044 |
from hepqpr.qallse import *
from hepqpr.qallse.plotting import *
from hepqpr.qallse.cli.func import time_this
import time
import pickle
# import the method
from hepqpr.qallse.dsmaker import create_dataset
modelName = "D0"
#modelName = "Mp"
#modelName = "Doublet"
maxTry=1
# 5e-3 : 167 MeV
# 8e-4 : 1.04 GeV
varDen... | 6,275 | 2,321 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================
#
# File name: __init__.py
# Author: threeheadedknight@protonmail.com
# Date created: 30.06.2018 17:00
# Python Version: 3.7
#
# ======================================================
from .ifconfig_parser im... | 440 | 155 |
from abc import ABC, abstractmethod
import tmdbsimple as tmdb
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.utils.decorators import method_decorator
from rest_framework.response import Response
from rest_framework.views import APIView
from api.serializers import... | 3,382 | 990 |
from django.shortcuts import render
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse
from apps.index.models import User, UserHistory
from sova_avia.settings import MEDIA_ROOT
from imageai.Prediction import ImagePrediction
import json
from .models import Article
from .forms import ... | 3,853 | 1,163 |
class Solution:
def missingNumber(self, nums) -> int:
if nums[0] != 0:
return 0
if nums[-1] != len(nums):
return len(nums)
return self.f(nums)
def f(self, nums):
print(nums)
if len(nums) <= 3:
for i in range(1, len(nums)):
... | 544 | 203 |
#!/usr/bin/env python3
from distutils.core import setup
version = '3.0'
setup(
name='deckard',
version=version,
description='DNS toolkit',
long_description=(
"Deckard is a DNS software testing based on library pydnstest."
"It supports parsing and running Unbound-like test scenarios,"
... | 1,159 | 367 |
import os
from urllib.parse import urljoin
from selenium import webdriver
from TrackApp.models import User, Track
from libs import track
def login(driver: webdriver,
live_server_url: str,
username: str,
password: str):
driver.get(urljoin(live_server_url, 'login'))
driver.find_el... | 1,894 | 573 |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from simuleval.states import TextStates, SpeechStates
class Agent(object):
data_type = None
def __init__(self, a... | 1,563 | 429 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import boto3
import json
import sys
import time
import ffmpeg
from MediaReplayEnginePluginHelper import OutputHelper
from MediaReplayEnginePluginHelper import Status
from MediaReplayEnginePluginHelper import DataPlane... | 13,317 | 3,767 |
from __future__ import division
from chempy.util.testing import requires
from ..integrated import pseudo_irrev, pseudo_rev, binary_irrev, binary_rev
import pytest
try:
import sympy
except ImportError:
sympy = None
else:
one = sympy.S(1)
t, kf, kb, prod, major, minor = sympy.symbols(
't kf kb... | 1,567 | 662 |
#!/usr/bin/python
import sys
import os
import shutil
def main():
if len(sys.argv) < 3:
print "Usage sourceDir resultDir"
sys.exit(1)
sourceDir = sys.argv[1]
resultDir = sys.argv[2]
if not os.path.exists(sourceDir):
print "{0} doesn't exist".format(sourceDir)
sys.exit(1)
if os.path.exists(resul... | 1,362 | 481 |
from setuptools import setup
setup(
name='netbox_plugin_osism',
version='0.0.1',
description='NetBox Plugin OSISM',
long_description='Netbox Plugin OSISM',
url='https://github.com/osism/netbox-plugin-osism',
download_url='https://github.com/osism/netbox-plugin-osism',
author='OSISM GmbH',
... | 1,097 | 347 |
from starlette.responses import HTMLResponse
class ResponseBuilder:
def __init__(self):
self.items = []
def addtag(self, name: str, value: str):
self.items.append((name, value))
def build(self):
og_tags = ""
for item in self.items:
og_tags += f"\n<meta property... | 525 | 158 |
from .core import Observer, Observable, AnonymousObserver as _
| 63 | 16 |
VESPA_IP = "172.16.100.65"
VESPA_PORT = "8080"
| 47 | 36 |
import cozmo
from cozmo.util import distance_mm, speed_mmps,degrees
def cozmo_program(robot: cozmo.robot.Robot):
robot.drive_straight(distance_mm(150),speed_mmps(100)).wait_for_completed()
robot.turn_in_place(degrees(90)).wait_for_completed()
robot.drive_straight(distance_mm(150),speed_mmps(100)).wait_for_... | 642 | 268 |
#!/usr/bin/env python
# Krzysztof Kosiński 2014
"""
Detect the Clang C compiler
"""
from waflib.Configure import conf
from waflib.Tools import ar
from waflib.Tools import ccroot
from waflib.Tools import gcc
@conf
def find_clang(conf):
"""
Finds the program clang and executes it to ensure it really is clang
... | 694 | 258 |
import unittest
from lambda_function import gather_anagrams
class TestSum(unittest.TestCase):
def test_list_int(self):
"""
Basic unit test to verify anagram of cinema including upper+lower case
"""
test_word = "iceman"
get_result = gather_anagrams(test_word)
... | 457 | 137 |
'''
Find the smallest cube for which exactly five permutations of its digits are cube.
'''
import math, itertools
print(math.pow(8, 1/3).is_integer())
tried = {}
for i in range(1000, 1200):
cb = int(math.pow(i, 3))
#print(cb)
#print(math.pow(int(cb), 1/3))
roots = 1
tried[i] = [str(cb)]
for x in itertools.permuta... | 577 | 287 |
from ants.medium import MediumX
from ants.materials import Materials
from ants.mapper import Mapper
from ants.multi_group import source_iteration
import numpy as np
import matplotlib.pyplot as plt
def reeds(cells):
width = 16.
delta_x = width/cells
group = 1
boundaries = [slice(0,int(2/delta_x)),sli... | 3,010 | 1,286 |
import os
import time
import logging
import argparse
import numpy as np
import cv2 as cv
import trimesh
import torch
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from shutil import copyfile
from icecream import ic
from tqdm import tqdm
from pyhocon import ConfigFactory
from models.d... | 29,411 | 9,905 |
#Python v3, OpenCV v3.4.2
import numpy as np
import cv2
videoCapture = cv2.VideoCapture("video.mp4")
ret,camera_input = videoCapture.read()
rows, cols = camera_input.shape[:2]
'''
Video dosyası üzerine Mean Shift için bir alan belirlenir.
Bu koordinatlar ağırlıklı ortalaması belirlenecek olan dörtgen alanıdır. '''
... | 2,007 | 923 |
from dtt_class import DTT
from parser import args
if __name__ == "__main__":
dtt = DTT()
# Creates a list of files and subdirectories
try:
l = dtt.dir_to_list(args.directory, args)
# Creates a .txt file with the list
dtt.list_to_txt(args.output_file, l)
except Exception as e:
... | 346 | 119 |
import torch.nn as nn
import collections
class BasicHead(nn.Sequential):
def __init__(self, in_channels, out_channels, **kwargs):
super().__init__()
class PreActHead(nn.Sequential):
def __init__(self, in_channels, out_channels, normalization, activation, **kwargs):
super().__i... | 1,675 | 566 |
class DimensionError(Exception):
pass
| 42 | 12 |
from __future__ import unicode_literals, print_function, absolute_import
import flask
import os
import os.path
import json
import sjoh.flask
import logging
import asgard
app = asgard.Asgard(__name__, flask_parameters={"static_folder": None})
# load configuration about files and folders
folder = os.path.dirname(__f... | 968 | 323 |
import io
import os
import unittest
import numpy as np
from PIL import Image
from vltk import SingleImageViz
PATH = os.path.dirname(os.path.realpath(__file__))
URL = "https://raw.githubusercontent.com/airsplay/py-bottom-up-attention/master/demo/data/images/input.jpg"
class TestVisaulizer(unittest.TestCase):
... | 414 | 146 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import torch
from collections import OrderedDict
from ..builder import build_tracker, TRAIN_WRAPPERS
from ...datasets import TrainPairDataset, build_dataloader
from ...runner import Runner
from ...utils.parallel import MMDat... | 3,419 | 979 |
"""
View helpers
============
Coaster provides classes, functions and decorators for common scenarios in view
handlers.
"""
# flake8: noqa
from .classview import *
from .decorators import *
from .misc import *
| 212 | 63 |
# Generated by Django 2.1.5 on 2020-03-08 05:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles', '0008_auto_20200308_0535'),
]
operations = [
migrations.CreateModel(
name='AuthorFri... | 1,429 | 445 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from incomming import CacheTick
from incomming import SaveLogin
from incomming import RemoveLogin
from incomming import StatusUpdate
from outgoing import ... | 377 | 102 |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# pylint: disable=duplicate-code
# pylint: disable=li... | 9,446 | 2,858 |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from rest_framework_json_api.relations import *
#load django and webapp models
#from django.contrib.auth.models import *
from api.models import *
class FmenuSerializer(serializers.ModelSerializer):
class Meta:
mod... | 358 | 101 |
import numpy as np
import pylab as pl
x = [] # Make an array of x values
y = [] # Make an array of y values for each x value
for i in range(-128,127):
x.append(i)
for j in range(-128,127):
temp = j *(2**(1 - abs((j/128))))
y.append(temp)
# print('y',y)
# pl.xlim(-128, 127)# set axis limits
# pl.ylim(... | 622 | 276 |
bl_info = {
"name": "Gothic Materials and Textures Blender",
"description": "Makes life easier for Gothic material export",
"author": "Diego",
"version": (1, 3, 0),
"blender": (2, 78, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
... | 36,578 | 10,324 |
# Massive Black 2 galaxy catalog class
import numpy as np
from astropy.table import Table
import astropy.units as u
import astropy.cosmology
from .GalaxyCatalogInterface import GalaxyCatalog
class MB2GalaxyCatalog(GalaxyCatalog):
"""
Massive Black 2 galaxy catalog class.
"""
def __init__(self, **kwar... | 7,881 | 2,300 |
from django.shortcuts import get_object_or_404, render
from django.contrib.staticfiles.templatetags.staticfiles import static
def index(request):
return render(request, 'skylernet/landing.html')
def connect(request):
context = {'online_media': [{"name": 'LinkedIn',
'href': '... | 714 | 215 |
from src.dirac_notation.bra import Bra
from src.dirac_notation.ket import Ket
from src.dirac_notation.matrix import Matrix
from src.dirac_notation import functions as dirac
from src.dirac_notation import constants as const
from src.objects.quantum_system import QuantumSystem, SystemType
class Qubit(QuantumSystem):
... | 532 | 158 |
import sys, re, textwrap
class ParseError(Exception):
# args[1] is the line number that caused the problem
def __init__(self, why, lineno):
self.why = why
self.lineno = lineno
def __str__(self):
return ("ParseError: the JS API docs were unparseable on line %d: %s" %
... | 9,926 | 2,785 |
# -*- coding: utf-8 -*-
import attest
from acrylamid.core import cache
class Cache(attest.TestBase):
def __context__(self):
with attest.tempdir() as path:
self.path = path
cache.init(self.path)
yield
@attest.test
def persistence(self):
cache.init(self.p... | 1,217 | 404 |
from subplot_animation import subplot_animation
import sys
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import os
import numpy as np
import glob
sys.path.append("/home/smp16fm/forked_amrvac/amrvac/tools/python")
from amrvac_pytools.datfiles.reading import amrvac_reader
from amrvac_pytools.v... | 1,235 | 522 |
from flask.helpers import flash
from flask.wrappers import Request
from swcf import app
from flask import render_template, redirect, request, url_for
from swcf.dao.indexDAO import *
@app.route("/", methods=['GET'])
def index():
return render_template("layout.html")
@app.route("/sendPost", methods=['POST'])
def se... | 812 | 250 |
from testlib2 import _puw
def get_default_form():
return _puw.get_default_form()
| 87 | 33 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | 4,668 | 1,682 |
host="mysql-general.cyqv8he15vrg.ap-southeast-2.rds.amazonaws.com"
user="admin"
password=""
database="silver_giggle"
| 117 | 52 |
from django import forms
from django.core.exceptions import ValidationError
from secret.models import Secret
class SecretForm(forms.ModelForm):
class Meta:
model = Secret
fields = ['username', 'email']
def clean_username(self):
username = self.cleaned_data['username']
if Secr... | 447 | 114 |
def seu_token():
return "NDUyMzQxOTA3MDEyNzE0NTI2.DgCa4Q.qhpEIZAUh3sLzZAqbdduRqjUwl8"
#Subistitua xxxxxx pelo seu token!! | 125 | 73 |
import xgboost as xgb
import datetime
import real_estate_analysis.models.functions as func
import real_estate_analysis.models.xgb_model.utils as XGB_utils
import real_estate_analysis.Model.utils as model_utils
def main():
###########################################################################################... | 4,209 | 1,147 |
from datetime import date
from os import environ
PARAMS_LESSON_PLAN = [
(
date(2018, 9, 4),
[
{"IdPrzedmiot": 173, "IdPracownik": 99},
{"IdPrzedmiot": 123, "IdPracownik": 101},
{"IdPrzedmiot": 172, "IdPracownik": 92},
{"IdPrzedmiot": 189, "IdPracownik... | 1,067 | 505 |
# vim:fileencoding=utf8
from distutils.core import setup
import os
README = os.path.join(os.path.dirname(__file__),'PKG-INFO')
long_description = open(README).read() + "\n"
setup(name="vbcode",
version='0.2.0',
py_modules=['vbcode'],
description="Variable byte codes",
author="utahta",
aut... | 886 | 254 |
"""
Extension desined to test bot functionality, just for testing
"""
# Library includes
from discord.ext import commands
# App includes
from app.client import BotClient
class TestCog(commands.Cog):
"""
Class cog for the testing_cog cog extension
"""
def __init__(self, client: BotClient):
... | 1,221 | 383 |
import urllib3
from bs4 import BeautifulSoup
import shutil
import re
import os
def obtenerReporteDiario(reporte_url, path):
req = urllib3.PoolManager()
res = req.request('GET', reporte_url)
soup = BeautifulSoup(res.data, features="html.parser")
pdfs = []
for link_soup in soup.find_all('a'):
... | 3,221 | 1,146 |
## This script set up classes for 4 bus and 2 bus environment
import pandapower as pp
import pandapower.networks as nw
import pandapower.plotting as plot
import enlopy as el
import numpy as np
import pandas as pd
import pickle
import copy
import math
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import... | 44,126 | 15,035 |
import json
from unittest import TestCase
from flask import Flask
from flask_controllers.GameServerController import GameServerController
from flask_helpers.VersionHelpers import VersionHelpers
from python_cowbull_server import app
from python_cowbull_server.Configurator import Configurator
from flask_helpers.ErrorHan... | 10,659 | 3,149 |
import logging
import time
from datetime import datetime, timedelta
from itertools import product
from typing import List
import requests
from python_flights.itinerary import Itinerary
from python_flights.pods import Country, Currency, Airport, Place, Agent, Carrier, Direction, Trip, Segment, Price, \
CabinClass,... | 10,104 | 3,144 |
#!/usr/bin/python
# coding: utf-8
# Copyright 2018 AstroLab Software
# Author: Chris Arnault
#
# 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... | 8,636 | 2,619 |
import click
import json
import os
import re
from tqdm import tqdm
from utils.imutil import *
import numpy as np
import math
PROCESSED_SCAN_FOLDER = 'processedScan'
def buildXyzMap(data_dir, prefix):
projector_size = get_projector_size(data_dir)
click.echo("Projector resolution %i x %i (from settings.json)" ... | 8,457 | 3,108 |
# Copyright 2015 Planet Labs, 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 wr... | 3,383 | 1,164 |
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.home, name="home"),
path('signup', views.signup, name="signup"),
path('activate/<uidb64>/<token>/', views.activate_account, name='activate'),
path('sell-book', views.sell_book, name='sell_book'),
path('book/<in... | 936 | 325 |
import pytest
from pathlib import Path
import json
if __name__ == "__main__":
pytest.main([__file__])
@pytest.fixture(scope="session")
def fixture_exception(fixture_json_path: Path) -> Path:
return fixture_json_path / 'exception' / 'Exception.json'
def test_exception(fixture_exception):
from src.mode... | 2,772 | 998 |
import boto3
import base64
import hmac
import hashlib
from .automl import AWS_ACC_KEY_ID, AWS_SEC_ACC_KEY, USER_POOL_ID, CLIENT_ID, CLIENT_SECRET, AWS_REGION_NAME
client_cognito = boto3.client('cognito-idp',
aws_access_key_id=AWS_ACC_KEY_ID,
aws_secret_access_key=AWS_SEC_ACC_KEY,
region_name=AWS_REGI... | 4,135 | 1,586 |
#!/usr/bin/env python3
from LIPM_with_dsupport import *
import random
import subprocess
from mono_define import *
from nav_msgs.msg import Odometry
from std_srvs.srv import Empty
def walk_test(initiate_time, T_dbl, zc, foot_height):
rospy.init_node('mono_move')
print('function called')
l_2.pub = rospy.Pu... | 10,464 | 3,614 |
from BCBio import GFF
from Bio import SeqIO
import csv
import sys
in_gff_file = sys.argv[1]
out_file = sys.argv[2]
#Add annotations to sequences
print("Parsing .gff file...")
in_handle = open(in_gff_file)
limit_info = dict(gff_type = ["mRNA"])
protnames = []
protanno = []
for rec in GFF.parse(in_handle, limit_info ... | 781 | 303 |
"""
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.
Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are s... | 1,657 | 506 |
import urizen.core
from urizen.core import *
import urizen.generators
from urizen.generators import *
import urizen.visualizers
from urizen.visualizers import *
| 163 | 49 |
import pandas as pd
from collections import Counter
import re
def Mystats(directory):
df=pd.read_csv(directory)
id=df['social_id'].unique()
#1
print('Q1:Number of unique users:',len(id))
mes=df['comment_tokens']
#2
print('Q2:Number of unique messages:',len(mes.unique()))
#4
word=[]... | 3,524 | 1,360 |
import codecs
import re
from collections import namedtuple
import unittest
from typing import Collection, Iterable, Sequence, Tuple, Type
import io
from pathlib import Path
from styler import decode
import json
import logging
from itertools import islice
logger = logging.getLogger(__name__)
CSS_PARSING_TESTS_DIR = ... | 3,300 | 985 |
from collections import Counter
from functools import reduce
with open("./input.txt", "r") as inputFile:
readingsStr = inputFile.read().splitlines()
columnsRange = range(len(readingsStr[0]))
columns = map(lambda columnIndex : map(lambda row : row[columnIndex], readingsStr), columnsRange)
multiModes = map(lambda c... | 1,886 | 670 |
import os, sys, re
while True:
path = os.getcwd() + " $"
# User input
os.write(1, path.encode())
args = os.read(0, 1000).decode().split()
# Exit
if args[0] == "exit":
if len(args) > 1:
print("Program terminated with exit code", args[1])
sys.exit(int(args[1]))
... | 2,637 | 841 |
def lexicographic_order(w_list):
"""
単語のリストを辞書式順序(五十音順)に並び替える。
優先度:半角記号・半角数字 > アルファベット > ひらがな > カタカナ > 漢字 > 全角記号・全角数字
注意:漢字を意図した読みで認識しているとは限らず、人間が使う辞書の並びと異なる場合がある。
"""
w_list = sorted(w_list)
# もう一つ方法がある
# w_list.sort()
print(w_list)
if __name__ == '__main__':
w_list = ["おはよう",... | 528 | 372 |
#####################################################
##将radar 数据转为kitti格式 ##
#####################################################
import json
import math
import os
import numpy as np
import utils
def rotMat2quatern(R):
# transform the rotation matrix into quatern
q = np.zeros... | 4,860 | 2,068 |
"""
OpenVINO DL Workbench
Class for creating per tensor scripts job
Copyright (c) 2021 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/L... | 2,739 | 854 |
# Generated by Django 3.1.2 on 2020-11-30 22:19
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0009_auto_20201201_0038'),
]
operations = [
migrations.RemoveField(
model_name='book',... | 862 | 274 |
def method(q1,p1,dq,dp,t1,dt):
a1=[0.5,0.5]
b1=[0,1]
A=[dq,dp]
for i in range(len(a1)):
q1+=b1[i]*dt*A[0](q1,p1,t1)
p1+=a1[i]*dt*A[1](q1,p1,t1)
t1+=dt
return q1,p1,t1
| 212 | 133 |
"""
enqueue
dequeue
size
traverse
Queue Implementation using SLL
"""
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
class Queue(object):
def __init__(self):
self.head = None
def enqueue(self, value):
if self.head is None:
s... | 1,217 | 377 |
from spotify import values
from spotify.page import Page
from spotify.resource import Resource, UpgradableInstance
class TrackContext(Resource):
def __init__(self, version, id):
super(TrackContext, self).__init__(version)
self.id = id
def fetch(self, market=values.UNSET):
params = va... | 2,133 | 611 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | 3,526 | 1,178 |
from lrasm.multicollinearity_tst import multicollinearity_test
import numpy as np
import pandas as pd
from statsmodels.stats.outliers_influence import variance_inflation_factor
import pytest
def test_multicollinearity_test():
"""Test multicollinearity test outputs from dataset"""
X_proper = pd.DataFrame({"hea... | 871 | 360 |
# References
# https://docs.aws.amazon.com/sagemaker/latest/dg/adapt-inference-container.html
import logging
import numpy as np
import PIL
from numpy import ndarray as NDArray
from PIL.Image import Image
from six import BytesIO
from torch.nn import Module
from facenet_pytorch import MTCNN
logger = logging.getLogge... | 1,014 | 362 |
import itertools
import random
NUM_CANS = 1
filename = "namo_probs/sort_prob_{0}.prob".format(NUM_CANS)
GOAL = "(RobotAt pr2 robot_end_pose)"
HEIGHT = 5
WIDTH = 5
def main():
s = "# AUTOGENERATED. DO NOT EDIT.\n# Configuration file for NAMO problem instance. Blank lines and lines beginning with # are filtered ... | 2,528 | 1,005 |
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst', 'rb') as f:
long_desc = f.read().decode('utf-8')
setup(name='pygeon',
version='0.1.0',
description='IP Geolocation in Python',
long_description=long_desc,
author='Alastair Houghton',
author_email='alastair@a... | 862 | 291 |
from flask import Blueprint, render_template, send_file
from flask_app import app
static_api = Blueprint('static_api', __name__)
# @static_api.route('/', methods=['GET'])
# def index():
# return render_template('index.html')
@static_api.route('/<image_id>', methods=['GET'])
def get_image(image_id):
return se... | 357 | 118 |
from cluster.preprocess.pre_node_feed import PreNodeFeed
class PreNodeFeedFr2Cnn(PreNodeFeed):
"""
"""
def run(self, conf_data):
"""
override init class
"""
super(PreNodeFeedFr2Cnn, self).run(conf_data)
self._init_node_parm(conf_data['node_id'])
def _convert_... | 365 | 123 |
#!/usr/bin/env python
from datetime import datetime
import pika
import os
import sys
import steps # noqa: F401
import json
from climate_simulation_platform.db import step_parameters, save_step, step_seen
from climate_simulation_platform import create_app
def func_params(func, body):
# If invalidated isn't in ke... | 3,535 | 1,024 |
import os
import sys
import random
import json
import tqdm
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import numpy as np
from transformers import BertTokenizer, BertModel, AdamW, get_linear_schedule_with_warmup
fr... | 7,764 | 2,513 |
import webapp2
from models import *
from webapp2_extras import sessions
def user_optional(handler):
def check_login(self, *args, **kwargs):
self.user = self.get_user()
return handler(self, *args, **kwargs)
return check_login
def user_required(handler):
def check_login(self, *a... | 1,542 | 479 |
# Basic libs
import os, time, glob, random, pickle, copy, torch
import numpy as np
import open3d
from scipy.spatial.transform import Rotation
# Dataset parent class
from torch.utils.data import Dataset
from lib.benchmark_utils import to_tsfm, to_o3d_pcd, get_correspondences
class KITTIDataset(Dataset):
"""
W... | 9,447 | 3,487 |
#!/usr/bin/env python
"""
Make plots to compare two different versions of desimodel
Stephen Bailey, LBL
July 2014
"""
import os, sys
import numpy as np
import pylab as P
import matplotlib.pyplot as plt
import fitsio
camcolor = dict(b='b', r='r', z='k')
def compare_throughput(dir1, dir2):
P.figure()
p0 = pl... | 1,344 | 583 |
import matplotlib.pyplot as plt
import numpy as np
import os
import json
import seaborn as sns
import re
sns.set(style="darkgrid")
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
'''
alist.sort(key=natural_keys) sorts in human order
http://nedbatcheld... | 1,923 | 723 |