text stringlengths 8 6.05M |
|---|
from database_connection import DatabaseConnection
from validation import Validation
from query import Queries
conn = DatabaseConnection.dbconnection()
cursor = conn.cursor()
class Supervisor:
def __init__(self, id):
"""
Initializing and to get the team no of a supervisor.
:param id:
... |
import time
import dash_bootstrap_components as dbc
from dash import Input, Output, html
placeholder = html.Div(
[
dbc.Button("Load", id="loading-placeholder-button", n_clicks=0),
dbc.Placeholder(
html.Div(id="loading-placeholder-output"),
className="w-100",
ani... |
from GF2 import one
from itertools import chain, combinations
def powerset(iterable):
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
a=[one,one,one,0,0,0,0]
b=[0,one,one,one,0,0,0]
c=[0,0,one... |
#
# Contains the FPSession class, which maintains an authenticated
# session with the fadedpage server.
# Need to install the requests package.
#
import requests
import json
from requests.exceptions import ConnectionError
from os import mkdir, path, rmdir, listdir, remove
import os
class FPSession(object): #{
def ... |
# albus.db
from .base_types import IntegerType, StringType
__all__ = [
'IntegerType',
'StringType',
]
|
# encoding: UTF-8
# Copyright 2017 Google.com
#
# 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... |
#!/usr/bin/env python3
# Python 3.2.3
# Linux/Unix
# James Jessen
# 10918967
# CptS 355
#-------------------------------------------------------------------------------
# Used this value because it's less than 80 and
# aligns nicely with both the histogram and digraph output.
_PRINT_WIDTH = 78
#debugging = True #... |
#!/usr/bin/env python
import math
import random
import csv
VERBOSE = False
def prob(r1, r2):
return r1*(1.-r2)/(r1*(1.-r2)+r2*(1.-r1))
class Outcome(object):
def __init__(self, name):
self.name = name
def __call__(self, team1, team2):
return NotImplementedError
class Seed... |
#This code appears to work, but it's too slow for leetcode
class ListNode():
def __init__(self, x):
self.val = x
self.next = None
def insertionSortList(head):
newHead = head
if head == None or head.next==None:
return head
curr= head.next
while curr != ... |
from django.db import models
class Artist(models.Model):
artist = models.CharField(max_length=100, null=False)
def __str__(self):
return self.artist
class Song(models.Model):
id = models.AutoField(primary_key=True, null=False, verbose_name="ID")
song = models.CharField(max_length=100, null=... |
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.http.response import HttpResponse
import json
from jobs.dao import select_jobs
from jobs.controller import JobCraw
def into_jobs(req):
return render_to_response('jobs.html',RequestContext(req))
def get_j... |
import subprocess
import time
directoryRoot = "/home/damianossotirakis/__Zallpy/__tlog/"
directoryConfig = "portaloficinas-config/"
directoryEureka = "portaloficinas-eureka/"
directoryGateway = "portaloficinas-gateway/"
directoryApiClient = "portaloficinas-api-client/"
directoryApiAuth = "portaloficinas-api-auth/"
dir... |
# A first Python script
import sys # Load a library module
print(sys.platform)
print(2 ** 10) # Raise 2 to a power
x = 'Spam!'
print(x * 8) # String repetition
nextInput=input(); # Take a input from the console
print(nextInput); # print the input
title="Welcome to the python wor... |
#!/usr/bin/env python
# Copyright 2009-2014 Eucalyptus Systems, 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 app... |
# TUPLES
# tup1 = ('MIT is the best!', 1, [], 'Yo!', 3)
# NOTE they are immutable (can't change elements' values)
# print(tup1)
# print(tup1[0])
# print(tup1[0:1])
# tup2 = ((1,'one'), (2, 'two'), (3, 'three'), (2, 'two'))
# def get_data(aTuple):
# nums = ()
# words = ()
# for t in aTuple:
# ... |
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from manage import app, db
class ContactUsModel(db.Model):
id = db.Column('id', db.Integer, primary_key=True)
name = db.Column('name', db.String)
email = db.Column(db.String, unique=True, nullable=False)
creation_date = db.Column('c... |
a = [[10, 20], [30, 40], [50, 60]]
print(a)
a = [[10, 20],
[30, 40],
[50, 60]]
#이차원리스트[행][열]
a[0][0] = 1000
a[1][1] = 2000
a[2][1] = 3000
print(a)
for i, j in a:
print(i, j)
for i in range(len(a)): #행의 개수
for j in range(len(a[i])): #열의 개수
print(a[i][j],end=" ")
print()... |
import numpy as np
import math
import os
import h5py
def ReadH5File(filename):
# return the first h5 dataset from this file
with h5py.File(filename, 'r') as hf:
keys = [key for key in hf.keys()]
data = np.array(hf[keys[0]])
return data
def WriteH5File(data, filename, dataset):
with h5p... |
import pandas as pd
import geopandas as gpd
import os
from shapely.geometry import Point, LineString, shape
from geopandas.tools import sjoin
import contextily as ctx
import matplotlib.pyplot as plt
import seaborn as sns
import tqdm
import geoplot
# 0. A brief exploration of the data
# Check date range, the distribut... |
import asyncio
from asyncio.exceptions import CancelledError
async def producer(q):
for i in range(10):
await q.put(i)
await asyncio.sleep(0.1)
## finishing
await q.put(None)
async def watcher(q, name):
while True:
task = await q.get()
if task is not None:
p... |
"""Main module of the Dota 2 subreddit Responses Bot.
The main body of the script is running in this file. The comments are loaded from the subreddit
and the script checks if the comment or submission is a response from Dota 2. If it is, a proper reply for response is
prepared. The response is posted as a reply to the... |
# coding=latin1
print("¿")
print("¿")
print("abc")
|
# pylint: disable=C0111
from setuptools import setup
with open("README.md", "r") as fh:
README = fh.read()
setup(
name='oneforge',
version='0.1.0',
description='1Forge REST API wrapper',
long_description=README,
long_description_content_type='text/markdown',
author='Renato Orgito',
aut... |
from django.db import models
# Create your models here.
class station(models.Model):
sno = models.CharField(max_length=4)
sna = models.CharField(max_length=128)
sarea = models.CharField(max_length=128)
lat = models.FloatField()
lng = models.FloatField()
ar = models.CharField(max_length=128)
... |
import os
import glob
import unittest
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def my_test_suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='*_test.py')
return test_sui... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask,render_template,request,redirect,url_for
from werkzeug.utils import secure_filename
import os,time
import base_func
app = Flask(__name__)
@app.route('/upload', methods=['POST', 'GET'])
def upload():
if request.method == 'POST':
base_func.b... |
# Behold my beautifully inelegant solution to the Project euler 39
def pf(number):
if number == 1:
return [1]
factors = []
subnumber = number
divisor = 2
temp = subnumber/divisor
while temp % 1 == 0:
factors.append(divisor)
subnumber = temp
temp =... |
"""
Hacked together router with Werkzeug because GCF does not support full Flask apps
"""
# hack together router with werkzeug because google cloud functions does not
# support full flask apps
from werkzeug.routing import Map, Rule, NotFound
from werkzeug.exceptions import MethodNotAllowed, HTTPException
import reques... |
# Copyright 2020 Pulser Development Team
#
# 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 i... |
"""relaydomains API v1 unit tests."""
import json
from django.urls import reverse
from modoboa.admin import factories as admin_factories, models as admin_models
from modoboa.lib.tests import ModoAPITestCase
from modoboa.transport import factories as tr_factories, models as tr_models
class DataMixin(object):
""... |
from django.urls import re_path
from elections.views.sync import get_election_fixture
from .views import (
CONDITION_DICT,
FORMS,
AllElectionsView,
ElectionTypesView,
IDCreatorWizard,
ReferenceDefinitionView,
SingleElection,
)
id_creator_wizard = IDCreatorWizard.as_view(
FORMS,
url... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 13:03:35 2020
@author: Ayax
"""
import pandas as pd
import numpy as np
datos = pd.read_csv('crx.data', sep=',',header=None)
datos = datos.replace(np.nan, '0')
datos = datos.replace('?', '10')
print(datos)
from sklearn.preprocessing import LabelEncoder... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from mock import patch
from wadebug.wa_ac... |
#!/usr/bin/python3
#import main mongo connect class
from joiningSegments.mongoConnect import mongoConn
config = {
"host" : "127.0.0.1",
"port" : 27017,
"db" : "testing"
}
print (config["db"])
if __name__ == "__main__":
"""make new monogo conn"""
dbConn = mongoConn(config["host"], config["port"]... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, indictrans and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt, getdate, nowdate, now_datetime
from frappe import msgprint, _
from f... |
import os
import tarfile
from six.moves import urllib
import pandas as pd
from pandas.plotting import scatter_matrix
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import hashlib
from sklearn.datasets import fetch_mldata
from sklearn.model_selection import train_test_split, StratifiedShuffleSplit,... |
from urllib.request import urlopen
url = "http://olympus.realpython.org/profiles/aphrodite"
page = urlopen(url)
html_bytes = page.read()
html = html_bytes.decode("utf-8")
tag = {"title":"", "head":"", "html":"", "body":""}
for i in tag:
tag_startindex = html.find("<" + i + ">") + len("<" + i +">")
... |
#!/usr/bin/env python
#
# Copyright (c) 2011 Polytechnic Institute of New York University
# Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#... |
from turtle import*
setup(800,800)
pendown()
seth(0)
fd(150)
seth(90)
fd(150)
seth(180)
fd(150)
seth(270)
fd(150)
done() |
class Check:
def __init__(self, item_name, location, email):
self.item_name = item_name
self.location = location
self.email = email
def dictify(self):
return {
'item_name' : self.item_name,
'location' : self.location,
'email' : self.email
... |
import re
from datetime import timedelta
from django import forms
from django.db.models import Q, F
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.postgres.search import SearchQuery, SearchRank
from core.forms.widgets import (AutocompleteSelectMultiple,
... |
x = float(input())
print((x % 1), "\n", int(x % 1 * 10))
|
# -*- coding: utf-8 -*-
#十進位換算
a=int(input())
print(format(a,"X"))
|
# from nipype.interfaces import fsl
from nipype.interfaces.fsl import (FLIRT, FAST, ConvertXFM, ImageMaths)
import nibabel as nib
import numpy as np
from scipy.ndimage.morphology import binary_erosion as erode
from nipype.pipeline import Node, Workflow
from nipype.interfaces.utility import IdentityInterface, Function
f... |
from django.conf import settings
from django.shortcuts import redirect
from django.urls import reverse
from . import views as user_views
from django.core.cache import cache
from datetime import datetime
from django.contrib import auth
import time
from django.contrib import messages
from django.contrib.auth imp... |
from operator import truediv
def mean(arr):
return truediv(sum(arr), len(arr))
def get_mean(arr, x, y):
if min(x, y) < 2 or max(x, y) > len(arr):
return -1
return truediv(mean(arr[:x]) + mean(arr[-y:]), 2)
# # Python 3
# from statistics import mean
#
#
# def get_mean(arr, x, y):
# if min(x... |
################################################################################
# \file SConstruct
# \brief The SCons master build script for the persistent rnn kernels.
################################################################################
import os
def mkdir(name):
if not os.path.isdir(name):
os.mk... |
import bitmex
import settings as s
client = bitmex.bitmex(api_key=s.API_KEY, api_secret=s.API_SECRET)
data = client.Trade.Trade_getBucketed(
binSize = '5m',
symbol='XBTUSD',
count=100,
reverse=True
).result() |
# Generated by Django 3.1.7 on 2021-03-25 14:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('audio', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='audiobook',
options={'verbose_name': 'Audio Bo... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 20 15:52:06 2017
@author: Diabetes.co.uk
"""
#this module need to be used at the start, it will automatically extract all of the
#entities and nouns of the questions and answer, from the question and answers with class file,
#and append them to create the sampledatabsecs... |
# ############################################################################ #
# #
# ::: :::::::: #
# config.py :+: :+: :+: ... |
import sys
input = sys.stdin.readline
numbagoose = int(input())
point = (0, 0)
dist = -1
for _ in range(numbagoose):
x, y = [int(i) for i in input().split()]
if (x ** 2 + y ** 2) ** 0.5 > dist:
dist = (x ** 2 + y ** 2) ** 0.5
point = (x, y)
print(point[0], point[1])
|
import poplib
serv = poplib.POP3_SSL( 'tamdil.iitg.ernet.in' , '995' ) # replace tamdil with your IITG Webmail server
serv.user( 'username' )
serv.pass_( 'password' )
|
'''
Created on Dec 8, 2016
@author: micro
'''
from skimage import feature |
### python基础语法
## 数据类型与变量
# print('I\'m ok.')
# print('I\'m learning\nPython.')
# print('\\\n\\')
# print('\\\t\\')
# # 用r''表示''内部的字符串默认不转义
# print(r'\\\t\\')
# # 用'''...'''的格式表示多行内容
# print('''line1
# line2
# line3''')
# print(True)
# print(False)
# print(3>2)
# print(2<1)
#
# # 布尔值可以用and、or和not运算。
# # and运算是与运算,... |
import uuid
from django.db import models
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from ..common.models import Article
from ..utils import upload_and_rename
def upload_and_rename_product_detail(instance, filename):
return upload_and_rename(instance.pk, fi... |
h = open('Day1/numbers.txt', 'r')
# Reading from the file
content = h.readlines()
foundSum = False
# Iterating through the content of the file
for x in range(0, len(content)):
for y in range(x+1, len(content)):
sum2020 = int(content[x]) + int(content[y])
if sum2020 == 2020:
fou... |
#!/usr/bin/python
import sys, re
pattern_reg = re.compile('^.+:(\d+):(\d+): (error|warning):')
first_error = -1;
msg_error = "";
first_warning = -1;
msg_warning = "";
for line in sys.stdin:
line = line.rstrip('\n')
m = re.search(pattern_reg, line)
if (m):
# in the pattern, each set of parenthese... |
import os
import pandas as pd
from rdkit.Chem import Descriptors
import rdkit.Chem as Chem
import matplotlib.pyplot as plt
import seaborn as sns
def Nrot(row):
""" Get number of rotatble bonds
Parameters
----------
row:
row of pandas.DataFrame containing SMILES field
Returns
-------
... |
#
# spectral_sequence_class.py
#
import numpy as np
from multiprocessing import Pool
from functools import partial
from ..simplicial_complexes.differentials import complex_differentials
from ..gauss_mod_p.gauss_mod_p import gauss_col_rad, gauss_barcodes
from ..persistence_algebra.barcode_bases import barcode_bas... |
#!/usr/bin/python
import time, imaplib, getpass, socket
missing_libs = []
# Try to import pynotify
try:
import pynotify
except ImportError:
missing_libs.append('python-notify')
# Try to import gnomekeyring
try:
import gnomekeyring as gk
except ImportError:
missing_libs.append('python-gnomekeyring')
... |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... |
class Student:
def __init__(self,name,years):
self.__name = name
self.__years = years
def set_weight(self,weight):
self.__weight = weight
def get_weight(self):
return self.__weight
stu = Student('Eason',21)
stu.set_weight(125)
print(stu.get_weight()) |
# 標準入力を受け付ける。
N = int(input())
A = list(map(int, input().split()))
# 数字の出現回数を配列でメモしておく。
# num_cnt_list[0]の要素は利用しない。
num_cnt_list = []
for _ in range(N + 1):
# 数字の出現回数の初期値を0としておく。
num_cnt_list.append(0)
for i in range(N):
num_cnt_list[A[i]] += 1
# 一度でも2回以上同じ数字が出現したら`No`, そうでなければ`Yes`を出力する。
if num_... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 18:42:52 2019
@author: SMA
"""
### load modules
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import os
from collections import defaultdict
import missingno
pd.set_option('display.float_format', lambda x: '%.5f' % x)
###... |
class MockSocket(object):
def __init__(self):
self.connected = False
self.timeout = 0
self.ipaddr = None
self.ipport = None
self.buffer = []
self.request = []
def settimeout(self, timeout):
self.timeout = timeout
def connect(self, ipaddrAndipportTup... |
from django.db import models
from product.models import Item
class Cart(models.Model):
code = models.CharField(max_length=10)
ship_value = models.DecimalField(max_digits=6, decimal_places=2)
total = models.DecimalField(max_digits=100, decimal_places=2, default=0.00)
timestamp = models.DateTimeField(au... |
# 用try--except捕获断言异常
res1 = {'code': 1, 'msg': '登陆成功'}
res2 = {'code': 0, 'msg': '登陆失败'}
try:
assert res1 == res2
except AssertionError as e:
print("编号A1用例不通过!")
raise e # 处理异常后,抛出异常
else:
print("编号A1用例通过!")
|
# -*- coding: utf-8 -*-
"""API endpoints for CRUD operations."""
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils.functional import cached_property
from django.http import Http404
from rest_framework.decorators import list_... |
from spack import *
import sys,os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../common'))
from scrampackage import write_scram_toolfile
class EigenToolfile(Package):
url = 'file://' + os.path.dirname(__file__) + '/../../common/junk.xml'
version('1.0', '68841b7dcbd130afd7d236afe8fd5b949f017615... |
import json
import logging
import time
from functools import wraps, partial
from flask import Flask, Response, request
from flask_cors import CORS
from requests import RequestException
from api.douban import DoubanAPI
from api.weibo import WeiboAPI
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(modu... |
__author__ = 'Elisabetta Ronchieri'
import unittest
from tstorm.tests.atomic import atomics
from tstorm.tests import utilities
def ts_dcache_ping(conf, ifn, dfn, bifn, uid, lfn):
s = unittest.TestSuite()
s.addTest(atomics.AtomicsTest('test_dcache_ping',conf, ifn, dfn, bifn, uid, lfn))
return s
def ts_sto... |
from __future__ import division
from collections import defaultdict
from math import *
from random import sample
import csv
from operator import itemgetter
import matplotlib as mpl
import matplotlib.pyplot as plt
import random
class BaseAlgorithm():
#def __init__(self):
# self.update_data()
def upda... |
import re as regex
from PyInquirer import style_from_dict, Token, ValidationError, Validator
CUSTOM_STYLE = style_from_dict({
Token.Separator: '#6C6C6C',
Token.QuestionMark: '#FF9D00 bold',
Token.Selected: '#5F819D',
Token.Pointer: '#FF9D00 bold',
Token.Answer: '#5F819D bold',
})
STATES_LIST = ['A... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
random.seed(42)
import numpy as np
np.random.seed(42)
import matplotlib.pyplot as plt
import cvxpy as cp
from sklearn_lvq import GmlvqModel, LgmlvqModel
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from sklear... |
site_configuration = {
'systems': [
{
'name': 'dt',
'descr': 'Dardel test nodes',
'hostnames': ['dt\d.pdc.kth.se'],
'modules_system': 'lmod',
'partitions': [
{
'name': 'cpu',
'descr': 'CPU on ... |
import random
name_list = input("Names Seperated by comma. \n").split(", ")
print(f"{name_list[random.randint(0, len(name_list) - 1)]}") |
import ete3
import sys
import os
sys.path.insert(0, os.path.join("tools", "msa_edition"))
import read_msa
random_alignment_format = "fasta"
def create_random_tree(msa_file, output_file):
global random_alignment_format
msa = read_msa.read_msa(msa_file)
tree = ete3.Tree()
tree.populate(len(msa.get_entries())... |
"""
FENICS script for solving the thermal Biot system using mixed elements with monolithic solver
Author: Mats K. Brun
"""
#from fenics import *
#from dolfin.cpp.mesh import *
#from dolfin.cpp.io import *
from dolfin import *
import numpy as np
import sympy as sy
# <editor-fold desc="Parameters">
dim = 2 ... |
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_protect
import numpy as np
np.set_printoptions(suppress=True)
import pandas as pd
from sklearn.cluster import KMeans
import json
@csrf_protect
def predicted(request):
if request.method == 'POST':
n_clusters = request... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Hanzhiyun'
import functools
def log(*arg):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
if not arg:
print('Begin call %s():' % func.__name__)
func(*args, **kw)
... |
# -*- coding: utf-8 -*-
"""This filters the bookcrossing data
http://www.informatik.uni-freiburg.de/~cziegler/BX/
prerequisite: the data is in the folder /BX-SQL-Dump
excludes all implicit ratings
excludes all users having < 20 ratings
writes the dump to .dat files (same format as in the MovieLens files)
To use this,... |
from django.db import models
from datetime import timedelta
class User(models.Model):
name = models.CharField(max_length=150)
def __str__(self):
return self.name
class Blog(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
created = models.DateTimeField(... |
from django.urls import path, include
from rest_framework import routers
from bandas.models import *
from webservices.views import *
router = routers.DefaultRouter()
router.register(r'bandas', banda_viewset)
router.register(r'roles', rol_viewset)
router.register(r'integrantes', integrante_viewset)
router.register(r'na... |
# Class definition of a linked list
class Node:
def __init__(self, data, next=None):
self.data=data
self.next=next
# Reverse a linked list
def reverse_linked_list(node):
prev_node = None
curr_node = node
while curr_node != None:
next_node = curr_node.next
curr_node.next... |
import os
import re
from django.db import models
from Portal.ConfigParser.ConfigParser import ConfigParser
# Create your models here.
configParser = ConfigParser(os.path.dirname(os.path.realpath(__file__))+"/createForm.cfg")
admissionDetailsInfo = configParser.getAdmissionDetails()
class PersonalDetails(models.Mode... |
#!/usr/bin/env python
from helpers.string import uppercase, lowercase # 1) importing specifics thing i.e. function
from helpers import variable # 2) importing a specific module
import helpers # 3) importing the entire package ... |
#Python Program to Find the Largest Number in a List
List = [1,2,4,5,7,9,10,11,15,20,]
print(List)
List = max(List)
print("The Largest Number is",List)
|
L = ["alen","unix","windows"]
for n in L :
print ("hello,%s!"%n) |
import socket
# Create a server socket
serverSocket = socket.socket()
print("Server socket created")
# Associate the server socket with the IP and Port
ip = "192.168.0.101"
port = 5000
serverSocket.bind((ip, port))
print("Server socket bound with with ip {} port {}".format(ip, port))
# Make th... |
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
# We can extent existing user model to consider team member
from django.contrib.auth.models import AbstractUser
#
#
# class User(AbstractUser):
# phone_number = PhoneNumberField()
# role = models.PositiveSmallIntegerField(c... |
from django import forms
from .models import Choice, Question
from django.forms import ModelForm, formset_factory
from django.forms.widgets import RadioSelect
class ChoiceForm(ModelForm):
EXCELLENT, GOOD, MEDIUM, BAD = 'EX', 'GO', 'ME', 'BA'
question_choices = (
(EXCELLENT, 'عالی'),
(GOOD, 'خوب... |
# -*- encoding:utf-8 -*-
'''Android 代码中的接口搜索'''
import os
#androidCode = "D:\\Code\\Android\\app\\src"
class searchAndroidInterface:
def __init__(self, codePath, resPath):
'''CodePath: Android code path;
resPath: save result of search '''
self.androidCodePath = codePath
self.re... |
import random
# my_list = []
# length = 0
# with open("sowpods.txt", "r") as open_file:
#
# line = open_file.readline()
# my_list.append(line)
# while line:
# length += 1
# my_list.append(line)
# line = open_file.readline()
with open("sowpods.txt", "r") as open_file:
lines = o... |
import requests
for i in range(1,10):
print(i)
image_name_dir = 'images/' + str(i) + '.png'
f = open(image_name_dir,'wb')
request_url = 'https://static-nft.pancakeswap.com/mainnet/0x0a8901b0E25DEb55A87524f0cC164E9644020EBA/pancake-squad-' + str(i) + '-1000.png'
r = requests.get(request_url)
if... |
# -*- coding: utf-8 -*-
import json
from django.test import TestCase
from zipcodes.factories.zipcode import ZipCodeFactory
from zipcodes.models import ZipCode
class ZipCodeResourceTest(TestCase):
def setUp(self):
self.ribeirao = ZipCodeFactory.create(
address='Avenida Presidente Vargas',
... |
import pandas as pd
import os
import scipy.stats
import numpy as np
import json
import h5py
import tensorflow as tf
import chrombpnet.training.utils.argmanager as argmanager
import chrombpnet.training.utils.losses as losses
import chrombpnet.training.metrics as metrics
import chrombpnet.training.data_generators.initial... |
import os
import sys
import json
import re
import requests
from flask import Flask, request
app = Flask(__name__)
from flaskext.mysql import MySQL
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'XXX'
app.config['MYSQL_DATABASE_PASSWORD'] = 'XXX'
app.config['MYSQL_DATABASE_DB'] = 'XXX'
app.config['MYSQL_DATABAS... |
from Interfaz.Window import Window
import os
#class starting the program
class Init():
def __init__(self):
Window()
def __readFile(self, path_file):
with open(path_file, encoding="utf-8") as f:
fileContents = f.read() # Get all the text from file.
... |
from abc import abstractmethod
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import sklearn
from sklearn.svm import SVR
from sklearn.model_selection import KFold
import xgboost as xgb
import optuna
class BaseModelCV(object):
model_cls = None
def __init__(self, n_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.