text
string
size
int64
token_count
int64
''' Module for linear algebra routines. ''' import logging import warnings import numpy as np import scipy.sparse as sp import scipy.sparse.linalg as spla from scipy.linalg.lapack import (dpotrf, dpotrs, dtrtrs, dgetrf, dgetrs) from rbf.sputils import row_norms, divide_rows LOGGER =...
17,679
6,469
#%% import os print(os.getcwd()) from Blocks import ReLU, SequentialNN, Dense, Hinge, SGD from dataset_utils import load_mnist import numpy as np from convolution_layer import ConvLayer from maxpool_layer import MaxPool2x2 from flatten_layer import FlattenLayer import sys def iterate_minibatches(x, y, batch_size=16, ...
3,200
1,273
# Normal-exponential using out-of-band probes # normex: negative control probes # noob: ‘out-of-band’ Infinium I probes # Lib import logging import numpy as np import pandas as pd from statsmodels import robust from scipy.stats import norm, lognorm # App from ..models import ControlType, ArrayType from ..models.sketch...
25,935
9,546
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import List import numpy as np from pydantic import BaseModel, validator from ray.rllib.agents.dqn import ApexTrain...
5,041
1,502
def division(a, b): b = float(b) if b == 0: c = 0 print('Cannot divide by 0.') return c else: a = float(a) c = round(a / b, 9) return c
196
75
import re from array import * import fileinput import sys, getopt import csv def main(argv): vlog = '' top = '' try: opts, args = getopt.getopt(argv,"hf:t:",["Vlog=","Top="]) except getopt.GetoptError: print ('script_gen.py -r <verilog file> -t <top module name>') sys.exit(2) ...
1,322
456
import os from cbt.private_client import PrivateClient from cbt.auth import get_new_private_connection if __name__ == "__main__": usd = os.getenv("USD_BUY") auth = get_new_private_connection() client = PrivateClient(auth) client.market_buy_btc(usd)
269
96
import numpy as np from os import getcwd, path import scipy.misc as misc import tensorflow as tf from tensorflow.contrib.tensorboard.plugins import projector def variable_summaries(var, histogram_name='histogram'): """ Attach a lot of summaries to a Tensor (for TensorBoard visualization). :type var: tf.Va...
4,836
1,623
import bigflow as bf from .job import ExampleJob workflow1 = bf.Workflow( workflow_id='workflow1', definition=[ExampleJob('job1')])
141
48
# Generated by Django 3.0.8 on 2020-11-16 19:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('hello', '0001_initial'), ] operations = [ migrations.CreateModel( name='Author', fi...
2,076
585
""" aula sobre lista 18 repare como as listas podem ser incluidas dentro de uma lista. """ teste = [] teste.append('Álamo') teste.append(26) galera = [] galera.append(teste[:]) # é preciso fazer uma cópia com [:] para o sistema não duplicar teste[0] = 'Francielli' teste[1] = 22 galera.append(teste) print(galera[:]) ...
1,307
526
# flups.io: tools for reading and writing files import re import logging import numpy as np from .calib import load_latest, calibration logger = logging.getLogger(__name__) def read_asc(fname): """ Read a single `asc` file, the ASCII format from Andor Solis. """ logger.debug("Loading `.asc` file: %s",...
3,992
1,406
import multiprocessing as mp import pytest from kawadi.text_search import SearchInText @pytest.fixture() def input_data(): text_to_find = "String distance algorithm" text_to_search = """SIFT4 is a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. It was develo...
2,521
785
"""Define the abstract class for Bayesian Neural Networks.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function class BayesianNN(object): """A Bayesian neural network keeps a distribution over neural nets.""" def __init__(self, optimizer): p...
448
126
# -*- coding: utf-8 -*- from .MaidWhite import MaidWhite name = "MaidWhite" __all__ = (MaidWhite)
99
43
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') DEBUG = False class DevelopmentConfig: DEBUG = True SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://levy:Dadiesboy12@localhost/ronchezfitness' SQLALCHEMY_TRACK_MODIFICATIONS =...
832
319
import pandas as pd from crosstab.mega_analysis.pivot_result_to_pixel_intensities import * def lateralisation_to_pixel_intensities(all_combined_gifs, df, semiology_term, quantiles, method='non-linear', scale_factor=10, ...
1,654
537
''' @Author: AnakinJiang @Email: jiangjinpeng319 AT gmail.com @Descripttion: requests测试demo @Date: 2019-08-27 15:37:14 @LastEditors: AnakinJiang @LastEditTime: 2019-08-27 16:55:06 ''' import requests def get_test(): url1 = 'https://www.douban.com/' r1 = requests.get(url1) print(r1.status_code) print(r1...
585
272
from overrides import overrides import torch from allennlp.common.checks import ConfigurationError from allennlp.training.learning_rate_schedulers.learning_rate_scheduler import LearningRateScheduler @LearningRateScheduler.register("polynomial_decay") class PolynomialDecay(LearningRateScheduler): """ Impleme...
3,536
1,058
""" TO DO: 1. Lot of edge cases not accounted for 2. Could use some unit testing scripts for sanity check 3. What are the bounds for years? """ import mysql from mysql.connector import Error import re import numpy as np def reject_outliers(data, m = 6.): d = np.abs(data - np.median(data)) ...
2,983
1,024
from ..common import ( WebApiTestBase, WebClientError as ClientError, WebClientLoginError as ClientLoginError, WebClient as Client, compat_mock, compat_urllib_error ) class ClientTests(WebApiTestBase): """Tests for client related functions.""" @staticmethod def init_all(api): retu...
3,505
1,027
from setuptools import setup long_description = None with open("README.md", 'r') as fp: long_description = fp.read() setup( name = 'pyEcovent', packages = ['ecovent'], version='0.8.4', description='Python3 library for single-room energy recovery ventilators from Vents / Blauberg / Flexit', lo...
842
262
#!/usr/bin/env python # -*- encoding: utf-8 -*- import tensorflow as tf import numpy as np import os from optparse import OptionParser import logging from atnet import ATNet from dataset.generator import ATNetDataGenerator from plot import * logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(le...
5,105
1,668
import unittest from pyhmmer.easel import Alphabet from pyhmmer.errors import UnexpectedError, AllocationError, EaselError, AlphabetMismatch class TestErrors(unittest.TestCase): def test_unexpected_error(self): err = UnexpectedError(1, "p7_ReconfigLength") self.assertEqual(repr(err), "Unexpected...
1,695
594
import base64 STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' CUSTOM_ALPHABET = 'abcdefghjkmnprstuvwxyz0123456789' ENCODE_TRANS = str.maketrans(STANDARD_ALPHABET, CUSTOM_ALPHABET) DECODE_TRANS = str.maketrans(CUSTOM_ALPHABET, STANDARD_ALPHABET) PADDING_LETTER = '=' def encode(buffer): assert type(buffer) ...
1,196
505
from .one_drive_datalake import OneDriveDatalake from .google_drive_datalake import GoogleDriveDatalake from .dropbox_datalake import DropboxDatalake from .google_cloud_storage_datalake import GoogleCloudStorageDatalake from .azure_blob_storage_datalake import AzureBlobStorageDatalake from .azure_data_lake_datalake imp...
437
141
""" A* grid planning author: Atsushi Sakai(@Atsushi_twi) Nikos Kanargias (nkana@tee.gr) See Wikipedia article (https://en.wikipedia.org/wiki/A*_search_algorithm) """ import math from node import Node from obstacle_map import Position class AStarPlanner: def __init__(self, obstacle_map): """ ...
4,319
1,272
wordle = open("Wordle.txt", "r") wordList = [] for line in wordle: stripped_line = line.strip() wordList.append(stripped_line) mutableList = [] outcomeList = [] def blackLetter(letter, list): for word in list: if letter in word: list.remove(word) def greenLetter(letter, ...
1,995
584
import datetime as dt import pytest from cuenca_validations.types import ( EntryType, SavingCategory, TransactionStatus, WalletTransactionType, ) from cuenca import BalanceEntry, Saving, WalletTransaction @pytest.mark.vcr def test_create_wallet_transaction(): wallet_id = 'LAvWUDH6OpQk-ber3E_zUEi...
3,945
1,289
''' XlPy/inputs ___________ Validates input file selection, configurations, and matches file types. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' # load modules import operator as op from xldlib.onstart.main ...
884
285
#!/usr/bin/env python import rospy from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped, Pose from styx_msgs.msg import TrafficLightArray, TrafficLight from styx_msgs.msg import Lane from sensor_msgs.msg import Image from scipy.spatial import KDTree import cv2 import yaml import math import numpy as...
4,789
1,536
from typing import Callable, List, Union from numpy import arange from reamber.algorithms.generate.sv.SvPkg import SvPkg from reamber.algorithms.generate.sv.SvSequence import SvSequence def svFuncSequencer(funcs: List[Union[float, Callable[[float], float], None]], offsets: Union[List[float], flo...
2,175
665
# Generated by Django 2.1.7 on 2019-03-29 20:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('e_secretary', '0009_profile'), ] operations = [ migrations.AlterModelOptions( name='professor', options={'ordering':...
1,781
497
""" Implements Pseudo-outcome based Two-step Nets, namely the DR-learner, the PW-learner and the RA-learner. """ # Author: Alicia Curth from typing import Callable, Optional, Tuple import jax.numpy as jnp import numpy as onp import pandas as pd from sklearn.model_selection import StratifiedKFold import catenets.logge...
28,778
9,911
import random from plotting_utils import plot_spectrogram_to_numpy, image_for_logger, plot_to_image import numpy as np import tensorflow as tf class GParrotLogger(): def __init__(self, logdir, ali_path='ali'): # super(ParrotLogger, self).__init__(logdir) self.writer = tf.summary.create_file_write...
2,743
802
weight = [] diff = 0 n = int(input()) for i in range(n): q, c = map(int, input().split()) if c == 2: q *= -1 weight.append(q) diff += q min_diff = abs(diff) for i in range(n): if abs(diff - 2*weight[i]) < min_diff: min_diff = abs(diff - 2*weight[i]) for j in range(i+1, n): ...
452
186
import pyspiel game = pyspiel.load_game('bridge(use_double_dummy_result=false)') line = '30 32 10 35 50 45 21 7 1 42 39 43 0 16 40 20 36 15 22 44 26 6 4 51 47 46 25 14 29 5 34 11 49 31 37 9 41 13 24 8 28 17 48 23 33 18 3 19 38 2 27 12 56 57 52 63 52 52 52 0 32 48 8 3 51 47 15 44 28 16 4 14 50 2 10 49 5 37 9 36 31 24 2...
534
396
import curses class Key: def __init__(self, *values): self.values = values self._hash = hash(values) self._keyset = set(values) def __eq__(self, other): return self._hash == other._hash def __hash__(self): return self._hash class Keys: ESC = Key(27) TAB ...
906
377
import pytest from gorgona.stages.cleaners import NumberCleaner @pytest.fixture() def setup_number_cleaner(): nc = NumberCleaner( '', '', ) return nc def test_positive_integer_single_digit_single_digit(setup_number_cleaner): assert setup_number_cleaner("7") == "" def test_positiv...
51,458
19,302
#! /usr/bin/env python3 import argparse import atexit import json import os import subprocess import sys import time import unittest from test_device import ( Bitcoind, DeviceEmulator, DeviceTestCase, TestDeviceConnect, TestGetKeypool, TestGetDescriptors, TestSignTx, ) from hwilib.devices...
9,700
3,192
import os on_rtd = os.environ.get('READTHEDOCS', None) == 'True' extensions = [] templates_path = ['_templates'] source_suffix = ['.rst', '.md'] master_doc = 'index' project = u'fiubar' copyright = u'2008-2018, Maru Berezin' version = '2.0.0' release = '2.0.0' exclude_trees = ['_build'] pygments_style = 'sphinx' html...
560
236
from io import StringIO import itertools import numpy as np import numpy.ma as ma inputfile = './input/day9.txt' # inputfile = StringIO('''2199943210 # 3987894921 # 9856789892 # 8767896789 # 9899965678''') def neighbors(ar, i, j): return {ar[i-1,j], ar[i+1,j], ar[i,j-1], ar[i...
663
313
import numpy as np import joblib from sklearn import datasets from sklearn import svm from sklearn.model_selection import train_test_split filename_p = "model.joblib" if __name__ == "__main__": digits = datasets.load_digits() X_train, X_test, y_train, y_test = train_test_split( digits.data, digit...
456
177
from .audio_mel import PWGAudioMelNoiseDataset, DataLoader dataset_class_dict = { "PWGAudioMelNoiseDataset": PWGAudioMelNoiseDataset } def create_dataloader(dataset_classname, dataset_config, batch_size=1, collate_fn=None, s...
1,050
294
from django.db import models # from tinymce import models as tinymce_models # # # Create your models here. # # class Page(models.Model): # title = models.CharField(max_length=200) # url = models.CharField(max_length=200) # content = models.TextField(max_length=20000) #tinymce_models.HTMLField()#forms.CharFi...
911
326
""" Copyright 2019 BBC. Licensed under the terms of the Apache License 2.0. """ from unittest.mock import Mock import pytest from google.cloud.bigquery import Client from foxglove.connectors.bigquery import BigQueryConnector @pytest.fixture def fake_bq_client(): return Mock(spec=Client(project='test_project')...
2,468
877
import sys #"splchar":["!","@","#","$",".",",",":","%","^","*"] splchar=[chr(i) for i in range(33,48)]#ASCII spl charecter range from 33-48 and58-65#and i here is the mapping expression ie the thing thet is executed evry iteration splchar1=[chr(i) for i in range(58,65)]#Instead of explicit declaration of for loop ...
1,982
743
__author__ = 'ashvinder' import re import os import gc import logger import time from TestInput import TestInputSingleton from backup.backup_base import BackupBaseTest from remote.remote_util import RemoteMachineShellConnection from couchbase_helper.documentgenerator import BlobGenerator from couchbase_helper.documentg...
28,838
9,119
"""Check the feasibility of a bipartite graph by using SSLAP's feasibility module""" import numpy as np from sslap import hopcroft_solve # All 3 methods will use the same input bipartite graph: # i = 0 connects to j = 0, 1 # i = 1 connects to j = 1, 2 # i = 2 connects to j = 1, 4 # i = 3 connects to j = 2 # i = 4 con...
963
479
"""A simple command-line interface to the clot.torrent package.""" from argparse import ArgumentParser from os import path, walk import shutil from clot import __version__, torrent def main(): """Execute actions according to the command-line arguments.""" args = _parse_command_line() for source in arg...
5,933
1,667
from lxml import objectify, etree from operator import itemgetter from ..xml_converter import XmlConverter class SubstanceCVConverter(XmlConverter): def convert(self, xml): item = {} item["term_english_equiv"] = str(xml.attrib["term-english-equiv"]) item["term_id"] = str(xml.attrib["term-i...
475
151
from products.views import ProductDetail from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^products/(?P<slug>[-\w]+)/', ProductDetail.as_view()...
482
152
from django.db import models # Create your models here. class HeadlineListing(models.Model): headline_text = models.CharField(max_length=500) accessed = models.DateTimeField() source_url = models.CharField(max_length=200) author = models.CharField(default="", max_length=200) source = models.CharFie...
339
108
import matplotlib.pyplot as plt import pandas as pd def main(): times = [ 1, 100, 365, 365*20, 365*100, 100000] df = pd.read_csv('tmp.csv') df_ini = pd.read_csv("initial_value.csv") xan_measured = (df_ini["distance"], df_ini["XAn"]) df_m = pd.read_csv('measured_value.csv') measured_da...
1,678
739
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import pytest from pydispatch import dispatcher from ava.core.context import Context, get_core_context class MockAgent(object): def __init__(self): self.greenlets = [] self._dispatcher = dispatcher ...
2,685
771
# -------------- # Loan Status # Loan Status # Let's start with the simple task of visualizing the company's record with respect to loan approvals. #Importing header files import pandas as pd import numpy as np import matplotlib.pyplot as plt # The path to the dataset has been stored in a variable path # Lo...
5,736
1,998
import json from rabbitai.migrations.versions.fb13d49b72f9_better_filters import ( Slice, upgrade_slice, ) from .base_tests import RabbitaiTestCase class TestMigration(RabbitaiTestCase): def test_upgrade_slice(self): slc = Slice( slice_name="FOO", viz_type="filter_box", ...
649
219
''' Manage Azure Database for MariaDB servers. ''' from .. pyaz_utils import _call_az from . import db, server, server_logs
125
39
import os import re import csv import sys import json import yaml import time import socket import connexion import postgresql as psql from flask import current_app from urllib.parse import urlencode from hashlib import md5 from bokeh.embed import server_document from .processes import fetch_process, is_running, proce...
19,805
5,601
import numpy as np import chainer from chainer import cuda, Function, gradient_check, Variable from chainer import optimizers, serializers, utils from chainer import Link, Chain, ChainList import chainer.functions as F import chainer.links as L class normalNN(Chain): def __init__(self, dim): super().__ini...
3,327
1,382
""" This script is needed to convert gdb scripts from commands to documentation """ import os def convert_commands_to_docs(): commands_dir = os.getcwd() + "/numba_dppy/examples/debug/commands" examples = os.listdir(commands_dir) os.chdir(commands_dir + "/docs") for file in examples: if file !=...
1,597
426
import sys import ctypes from Phidget22.PhidgetSupport import PhidgetSupport from Phidget22.PhidgetException import PhidgetException from Phidget22.Phidget import Phidget class Accelerometer(Phidget): def __init__(self): Phidget.__init__(self) self.handle = ctypes.c_void_p() if sys.platform == 'win32': se...
6,672
2,524
""" In HiCal, a meeting is stored as tuples of integers (start_time, end_time). / These integers represent the number of 30-minute blocks past 9:00am. / For example: / (2, 3) # meeting from 10:00 - 10:30 am / (6, 9) # meeting from 12:00 - 1:30 pm / Write a function merge_ranges() that / takes a list of meeting time ran...
728
372
import json import requests from typing import List from konlpy.tag import Okt from requests.models import Response class OktTokenizer: """ A POS-tagger based tokenizer functor. Note that these are just examples. The `phrases` function usually gives a better result than an ordinary POS tokenizer. ...
1,209
354
from free_bodies import * # This is the actual engine which is apply physics to objects class physics_engine: FB = [] # Array holds all of the objects in our simulation. FB = free bodies # Add free bodies to the system def add_fb(self, fb): self.FB.append(fb) # Remove a free body fro...
823
236
/home/runner/.cache/pip/pool/57/99/fd/1d22e7d1fbf9ab07bcdf332318605c4de276c282734bf85d8c6421a6ce
96
71
import sys import periphery from .asserts import AssertRaises if sys.version_info[0] == 3: raw_input = input spi_device = None def test_arguments(): print("Starting arguments test...") # Invalid mode with AssertRaises(ValueError): periphery.SPI(spi_device, 4, int(1e6)) # Invalid bit ord...
5,044
2,063
""" Language specific settings """ from typing import Dict, Set from shapiro.common import Rating, ranged_rating from shapiro.tools import log, signum from spacy.tokens import Token _log = log class LanguageSentiment: def __init__(self, language_code: str): assert language_code is not None asser...
12,129
3,950
# ZMP preview control simulation with Python # By : Eko Rudiawan Jamzuri # Email : eko.rudiawan@gmail.com # This is an implementation of ZMP preview control with feedforward method # This Python program will calculating CoM trajectory based on ZMP trajectory input # The Gain parameter Gi, Gx, and Gd is imported from ma...
3,053
1,385
def counting_sort(arr): # Find min and max values min_value = min(arr) max_value = max(arr) counting_arr = [0]*(max_value-min_value+1) for num in arr: counting_arr[num-min_value] += 1 index = 0 for i, count in enumerate(counting_arr): for _ in range(count): ...
458
181
# [8 kyu] Grasshopper - Terminal Game Move Function # # Author: Hsins # Date: 2019/12/20 def move(position, roll): return position + 2 * roll
154
62
import os import logging.config import redis from flask import Flask from nmtwizard import common from nmtwizard import configuration as config from utils.database_utils import DatabaseUtils from flask_session import Session VERSION = "1.12.0" app = Flask(__name__) app.request_id = 1 def get_log_handler(): log_...
2,501
823
# from pybrain.datasets import SupervisedDataSet # from pybrain.supervised.trainers import BackpropTrainer # from pybrain.structure.modules import SoftmaxLayer # from pybrain.structure.modules import SigmoidLayer # from pybrain.tools.s import buildNetwork # (x,y,z) = x é a quantidade de camadas de entrada, y é a...
1,152
443
from unittest import TestCase from ..pres_request_schema import DIFProofRequestSchema class TestPresRequestSchema(TestCase): """DIF Presentation Request Test""" def test_limit_disclosure(self): test_pd_a = { "options": { "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa7"...
4,213
1,070
from datadog.api.resources import GetableAPIResource, CreateableAPIResource, \ UpdatableAPIResource, DeletableAPIResource, ActionAPIResource, ListableAPIResource class Screenboard(GetableAPIResource, CreateableAPIResource, UpdatableAPIResource, DeletableAPIResource, ActionAPIRe...
1,190
329
from .alexnet import alexnet_V2 import tensorflow.compat.v1 as tf import tensorflow.contrib.slim as slim from utils import montage_tf from .lci_nets import patch_inpainter, patch_discriminator import tensorflow.contrib as contrib # Average pooling params for imagenet linear classifier experiments AVG_POOL_PARAMS = {'...
10,525
4,105
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Author: pirogue Purpose: 白名单端口表操作 Site: http://pirogue.org Created: 2018-08-03 17:32:54 """ from dbs.initdb import DBSession from dbs.models.Whiteport import Whiteport from sqlalchemy import desc,asc from sqlalchemy.exc import InvalidRequestError # import s...
1,486
495
# # Copyright (C) 2018 Satoru SATOH <ssato @ redhat.com> # License: MIT # r"""Singleton class .. versionadded:: 0.9.8 - Add to make a kind of manager instancne later to manage plugins. """ from __future__ import absolute_import import threading class Singleton(object): """Singleton utilizes __new__ special m...
789
249
# -*- coding: utf-8 -*- """ Created on Tue Sep 9 10:37:24 2020 @author: fallahnejad Important Note: all the costs provided in EUR should be multiplied by EUR2USD factor before providing to the GEOPHIRES """ import os import re import shutil import pandas as pd from .cm.geophires.GEOPHIRESv2 import geophires def a...
4,937
1,632
#!/usr/bin/python import time import psycopg2 import argparse import postgres_util import container_util import admin_db import volumes from send_mail import send_mail from config import Config def full_test(params): admin_db.init_db() con_name = params['dbname'] dbtype = params['dbtype'] print('Star...
6,040
1,852
# -*- coding: utf-8 -*- import unittest from lxml import etree from perfectextractor.apps.extractor.models import Perfect from perfectextractor.corpora.opus.perfect import OPUSPerfectExtractor class TestPerfectExtractor(unittest.TestCase): def test_is_lexically_bound(self): en_ex = OPUSPerfectExtractor...
4,742
1,705
import tvm from functools import reduce from ..utils import to_int, to_int_or_None def get_need_tile(need_tile): return [True if x.value == 1 else False for x in need_tile] def get_factors(split_factor_entities): return [[x.value for x in factors.factors] for factors in split_factor_entities] def tile_axis(st...
4,303
1,615
########################################################### # LOWER LEVEL LIBRARY THAT TALKS TO THE MONOCHROMATON # ########################################################### import subprocess import time # -- See pyserial import serial class CornerStone260: """This class controlls the Cornerstone 26...
7,311
2,362
############################################################################# # # Author: Ruth HUEY, Michel F. SANNER # # Copyright: M. Sanner TSRI 2008 # ############################################################################# # $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/autoflex4Commands.py,v 1.1 ...
4,845
1,737
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. import cohesity_management_sdk.models.cifs_share_information import cohesity_management_sdk.models.volume_security_information class NetAppVolumeInformation(object): """Implementation of the 'NetApp Volume Information.' model. Specifies information abou...
6,801
1,719
""" The module contains the following submodules. """ from .frontend import Node __all__ = ["Node"] if __name__ == "__main__": import doctest doctest.testmod()
170
58
import collections import itertools import re import sys read_str = lambda : sys.stdin.readline().strip() read_str_list = lambda : sys.stdin.readline().strip().split() read_int = lambda : int(read_str()) read_int_list = lambda : map(int, read_str_list()) read_float = lambda : float(read_str()) read_float_list = lambda...
1,088
533
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
5,958
1,649
# Copyright 2018 Catalyst IT Limited # # 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...
9,537
3,062
from setuptools import setup setup(name='goofy', version='0.1', description='A goofy ebay bot.', url='github.com/elcolumbio/goofy', author='Florian Benkö', author_email='f.benkoe@innotrade24.de', license='Apache License, Version 2.0 (the "License")', packages=['goofy'])
314
116
import random import os import traceback import json from environment import Environment from environment import Action # 0 <= GAMMA < 1 # GAMMA = 0 -> only consider immediate rewards # GAMMA = 1 -> consider future rewards GAMMA = 0.8 confidence = 0 # initialize "brain" brain = open("brainFile", "r") if(os.stat("....
1,820
628
import unittest import translator class TestEnglishToFrench(unittest.TestCase): def test_love(self): self.assertEqual(translator.english_to_french('Love'), 'Amour') def test_sun(self): self.assertEqual(translator.english_to_french('Sun'), 'Soleil') def test_null(self): self.as...
987
352
from flask import (Flask, jsonify) from gevent import (pywsgi, sleep) from geventwebsocket.handler import WebSocketHandler from . import __version__ from .logs import logger class FlaskApp(object): def __init__(self, host='', port=8080): self.app = Flask(__name__) self._register_routes() ...
2,149
632
from django.views.generic import ListView, CreateView, UpdateView from django.utils.decorators import method_decorator from django.contrib.admin.views.decorators import staff_member_required from django.shortcuts import get_object_or_404, redirect, reverse from django.urls import reverse_lazy from django.contrib import...
9,284
2,690
import caffe import torch import numpy as np import argparse from collections import OrderedDict from torch.autograd import Variable import torch.nn as nn def arg_parse(): parser = argparse.ArgumentParser() parser.add_argument('--model', '-m', default='alexnet') parser.add_argument('--decimal', '-d', defa...
4,880
1,687
# -*- coding: utf-8 -*- """ Created on Tue May 26 15:53:33 2020 @author: hartwgj """ # -------------------------------------- # OHShots.py # # MDSplus Python project # for CTH data access # # OHShots.py --- gets the shots within a given date range that use OH # # Parameters: # startdate # enddate # # Returns: #...
1,903
583
#!/usr/bin/env python3 import argparse import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import numpy as np import cv2 import matplotlib.pyplot as plt from skimage.transform import radon, rescale, rotate import plotly.graph_objs as go ext...
6,271
2,015
# Go to new line using \n print('-------------------------------------------------------') print("My name is\nMaurizio Petrelli") # Inserting characters using octal values print('-------------------------------------------------------') print("\100 \136 \137 \077 \176") # Inserting characters using hex values print('...
766
174
class RetryOptions: def __init__(self, firstRetry: int, maxNumber: int): self.backoffCoefficient: int self.maxRetryIntervalInMilliseconds: int self.retryTimeoutInMilliseconds: int self.firstRetryIntervalInMilliseconds: int = firstRetry self.maxNumberOfAttempts: int = maxNumb...
505
138
import datetime import urllib from urllib.request import urlopen import time import logging import bs4 import telegram from telegram import Update from telegram.ext import CommandHandler, CallbackContext from modules.abstract_module import AbstractModule from utils.decorators import register_module, register_command...
14,753
4,191