text
stringlengths
38
1.54M
import os import collections import hashlib __all__ = ["emojize"] def encode_hash_with_modulo_operation(hash_, emojies, length): # type: (int, list, int) -> str emoji_string = "" index = hash_ % (len(emojies) ** length) for _ in range(length): emoji_string += emojies[index % len(emojies)] ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging import os def get_file_path(relative_filepath, parent_dir=None): """ Get file path relatively to parent folder `placethings` Args: re...
# decimal to Roman numeral converter. works up to 3999, at which point you run out of symbols. print("number: ") num = int(input()) roman = "" suffixes = [ ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"], ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"], ["", "C", "CC", "CCC", "CD", "D", "...
from django.contrib import admin # Register your models here. from apps.documents.models import Document admin.site.register(Document)
import cv2 import os import numpy as np import json from keras.utils import np_utils from sklearn.utils import shuffle from sklearn.model_selection import train_test_split # load and prepare data # user_data_file = 'user_data.json' # face_images_folder = 'face_images/' def load_data(user_data_file, face_images_fold...
# Open the file with with data separated by commas # Convert it to SQL FORMAT f = open('noSQLFormat.txt') i = 0 for x in f: line = f.readline() tc = len(line) valeur = '\"' + "," + '\"' line = line.replace(",", valeur) cara = "\")," lineall = "(\"" + line + cara.rstrip() print(lineall) ...
import os import matplotlib.pyplot as plt import pickle skip=10000 history_losses = [] if os.path.isfile('./G1/loss_historyv2'): history_losses = pickle.load(open('./G1/loss_historyv2', 'rb')) proper_history_losses = [] for i in range(skip, len(history_losses)): proper_history_losses.append(history_losses[i]...
from django.db import models from cms.models.pluginmodel import CMSPlugin # Create your models here. class Hello(CMSPlugin): guest_name = models.CharField(max_length=50, default='Guest')
#!/usr/bin/env python3 import csv import os import sys #from nifti import *; #import nifti.clib as ncl import nibabel import numpy from numpy import linalg as LA import scipy.ndimage import math import getopt import scipy.io import scipy.ndimage import tempfile import shutil import subprocess import FLIRT ...
from flask import Flask, render_template, request from maniplate_instance import launch_an_instance, terminate_an_instance app = Flask(__name__) app.secret_key = 'yanli_key' fail_str = 'We are sorry, there is a machine running.' success_str = 'Congratuations, a machine has been created successfully.' @app.route('/in...
# Convex Landau Ginzburg # See Blog post for more x = np.linspace(0,1,100).reshape((-1,1)) y = np.linspace(0,1,100).reshape((1,-1)) row = np.zeros(100) row[0] = -2 row[1] = 1 col = row K = np.toeplitz(row, col) K2 = np.kron(np.eye(100), K) + np.kron(K, np.eye(100)) def V(phi): a = 1 # The setpoint of the field V1...
from django.contrib import admin from datetime import date from . import models def make_published(modeladmin, request, queryset): queryset.update(status='p') make_published.short_description = "Mark selected courses as Published" class TextInline(admin.StackedInline): model = models.Text class QuizInline(a...
from external_data_sync.models import BaseDataSource class PhillyDataSource(BaseDataSource): pass
import serial f = open("/home/pi/imulogger/temp2.mtb","wb") ser = serial.Serial('/dev/ttyUSB0',921600,timeout=10) ser.flush() ser.write(b'\xfa\xff\x40\x00\xc1') ConfigWritten = False DataCollect = b'' for i in range(50000): data = ser.read_until(b'\xfa\xff') if data[0] == 13: f.write(b'\xfa\xff\x0d') f.wr...
import numpy as np import scipy.optimize as op __author__ = 'smbuthia' class ModuleTrainer: """Implementation for class that trains the module""" def load_training_data(self, filename, n): data = np.loadtxt(filename, delimiter=',') return data[:, 0:n], data[:, data.shape[1]-1] ...
fs = "task{}-test{}.{}" for t in range(1, 5): for i in range(6): fints = open(fs.format(t, i, "in"), 'w') fouts = open(fs.format(t, i, "out"), 'w') ip = input("Enter app input (task {}, test {}): ".format(t, i)) op = input("Enter app output (task {}, test {}): ".format(t, i)) fints.write(ip) ...
# Generated by Django 2.2.2 on 2019-06-26 09:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mainapp', '0004_auto_20190619_1436'), ] operations = [ migrations.AddField( model_name='codebase', name='hash_digest...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-30 19:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import sqlparse class Migration(migrations.Migration): dependencies = [ ('dashboard', '0006_auto_20170630_1851'), ...
domain_path = {'movie':{ 'act_path':'./data/data_movie/dia_acts.txt', 'slot_path':'./data/data_movie/slot_set.txt', 'dialog_path':'./data/data_movie/movie_all_wState.p', 'split':[1445, 433, 1010], }, 'taxi':{ 'act_path':'./data/data_taxi/dia_acts.txt', 'slot_path':'./data/data_taxi/taxi_slots.txt', 'dia...
import os.path import glob import logging import cv2 import numpy as np from datetime import datetime from collections import OrderedDict from scipy.io import loadmat import torch from dpsrutils import utils_deblur from dpsrutils import utils_logger from dpsrutils import utils_image as util from dpsrmodels.network_...
from __future__ import annotations from rsyscall.tests.trio_test_case import TrioTestCase import rsyscall.thread from rsyscall.nix import enter_nix_container, deploy import rsyscall._nixdeps.nix import rsyscall._nixdeps.hello import rsyscall._nixdeps.coreutils import rsyscall._nixdeps.bash from rsyscall.tasks.ssh impo...
import webbrowser import os from django.utils.text import slugify from invoke import task from git import Repo def _connect_github(): from github import Github token_path = os.path.join(os.getcwd(), '.githubtoken') print("Connecting to GitHub...") try: with open(token_path, "r") as f: ...
from django.shortcuts import render from django.apps import apps from django.core import serializers from django.http import HttpResponseRedirect import uuid from django.urls import reverse from django.views.generic.base import TemplateView from django.views.decorators.csrf import csrf_exempt from django.shortcuts im...
import os ATERNITY_USER = os.environ['ATERNITY_USER'] ATERNITY_PW = os.environ['ATERNITY_PW'] SERVICENOW_USER = os.environ['SERVICENOW_USER'] SERVICENOW_PW = os.environ['SERVICENOW_PW'] SERVICE_NOW_EVENT_URL= os.environ['SERVICE_NOW_EVENT_URL'] ATERNITY_INCIDENT_URL =os.environ['ATERNITY_INCIDENT_URL']
import tkinter as tk from tkinter.filedialog import askopenfilename from tkinter import messagebox import adjust as adj class Main: def __init__(self): self.ont = '' self.update = '' self.dic = [] self.app = tk.Tk() self.app.title("Update Company Names") self.app.geometry("700x280") self.v1 = tk.StringV...
import copy from framework.prototype import Prototype class MessageBox(Prototype): def __init__(self, decochar): self.__decochar = decochar def use(self, s): length = len(s) line = self.__decochar * (length + 4) print("{0}".format(line)) print("{0} {1} {2}".format(sel...
#!/usr/bin/env python import sys import os.path import collections import string # hat tip http://stackoverflow.com/users/496713/amillerrhodes def caesar(plaintext, shift): alphabet = string.ascii_lowercase shift=shift%26 shifted_alphabet = alphabet[shift:] + alphabet[:shift] table = string.maketrans(alphabet, sh...
#!/usr/bin/python ''' Project Euler - Problem 4 ''' def isPalindrome(n): lst = list(str(n)) rev = lst[:] rev.reverse() return (lst == rev) def findPalindrome(): pal = [0, 0, 0] for i in range(999, 99, -1): for j in range (999, 99, -1): if (isPalindrome (i*j)): newPal = [(i*j), i, j] #print newPal...
import requests API_URL = "https://webexapis.com/v1/" def jwt_login(jwt_token): print("Guest log in...") headers = {"authorization":"Bearer {}".format(jwt_token)} url = API_URL + "jwt/login" response = requests.post(url, headers=headers).json() print("Guest logged in!") return response["token...
from sqlalchemy import Column, text from sqlalchemy.dialects.postgresql import UUID class UUIDPKMixin: id = Column( UUID(as_uuid=True), primary_key=True, index=True, server_default=text("gen_random_uuid()"), )
import siteapps_v1.ntgreekvocab.models from django.shortcuts import render_to_response from django.template import RequestContext from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.utils import simplejson from siteapps_v1.ntgreekvocab.models impo...
# -*- coding: utf-8 -*- """ Created on Wed Mar 27 16:16:00 2019 @author: Attila Lengyel """ import numpy as np import scipy from scipy import linalg from scipy import ndimage from PIL import Image as pil_image from PIL import ImageEnhance def array_to_img(x, data_format='channels_last', scale=False, dtype='float32')...
from mido import Message, MidiFile, MidiTrack import math ## frequency and midicents handling def mc_to_f(midicents): # converts midicents value to frequency # assumes A440 @ 6900 midicents frequency = 440 * 2.**((midicents-6900.)/1200.) return frequency def f_to_mc(frequency): #converts frequency to midicents ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 23 15:45:26 2019 @author: usingh """ from pyrpipe import pyrpipe_utils as pu from pyrpipe import pyrpipe_engine as pe import os import statistics class SRA: """This class represents an SRA object Parameters ---------- ...
from flask import Flask from app.config import configs def create_app(config_name): flask_app = Flask(__name__) flask_app.config.from_object(configs[config_name]) return flask_app
from django.contrib import admin from .models import * # Register your models here. class PublisherManage(admin.ModelAdmin): list_display = ['id','name'] class BookManage(admin.ModelAdmin): list_display = ['id','title','publisher'] admin.site.register(Publisher,PublisherManage) admin.site.register(Book,BookM...
from base import JiraBaseAction class JiraComponent(JiraBaseAction): def _run(self, id): return self.jira.component(id)
from django.urls import path from apps.core.views import base_view urlpatterns = [ path( "", base_view, name="home", ), ]
# http://www.pythonchallenge.com/pc/def/map.html # using 2 methods form the string class : # - string.translate(table) # ==> transform a string to another, using the translation table in argument. # - string.maketrans("input", "output") # ==> create a translation table from 2 strings : the input and the expected re...
# Base imports from typing import List # Project imports from docker.run import run_with_compose def stop(arguments: List[str]) -> int: print(">>>>>>>>>>>>>>>>>>>> Stopping services <<<<<<<<<<<<<<<<<<<<") return run_with_compose(['stop'] + arguments)
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import permissions from .serializers import * from rest_framework.parsers import FileUploadParser from rest_framework import status class Articles(APIView): permission_classes = [permissions.IsAdminUser] ...
import pandas as pd class Date: @staticmethod def find_missing_dates(dates_array): minimum = min(dates_array) maximum = max(dates_array) missing = [] for d in pd.date_range(minimum, maximum): if d not in dates_array: missing.append(d) r...
import tifffile as tf # %matplotlib inline import matplotlib.pyplot as plt import matplotlib.image as mpimg from mpl_toolkits.mplot3d import Axes3D import numpy as np import cv2 import sys # Extract the raw image data from an ome-tiff file # Note: returns a numpy array in the format (time, z-val, y-val, x-...
import os HERE = os.path.dirname(__file__) F1_PATH = os.path.join(HERE, 'f1.csv') F2_PATH = os.path.join(HERE, 'f2.csv')
import os import mock import shutil import numpy as np import pytest from .. import VideoPaddleEncoder from jina.executors import BaseExecutor from jina.executors.metas import get_default_metas input_dim = 224 target_output_dim = 2048 num_doc = 2 test_data = np.random.rand(num_doc, 3, 3, input_dim, input_dim) tmp_fil...
import random def genRand(a, b): return random.randint(a, b) if __name__ == "__main__": print("************************************Guess The Number Game************************************") a = int(input("Enter the lower limit for the number: ")) b = int(input("Enter the upper limit for the number: ...
""" Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Find the kth positive integer that is missing from this array. Example 1: Input: arr = [2,3,4,7,11], k = 5 Output: 9 Explanation: The missing positive integers are [1,5,6,8,9,10,12,13,...]. The 5th missing positive...
for i in range(1,21): num = input("Next number: ") if i%7 == 0: if num == 'Boom': print('OK1') else: print('NOK1 - you were supposed to enter "Boom"') elif int(num )== i: print('OK2') else: print('You are wrong') break
#!/usr/bin/env python3 COMMIT_MSGS_PATH = "/Users/vyn/projects/scripts/bin/commitMsgs.txt" import sys def main(message): if message == "": return lines = [] with open(COMMIT_MSGS_PATH, "r") as f: lines = f.readlines() if message not in lines: with open(COMMIT_MSGS_PATH, "a")...
from urllib.request import Request, urlopen from bs4 import BeautifulSoup my_code = """ def create_href_list(): request = Request("https://www.guardicore.com/") page_content = urlopen(request) soup = BeautifulSoup(page_content, features="html.parser") links = [] for ix, link_tag in enumerate(soup...
''' Sort Array By Parity Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You may return any answer array that satisfies this condition. ''' class Solution: def sortArrayByParity(self, A: List[int]) -> List[int]: re...
__author__ = 'fsoler' from parking_app.Robotic_Deliverer.RoboticDeliverer import RoboticDeliverer """ def start(input_queue, parking_slot, mutex_parking_slot): robotic_deliverer_controller = RoboticDeliverer() robotic_deliverer_controller.initialize(input_queue, parking_slot, ...
import tensorflow as tf import numpy as np import mlflow import mlflow.tensorflow import matplotlib import matplotlib.pyplot as plt import sklearn from sklearn.metrics import roc_auc_score import sys gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: # Currently, memory growth needs to be...
a=int(input("habitantes de A: ")) b=int(input("habitantes de B: ")) pa=float(input("percentual A: ")) pb=float(input("percentual B: ")) t=0 while(a<b): a=a+a*(pa/100) b=b+b*(pb/100) t = t+1 print(t)
from Prediction import Prediction from Parser import Parser from GOR3 import GOR3 parser = Parser("DATA/CATH_info.txt", "DATA/dssp") # parser.loadStrucAndSeq("bdd.txt") prediction = parser.createPrediction() # prediction = Prediction() # prediction.loadSaveFile("prediction.txt") # prediction.getDimension() # parser...
from django.db import models class DeathLang(models.Model): title=models.CharField(max_length=100,primary_key=True,verbose_name="说的话") date=models.DateTimeField() def __str__(self): return self.title class Langlist(models.Model): name=models.CharField(max_length=10,primary_key=True,verbose_name="语言") ...
from django.urls import path from .views import payload from django.views.generic import TemplateView urlpatterns = [ path('payload/', payload), path('',TemplateView.as_view(template_name='home.html'), name='home'), ]
import shelve email_db = shelve.open('../Scripts/emails') arr =['kruddom7@flickr.com', 'Kathrine'] print(email_db['Kathrine'],arr[0])
"""starnavi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
import logging import math import time import copy import pygame from pygame.locals import (QUIT, KEYDOWN, K_ESCAPE) import numpy as np import pickle import imageio import Box2D from Box2D.b2 import (world, polygonShape, circleShape, staticBody, dynamicBody, kinematicBody) import matplotlib.pyplot as plt import os...
''' --- Day 2: Inventory Management System --- For example, if you see the following box IDs: abcdef contains no letters that appear exactly two or three times. bababc contains two a and three b, so it counts for both. abbcde contains two b, but no letter appears exactly three times. abcccd contains three c, but no l...
from django.views import generic class Welcome(generic.TemplateView): template_name = 'welcome.html' class SuccessfulRegistration(generic.TemplateView): template_name = 'success.html'
import os import sys __author__ = 'mameri' def label_prf_by_score_files(p_file_score, p_file_in, p_file_out): with open(p_file_in, 'r') as f_in: prf_lines = f_in.readlines() with open(p_file_score, 'r') as f_score: score_lines = f_score.readlines() word_i = 0 with open(p...
#!/usr/bin/env python # -*- coding:utf-8 -*- from django import forms from Repertory import models class Form1(forms.Form): username = forms.CharField( error_messages={'required': '用户名不能为空'}, ) password = forms.CharField(max_length=8, min_length=4,error_messages={'required': '邮箱不能为空', 'invalid': '邮箱格式错...
# taken from """ http://wiki.python.org/moin/ConfigParserExamples http://stackoverflow.com/questions/3220670/read-all-the-contents-in-ini-file-into-dictionary-with-python """ from __future__ import print_function import configparser as cp Config=cp.ConfigParser() def ConfigSectionMap(section): dict1 = {} ...
from setuptools import setup setup( name='azrpc', version='1.0.2', url='https://github.com/max0d41/azrpc', description='A robust and feature rich RPC system based on ZeroMQ and gevent.', packages=[ 'azrpc', ], install_requires=[ 'zmq', 'gevent', 'functionregi...
Anton, Boris, Victor = list(map(int,input().split())) if Anton == Boris == Victor: print("Same age") if Anton == Boris > Victor: print("Victor") elif Anton == Victor > Boris: print("Boris") elif Boris == Victor > Anton: print("Anton") elif Anton < Boris > Victor: print("Boris") elif Boris < Anton ...
a=int(input()) for i in range(1,2*a): if i>a:print("*"*(a*2-i)+" "*(i*2-a*2)+"*"*(a*2-i)) else: print("*"*i+" "*(a*2-(i*2))+"*"*i)
# from twilio.rest import TwilioRestClient from time import sleep import requests import json import sqlite3 import re import argparse # account_sid = " <Your sid> " # auth_token = " <Your auth_token> " # # ourNumber = " <Your number> " def getQuotesFromApi(): requestParams = { "method": "getQuote", ...
import renmas3.switch as proc from tdasm import Tdasm def asin_ps(): data = """ #DATA uint32 _ps_am_sign_mask[4] = 0x80000000, 0x80000000, 0x80000000, 0x80000000 float _ps_am_1[4] = 1.0, 1.0, 1.0, 1.0 float _ps_am_m1[4] = -1.0, -1.0, -1.0, -1.0 float _ps_atan_t0[4] = -0.091646118527, -0.091646...
# -*- encoding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np from torch.nn.parameter import Parameter from torch.nn import functional as F def get_embedding_weight(num_embeddings, embedding_dim, use_cuda): t = torch.rand(num_e...
sum = 0 while True: x = input("Введите число: ") if x == "Стоп": break elif x.isdigit(): x = int(x) sum = sum + x else: print("Повторите ввод числа") print("Сумма введённых чисел: ",sum)
import ast from functools import partial from django.db import IntegrityError from django.db import models as m from django.db.models import F, Q from django.db.models.signals import post_save, pre_delete from mptt.models import TreeForeignKey from etc import dimensions from etc.constants import separator, TARGETING_...
import pickle a_dict = {'apple': 1, 'orange': 2, 'pear': 3} # file = open('./file/pickle_example.pickle', 'wb') # pickle.dump(a_dict, file) # file.close() with open('./file/pickle_example.pickle', 'rb') as file: a_dict1 = pickle.load(file) print(a_dict1)
# -*- coding: utf-8 -*- import logging from pathlib import Path import streamlit as st from src.features import parse_config from src.deployment import user_input_features, predict def main(model_filepath='models/', config_file='config.yml'): """ Loads user input and uses stored model to predict price of the ...
# -*- coding: utf-8 -*- import django django.setup() from sefaria.model import * from linking_utilities.dibur_hamatchil_matcher import * from sources.functions import * import re import unicodecsv as csv import codecs SERVER = u"http://nachaleshkol.sandbox.sefaria.org/" # SERVER = u"http://localhost:8000" FILE = u"Nac...
import numpy as np import cv2 import os import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import pandas as pd from scipy import ndimage from methods import * class_size = 8 def get_features(image, mode='train'): # hisogram equalization image = cv2.cvtColor(image, cv2.COLOR_BGR2...
# -*- coding: utf-8 -*- # @Author : yz # @Time : 2018/5/11-18:00 from . import api from mall import redis_store from flask import session @api.route('/index') def index(): session['name'] = 'xxxxxxxxxxx' # 测试开启session后, redis_store.set('name=','xiaobai') return 'ceshi'
import pandas as pd import numpy as np from collections import Counter class my_DT: def __init__(self, criterion="gini", max_depth=8, min_impurity_decrease=0, min_samples_split=2): # criterion = {"gini", "entropy"}, # Stop training if depth = max_depth # Only split node if impurity decreas...
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import pytest pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_gems(get_version): assert await get_version("example", {"gems": None}) == "1.0.2"
import requests import json from bs4 import BeautifulSoup Base_url = "https://www1.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=RELIANCE" page = requests.get(Base_url) soup = BeautifulSoup(page.content, 'html.parser') content = soup.find(id="responseDiv") data = content.text.split("\",\...
# -*- coding: utf-8 -*- """ Created on Wed Jul 17 11:32:20 2019 @author: jjohns """ X=[] Y=[] Z=[] OBConversion=ob.OBConversion() OBConversion.SetInFormat("xyz") for index in range(0,len(tset)): mol=ob.OBMol() mol_name=train1JHN.iloc[index]['molecule_name'] +'.xyz' OBConversion.Re...
from flask import Flask, render_template, request, redirect, send_from_directory from markupsafe import escape import musicbrainzngs as mbz import requests import html import urllib.parse import re from multiprocessing import Pool from typing import List from functools import partial from itertools import repeat import...
species( label = 'C=[C]OC1[CH]C=CCC=C1(2243)', structure = SMILES('C=[C]OC1[CH]C=CCC=C1'), E0 = (298.493,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([2750,2807.14,2864.29,2921.43,2978.57,3035.71,3092.86,3150,900,928.571,957.143,985.714,1014.29,1042.86,1071.43,1100,2950,3100,1380,975,102...
def bin_srch_rot(inp_arr, target): n = len(inp_arr) low = 0 target = n-1 item = inp_arr[0] if target>item:
import numpy as np import matplotlib.pyplot as plt def f(t,y): return y vt = np.zeros(200) vy = np.zeros((4,200)) t = 0. y1 = y2 = y4 = 1. h = 0.001 for idx in range(200): for step in range(1000): k1 = f(t, y1) y1 += h*k1 k1 = f(t, y2) k2 = f(t+0.5*h, y2+0.5*h*k1) ...
"""Const for conversation integration.""" DOMAIN = "conversation" DEFAULT_EXPOSED_DOMAINS = { "climate", "cover", "fan", "humidifier", "light", "lock", "scene", "script", "sensor", "switch", "vacuum", "water_heater", }
from functions import * from unicurses import * class missile: def __init__(self, foreground=None, background=None, attribute=0): self.min_y = self.y - 7 self.window_missile = newwin(1, 1, self.y, self.x) box(self.window_missile) waddstr(self.window_missile, self.body) se...
# -*- coding: utf-8 -*- from flask import Flask, render_template, url_for, request, send_from_directory, jsonify, json import sys, math, re, os # import from folder "python" module "postprocessor" (in "python" folder mast be empty file "__init__.py") import python.postprocessor as postprocessor import python.haas as ...
from dataclasses import dataclass @dataclass class coordinates(object): """data class for image object coordinates""" x: int y: int w: int h: int
# Source: https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/gym/pybullet_envs/baselines/enjoy_kuka_diverse_object_grasping.py import os, inspect import numpy as np import math currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(os.pa...
"""Copyright 2016 Dana-Farber Cancer Institute""" import pandas as pd import logging logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s', ) def add_sort_order(trial_match_df): """ Aggregate all the trial matches by MRN and provide a sort order using the following logic: (1) Firs...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from import_export import resources from .models import Program, Category,Location from import_export.admin import ImportExportModelAdmin from mptt.admin import MPTTModelAdmin class ProgramResource(resources.ModelResou...
import FWCore.ParameterSet.Config as cms from RecoTracker.PixelTrackFitting.pixelTracks_cfi import pixelTracks as _pixelTracks from RecoTauTag.HLTProducers.trackingRegionsFromBeamSpotAndL2Tau_cfi import trackingRegionsFromBeamSpotAndL2Tau # Note from new seeding framework migration # Previously the TrackingRegion was...
import pygame import random pygame.init() colors = { 'WHITE': (255,255,255), 'BLUE': (0, 0, 255), 'GREEN': (0,255,0), 'RED': (255, 0, 0), 'BLACK': (0, 0, 0) } clock = pygame.time.Clock() display_width = 1024 display_height = 768 FPS = 60 font = pygame.font.SysFont("calibri", 32, bold=True) bor...
from nltk.tokenize import TweetTokenizer from sklearn.base import BaseEstimator, TransformerMixin class Tokenizer(BaseEstimator, TransformerMixin): def __init__(self, preserve_case=True, strip_handles=True, reduce_len=True): self.preserve_case = preserve_case self.reduce_len = reduce_len ...
class MyQueue(object): def __init__(self): """ Initialize your data structure here. """ self.queue = list() def push(self, x): """ Push element x to the back of queue. :type x: int :rtype: None """ self.queue.append(x) def po...
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description': 'A first skeleton project', 'author': 'Fred Bellinder', 'url': 'URL to deployed project', 'download_url': 'link', 'author_email': 'fred.goteborg@gmail.com', 'version': '0.1',...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Sergey Sobko' __email__ = 'S.Sobko@profitware.ru' __copyright__ = 'Copyright 2015, The Profitware Group' from math import fabs, floor, sin from struct import pack, unpack class dword(int): def __or__(self, other): return dword((int(self) | (oth...
from pbge.dialogue import Reply,Cue,ContextTag from . import context ACCEPTMISSION_JOIN = Reply( "[ACCEPT_MISSION:JOIN]" , context = ContextTag([context.ACCEPT,context.MISSION]), destination = Cue( ContextTag([context.JOIN]) ) ) ACCEPTMISSION_GOODBYE = Reply( "[ACCEPT_MISSION:GOODB...