text
string
size
int64
token_count
int64
# 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, software # d...
1,687
512
# -*- coding: utf-8 -*- import numpy as np #import cmath as cm # Main parameters for window # 'record_every': number of time_steps one between two consecutive record events window_params = {'kernel': 'RK4','nstep_update_plot': 100, 'step_size': 0.01, 'array_size': 10000, 'streaming': True, 'record_state':False, ...
8,175
2,902
from multiprocessing import Pool import EnvEq as ee import numpy as np import itertools as it import os #parsing input into numpy arrays from input import * y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test]) p=np.array([p_o2,p_test]) mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]]) lam=np.a...
1,464
728
import csv import re import numpy as np thre = 1.5 # 要调整的参数,这个是阈值 iteration_num = 2 # 要调整的参数,这个是迭代次数 def KalmanFilter(z, n_iter=20): # 卡尔曼滤波 # 这里是假设A=1,H=1的情况 # intial parameters sz = (n_iter,) # size of array # Q = 1e-5 # process variance Q = 1e-6 # process variance # allocate space...
4,495
2,041
from .analyzer import ProgpilotAnalyzer from .issues_data import issues_data analyzers = { 'phpanlyzer' : { 'name' : 'phpanalyzer', 'title' : 'phpanalyzer', 'class' : ProgpilotAnalyzer, 'language' : 'all', 'issues_data' : issues_data, }, }...
321
107
#!/usr/bin/env python import shutil, re, os, sys file_model = "Model.template" bookname = "TechNotes" file_bibtex = "thebib.bib" folder_target = "../pdf/" #if name is a chapter, return its sections def get_sections(name): if not os.path.isdir(name): return [] files = os.listdir(name) sections = ...
6,499
2,176
#!/usr/bin/env python # # Python Serial Port Extension for Win32, Linux, BSD, Jython # module for serial IO for POSIX compatible systems, like Linux # see __init__.py # # (C) 2001-2010 Chris Liechti <cliechti@gmx.net> # this is distributed under a free software license, see license.txt # # parts based on code from Gran...
24,252
8,375
import datetime from database import Base from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) first_name = Column(String(255)) last_name = Column(String(255)) email = Column(String(255), index...
2,272
677
import os import math import string import numpy as np import rospy import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, \ GaussianNoise, BatchNormalization import cv2 import collections import random import time from example_s...
4,724
1,520
from Kronos_heureka_code.Zeit.Uhrzeit import Uhrzeit, Stunde, Minute, Sekunde from Kronos_heureka_code.Zeit.Datum.Monat import Monate from Kronos_heureka_code.Zeit.Datum.Jahr import Jahr, Zeitrechnung from Kronos_heureka_code.Zeit.Datum.Tag import Tag
252
100
import logging def setup_logger(fname=None, silent=False): if fname is None: logging.basicConfig( level=logging.INFO if not silent else logging.CRITICAL, format='%(name)-12s: %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M', filemode='w' ) els...
845
267
# type: ignore from typing import Union, List, Dict from urllib.parse import urlparse import urllib3 from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute from pymisp.tools import GenericObjectGenerator import copy from pymisp.tools import FileObject from CommonServerPytho...
63,014
19,484
from bs4 import BeautifulSoup import os import wget from urllib.request import Request, urlopen bicycles=[{'name': 'Kron XC150 27.5 HD Bisiklet', 'link': 'https://www.epey.com/bisiklet/kron-xc150-27-5-hd.html'}, {'name': 'Corelli Trivor 3 Bisiklet', 'link': 'https://www.epey.com/bisiklet/corelli-trivor-3-0.html'}, {'...
19,936
9,105
from django.conf import settings from redminelib import Redmine as DefaultRedmine from .validator import RedmineInstanceValidator class Redmine(DefaultRedmine): def __init__(self, url=None, key=None): url = url or settings.REDMINE_BASE_URL key = key or settings.REDMINE_API_KEY super().__i...
956
278
import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.stats from finished_files.survey_data_dictionary import DATA_DICTIONARY # Load data # We want to take the names list from our data dictionary names = [x.name for x in DATA_DICTIONARY] # Generate the list of names to import usecols =...
3,212
1,105
import torch from torch.nn import functional as F from torch import nn from torch.autograd import Variable from adet.utils.comm import compute_locations, aligned_bilinear def dice_coefficient(x, target): eps = 1e-5 n_inst = x.size(0) x = x.reshape(n_inst, -1) target = target.reshape(n_inst, -1) in...
4,918
1,816
# Copyright 2016 Mirantis 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 writing,...
3,804
1,070
""" A simple wrapper for the Bongo Iowa City bus API. """ import requests as req class Bongo(object): """ A simple Python wrapper for the Bongo Iowa City bus API. """ def __init__(self, format='json'): self.format = format def get(self, endpoint, **kwargs): """Perform a HTTP GET...
2,569
750
import random import socket import string import sys import threading import time def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None: # Threading support thread_num = 0 thread_num_mutex = threading.Lock() # Utility function def print_status() -> None: global thre...
1,671
554
def default_evaluator(model, X_test, y_test): """A simple evaluator that takes in a model, and a test set, and returns the loss. Args: model: The model to evaluate. X_test: The features matrix of the test set. y_test: The one-hot labels matrix of the test set. ...
443
135
import random class Yolov3(object): def __init__(self): self.num=0 self.input_size=[8,16,32] def __iter__(self): return self def __next__(self): a = random.choice(self.input_size) self.num=self.num+1 if self.num<3: return a else: raise StopIteration yolo=Yolov3() for data in yolo: print(data)
319
146
import math import numpy as np import librosa from utils import hparams as hp from scipy.signal import lfilter import soundfile as sf def label_2_float(x, bits): return 2 * x / (2**bits - 1.) - 1. def float_2_label(x, bits): assert abs(x).max() <= 1.0 x = (x + 1.) * (2**bits - 1) / 2 return x.clip(0...
2,836
1,270
from getratings.models.ratings import Ratings class NA_Talon_Jng_Aatrox(Ratings): pass class NA_Talon_Jng_Ahri(Ratings): pass class NA_Talon_Jng_Akali(Ratings): pass class NA_Talon_Jng_Alistar(Ratings): pass class NA_Talon_Jng_Amumu(Ratings): pass class NA_Talon_Jng_Anivia(Ratings): pass ...
6,407
3,595
class TurkishText(): """Class for handling lowercase/uppercase conversions of Turkish characters.. Attributes: text -- Turkish text to be handled """ text = "" l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'] u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'] def __init__(self, text): self.te...
1,256
379
import googlemaps gmaps = googlemaps.Client(key='google_key') def get_markers(address): geocode_result = gmaps.geocode(address) return geocode_result[0]['geometry']['location']
188
63
from __future__ import absolute_import from __future__ import division from __future__ import print_function # Imports import os import numpy as np import tensorflow as tf def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128): """ Run the estimator """ if optimizer is None: optim...
3,427
1,184
""" Represents an app archive. This is an app at rest, whether it's a naked app bundle in a directory, or a zipped app bundle, or an IPA. We have a common interface to extract these apps to a temp file, then resign them, and create an archive of the same type """ import abc import biplist from bundle impor...
15,279
4,409
from conan.tools.env import Environment def runenv_from_cpp_info(conanfile, cpp_info): """ return an Environment deducing the runtime information from a cpp_info """ dyn_runenv = Environment(conanfile) if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP retu...
1,888
605
""" ********************************************************************************** List model ********************************************************************************** """ from enum import Enum from dataclasses import dataclass from uuid import UUID from datetime import datetime class ListType(str, Enum...
652
168
# -*- coding: utf-8 -*- """ Automation task as a AppDaemon App for Home Assistant - current meter PEAK POWER notifications """ import datetime as dt from enum import IntEnum import appdaemon.plugins.hass.hassapi as hass LOG_LEVEL = "INFO" LOG_LEVEL_ALERT = "WARNING" LOGGER = "special_event_log" COEF_CRITICAL_LIMIT ...
12,985
3,866
# -*- test-case-name: twisted.internet.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ This module provides support for Twisted to interact with the glib/gtk2 mainloop. In order to use this support, simply do the following:: | from twisted.internet import gtk2reactor | ...
13,391
3,898
""" Setup: - Import Libraries - Setup tf on multiple cores - Import Data """ import pandas as pd import numpy as np import tensorflow as tf import seaborn as sns from time import time import multiprocessing import random import os from tensorflow.keras.models import Sequential from tensorflow.keras.layer...
4,356
1,651
# This example show how to use inline keyboards and process button presses import telebot import time from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton import os, sys from PIL import Image, ImageDraw, ImageFont import random TELEGRAM_TOKEN = '1425859530:AAF5MQE87Zg_bv3B2RLe3Vl2A5rMz6vYpsA' ...
4,012
1,543
from rectangle2 import rectangle_area def test_unit_square(): assert rectangle_area([0, 0, 1, 1]) == 1.0 def test_large_square(): assert rectangle_area([1, 1, 4, 4]) == 9.0 def test_actual_rectangle(): assert rectangle_area([0, 1, 4, 7]) == 24.0
261
107
# -*- coding: utf-8 -*- from unittest import TestCase, TestLoader from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound, HandlerAlreadyBound) def init_radio(f): def wrap(self, *args): self.radio = Radio() return f(self, *args) return wrap class TestRadio...
3,081
944
class APIError(Exception): """ Base exception for the API app """ pass class APIResourcePatternError(APIError): """ Raised when an app tries to override an existing URL regular expression pattern """ pass
244
67
import sys from typing import Sequence import pytest from jina import Request, QueryLang, Document from jina.clients.request import request_generator from jina.proto import jina_pb2 from jina.proto.jina_pb2 import EnvelopeProto from jina.types.message import Message from jina.types.request import _trigger_fields from...
6,256
2,108
import os import sys DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) ) def Settings( **kwargs ): return { 'interpreter_path': sys.executable, 'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ] }
243
101
from distutils.core import setup setup( name='utils', version='1.0.0', author='Mirco Tracolli', author_email='mirco.tracolli@pg.infn.it', packages=[ 'utils', ], scripts=[], url='https://github.com/Cloud-PG/smart-cache', license='Apache 2.0 License', description='Utils fo...
616
205
"""Support for Eight Sleep binary sensors.""" from __future__ import annotations import logging from pyeight.eight import EightSleep from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.enti...
2,074
641
# This file is part of the CERN Indico plugins. # Copyright (C) 2014 - 2022 CERN # # The CERN Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; see # the LICENSE file for more details. from unittest.mock import MagicMock import pytest from requests.ex...
9,215
3,190
# _*_ coding: utf-8 _*_ # --------------------------- __author__ = 'StormSha' __date__ = '2018/3/28 18:01' # --------------------------- # -------------------------django---------------------- from django.conf.urls import url from .views import OrgView, AddUserAskView, OrgHomeView, OrgCourseView, OrgDescView, OrgTeach...
1,220
464
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('filer', '0009_auto_20171220_1635'), ] operations = [ migrations.AlterField( mod...
571
198
import FWCore.ParameterSet.Config as cms # handle normal mixing or premixing def getHcalDigitizer(process): if hasattr(process,'mixData'): return process.mixData if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'): return process.mix.digiti...
12,166
4,501
import numpy as np import xml.etree.ElementTree as ET class Geom(object): def __init__(self, geom): self.xml = geom self.params = [] def get_params(self): return self.params.copy() def set_params(self, new_params): self.params = new_params def update_point(self, p, ne...
10,106
3,593
''' Load User Middleware''' from masonite.facades.Auth import Auth class LoadUserMiddleware: ''' Middleware class which loads the current user into the request ''' def __init__(self, Request): ''' Inject Any Dependencies From The Service Container ''' self.request = Request def before(sel...
672
172
from minqlx_plugin_test import * import logging import unittest from mockito import * from mockito.matchers import * from hamcrest import * from redis import Redis from merciful_elo_limit import * class MercifulEloLimitTests(unittest.TestCase): def setUp(self): setup_plugin() setup_cvars({ ...
22,691
8,024
from ronglian_sms_sdk import SmsSDK from celery_tasks.main import app # 写我们的任务(函数) # 任务必须要celery的实例对象装饰器task装饰 # 任务包的任务需要celery调用自检检查函数。(在main里面写。) @app.task def celery_send_sms_code(mobile, sms_code): accId = '8a216da8762cb4570176c60593ba35ec' accToken = '514a8783b8c2481ebbeb6a814434796f' appId = '8a216da...
689
496
import sublime_plugin class MethodDeclaration(object): """docstring for MethodDeclaration""" def __init__(self): self._methodclass = None self.has_implementation = False self.has_interface = False @property def has_implementation(self): return self._has_implementation...
5,195
1,414
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
33,860
11,269
# -*- coding: UTF-8 -*- import os, re, shutil, time, xbmc from resources.lib.modules import control try: import json as simplejson except: import simplejson ADDONS = os.path.join(control.HOMEPATH, 'addons') def currSkin(): return control.skin def getOld(old): try: old = '"%s"' % old quer...
7,195
2,385
""" All things for a HAP characteristic. A Characteristic is the smallest unit of the smart home, e.g. a temperature measuring or a device status. """ import logging from pyhap.const import ( HAP_PERMISSION_READ, HAP_REPR_DESC, HAP_REPR_FORMAT, HAP_REPR_IID, HAP_REPR_MAX_LEN, HAP_REPR_PERM, ...
10,360
3,253
dataset_type = 'UNITER_VqaDataset' data_root = '/home/datasets/mix_data/UNITER/VQA/' train_datasets = ['train'] test_datasets = ['minival'] # name not in use, but have defined one to run vqa_cfg = dict( train_txt_dbs=[ data_root + 'vqa_train.db', data_root + 'vqa_trainval.db', data_root +...
1,767
731
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include, re_path from django.views.generic import TemplateView urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('rest-auth/', include('rest_auth.urls...
752
229
#!/bin/bash # -*- coding: UTF-8 -*- # 基本控件都在这里面 from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog, QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit, ...
22,881
8,817
""" GpuCorrMM-based convolutional layers """ import numpy as np import theano import theano.tensor as T from theano.sandbox.cuda.basic_ops import gpu_contiguous from theano.sandbox.cuda.blas import GpuCorrMM from .. import init from .. import nonlinearities from . import base # base class for all layers that rely ...
3,869
1,257
#! /usr/bin/env python # # =============================================================== # Description: Sanity check for fresh install. # # Created: 2014-08-12 16:42:52 # # Author: Ayush Dubey, dubey@cs.cornell.edu # # Copyright (C) 2013, Cornell University, see the LICENSE file # ...
3,292
1,245
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals try: unicode except NameError: basestring = unicode = str # Python 3 import logging import rdflib from rdflib import compare logger = logging.getLogger("ldtools") RESET_SEQ = "\033[0m" COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[...
3,831
1,269
# Debug print levels for fine-grained debug trace output control DNFQUEUE = (1 << 0) # netfilterqueue DGENPKT = (1 << 1) # Generic packet handling DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis DCB = (1 << 3) # Packet handlign callbacks DPROCFS = (1 << 4) # procfs DIPTBLS = (...
1,420
595
''' Script for training the model ''' import tensorflow as tf import numpy as np from input import BatchGenerator from model import MultiRnn import time from datetime import datetime import os import matplotlib as mpl mpl.use('Agg') from matplotlib import pyplot as plt sum_dir = 'sum' # dir to write summary train_di...
3,175
1,024
import os import sys import threading import time import warnings from contextlib import ExitStack import click import pendulum from dagster import __version__ from dagster.core.instance import DagsterInstance from dagster.daemon.controller import ( DEFAULT_DAEMON_HEARTBEAT_TOLERANCE_SECONDS, DagsterDaemonCont...
4,002
1,282
import sys, os sys.path.append(os.path.dirname(os.path.dirname(sys.path[0]))) from sportsreference.nfl.teams import Teams for team in Teams(): print(team.name) for player in team.roster.players: print(player.name) for game in team.schedule: print(game.dataframe) print(game.dataframe...
331
111
import numpy as np import matplotlib import matplotlib.pyplot as plt import sys sys.path.append("../") from quelea import * nx = 217 ny = 133 x0 = 0 x1 = 30 # lambdas y0 = 0 y1 = 20 # lambdas xs = np.linspace(x0, x1, nx) ys = np.linspace(y0, y1, ny) # 2d array of (x, y, z, t) coords = np.array( [ [x, y, 0, 0] for ...
1,116
516
import os from absl import app from absl import flags import numpy as np import tqdm from tensorflow.keras import Model from albumentations import ( Compose, HorizontalFlip, RandomBrightness,RandomContrast, ShiftScaleRotate, ToFloat, VerticalFlip) from utils import reset_tf from eval_utils import calc_score_v...
4,709
1,755
from django.conf import settings from suit import apps from suit.apps import DjangoSuitConfig from suit.menu import ParentItem, ChildItem APP_NAME = settings.APP_NAME WIKI_URL = settings.WIKI_URL class SuitConfig(DjangoSuitConfig): name = 'suit' verbose_name = 'Mbiome Core JAXid Generator' site_title = '...
4,612
1,385
import h5py import numpy as np np.set_printoptions(threshold=np.nan) from shutil import copyfile copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5 bl = h5py.File("baseline_pruned.h5", 'r') #dummy = h5py.File("dummy.h5", 'r') pretrained = h5py.File("pretrained_b...
38,519
17,313
# Natural Language Toolkit: Interface to Weka Classsifiers # # Copyright (C) 2001-2015 NLTK Project # Author: Edward Loper <edloper@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Classifiers that make use of the external 'Weka' package. """ from __future__ import print_fu...
12,970
4,003
import pandas as pd import numpy as np from src.si.util.util import label_gen __all__ = ['Dataset'] class Dataset: def __init__(self, X=None, Y=None, xnames: list = None, yname: str = None): """ Tabular Dataset""" if X is None: raise Exception("Trying ...
5,502
1,753
""" Module: 'display' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class TFT: '' BLACK = 0 BLUE = 255 BMP = 2 BOTTOM = -9004 CENTER = -9003 COLOR_BI...
3,357
1,387
import json, requests, datetime from cron_descriptor import get_description from .dbclient import dbclient from .JobsClient import JobsClient from .ClustersClient import ClustersClient from .WorkspaceClient import WorkspaceClient from .ScimClient import ScimClient from .LibraryClient import LibraryClient from .HiveCli...
364
93
# -*- coding: utf-8 -*- # SkinWeights command and component editor # Copyright (C) 2018 Trevor van Hoof # Website: http://www.trevorius.com # # pyqt attribute sliders # Copyright (C) 2018 Daniele Niero # Website: http://danieleniero.com/ # # neighbour finding algorythm # Copyright (C) 2018 Jan Pijpers # Webs...
1,145
380
"""AVM FRITZ!Box binary sensors.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from datetime import datetime, timedelta import logging from typing import Any, Literal from fritzconnection.core.exceptions import ( FritzActionError, FritzActionFaile...
11,744
3,945
from Ifc.ClassRegistry import ifc_class, ifc_abstract_class, ifc_fallback_class @ifc_abstract_class class IfcEntity: """ Generic IFC entity, only for subclassing from it """ def __init__(self, rtype, args): """ rtype: Resource type args: Arguments in *reverse* order, so you can...
2,931
993
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (c) 2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import logging import os from io_monitor.constants import DOMAIN from io_monitor.utils.data_window import DataCollectionWindow LOG = logging.getLogger(DOMAIN) class DeviceDataCollec...
5,330
1,802
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
19,793
6,162
from net_common import * import struct import sys def getDirHashOpts(withNames=False, ignoreThumbsFiles=True, ignoreUnixHiddenFiles=True, ignoreEmptyDirs=True): return bytearray([((1 if withNames else 0) + (2 if ignoreThumbsFiles else ...
1,373
485
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-09-11 10:05 from __future__ import unicode_literals import config.s3 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('investment_report', '0019_auto_20180820_1304'), ] operations = [ ...
624
219
"""Validate that number of threads in thread pools is set to 1.""" import numexpr import blosc import threadpoolctl # APIs that return previous number of threads: assert numexpr.set_num_threads(2) == 1 assert blosc.set_nthreads(2) == 1 for d in threadpoolctl.threadpool_info(): assert d["num_threads"] == 1, d
317
104
#!/usr/bin/env python """A simple viewer for Stokes patterns based on two far-field pattern files. (Possibly based on one FF pattern files if it has two requests: one for each polarization channel.)""" import os import argparse import numpy import matplotlib.pyplot as plt from antpat.reps.sphgridfun.tvecfun import TVec...
3,208
1,297
'''Some helper functions for PyTorch, including: - progress_bar: progress bar mimic xlua.progress. - set_lr : set the learning rate - clip_gradient : clip gradient ''' import os import sys import time import math import torch import torch.nn as nn import torch.nn.init as init from torch.autogr...
2,141
839
from __future__ import absolute_import, division, print_function import logging import sys logging.basicConfig( stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s-%(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') import numpy as np import utils logger = logging.getLogger("ind...
2,236
762
print('\033[7;30mOla mundo\033[m!!!')
38
24
# Copyright 2020 The Cirq Developers # # 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 ...
12,050
3,495
import os import sys import numpy as np import iotbx.phil from cctbx import uctbx from dxtbx.model.experiment_list import ExperimentListFactory from scitbx.math import five_number_summary import dials.util from dials.array_family import flex from dials.util import Sorry, tabulate help_message = """ Examples:: d...
22,798
7,507
# -*- coding: utf-8 -*- from enum import Enum, IntEnum, unique import os APP_NAME = "mine2farm" NETWORK_NAME = "CenterAxis" LOG_LEVEL_CONSOLE = "WARNING" LOG_LEVEL_FILE = "INFO" APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/") LOG_FOLDER = APP_FOLDER + "app/log/" LOG_FILE = "%(asctime)_" + AP...
8,749
3,492
from django.db import models # Create your models here. class Destination(models.Model) : name = models.CharField(max_length = 100) img = models.ImageField(upload_to = 'pics') desc = models.TextField() price = models.IntegerField() offer = models.BooleanField(default = False) class News()...
433
133
import base64 import io import dash import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output import numpy as np import tensorflow as tf from PIL import Image from constants import CLASSES import yaml with open('app.ya...
6,001
1,804
import json import requests from django.conf import settings class rakuten: def get_json(self, isbn: str) -> dict: appid = settings.RAKUTEN_APP_ID # API request template api = "https://app.rakuten.co.jp/services/api/BooksTotal/"\ "Search/20170404?format=json&isbnjan={isbnj...
1,214
388
print(int(input(""))**0.5)
26
13
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
18,710
5,589
from django.shortcuts import render,redirect,reverse from . import forms,models from django.db.models import Sum from django.contrib.auth.models import Group from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required,user_passes_test def home_view(request): if request.us...
21,322
6,950
import os import numpy as np from paddle import fluid from ltr.models.bbreg.atom import atom_resnet50, atom_resnet18 from ltr.models.siamese.siam import siamfc_alexnet from ltr.models.siam.siam import SiamRPN_AlexNet, SiamMask_ResNet50_sharp, SiamMask_ResNet50_base from pytracking.admin.environment import env...
16,684
5,430
#!/usr/bin/env python2 import sys import random import os.path import shutil import commands import types import math #gsPath = '/usr/local/bin/gs' gsPath = 'gs' logFile = '/dev/null' #logFile = 'plot.log' #--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage) # class PsPlot(object): def __init__(self...
19,069
7,178
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-28 06:53 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('exercises', '0002_auto_20161128_1718'), ] operations = [ migrations.RenameModel( ...
402
159
# Copyright 2021 Northern.tech AS # # 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...
2,006
636
""" 295 find median from data stream hard """ from heapq import * class MedianFinder: # max heap and min heap def __init__(self): """ initialize your data structure here. """ self.hi = [] self.lo = [] def addNum(self, num: int) -> None: heappush(self.lo,...
740
275
import os import numpy as np import raisimpy as raisim import math import time raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim") world = raisim.World() ground = world.addGround() world.setTimeStep(0.001) world.setMaterialPairProp("steel", "steel", 0.1, 1.0, 0.0) ...
3,445
1,778
# Copyright 2012 Pedro Navarro Perez # Copyright 2013 Cloudbase Solutions Srl # 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...
15,132
4,333
# -------------- # Importing header files import numpy as np import pandas as pd from scipy.stats import mode # code starts here bank = pd.read_csv(path) categorical_var = bank.select_dtypes(include = 'object') print(categorical_var) numerical_var = bank.select_dtypes(include = 'number') print(numeric...
1,326
561
''' Training Scropt for V2C captioning task. ''' __author__ = 'Jacob Zhiyuan Fang' import os import numpy as np from opts import * from utils.utils import * import torch.optim as optim from model.Model import Model from torch.utils.data import DataLoader from utils.dataloader import VideoDataset from model.transforme...
7,673
2,514