content stringlengths 5 1.05M |
|---|
import sys, os, re, math, optparse
parser = optparse.OptionParser()
parser.add_option("-i","--input", dest = "fn", help = "input file")
parser.add_option("-s","--start", type="int", dest = "start", help = "start collecting")
parser.add_option("-e","--end", type="int", dest = "end", help = "end collecting")
parser.a... |
from pm import db
import time
from pm.const import TASK_STATUS
from sqlalchemy.dialects.mysql import BLOB, INTEGER, VARCHAR, TIMESTAMP
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_name = db.Column(db.String(80), nullable=False, unique=True)
staff_id = db.Colu... |
# Code by Ian McLoughlin
# A program that displays Fibonacci numbers using people's names.
# My surname is Byrne The first letter B is number 66 The last letter e is number 101 Fibonacci number 167 is 35600075545958458963222876581316753used in a string returns an integer representing the Unicode code point of a charact... |
from django.urls import path
from . import views
urlpatterns = [
path('',views.index, name='index'),
path('about-me/',views.about_me, name='about')
]
|
import csv
import datetime
import os
import pathlib
import sys
from PIL import Image
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from preprocess import align
class CameraData(object):
"""Data about cameras:
Args:
storage_path (str or p... |
from pykakasi import kakasi,wakati
text = u"かな漢字交じり文"
kakasi = kakasi()
kakasi.setMode("H","a") # Hiragana to ascii, default: no conversion
kakasi.setMode("K","a") # Katakana to ascii, default: no conversion
kakasi.setMode("J","a") # Japanese to ascii, default: no conversion
kakasi.setMode("r","Hepburn") # default: us... |
from ray import tune
import ray
# from ray.tune.suggest import HyperOptSearch
import os
import numpy as np
# Initialize ray
ray.init(ignore_reinit_error=True, redis_max_memory=20*1000*1000*1000, object_store_memory=1000000000,
num_cpus=4)
## Push this as a class with the package name. Ex - class tune(): pass... |
import re, time
import COCA50_list
# wordlist .py filename (without .py)
mdxTxtFileName = input('Please input mdx .txt filename (without .txt).\n> ')
startTime = time.time()
fo = open('%s.txt' % mdxTxtFileName, encoding='UTF-8')
data = fo.read()
data = '\n' + data
fo.close()
matches = []
for i in COCA... |
from Utils.Utils import similarity
def MMR(lambda_score, q, data, k):
docs_unranked = data
docs_selected = []
best = [0,0]
for i in range (k):
mmr = -100000000
for d in docs_unranked:
sim = 0
for s in docs_selected:
sim_current = similarity(d, ... |
#!/usr/bin/env python3
"""Examples of various ways to draw an rounded_rectangle."""
from SimpleSurface import SimpleSurface
# Create the SimpleSurface object and set the background to yellow
surface = SimpleSurface(600, 800)
surface.set_background()
font = "examples/fonts/arial.ttf"
font_size = 16
# Write a title
ti... |
# -*- coding: utf-8 -*-
"""
@description: 通过关键词(行业名、城市名)搜索职位
@author:XuMing
"""
from __future__ import print_function # 兼容python3的print写法
from __future__ import unicode_literals # 兼容python3的编码处理
import json
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
from urllib import urlencode
from urlparse... |
from __future__ import annotations
from abc import ABC, abstractmethod
import typing
# noinspection PyTypeChecker
class TypeSpecification(ABC):
"""
Base class for typed and untyped specifications.
"""
@abstractmethod
def get_type_names(self) -> list:
pass
@abstractmethod
def get_t... |
from selfiespredict.data.load_data import Data_Cleaner #imports Data_cleaner
import unittest
from rdkit import Chem
import os
from copy import deepcopy
from rdkit import RDLogger
paper_smiles = "CNC(C)CC1=CC=C2C(=C1)OCO2"
paper_smiles_rdkit_canonical = "CNC(C)Cc1ccc2c(c1)OCO2"
paper_smiles_rdkit_canonical_tokenized = ... |
# SPDX-FileCopyrightText: 2021 John Park for Adafruit Industries
# SPDX-License-Identifier: MIT
# RaspberryPi Pico RP2040 Mechanical Keyboard
import time
import board, storage
from digitalio import DigitalInOut, Direction, Pull
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import... |
"""Support for the Hive alarm."""
from datetime import timedelta
from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntity,
AlarmControlPanelEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALA... |
from django.http import HttpResponse
from database.query.permission import permitted_to_manage as database_permitted_to_manage
from database.query.permission import permitted_to_do as database_permitted_to_do
from database.query.permission import forbidden_to_do as database_forbidden_to_do
from database.query.permiss... |
import func
from time import sleep
op=[1,2,3]
blok=0
while True:
func.cab('GERENCIADOR DE SENHAS')
print('\033[1;33m1>\033[m \033[1;34mLOGIN\033[m')
print('\033[1;33m2>\033[m \033[1;34mNOVO CADASTRO\033[m')
print('\033[1;33m3>\033[m \033[1;34mSAIR\033[m')
func.linha()
opi=int(input('\0... |
"""
====================================================
How to use ``sampling_strategy`` in imbalanced-learn
====================================================
This example shows the different usage of the parameter ``sampling_strategy``
for the different family of samplers (i.e. over-sampling, under-sampling. or
c... |
from collections import OrderedDict
#
# define types for synthea schema
#
class ModelSyntheaPandas:
#
# Check the model matches
#
def __init__(self):
self.model_schema = self.syntheaSchema()
#
# define omop schema here
# The DATE fields are read in as string. They can be converted ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 9 00:06:24 2014
@author: kristian
"""
from skumleskogen import *
import time
################## OPTIONS ##################
debug_on = True
write_to_file = True
hukommelse = {}
sti_totalt = ["inn"]
noder_med_lås = set()
forrige_retning = []
file = None
try:
del ... |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
import random
import numpy as np
from deap import base
from deap import creator
from deap import tools
from deap import algorithms
import argparse
import pandas
import os
import numpy as np
import matplotlib.pyplot as plt
import functools
from collections import Counter
import math
import random
def main(args):
... |
"""A library for diffusion maps."""
from .diffusion_maps import diffusion_maps
__all__ = ['diffusion_maps']
|
# -*- coding: utf-8 -*-
"""
Yeast Pitch Calculator
This replicates other calculators found here:
- http://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/
""" # noqa
import argparse
import sys
import textwrap
from brew.constants import GAL_PER_LITER
from brew.constants import IMPERIAL_UNITS
from ... |
import threading
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from board import Board
class Game:
def __init__(self):
self.driver = webdriver.Chrome()
self.driver.get('https://2048game.com')
time.sleep(0.5)
self.web_page... |
from functools import partial
from unittest.mock import Mock
import pytest
from tartiflette.utils.arguments import (
UNDEFINED_VALUE,
argument_coercer,
coerce_arguments,
)
from tests.functional.utils import AsyncMock
def _create_mock_arg(name, value):
arg_mock = Mock()
arg_mock.name = name
a... |
# zhangshulin
# e-mail: zhangslwork@yeah.net
# 2018-2-23
from facenet.src.align import detect_face
import tensorflow as tf
import numpy as np
from scipy import misc
from skimage import transform
class Face_detector:
def __init__(self, face_size):
self._FACE_SIZE = face_size
self._graph = tf.Gra... |
from keras.callbacks import ModelCheckpoint, TensorBoard, Callback
from sklearn.metrics import mean_squared_error
import numpy as np
import math
from tqdm import tqdm
import matplotlib.pyplot as plt
from keras.models import save_model
class predictSeqCallback(Callback):
def on_train_begin(self, logs={}):
s... |
"""
https://leetcode.com/problems/add-to-array-form-of-integer/
For a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [1,2,3,1].
Given the array-form A of a non-negative integer X, return the array-form of the integer X+K.
... |
"""
Support for local control of entities by emulating the Phillips Hue bridge.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/emulated_hue/
"""
import asyncio
import threading
import socket
import logging
import os
import select
from aiohttp import we... |
from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
from .forms import Postform, Editform
from .models import Post
class HomeView(ListView):
model = Post
template_name = "home.html"
ordering = ['-post_date']
class ArticleDetailV... |
class Field(object):
pass
class TextField(Field):
pass
class IntField(Field):
pass
class FloatField(Field):
pass
class DatetimeField(Field):
pass
class Item(object):
pass
class Post(Item):
# title = TextField(selector=Css('#span-68-674'), max_length=127, validator=)
pass
|
"""
desispec.io.fibermap
====================
IO routines for fibermap.
"""
import os
import warnings
import numpy as np
from astropy.table import Table, Column
from desiutil.depend import add_dependencies
from desispec.io.util import fitsheader, write_bintable, makepath
#- Subset of columns that come from original ... |
#!/usr/bin/python
import tf
import rospy
from geometry_msgs.msg import *
class LidarInitPublisher:
def __init__(self):
self.broadcaster = tf.TransformBroadcaster()
def spin(self):
self.broadcaster.sendTransform((0, 0, 0), (-0.5, -0.5, -0.5, 0.5), rospy.Time.now(), 'velodyne', 'lidar')
self.broadcaster.send... |
# This file is part of VoltDB.
# Copyright (C) 2008-2020 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, c... |
from abc import ABCMeta
from abc import abstractmethod
import logging
class Webhook(object):
__metaclass__ = ABCMeta
def __init__(self, event, context):
self.log = logging.getLogger("irchooky")
self.event = event
self.context = context
self.irc_message = ""
@abstractmetho... |
from django.templatetags.static import static
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from hexa.plugins.connector_dhis2.models import Instance
from hexa.ui.datacard import (
Datacard,
Section,
TextProperty,
URLProperty,
LocaleProperty,
DatePropert... |
# Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved.
import nuke
# List of libraries which may be in the plugins directory that are dependencies,
# not plugins themselves
PLUGINS_FILTER = [
"Alembic_In",
"DNxHR",
"FnNukeCodecs"
]
def _filterPlugin(plugin):
for filter in PLUGINS_FILTER:
... |
#!/usr/bin/env python
# stdlib imports
import os
import tempfile
from datetime import datetime, timedelta
import shutil
import pytest
# third party imports
import numpy as np
from obspy.core.utcdatetime import UTCDateTime
# local imports
from gmprocess.utils.constants import UNIT_CONVERSIONS
from gmprocess.io.dmg.co... |
import numpy
clock_speed = 16000000
prescaler = 256 # Can be [1,8,64,256,1024]
desired_interrrupt_freq = 100 #[Hz]
compare_match_reg = clock_speed/(prescaler*desired_interrrupt_freq)-1
print(compare_match_reg) |
from app.resources.resources import RESOURCES
from app.engine import bmpfont, image_mods
class FontType():
def __init__(self, name, default):
self.name = name
self.colors = {}
self.default = default
NORMAL_FONT_COLORS = ['white', 'blue', 'green', 'red', 'grey', 'yellow', 'brown']
... |
import caffe
import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
import config
import ordinal_func as ofunc
import DLDL_func as dfunc
prototxt = '/home/tianchu.guo/caffe/y_caffe_master_20160223_aug/data/android_gaze_tcguo/ordinal_DLDL_CASIA_v1/deploy.prototxt'
caffemodel = '/home/tianchu.guo/caffe/... |
from __future__ import unicode_literals
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.http import is_safe_url
from django.utils.translation import ugettext... |
# Generated by Django 2.2.4 on 2019-08-24 18:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pager', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='channel',
name='pagers',
),
... |
class Solution:
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
m, n = len(matrix), len(matrix[0])
for i in range(n - 1):
for j in range(n - 1 - i):
matrix... |
# -*- coding: utf-8 -*-
import os
import json
from pathlib import Path
import pytest
import click
from click.testing import CliRunner
from sveetoy_cli.cli.console_script import cli_frontend
def test_empty(caplog, settings):
"""Invoked without required arguments"""
runner = CliRunner()
with runner.iso... |
import paraview
class ProgressObject():
'''Progress reporter. Creates a dummy vtkCinemaExporter proxy to use it
as the emitter of progress events.'''
def __init__(self):
self.proxy = paraview.simple.servermanager.CreateProxy(
"exporters", "CinemaExporter")
self.obj = self.p... |
#!python3
#-*- coding: utf-8 -*-
from state import State
from transition import Transition
class ReplayMemory(object):
def __init__(self, CAPACITY):
self.capacity = CAPACITY # メモリの最大長さ
self.memory = [] # 経験を保存する変数
self.index = 0 # 保存するindexを示す変数
def push(self, state, action, state... |
import datetime
import re
from urllib.error import HTTPError
from urllib.error import URLError
from urllib.request import urlopen
import requests
from bs4 import BeautifulSoup
def get_date_today():
now = datetime.datetime.now()
return str(now.strftime("%Y-%m-%d"))
def get_links_csv(url):
"""
Functi... |
"""novos intens corrigidos e alterados
Revision ID: 45003b5d3a09
Revises: 3b7ad60f6fb5
Create Date: 2021-06-01 21:05:33.045365
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '45003b5d3a09'
down_revision = '3b7ad60f6fb5'
branch_labels = None
depends_on = None
... |
#!/usr/bin/env python3
"""
i3blocks script for Spotify. Displays a colourful title and artist.
Left click to pause-play.
Middle click for previous song, right click for next song.
Scroll to change volume.
"""
from i3blocks_helper import colour, check_clicks, run, pango
from subprocess import CalledProcessError
comma... |
# Copyright (C) 2016 Deloitte Argentina.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
from PlugIns.PlugIn import PlugIn
class CheckPackerPlug(PlugIn):
def __init__(self, sample=None):
PlugIn.__init__(self, sample)
def getPath(... |
from datetime import datetime
from tiktok_marketing.module import Module
class Pages(Module):
def get_pages(self, advertiser_id: int = None, library_id: int = None, **kwargs):
"""
This method returns page ids that can be used in lead ads or collection ads.
## Parameters
- `adverti... |
#!/usr/bin/env python -O
# -*- coding: utf-8 -*-
#
# tests.unit._dao.TestRTKType.py is part of The RTK Project
#
# All rights reserved.
"""
This is the test class for testing the RTKType module algorithms and
models.
"""
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(dirname(dirname... |
from django.urls import path
from .apps import DjangoUserInteractionLogConfig
from .views import (LogRecordsListView, LogRecordsDetailView)
from .examples import (ExampleViewWithMixin, example_function_based_view)
urlpatterns = [
path('', LogRecordsListView.as_view(), name=str(DjangoUserInteractionLogConfig.name) ... |
from app import app
@app.task
def add(x, y):
return x + y
@app.task
def subtract(x, y):
return x - y
@app.task
def multiply(x, y):
return x * y
@app.task
def divide(x, y):
return x / y
@app.task
def modulo(x, y):
return x % y
|
import re
import util
def part1(lines):
memory = {}
mask0, mask1 = 0, 0
for line in lines:
if match := re.match(r"^mask = ([X01]+)$", line):
mask, = match.groups()
mask0 = int(mask.replace("X", "1"), 2)
mask1 = int(mask.replace("X", "0"), 2)
elif match ... |
__all__ = ["constants", "controller", "error", "helper", "model", "timer"]
from .version import __version__
from .timer import Timer
|
from collections import defaultdict
import logging
import os
import re
from subprocess import Popen, PIPE, STDOUT
from tempfile import TemporaryDirectory
import pystac
import rasterio as rio
from shapely.geometry import shape
from stactools.aster.constants import (HDF_ASSET_KEY, ASTER_BANDS)
from stactools.core.proje... |
from datetime import datetime
import psycopg2
from elastic.elasticsearch import Elastic
class BusScrapyPipeline(object):
@staticmethod
def convert_data_time(value):
"""
prepared date value for saving
:param value:
:return:
"""
return str(datetime.strptime(value... |
def pascal_triangle(n):
trow = [1]
y = [0]
for x in range(max(n,0)):
print(trow)
trow = [l+r for l,r in zip(trow+y, y+trow)]
return n >= 1
pascal_triangle(int(input())) |
import numpy as np
class KNNClassifier:
def __init__(self, k=3):
self.k = k
self.x_train = None
self.y_train = None
def fit(self, x_train, y_train):
self.x_train = x_train
self.y_train = y_train
return self
def predict(self, x_predict):
y_predict =... |
#!/usr/bin/env python3
from pwn import *
# Open up the process
p = process("./asst3", stdin=PTY)
# Ignore the first nine lines
for x in range(0, 9):
p.recvline()
# Leak an address from memory
p.sendline("%4$p")
addr = p64(int(p.recvline().strip(), 16) + 4)
# Generate the payload
quit = b"quit"
shellcode = b"\x4... |
#!/usr/bin/env python
#
# Copyright (c) 2016 In-Q-Tel, 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
#... |
import subprocess
import releasely.git
def get_branch():
return releasely.git.rev_parse("HEAD")
def get_last_commit():
return releasely.git.log(n=1, oneline=True)
def get_current_version():
output = (
subprocess.check_output(["bumpversion", "--dry-run", "--list", "patch"])
.decode("ut... |
from casperlabs_local_net.client_parser import parse_show_blocks
from casperlabs_local_net.docker_node import DockerNode
from casperlabs_local_net.casperlabs_accounts import GENESIS_ACCOUNT
from casperlabs_local_net.casperlabs_accounts import Account
from casperlabs_local_net.common import (
Contract,
CONV_RATE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
version = "0.1.3"
import os
import fileinput
import getopt
import sys
import re
# ===============================================================================
class Dialect:
shortcuts = {}
synonyms = {}
required = {}
short_tags = ()
class HtmlDialect... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import... |
import kfp
from kfp import components
from kfp import dsl
sagemaker_process_op = components.load_component_from_file(
"../../process/component.yaml"
)
@dsl.pipeline(name="SageMaker Processing", description="SageMaker processing job test")
def processing_pipeline(
region="",
job_name="",
image="",
... |
print('=ˆ= ' * 11)
print(' CÁLCUL DE DESCOMPTES')
print('=ˆ= ' * 11)
valor = float(input('Introduïu l\'import del producte: '))
print('-.- ' * 11)
descompte = float(input('Introduïu l\'import del descompte: '))
print('!<>!' * 11)
print('el valor del vostre producte rebaixat és € {:.2f}'.format(valor - (valor ... |
#!/usr/bin/python3
# RSA Cipher
# http://inventwithpython.com/hacking (BSD Licensed)
import sys
from datetime import datetime
# IMPORTANT: The block size MUST be less than or equal to the key size!
# (Note: The block size is in bytes, the key size is in bits. There
# are 8 bits in 1 byte.)
DEFAULT_BLOCK_S... |
import fractions
a, b, k = map(int, input().split())
gcd = fractions.gcd(a, b)
divisor_list = []
if gcd == 1:
divisor_list = [1]
else:
divisor_list.append(1)
for i in range(2, gcd // 2 + 1):
if gcd % i == 0:
divisor_list.append(i)
divisor_list.append(gcd)
print(divisor_list[len(di... |
"""Unit tests for reviewboard.reviews.ui.base.FileAttachmentReviewUI."""
from djblets.testing.decorators import add_fixtures
from kgb import SpyAgency
from reviewboard.reviews.ui.base import (FileAttachmentReviewUI,
register_ui,
unregis... |
#encoding:utf-8
subreddit = 'Gunners'
t_channel = '@r_gunners'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
# Generated by Django 3.1.3 on 2020-11-13 13:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('equipments', '0004_auto_20201113_1334'),
]
operations = [
migrations.AlterField(
model_name='equipment',
name='statu... |
import os
import click
import h5py
import numpy as np
@click.group()
@click.argument('in_path', type=click.Path(exists=True, resolve_path=True))
@click.argument('out_dir', type=click.Path(exists=False, dir_okay=True,
resolve_path=True, writable=True,
... |
ad, am, ay = map(int, input().split())
ed, em, ey = map(int, input().split())
if (ay, am, ad) <= (ey, em, ed):
print(0)
elif (ay, am) == (ey, em):
print(15 * (ad - ed))
elif ay == ey:
print(500 * (am - em))
else:
print(10000)
|
__version__ = '1.2.9'
__VERSION__ = __version__
from .workbook import Workbook
|
class TrackdiskDevice(object):
#1760x 512 byte blocks
#11x blocks per sector
#0-10 s0, 11-22 s1, etc.
#ioreq: 0x20
#iostdreq: +0x10 = 0x30
io_Message = 0x0
io_Command = 0x1c
io_Flags = 0x1e
io_Error = 0x1f
io_Actual = 0x20
io_Length = 0x24
io_Data = 0x28
io_Offset = 0... |
import numpy as np
from .intersection import bbox_compute_intersection_numpy_vectorized
from .area import bbox_compute_area_numpy_vectorized
def bbox_compute_iou_numpy_vectorized(bbox_a: np.ndarray, bbox_b: np.ndarray):
intersection = bbox_compute_intersection_numpy_vectorized(bbox_a, bbox_b)
intersection_ar... |
import argparse
import os
import re
import sys
import json
import codecs
import pkg_resources
import socket
import queue
import logging
import logging.config
import ctypes
import datetime
import fcntl
import signal
import ntpath
from catstrace.json_transformer import to_json
from catstrace.events.base_event import Even... |
import uuid
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.tests.custom_user import RemoveGroupsAndPermissions
from django.db import models
with RemoveGroupsAndPermissions():
class UUIDUser(AbstractUser):
"""A user with a UUID as primary key"""
id = models.UUIDField(d... |
# Program: addgallery.py
#
# Purpose: This script adds a new page to the VisIt gallery.
#
# Programmer: Brad Whitlock
# Date: Thu Apr 5 09:19:51 PDT 2007
#
# Modifications:
# Brad Whitlock, Fri Jul 31 10:56:00 PDT 2009
# I updated it to use a newer page style and I made it use SVN.
#
###############################... |
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import random
from sopel import module
# Works for generic "hi, guys", but maybe not "you (specific group of) guys"
greet = ['team', 'all', 'pals', 'gang', 'crew', 'people', 'everyone', 'friends',
"y'all"]
# ... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django import forms
# Create your models here.
class Database(models.Model):
criminal_name = model... |
from iptoasn import IPtoASN
server = IPtoASN(host='', port=8080) # Listen on *:8080
print("ASN-Database loaded. Starting API..", flush=True)
server.serve_forever()
|
# Copyright 2018 Lawrence Livermore National Security, LLC and other
# sonar-driver Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from pyspark.sql.functions import udf, col, explode, lit, split
from pyspark.sql.types import ArrayType, Bool... |
import logging
from ...errors import SimValueError, SimSolverModeError
from ...state_plugins.callstack import CallStack
l = logging.getLogger(name=__name__)
# TODO: Make callsite an object and use it in BlockID and FunctionKey
class BlockID(object):
"""
A context-sensitive key for a SimRun object.
""... |
from django.db import models
class Produto(models.Model):
nome = models.CharField(("Nome"), max_length=50)
preco = models.DecimalField(("Preço"), max_digits=12, decimal_places=2)
estoque = models.IntegerField(("Quantidade em estoque"))
def __str__(self):
return self.nome
class Cliente(mo... |
from django import forms
from django.forms import ModelForm
from .models import Post
from django.core.exceptions import ValidationError
# creating a form for custom validation
class CreateViewForm(forms.ModelForm):
title = forms.CharField(required=False) # defining the field as not required
image = forms.Ima... |
#!/usr/bin/env python3
"""Run precommit checks on the repository."""
import argparse
import os
import pathlib
import re
import subprocess
import sys
def main() -> int:
"""Execute the main routine."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--overwrite",
help="Overwrites th... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from wcics import app, db
from wcics.database.models import Organizations, OrganizationUsers
from wcics.server.consts import ORGANIZATIONS_PER_PAGE
from wcics.server.routes.utils import paged_data
from flask import render_template
from sqlalchemy import func
@app.ro... |
"""
Settings for external services to query for autocomplete
when assigning skos Matches
"""
search_types = (
('KeywordSearch?', 'Keyword Search'),
('PrefixSearch?', 'Prefix Search')
)
class DbpediaAC(object):
"""
Dbpedia
"""
endpoint = 'http://lookup.dbpedia.org/api/search/'
search_type ... |
from itertools import cycle
from typing import List, Optional
from more_itertools import powerset
from pyrsistent import pset, s
from pyrsistent.typing import PSet
from toolz.curried import concat, filter, first, map, pipe, sliding_window, take
from my_types import Complex, Cycle
from simplicialHomology import simpli... |
from Jumpscale import j
from .GraphiteClient import GraphiteClient
JSConfigs = j.baseclasses.object_config_collection
class GraphiteFactory(JSConfigs):
__jslocation__ = "j.clients.graphite"
_CHILDCLASS = GraphiteClient
|
# -*- coding: utf-8 -*-
###
# © 2018 The Board of Trustees of the Leland Stanford Junior University
# Nathaniel Watson
# nathankw@stanford.edu
# 2018-07-20
###
"""
Contains a Transfer class that encapsulates working with the Google Storage Transfer Service to
transfer files from AWS S3 to GCP buckets. If you want to ... |
import sys
sys.path.insert(0, "./")
sys.path.insert(0, "../")
import os
import subprocess
from pathlib import Path
from netCDF4 import Dataset
import pytest
import main as scampy
import common as cmn
import plot_scripts as pls
@pytest.fixture(scope="module")
def sim_data(request):
# remove netcdf file from pr... |
"""
app.routes.redirect
===================
"""
from datetime import datetime
from flask import Blueprint, flash, render_template, url_for
# noinspection PyProtectedMember
from flask_babel import _
from flask_login import current_user, login_required
from itsdangerous import BadSignature
from werkzeug import Response... |
from django.test import RequestFactory
from django.test import TestCase
from django.utils.safestring import SafeText
from django.views.generic import ListView
from smart_lists.exceptions import SmartListException
from smart_lists.filters import SmartListFilter
from smart_lists.helpers import SmartList, SmartOrder
from... |
from PyQt5.QtWidgets import QApplication, QWidget, QCalendarWidget, QVBoxLayout
import sys
from PyQt5.QtGui import QIcon
class Window(QWidget):
def __init__(self):
super().__init__()
self.create_ui()
def create_ui(self):
self.setWindowTitle("PyQt5 Calendar")
self.setGeometry(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.