index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
14,900
af10f9032c020c97d0a073f5c3aafc79aa963d42
#!/usr/bin/env python3 import sys import re def indent(line): return len(line) - len(line.lstrip(" ")) def main(): list_re = re.compile("^ *([0-9]+.)") stack = [1] indent_stack = [0] for line in sys.stdin: m = list_re.match(line) if not m: print(line, end="") ...
14,901
7444bdeb99a64c39ca6675ab0d58fdc0ada6736f
import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import argparse from Tensor.real_tensor import RV_tensor from Tensor.binary_tensor import binary_tensor from Tensor.count_tensor import count_tensor import numpy as np from SSVI.SSVI_TF_robust import SSVI_TF_robust from SSVI.SSVI_TF_...
14,902
b21386b7974954e86fad49980d258f7162b430d5
import time import numpy as np import math from numpy.random import rand import matplotlib.pyplot as plt import matplotlib as mpl class Up_down_flip_model(): def __init__(self,N,step,label='simple flip model'): self.N = N self.step=step self.config = self.init_grid(N) self.J = self....
14,903
cd9314f1e5a94d4758cb5ae5f27e4321482cd348
# -*- coding: utf_8 -*- # Copyright (C) 2012 Olaf Radicke # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
14,904
7f592044e6f7b0a1927a4f080a31581f1e269ee3
import copy # Constants X = 'X' O = 'O' class Tictactoe: """ Tictactoe contains the game model. All the function related to the game's structure is in this class. """ def __init__(self): """ Initializes a new Tictactoe game. Creates player and board. """ # Current...
14,905
9995560e51e9805a48805ab523ae0befb2b5eed7
# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 and # only version 2 as published by the Free Software Foundation. # # This program is distributed in the hope t...
14,906
463ef3e4e52ed5f46304fea7e759a72c8128fa9d
# A Floater is Prey; it updates by moving mostly in # a straight line, but with random changes to its # angle and speed, and displays as ufo.gif (whose # dimensions (width and height) are computed by # calling .width()/.height() on the PhotoImage from PIL.ImageTk import PhotoImage from prey import Pre...
14,907
c241a10734d6540a4afa4116f9d7a84546ab40cf
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from SR_Dataset import SR_Dataset, ToTensor import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.use...
14,908
1668a6723d81836eece00b1cc75e84ec2c7d08c0
##Author: Rashmi Varma ##Created: September 28, 2017 ##Career and Job Center Agent ##Agent accepts a list of free-form keywords from the command line and outputs Career ##and job opportunities that closely match the input keywords. Agent uses ##k-nearest neighbor algorithm to find matches for any given value of k. l...
14,909
d4a6bfa8678851c31d63a03813e5b9984b913924
# -*- coding: utf-8 -*- import arcpy import pandas as pd #日本地図のShape inFeatures = "D:\python\soccer\japan_ver80.shp" #更新するフィーチャクラスがあるgdb arcpy.env.workspace = "C:\ArcPySample\ArcPyJapan.gdb" field_list = [] for field in arcpy.ListFields(inFeatures): if field.type != "Geometry": field_list.append(field.n...
14,910
de3abc02fcdbf86799ca821f4e5e89658a5e5d1b
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = "WAW" addresses_name = ( "2023-05-04/2023-03-28T16:20:27.419644/Democracy_Club__04May2023.tsv" ) stations_name = ( "2023-05-04/2023-03-28T16...
14,911
97e9bf171fa134c833ac64204f4fa7689a358666
import os, subprocess import astropy.io.fits as fits from astropy import wcs import numpy as np import scipy.ndimage as ndimage from scipy.ndimage.filters import median_filter from pyklip.instruments.Instrument import Data import pyklip.klip as klip class Ifs(Data): """ A spectral cube of Osiris IFS Data. ...
14,912
ea1596099c323315a947612cf6fe484f31caf05d
# -*- coding: utf-8 -*- """ Created on Mon Feb 29 12:40:03 2016 @author: taivo """ import igraph g = igraph.Graph(3) igraph.plot(g, "test.png")
14,913
672f5dd5553463e4ab23e46d67a12b081fb800b1
# Question Regarding API Design request.is_ajax()
14,914
3bdb8639cb53fdcd70894c6338f96b4a147ec6ce
from keopscore.formulas.Operation import Operation from keopscore.utils.code_gen_utils import ( c_variable, c_for_loop, ) #################################### ###### Tensor product ##### #################################### class TensorProd(Operation): string_id = "TensorProd" def __init__...
14,915
355580a75d9802193a0eae3474d92aaf6d4a0726
"""webweb2 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
14,916
8ef215135f04ef03275d811f52ec600299be6478
# Generated by Django 3.1.3 on 2020-12-01 18:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Tasker', '0015_auto_20201130_1559'), ] operations = [ migrations.AlterField( model_name='url', name='links', ...
14,917
ba92e368c247bf07e9242f1247624559766311cc
# -*- coding: utf-8 -*- """ Created on Sun Mar 29 15:16:25 2020 @author: Vasilis """ import turtle #%% #for i in range(100): # print("We like Python's turtles!") #%% #wn = turtle.Screen() turtle.clearscreen() vasi=turtle.Turtle() for i in range(3): vasi.forward(50) vasi.left(120) for i in range(4): ...
14,918
8796e341299d17c23706099aad0e36eadac5c312
def verify(num1,num2): if num1 > num2: return num1 elif num1 == num2: return 1 else: return num2 def display(arg1,arg2): if(verify(arg1,arg2)==arg1): print("A") elif(verify(arg1,arg2)==1): print("C") else: print("B") display(1000,3500)
14,919
93c39f0f5c27a2ea910b2519a0360c5b797b53ae
import numpy as np import matplotlib.pyplot as plt def load(densityfile): data={} data['temperature'],data['density']=np.loadtxt(densityfile,unpack=True) return data def fit(x,y,substance): plt.plot(x,y,'o', markerfacecolor='#2166ac', markeredgecolor='#053061', markersize=8, markeredgewidth=1.5) for...
14,920
d4bc112955e9ad9c7ba82f3549eab636fbe3941a
from flaskRun import getDriver def f_1mg(medicine): # driver = getDriver() # URL = "https://www.1mg.com/search/all?name="+medicine # r = requests.get(URL) # soup = BeautifulSoup(r.content,'html.parser') # # print(soup.prettify()) # name = "" # cost = "" # name_table = soup.find('div',attrs = {'class':'style...
14,921
1ed3087b7a39324fd29f128abd989a9c53bb8406
from datetime import timedelta import socket import os class Config: SERVICE_NAME = 'Minitwit' HOST = socket.gethostbyname(socket.gethostname()) PORT = 80 DEBUG = True RUN_SETTINGS = { "host": HOST, "port": PORT, "debug": DEBUG } JWT_ACCESS_TOKEN_EXPIRES = timede...
14,922
0bf87f7e61b614a4331e57113ac46f8986b446bf
import numpy as np def app_products2optimisation(products): # вес P — x1, к --x2 # c = [-250,-210] #Функция цели 250x1+210x2 – уменьшение расходов на продуктовую корзину ; # A_ub = [[15,4]] #'1' жиры последовательно для Р и К # b_ub = [14] #'1' 15x1+4x2 <=14 – ограничение количества жира; # A_eq ...
14,923
6ad575b90c3d3eb6d296ed16849d0cc30f02fa37
# Python from unittest import mock import uuid # patch python-ldap with mock.patch('__main__.__builtins__.dir', return_value=[]): import ldap # NOQA # Load development settings for base variables. from awx.settings.development import * # NOQA # Some things make decisions based on settings.SETTINGS_MODULE, so t...
14,924
93046717752971c336289dc5c2e534e0f6e44897
r=int(input()) m=[] for i in range(r): curr=[int(v) for v in input().split()] m.append(curr) n1,n2=input().split() n1,n2=int(n1),int(n2) print(m[n1-1][n2-1])
14,925
44b66a43b926b222989bce1ef70c2084d88d6bef
for _ in range(int(raw_input())): print raw_input().replace('><', '<>').count('><')
14,926
2ffd2630f9d7b5f34bc1a7a2bea25bb2d1cb8b67
#!/usr/bin/python import argparse import subprocess import sys import os ## # Set env subenv = os.environ.copy() def set_queue_host(): kafka_client_pod = ( subprocess.Popen( "kubectl get pods |grep debug-kafka-client |awk '{print $1}'", shell=True, env=subenv, ...
14,927
77d3260848a5eed3b78bc2dc006ae2fcbdf25e08
TEXTO = "Soy una constante"
14,928
a0b350345f082c09b82acf3145f79856274c22fe
import csv virus_list = {} def create_virus_list(): with open('data.csv', 'r') as csvfile: i = 0 csv_reader = csv.reader(csvfile) for disease in csv_reader: if i > 1: fatality = disease[1] for index, character in enumerate(fatality): ...
14,929
f53874851e3b77620b78a9f291079fe6d16a1c76
""" Django settings for robocat project. Generated by 'django-admin startproject' using Django 3.0.2. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os #...
14,930
ab02fd7afcc113fe2c1b9aa7697a1ea08e6f4b00
from django.contrib.auth.models import User, Permission from django.test import TestCase from django_fsm import has_transition_perm from testapp.models import BlogPost class PermissionFSMFieldTest(TestCase): def setUp(self): self.model = BlogPost() self.unpriviledged = User.objects.create(usernam...
14,931
1318c706fcea91ef086c8f52a7d13d103cc84bc6
# 정수 2개 입력받아 비교하기4 a, b = map(int, input().split()) print(a!=b)
14,932
574f832a403483e823aca6de990b54bcfba7426c
i = 0 v = 1 while i < 99: v = v + v * (1/2) i += 1 print(v)
14,933
316fdadcccd3dfdd634c40a49932e24c214c4a39
#!/usr/bin/env python3 from ncclient import manager conn = manager.connect( host='192.168.24.252', port='830', username='netconf', password='juniper!', timeout=10, device_params={'name':'junos'}, hostkey_verify=False) result = conn.command('show version', fo...
14,934
c9194e8ff690165129b04479c1f925769954c347
import logging import argparse import numpy as np from sklearn.cluster import KMeans as sk_kmeans from sklearn.cluster import MiniBatchKMeans as minibatch from methods.util_models import * from sklearn.metrics import pairwise_distances class KMeans(sk_kmeans): """A KMeans class that will attempt to perform clus...
14,935
0a352d08587cd19351c184bca87946a8cb336822
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/18 15:27 #while循环 a = 1 #判断条件表达式 while a < 10: #执行条件循环体 print(a) a += 1
14,936
f40d05ddc48dec484d1183f540a2719b7b0b8c93
"""securitysystem URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Clas...
14,937
028c99c3a090098286ac53ef6340d8a6bc5697f9
# coding: utf-8 # # Project 2 on Bayesian Learning Regression # In[1]: import numpy as np import scipy as sci import pandas as pd import math from matplotlib import pyplot as plt # In[2]: #data raw prepare train_100_10 = pd.read_csv('/Users/jianwenliu/MLPP2/pp2data/train-100-10.csv') train_100_100 = pd.read_cs...
14,938
d39f1976dcf03b9a0a333a528cb9b3b512cdd93c
from django.apps import AppConfig class BusybeeConfig(AppConfig): name = 'busybee'
14,939
f7451922a2703e3d1533d812c5d85f0ea152fc5f
# ---------------------------------------------------------------------------- # cocos2d # Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa, # Lucio Torre # Copyright (c) 2009-2019 Richard Jones, Claudio Canepa # All rights reserved. # # Redistribution and use in source and binary forms, with o...
14,940
8cdeb9163120a754dcc276043870e4479327e17b
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2011, Michal Rezny <miisha@seznam.cz>' __docformat__ = 'restructuredtext en' import socket, re...
14,941
bc55c045de07b5802ab40d63b178bfcb4210f7ff
from cc3d.core.PySteppables import * class SBMLSolverSteppable(SteppableBasePy): def __init__(self, frequency=1): SteppableBasePy.__init__(self, frequency) def start(self): # Antimony model string model_string = """model test_1_Antimony() # Model S1 => S2; k1*S1 ...
14,942
febd42e19bd79934c78d37405ae12c39ef929000
#!/usr/bin/python from __future__ import print_function import solidscraper as ss import traceback import argparse import codecs # utf-8 text files import json import os from collections import defaultdict from datetime import datetime from datetime import timedelta from dateutil import tz import time def toFixed(s...
14,943
67bb1a6be71f637c73934d20bd724dadbdc71a3c
from django.utils.translation import ugettext_lazy as _ from django.db.models.signals import pre_save from django.dispatch import receiver from .base import * class Country(Base): name = models.CharField( verbose_name=_('Name'), max_length=200, null=True ) c_index = models.CharFiel...
14,944
4ab38cb73baec7473bc2f75cf13e2f4ddd21c3ca
import json class Tree: def __init__(self, root, branches): self.root = root self.branches = branches def __repr__(self): # a = ' '.join(self.root) + ' '.join(self.branches) return json.dumps(self.branches) + self.root # a
14,945
d48f5cc11542a4677375366381e7c469801184a3
# -*- coding: utf-8 -*- from .cases import * from .simple_test_cases import *
14,946
cf438b6fa67bfdacdba859e706daafa06127137c
# -*- coding: utf-8 -*- """ Lin GUO """ import pandas as pd import numpy as np import matplotlib.pyplot as plt train=pd.read_csv('data_subsets/0_6.csv') meta_train = pd.read_csv('metadata_train.csv') def phase_indices(signal_num): phase1 = 3*signal_num phase2 = 3*signal_num + 1 phase3 = 3*signal_num + ...
14,947
de5ba9c122515fce3203affdfe11a2c2fe3c4344
# a tentative script to upload all existing drstree "versions" into CMIP sqlite database # each variable, mip, experiment, model, ensemble combination add a new instance in "instance" # for each instance there should be at least one version in "version" table # for each version add at least one file in table "files" ...
14,948
96c6016362799363992157988a4e7137da22c9e3
from django.urls import path from . import views from django.conf.urls.static import static from django.conf import settings from django.conf.urls import url, include from .feeds import AllPostRssFeed from django.views.static import serve from blog.settings import MEDIA_ROOT app_name = 'blog_app' urlpatterns = [ p...
14,949
843eb1776030e2306ca9c1e93aa2ca6fe279f54b
import datetime as dt import re from src.schema.movie import MovieSchema, MovieSearch from marshmallow.exceptions import ValidationError from src.models.movie import Movie from flask import jsonify def request_to_schema(request, toSearch = False): if not request.is_json: return jsonify({"msg": "Missing JSO...
14,950
5890841ac59bdc1220956f1a8bbb042af776b522
#!/usr/bin/python import sys total_post = 0 for line in sys.stdin: data = line.strip().split("\"") total_post += int (data[1]) print ("Total post ", total_post)
14,951
ed3b3396500b660d494085799baa05ae712a375f
import pandas as pd from openpyxl import load_workbook class DataFrame(object): def __init__(self,casepath,sheet_name): self.testcase = pd.read_excel(casepath,sheet_name = sheet_name) def fill_null(self,column): #处理excel中存在合并的单元格导致dataframe为空的的数据项,method = 'ffill'向上填充 self.testcase[column].fullna(method='f...
14,952
0858b404343ebfc129d3206f4311263b85b219c9
import numpy as np import matplotlib.pyplot as plt from collections import Counter prob = [0.1, 0.2, 0.3, 0.1, 0.2, 0.1] dice = list(range(1, 7)) samples = np.random.choice(dice, size=100000, p=prob) tmp = Counter(samples) print(tmp) print(tmp.__class__) X = sorted(tmp.keys()) Y = [tmp[x] for x in X] ...
14,953
f9595838ef33b69a5ccbbd0850760ce7a461bda6
from django.core.management.base import BaseCommand, CommandError from shorten.models import KirrURL class Command(BaseCommand): help = 'Refresh all shortcodes' def add_arguments(self, parser): parser.add_argument('--items', type=int) def handle(self, *args, **options): return KirrURL.obje...
14,954
7135329bce670012ebf6ba1ac93b9a77c35e415a
from django.db import models from employees.models import * # Create your models here. class Department(models.Model): department_name = models.CharField(max_length=30) department_dec = models.ForeignKey( 'self', on_delete=models.SET_NULL, blank=True, null=True, ) def...
14,955
1d9f7c1fbb78a99d6089a274d6e253107b5e16a9
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 1 19:23:15 2021 @author: Oscar Talero """ #====================================================================== # E S P A C I O D E T R A B A J O A L U M N O # ====================================================================...
14,956
c8fb8e73b182db4a55bebb690cdc8eda72ff2e70
import math def main(): #escribe tu código abajo de esta línea a=4 b=5 oper1= 2*(3/4) +4*(2/3) -3*(1/5) +5*(1/2) print (round(oper1,4)) oper2= 2* math.sqrt(35**2)+ 4* math.sqrt(36**3)- 6* math.sqrt(49**2) print (round(oper2,4)) oper3= (a**3 +2*b**2)/(4*a) print (round(oper3,4)) ...
14,957
b9058a6aab33b979446747c464912e2f5e9ee77f
"""Modify cached data to include class_id. Other stages in the nr set will need to use the database ids when writing to the database. Instead of having to keep looking up the mapping and check if entries exist we put it all in one place. """ import copy from pymotifs import core from pymotifs.nr.builder import Know...
14,958
419ea76c731861d97b1cf9b25bbec30d2c79653f
#!/usr/bin/env python # coding: utf-8 # In[ ]: ### load Data import tensorflow as tf import gzip from time import time from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) import keras as ks import keras import numpy as np import tensorflow.keras.backend as K from random import r...
14,959
2892ee5aedd10c1df2d4c53e79895e49059d03d1
# coding: utf-8 ''' function: 1. 鼠标事件 作用: 1. 为视频选定区域 ''' import cv2 import os import config as cfg import numpy as np def get_rect(image, title='get_rect'): ''' 获取两次鼠标点击事件得到的矩形框 :param image: :param title: :return: (x1, y1), (x2, y2) ''' mouse_params = {'tl': None, 'br': None,...
14,960
5d5c72551ac012e12a33c31118553a776149f99c
"""Implementation of node listing, deployment and destruction""" from __future__ import absolute_import import datetime import itertools import json import os import re import string import libcloud.compute.providers import libcloud.compute.deployment import libcloud.compute.ssh from libcloud.compute.types import No...
14,961
8d9a8a3cc7b5d8b34f67b604d94bf9e30d568d5a
from django.shortcuts import render from . import models, forms, check # Create your views here. def campground_checker_view(request): """Handles availability requests and loads the form for users to submit requests.""" # If POST request, retrieve data from API if request.method == 'POST': form = ...
14,962
09cd01e9698959760ffd893a6ebb98d0f18339a1
import maya.cmds as cmds import maya.OpenMaya as om from collections import OrderedDict #----------------------------------------------------------------------------------------------------------------------------------------------# def Hitch_L_LegSnap(prefix=''): ################# ikfkValue = cmds.getAtt...
14,963
43c207d3aa864b36ed27b71904c01b3d77ab9310
class Solution: def romanToInt(self, s: str) -> int: encodeTable = { "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000 } total = 0 if not s: return total i = len(s) -...
14,964
9205e857cc9fef576abfb03d9822cae487929ae4
# coding: utf-8 """ Test different reading data from different mass runs """ from __future__ import absolute_import, unicode_literals, division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os, sys # Third-party import astropy.units as u from astropy.constants import G from...
14,965
c751b5e6154ac522bb2693273ae8f2d8c9b2849a
import pygame import random from kreis import Kreis pygame.init() pygame.display.set_mode((500, 500)) pygame.display.set_caption("Zufällige Kreise") kreise = [] counter = 0 bRun = True while bRun: pygame.time.delay(100) for event in pygame.event.get(): if event.type == pygame.QUIT: bRun ...
14,966
35a63a0a35ec2f8ffb83e0525bb91b6ef2781fa4
# Generated by Django 3.0.8 on 2020-12-07 10:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('estimate', '0001_initial'), ] operations = [ migrations.AddField( model_name='estimate', name='category', ...
14,967
585ea2240cbd825f04c7c7048ef8b45c648ba382
from django.shortcuts import get_object_or_404, render from django.template.loader import render_to_string from django.http import * from django.urls import reverse from django.template import loader, Context from django.contrib.auth.models import User from django.core.validators import * from django.core.mail import *...
14,968
19316b060e80c2f517dd176ff1a9a4e3389813e2
""" This file Create by Fawziah Almutairi Created on Mon Dec 16 01:25:40 2019 Programming for Geographical Information Analysts: Core Skills. @author: ml18fksa, the Student ID is 201288865 Geography Programming Courses at University of Leeds "" This file called the GUI which means build a Graphical User Interface a...
14,969
8b3c33430a3b4acd071005a7ccb63187da248774
# Python Activtiy # # Fill in the code for the functions below. # The starter code for each function includes a 'return' # which is just a placeholder for your code. # import regular expression module import re # # Part A. starts_with_number # Define a function starts_with_number(s) that takes a string and returns tr...
14,970
98eec42ff428193c6ecdab1e80204287d1466714
# Generated by Django 3.0.2 on 2020-01-13 09:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fyle', '0001_initial'), ] operations = [ migrations.AddField( model_name='expense', name='approved_at', ...
14,971
5109eb2ffd5d01484a8cb1b7fd588d7214116878
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2014, 2015 Patrick Moran for Verizon # # Distributes WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy...
14,972
cfc013980821c6b4a7f81bac475b8993b5b44a65
admin_credentials = {'userName': 'Administrator', 'password': 'wpsthpvse1'} enclosure_name = "CN75120D7B" drive_enclosure_name = "CN75120D7B, bay 3" expected_number_of_DE = 1 expected_number_of_drives = 8
14,973
53139af1063dd8c2a5595ac727704a7b8d8665b8
from src.SegmenterWindow import SegmenterWindow from PySide2.QtWidgets import QApplication if __name__ == '__main__': import sys app = QApplication(sys.argv) window = SegmenterWindow() window.setGeometry(100, 50, 1000, 1000) window.show() sys.exit(app.exec_())
14,974
cee5867565e33d825914487f7502e64305745b82
# Copyright (c) 2018 Uber Technologies, 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 ag...
14,975
37bc0011ca12da8995ad97176de3002e52aa3f40
#!/usr/bin/env python # coding: utf-8 # In[1]: import argparse import logging import os import json import pickle from pathlib import Path from utils import Tokenizer, Embedding from dataset import Seq2SeqDataset from tqdm import tqdm import torch from torch import nn from torch.autograd import Variable as V import ...
14,976
42a9657c4e46be69a1ad152dc38c241864421a85
''' Created on 27. nov. 2014 @author: JohnArne ''' from hmac import trans_36 import requests import os from sentiwordnet import SentiWordNetCorpusReader, SentiSynset import nltk from pos_mappings import TYPECRAFT_SENTIWORDNET import gettext import codecs import subprocess import pickle class Lexicon(): """ Ha...
14,977
ed7a0fd7ef4383817a3a350ff3a78c7ddafd0419
""" http://memosisland.blogspot.com/2013/04/reading-binary-data-files-written-in-c.html """ import numpy as np import matplotlib.pylab as plt def load_file(fileHead): dt = np.dtype("f4, f4, f4, f4, f4, f4, f4, f4, f4, f4, f4, f4, i8") # dt = np.dtype([('x', f4), ('vx', f4), ('y', f4), ('vy', f4), ('z', f4)...
14,978
264fa5a9cf3f125ce8ad5afa43e1710626fde4e9
#-*- coding:utf-8 -*- import jieba import sys import codecs import ipdb def cut_and_write(input_file, output): with open(output,'w+') as fo: with open(input_file, 'r') as fi: for line in fi: stripped_line = line.strip().decode("utf-8", 'ignore').split('\t') line...
14,979
fb76a8997cd76275ae63b65f6e19ccb8ad5b33e9
str_me = "abcd" str_arr = ["a","b","c","d"] for s in str_arr[::]: print("{}".format(s), end="") print("") print("<< This is same >>") for s in str_me[::]: print("{}".format(s), end="") print("")
14,980
75f3bb9661f0f327a4764d2618264813ddea4ab1
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
14,981
50eb131d8b7c4f0c08276a7b8648514d39f23937
# © Copyright Databand.ai, an IBM Company 2022 import pytest from more_itertools import last from dbnd import task from dbnd._core.current import try_get_current_task_run from dbnd._core.tracking.commands import set_external_resource_urls from dbnd.testing.helpers_mocks import set_tracking_context from test_dbnd.tra...
14,982
0329e00fc0ce4235c409072027c148218d004f5e
# -*- coding:utf-8 -*- # __author__ = 'gupan' """ 数据库操作接口: 在conf.settings模块中设置了DATABASE """ from conf import settings import os import sys import json class Db: """ 改进建议(未实现功能): 该类封装了一个数据库的初始化以及sql执行函数 建议后期封装一个Db_Handle类,该类集成了sql语句的执行方法,而Db类的功能只是初始化Db_Handle对象 """ """ 根据conf.sett...
14,983
84c770269f7c9c67646654d8f3fffafa7c3f6e1b
# -*- coding: utf-8 -*- """ Created on Mon Oct 7 11:44:30 2013 @author: jinpeng.li@cea.fr """ import unittest import numpy as np from sklearn import datasets from epac import Methods from epac.workflow.splitters import WarmStartMethods from epac.tests.utils import comp_2wf_reduce_res from epac.tests.utils import com...
14,984
e7a51ae5c4e28a953255ab196c67b8513d039515
#!C:\Python38\Python import datetime import tkinter as tk from PIL import Image,ImageTk window=tk.Tk() window.geometry("300x400") window.title(" Age Calculator App ") name = tk.Label(text = "Name") name.grid(column=0,row=1) year = tk.Label(text = "Year") year.grid(column=0,row=2) month = tk.Label(text = "Month") mon...
14,985
423b378a83eef4af3fe31f9ebfef411cdfde6a32
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
14,986
bf879a3d67e8ab433c03519b21ce21a116f90692
from datetime import datetime from concesionario import * if __name__ == "__main__": coches1 = [ Coche("V40", 2.0, "Diesel", 120, "", datetime.date(2019,2,2), 0), Coche("S90", 2.0, "Diesel", 150, "", datetime.date(2017,11,15), 23435) ] coches2 = [ Coche("A3", 1.0, "Gasolina", 115, "", dat...
14,987
caef589b135da0b341888fe8efb9b21574873ca5
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('athletes', '0006_auto_20150726_0203'), ('trainings', '0008_auto_20150803_2141'), ] operations = [ migrations.AddFiel...
14,988
d77e1ab60c32dbe46a40f895a5fba8cce8b5786f
from suds import Client class TimeFilter: """Represents a Deep Security TimeFilter Transport""" def __init__(self, suds_client, rangeFrom=None, rangeTo=None, specificTime=None, time_type="LAST_HOUR"): self.rangeFrom = rangeFrom self.rangeTo = rangeTo self.specificTime = specificTime ...
14,989
1d533c1e874d172d413ef20fe147434f193cb910
import requests from bs4 import BeautifulSoup import pandas as pd from selenium import webdriver import time import pickle LL_URL = 'https://jollyturns.com/resort/united-states-of-america/loveland-ski-area/skiruns-green' AB_URL = 'https://jollyturns.com/resort/united-states-of-america/arapahoe-basin/skiruns-green' C_U...
14,990
0144c497b2dc446ba7241ab37479b2bbaf8fcea1
from time import sleep import xlwt from xlwt import Workbook from bs4 import BeautifulSoup import requests from datetime import date def write_xls_header(filename): wb = Workbook() sheet1 = wb.add_sheet('Sheet 1') sheet1.write(0, 0, 'Surname/Name') sheet1.write(0, 1, 'Language Link Name') ...
14,991
fd15ea4873fbec7c4a4f270e61832810015aa945
from django.db import models # Create your models here. # Dataset model will contain all the 3,33,333 records. class Dataset(models.Model): word = models.CharField(max_length=100000) count = models.CharField(max_length=100000000000000) def __str__(self): return self.word
14,992
3bcb3ab455ed80c8c639da19024c347345613a1d
def underline(text): return '\u0332'.join([c for c in text]) + '\u0332'
14,993
0508e675d07a13f48510fdbc62896c938270144c
def myfunc(): print('Hi, I am a func inside mymodule.py')
14,994
e1b60d0d96e088f9b964a1d8f818ecbe83639ed4
# Retrieve functions from datetime import datetime as dt import math import re import time import dateutil.parser import requests import json import config as cfg import numpy as np def get_filter_object(filterTerm, fieldName, filterValue=None, fieldValue=None): """ Returns a filter object that can be included in...
14,995
06ef9c88c3719c02a2919b6dfe0d7a11ae5813c5
# !/usr/bin/python # -*- coding:utf-8 -*- # 定义api """ 栈的定义: 一个后进先出的集合。 class Stack<Item>: Stack() 实例化栈对象 void push(Item item) 将元素入栈 Item pop() 弹出栈顶元素 bool is_empty() 判断栈是否为空 int size() 返回栈的当前容量 __iter__ 返回栈的迭代器对象 __next_...
14,996
dfbcb0ee59248865e0365b4d510e60c396ef4829
import random class robo: x = random.randint(300, 600) y = random.randint(500, 600) color = (153, 51, 0) class bola: x = 400 y = 300 thickness = 10 color = (255, 255, 0) class line: xi = robo.x+0.5 yi = robo.y xf = bola.x yf = bola.y thickness = 1 ...
14,997
b846b87a45d9f74b36e95c150e599cdcbb27818f
# Programmers Coding Test Practice # 2018 KAKAO BLIND RECRUITMENT [1차] 뉴스 클러스터링 # # https://programmers.co.kr/learn/courses/30/lessons/17677 # # ============================================================================== from string import ascii_uppercase from copy import deepcopy def get_multiple_set(string):...
14,998
c107be358ea37ac32543dabd96b4df3a0048a01b
from io import BytesIO from subprocess import Popen, PIPE import pytest def lzo_stream(*, length: int = 4096): """ Compress a string of null bytes, the length being defined by the argument to this function. """ compressor = Popen(["lzop", "-c"], stdin=PIPE, stdout=PIPE, stderr=PIPE) stdout, ...
14,999
e3fe40178140cc9dedffd1e1918d8ccb528d4913
class Solution: def swimInWater(self, grid): """ :type grid: List[List[int]] :rtype: int """ n=len(grid) count=-1 grid2=[[n**2 for i in range(n)] for j in range(n)] grid2[0][0]=grid[0][0] while count!=0: count=0 ...