text
string
size
int64
token_count
int64
# Convenience test module to run all of the XML-related tests in the # standard library. import sys import test.test_support test.test_support.verbose = 0 def runtest(name): __import__(name) module = sys.modules[name] if hasattr(module, "test_main"): module.test_main() runtest("test.test_minidom...
497
189
import pytest import os import memcnn.experiment.factory from memcnn.config import Config def test_get_attr_from_module(): a = memcnn.experiment.factory.get_attr_from_module('memcnn.experiment.factory.get_attr_from_module') assert a is memcnn.experiment.factory.get_attr_from_module def test_load_experiment_...
1,275
470
""" @file: test_search_serial_port.py @author: Futa HIRAKOBA @brief: search_serial_port.pyใฎใ‚’ใƒ†ใ‚นใƒˆใ™ใ‚‹ใƒ—ใƒญใ‚ฐใƒฉใƒ  """ from search_serial_port import search_com_ports, search_enabled_com_port def test_search_com_ports(): search_com_ports() def test_search_enabled_com_port(): search_enabled_com_port()
303
121
print("---CONVERSรƒO DE MEDIDAS---") valor_metros = float(input("Informe o valor em metros ร  ser convertido: ")) valor_centimetros = valor_metros * 100 print("{} metros equivale a {} centimetros.".format(valor_metros, valor_centimetros))
238
86
from pyparsing import ParseException from easymql.exc import EasyMQLSyntaxError from easymql.pipeline import Pipeline, encode class EasyMQL: def parse(self, query_string): try: return encode(Pipeline.parse(query_string, explode=False)) except ParseException as e: raise Eas...
385
118
import requests import json def getguild(guild_id): guild_id = str(guild_id) http_response = requests.get(f'https://discord.com/api/guilds/{guild_id}/widget.json') response_data = http_response.json() data = json.dumps(response_data) return data
266
95
# Generated by Django 3.1.3 on 2021-01-22 02:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('server', '0010_auto_20210122_0054'), ] operations = [ migrations.AlterField( model_name='sensorvalue', name='value',...
409
152
"""p2 core tasks""" from p2.core.celery import CELERY_APP from p2.lib.reflection import path_to_class @CELERY_APP.task(bind=True) def signal_marshall(self, signal, args=None, kwargs=None): """Run signal in task worker""" if not args: args = [] if not kwargs: kwargs = {} # Lookup PK to ...
683
229
import pytest import numpy as np import itertools from numpy.testing import assert_allclose from keras_contrib.utils.test_utils import layer_test, keras_test from keras.utils.conv_utils import conv_input_length from keras import backend as K from keras_contrib import backend as KC from keras_contrib.layers import conv...
4,463
1,434
"""Holds the luigi tasks which count the number of rows in the files Records the number of clean and dirty rows in the AIS data, writing these stats to the database and finally producing a report of the statistics 1. Count the number of rows in the raw csv files (in ``files/unzipped/<archive>``) 2. Count the number o...
8,131
2,332
############################################################################## # Copyright 2016-2017 Rigetti Computing # # 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...
1,917
575
#!/usr/bin/env python # license removed for brevity import rospy from std_msgs.msg import Float32 from megapi import * from makeblock_ros.srv import * bot = None def onRead(v): print("and here!") rospy.loginfo(v) pub.publish(v) def handle_makeblock_motors(req): global bot bot.motorRun(M1, req.s...
946
369
# Copyright (c) 2004, The Long Now Foundation # 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 o...
9,347
3,563
import copy, os from ansible import errors def expand_config(config_data): try: all_data = copy.deepcopy(expand_envs(config_data)) return all_data except Exception, e: raise errors.AnsibleFilterError( 'expand_config plugin error: {0}, config_data={1}'.format( str(e), ...
768
244
# Copyright 2021 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
2,514
891
# Copyright 2018 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 applica...
8,407
2,456
## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by ############################################################################ # # Author: Ruth HUEY, Michel F. SANNER # # Copyright: M. Sanner TSRI 2001 # ############################################################################# # $Header: /opt/cvs/pyt...
53,916
18,931
import numpy as np from simulation import simulation_code from tqdm import tqdm def make_length(arr,maxlen): dL = maxlen - len(arr) if dL > 0: newa = np.concatenate((arr, np.ones(dL)*arr[-1])) else: newa = arr return newa def make_equal_length(arr_list): maxlen = max([len(a) for ...
2,342
1,022
# Generated by Django 3.0.5 on 2020-05-24 10:19 import datetime import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0001_initial'), ] operations = [ migrations.Create...
5,480
1,322
import datetime s = '2018-12-31' d = datetime.date.fromisoformat(s) print(d) # 2018-12-31 print(type(d)) # <class 'datetime.date'> # print(datetime.date.fromisoformat('2018-12')) # ValueError: Invalid isoformat string: '2018-12' print(datetime.date.fromisoformat('2018-01-01')) # 2018-01-01 # print(datetime.date....
2,185
1,194
# -*- encoding: utf-8 -*- from .. import db from ._base_model import ModelSchema class HelloDB(db.Model, ModelSchema): """Use the Model to Establish a Connection to DB""" __tablename__ = "HelloDB" id = db.Column(db.Integer, primary_key = True, autoincrement = True, nullable = False) field = db.Co...
418
142
import numpy as np import matplotlib.pyplot as plt import cv2 import time def getTransformMatrix(origin, destination): x = np.zeros(origin.shape[0] + 1) # insert [0]-element for better indexing -> x[1] = first element x[1:] = origin[:,0] y = np.copy(x) y[1:] = origin[:,1] x_ = np.copy(x) x_[1...
3,069
1,339
import argparse import os import torch import torch.nn.functional as F from torch import nn from torch.optim.adamax import Adamax from multiobject.pytorch import MultiObjectDataLoader, MultiObjectDataset epochs = 100 batch_size = 64 lr = 3e-4 dataset_filename = os.path.join( 'dsprites', 'multi_dsprites_color...
4,219
1,431
import bpy import random import math ## ๅ›บๅฎšๅ€ค่จญๅฎš ############################################################# # ๅฎŸ่กŒใƒ•ใ‚กใ‚คใƒซใƒ‘ใ‚นไธ€่ฆง FILE_ROOT_PATH = 'D:/blender_battleVR_py/' setrendr_file_name = FILE_ROOT_PATH + "setting_render.py" magicobj_file_name = FILE_ROOT_PATH + "magic_model.py" fieldins_file_name = FILE_ROOT_PATH + "fie...
2,015
923
from django.test import TestCase import copy from django.contrib.auth import get_user_model from funds.models import Fund from genres.models import Genre from users.tests import UserCreateMethods from funds.tests import FundCreateMethods from users.tests import USER_SAMPLES, ADMIN_SAMPLES from funds.tests import F...
2,014
704
"""Hyperparameters from paper """ import numpy as np import torch.optim as optim from .model import DQN, DuelingDQN class AtariHyperparams: ALGO = "DQN" SEED = 2 LOG_DISPLAY_FREQ = 10 # Image sizing WIDTH = 84 HEIGHT = 84 # Number of most recent frames given as input to Q-network A...
4,881
1,892
#! python3 # -*- coding: utf-8 -*- """ Euler description from https://projecteuler.net/ Problem 0002 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibo...
822
335
""" Summarize a column total cases column and total deaths column Country by country data in columns, sum up and match global totals """ import csv import pandas pandas.set_option("display.max_rows", None, "display.max_columns", None) col_list = ["Total Cases", "Country/ Other", "Total Deaths", "# 9/27/2020"] df = p...
1,090
402
import operator def parse(op): dict[op[0]] = ops[op[1]](dict[op[0]], int(op[2])) maxs.append(max(dict.values())) def parser(exp): return ops[exp[1]](dict[exp[0]], int(exp[2])) def execute(op, exp): if parser(exp): parse(op) def initDictVars(arr): vars = set([x.split(' ')[0] for x in ...
908
362
import asyncpg from fastapi import FastAPI from loguru import logger from app.core.settings.app import AppSettings async def connect_to_db(app: FastAPI, settings: AppSettings) -> None: logger.info('Connecting to PostgreSQL') app.state.pool = await asyncpg.create_pool( str(settings.database_url), ...
667
199
#!/usr/bin/env python # coding=utf-8 # Python Script # # Copyleft ยฉ Manoel Vilela # # from __future__ import print_function """ Special Pythagorean triplet Problem 9 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, aยฒ + bยฒ = cยฒ For example, 3ยฒ + 4ยฒ = 9 + 16 = 25 = 52. There exists ...
912
379
""" Copyright (c) 2020 The Orbit Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. """ from absl import app from core.orbit_e2e import E2ETestSuite from test_cases.connection_window import FilterAndSelectFirstProcess, ConnectToStadiaInstanc...
1,248
409
from interrogatio.shortcuts.dialogs import * # noqa
52
18
from typing import Union import kfp from kfp.components import InputPath, OutputPath from skit_pipelines import constants as pipeline_constants def extract_tgz_archive( tgz_path: InputPath(str), output_path: OutputPath(str), ): import tarfile from loguru import logger logger.debug(f"Extracting...
609
203
import pytest from dagster import ( DagsterInvalidDefinitionError, InputDefinition, Nothing, Optional, composite_solid, execute_pipeline, execute_solid, lambda_solid, pipeline, ) def test_none(): @lambda_solid(input_defs=[InputDefinition("x", Optional[int], default_value=None)...
4,438
1,485
from .core import BaseBlock from .runner import Runner, create_runner
69
18
import math as m p=int(input("enter a prime integer p ")) q=int(input("enter a prime integer q ")) num=int(input("enter a number to encrypt ")) n=p*q z=(p-1)*(q-1) for e in range(2,z): if m.gcd(e,z)==1: break for i in range(1,10): x=1+i*z if x%e==0: d=int(x/e) break alpha=pow(num,e) ctt=alpha % n beta=pow(c...
473
237
import komand from .schema import RunInput, RunOutput # Custom imports below class Run(komand.Action): def __init__(self): super(self.__class__, self).__init__( name="run", description="Run command", input=RunInput(), output=RunOutput() ) def construct(self, func): func +...
831
258
from config.updateConfig import UpdateConfig sampleCONF = { "task": { "name": "sample", }, "instructions": { "text": "Give instructions", "startPrompt": "Press any key to continue. Press q to quit.", "alarm": "horn.wav", "questionnaireReminder": "answerQuestionnaire....
636
212
""" Copyright 2020 The OneFlow 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 applicable law or agr...
2,994
1,016
''' Created on Mar 30, 2019 @author: PIKU ''' def justSayHello(): print("Hello ...") def getHello(): return "Hello guys" if __name__ == '__main__': justSayHello() x = getHello() print(x)
237
105
from Evaluation_Metrics.Average_Precision import ElevenPointInterpolatedAP from Evaluation_Metrics.New_Metric import TP_FP def mean_AP(GT,PRED,TH): Rice_GT=GT[:,:,:,1] Weed_GT=GT[:,:,:,0] Rice_P=PRED[:,:,:,1] Weed_P=PRED[:,:,:,0] TP_R,FP_R=TP_FP(Rice_GT,Rice_P,TH) Acc_TPR=[] s=0 for i i...
1,090
532
def formstash_to_querystring(formStash): err = [] for (k, v) in formStash.errors.items(): err.append(("%s--%s" % (k, v)).replace("\n", "+").replace(" ", "+")) err = sorted(err) err = "---".join(err) return err class _UrlSafeException(Exception): @property def as_querystring(self): ...
5,001
1,565
#!/usr/bin/env python3 import sys offset_table = [] def get_freq(a): v = {} for i in a: if i in v: v[i] += 1 else: v.update({i: 1}) return v def process_file(filename): freq = {} a = [] median = 0 with open(filename, "r") as f: a = f.read...
771
329
#! /usr/bin/env python3 import os import sys PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(os.path.join(PARENT_DIR, 'generated')) sys.path.append(os.path.join(PARENT_DIR, 'helper_functions')) import argparse import json import logging import logging.config import inspect, tim...
18,212
4,950
from enum import Enum class CardType(Enum): ATTACK = 1 SKILL = 2 POWER = 3 STATUS = 4 CURSE = 5 class CardRarity(Enum): BASIC = 1 COMMON = 2 UNCOMMON = 3 RARE = 4 SPECIAL = 5 CURSE = 6 class Card: def __init__(self, card_id, name, card_type, rarity, upgrades=0, has_...
1,534
539
from typing import TypedDict class ILineFlowSumm(TypedDict): inst: dict maxFlow: dict maxTime: dict
114
39
import os import random import numpy as np import torch from chatbot_agent.nlu import BERTNLU from chatbot_agent.policy.rule import RulePolicy from chatbot_agent.nlg import TemplateNLG from chatbot_agent.agent import PipelineAgent from chatbot_agent.analyzer import Analyzer def set_seed(r_seed): random.seed(r_se...
1,280
494
from insights.parsers.zipl_conf import ZiplConf from insights.tests import context_wrap from insights.parsers import ParseException import pytest ZIPL_CONF = """ [defaultboot] defaultauto prompt=1 timeout=5 default=linux target=/boot [linux] image=/boot/vmlinuz-3.10.0-693.el7.s390x ramdisk=/boot/initramfs-3.10...
3,027
1,504
import asyncio import os import signal import tomodachi from typing import Any, Dict, Tuple, Callable, Union # noqa from aiohttp import web from tomodachi.transport.http import http, http_error, http_static, websocket, Response, RequestHandler from tomodachi.discovery.dummy_registry import DummyRegistry async def mi...
6,560
2,132
import eventlet import errno import logging import traceback import mimetools import resource import json import os import sys import argparse from eventlet import wsgi from eventlet.green import socket from .actions import Unknown, Proxy, Empty, Static, Redirect, NoHosts, Spin from .config import SimpleConfig from .ma...
13,624
3,867
# -*- coding: utf-8 -*- # Copyright ยฉ 2018 PyHelp Project Contributors # https://github.com/jnsebgosselin/pyhelp # # This file is part of PyHelp. # Licensed under the terms of the GNU General Public License. # ---- Standard Library Imports import os import os.path as osp # ---- Third Party imports import numpy as ...
18,989
6,387
from decimal import Decimal import pytest from bson import Decimal128 from momapper import MappedClass, Field from momapper.mongodb.collection import MappedCollection from momapper.types import ( DecimalType, ValidationError, IntType, FloatType, StringType, ByteType, BoolType, ListType...
6,131
1,828
import deepleaps.ipc.RunningCommand
36
13
import ctypes as ct import time import copy import numpy as np import sharpy.aero.utils.mapping as mapping import sharpy.utils.cout_utils as cout import sharpy.utils.solver_interface as solver_interface import sharpy.utils.controller_interface as controller_interface from sharpy.utils.solver_interface import solver, ...
26,878
7,757
from __future__ import absolute_import, print_function, division import unittest from pony.orm.core import * from pony.orm.core import local from pony.orm.tests.testutils import * from pony.orm.tests import setup_database, teardown_database class TestGeneratorDbSession(unittest.TestCase): def setUp(self): ...
4,734
1,494
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2018-01-05 01:20 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('private_sharing', '0007_auto_20171220_2038'), ] operations = [ migrations.CreateMod...
725
240
# coding: utf-8 """ Test Pyleecan optimization module using Zitzlerโ€“Debโ€“Thiele's function N. 3 """ import pytest from ....definitions import PACKAGE_NAME from ....Tests.Validation.Machine.SCIM_001 import SCIM_001 from ....Classes.InputCurrent import InputCurrent from ....Classes.MagFEMM import MagFEMM from ....Classes...
5,759
2,093
""" @Time : 12/4/2020 13:57 @Author : Young lee @File : import_lib @Project : machine_learning_in_action """ import collections import math import os import random import sys import tarfile import time import zipfile import operator from IPython import display from matplotlib import pyplot as plt import numpy a...
325
103
from htmlparser import HTMLParser import pandas # Here we scrap a page from Wikipedia, parse it for tables, and convert the first table found into a `pandas.DataFrame`. url = "https://en.wikipedia.org/wiki/List_of_S%26P_500_companies" hp = HTMLParser(url) # scrapping the webpage page = hp.scrap_url() # extracting only...
590
186
from django.db import models # https://stackoverflow.com/questions/1737017/django-auto-now-and-auto-now-add/1737078#1737078 from {{project_name}}.common.enums import PersonSexEnum class TimeStampedModel(models.Model): """ Defines a timestamped model with create_date (auto_now_add) and update_date (auto_now) ...
2,099
696
from typing import Union, List import pika import pika.exceptions import time import logging def CreateDurableQueue(channel: pika.adapters.blocking_connection.BlockingChannel, queue: str, settings: dict = None): if settings is None: settings = {} channel.queue_declare(queue, ...
4,881
1,279
# # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) # This module is free software, and you may redistribute it and/or modify # under the same terms as Python, so long as this copyright message and # disclaimer are retained in their original form. # # IN NO EVENT SHALL BIZAR SOFTWARE PTY LT...
16,087
4,317
"""solution.py""" # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: """ T: O(?) S: O(?) """ l3 = ListNode(0) ...
1,467
536
# Copyright 2015 Mellanox Technologies, 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 agreed t...
1,984
699
#!/bin/python3 import math import os import random import re import sys # Complete the plusMinus function below. def plusMinus(arr): ''' There is probably a better solution than this but this would be the trivial solution, and it is successful. ''' pos, neg, zero = 0, 0, 0 size = len(arr)...
679
230
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_parse, compat_urllib_request, ) from ..utils import ( ExtractorError, encode_dict, int_or_none, ) class GorillaVidIE(InfoExtractor): IE_DESC = 'Gor...
4,273
1,656
# Copyright 2013 by Kai Blin. # Revisions copyright 2015 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. import unittest import warnings from os import path from Bio import BiopythonP...
7,552
2,496
import os import tensorflow.keras.backend as K from dataflow import ( BatchData, RepeatedData, MultiProcessRunnerZMQ) from tensorflow.keras.callbacks import Callback, ReduceLROnPlateau, ModelCheckpoint, TensorBoard from tensorflow.keras.callbacks import LearningRateScheduler from .modelcheckpoint import CustomMod...
6,618
2,163
import turtle import math from time import sleep def calculate_points(pos, r1, r2, angles): points = [] for a in angles: x = pos[0] + (r1 * math.cos(math.radians(a))) y = pos[1] + (r2 * math.sin(math.radians(a))) points.append((x, y)) return points def draw_pyramid(tur, draw=False)...
1,570
679
# vim:set ts=4 sw=4 et: ''' Config ====== ''' import re from .action_mapper import Action from .checks_list import Checks from .exceptions import ConfigurationException class Config(object): """The :class:`Config` class is responsible for storing application groups and policies read from the datastore. ...
5,791
1,501
# Generated by Django 2.0.2 on 2018-02-17 12:17 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('printapp', '0001_initial'), ] operations = [ migrations.AlterField( model_name='historybayar', name=...
1,039
328
# -*- coding: utf-8 -*- """ @author: Fredrik Wahlberg <fredrik.wahlberg@it.uu.se> """ import requests import json import os.path import re class Waller(): def __init__(self, datapath, verbose=False): super(Waller, self).__init__() self.reprname = "Waller" assert os.path.exists(datapath), ...
7,569
2,188
""" Here are two different functions used for common data cleaning tasks. You can use these functions to load data into a pandas Dataframe. """ import numpy as np import pandas as pd from sklearn.utils import shuffle class CleanData: def __init__(self): """ This init function instanti...
701
189
# --------------------------------------------------------------------- # crm.supplierprofile application # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- #...
870
228
from random import shuffle NUM_DIGIT = 3 MAX_GUESSES = 10 def main(): # main game print( f""" Bagels, a detective logic game. By Ibrahim raimi I am thinking of a number {NUM_DIGIT} number with no repeted digits. Try to guess what it is. Here re some clues: When i ...
2,849
849
# encoding: utf-8 __author__ = 'Aleksei Maliutin' """ unique_signatures.py Created by lex at 2019-03-28. """ import pandas as pd from NetEmbs.CONFIG import N_DIGITS def get_signature(df: pd.DataFrame) -> pd.Series: """ Aggregation function over GroupBy object: to extract unique signature for the given busines...
2,652
863
#$Id$# from books.util.ZohoHttpClient import ZohoHttpClient from books.parser.RecurringInvoiceParser import RecurringInvoiceParser from .Api import Api from json import dumps base_url = Api().base_url + 'recurringinvoices/' parser = RecurringInvoiceParser() zoho_http_client = ZohoHttpClient() class RecurringInvoice...
6,008
1,803
"""Define the django settings for a local setup.""" from .base import * # noqa # SECURITY WARNING: don't run with debug turned on in production! # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = True TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # SECURITY WARNING: keep the secret key used in produ...
661
228
#!/usr/bin/env python import os import argparse import sqlite3 from glob import glob import pandas as pd parser = argparse.ArgumentParser() parser.add_argument('--gtex-models-dir', type=str, required=True) parser.add_argument('--variants-file-with-gtex-id', type=str, required=True) parser.add_argument('--output-file...
1,457
543
""" Define authorization predicates. These are functions which accept an `Identity` object and a context object and return a truthy value. These represent building blocks of our permission map which define when people do, or don't have permissions. For example a predicate might define "group_created_by_user" which is...
5,676
1,647
# coding=utf-8 from planing_tool.models.plazas import State, Country, City from django.contrib.gis.db.models import PointField from datetime import datetime, timedelta from libs.currency_utils import CurrencyUtils from django.contrib.gis.db.models.manager import GeoManager from django.db import models from simple_histo...
3,325
1,144
import os import tensorflow as tf from util import masked_softmax class PolicyNetwork(object): """ Policy Function approximator. """ def __init__(self, input_size, output_size, learning_rate=0.001, summaries_dir=None, scope="policy_estimator"): with tf.variable_scope(scope): # Writes Tens...
8,346
2,642
import os import sys import gc import ctypes import psutil import pytest import warnings import threading from time import sleep from multiprocessing import util, current_process from pickle import PicklingError, UnpicklingError from distutils.version import LooseVersion import loky from loky import cpu_count from lok...
32,111
9,633
# โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— # โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ # โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ # โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ # โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— # โ•šโ•โ• โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ• โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ• โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ• # Copyrigh...
3,781
1,782
# From the future from __future__ import absolute_import # Python imports import os import copy import logging from hashlib import sha1 from shutil import rmtree from functools import partial, wraps # Dulwich imports from dulwich.repo import Repo as DulwichRepo from dulwich.client import get_transport_and_path from d...
34,597
10,342
# fpsAllFrameRead = open("profileAllFrame.txt", "r") # profileDataReadList =[] # t = [] # for line in fpsAllFrameRead.readlines(): # profileDataReadList.append(line) # # for line in profileDataReadList: # splitByComma = line.split(",") # l = len(splitByComma) # print str(l) a = 34.4/(1000/60) print str...
992
421
from django.urls import include, path, re_path from . import views from django.contrib.auth.views import ( login, logout, password_reset, password_reset_done, password_reset_confirm, password_reset_complete, ) app_name = 'core' urlpatterns = [ path('', views.Home...
452
147
#!/usr/bin/env python # -*- coding: utf-8 -*- """temp_convert.py: Convert temperature F to C.""" # initialize looping variable, assume yes as first answer continueYN = "Y" while continueYN.upper() == "Y": # get temperature input from the user, and prompt them for what we expect degF = int(raw_input("Enter te...
745
250
#!/usr/bin/env python from os.path import join, realpath import sys; sys.path.insert(0, realpath(join(__file__, "../../../../../"))) import conf from hummingbot.connector.exchange.wazirx.wazirx_api_order_book_data_source import WazirxAPIOrderBookDataSource from hummingbot.connector.exchange.wazirx.wazirx_user_stre...
2,197
760
from setuptools import setup, find_packages setup(name='getDB', version='0.0.4', description="This module can be used to download HMDB and KEGG database.", license='MIT', author='Xiaotao Shen', author_email='shenxt1990@163.com', url='https://github.com/jaspershen/getDB', long_...
597
188
""" modified from sparsify.py file. This file gnerate angle map of [H=64,W=1024,4] from velodyne lidar bins To run this: python3 pts2angmap.py --calib_path '/root/gdrive/My Drive/PointRCNN/data/KITTI/object/training/calib/'\ --image_path '/root/gdrive/My Drive/PointRCNN/data/KITTI/object/training/image_2/' ...
7,706
2,951
# -*- coding: utf-8 -*- import sys import urllib from bsdconv import Bsdconv def bsdconv01(dt): dt=dt.lstrip("0").upper() if len(dt) & 1: return "010"+dt else: return "01"+dt def bnf(s): return ",".join([bsdconv01(x) for x in s.strip().split(" ")]) iotest=[ ["big5:utf-8","\xa5\x5c\x5c\xaf\xe0","ๅŠŸ\่ƒฝ"], ["b...
13,481
8,597
import tarfile import click import requests from odc.io.tar import tar_mode, add_txt_file from multiprocessing.dummy import Pool as ThreadPool from functools import partial from urllib.parse import urlparse from thredds_crawler.crawl import Crawl def download(url): parsed_uri = urlparse(url) target_filename ...
2,488
864
DATA_S3 = "bioanalyze-ec2-test-nf-rnaseq-06o3qdtm7v" JOB_S3 = DATA_S3 # These come from the terraform code in auto-deployment/terraform ECR = "dabbleofdevops/nextflow-rnaseq-tutorial" COMPUTE_ENVIRONMENT = "bioanalyze-ec2-test-nf-rnaseq" JOB_DEF_NAME = "bioanalyze-ec2-test-nf-rnaseq" JOB_QUEUE_NAME = "bioanalyze-ec2-...
599
304
#!/usr/bin/env python """ Example: $ python ./ncdf2bp.py netcdf_file """ from adios import * from scipy.io import netcdf import numpy as np import sys import os import operator def usage(): print os.path.basename(sys.argv[0]), "netcdf_file" if len(sys.argv) < 2: usage() sys.exit(0) ##fname = "MERRA100....
4,067
1,499
import logging import re from airflow.hooks import HiveCliHook from airflow.models import BaseOperator from airflow.utils import apply_defaults class HiveOperator(BaseOperator): """ Executes hql code in a specific Hive database. :param hql: the hql to be executed :type hql: string :param hive_cl...
2,322
774
import os import yaml import segmentation_models_pytorch as smp import torch import argparse import torch.nn as nn import timm from model_wrapper import Classification_model def prepare_model(opt): with open(opt.hyp) as f: experiment_dict = yaml.load(f, Loader=yaml.FullLoader) model_pretrained = timm.c...
1,042
330
from requests import get from utils.TwitterService import TwitterService import tweepy from decouple import config def get_tweets_with_location_and_query(search_params): """ Searches all tweets that are in the given location and contains a query string. """ if 'geocode' not in search_params: return {'...
8,259
2,567
# Required imports import os import sys import serial import time sys.path.append(os.path.dirname(os.path.expanduser('~/projects/Python-Playground/Debug'))) # Update path accordingly from Debug.Debug import Debug # Declare debug debug = Debug(True, 3).prt # Simplifies debugging messages # Message building blocks RW...
4,511
1,315