text
string
size
int64
token_count
int64
from typing import List, Optional, Tuple import mazegen from mazegen import M, WALL # In desmos coordinates (x,y), with y=0 being the bottom row # CARDINAL_DELTAS = [(0, 1), (1, 0), (0, -1), (-1, 0)] # In array coordinates (y,x), with y=0 being the top row CARDINAL_DELTAS = [(-1, 0), (0, 1), (1, 0), (0, -1)] S = Tupl...
2,688
1,059
import subprocess import logging def run(command, cwd=None): try: return subprocess.check_output( command, cwd=cwd, stderr=subprocess.STDOUT, stdin=open("/dev/null"), close_fds=True) except subprocess.CalledProcessError as e: logging.error("Failed command '%s' output:\n...
361
114
from numpy import zeros, ones, dot, sum, abs, max, argmax, clip, \ random, prod, asarray, set_printoptions, unravel_index # Generate a random uniform number (array) in range [0,1]. def zero(*shape): return zeros(shape) def randnorm(*shape): return random.normal(size=shape) def randuni(*shape): return random.ran...
15,924
4,822
#! /usr/bin/python ''' This file provides a sample app for loading data into FDB. To use it to load data into one of the sample clusters in this repo, you can build the image by running `docker build -t fdb-data-loader sample-apps/data-loader`, and then run the data loader by running `kubectl apply -f sample-apps/dat...
1,429
508
# ID : 18 # Title : 4Sum # Difficulty : MEDIUM # Acceptance_rate : 35.2% # Runtime : 72 ms # Memory : 12.7 MB # Tags : Array , Hash Table , Two Pointers # Language : python3 # Problem_link : https://leetcode.com/problems/4sum # Premium : 0 # Notes : - ### def fourSum(self, nums: List[int], target: int) -> List[Lis...
1,580
527
''' Algorithm for matching the model to image points. Based on (Cootes et al. 2000, p.9) and (Blanz et al., p.4). ''' import numpy as np from utils.structure import Shape from utils.align import Aligner class Fitter(object): def __init__(self, pdmodel): self.pdmodel = pdmodel self.aligner = Align...
1,916
626
from flask import Flask from flask_cors import CORS # type: ignore from .api import account_blueprint from .event_handlers import register_event_handlers from .infrastructure import event_store_db from .composition_root import event_manager def account_app_factory(db_string: str): app = Flask(__name__) CORS(...
578
194
# Package: Storage Manager # License: Released under MIT License # Notice: Copyright (c) 2020 TytusDB Team # Developers: Alexis Peralta from storage.avl import avlMode from storage.b import BMode from storage.bplus import BPlusMode from storage.hash import HashMode from storage.isam import I...
41,794
12,490
from RPA.Browser.Selenium import Selenium from RPA.FileSystem import FileSystem import datetime import os class PDFDownloader: def __init__(self, page_urls, names): self.browser = Selenium() self.files = FileSystem() self._dir = f'{os.getcwd()}/output' self._urls = page_urls ...
1,015
305
# Add this test back later, unfortunately casting errors and no time to deal with them. # @pytest.mark.parametrize("dataflow_object", ["external_input_int.json"], indirect=True) # def test_external_input_int(dataflow_object: DataFlowObject, dataflow: DataFlow): # dataflow_rs = dataflow_object.run(external_inputs={"...
1,352
481
from django.shortcuts import render from rest_framework import generics from . import models from .models import Category, Product from .serializers import CategorySerializer, ProductSerializer class ProductListView(generics.ListAPIView): queryset = Product.objects.all() serializer_class = ProductSerializer ...
886
241
class Node(): def __init__(self, value): self.value = value self.adjacentlist = [] self.visited = False class Graph(): def DFS(self, node, traversal): node.visited = True traversal.append(node.value) for element in node.adjacentlist: if element...
831
294
from arm.logicnode.arm_nodes import * class ArrayLoopNode(ArmLogicTreeNode): """Loops through each item of the given array.""" bl_idname = 'LNArrayLoopNode' bl_label = 'Array Loop' arm_version = 1 def init(self, context): super(ArrayLoopNode, self).init(context) self.add_input('Ar...
613
192
""" Copyright 2017-present Airbnb, 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, sof...
2,592
749
import numpy as np from LocalSearch.local_search import * from EvolutionAlgorithm import EvolutionAlgorithm as EA def init_real_chromosome(size, variation=2): return np.random.normal(0, variation, size) def init_bin_chromosome(size): return np.random.binomial(1, 0.5, size) def initialization(population_...
2,416
879
""" Dummy file for testing """
31
12
# -*- encoding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function import os import tempfile import unittest import re import shutil class Test(unittest.TestCase): ## XXXvlab: it seems it's already there in PY3 and maybe PY2, ## so why keep it ? def assertContains(s...
1,545
507
"""Constants for the Ridwell integration.""" import logging DOMAIN = "ridwell" LOGGER = logging.getLogger(__package__) DATA_ACCOUNT = "account" DATA_COORDINATOR = "coordinator" SENSOR_TYPE_NEXT_PICKUP = "next_pickup"
221
83
""" Authors: Augustine Italiano, Ryan Forster, Adam Camer-Pesci This class will act as the control centre for the backend components: Calculations.py FileLoader.py """ import os import sys import csv from datetime import datetime import json import rpy2.robjects.packages as rpackages from rpy2.robjects.vector...
6,143
2,048
import subprocess import fnmatch from pathlib import Path import os import re def all_files(src): regex_include = re.compile("|".join((fnmatch.translate(e) for e in src.included_files))) regex_exclude = re.compile("|".join((fnmatch.translate(e) for e in src.excluded_files))) for root, dirs, files in os.w...
1,328
466
import click class command: def __init__(self, name=None, cls=click.Command, **attrs): self.name = name self.cls = cls self.attrs = attrs def __call__(self, method): def __command__(this): def wrapper(*args, **kwargs): return method(this, *args, **k...
1,917
561
from __future__ import division import numpy as np # Set bar stimuli speed def update_bar_speed(BPsyn, delay, width, speed, d_init, synapse_type="alphaCSyn", angle=0): print "Updating bar speed to: %f mm/s" % speed angrad = angle * np.pi / 180.0 angcos = np.cos(angrad) angsin = np...
4,716
1,725
from prime_numbers import is_prime def test_is_prime(): assert is_prime(-1) is False assert is_prime(0) is False assert is_prime(4) is False assert is_prime(6) is False assert is_prime(8) is False assert is_prime(9) is False assert is_prime(10) is False assert is_prime(12) is False ...
3,326
1,212
#====================== # # Scientific Plotting Calculator # #---------------------- # # Preetam Sharma # # Artificial Intelligence, ICL # #====================== # # Usefull modules and tools from tkinter import BOTTOM, BOTH, TOP, Label, DISABLED, NORMAL, INSERT, E...
14,914
4,494
from gefyra.__main__ import up_parser, up_command from gefyra.configuration import ClientConfiguration, __VERSION__ REGISTRY_URL = "my-reg.io/gefyra" QUAY_REGISTRY_URL = "quay.io/gefyra" STOWAWAY_LATEST = "my-reg.io/gefyra/stowaway:latest" CARGO_LATEST = "my-reg.io/gefyra/cargo:latest" OPERATOR_LATEST = "my-reg.io/ge...
7,386
2,632
# coding: utf8 import argparse import math import os import sys from time import clock import libmaster_board_sdk_pywrap as mbs from Trajectory import trajectory from Plotter import overlay_plot def example_script(name_interface): N_SLAVES = 6 #  Maximum number of controled drivers N_SLAVES_CONTROLED = 1 ...
6,476
1,974
# Leechy Prototype Spectrum Analyzer. # Important: MAKE SURE KEYBOARD IS ON ENGLISH AND CAPSLOCK IS NOT ON! import cv2,pickle,xlsxwriter,time,datetime,os, os.path from imutils import rotate_bound import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Button from PIL import Image, Im...
8,074
3,769
from .EncoderRNN import EncoderRNN from .DecoderRNN import DecoderRNN from .TopKDecoder import TopKDecoder from .seq2seq import Seq2seq
136
47
""" Spacer components to add horizontal or vertical space to a layout. """ import param from bokeh.models import Div as BkDiv, Spacer as BkSpacer from ..reactive import Reactive class Spacer(Reactive): """ The `Spacer` layout is a very versatile component which makes it easy to put fixed or responsive ...
3,055
1,004
#encoding:utf-8 from utils import weighted_random_subreddit subreddit = weighted_random_subreddit({ 'BeautifulFemales': 0.25, 'cutegirlgifs': 0.25, 'gentlemanboners': 0.25, 'gentlemanbonersgifs': 0.25 }) t_channel = '@r_gentlemanboners' def send_post(submission, r2t): return r2t.send_simple(sub...
432
178
import sys, os import Page_Rank_Utils as pru from Power_Iteration import PowerMethod from QR_Algorithm import qr_Algorithm_HH, qr_Algorithm_GS, shiftedQR_Algorithm from Inverse_Iteration import InverseMethod from Inverse_Iteration_w_shift import InverseShift import matplotlib.pyplot as plt THIS_FOLDER = os.path.dirname...
5,334
1,854
#!/usr/bin/env python3 import member m1 = member.SomeClass("Pavel") print ("name =",m1.name) m1.name = "Gunther" print ("name =",m1.name) m1.number = 7.3 print ("number =",m1.number)
188
84
#!/usr/bin/env python # -*- coding: utf-8 -*- import getpass import json import requests import sys import six import re class API: """ Defines REST API endpoints for Valispace. """ _writable_vali_fields = [ 'reference', 'margin_plus', 'margin_minus', 'unit', 'formula', 'description...
26,946
7,562
from distutils.core import setup setup(name='Bluemix', version='0.1', description='A bluemix datasource to be used with cloudbase-init', packages=['bluemix', 'bluemix.conf'])
194
68
# Copyright 2021 United States Government as represented by the Administrator of the National Aeronautics and Space # Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved. r""" This module provides the capability to locate the relative position of a regula...
49,575
12,942
import math import sys import torch from numbers import Number from torch import distributions from torch.distributions import constraints from torch.distributions.exp_family import ExponentialFamily from torch.distributions.utils import _standard_normal, broadcast_all q = sys.exit class Normal_(ExponentialFamily):...
5,071
1,565
import matplotlib matplotlib.use('Agg') # this lets us do some headless stuff import matplotlib.pylab as plt import numpy as np x = np.asarray([0,5,2]) y = np.asarray([0,1,3]) f = plt.figure() ax = f.add_subplot(111) ax.plot(x,y) #plt.show() # we have a headless display, can't do this! f.savefig('basicplot.eps',format...
376
147
# https://www.hackerrank.com/challenges/utopian-tree def tree_height(tree, N, start): if not N: return tree if start == 'spring': for i in range(N // 2): tree = tree * 2 + 1 if N % 2: return tree * 2 else: return tree elif start == 'summer...
659
213
from .piodispatch import dispatch, ascoroutine, shutdown
56
17
### Maximum Number of Coins You Can Get - Solution class Solution: def maxCoins(self, piles: List[int]) -> int: piles.sort() max_coin, n = 0, len(piles) for i in range(n//3, n, 2): max_coin += piles[i] return max_coin
266
96
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pupil', '0011_questions_set_id'), ] operations = [ migrations.CreateModel( name='SessionData', field...
986
286
import cv2 import numpy as np from collections import namedtuple from math import ceil, sqrt, exp, pi, floor, sin, cos, atan2, gcd import time from collections import deque, namedtuple # Dictionary that maps from joint names to keypoint indices. KEYPOINT_DICT = { "nose": 0, "left_eye_inner": 1, "left_eye":...
23,497
7,960
# -*- coding: utf-8 -*- """ Use behave4cmd0 step library (predecessor of behave4cmd). """ from __future__ import absolute_import # -- REGISTER-STEPS FROM STEP-LIBRARY: # import behave4cmd0.__all_steps__ # import behave4cmd0.failing_steps import behave4cmd0.passing_steps import behave4cmd0.note_steps
303
115
# Copyright 2022 The Fuchsia 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 dataclasses import dataclass from typing import Dict, List, Optional from serialization import serialize_fields_as __all__ = ['PackageManifest', 'Packag...
4,524
1,321
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from itertools import product from pathlib import Path import numpy as np import tensorflow as tf from dotenv import load_dotenv from annotation.direction import (Direction, get_diagonal_directions, get_cross_directions) from ...
6,025
1,684
from django import forms from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.models import User from account.models import Account class AccountCreateForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False, help_text='Optional.') last_name...
747
210
# Generated by Django 2.0.2 on 2018-03-22 21:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('palsbet', '0002_viptipsgames'), ] operations = [ migrations.AlterField( model_name='viptipsgames', name='cathegory',...
390
141
import gym from gym import spaces import numpy as np import learning_data from Simulation import Simulation def get_value_or_delimiter(value, delimiter): return min(delimiter[1], max(delimiter[0], value)) class Environment(gym.Env): def __init__(self, simulation, training): super(Environment, self)...
18,700
5,596
import pandas as pd import json import csv # importing the module import json # Opening JSON file with open('response.json') as json_file: data = json.load(json_file) # for reading nested data [0] represents # the index value of the list print(data['results'][0]['alternatives']['transcri...
1,311
422
from getratings.models.ratings import Ratings class NA_Sivir_Bot_Aatrox(Ratings): pass class NA_Sivir_Bot_Ahri(Ratings): pass class NA_Sivir_Bot_Akali(Ratings): pass class NA_Sivir_Bot_Alistar(Ratings): pass class NA_Sivir_Bot_Amumu(Ratings): pass class NA_Sivir_Bot_Anivia(Ratings): pass ...
6,407
3,595
# 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 # distributed under the...
1,711
532
from build import replace_text, version replace_text("@{version}", version)
77
21
# Copyright Jamie Allsop 2011-2017 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) #------------------------------------------------------------------------------- # CreateVersionFileCpp #--...
17,748
5,301
# proxy module from __future__ import absolute_import from mayavi.components.implicit_plane import *
101
28
import pandas as pd from scipy.stats import ttest_rel """ output """ # Note: some output is shortened to save spaces. # This file discusses statistical analysis (Part II). # ------------------------------------------------------------------------------ # Data stored in form of xlsx with contents: """ group data...
928
338
""" Implementation of attack methods. Running this file as a program will evaluate the model and get the validation accuracy and then apply the attack to the model specified by the config file and store the examples in an .npy file. """ from __future__ import absolute_import from __future__ import division from...
6,640
2,180
import os from app import create_app config_name = os.getenv('FLASK_CONFIG') app = create_app('development') if __name__ == '__main__': app.run(host='0.0.0.0')
166
65
import unittest from universe import components, engine, utils class PlanetProductionTestCase(unittest.TestCase): def test_values(self): manager = engine.Manager() manager.register_entity_type('species', [ components.SpeciesProductionComponent(), ]) manager.register_en...
30,392
17,084
import random import torch import torch.nn as nn import torch.nn.functional as F from .layers import * PRIMITIVES = [ 'MBI_k3_e3', 'MBI_k3_e6', 'MBI_k5_e3', 'MBI_k5_e6', 'MBI_k3_e3_se', 'MBI_k3_e6_se', 'MBI_k5_e3_se', 'MBI_k5_e6_se', # 'skip', ] OPS = { 'MBI_k3_e3' : lambda ic, mc, oc, s, aff, act: MBInvert...
12,044
5,916
import numpy as np import random as random def move_to_sample(Rover): delX = 0; delY = 0; if len(Rover.rock_angles) > 0: dist_to_rock = np.mean(np.abs(Rover.rock_dist)) angle_to_rock = np.mean(Rover.rock_angles); Rover.steer = np.clip(angle_to_rock* 180/np.pi, -15, 15) if Rove...
6,001
1,996
import redis # Default values. REDIS_URL = None REDIS_HOST = 'localhost' REDIS_PORT = 6379 FILTER_URL = None FILTER_HOST = 'localhost' FILTER_PORT = 6379 FILTER_DB = 0 def from_settings(settings): url = settings.get('REDIS_URL', REDIS_URL) host = settings.get('REDIS_HOST', REDIS_HOST) port = settings.ge...
869
331
# -*- coding: utf-8 -*- from datetime import date, datetime from odoo.tests.common import Form from odoo.addons.hr_holidays.tests.common import TestHrHolidaysCommon from odoo.exceptions import ValidationError class TestAutomaticLeaveDates(TestHrHolidaysCommon): def setUp(self): super(TestAutomaticLeaveD...
13,444
4,124
# encoding: utf-8 from __future__ import absolute_import, unicode_literals import onnxruntime class ONNXModel: def __init__(self, model_file=None, session=None, task_name=''): self.model_file = model_file self.session = session self.task_name = task_name if self.session is None: ...
445
132
# -*- coding: utf-8 -*- from django.shortcuts import get_object_or_404, render_to_response, redirect from django.template import RequestContext from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_exempt from django.http import Http404, HttpResponse, HttpResponseForbidden, Http...
3,881
1,211
######################################## # CS/CNS/EE 155 2018 # Problem Set 1 # # Author: Joey Hong # Description: Set 1 Perceptron helper ######################################## import numpy as np import matplotlib.pyplot as plt def predict(x, w, b): ''' The method takes the weight vector and bias o...
1,687
638
#Antonio Karlo Mijares #ICS4U-01 #November 24 2016 #1D_2D_arrays.py #Creates 1D arrays, for the variables to be placed in characteristics = [] num = [] #Creates a percentage value for the numbers to be calculated with base = 20 percentage = 100 #2d Arrays #Ugly Arrays ugly_one_D = [] ugly_one_D_two = [] ugly_two_D ...
5,894
1,863
# from gym_viewshed.envs.viewshed_env import ViewshedEnv # from gym_viewshed.envs.viewshed_basic_env import ViewshedBasicEnv # from gym_viewshed.envs.viewshed_random_env import ViewshedRandomEnv # from gym_viewshed.envs.viewshed_greedy_env import ViewshedGreedyEnv # from gym_viewshed.envs.viewshed_coverage_env import V...
407
157
import collections from copy import deepcopy from nose.tools import assert_raises from syn.base.b import ListWrapper, Attr from syn.base.b.tests.test_base import check_idempotence from syn.types.a import generate from syn.type.a import Schema from syn.schema.b.sequence import Sequence from syn.base_utils import assert_...
4,081
1,609
from models import StandardHMM, DenseHMM, HMMLoggingMonitor from utils import prepare_data, check_random_state, create_directories, dict_get, Timer, timestamp_msg, check_dir, is_multinomial, compute_stationary, check_sequences from data import penntreebank_tag_sequences, protein_sequences, train_test_split from datet...
21,974
7,550
from newcamera import TrackingCameraRunner from serial_io import SerialIO from show import imshow import cv2 import math print("Initializing serial connection with Arduino") ard = SerialIO() ard.start() print("Initializing camera") c = TrackingCameraRunner(0) print("Tracking Ball...") tcenterx = 640 tradius = 40 spee...
2,167
636
''' TaxiMDPClass.py: Contains the TaxiMDP class. From: Dietterich, Thomas G. "Hierarchical reinforcement learning with the MAXQ value function decomposition." J. Artif. Intell. Res.(JAIR) 13 (2000): 227-303. Author: David Abel (cs.brown.edu/~dabel/) ''' # Python imports. from __future__ import print_func...
8,247
2,634
#coding:utf-8 # # id: bugs.core_2923 # title: Problem with dependencies between a procedure and a view using that procedure # decription: # tracker_id: CORE-2923 # min_versions: ['2.5.0'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, isql_act, Action ...
2,176
782
""" --- Day 9: Marble Mania --- You talk to the Elves while you wait for your navigation system to initialize. To pass the time, they introduce you to their favorite marble game. The Elves play this game by taking turns arranging the marbles in a circle according to very particular rules. The marbles are numbered sta...
5,582
2,273
from .ic_1_stock_prices import stock_prices_1_brute_force, stock_prices_2_greedy def test_stock_price_algorithms_lose(): stock_prices = [10, 9, 7] assert stock_prices_1_brute_force(stock_prices) == -1 assert stock_prices_2_greedy(stock_prices) == -1 def test_stock_price_algorithms_no_gain(): stock_prices = [2, ...
983
457
from django.db import models from django.core.validators import MinValueValidator, MaxValueValidator class Control(models.Model): objects=models.Manager() TYPE_CHOICES=( ('Primitive','Primitive'), ('Corpse','CORPSE'), ('Gaussian','Gaussian'), ('CinBB','CinBB'), ) #pk i....
762
241
import numpy as np from pyNastran.bdf.cards.aero.utils import ( points_elements_from_quad_points, create_axisymmetric_body) def create_structured_cquad4s(model, pid, p1, p2, p3, p4, nx, ny, nid=1, eid=1, theta_mcid=0.): """ Parameters ---------- p1 / p2 / p3 / p4 : (3,...
1,542
609
import argparse import os,sys import pytest from ..dumpSTR import * from ..filters import * def base_argparse(tmpdir): args = argparse.ArgumentParser() args.vcf = None args.vcftype = "auto" args.out = str(tmpdir / "test") args.min_locus_callrate = None args.min_locus_hwep = None args.min_l...
19,755
7,272
from defs import * __pragma__('noalias', 'name') __pragma__('noalias', 'undefined') __pragma__('noalias', 'Infinity') __pragma__('noalias', 'keys') __pragma__('noalias', 'get') __pragma__('noalias', 'set') __pragma__('noalias', 'type') __pragma__('noalias', 'update') class Tower: def __init__(self, tower): ...
1,749
549
''' 실행 방법 : 아나콘다 프롬프트에서 main.py가 있는 폴더 경로에 아래 명령어 입력 python glowpick.py 데이터 목록 1. Category 2. Brand_Name 3. Product_Name 4. volume 5. price 6. Sales Rank 7. rate 8. nb_reviews 7. product_number ''' from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdrive...
6,081
2,104
from algorithms.factorization_machine import FactorizationMachine from algorithms.latent_dirichlet_allocation import LatentDirichletAllocation from app.config import db from app.config.config import engine import datetime import numpy as np import pandas as pd import pickle class Engine: def __init__(self): ...
3,651
1,061
import pytest # Reader imports import copybook # # Tests # tests = { "extra header text":""" 10 IDENTIFICATION DIVISION. PROGRAM-ID. 8-REPORT. AUTHOR. DDT. MODIFIED BY OREN. DATE WRITTEN. 10/13/2010. DATE COMPILED. 10/13/2010. 01 WORK-BOOK. ...
3,179
955
from werkzeug import exceptions import settings from utils import get_class_by_path def authenticate(f): def decorator(request): try: authentication_backend = get_class_by_path(settings.AUTHENTICATION_BACKEND) authenticator = authentication_backend() except Exception: ...
451
116
import numpy as np import matplotlib.pyplot as plt import skimage.transform as skit import sys, os sys.path.append(os.getcwd()) from quadboost.datasets import MNISTDataset from quadboost.utils import * from haar_preprocessing import * def plot_images(images, titles): fig, axes = make_fig_axes(len(images)) f...
1,189
502
import numpy as np import matplotlib.colors as colors import matplotlib.pyplot as plt def despine(ax=None): """Despine axes.""" ax.spines['right'].set_visible(False) ax.spines['left'].set_visible(False) ax.spines['top'].set_visible(False) ax.spines['bottom'].set_visible(False) ax.set_xticks([]...
1,233
463
""" SALTS XBMC Addon Copyright (C) 2014 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. T...
4,034
1,327
from typing import List import numpy as np import pandas as pd from matplotlib import pyplot as plt from visualization.helper_functions import ( FIGURE_FOLDER, TYPE_DICT, calibration_curves, ) from visualization.load_results import load_results, save_results_to_table def plot_calibration_curves( res...
3,940
1,311
"""Exact distributions covariance tools module. The functions in the module do small repetitive tasks, that are used along the whole implementation. These tools improve the way the tasks are standardized in the modules that use them. This script requires the following modules: * os * pickle * typing *...
11,794
3,680
# Import Dependencies import pandas as pd from splinter import Browser from bs4 import BeautifulSoup as bs from webdriver_manager.chrome import ChromeDriverManager def scrape(): # Featured Image scrape executable_path = {'executable_path': ChromeDriverManager().install()} browser = Browser('chrome', **exe...
3,272
1,130
#!/usr/bin/env python import curses import time import random from operator import getitem,attrgetter stdscr = curses.initscr() L,W= stdscr.getmaxyx() curses.start_color() curses.noecho() curses.cbreak() curses.curs_set(0) stdscr.keypad(1) L,W = stdscr.getmaxyx() normal,infiltrate,get2goal,runaway=0,1,2,3 def start_pag...
15,391
5,672
kamus = {"elephant" : "gajah", "zebra" : "zebra", "dog" : "anjing", "camel" : "unta"} kata = input("Masukan kata berbahasa inggris : ") if kata in kamus: print("Terjemahan dari " + kata + " adalah " + kamus[kata]) else: print("Kata tersebt belum ada di kamus")
266
121
import pandas as pd import structlog import rapidjson from .constants import ( get_page_key_fs, get_tome_manifest_key_fs, get_tome_path_fs, ) class TomeReaderFs: def __init__(self, *, root_path, prefix=None, tome_name, log=None, has_header=True): self._log = log if log is not None else structl...
2,521
777
#!/usr/bin/env python # from google.cloud import speech from google.cloud import speech_v1p1beta1 as speech from google.cloud.speech_v1p1beta1 import enums from google.cloud.speech_v1p1beta1 import types from google.api_core.exceptions import InvalidArgument, OutOfRange import pyaudio import Queue import rospy import ...
7,713
2,093
# coding: utf-8 import pprint import re import six class CallbackLifeCycleHookOption: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and ...
6,158
2,109
import tkinter as tk #tkinter is our gui lib. import webbrowser #webbrowser allows us to open user's default web browser. good for clicking on links. import jsonlines import io import genCoverLetter as gcl from Search_and_Apply.Search_and_Apply.spiders.IndeedSpider import searchFor from Search_and_Apply.Search_...
9,621
3,174
import os import yaml from followthemoney.types import registry from followthemoney.schema import Schema from followthemoney.mapping import QueryMapping from followthemoney.proxy import EntityProxy from followthemoney.exc import InvalidModel, InvalidData class Model(object): """A collection of schemata.""" ...
3,900
1,113
JUMPHOST = "jumphost" VMANAGE = "10.121.6.35" AZURE_STORAGE_ACCOUNT = "azure-storage-account"
93
49
from django.urls import path from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, ) from .views import ( RegisterView, UserDetail, LocationList, LocationDetail, FavoritePlaceList, FavoritePlaceDetail, ObstacleList, ObstacleDetail, UserObstacleC...
1,423
461
from collections import OrderedDict from vp_suite.model_blocks import ConvLSTM from vp_suite.models.precipitation_nowcasting.ef_blocks import Encoder_Forecaster class EF_ConvLSTM(Encoder_Forecaster): r""" This is a reimplementation of the Encoder-Forecaster model based on ConvLSTMs, as introduced in "Con...
5,868
2,141
from bs4 import BeautifulSoup from bs4 import SoupStrainer import sys def get_paragraphs(post_content): paragraphs = list() only_p_tags = SoupStrainer(["p", "h1", "h2", "h3", "h4", "h5", "h6", "li", ]) soup = BeautifulSoup(post_content, "lxml", parse_only=only_p_tags) for paragraph in soup: #replace all link...
560
229
from iFinDPy import * import datetime as dt import time import datetime import pandas as pd import statsmodels.api as sm import numpy as np import talib def initialize(account): account.a_periods=10 # 持有日期上限 account.b_periods=3 # 持有日期上限 account.hold={} # 记录持有天数情况 account.holdSl=[] # 记录短期波段...
23,920
10,330