content stringlengths 5 1.05M |
|---|
import pdb
import json
import copy
import inspect
import pandas as pd
import numpy as np
import uuid
from sqlalchemy import create_engine
from sqlalchemy import select, and_
from sqlalchemy import create_engine, select, and_, or_
from sqlalchemy.pool import NullPool
import sqlalchemy as sa
from sqlalchemy.orm import se... |
import tkinter as tk
from tkinter import ttk
from collections import deque
class Timer(ttk.Frame):
"""parent is the frame which contains the timer frame self is the object whose properties are being created
and controller is the class whose properties are inherited....tk.Frame properties are also inher... |
#The World's Most Annoying E-Book
#Concepts Used:
#print()
#input()
#newline
#tab
#comments
print("\n\t\tThe World's Most Annoying E-Book")
print("\n\n\nBy Rich Williams")
input("\nPress Enter to Begin")
#Title
print("\n\nA Tale of Two Cities")
print("By Charles Dickens")
input("\n\nPress Enter ... |
################################################################################
##
## 新浪微博热点事件发现与脉络生成系统
##
## @Filename ./HotspotsAnalysis/CorrelationAnalysis.py
## @Author 李林峰, 刘臻, 徐润邦, 马伯乐, 朱杰, 瞿凤业
## @Version 3.1
## @Date 2019/09/06
## @Copyright Copyrig... |
from tensorflow.python.keras.applications.inception_v3 import InceptionV3
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers import Dense, GlobalAveragePooling2D, Dropout
from tensorflow.python.keras.layers import Input
from shared.utils import setup_trainable_layers
def InceptionV3... |
import matplotlib.pyplot as plt
def plot_training_history(history, show=True):
plt.plot(history.history['accuracy'], label='accuracy')
plt.plot(history.history['val_accuracy'], label='val_accuracy')
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.ylim([0.5, 1])
plt.legend(loc='lower right')
... |
import funcs as func
from flask import Flask
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
import docker
try:
client = docker.from_env()
except:
exit()
def create():
output = client.containers.run("quay.io/infoupgraders/images:final", detach=True, stdin_open=True)
retur... |
import math
from future.utils import with_metaclass
class EventRegistry(object):
Events = {}
MetaEvents = {}
def register_event(cls, event, bases):
if (Event in bases) or (NoteEvent in bases):
assert event.statusmsg not in cls.Events, \
"Event %s already reg... |
import argparse
import io
import logging
import os
import tokenize
import ctypeslib.codegen.codegenerator
import ctypeslib.codegen.typedesc
def rewrite_ctypes_little_endian(readline):
prev_tokens = [None, None]
def rewrite_token(token):
if prev_tokens[0] is None or prev_tokens[1] is None:
... |
import argparse
from gitlab_api_client import GitlabApi
from user_config import get_gitlab_api_client
from subprocess import check_call
def create_project_action(main_args, progname: str):
gitlab_instance = main_args.gitlab_instance
create_project_parser = argparse.ArgumentParser(description='Create new pro... |
from django.shortcuts import render
from .models import Story
from . models import Product
from django.views import generic
from django.views.generic import TemplateView
from django.contrib.auth.models import User
class storyListView(generic.ListView):
model = Story
class storyDetailView(generic.DetailView):
... |
import pytest
from torch.optim import SGD as _SGD
from neuralpy.optimizer import SGD
# Possible values that are invalid
learning_rates = [-6, False, ""]
momentums = [-6, False, ""]
dampenings = ["asd", False, 3]
weight_decays = [-0.36, "asd", "", False]
nesteroves = [122, ""]
@pytest.mark.parametrize(
"learning_... |
'''
Load full XML text (FDSys sourced) data files on disk into PostgreSQL table.
For XML files. TXT files is a separate script.
Full text files should be downloaded like:
./run fdsys --collections=BILLS --congress=113 --store=xml,text --bulkdata=False
./run fdsys --collections=BILLS --congress=114 --store=xml,text --... |
# Copyright 2018 Saphetor S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 17 16:10:58 2019
@author: pitonhik
"""
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 27 15:45:06 2019
@author: pitonhik
"""
import cv2
import numpy as np
import tensorflow as tf
import sys
sys.path.append("..")
from utils import label_map_util
from utils import visual... |
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
import gettext
PluginLanguageDomain = "NetworkBrowser"
PluginLanguagePath = "SystemPlugins/NetworkBrowser/locale"
def localeInit():
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, Plugin... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import common
import numpy as np
import unittest
from trajectory import Trajectory
from constraints import *
from measurements import get_measurements, create_anchors
class TestGeometry(unittest.TestCase):
def setUp(self):
self.traj = Trajectory(n_complex... |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, copy, modify, merge, publ... |
from __future__ import print_function, division
from torch.nn.modules.loss import _assert_no_grad, _Loss
import torch.nn.functional as F
import torch
# define a customized loss function for future development
class WeightedBCELoss(_Loss):
def __init__(self, size_average=True, reduce=True):
super(WeightedB... |
#!/usr/bin/python3
"""The module is to create ziti identity and eroll it for the loacal endpoint."""
from os.path import expanduser
from json import loads
import traceback
import argparse
import logging
from subprocess import Popen, PIPE
from requests import post, get
from sys import exit
def restful(url, rest_method... |
from itertools import *
r1 = range(3)
r2 = range(2)
print('zip stops early:')
print(list(zip(r1,r2)))
r1 = range(3)
r2 = range(2)
print('\nzip_longest processes all of the values')
print(list(zip_longest(r1,r2))) |
"""
======================================
Probabilistic Classifier Chain Example
======================================
An example of :class:`skml.problem_transformation.ProbabilisticClassifierChain`
"""
from sklearn.metrics import hamming_loss
from sklearn.metrics import accuracy_score
from sklearn.metrics import f... |
import enum
import discord
class MessageType(enum.Enum):
Plain = enum.auto()
Embed = enum.auto()
Error = enum.auto()
Confirmation = enum.auto()
Success = enum.auto()
class Reply:
def __init__(self, message: str, type: MessageType = MessageType.Plain):
self.message = message
self.type = type
s... |
from runner.run_description import RunDescription, Experiment, ParamGrid
_params = ParamGrid([
])
_experiments = [
Experiment(
'battle2_fs4',
'python -m algorithms.appo.train_appo --env=doom_battle2 --train_for_env_steps=3000000000 --algo=APPO --env_frameskip=4 --use_rnn=True --ppo_epochs=1 --roll... |
# coding: utf-8
import re
import wcwidth
import numpy as np
from ._colorings import _toCOLOR_create
from .generic_utils import handleKeyError, handleTypeError
f_aligns = ["<", ">", "=", "^", "left", "right", "center"]
f_signs = ["+", "-", " ", ""]
f_grouping_options = ["_", ",", ""]
f_types ... |
"""
This module lets you practice the WAIT-FOR-EVENT pattern, using:
while True:
...
if <event has occurred>:
break
...
If you wish to use the while <condition>: form, that is OK too,
but we reserve the right to offer help only if you use the while True: form,
since many p... |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import random
class CoinTossBoxLayout(BoxLayout):
def choice(self, guess):
output = guess
if self.ids.result.text == "": # if the result box is empty, then print the result. If there is already a result, do nothing.
sel... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""New daily plot generation - using GGD data.
Created on Tue Nov 16 22:02:09 2021
@hk_nien
"""
import matplotlib.pyplot as plt
import tools
import nlcovidstats as nlcs
import nlcovidstats_data as ncd
import pandas as pd
import plot_aantal_tests_updates as ggd_tests
im... |
"""
Handled exceptions raised by REST framework.
In addition Django's built in 403 and 404 exceptions are handled.
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
"""
from __future__ import unicode_literals
from rest_framework import status
import math
class APIException(Exception):
"""
... |
from cs50 import get_int
# Recieve the pyramid's height, while the input is on the defined range
h = 0 #initialing the Height
while (h > 8 or h < 1):
h = get_int("Height: ")
#print the hashes
for i in range(1, h + 1):
print( " " * (h-i) + "#"*(i) ) |
#!/usr/bin/env python
# /* ----------------------------------------------------------------------------
# * Copyright 2021, Jesus Tordesillas Torres, Aerospace Controls Laboratory
# * Massachusetts Institute of Technology
# * All Rights Reserved
# * Authors: Jesus Tordesillas, et al.
# * See LICENSE file for the ... |
'''
Errors in Dagster:
All errors thrown by the Dagster framework inherit from DagsterError. Users should not inherit their
own exceptions from DagsterError. This how dagster communicates errors like definition errors and
invariant violations.
There is another exception base class, DagsterUserCodeExecutionError, whic... |
#!/usr/bin/env python
import getopt
from sys import argv
from os import system, path
import os
from repo_handler import create_repo_handler
build_log = "__build.log";
para = 0;
def generate_arg_file(src_dir, src_file, arg_file, deps_dir, force_rebuilt):
if not force_rebuilt:
print "Normal Compiling....";
... |
# -*- coding: utf-8 -*-
import glfw
import imgui
import OpenGL.GL as gl
from imgui.integrations.glfw import GlfwRenderer
import flags
from project import show_labelFM_info
from project import show_labelFM_state
from project import show_labelFM_window
from project import show_labelFM_setting_APP
def impl_glfw_init():... |
"""Generated wrapper for BSend Solidity contract."""
# pylint: disable=too-many-arguments
import json
import time
from typing import ( # pylint: disable=unused-import
List,
Optional,
Tuple,
Union,
)
from eth_utils import to_checksum_address
from hexbytes import HexBytes
from web3.contract import Con... |
"""Copyright (c) 2014, Dilithium Power Systems LLC All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions an... |
#!/usr/bin/env python
from ciscoconfparse import CiscoConfParse
from pprint import pprint as pp
ciscocfg = CiscoConfParse("cisco_ipsec.txt")
transform_sets = ciscocfg.find_objects_w_child(parentspec=r'crypto map CRYPTO', childspec='3DES')
print("The following crypto maps are not using AES:\n")
for line in transfo... |
from __future__ import division, print_function, absolute_import
from . import util
import numpy as np
class PatternFilterer(object):
#The idea is that 'patterns' gets divided into the patterns that pass and
# the patterns that get filtered
def __call__(self, patterns):
raise NotImplementedError(... |
#!/usr/bin/env python
from wordcount import load_word_counts
import sys
def top_two_word(counts):
"""
Given a list of (word, count, percentage) tuples,
return the top two word counts.
"""
limited_counts = counts[0:2]
count_data = [count for (_, count, _) in limited_counts]
return count_dat... |
###############################################################################
# Copyright 2014 The University of Texas at Austin #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #... |
import time
import json
import web3
import test_utilities
from integration_test_context import main, common, eth
from common import *
from eth import ETH
cmd = main.Integrator()
def web3_connect_ws(host, port):
return web3.Web3(web3.Web3.WebsocketProvider("ws://{}:{}".format(host, port)))
def get_web3_connecti... |
import onmt
import onmt.modules
import torch.nn as nn
import torch, math
from torch.nn.modules.loss import _Loss
#~ class LabelSmoothedCrossEntropyCriterion(_Loss):
#~
#~ def __init__(self, n_targets, eps):
#~ super().__init__()
#~ self.eps = eps
#~ self.n_targets = n_targets
#~
#~ @... |
# Test of Wall constructor
# Copyright (C) 2019 Robin, Scheibler, Cyril Cadoux
#
# 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
... |
import pygame
class Resource:
def __init__(self):
self.images = {}
self.sounds = {}
self.music = {}
def load(self):
print("Loading resources...")
self.images["blood"] = pygame.image.load("snake/images/blood.png").convert_alpha()
self.images["dirt"] = pygame.ima... |
numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
letters = ('a', 'b', 'c', 'd')
# slicing of tuples
print(numbers[2:5])
even_nums = numbers[1::2]
odd_nums = numbers[0::2]
print('even numbers', even_nums)
print('odd numbers', odd_nums)
# iteration with tuples
for n in numbers:
print(n ** 2)
# functions with tuples
def ... |
# Bep Marketplace ELE
# Copyright (c) 2016-2021 Kolibri Solutions
# License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE
#
from django.contrib import admin
from .models import CategoryResult, GradeCategory, GradeCategoryAspect, CategoryAspectResult, ResultOptions
cla... |
'''OpenGL extension INTEL.parallel_arrays
This module customises the behaviour of the
OpenGL.raw.GL.INTEL.parallel_arrays to provide a more
Python-friendly API
Overview (from the spec)
This extension adds the ability to format vertex arrays in a way that's
The official definition of this extension is available... |
import os
import sys
import openpyxl
import argparse
import re
from common import *
__version__ = '0.0.1'
# cli parser definition
parser = argparse.ArgumentParser('tag_title_row')
parser.add_argument('--version', action='version', version=__version__)
parser.add_argument('file', type=str, help='file name to be read ... |
from compas_fab.backends.ros.messages import Header
from compas_fab.backends.ros.messages import ROSmsg
from compas_fab.backends.ros.messages import String
from compas_fab.backends.ros.messages import Time
from compas_fab.backends.ros.messages import Float32MultiArray
from compas_fab.backends.ros.messages import Int8Mu... |
"""Add index to url
Revision ID: 2f15229eefbd
Revises: 4167d142d57b
Create Date: 2017-10-14 20:16:16.172385
"""
# revision identifiers, used by Alembic.
revision = '2f15229eefbd'
down_revision = '4167d142d57b'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alemb... |
import copy
import numpy as NP
import matplotlib.pyplot as PLT
import matplotlib.colors as PLTC
import matplotlib.ticker as PLTick
import yaml, argparse, warnings
import progressbar as PGB
from prisim import bispectrum_phase as BSP
import ipdb as PDB
PLT.switch_backend("TkAgg")
if __name__ == '__main__':
## ... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import errno
import ... |
import cv2
def rotate_image(mat, angle):
"""
Rotates an image (angle in degrees) and expands image to avoid cropping
"""
height, width = mat.shape[:2] # image shape has 3 dimensions
image_center = (width/2, height/2) # getRotationMatrix2D needs coordinates in reverse order (width, height) compare... |
import unittest
import copy
import tempfile
import pickle
import os
import datetime as dt
from market_calendars.core import (Date,
Period,
Weekdays)
class TestDate(unittest.TestCase):
def test_date_input_with_serial_number(self):
serial_n... |
"This module is used to built simple calculator"
import math
pi =math.pi
def sum(x,y=1):
"This method calculates sum of two numbers"
return x+y
def diff(x,y=1):
return x-y
def mul(x,y):
return x*y
def div(x,y=1):
assert ( y != 0), "Cannot be divided by zero"
return x/y
def area_peri(r=1):
... |
# coding=utf-8
# author=uliontse
# binary search:
def binary_search(arr, target):
# arr.sort()
left, right = 0, len(arr)-1
while left <= right:
mid = (left + right) // 2
if mid < target:
left = mid + 1
elif mid > target:
right = mid - 1
else:
... |
import numpy
from kernel_tuner import tune_kernel, run_kernel
from numba import cuda
import json
import argparse
from numpyencoder import NumpyEncoder
# Setup CLI parser
parser = argparse.ArgumentParser(description="MD tuner")
parser.add_argument("--size", "-s", type=int, default=1, help="problem size to the benchmark... |
#!/usr/bin/env python3
# Copyright 2021 Collabora, Ltd.
#
# 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, copy, modify,... |
# Dependencies: https://pypi.python.org/pypi/bitcoin >= 1.1.27
import binascii
import hashlib
import base64
import bitcoin
def verify(challenge_hidden, challenge_visual, pubkey, signature, version):
if version == 1:
message = binascii.unhexlify(challenge_hidden + binascii.hexlify(challenge_visual))
el... |
import os
from errno import ENOENT, EPERM
from stat import S_IFDIR, S_IFREG
from time import time
import logging
from datetime import datetime
import threading
import functools
import collections
from fuse import FUSE, Operations
from storage import GitStorage
log = logging.getLogger('spaghettifs.filesystem')
log.set... |
import FWCore.ParameterSet.Config as cms
#--- reset HB/HE ZS to 2TS
#--- NB: may need appropriate HcalZSThresholds update
def customise_2TS(process):
process.simHcalDigis.HBregion = (2,5)
process.simHcalDigis.HEregion = (2,5)
process.simHcalDigis.use1ts = False
return(process)
|
def replace_letters(word):
|
from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import Screen
from kivy.uix.stacklayout import StackLayout
from bidding import Bidding, playOrder
from bidding_tree import bids
from constants import clubs, colors, diamonds, hea... |
from .listener import RequestSuccessListener
from .notifier import RequestSuccessNotifier
|
import os
from redis import Redis
from neo4j import GraphDatabase
"""
get_redis connects to a redis database and returns an instance of this
connection.
"""
def get_redis():
# if a custom IP for redis has been specified, use it, else default to localhost
redis_ip = os.environ.get('REDIS_IP')
if (redis_ip ... |
# Generated by Django 2.1.2 on 2018-10-06 21:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cash', '0002_auto_20181006_2046'),
]
operations = [
migrations.AddField(
model_name='week',
name='_carry_over',
... |
from . import decisions
class Territory:
is_complex = False
is_coastal = False
is_inland = False
is_sea = False
def __init__(self, _id, name, neighbour_ids, contested=False):
self.id = _id
self.name = name
self.neighbour_ids = neighbour_ids
self.pieces = set()
... |
import numpy as np
def dist_sphe(x, y, lon, lat):
"""Compute the spherical arc between two points on the unit sphere"""
return np.arccos(np.sin(lat)*np.sin(y)+np.cos(lat)*np.cos(y)*np.cos(lon-x))
def compute_weight(x, y, lon, lat, reso, degrees=False):
"""Compute the weight between points (x, y) and point... |
"""Define Rotest's TestSuite, composed from test suites or test cases."""
# pylint: disable=method-hidden,bad-super-call,too-many-arguments
# pylint: disable=too-many-locals
from __future__ import absolute_import
import unittest
from itertools import count, chain
from future.builtins import next
from rotest.common i... |
lines = []
with open('input-p67.txt') as f:
lines = f.readlines()
i = 0
for n in lines:
lines[i] = n.split(" ")
i = i+1
l_DP = [[int(lines[0][0])]]
i = 0
for n in lines[1:]:
temp_list=[]
for k in range(0,len(n),1):
#print(k)
if k == 0:
temp_list.append(int(n[k])+l_DP[... |
import json
import urllib.request
def get(status="In Service"):
'''
* Load stations of bike sharing.
*
* @param status - A status to filter stations (e.g., "In Service", "Not In Service", None; default: "In Service").
* @return stations - A list with stations and their data.
'''
url = ... |
import sys
sys.path.append("../..")
from MyCrypto.utils.galois_field import GF
from MyCrypto.utils.matrix import Matrix
class GF2_8(GF):
def __init__(self, data, order=8):
super().__init__(data, order)
class AES:
def __init__(self, raw_key):
self._reset_data()
self._reset_key... |
#!/usr/bin/env python
""" Convert a svg file into 2D triangle mesh.
"""
import argparse
import logging
import pymesh
import numpy as np
from numpy.linalg import norm
import os.path
from subprocess import check_call
from time import time
def parse_args():
parser = argparse.ArgumentParser(__doc__);
... |
import tensorflow as tf
from pymystem3 import Mystem
from utils import load_dumped, get_dataframe, clean_text
from tensorflow.python.keras.models import load_model
from tensorflow.python.keras.backend import set_session
from keras.preprocessing.sequence import pad_sequences
from lenta_training import MAX_SEQUENCE_LENGT... |
import subprocess
from pathlib import Path
from natsort import os_sorted
from colorama import Fore, Style, init as init_colorama
# Directory of this file ( /serene/compiler/ )
here = Path(__file__).parent.resolve()
init_colorama()
existing_coverage = False
paths = os_sorted([Path(x) for x in here.glob("./tests/t*.s... |
import pyautogui
import time
import os
def main():
z = '0'
name = "0.png"
path = "./1/"
os.mkdir(path)
for x in range(0,50):
pyautogui.screenshot(path+name)
time.sleep(0.5)
pyautogui.hotkey('pagedown')
def start():
print("5..")
time.sleep(1)
print("4..")
... |
#!/usr/bin/env python2
import xml.etree.cElementTree as ET
import logging
import contextlib
import re
import subprocess
from ssg.constants import OSCAP_RULE
from ssg.constants import PREFIX_TO_NS
from ssg.constants import bash_system as bash_rem_system
from ssg.constants import ansible_system as ansible_rem_system
fr... |
#!/usr/bin/python3
import socket
import time
from picamera2.encoders import H264Encoder
from picamera2.outputs import FileOutput
from picamera2 import Picamera2
picam2 = Picamera2()
video_config = picam2.video_configuration({"size": (1280, 720)})
picam2.configure(video_config)
encoder = H264Encoder(1000000)
with so... |
import unittest
from tests.base import BaseTestCase
class ApiGroupApiTestCase(BaseTestCase):
def test_get_api_group_list(self):
pass
def test_new_api_group(self):
pass
def test_delete_api_group(self):
pass
if __name__ == '__main__':
unittest.main()
|
import logging
import os
import random
from pathlib import Path
from typing import Any, Dict, Tuple
import matplotlib.pyplot as plt
import numpy as np
import yaml
np.set_printoptions(suppress=True)
plt.rcParams["font.size"] = 16
BASE_DIR = Path(__file__).resolve().parents[2] # python_project_template
SRC_DIR = BASE... |
reaction_logger = {
"added": {
"title": "Emoji added:",
"content": "User: {member.mention} (`{member.id}`)\n"
"Channel: {channel.mention} (`{channel.id}`)\n"
"Emoji: {emoji.name}\n",
"footer": {
"text": "Emoji Logger",
"icon": "{g... |
# coding=utf8
import os
from .geo import geo_entity_extractor, geo_gnn_entity_matcher
from .atis import atis_entity_extractor, atis_gnn_entity_matcher
def get_gnn_entity_matcher(task, language):
matcher = None
if task == 'geo':
base_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ADS-B Cursor-on-Target Gateway Function Tests."""
import asyncio
import csv
import io
import urllib
import xml.etree.ElementTree
import pytest
import stratuxcot
import stratuxcot.functions
__author__ = 'Greg Albrecht W2GMD <oss@undef.net>'
__copyright__ = 'Copyrig... |
#!/usr/bin/env python
import requests, socket
username = ""
password = ""
hostname = "" # your domain name hosted in no-ip.com
# Gets the current public IP of the host machine.
myip = requests.get('http://api.ipify.org').text
# Gets the existing dns ip pointing to the hostname.
old_ip = socket.gethostbyname(hostnam... |
import os
from flask import (
Flask, flash, render_template,
redirect, request, session, url_for)
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from werkzeug.security import generate_password_hash, check_password_hash
if os.path.exists("env.py"):
import env
app = Flask(__name__)
ap... |
data = """FBBBFBBLRR
BFFFBBFLRR
BFBFBBFLLR
BBFFFFBLLR
FBBFBBFRLL
BBFFFFBRLL
FBBFBFFLLR
BFFBBBFRRL
FFBFBFFRLR
FBFFFFBLLL
FBFFFFFLRL
FFFBFBBRLR
FFBFFFFLLL
BFBBBFFLLL
FFBBBFBRLR
BFFBFBFLLL
FBFBFFFLLL
BBFFBBBRRL
FBFFBFBLLL
BFFBFBFRRL
FBFBFFFRLR
BFBBBFBRLL
FFBBFBFLRL
FBBFFBFRRR
BFBBBBBLRL
FFBFBFBLRL
FFBFFFFLRL
BFBFBFBRRR
FB... |
import unittest
from stacker.blueprints.testutil import BlueprintTestCase
from stacker.context import Context
from stacker.config import Config
from stacker.variables import Variable
from stacker_blueprints.generic import GenericResourceCreator
class TestGenericResourceCreator(BlueprintTestCase):
def setUp(self... |
from player import Player
tim = Player('Tim')
# print(tim.name)
# print(tim.lives)
# tim.lives -= 1
# print(tim)
tim.lives = -1
# for i in range(3):
# print('-'*20)
# tim.lives -= 1
# print(tim)
|
"""
create and annotate references to strings in 64-bit Windows Go executables.
expect to see the assembly pattern:
lea reg, $string
mov [stack], reg
mov [stack], $size
"""
import idc
import ida_ua
import ida_name
import ida_bytes
import idautils
def enum_segments():
for segstart in idautils.Segments():
... |
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
# ---------------------------------------------------------
# QGIS Catalog Service client.
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
# Alexander Bruy (alexander.bruy@gmail... |
class WalletExists(Exception):
""" A wallet has already been created and requires a password to be
unlocked by means of :func:`transnet.wallet.unlock`.
"""
pass
class WalletLocked(Exception):
""" Wallet is locked
"""
pass
class RPCConnectionRequired(Exception):
""" An RPC connect... |
'''
Code to read SEVIRI data in HRIT format.
'''
import satpy # Requires virtual environmen for reading native (.nat) and hrit files.
import numpy as np
import datetime
import glob
from pyresample import geometry, bilinear
import os
import h5py
import sys
from tempfile import gettempdir
# The following are necessary... |
print('''
Exercício 57 da aula 14 de Python
Curso do Guanabara
Day 23 Code Python - 22/05/2018
''')
lista = {'M': 'MASCULINO', 'F': 'FEMININO'}
aux = '' #input('Qual o sexo [M/F] ? ').strip().upper()
while aux not in lista:
aux = input('Qual o sexo [M/F] ? ').strip().upper()
print(aux)
|
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
name = 'MyProject',
ext_modules = cythonize(["*.pyx"]),
include_dirs=[numpy.get_include()]
)
|
""" Cisco_IOS_XR_ethernet_cfm_datatypes
This module contains a collection of generally useful
derived YANG data types.
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YLis... |
#
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Functions for parsing the inheritance for overriding attributes.
Overriding attributes are defined and can be overridden further down the hierarchy.
There are two types - standard and merging. If an attribute is defined a... |
for i in range(0, 3, 1):
print(i) |
import datetime
import json
from prediction import predict
import psycopg2
from redis import Redis
from rows import DumpRow, PredictionRow
import time
def predict_thread(data, kind, cursor, connection):
prediction_table, rows_table = data["prediction_table"], data["rows_table"]
station_id = data["station_id"]... |
#!/usr/bin/env python
# coding: utf-8
# Author: Vladimir M. Zaytsev <zaytsev@usc.edu>
import os
import sys
import logging
import argparse
import collections
from sear.lexicon import DictLexicon
logging.basicConfig(level=logging.INFO)
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("-t", "--test", ... |
from flask import Flask
from werkzeug.exceptions import HTTPException
from . import blueprints, cors, database, schema
# Configure the app
app = Flask(__name__)
app.config.from_object("better_todos.config")
# Setup dependencies
cors.init(app)
database.init(app)
schema.init(app)
# Register the blueprints (modules)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.