index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
994,000
df10aa796406b3d5f71fb1f6b28f21551d418e79
import os.path import json_lines import numpy as np import re from underthesea import word_tokenize # PATH_QUESTION_ANSWER = '/Users/tienthanh/Projects/ML/datapool/tgdd_qa/QA-example.jl' PATH_QUESTION_ANSWER = '/Users/tienthanh/Projects/ML/datapool/tgdd_qa/iphone-6-32gb-gold.jl' PATH_TO_STOPWORDS = '/Users/tienthanh/P...
994,001
4d62e30b611b5c9b520ecea8d9145746f4f6cd6a
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.core import build_assigner, build_sampler from mmtrack.models.track_heads import QuasiDenseEmbedHead def test_quasi_dense_embed_head(): cfg = mmcv.Config( dict( num_convs=4, num_fcs=1, ...
994,002
a1e4dc712978d2b8d1620bd15b8647ad7057a27e
import mxnet as mx from mxnet import gluon from adversarial.blocks.resnext import ResNeXt from adversarial.blocks.mdn import SELU, DenseNet class JNet(gluon.nn.HybridBlock): def __init__(self, classes, **kwargs): super(JNet, self).__init__(**kwargs) with self.name_scope(): self._pfcand ...
994,003
d4619d438ebf30ec79a3795cb9c5718a49fba26a
import time import Adafruit_PCA9685 esc = Adafruit_PCA9685.PCA9685() esc_pwm_freq = 50 # PWM frequency used to communicate with the ESCs tick_length = (1000000 / esc_pwm_freq) / 4096 # 1 second in us, divided by the freq, divided by the bit depth is the tick length per us esc_min = 1000 * tick_length # 1000us in t...
994,004
51c135a08dea27df80618196ccaed27902703ccf
from django.shortcuts import render, render_to_response, get_object_or_404, redirect from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.contrib.auth.decorators import login_required from django.conf import settings from django.http import HttpResponse from fullcalendar.util import eve...
994,005
252c1a80587d0a3df923b12328faa4d3978ddf12
import sqlite3 import pandas as pd import FinanceDataReader as fdr import numpy as np import datetime from scipy import stats def get_date(start, terms): return pd.bdate_range(end = start,tz='Asia/Seoul',periods=terms).date meta = fdr.StockListing('KOSPI') meta.dropna(how='all',subset=meta.columns[3:],...
994,006
2b7a1a77e9ca93d10cdf786f8203e6aa5b31fca2
# -*- coding: utf-8 -*- """ This file gives the dipole radiation (E and B field) in the far field, the full radiation (near field + far field) and the near field radiation only @author: manu """ from __future__ import division from numpy import * from numpy.random import * from pylab import * #from entropy i...
994,007
1d0895c81a0a865fc10323af07b58704afaadbc1
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ s = str(x) l, r = 0, len(s)-1 while l < r: if s[l] != s[r]: return False l += 1 r -= 1 return True
994,008
7ae569675306430771f3b4b6813e04cfdeeb882e
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import click import logging from .grafana_dashboard import ( convert_dashboards, info_dashboards, test_dashboards, metrics_dashboards, metrics_all, ) from .prometheus_rule import convert_rules, metrics_rules, info_rules from .utils...
994,009
b2130579faa8779509b3dccb2b535c3be30e4c3d
from base_model import cpu_count,cpu_person
994,010
cf6d8a95fc85904407e721b06f02a621e664dbc8
from temperatures import data_colector from temperatures import data_adjuster import numpy as np import pandas as pd import seaborn as sns from tkinter import * import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,NavigationToolbar2Tk) from matplotlib.backend_bases import key...
994,011
43dac023d0bf6d1747414002a69bba3a776680d0
from django.contrib import admin from django.contrib.admin import DateFieldListFilter from mptt.admin import DraggableMPTTAdmin, TreeRelatedFieldListFilter from .models import ( Card, Category, Comment, DelieverChoice, PaymentChoice, ProductBrand, ProductCountry, Rate, ShopComment, ...
994,012
7989bf060e32dc6596fe00f3c39f88600c75ef7f
F_n = {0:0 ,1:1} #declaring fibbonacci for value n = 0 & 1 def fibbonacci(n): if n in F_n.keys(): return F_n[n] else: F_n[n] = fibbonacci(n-1) + fibbonacci(n-2) return F_n[n] n = int(input()) print(fibbonacci(n))
994,013
281bf2d213e367b46119ebdba32dfe24e18958b1
from .OdbMeshNode import OdbMeshNode from .OdbSet import OdbSet class OdbPretensionSection: """The pretension section object is used to define an assembly load. It associates a pretension node with a pretension section. Attributes ---------- node: OdbSet An :py:class:`~abaqus.Odb.OdbSet.O...
994,014
53352bd2c96253f93b9e06f01b159b883db9345d
''' 本篇可直接在 rq 的 notebook 运行,无需回测 取最近 80 个交易日的 沪深主力连续收盘点位收益率 分别分为 [1, 2, 4, 8, 16] 组 单独画图 ''' close_data = get_price('IF88', frequency='1d', start_date='2016-01-01', end_date='2017-06-30')['close'] print('len(close_data): ', len(close_data)) revenue_close_data = 100 * close_data.pct_change().dropna() print('len(reve...
994,015
bf458bafa6e152944f2e8904aab279ab6ea58000
import sys sys.stdin = open("input.txt") import math class Tree: def __init__(self, M, N): self.tree = [0] * (M + 1) self.N = N for _ in range(N): i, v = map(int, input().split()) self.tree[i] = v def calculate(self, index): while index != 1: ...
994,016
e3de185be1bcd10e5aeb9e8aee8261a8dcc020e7
import urllib.request; import random; file_garena='https://docs.google.com/spreadsheets/d/1Nk-nFm34WZffVyv0LRvgxAl68QkF9l8rMEPAmAHXGRs/edit?usp=sharing' def dowloadfile(url): response = urllib.request.urlopen(url); csv = response.read(); csv_str = str(csv); lines =csv_str.split("\\n"); dest_url = r'goog....
994,017
59a2894dd5fb635ae33d1ae6c0f0d8721df873a2
import os import os.path import sys import requests cached_extensions = [ "bmp", "ejs", "jpeg", "pdf", "ps", "ttf", "class", "eot", "jpg", "pict", "svg", "webp", "css", "eps", "js", "pls", "svgz", "woff", "csv", "gif", "mid", "png"...
994,018
dad29a1d9354272cfec14b75b67fec8bf65fa771
from functools import wraps from django.conf import settings try: from google.appengine.api import taskqueue except ImportError: taskqueue = None _webhook_url = '/notifications/notify/' def do_maybe_notification(func): """Wrap a method that returns a serialized list of splits and send updates to th...
994,019
ae50a585bfbe482e08bfe8d6e986e9af012a9a71
import numpy as np import loadFittingDataP2 as load_data import matplotlib.pyplot as plt import q1,q2,q3 def lsq_error(f_params,w): X = f_params[0] y = f_params[1] M = f_params[2] phi_X = polynomial_basis(X, M) error = np.sum((y - np.dot(phi_X,np.transpose(w)))**2) # e = (y - np.dot(phi_X,np.t...
994,020
6be515864b89c0d5ca6db22e3618c354145183b8
equationa = "(2 + 2) * 6 + 3" equationa = equationa.replace(' ','') #print(equationa) operators = "+" operators1 = "*/" operators2 = "+" while "(" in equationa: start = equationa.find("(") end = equationa.find(")") equationb = (equationa[start:end+1]) #print(1) #print(equationb) # ''' if equationb[start + 1] ...
994,021
34d07d3b8961ab9024dd95e4bb3cac0458e521c4
#!/usr/bin/python3 """Module lists all states that match name argument""" if __name__ == "__main__": import MySQLdb from sys import argv # default values user="root", passwd="", db="hbtn_0e_0_usa" db = MySQLdb.connect(host="localhost", port=3306, user...
994,022
dbff87f7922bf38e5839d306e47966bbc2f2b9f6
# python에서 사용하는 변수는 객체를 가리키는 것이라고도 말할수 있다. a = [1,2,3] # 위의 a리스트 자료형은 [1,2,3]의 값을 가지는 리스트 자료형이 자동으로 메모리에 생성되고 # 변수 a 는 [1,2,3]리스트가 저장된 메모리의 주소를 가리키게 된다. # 변수 a가 가리키는 주소값 print(id(a)) # 리스트를 복사 할때 # a 변수가 가지고 있는 주소값을 변수 b 에 대입 # 두 변수가 참조하는 객체의 주소값은 일치하기 때문에 서로 변수의 값을 수정 삭제 할수 있다. a = [1,2,3] b = a a[1] = 4 print(b) #...
994,023
c58885e1397ed34fdef82ba8b485aff6d014ba55
########################### # Time Series Learning # this code is train and test tsl model. # select tsl model. # train : # train model and save variables of model. # test : # load model and evaluate. # # data : hospital admit patients # input : previous EMR data # output : predicted next EMR data # # by Donghoon Oh...
994,024
e8b6718f19be532b98435b092f2507b9db975a06
# -*- coding: utf-8 -*- import numpy from .types import check_numpy_array X = (1.0,0.0,0.0) Y = (0.0,1.0,0.0) Z = (0.0,0.0,1.0) Dxy = (1.0,1.0,0.0)/numpy.sqrt(2) Axy = (-1.0,1.0,0.0)/numpy.sqrt(2) def normalize2(vec,norm=1.0): """ Normalizes a vector to a specified size """ vec = check_numpy_array(vec) ...
994,025
6ad348348af6c72a890a2df2251496ec1c1f5aff
"""Definir un conjunto con números enteros entre 0 y 9. Luego solicitar valores al usuario y eliminarlos del conjunto mediante el método remove, mostrando el con- tenido del conjunto luego de cada eliminación. Finalizar el proceso al ingresar -1. Utilizar manejo de excepciones para evitar errores al intentar quitar ele...
994,026
6d0ea74e20d5dd0046a61cc75fac6c9e4c07a74e
#!/usr/bin/python3 with open('data.txt', 'r') as file: file.read(text) print("Content-type:text/html\r\n\r\n") print("<h1>%s</h1>" % )
994,027
6b512de4bca5e9ebbb6cc163aa394266f016ca50
from pathlib import Path import bw_processing as bwp import numpy as np from fs.base import FS from fs.osfs import OSFS from fs.zipfs import ZipFS from .errors import InconsistentGlobalIndex def get_seed(seed=None): """Get valid Numpy random seed value""" # https://groups.google.com/forum/#!topic/briansuppo...
994,028
96061e923189ca97d6369aefb78d6e157fa38574
import pygame,time,random BLACK = (0,0,0) GREEN = (34, 139, 34) RED = (255, 0, 0) WHITE = (255, 255, 255) CYAN = (0, 255, 255) BLUE = (64, 224, 208) pygame.init() width, height = 800, 500 win=pygame.display.set_mode((width, height)) pygame.display.set_caption('Flappy bird') clock = pygame.time.Clock() img = pygame.ima...
994,029
aceaac25e51ceff859ba5bfa5b94ca9c27f41d79
""" regex1 正则表达式 """ import re s = "今年是2019年12月10日,2019年初的目标实现了吗" \ "保持95斤的愿望还记得吗" pattern = r"\d+" # 获取匹配内容的迭代器 result = re.finditer(pattern, s) # for i in result: # 迭代得到每处匹配内容的match对象 # < _sre.SRE_Match object; span = (3, 7), match = '2019' > # print(i.group()) # 2019 ... # 完全匹配 # obj = re.f...
994,030
3b2228da7b7f4b11ecba8000bd10f288dbad0f3a
from django.contrib.auth.forms import AuthenticationForm from django.utils.translation import gettext_lazy as _ from django import forms class UserLoginForm(AuthenticationForm): def __init__(self, *args, **kwargs): super(UserLoginForm, self).__init__(*args, **kwargs) username = forms.CharField(widget=...
994,031
a3a7e96cd8c29ac220284891fd6b81a4a19752e9
# 967. Numbers With Same Consecutive Differences # Medium # 1464 # 146 # Add to List # Share # Return all non-negative integers of length n such that the absolute difference between every two consecutive digits is k. # Note that every number in the answer must not have leading zeros. For example, 01 has one leadin...
994,032
b413e782ae4dad5b9ceae777d5c8ee4413ecd007
import urllib.request import random import time def hello(): print("hello") def capture(path): seed = random.random() # print(seed) urllib.request.urlretrieve("http://10.146.19.124/capture?t=" + str(seed), path) if __name__ == "__main__": n = 15 print("Start ...
994,033
b4f9c70337cc0b05dd674d1d1756b3f41723626c
class Solution: def myPow(self, x: float, n: int) -> float: episilon = 0.00000000001 if x<episilon and x>-episilon and n<0: return 0.0 s = 1 if n>0 else -1 result = self.helper(x,n*s) if s==1: return result return 1/result def helper(self,...
994,034
91747a55751cc33590389603e303cdf900cf5677
import sys import time import numpy import statistics """ Each sudoku board is represented as a dictionary with string keys and int values. e.g. my_board['A1'] = 8 """ ROW = "ABCDEFGHI" COL = "123456789" order_of_selection = [1,2,3,4,5,6,7,8,9] def print_board(board): """Helper function to print board in a squ...
994,035
0e5338ac6aa795a1c7666e850766f6e1af7fe1d4
# https://leetcode.com/problems/sort-list/ from typing import List class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def sortList(self, head: ListNode) -> ListNode: return head root = ListNode(1) root.next = ListNode(2) root.next.next = ListNode(3)...
994,036
0a6142bc468c0946de4cd034ea2748ffa53e5a4e
from django.urls import path, re_path from .views import Home_List app_name = 'home' urlpatterns = [ path('', Home_List.as_view(), name='home'), ]
994,037
22384b1ede0cd5111bef06d06053fdbf9f7c7f1b
# from dailycodingproblem.com # # Daily Challenge #1085 # Given a string of digits, generate all possible valid IP address combinations. # IP addresses must follow the format A.B.C.D, where A, B, C, and D are numbers between 0 and 255. Zero-prefixed numbers, # such as 01 and 065, are not allowed, except for 0 itself. ...
994,038
7445109bfe9000a2d2680b2b9da59ffe0e2c1b9e
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.devtools.clouderrorreporting.v1beta1 import error_stats_service_pb2 as google_dot_devtools_dot_clouderrorreporting_dot_v1beta1_dot_error__stats__service__pb2 class ErrorStatsServiceStub(object): """An API for retrieving a...
994,039
c1c38598afe1f1427adb0c37af0b9265133aa4db
from django.db import models from lego.apps.podcasts.permissions import PodcastPermissionHandler from lego.utils.models import BasisModel class Podcast(BasisModel): source = models.CharField(max_length=500) description = models.TextField() authors = models.ManyToManyField("users.User", related_name="auth...
994,040
5a62f28e616d29581d3c511572dd7a05cab888f9
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Create data module.""" import pandas as pd def create_dataframe(): """Create the dataframe for the dashboard.""" df = pd.read_csv('data/data.csv', header=0) return df def get_data(): df = pd.read_csv('data/data2.csv', ...
994,041
8de7cca58070ba401136ea98a08345cd672f2281
""" Similar to decorators, context-managers are tools that wrap up the code While decorators wrap up defined classes or functions, context-managers wrap up arbitrary, free-form blocks of code (i) exit is guaranteed even if internal code raises an exception """ # context-manager syntax try: my_file = open('/path/to...
994,042
b7be1925c220ca21dead4eac10b020ff9e2b5334
import datetime import gzip import json import logging import shutil import unittest import os from log_analyzer import load_config, get_last_log_file, render, calculate_metrics, openfile, \ extract_date_frome_file_name, create_parser, parse_report logging.disable(logging.CRITICAL) class TestLogAnalyzer(unittes...
994,043
288c75b6772f8085f86c089749377b7967943abd
import unittest import caffe import numpy as np import cv2 class ImgFlatten(caffe.Layer): def setup(self, bottom, top): assert len(bottom) == 1, 'requires a single layer.bottom' assert len(top) == 1, 'requires a single layer.top' params = eval(self.param_s...
994,044
eb61f5c5f5de3e17b90c58ddec5bac1043ef1861
from apistar import http, exceptions from users.models import User from project.settings import NO_AUTH_ENDPOINTS, ORIGIN class Cors(): def on_response(self, response: http.Response): response.headers['Access-Control-Allow-Origin'] = ORIGIN class MustBeAuthenticated(): def on_request(self, path: htt...
994,045
cf0dbb0ed7197cde7611cf51805ee61fb14246b0
from tkinter import * from tkinter import filedialog import os from PIL import ImageTk, Image import time class UI: def __init__(self,window): self.window = window self.window.minsize(width=600, height=500) self.window.wm_title("Photo Viewer") self.folderPath = StringVar() ...
994,046
abc295b4721ca0633984e56811e8c6de8edd082d
# Virtualized High Performance Computing Toolkit # # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved. # # This product is licensed to you under the Apache 2.0 license (the # "License"). You may not use this product except in compliance with the # Apache 2.0 License. This product may include a number of subcomp...
994,047
82f5d6173f19684f129fe7978a9bab17ef275e6f
# Instructions # You are going to write a List Comprehension to create a new list called squared_numbers. # This new list should contain every number in the list numbers but each number should be squared. # e.g. `4 * 4 = 16` # 4 squared equals 16. # DO NOT modify the List numbers directly. Try to use List Comprehensi...
994,048
6459163799934a6b8b51251b4ec295fbb5db0f57
#!/usr/bin/env python # -*- coding: UTF-8 -*- # script_utils.py --- # # @Filename: script_utils.py # @Description: # @Author: Weijie Li # @Created time: 2018-03-18 17:35:59 # @Last Modified by: # @Last Modified time: import src.messages.messages_pb2 as pb def script_to_verify_key(vk): return pb.Script(body=[p...
994,049
f74ef18ae6e42e936397fe78d793e220f10c7310
def suma (): global x Y = 3 x = Y + x print ("la x de la funcion suma es_: ", x) def main (): global x x = 8 x = x + 10 suma() print("la x del main es: ", x) main()
994,050
29c2860fe65a0bb6ad57ade7c5ea1a1b6f32e4d5
import timeit import unittest import random import numpy as np def read_data(filename): with open(filename) as f: array = [] for line in f: array.extend([int(x) for x in line.split()]) return array def selection_sort(num_list): i = 1 while i < len(num_list): ...
994,051
03d36284928326e7690ecb111a06d5f9b960b05c
#!/usr/local/bin/python3.7 #-*- coding: utf-8 -*- ''' Created on 2019年5月2日 fv.Start -- shortdesc fv.Start is a description It defines classes_and_methods @author: Tux48 @version: 0.1 @copyright: 2019 organization_name. All rights reserved. @deffield updated: Updated ''' from flask import...
994,052
91b948fd3223267cbb0d031c8ea75d3e146015cb
from django.urls import path from rest_framework.routers import SimpleRouter from src.recommendation import views router = SimpleRouter() router.register(r'productprice', views.ProductPriceViewSet, 'ProductPrice') router.register(r'category', views.CategoryViewSet, 'Category') router.register(r'productimage', views....
994,053
d1305075228241cbbe1889cdf05c474ef56ddece
print("\033[1;47mOlá, mundo!\033[m")
994,054
4ac41580d967e71664bfb5a9368a982c3b371061
from xai.brain.wordbase.adjectives._backup import _BACKUP #calss header class _BACKUPS(_BACKUP, ): def __init__(self,): _BACKUP.__init__(self) self.name = "BACKUPS" self.specie = 'adjectives' self.basic = "backup" self.jsondata = {}
994,055
0938826cc0f56b199f7fa027572cf303af4860eb
from django.shortcuts import ( render, redirect, reverse, HttpResponse, get_object_or_404) from django.conf import settings from django.contrib import messages from products.models import Product def view_basket(request): """ View that renders the shopping basket contents page """ context = { 'd...
994,056
8d07f7d9eb8f638f46a0afe1ef082c85ca46f079
from car_controller.car_controller_ import CarController # pragma: no cover import time import numpy as np import cv2 from matplotlib import pyplot as plt THRESHOLD = 100 # less means more stricts EROSION = 2 # Iteration. More means thicker DILATION = 2 # Iteration. More means more is removed MIN_MATCH_COUNT = 8 BO...
994,057
f9f29e26a02d619bebb51d6d742b135a1fc05af2
import csv import sys import numpy as np import tensorflow.compat.v1 as tf # type: ignore import Jann.utils as utils tf.disable_v2_behavior() def process_pairs_data(args): """Main run function to process the pairs data.""" tf.logging.info('Select and save {} random pairs...'.format( args.num_lines...
994,058
47cb96c6eaae08acfc854bb16fcc42e1a226bed0
from pathlib import Path from datetime import datetime from unittest import mock import numpy as np import astropy.units as u from astropy.time import Time from sunpy.net import attrs as a from radiospectra.spectrogram2 import Spectrogram from radiospectra.spectrogram2.sources import SWAVESSpectrogram @mock.patch(...
994,059
4e45581b5ab09c14cc944fced3f8074f6017398f
import pygame import random import os pygame.init() pygame.display.set_caption("EndToper's cross-zero") WHITE = (255,255,255) BLACK = (0,0,0) #рассчет отнасительных координат 2 width, height = pygame.display.Info().current_w, pygame.display.Info().current_h WIDTH, HEIGHT = width, height width, height = ro...
994,060
018617327f0487a44a50856b03503948f574bef5
import numpy as np import dezero from dezero import cuda, utils from dezero.core import Function, Variable, as_variable, as_array # ============================================================================= # Basic functions: sin / cos / tanh / exp / log # ==========================================================...
994,061
d6274ba174cc492f58d8d1ae9957e498897f7a59
''' Wrapping params from app cell Useful because it can be hard to predict how the app cell will pass things in, and to retrieve params in different forms (e.g., CLI vs. prose) ''' import json from ..util.debug import dprint from .globals import Var class Params: ''' Provides interface for: -----------...
994,062
68a24863bf99f332eb82cb363c3e2acd71e3b685
import os import sys import transaction import hashlib from pyramid.paster import ( get_appsettings, setup_logging, ) from pyramid.scripts.common import parse_vars from ..models.meta import Base from ..models import ( get_engine, get_session_factory, get_tm_session, ) from ..models import...
994,063
5d2f2b0232842b2cf0ccd8a22c40a1298adb21e0
import requests import math import datetime from passlib.hash import bcrypt #BASE_URL = 'http://54.159.70.183/' BASE_URL = 'http://127.0.0.1:8888/' MAININCA_DATA_ENDPOINT = 'api/save_main_inca/' GET_MEASUREMENT_PROM = 'api/measurementPromedio/' ACTIVE_QHAWAX_ENDPOINT = 'api/get_all_active_qhawax/' SAVE_GAS_INCA_ENDPO...
994,064
7080acda444997c23370cccaf18981c750b5bceb
from django.apps import AppConfig class ssp(AppConfig): name = 'ssp' def ready(self): import ssp.signals
994,065
3277f256185b8d50a8fcc3d5607055bd7f05597b
#Cheryl Zogg HW3 - Problem 2 class Node: """base class""" def __init__(self, name, cost, utility): """ :param name: name of this node :param cost: cost of this node :param utility: utility of this node """ self.name = name self.cost = cost self.ut...
994,066
06bf731c66f3497088f27b85c69f58f68ec10002
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @Author : 成雨 @Contact : 1121352970@qq.com @Software: PyCharm @File : errors.py @Time : 2019-08-05 17:25 @Desc : """ from flask import jsonify from werkzeug.http import HTTP_STATUS_CODES def error_response(status_code, message=None): payload...
994,067
3e10fb47e15765269f273bf0098dc7c047faac89
import urllib from sp_api.api.products.products import Products def test_pricing_for_sku(): print(Products().get_product_pricing_for_skus([ ]))
994,068
ab6209c4d74d4cf9497f94529b9c471857bfe7ff
import numpy as np import jieba from gensim.models import word2vec from keras.utils import to_categorical from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.layers import Embedding, Dense, TimeDistributed, Dropout, LSTM, GRU, Bidirectional, Flatten import sys f...
994,069
eefaccb2c42b6c8e5109d74e0eb8c0a1f2b9944c
""" A bunch of diffeomorphisms of the real line. """ import numpy as np from contracts import contract from .. import GenericScalar @contract(x='array', alpha='>0') def power(x, alpha=2.0): return np.sign(x) * np.power(np.abs(x), alpha) # # @contract(x='array', alpha='>0') # def powerinv(x, alpha=2): # ...
994,070
41777a74ad00e6f5c1f985a0fcd8f3dd3b19d65b
import csv import re import sys def parse_args(): '''Parse arguments and excute operations according to the option. Returns: option: Option for the tool pattern: Pattern for the option filename: The csv file path ''' if len(sys.argv) < 2: print('Error: Argument missing...
994,071
b5109695da0369d5f1679596acfd12515029e994
# ------------------------------------------------------------------------------ # Project Euler - Problem 044 - Pentagon numbers # ------------------------------------------------------------------------------ # Problem Link: https://projecteuler.net/problem=044 # ------------------------------------------------------...
994,072
e299878ac00b2bbcb1328345290d5c10d6bf419b
#coding : utf8 #Author : taosenlin #Time : 2020/3/30 18:10 # Selenium中的xpath定位 # XPath即为XML路径语言,它是一种用来确定XML1文档中某部分位置的语言。 # 一、xpath属性定位 # 1、xpath通过元素的id、name、class这些属性定位 # //*[@id='kw'] //*[@name='wd'] //*[@class='s_ipt'] # 二、xpath其他属性 # 1、如果一个元素id、name、class属性都没有,这时候也可以通过其他属性定位到 # //*[@autocomplete='o...
994,073
792a8704693972606447d94ca9908bb2e1a73bb8
#main.py from order import Order o = Order() o.order_drink()
994,074
0ca6563fbc35bb4f9ee51b7256182062a143628f
#!/usr/local/bin/python from pprint import pprint as pp import json ''' The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten...
994,075
7fb7487ffbbae894319dc696a749c8d52f3b72db
# Copyright © 2022 Province of British Columbia # # 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...
994,076
b7d4a2e44592e3e170459f8f025c1b91e2544730
# The pipeline for constructing an MSM from msmbuilder.io import load_generic, load_trajs, save_trajs, save_generic from msmbuilder.msm import MarkovStateModel from msmbuilder.lumping import PCCAPlus import numpy as np import seaborn as sns import matplotlib matplotlib.use('Agg') from matplotlib.pylab import plt from m...
994,077
def51cdaf5c7f57f6566bb556b21fe067a208323
######## # Copyright (c) 2013 GigaSpaces Technologies Ltd. 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...
994,078
1c4fd49f0a52d4909634c24eb323c2d4d9235bb7
# coding: utf-8 class ISessionSource(object): """ A class which loads a session_id from different sources (such as queries, headers and etc.) """ def get_session_id(self): """ Return a session id :return: """ raise NotImplementedError() class ISessionBackend(...
994,079
84e2acad84092b49bc008019617668552ab50723
import tweepy import os import json import time from twitter_util.VideoMedia import VideoMedia from media_util import is_a_video, get_post_data, is_an_image class TwitterUtil: def __init__(self, config): auth = tweepy.OAuthHandler(config["consumer_key"], config["consumer_secret"]) auth.set_access_t...
994,080
38c69294f2b3526078033496fa2599ebc7a3a746
#!/usr/bin/env python #_*_coding:utf-8_*_ #print "消费升级驱动中国经济" #user_input1 = input("input your name:") #print ("user input msg:", user_input1 ) #name="daidai" #name=input("input your girl frend name:") #print(name) import os cmd=os.popen('df -h').read() print(cmd) import sys print(sys.path)
994,081
18db004a8a80d90a4a53a6f3617fca8ce36cc3e4
from distutils.core import setup import py2exe setup(windows=["__init__.py"], zipfile=None)
994,082
963eeecdaf3f5ab0b06a795fcb230d24ad34d164
import textwrap import io from cssypy.visitors import flatteners, formatters from cssypy import parsers, errors from cssypy import csstokens as tokens from cssypy.nodes.util import dump from cssypy.nodes import * from .. import base class Flattener_TestCase(base.TestCaseBase): def stylesheet_to_string(self, sty...
994,083
f0674999501ad84d9d663b56fc160bcae2a77c9c
import keyboard # using module keyboard import time import pyautogui while True: # making a loop try: # used try so that if user pressed other than the given key error will not be shown if keyboard.is_pressed('INS'): # if key 'q' is pressed while True: print('You Pressed A...
994,084
7e1e050758aa29cfaf18e989a2786e074ecf9930
""" 問題@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 右から読んでも左から読んでも同じ文章になる文を回文と言います。 入力された文が回文であるかどうかを判定するプログラムを作ってください。 (回文の例)しんぶんし、よるすいえいするよ、たいやきやいた、わたしまけましたわ、など。 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ネットで拾った回文リスト++++++++++++++++++++++++++++++++++++++++++...
994,085
3700cd973a25f4d5cb5319e789b0a20cd9be9476
import json import re import glob from mapping import * dict_data = {} dict_data['samsung'] = [] dict_data['nokia'] = [] dict_data['apple'] = [] dict_data['oppo'] = [] dict_data['xiaomi'] = [] dict_data['lg'] = [] dict_data['huawei'] = [] dict_data['vivo'] = [] def get_arr_path(path_folder): path_folder = path_f...
994,086
d0b946c27b793097a73f9feff4ada3a79f4d78ee
from django.dispatch import receiver from allauth.account.signals import user_signed_up from allauth.socialaccount.signals import social_account_added, social_account_updated, social_account_removed from allauth.socialaccount.models import SocialAccount, SocialToken from .models import Profile import re @receiver(use...
994,087
aa1bbedee76caa7627712ea60c662f8be24f87a1
from django.conf.urls import url from django.contrib import admin from chatbot.views import ChatBot, backup_chatbot urlpatterns = [ url(r'^subscribe', ChatBot.subscribe), url(r'^unsubscribe', ChatBot.unsubscribe), url(r'^backup', backup_chatbot), ]
994,088
be8cba5ef5e3f7d152302304c7946d368029aa08
from pyqtgraph import QtGui, QtCore import pyqtgraph as pg import numpy as np import matplotlib.pyplot as plt import sys import ipdb class Workersignal(QtCore.QObject): finished = QtCore.pyqtSignal() error = QtCore.pyqtSignal(tuple) result = QtCore.pyqtSignal(tuple) #prorgress = QtCore.pyqtSignal(tupl...
994,089
936ed60576bc7343fb9daefaa638ace5d25ab5cb
# !/usr/bin/env python # -*- coding:utf-8 -*- # 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 # https://www.tensorflow.org/get_started/mnist/...
994,090
0b363fd11a45acb0b0db9765fb2ce5d36972be15
# -*- coding: future_fstrings -*- # Copyright 2018 Brandon Shelley. 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 # #...
994,091
c0e6137b0442190edd871e16a12773e813928252
# -*- coding: utf-8 -*- """ Created on Thu Mar 2 11:04:38 2017 @author: HonkyT """ #from IPython import get_ipython #get_ipython().magic('reset -sf') # #from numpy import fft # om man skriver såhär begöver man itne använda np. # men eftersom jag behöver fler saker från nupy och jag redan skrivit np på all...
994,092
53b9d39b2c599bff4b2bf289d4fc5ff9e91dfa51
from django.shortcuts import render import django.contrib.auth.views as authviews from django.conf import settings from urllib.parse import quote def login(request): return render(request, 'oauthlogin/login.html', { 'oauth_providers': [(k, v) for k, v in sorted(settings.OAUTH.items())], 'next': q...
994,093
8e3f87b38c380608e4eb26dcb21ce0bf72ac4b81
import pycuda.gpuarray as gpuarray import pycuda.driver as cuda import pycuda.autoinit import numpy as np a_gpu = gpuarray.to_gpu(np.random.randn(5, 5).astype(np.float32)) a_doubled = (2 * a_gpu).get() print("ORIGINAL") print(a_doubled) print("DOUBLED MATRIX AFTER PyCUDA EXECUTION USING GPUARRAY CALL") print(a_gpu)
994,094
f9e8e68356260e2b928bff58e7c0eb7f9687f15a
# Benchmarking Suite # Copyright 2014-2017 Engineering Ingegneria Informatica S.p.A. # # 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 ...
994,095
8dc76d074f4777a4ae22d5f67f77b71d8deb3015
import abjad import baca from abjadext import rmakers from mraz import library ######################################################################################### ########################################### 04 ########################################## ###########################################################...
994,096
6a8e39889a7058bb2b927367c772ddbd205a67f8
#check if its palindrome or not string = raw_input("enter any string:") if (string == string[::-1]): print ("the string is a palindrome") else: print ("the string is not a palindrome")
994,097
bb6d2b1c12b23ab41b925fdfb7c40268db4c64f1
#!/usr/bin/python3 """ Module to execute the function that print a text.. """ def text_indentation(text): """ Function that prints a text with 2 new lines after each of these characters: ., ? and : """ i = 0 if type(text) != str: raise TypeError("text must be a string") ...
994,098
5fe8346fa41fbae4e99185928c659da3b3e53638
# MIT License # # Copyright (c) 2021 Yusuf Cihan # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
994,099
6e08a9b2b0e4de2908c5ef4aa35bbc82b5fe80f7
# -*- coding:utf8 -*- import getpass import sys from optparse import OptionParser from pexpect.exceptions import TIMEOUT from api.api import Api from api.inputClient import InputClient from api.outputClient import OutputClient from constants.ParamsException import ParamsException from service.color import redStr, gre...