text stringlengths 8 6.05M |
|---|
import math
from hypothesis import given, assume
from hypothesis.strategies import sampled_from, floats, data, integers
from pytest import raises
from renard.renard import (RenardSeriesKey, series, rrange, find_less_than_or_equal, find_greater_than_or_equal,
find_nearest,
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from image_cropping import ImageRatioField
from ckeditor.fields import RichTextField
from multisitesutils.models import Site... |
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
from torch import optim
from graphgallery.nn.models import TorchKeras
from graphgallery.nn.layers.pytorch import GCNConv, activations
from graphgallery.nn.metrics.pytorch import Accuracy
from graphgallery.nn.init.pytorch import gloro... |
from sys import stdin
from math import ceil, log
from decimal import Decimal as d
class RMQ(object):
def __init__(self, numbers):
self.e = []
n = len(numbers)
if (n & (n-1))!=0:
x = ceil(log(n, 2))
self.n = 2**x;
while n != self.n:
... |
""" pluginSearch.py
* This class looks for plugins and creates a dictionary containing.
the plugin models. Plugin objects can be instanciated elsewhere.
The plugins are identified by a certain string contained in the
first x charcters of the python file. Plugins should have a .py
extension.
John Eslick, Car... |
#this is a simple program which verifies the creditcard number using luhns algorithm
while True:
card_number=list(map(int,input("Enter the card number here")))
if len(card_number)==16:
break
checker=card_number.pop()
for x in range(14,-1,-2):
card_number[x]*=2
if card_number[x]/10>=... |
#!/usr/bin/python
import mysql.connector
##
# Create .fasta file for trans and prot seqs from gene_db database
##
### Start up connection
dbh_gene_db = mysql.connector.connect(user='s12', password='jazzduck', database='gene_db')
cursor_gene_db = dbh_gene_db.cursor()
# select all gene + transcripts from trancript ta... |
from util import NUM_NODES, read_file, get_initial_state, open_nodes, calc_heuristics
def pathfinding():
open_states = []
initial_state = get_initial_state(nodes)
open_states.append(initial_state)
while len(open_states) > 0:
current_state = open_states[0]
if len(current_state.path) ... |
MOVIE_API_KEY = '<19eb2c37e12c55e93facdf16eae63d25>'
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import fields, models
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = 'res.partner'
contract_count = fields.Integer(compute='_compute_contract_count',... |
import numpy as np
import pandas as pd
import networkx as nx
class Simulador_MIP():
def __init__(self, archivo_domestico, archivo_total):
self.carga_datos(archivo_domestico, archivo_total)
self.define_varibles_calculadas()
self.vectores_coeficientes()
self.matrices_coeficientes_tecn... |
def reverse_string_in_place(input):
input = list(input)
start = 0
end = len(input) - 1
while(start < end):
input[start], input[end] = input[end], input[start]
start += 1
end -= 1
return input
if __name__ == "__main__":
print(reverse_string_in_place("inputs"))
|
# -*- coding: utf-8 -*-
import json
import numpy as np
import copy
import time
import os
import sigraph
import pandas as pd
import random
#Pytorch
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
#Brainvisa
from soma import aims
#from deepsulci.sulci_labe... |
import cv2
import numpy
from matplotlib import pyplot as plt
img = cv2.imread('./../sheep.jpg',0)
# laplacian = cv2.Laplacian(img,cv2.CV_64F)
sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5)
sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5)
laplacian = cv2.Sobel(sobelx,cv2.CV_64F,0,1,ksize=5)
plt.subplot(2,2,1),plt.imsho... |
import pandas as pd
import numpy as np
data = pd.read_csv('/data-out/titanic.csv', index_col='PassengerId')
passengers = len(data)
"""
Сколько м/ж
"""
male = (data['Sex'].value_counts()['male'])
female = len(data) - male
ans1 = (male, female)
with open('/data-out/1.txt', 'w') as f:
f.write(str(male))
f.writ... |
from django.conf.urls import url
from .views import GithubWebHook
urlpatterns = [
url(r'^github/web/', GithubWebHook.as_view(), name='github_web'),
]
|
import sqlite3
import time
import os.path
import feedparser
from datetime import datetime
import re
from flask import g
from views import app
DATABASE = 'tmp/rockneurotiko.sqlite'
DEBUG = True
SECRET_KEY = 'zumTUzM3IhUVQgeX9c55'
def connect_db():
"""Returns a new connection to the sqlite database"""
return s... |
from employee import Employee
class MyNode:
def __init__(self,data,next1 = None):
self.__data = data
self.__next = next1
def getNext(self):
return self.__next
def setNext(self,other):
self.__next = other
def getData(self):
return self.__data... |
#!/usr/bin/env python
"""
Josh's Dumb-Ass Classifier
"""
import pprint
import sys,os, copy
sys.path.append(os.environ.get("TCP_DIR") + '/Software/feature_extract/Code/extractors')
import sdss, ned, ng
class bogus_sdss:
def __init__(self):
self.in_footprint = False
self.feature = {}
class JDAC:
... |
#!/usr/bin/env python
'''
package.py: part of singularity package
'''
from singularity.runscript import get_runscript_parameters
from singularity.utils import zip_up, read_file
from singularity.cli import Singularity
import tempfile
import tarfile
import hashlib
import zipfile
import json
import os
def package(ima... |
'''
python test.py output_file
'''
import numpy as np
import sys
from numpy.linalg import inv, det
from math import pi, exp
import time
if len(sys.argv) != 2:
print("python test.py output_file")
exit()
p_zero = 24720/(24720+7841)
mean_zero = np.load("gen_model/0_mean.npy")
mean_one = np.load("gen_model/1_m... |
from django.shortcuts import render_to_response, HttpResponseRedirect
from django.template import RequestContext
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.contrib import messages
from mapFriends.facebook import test_token, get_authorization_url,... |
#!/usr/bin/python
# Copyright (c) Members of the EGEE Collaboration. 2004.
# See http://www.eu-egee.org/partners/ for details on the copyright
# holders.
#
# 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 ... |
class Number:
def check(self,ch):
if (ch>='a'and ch<='z'):
print("Its an alphabet")
elif(int(ch)>=0 and int(ch)<=9):
print("Its an number")
ss=Number()
ch=input("Enter a charcater")
ss.check(ch)
|
import time
import numpy as num
import scipy as sci
import sympy as sym
from sympy import *
from numpy import *
from scipy import *
from scipy.sparse import *
x1 = 0; x2 = 0; x3 = 0; x4 = 0; y1 = 0; y2 = 0; y3 = 0; y4 = 0 # Initializing all variables necessary for the program
range_x = 0; range_y = 0; no_of_elements =... |
import numpy as np
import matplotlib.pyplot as plt
def load_data(filename):
f= open(filename,'r')
tmp_str=f.readline()
tmp_arr=tmp_str[:-1].split(' ')
N=int(tmp_arr[0]);n_row=int(tmp_arr[1]);n_col=int(tmp_arr[2])
print("N=%d, row=%d, col=%d" %(N,n_row,n_col))
data=np.zeros([N,n_row*n_col+1... |
import json
from pprint import pprint
data = json.load(open('file.json'))
print (data)
pprint(data) |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^sentiment/', include('sentiment.urls', namespace='sentiment')),
url(r'^twitter/', include('sentiment.urls', namespace='twitter')),
url(r'^stocks/', include('stocks.urls', namespace='stocks')),
url(r'^users... |
#!/usr/bin/env python
from flaskext.script import Manager, prompt_bool
from marked import app
# import fixtures as _fixtures
from marked.database import init_db
import os
manager = Manager(app)
@manager.shell
def make_shell_context():
from marked import models
return dict(app=app, mod=models)
@manager.comm... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-14 14:42
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
#-------------------------------- IMPORTS -----------------------------------
import requests
from bs4 import BeautifulSoup
import pandas as pd
import matplotlib.pyplot as plt
#------------------------ FUNCTION DEFINITIONS ------------------------------
def build_SQL_query(ra_range, dec_range, n_obj):
"""
... |
import numpy as np
import math
# 30个点的坐标
points = [(0, 0), (20, 36), (96, 14), (14, 59), (15, 35), (59, 74), (6, 7), (65, 52), (12, 44), (-67, 73), (-23, 0),
(-61, 68), (-25, 92), (-87, 87), (-81, 11), (-3, 16), (-24, -90), (-31, -50), (-30, -43), (-74, -28),
(-24, -21), (-6, -30), (-95, -76), (29,... |
import random as r
import time as t
import os
class Game():
incorrect = 0
count = 0
score_list = []
#타자연습에 들어갈 문장
Flower = []
Flower.append("여름장이란 애시당초에 글러서, 해는 아직 중천에 있건만")
Flower.append("장판은 벌써 쓸쓸하고 더운 햇발이 벌여 놓은 전 휘장 밑으로 등줄기 훅훅 볶는다.")
Flower.append("마을 사람들은 거지반 돌아간 뒤요, 팔리지 못한 나뭇군패가 길거... |
"""
Fractal trees and plants are among the easiest of fractal objects to
understand. They are based on the idea of self-similarity. Each of the branches is
a smaller version of the main trunk of the tree. The main idea in creating
fractal trees or plants is to have a base object and to then create smaller,
similar obje... |
from flask import Flask, request, render_template, flash, url_for
from flask import Response
from werkzeug.utils import redirect
import psycopg2
from AirBnb import compute_predictions
from werkzeug.utils import secure_filename
import os
from flask import send_from_directory
from Airbnb_config import FeatureSelection, D... |
from PIL import Image
import numpy as np
################ dilation
def dilation(kernel, input_name):
img_input = Image.open(input_name)
pixels_input = img_input.load()
dilation_output = Image.new(img_input.mode, img_input.size)
dilation_pixels = dilation_output.load()
# initial
for x in range... |
from sender.celery_app import celery_app
from sender.transport import Transport
@celery_app.task
def send_message(message_id):
"""Задача отправки сообщения
:param message_id: идентификатор сообщения
:return: результат отправки
"""
transport = Transport(message_id)
return transport.send()
|
(this was done in the console)
>>> #make a list with Monday, Tuesday, Wednesday
>>> week = ['Monday','Tuesday','Wednesday']
>>> week
['Monday', 'Tuesday', 'Wednesday']
>>> week[1]
'Tuesday'
>>> week[-2]
'Tuesday'
>>> week.append('Thursday')
>>> week
['Monday', 'Tuesday', 'Wednesday', 'Thursday']
>>> week[1:3]
['Tuesda... |
#With the "items" method, you can iterate over both keys and values of a dictionar
l={"france":"paris","india":"delhi"}
for country,capitals in l.items():
print("the capital of " + country + " is " + capitals + "")
|
import os
import sys
import logging
## ws_client and msg_ntk path
sys.path.insert(0, os.path.abspath("../ws_client"))
sys.path.insert(0, os.path.abspath("../msg_ntk"))
from ws_client import WebsocketClient
from msg_ntk import Map2DDataPUB
from msg_ntk import Map2DDataSUB
## LOGGING INFO
logging.basicConfig()
LOGGER... |
"""OctreeLevelInfo and OctreeLevel classes.
"""
from __future__ import annotations
import logging
import math
from typing import TYPE_CHECKING, Dict, List, Optional
import numpy as np
from napari.layers.image.experimental.octree_chunk import (
OctreeChunk,
OctreeChunkGeom,
)
from napari.layers.image.experime... |
import yfinance as yf
# msft = yf.Ticker("Visa")
# print(msft.info)
# #history = msft.history(period="max")
# temp = yf.Tickers
# history = msft.history(period="3d")
# print(history.size)
# print(len(history))
# #print(history.columns)
#
# print(history)
# for ind in history.index:
# for col in history.columns:
#... |
######Selection Sort
def selection_sort(l1)
for i in range(0,len(l1)):
max_index=0
max_val=l1[0]
for j in range(0,len(l1)-i):
if l1[j]>max_val:
max_index=j
max_val=l1[j]
#swaping max index with last index of sub array
last_index=le... |
class Translator():
"""Abstract class for translating standard ciphers (i.e. Morse Code)"""
key = []
def translate(self, *args):
"""Base method for decoding a cipher"""
raise NotImplementedError()
def interactiveTranslate(self):
"""For quick translating with each character typed from the user, type ! to re... |
"""FAM URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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 vie... |
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.core import serializers
from django.views import View
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf... |
import pygame, sys
import itertools
import time
import OpenGL.GL as gl
import neurodot_present.present_lib as pl
from neurodot_present.present_lib import Screen, CheckerBoard, UserEscape, VsyncPatch
pl.DEBUG = False
################################################################################
if __name__ == "__mai... |
"""
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from astropy import units as u
from astropy import constants as const
import scipy.integrate as integrate
from .default_cosmo import default_cosmo # define a default cosology for utilities
from .distance_func... |
import os
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("ggplot")
%matplotlib inline
from tqdm import tqdm_notebook, tnrange
from itertools import chain
from skimage.io import imread, imshow, concatenate_images
from skimage.transform import resize
from s... |
# -*- coding: utf-8 -*-
"""
Mesa Agent-Based Modeling Framework
Core Objects: Model, and Agent.
"""
import datetime
from .multilevel_mesa import MultiLevel_Mesa
__all__ = ["MultiLevel_Mesa"]
__title__ = 'multilevel_mesa'
__version__ = '0.0.1'
__license__ = 'MIT'
__copyright__ = 'Copyright %s Tom ... |
from bynarytree import ABR
from bynarytree import ARN
import random
from timeit import default_timer as timer
from matplotlib import pyplot as plt
import pickle
def random_array(n):
array = range(n)
for i in range(0, n):
array[i] = random.randint(0, n * 10)
return array
def random_array_ordered(... |
import crypt, spwd, syslog
def auth_log(msg):
"""Send errors to default auth log"""
syslog.openlog(facility=syslog.LOG_AUTH)
syslog.syslog("SSH Attack Logged: " + msg)
syslog.closelog()
def check_pw(user, password):
"""Check the password matches local unix password on file"""
try:
hashed_pw = spwd.getspnam(us... |
#!/usr/bin/env python3
import time
import random
import typing
import sys
def pos(data, size=4):
ret = []
for x in range(0, len(data), size):
ret.append( int.from_bytes(data[x:x+size], 'big') )
return ret
def neg(data, size=4):
s = b''.join([e.to_bytes(size, 'big') for e in data])
return ... |
s=input()
def solve(s):
l=s.split(" ")
texto=""
for i in l:
if i!="":
texto+=i.capitalize()+" "
else:
texto+=" "
return texto
print(solve(s))
|
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 09:15:57 2020
@author: Administrator
"""
import os
import sys
sys.path.insert(0,os.path.abspath('..'))
import time
import numpy as np
import pandas as pd
import SIMLR
from SIMLR import helper
from sklearn import metrics
from sklearn.metrics.cluster imp... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 12 15:03:51 2017
@author: ian
"""
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import pandas as pd
from scipy.stats import linregress
import DataIO as io
# Get data
f = '/home/ian/OzFlux/Sites/GatumPasture/Da... |
import mysql.connector
import uuid
import sys
from PIL import Image
import base64
import io
import PIL.Image
from mysql.connector.errors import custom_error_exception
from datetime import datetime
cnx = mysql.connector.connect(user="ugqiri0xcve8arnj", password="W05Xj0GMrQfciurwXyku", host="b1d548joznqwkwny7elp-mysql.s... |
from django.db import models
import reversion
@reversion.register()
class TestModel(models.Model):
name = models.CharField(max_length=10)
|
# Copyright 2016 OpenStack Foundation
# 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 requ... |
from django import forms
from .models import Player
from django.core.exceptions import ValidationError
import re
class PlayerForm(forms.ModelForm):
class Meta:
model = Player
fields = ['name','count_correct_answers', 'money_won']
widgets = {
'name': forms.TextInput(attrs={'class... |
from spack import *
class Form(AutotoolsPackage):
homepage = "http://www.example.com"
url = "https://gosam.hepforge.org/gosam-installer/form-4.1.033e.tar.gz"
version('4.1.033e', sha256='b182e10f9969238daea453c14ada9989a4818d23aad8855a8eb5968a231f545c')
def configure_args(self):
args = ... |
from flask import Flask, jsonify
from numeros import numero
app = Flask(__name__)
@app.route('/<string:entrada>', methods=['GET'])
def response(entrada):
resultado = numero(entrada)
return jsonify(resultado=resultado)
if __name__ == '__main__':
app.run(port=5050, debug=True)
|
'''
Created on 24 de abr de 2018
@author: maikon
'''
import sys
import cv2
import numpy as np
from matplotlib import pyplot as plt
# cascade_src = 'resource/cars.xml'
cascade_src = '/home/maikon/git/OpencvPython/resource/haarcascade_russian_plate_number.xml'
car_cascade = cv2.CascadeClassifier(cascade_src)
def procu... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import zipfile
# In[ ]:
def namelist_in_archive (archive):
with zipfile.ZipFile(archive) as archive:
namelist = archive.namelist()
return namelist
|
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import math
import sys
def Round(a):
return int(a+.5)
def init():
glClearColor(1.0,1.0,1.0,0.0)
glColor3f(1.0,0.0,0.0)
glPointSize(3.0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluOrtho2D(0.0,600.0,0.0,600.0)
def setpixel(x,y):
g... |
# -*- coding: utf-8 -*-
#author:Haochun Wang
# import scrapy
from scrapy.spiders import Spider
import re
# from scrapy import *
import re, sys
import requests
import math
# if sys.getdefaultencoding() != 'utf-8':
# reload(sys)
# sys.setdefaultencoding('utf-8')
url = 'http://www.boc.cn/sourcedb/whpj/index.html... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import frappe
from frappe import _
def get_data():
roles = frappe.get_roles(frappe.session.user)
if 'Prospect' not in (roles):
return {
"mycfo": {
"color": "grey",
"icon": "icon-th",
"type": "module",
"label": _("Customer Details")
},
... |
# the following is an attempt to handle the Sage script `RiordanGroup' as a
# python module but it can be the case, since that file isn't a python module really.
import sys
entry_riordan_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(entry_riordan_path)
# the following is only fo... |
#!/usr/bin/env python3
import logging
import json
from twilio.rest import Client
"""
Send text message to a list of numbers
client - twilio client that will send the message
client_number - number to send text from
message - body of the text message
"""
def send_mass_texts(client:Client, client_number:str, message... |
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn import datasets, linear_model, metrics, svm
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score, cross_val_predict
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cross_... |
# -*- coding: utf-8 -*-
import logging
from typing import Any
import aiocache
import aiocache.backends
from .backends import SimpleMaxTTLMemoryCache
from .serializers import CompressionSerializer
from .cache_group import CacheGroup
from ..typedefs import WebApp
logger = logging.getLogger(__name__)
# pylint: disab... |
from __future__ import absolute_import
from data_structures import Candidate, Document, Sentence
from readers import MinimalCoreNLPReader, RawTextReader
from base import LoadFile
from utils import (load_document_frequency_file, compute_document_frequency,
train_supervised_model, load_references,... |
class Area:
@staticmethod
def square(side ):
return (side * side) if side > 0 else 0
@staticmethod
def rectangle(length, breadth):
return length * breadth
@staticmethod
def triangle(breadth, height):
return (breadth * height) / 2
@staticmethod
def circle(radius... |
#!/usr/bin/env python
"""
Helper function used throughout the package.
"""
import typing as tp
|
import pygame
from pygame.locals import *
import random
import time
import sys
import os
#DEBUGGER DEVELOPER TOOL
debug = False
if debug == True:
from threading import *
from debug import *
def passthu():
while True:
debug.update(globals())
time.sleep(0.5)
ptt = Thread(t... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:06:55 2020
@author: 91880
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
cars=pd.read_csv("cars_sampled.csv")
cars.columns
cars.shape
cars.head()
cars.info()
description=cars.describe()
cars.head()
... |
from agent.agent import Agent
from functions import *
import sys
import pandas as pd
# import cudf as pd
import os
#set GPU Device
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
main_df=pd.DataFrame()
empty_list=[]
if len(sys.argv) != 4:
print( "Usage: python train.py [s... |
import cv2 as cv
import numpy as np
import os
def limiarizar(origem, destino):
nome = []
for n in os.listdir(origem):
nome.append(n)
for i in nome:
os.chdir(origem)
img = cv.imread(i)
img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
#Usando o método de Otsu para exec... |
from django.contrib import admin
from .models import Book, Category, BookImage
from django.contrib.gis.admin import OSMGeoAdmin
from django.utils.html import format_html
# Register your models here.
class BookImageInline(admin.StackedInline):
model = BookImage
list_display = ('thumbnail_tag')
readonly_field... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import unittest
import numpy as np
from nufft import nufft1d1freqs, nufft1d1, nufft1d2, nufft1d3
def _get_data():
ms = 90
nj = 128
k1 = np.arange(-0.5 * nj, 0.5 * nj)
j = k1 + 0.5 * nj + 1
x = np.pi * np.cos(-np.pi * j / nj)
... |
#!flask/bin/python
import imp
import os
from migrate.versioning import api
from app import db
from config import DevConfig, ProdConfig
if os.environ.get('MDGIT_ENV') == 'dev':
config = DevConfig
else:
config = ProdConfig
migration = config.SQLALCHEMY_MIGRATE_REPO + '/versions/%03d_migration.py' % (api.db_versi... |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a target and a subsidiary dependent target from a
.gyp file in a subdirectory, without specifying an explicit output b... |
class LinkedList:
def __init__(self):
self.head = None
class LLNode:
def __init__(self, data=None, next=None):
self.data = data
self.next = None
def build_linked_list(idx_max, idx, lst):
lst.head = LLNode(idx)
build_ll_nodes(idx_max, idx + 1, lst.head)
return lst
def bu... |
#!/usr/bin/python
import time
var = 1
while var == 1 : # This constructs an infinite loop
time.sleep(5) # Delay for 5 seconds
|
from sqlalchemy import *
from sqlalchemy import event
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, backref, sessionmaker, scoped_session
from sqlalchemy.ext.associationproxy import association_proxy
import calendar
import numbers
import re
import time
import threading
im... |
# data.py
ofiledir = './data/'
ofilename = 'IF9999.csv'
ofileheader = ['date', 'time', 'open', 'high', 'low', 'close', 'vol', 'position']
start_time_am = ' 10:01:00'
end_time_am = ' 11:20:00'
start_time_pm = ' 13:31:00'
end_time_pm = ' 14:50:00'
xx_range = 30
yy_range = 1
# network.py
logdir = './log/'
savedir = './s... |
import logging
import importlib
import inspect
from .utils import import_class
default_app_config = 'stretch.apps.StretchConfig'
logger = logging.getLogger('stretch')
def is_index(member):
if not inspect.isclass(member):
return False
if not getattr(member, 'IS_INDEX', False):
return False... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
x = np.array([4.6, 0.0, 6.4, 6.5, 4.4, 1.1, 2.8, 5.1, 3.4, 5.8, 5.7, 5.5, 7.9, 3.0, 6.8, 6.2, 4.0, 8.6, 7.5, 1.3, 6.3, 3.1, 6.1, 5.3, 3.9, 5.8, 2.6, 4.8, 2.2, 5.3])
y = np.array([5.5, 1.7, 7.2, 8.3, 5.7, 1.1, 4.1, 6.7, ... |
# -*- coding: cp1252 -*-
from donees import *
from fonctions import *
score=recup_score(nom_fichier_scores)
mot= mot_hoazard(liste_mots)
lettres_recup=[]
essai=0
utilisateur=recup_nom()
if utilisateur not in score.keys() :
score[utilisateur]=0
while essai < nb_coups:
lettres_recup.append(recup_lettre())
... |
from _typeshed import Incomplete
class MinHeap:
class _Item:
key: Incomplete
value: Incomplete
def __init__(self, key, value) -> None: ...
def __init__(self) -> None: ...
def min(self) -> None: ...
def pop(self) -> None: ...
def get(self, key, default: Incomplete | None = N... |
#!/usr/bin/env python
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# 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... |
import json
import string
from time import sleep
import requests
class DomainChecker:
def __init__(self, tld):
self.tld = tld
self.check_url = "https://www.hosting.kr/domains?query={}"
self.headers = {
"content-type": "application/json",
"x-requested-with": "XMLHtt... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import struct
import time
import app_pb2
XY_PKG_MAX_LEN = 2048000;
XY_HEADER_LEN = 17;
PACKAGE_HEADER = ">IIIHHb";
SERVER_HOST = '192.168.206.128';
SERVER_PORT = 10000;
class CClient:
HOST=SERVER_HOST;
PORT=SERVER_PORT;
UserID = 1472978293;
Pas... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 19:59:46 2019
@author: PEKERPCLocal
Description:
Snippets of code for basic exploration of data. Moslty inspired by
couple of blog posts and tutorials.
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
p... |
"""
$ pylint birthday_cake_candles.py
Your code has been rated at 10.00/10 (previous run: 5.00/10, +5.00)
"""
FILE_OPEN = open('DATA.lst', 'r')
MESSAGE = FILE_OPEN.read()
DATA = [MESSAGE]
TYPE_DATA = []
DATA_INT = []
for line in DATA:
# Convierto mi DATA que es un String en un Array de String
TYPE_DATA =... |
t,p=map(int,input().split())
temp=0
temp=t
t=p
p=temp
print(t,p)
|
#!/usr/bin/env python3
from __future__ import print_function
import aerospike
from aerospike import exception as ex
from aerospike_helpers.operations import operations
from aerospike_helpers.operations import map_operations
from aerospike import predicates as p
from aslib.dbg import Dbg
from aslib.asutils import Lck
... |
from django.shortcuts import render,redirect,get_object_or_404
from django.utils import timezone
from django.core.paginator import Paginator
from django.views.generic.edit import FormView
from .models import Notice,Comment
from django.db.models import Q
from django.views.generic.edit import FormView
from .forms impor... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 14:19:28 2019
@author: Ananthan, James
"""
import numpy as np
import pandas as pd
import process as sp
import os
from sklearn.preprocessing import normalize
import math
import sys
def t_n_d(file):
"""
gets title and description from a file
"""
s = fil... |
# Driver Code
my_list = [923,6,234,56,3,0,123,5,7,3]
# length of the list
length = len(my_list)
for i in range(length):
# index of the element we consider to have the least value
min_index = i
# i + 1 beacuse i th index is the one we are comparing
for j in range(i + 1, length):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.