content
stringlengths
0
894k
type
stringclasses
2 values
from . import Plugin class CatchallPlugin(Plugin): priority = -5 """ Turns metrics that aren't matched by any other plugin in something a bit more useful (than not having them at all) Another way to look at it is.. plugin:catchall is the list of targets you can better organize ;) Note that the ass...
python
import sys import logging import numpy as np import sympy as sp import ANNarchy_future.api as api import ANNarchy_future.parser as parser class Symbol(sp.core.Symbol): """Subclass of sp.core.Symbol allowing to store additional attributes. """ def __new__(self, name, method='euler'): obj = sp.co...
python
from juriscraper.OpinionSite import OpinionSite from datetime import datetime import re class Site(OpinionSite): def __init__(self, *args, **kwargs): super(Site, self).__init__(*args, **kwargs) self.court_id = self.__module__ self.url = "http://www.courts.state.va.us/scndex.htm" def _...
python
from django.conf.urls import patterns, include, url from django.contrib import admin from core.views import JobList, JobDetail, JobCreate admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'emplea_do.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', J...
python
import RPi.GPIO as GPIO import time from pathlib import Path import os import sys relay_signal = 4 # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(relay_signal, GPIO.OUT) # pulls the signal pin high signalling the relay switch to close def garage_btn_down(pin): GPIO.output(pin, GPIO.HIGH) # Close OSC # pulls ...
python
# Common libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Restrict minor warnings import warnings warnings.filterwarnings('ignore') # Import test and train data df_train = pd.read_csv('../input/train.csv') df_Test = pd.read_csv('../input/test.csv') df_test = df_...
python
# -*- coding: utf-8 -*- """ Gromov-Wasserstein transport method =================================== """ # Author: Erwan Vautier <erwan.vautier@gmail.com> # Nicolas Courty <ncourty@irisa.fr> # # License: MIT License import numpy as np from .bregman import sinkhorn from .utils import dist ...
python
# coding: utf-8 """ Cloudbreak API Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud...
python
"""initialize the connection and wait for a message directed at it""" from irc import * from decision import * import os import random channel = "#bitswebteam" server = "irc.freenode.net" nickname = "EisBot" irc = IRC() irc.connect(server, channel, nickname) while 1: text = irc.get_text() ...
python
import pickle import argparse import cv2 from tqdm import tqdm from lib.config import Config def parse_args(): parser = argparse.ArgumentParser(description="Tool to generate qualitative results videos") parser.add_argument("--pred", help=".pkl file to load predictions from") parser.add_argument("--cfg",...
python
# Copyright (c) 2008, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of co...
python
#!/usr/bin/env python """ Copyright (c) 2018 Keitaro AB Use of this source code is governed by an MIT license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT. """ """ Executable module for checking github version updates for repositories from repositories.txt and alerting the slack ch...
python
from enum import Enum class Order(Enum): ASC = "ASC" DESC = "DESC" class DatabaseType(Enum): PSYCOPG2 = "PSYCOPG2" SQLITE3 = "SQLITE3" class Fetch(Enum): ONE = "ONE" ALL = "ALL"
python
# -*- coding:utf-8 -*- import threading local_value = threading.local() def test_put_thread(value): local_value.value = value test_read_thread() def test_read_thread(): print(local_value.value + " in thread: %s" % threading.current_thread().name) t1 = threading.Thread(target=test_put_thread, args=("张...
python
from flask import (Blueprint, render_template, redirect, request, url_for, abort, flash) from itsdangerous import URLSafeTimedSerializer from app import app, models, db from app.models import Survey, SurveyOptions from app.forms import survey as survey_forms from sqlalchemy import func # Create a su...
python
# coding: utf-8 import os import sys from threading import Thread sys.path.append(os.path.join(os.path.dirname(__file__), '../util')) from pluginbase import PluginBase class NotifierBase(PluginBase): def __init__(self): self.modtype = 'notifier' super().__init__() def start_notification(sel...
python
# -*- coding: utf-8 -*- # Copyright (c) 2017, FinByz Tech Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import add_days class TruckPartsInventory(Docum...
python
import pygame import json class Spritesheet: # Takes in Spritesheet file name. Assumes a png and a json file exist def __init__(self, filename): self.filename = filename self.sprite_sheet = pygame.image.load(filename).convert() self.meta_data = self.filename.replace('png', 'js...
python
""" This configuration file contains common data for parametrizing various tests such as isotherms. """ PRESSURE_PARAM = [ (1, {}), # Standard return (100000, { 'pressure_unit': 'Pa' }), # Unit specified (0.128489, { 'pressure_mode': 'relative' }), # Mode relative (12.8489, { ...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import platform import sys if platform.system() != 'Linux': sys.exit(-1) from .killer import Killer from .utils import load_config parser = argparse.ArgumentParser(description='ssh key killer') parser.add_argument('-c', '--config', dest='config', m...
python
# coding: utf-8 ''' @Date : 2021-05-05 @Author : Zekang Li @Mail : zekangli97@gmail.com @Homepage: zekangli.com ''' import torch import string import torch.nn as nn from transformers import * SPECIAL_TOKENS = ["<bos>", "<eos>", "<info>", "<speaker1>", "<speaker2>", "<empty>", "<pad>"] SPECIAL_TOKENS_...
python
import os import json, decimal import boto3 from boto3.dynamodb.conditions import Key, Attr tableName = os.environ.get('ACCESS_TABLE_NAME') def handler(event, context): client = boto3.resource('dynamodb') table = client.Table(tableName) print(table.table_status) print(event) username = event['requestCont...
python
A_0219_9 = {0: {'A': 0.2420334938061355, 'C': -0.12964532145406094, 'E': -0.30716253311729963, 'D': -0.20136070573849837, 'G': 0.09315559829464488, 'F': 0.414085377622071, 'I': -0.11091042509341746, 'H': -0.40154576951031906, 'K': -0.11190222068525454, 'M': -0.16860437072777687, 'L': 0.20901824078912526, 'N': 0.0322878...
python
# from typing import Dict # import os # from unittest import TestCase, main # # import json # # from monolithcaching import CacheManager # # # class TestCacheManager(TestCase): # # @staticmethod # def get_meta_data(meta_data_path: str) -> Dict: # with open(meta_data_path) as json_file: # met...
python
def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ traversal1 = l1 traversal2 = l2 dummy = head = ListNode(0) carry = 0 while traversal1 != None or traversal2 != None or carry != 0: i...
python
# coding=utf-8 import json from common import constant from common import errcode from common.mylog import logger from dao.question.question_dao import QuestionDao from dao.question.user_question_map_dao import UserQuestionMapDao from handlers.base.base_handler import BaseHandler from myutil import tools class GetQu...
python
import pytest from ethereum import tester from functools import ( reduce ) from fixtures import ( MAX_UINT, fake_address, token_events, owner_index, owner, wallet_address, get_bidders, fixture_decimals, contract_params, get_token_contract, token_contract, create_contr...
python
import progressbar def test_with(): with progressbar.ProgressBar(max_value=10) as p: for i in range(10): p.update(i) def test_with_stdout_redirection(): with progressbar.ProgressBar(max_value=10, redirect_stdout=True) as p: for i in range(10): p.update(i) def test_w...
python
#!/usr/bin/env python # # Copyright 2016 Steve Kyle. 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 require...
python
from .find_maximum_value_binary_tree import find_maximum_value, BST def test_find_maximum_value_tree_with_one_value(): one_value = BST([5]) assert find_maximum_value(one_value) == 5 def test_find_maximum_value_tree_with_two_values(): one_value = BST([10, 2]) assert find_maximum_value(one_value) == 1...
python
import matplotlib.pyplot as plt import networkx as nx import os import random import warnings from matplotlib.backends import backend_gtk3 from settings import OUTPUT_DIR warnings.filterwarnings('ignore', module=backend_gtk3.__name__) RESTART_PROBABILITY = 0.15 STEPS_MULTIPLIER = 100 def random_walk_sample(grap...
python
from collections import KeysView def find(iterable: list or KeysView, key=lambda x: x): for elem in iterable: if key(elem): return elem return None def index(iterable: list, key=lambda x: x) -> int: x = 0 for elem in iterable: if key(elem): return x x += 1 return -1
python
from django.apps import AppConfig class CalToolConfig(AppConfig): name = 'cal_tool'
python
# # # 0=================================0 # | Kernel Point Convolutions | # 0=================================0 # # # ---------------------------------------------------------------------------------------------------------------------- # # Callable script to start a training on Myhal...
python
#!/usr/bin/env python """Split large file into multiple pieces for upload to S3. S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux box images we need to use boto's multipart file support. This parallelizes the task over available cores using multiprocessing. Usage: s3_multipart_upload....
python
#!/usr/bin/env python # coding: utf-8 ################################################################################################### # # File : frame_study.py # # Auhtor : P.Antilogus # # Version : 22 Feb 2019 # # Goal : this python file read raw data image , and can be used for specific sensor diagnostic like : ...
python
#!/usr/bin/python # # Copyright 2012 Sonya Huang # # 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 ag...
python
class Solution(object): def lengthOfLongestSubstringTwoDistinct(self, s): """ :type s: str :rtype: int """ if not s: return 0 c = s[0] maxlen = 0 chars = set([c]) llen = 0 start = 0 end = 0 for i, cc in enume...
python
import sys from sqlalchemy import create_engine import pandas as pd import numpy as np import re from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import PorterStemmer, WordNetLemmatizer from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.mod...
python
#!/usr/bin/env python # -*- coding: utf-8 # Copyright 2017-2019 The FIAAS Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
python
# -*- coding: utf-8 -*- # # michael a.g. aïvázis <michael.aivazis@para-sim.com> # (c) 1998-2022 all rights reserved # support import qed # custom properties def selectors(default={}, **kwds): """ A map from selector names to their legal values """ # build the trait descriptor and return it retur...
python
#!/usr/bin/env python import numpy from numpy.random import RandomState from sklearn.datasets import make_friedman1 from sklearn.model_selection import train_test_split from typing import Union from backprop.network import Network _demo_problem_num_train_samples: int = 1000 _demo_problem_num_test_samples: int = 100 ...
python
# Copyright 2020 Board of Trustees of the University of Illinois. # # 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 ...
python
import numpy as np from mrcnn import utils def build_rpn_targets(image_shape, anchors, gt_class_ids, gt_boxes, config): """Given the anchors and GT boxes, compute overlaps and identify positive anchors and deltas to refine them to match their corresponding GT boxes. anchors: [num_anchors, (y1, x1, y2, x2)...
python
from django import forms from django.contrib import admin from django.utils.safestring import mark_safe from .models import Episode, ShowDate from .tasks import generate_peaks class ShowsCommonModelAdminMixin: save_on_top = True list_filter = ("published", "show_code") list_display_links = ("show_code", ...
python
""" Events emitted by the artist model """ from dataclasses import dataclass from typing import List, Optional from OpenCast.domain.event.event import Event, ModelId @dataclass class ArtistCreated(Event): name: str ids: List[ModelId] thumbnail: Optional[str] @dataclass class ArtistThumbnailUpdated(Eve...
python
from unittest import TestCase from lie2me import Field class CommonTests(object): def get_instance(self): return self.Field() def test_submitting_empty_value_on_required_field_returns_error(self): field = self.get_instance() field.required = True value, error = field.submit(f...
python
import os import sys from RLTest import Env from redisgraph import Graph, Node, Edge sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from base import FlowTestsBase redis_graph = None male = ["Roi", "Alon", "Omri"] female = ["Hila", "Lucy"] class testGraphMixLabelsFlow(FlowTestsBase): def __init__...
python
import io import logging from typing import List, Union LOG = logging.getLogger(__name__) class FileHelper: """Encapsulates file related functions.""" def __init__(self, filepath, line_idx, contents): self.filepath = filepath self.line_idx = line_idx self.contents = contents @cl...
python
#!/usr/bin/python import sys import tarfile import json import gzip import pandas as pd import botometer from pandas.io.json import json_normalize ## VARIABLE INITIATION #system argument # arg 1 = 'rs' or 'sn' # arg 2 = hour file 6,7 or 8 ? # arg 3 = start row # arg 4 = end row # arg 5 = key selection, 1,2,3,4 # sn 7...
python
from analyzers.utility_functions import auth from parsers.Parser import Parser class HthParser(Parser): __url = "https://fantasy.premierleague.com/api/leagues-h2h-matches/league/{}/?page={}&event={}" __HUGE_HTH_LEAGUE = 19824 def __init__(self, team_id, leagues, current_event): super().__init__(t...
python
import numpy as np from math import log2 from scamp_filter.Item import Item as I from termcolor import colored def approx(target, depth=5, max_coeff=-1, silent=True): coeffs = {} total = 0.0 current = 256 for i in range(-8, depth): if total == target: break ...
python
########################################################### # Re-bindings for unpickling # # We want to ensure class # sage.modular.congroup_element.CongruenceSubgroupElement still exists, so we # can unpickle safely. # ########################################################### from sage.modular.arithgroup.arithgroup...
python
"""Impementation for print_rel_notes.""" def print_rel_notes( name, repo, version, outs = None, setup_file = "", deps_method = "", toolchains_method = "", org = "bazelbuild", changelog = None, mirror_host = None): tarball_name = ":%s-%...
python
#!/usr/bin/env python # Run VGG benchmark series. # Prepares and runs multiple tasks on multiple GPUs: one task per GPU. # Waits if no GPUs available. For GPU availability check uses "nvidia-smi dmon" command. # 2018 (C) Peter Bryzgalov @ CHITECH Stair Lab import multigpuexec import time import os import datetime #...
python
from distutils.core import Extension, setup import numpy as np setup( name="numpy_ctypes_example", version="1.0", description="numpy ctypes example", author="Mateen Ulhaq", author_email="mulhaq2005@gmail.com", maintainer="mulhaq2005@gmail.com", url="https://github.com/YodaEmbedding/experim...
python
""" Copyright 2015 Paul T. Grogan, Massachusetts Institute of Technology 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 applicabl...
python
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # pylint: ...
python
from utils.QtCore import * class CustomAddCoinBtn (QPushButton): def __init__( self ): super().__init__() self.setCursor(Qt.PointingHandCursor) self.setText('Add coin') self.setObjectName('add_coin_btn') self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.P...
python
from typing import Callable, List import numpy as np from qcodes.instrument.base import Instrument from qcodes.instrument.parameter import Parameter from qcodes.instrument.channel import InstrumentChannel, ChannelList from qcodes.utils import validators as vals from .SD_Module import SD_Module, keysightSD1, Signadyne...
python
# -*- coding: utf-8 -*- from urllib import request import sys, os import time, types, json import os.path as op import win32api, win32con, win32gui # default_encoding = 'utf-8' # if sys.getdefaultencoding() != default_encoding: # reload(sys) # sys.setdefaultencoding(default_encoding) TRY_TIMES = 1 DEFA...
python
from django.shortcuts import render from django.urls import reverse, reverse_lazy from django.views.generic import ListView, DetailView, DeleteView from django.views.generic.edit import CreateView, UpdateView from django.contrib.auth.mixins import PermissionRequiredMixin from .models import AdvThreatEvent, NonAdvThrea...
python
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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.apac...
python
import os from optparse import make_option from django.core.management import call_command, BaseCommand from django.conf import settings from fixture_generator.base import get_available_fixtures from django.db.models.loading import get_app class Command(BaseCommand): """ Regenerate fixtures for all applicatio...
python
# coding: utf-8 # Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department # Distributed under the terms of "New BSD License", see the LICENSE file. """ Builtin tools that come with pyiron base. """ from abc import ABC from pyiron_base.job.factory import JobFactory __...
python
# -*- coding: utf-8 -*- from yandex_checkout import ReceiptItem from yandex_checkout.domain.common.receipt_type import ReceiptType from yandex_checkout.domain.common.request_object import RequestObject from yandex_checkout.domain.models.receipt_customer import ReceiptCustomer from yandex_checkout.domain.models.settlem...
python
# Copyright 2020 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, ...
python
from flaky import flaky from .. import SemparseTestCase from allennlp.models.archival import load_archive from allennlp.predictors import Predictor class TestAtisParserPredictor(SemparseTestCase): @flaky def test_atis_parser_uses_named_inputs(self): inputs = {"utterance": "show me the flights to seat...
python
# Generated by Django 3.2.3 on 2021-05-29 21:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('discordbot', '0021_auto_20210529_2045'), ] operations = [ migrations.AddField( model_name='member', name='settings',...
python
# Author: Jintao Huang # Time: 2020-5-24 import torch.nn as nn from .utils import FrozenBatchNorm2d default_config = { # backbone "pretrained_backbone": True, "backbone_norm_layer": nn.BatchNorm2d, "backbone_freeze": ["conv_first", "layer1", "layer2"], # "backbone_freeze": [""], # freeze backbone...
python
# TOO EASY T = int(input()) for _ in range(T): lower, upper = map(int, input().split()) n = int(input()) # a < num <= b for _ in range(n): mid = (lower+upper)//2 print(mid) res = input() if res == "TOO_SMALL": lower = mid + 1 elif res == "TOO_BIG": ...
python
# -*- coding: utf-8 -*- from odoo import _, api, fields, models class Trainer(models.Model): _name = "bista.trainer" _description = "Bista Training Management System - Trainer" _rec_name = "name" profile_image = fields.Binary(string="Profile Image", attachement=True) first_name = fields.Char(str...
python
#coding: utf-8 #!python3 # 5) Solicite o preço de uma mercadoria e o percentual de desconto. Exiba o valor do desconto # e o preço a pagar: p_produto = float(input('Valor produto: ')) p_desconto = float(input('Percentual de desconto: ')) p_produto_atual = p_produto - (p_produto*p_desconto/100) print('Preço...
python
# Generated by Django 2.2.16 on 2020-10-02 08:37 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('routes', '0047_source_id_nullable'), ('routes', '0048_athlete_activities_imported'), ] operations = [ ]
python
#!/usr/bin/env python3 import unittest import numpy as np from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver def run_cruise_simulation(cruise, t_end=100.): man = Maneuver( '', duration=t_end, initial_speed=float(0.), lead_relevancy=True, initial_distance_lead=100, cruise_valu...
python
from __future__ import print_function from mmstage import MicroManagerStage
python
# Copyright: 2006-2011 Brian Harring <ferringb@gmail.com> # License: GPL2/BSD """ exceptions thrown by the MergeEngine """ __all__ = ("ModificationError", "BlockModification", "TriggerUnknownCset", ) class ModificationError(Exception): """Base Exception class for modification errors""" def __init__(sel...
python
# Generated by Django 2.1.7 on 2019-04-16 15:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('materials', '0068_auto_20190415_2140'), ] operations = [ migrations.RenameField( model_name='dataset', old_name='experimenta...
python
# -*- coding: utf-8 -*- """ flask_security.recoverable ~~~~~~~~~~~~~~~~~~~~~~~~~~ Flask-Security recoverable module :copyright: (c) 2012 by Matt Wright. :license: MIT, see LICENSE for more details. """ from flask import current_app as app from werkzeug.local import LocalProxy from werkzeug.securi...
python
import pandas as pd import numpy as np import os import matplotlib.pyplot as plt from sklearn.metrics import classification_report,accuracy_score,f1_score,precision_score,recall_score from scikitplot.metrics import plot_confusion_matrix class eval_metrics(): def __init__(self,targets,preds,classes): try: ...
python
#!/usr/bin/python # -*- coding: utf-8 -*- import unittest import itertools from saliency_map import * from utils import OpencvIo class GaussianPyramidTest(unittest.TestCase): def setUp(self): oi = OpencvIo() src = oi.imread('./images/fruit.jpg') self.__gp = GaussianPyramid(src) def t...
python
# MODULE: TypeRig / Core / Ojects # ----------------------------------------------------------- # (C) Vassil Kateliev, 2017-2020 (http://www.kateliev.com) # (C) Karandash Type Foundry (http://www.karandash.eu) #------------------------------------------------------------ # www.typerig.com # No warranties. By using ...
python
from pyomac.clustering.cluster_utils import ( ModalSet, IndexedModalSet, indexed_modal_sets_from_sequence, modal_sets_from_lists, modal_clusters, single_set_statistics, filter_clusters, plot_indexed_clusters )
python
# TextChart - Roll The Dice import pygwidgets from Constants import * class TextView(): def __init__(self, window, oModel): self.window = window self.oModel = oModel totalText = ['Roll total', ''] for rollTotal in range(MIN_TOTAL, MAX_TOTAL_PLUS_1): totalText.append(r...
python
""" Exercise 1 Write a function that takes a string as an argument and displays the letters backward, one per line. """ def backwards(word): x = len(word) - 1 while x >= 0: print(word[x]) x -= 1 backwards("hello")
python
# with open('./space.text', 'w') as message: # message.write('我是写入的数据\n') # message.write('我再写一段文字哦\n') # message.write('继续写入\n') with open('./space.text', 'a') as msg: msg.write('附加一段文字\n') msg.write('继续附加一段\n')
python
import modeli, dobi_zneske from bottle import * import hashlib # racunaje md5 import json,requests import pandas as pd secret = "to skrivnost je zelo tezko uganiti 1094107c907cw982982c42" def get_administrator(): username = request.get_cookie('administrator', secret=secret) return username def get_user(a...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys filepath = sys.argv[1] path, filename = os.path.split(filepath) filename, ext = os.path.splitext(filename) for i in os.listdir(os.getcwd()+'/'+path): file_i, ext = os.path.splitext(i) if i.startswith(filename+'_segmented') and ext == '.ttl': # ...
python
from datetime import datetime, timedelta import pendulum import prefect from prefect import task, Flow from prefect.schedules import CronSchedule import pandas as pd from io import BytesIO import zipfile import requests schedule = CronSchedule( cron="*/30 * * * *", start_date=pendulum.datetime(2021...
python
import ROOT as root qMap_Ag_C0_V0 = root.TProfile2D("qMap_Ag_C0_V0","qMap_Ag_C0 (V0)",52,0,52,80,0,80,0,0); qMap_Ag_C0_V0.SetBinEntries(3585,29768); qMap_Ag_C0_V0.SetBinEntries(3586,79524); qMap_Ag_C0_V0.SetBinEntries(3639,83953); qMap_Ag_C0_V0.SetBinEntries(3640,124982); qMap_Ag_C0_V0.SetBinEntries(3641,14345); qMap_...
python
from . import start_watcher def main(): start_watcher()
python
from .market import Market, TradeException import time import hmac import urllib.parse import urllib.request import requests import hashlib import config import database from datetime import datetime class PrivateBter(Market): url = "https://bter.com/api/1/private/" def __init__(self): super().__ini...
python
import rlkit.misc.hyperparameter as hyp from rlkit.launchers.launcher_util import run_experiment import os from rlkit.misc.asset_loader import sync_down def experiment(variant): from rlkit.core import logger demo_path = sync_down(variant['demo_path']) off_policy_path = sync_down(variant['off_policy_path'...
python
# Generated by Django 3.2.7 on 2021-09-27 02:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AlterField( model_name='profile', name='user_type', ...
python
# encoding: utf-8 """ route.py Created by Thomas Mangin on 2015-06-22. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ from exabgp.protocol.family import SAFI from exabgp.bgp.message.update.nlri.qualifier import RouteDistinguisher from exabgp.configurati...
python
'''This file provides editor completions while working on DFHack using ycmd: https://github.com/Valloric/ycmd ''' # pylint: disable=import-error,invalid-name,missing-docstring,unused-argument import os import ycm_core def DirectoryOfThisScript(): return os.path.dirname(os.path.abspath(__file__)) # We need to te...
python
from twisted.trial import unittest from signing.persistence import Persistence class PersistenceTests(unittest.TestCase): def setUp(self): self.persistence = Persistence() def test_set_get(self): d = self.persistence.set('somekey', 'somefield', 'somevalue') d.addCallback(lambda _: sel...
python
""" Module storing the `~halotools.sim_manager.CachedHaloCatalog`, the class responsible for retrieving halo catalogs from shorthand keyword inputs such as ``simname`` and ``redshift``. """ import os from warnings import warn from copy import deepcopy import numpy as np from astropy.table import Table from ..utils.pyt...
python
import unittest, os import cuisine USER = os.popen("whoami").read()[:-1] class Text(unittest.TestCase): def testEnsureLine( self ): some_text = "foo" some_text = cuisine.text_ensure_line(some_text, "bar") assert some_text == 'foo\nbar' some_text = cuisine.text_ensure_line(some_text, "bar") assert some_tex...
python
import math import numpy as np from utils.functions.math.coordinate_trans import coordinate_transformation_in_angle def circle_make(center_x, center_y, radius): ''' Create circle matrix(2D) Parameters ------- center_x : float in meters the center position of the circle coordinate x cen...
python