content stringlengths 5 1.05M |
|---|
#!/usr/bin/python3
import hashlib
doorID = input("? ")
salt = 1
password = ""
while True:
string = doorID + str(salt)
hashed = str(hashlib.md5(string).hexdigest())
if hashed[0:5] == "00000":
print "Salt: " + str(salt) + "; Hash: " + hashed
password += hashed[5]
if len(password) ==... |
# Generated by Django 3.2.9 on 2022-01-15 15:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('worriors_app', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Worrior',
new_name='Warrior',
),
... |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.models.organization_plugin import OrganizationPluginSerializer
from sentry.api.serializers.models.... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/datastore/v1beta3/entity.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... |
#!/usr/bin/env python
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
import os
import thread
import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpClient
f... |
def data_reverse_old(data):
chunks = [data[i:i+8] for i in range(0, len(data), 8)]
return [bit for byte in reversed(chunks) for bit in byte]
def data_reverse(data):
return [b for i in range(len(data)-8, -1, -8) for b in data[i:i+8]]
data1 = [1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,... |
#! /usr/bin/env python
import random
matriz1 = [[0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1],[0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1],[0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0],[1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0],[0,1,0,0,0,1,0,1,0,... |
# -*- coding: utf-8 -*-
"""
Systems Overview – Init
=======================
Package initialisation
Copyright 2021 MET Norway
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.o... |
from __future__ import print_function
from model import *
flags = tf.app.flags
flags.DEFINE_integer('num_units', 24, 'Number of units in LSTM layer')
flags.DEFINE_integer('num_unrollings', 20, 'Input sequence length')
flags.DEFINE_integer('batch_size', 1000, 'The size of training batch')
flags.DEFINE_integer('train_s... |
#Copyright(c) 2016, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Drawing import Point, Color, Font
from System.Windows.Forms import *
from System import Array, Object
def tolist(obj1):
if hasattr(obj1,"__iter__"):... |
import ckan.lib.base as base
import ckan.plugins as p
import logging
import ckan.lib.dictization.model_dictize as model_dictize
from ckan.controllers import storage
from sqlalchemy import *
from ckan import model
tk = p.toolkit
_ = tk._ # translator function
log = logging.getLogger('ckan.logic')
class AJAXResponse(... |
import argparse
import json
import enum
from PIL import Image
class BlockType(enum.Enum):
Void = 0
Boundary = 1
Grass = 2
Concrete = 3
def get_args():
ap = argparse.ArgumentParser(description="worldgen")
ap.add_argument("source", nargs=1)
ap.add_argument("destination", nargs=1)
retu... |
import pickle
import numpy as np
from os.path import join
class IndexReader:
"""
IndexReader providing an interface for accessing a point-in-time view of an index.
Doc: https://lucene.apache.org/core/8_11_0/core/org/apache/lucene/index/IndexReader.html
Code: https://github.com/apache/lucene/blob/main... |
import numpy as np
import scipy.stats
import uncertainties
import argparse
import emcee
import halotools.empirical_models as htem
import halotools.sim_manager as htsm
# import halotools.mock_observables as htmo
# import tabcorr
import mocksurvey as ms
import galtab
# Make sure Corrfunc is installed, or else this wil... |
#####################################################################
# ADOBE CONFIDENTIAL
# ___________________
#
# Copyright 2019 Adobe
# All Rights Reserved.
#
# NOTICE: All information contained herein is, and remains
# the property of Adobe and its suppliers, if any. The intellectual
# and technical concepts co... |
from sqlalchemy import Table, Column, Integer, String, Boolean
from sqlalchemy.orm import mapper
from database import metadata, db_session
class Student:
query = db_session.query_property()
def __init__(self, first_name, last_name, age=None, email=None):
self.first_name = first_name
self.last_... |
__author__ = 'Bohdan Mushkevych'
from schema.io import load
from schema.sdpl_schema import DataRepository
from parser.relation import Relation
class DataStore(object):
""" module links relation with the data source/sink (table name and repository)
relation is versioned - i.e. fields with higher version t... |
import numpy as np
import torch
import time
import copy
import torch.nn as nn
from flcore.optimizers.fedoptimizer import PerAvgOptimizer
from flcore.clients.clientbase import Client
class clientPerAvg(Client):
def __init__(self, device, numeric_id, train_slow, send_slow, train_data, test_data, model, batch_size, ... |
import numpy as np
from torch.nn import functional as F
import matplotlib.pyplot as plt
import rlkit.torch.pytorch_util as ptu
import torch
from gym.envs.mujoco import PusherEnv, AntEnv, HalfCheetahEnv, HumanoidStandupEnv
from torch.utils.data import DataLoader, TensorDataset
from torch.optim import Adam
from torch imp... |
# Copyright 2018 Braxton Mckee
#
# 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 t... |
import os
import time
from dotdictionary import DotDictionary
__all__ = ['Metric']
# pid of the process we are running, automatically added to the metrics
try:
PID = os.getpid()
except:
PID = 0
class Metric(object):
"""
The set of values that are sent to the Graphdat dashboard for
each request
... |
from openapi_core import create_spec
from .. import exceptions
import json
class OpenAPIJSONCodec(object):
media_type = 'application/openapi+json'
media_types = ['application/openapi+json', 'application/vnd.oai.openapi+json']
def decode(self, bytestring, **options):
base_url = options.get('ba... |
from .sensorinfo import SensorInfo, SensorApi
from threading import Thread, Event, Lock
from random import random
try:
import RPi.GPIO as GPIO # @UnresolvedImport
except:
class GPIO:
BCM = 0
IN = 0
OUT = 0
PUD_UP = 0
@classmethod
def input... |
'''
@copyright: 2022 - Symas Corporation
'''
from ..model import Role
from ..file.common import require_one,attrs,common_search
def read (entity):
return require_one('Role', search(entity), entity.obj_name)
def search (entity):
return list(map(lambda e:__unload(e), common_search('role', entity)))
def __unloa... |
from typing import Optional
from uuid import uuid4
from entity.emote import Emote
from repository.emoteRepository import EmoteRepository
from telegram import InlineQueryResultGif, InlineQueryResultPhoto
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.inlinequeryhandler import InlineQueryHand... |
import fragmenter
import subprocess
import os
oemols = fragmenter.chemi.file_to_oemols('kinase_inhibitors.smi')
for mol in oemols:
name = mol.GetTitle()
print(name)
# replace command on psub script
with open('calc_am1_bsub.lsf', 'r') as file:
filedata = file.read()
filedata = filedata.r... |
from django.apps import AppConfig
class OpConfig(AppConfig):
name = 'op'
|
from selenium import webdriver
chrome_driver_path = 'C:/Development/chromedriver.exe'
driver = webdriver.Chrome(chrome_driver_path)
driver.set_window_size(1440, 720)
# driver.get('https://www.amazon.com/ELECJET-PowerPie-20000mAh-External-Nintendo/dp/B07YLFX8DT/ref=sr_1_2_sspa?dchild=1&keywords=laptop+power+bank&qid=1... |
"""TEST MODULE TEMPLATE"""
from advent_of_code.y2018.d2 import solution_1
from advent_of_code.y2018.d2 import solution_2
def test_solution_1():
example_input = [
"abcdef",
"bababc",
"abbcde",
"abcccd",
"aabcdd",
"abcdee",
"ababab",
]
example_result =... |
#Function that takes a number from a file
#and overwrites it
filename = "count.txt"
def writeNumber(number):
with open(filename, "wt") as f:
# write takes a string so we need to convert
f.write(str(number))
writeNumber(344) |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
from django.db import models
class Keyword(models.Model):
keyword = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Job(models.Model):
url = models.URLField()
created_at = models.DateTimeField(auto_now_a... |
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009-2010, James McCoy
# 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 ... |
import os
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.test import TestCase as BaseTestCase
from django.contrib.auth.models import User
from user_messages.models import Thread, Message
class login(object):
def __init__(... |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt
c = 100 # c darab véletlen pontot generálunk
x = np.random.random(c) # a generált pontok x értéke a [0;1] tartományban
y = np.random.random(c) # a generált pontok y értéke a [0;1] tartományban
d = np.sqrt(x * x + y * y) # minden pont távolsága ... |
from event_testing.resolver import SingleSimResolver
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sickness.sickness_utils import all_sickness_weights_gen
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
import services
sick_sim_schema = GsiG... |
from raccgen import generate
datafile = "lists/data.csv"
raccdata = generate.build(datafile)
pair = generate.racc(raccdata)
print(pair) |
import urllib
import functools
import pprint
import typing as T
import requests
from pyrsistent import pmap
from pymaybe import Nothing
from .toolz import (
pipe, curry, partial, concatv, compose, map, filter, merge,
maybe_pipe, vmap, maybe_first, noop, is_dict, vcall,
)
from . import logging
log = logging.n... |
from django.shortcuts import render,render_to_response
from django.http import HttpResponse,HttpResponseRedirect
from django import forms
from syapp.models import UserMain, YsArticle
import time,hashlib
import json
# jujiaodata.com.
# 生成列表页
class UserForm(forms.Form):
username = forms.CharField(label='username',m... |
import os
from flask import request
from flask_restful import Resource, abort
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import InvalidSignatureError
from linebot.models import (
TextSendMessage, TextMessage, MessageEvent
)
handler = WebhookHandler(os.getenv('LINE_CHANNEL_SECRE... |
# Generated by Django 2.2.15 on 2020-08-05 05:02
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('herders', '0015_artifactcraftinstance_artifactinstance'),
]
operations = [
... |
import click
import yaml
import torch
import ssd
import ssd.transforms as T
from ssd.coco.coco_utils import get_coco_api_from_dataset
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
@click.command()
@click.option('--dataset', required=True,
type=click.Choice(['labelme', 'VOC',... |
from kaggle_environments.envs.hungry_geese.hungry_geese import Configuration
from kaggle_environments import make as kaggle_make
from pathlib import Path
import torch
from torch import nn
from torch import multiprocessing as mp
from hungry_geese.training.alphagoose.alphagoose_data_generator import get_latest_weights_f... |
from typing import Dict, Tuple
import numpy as np
from numpy import ndarray
def forward(X: ndarray, Y: ndarray, weights: Dict[str, ndarray]) -> Tuple[float, Dict[str, ndarray]]:
"""Performs a single forward pass of the gradient descent.
Args:
X (ndarray): the input data.
Y (ndarra... |
# -*- coding: utf-8 -*-
import base64
import pytest
import hashlib
from falcon.testing import TestBase
from falcon import API
from falcon import status_codes
from graceful.resources.base import BaseResource
from graceful import authentication
from graceful import authorization
@authorization.authentication_required... |
import operator as op
from collections import defaultdict
from itertools import starmap
from functools import reduce
from uuid import uuid1
import funcy as fn
from toposort import toposort
from aiger import aig
def _fresh():
return str(uuid1())
def _map_tree(inputs, f):
queue = fn.lmap(aig.Input, inputs)
... |
#!/usr/bin/python2.6
#
# Copyright 2012 Google 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
#
# Unless required... |
import math
MODE_INT = 1
MODE_FLOAT = 2
class PT1(object):
def __init__(self, t_sample, tau, K=1, mode=MODE_FLOAT, shift=10):
# TODO:
# - Rename parameters
self._t_sample = t_sample
self._tau = tau
self._mode = mode
self._shift = shift
if mode == MODE_INT:
... |
import os
def get_paths_from_list(fn_list, prefix = '', suffix = '', auto_prefix = None):
'''
@argument fn_list (STR: filename)
a file that stores a list of ID/path(s)
@argument prefix (STR)
prefix added to paths
@argument suffix (STR)
suffix added to paths
@argument auto_pre... |
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.gridspec
import numpy as np
def make_my_grid_subplots(ratios_c, ratios_r, gridspec_kwargs = {'wspace':0.2, 'hspace':0.2, 'left':.2, 'top':0.9}):
gridspec_kwargs['hspace']=.5
gridspec_kwargs['left']=.2
gridspec_kwargs... |
""" Utilities for dealing with correlated inputs."""
from equadratures.parameter import Parameter
from equadratures.poly import Poly, evaluate_model, evaluate_model_gradients
from equadratures.basis import Basis
import numpy as np
from scipy import stats
from scipy.stats import multivariate_normal, norm
from scipy.lina... |
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 不显示等级2以下的提示信息
print('GPU', tf.test.is_gpu_available())
a = tf.constant(2.0)
b = tf.constant(4.0)
print(a + b) |
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import yaml
from colour import Color
#generate a gradient colo map
def color_list_generator(color_level=100,start_color='white',end_color='red'):
start=Color(color=start_color)
end=Color(color=end_color)
color_list=list(start.range_to... |
from django.db import models
class MeasurementsSets(models.Model):
object_id = models.IntegerField(null = False)
complete = models.BooleanField(null = False, default = False)
timestamp = models.IntegerField(null = False)
def __str__(self):
return str(self.id)
class Measurements(models.Model)... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
"""
monkey patch distutils to use multi-core to build single extension.
these code is based on:
https://stackoverflow.com/a/13176803/4797109
"""
import multiprocessing.pool
parallel: int = 1
# monkey-patch for parallel compilation
def parallel_compile(self,
sources,
output_... |
import json, subprocess
from .. pyaz_utils import get_cli_name, get_params
def add(source=None, name=None, index=None, yes=None, pip_extra_index_urls=None, pip_proxy=None, system=None, version=None, upgrade=None):
params = get_params(locals())
command = "az extension add " + params
print(command)
o... |
# 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, software
# distributed under the ... |
# -*- coding: utf-8 -*-
"""
idfy_rest_client.http.auth.oauth2
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
import base64
import calendar
from datetime import datetime
from ...controllers.o_auth_authorization_controller import OAuthAuthorizationControlle... |
from flask import Flask, Response, render_template, request
import json
from wtforms import TextField, Form
from flask_restful import Resource, Api
app = Flask(__name__, template_folder='template')
api=Api(app)
class SearchForm(Form):
autocomp = TextField('Insert Footballer', id='footballer_autocomplete'... |
import smart_imports
smart_imports.all()
class ResourceTest(testcase.TestCase):
def setUp(self):
super(ResourceTest, self).setUp()
game_logic.create_test_map()
self.account = self.accounts_factory.create_account()
@mock.patch('the_tale.accounts.prototypes.AccountPrototype.active_... |
from . import mysql
MySql = mysql.MySql
__version__ = "1.1.3"
__all__ = ['mysql']
|
from django.db import models
from django.contrib.auth import models as auth_models
from graphite.account.models import Profile
from graphite.util import json
class Dashboard(models.Model):
name = models.CharField(primary_key=True, max_length=128)
owners = models.ManyToManyField(Profile, related_name='dashboards')
... |
def test_import():
import hapdab
assert True
|
import json
import os
from kodexa.model import Taxonomy
def get_test_directory():
return os.path.dirname(os.path.abspath(__file__)) + "/../test_documents/"
def test_serialization():
taxonomy_json = open(os.path.join(get_test_directory(), 'example-taxonomy.json'), 'rb').read()
taxonomy_dict = json.load... |
from html import unescape
from django.core.exceptions import FieldDoesNotExist
from django.utils.html import strip_tags
from django_elasticsearch_dsl import Document, fields
from django_elasticsearch_dsl.registries import registry
from elasticsearch_dsl import A
from elasticsearch_dsl.query import MultiMatch
from se... |
import os
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README')).read()
setup(
name = "maillib",
version = "0.1.3",
description = "A simplified interface to Python's email package.",
long_description = ... |
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Add relation module by Chengpeng Chen
# --------------------------------------------------------
# the layer to encoding the geometric features
# refer to paper: Relation ne... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 23 10:57:38 2018
@author: huang
"""
import traceback
import sys
import time
import hashlib
import copy
from com.logger import logger
from com.connection import db
sys.path.append('../')
from worker.communicate import insert_db_data
TABLE_COL_MAP={
'call_meth... |
"""tensorflow summary util"""
import tensorflow as tf
def mean_summary(var):
"""mean scalar summary
:type var: tensorflow.Variable
:param var: variable to add summary
"""
with tf.name_scope(var.name.split(":")[0]):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', m... |
import asyncio
from utilities import utilities
from Db.mute_sql import addMuteUser, getMutedUsers, getMutedUser, remMuteUser
from telethon import utils, errors
import re
async def mute_user(message, from_id, chat_id, name):
try:
if getMutedUser(chat_id, from_id):
return await message.reply("Us... |
# Generated by Django 2.2.3 on 2019-11-18 21:34
from django.db import migrations, models
import portal.hackathons.models
class Migration(migrations.Migration):
dependencies = [
("capstone", "0003_auto_20191115_2201"),
]
operations = [
migrations.AddField(
model_name="capston... |
import logging
from django.template import Context
from django.template import Template
from django.shortcuts import get_object_or_404
from .models import Blog
logger = logging.getLogger(__name__)
class RenderPostMixin:
def render_post(self, post, javascript=True, include_detail=False):
content = "{}\... |
# Generated by Django 2.2.3 on 2020-04-14 06:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Movies', '0001_initial'),
('Users', '0001_initial'),
]
operations = [
migration... |
# coding=utf-8
from django.shortcuts import render, redirect
from django.core.paginator import Paginator
from models import *
from haystack.views import SearchView
# Create your views here.
def index(request):
category_list = Category.objects.all()
array = []
for category in category_list:
news =... |
"""fsps-age.py -- Estimates the age of a Photometric SED using FSPS.
Science goal:
Check local environment effects on SNIa by looking for correlations
between HR and the age of the local environment calculated from SDSS Scene
Modeling Photometry
Usage:
fspsage.py burnin OBJID
fspsage.py run DATASE... |
import numpy as np
import pandas as pd
import boto3
import diff_classifier.aws as aws
import os
import math
import matplotlib.pyplot as plt
from io import StringIO
from csv import writer
import secrets
import diff_classifier.features as ft
def directed_diffusion(n_particles=1000, size=1600, time_max=50, vm=None, dif... |
#hours in a year
var = 24 * 365
print("Hours in an year: " + str(var))
#minutes in a decade
var1 = var * 10 * 60
print("Minutes in a decade: " + str(var1))
#age in seconds
var2 = var * (2018 - 1999) * 60 * 60
print("Age in seconds: " + str(var2))
#full name
print("First Name: ")
var3 = input()
print("Middle Name: "... |
from django.urls import reverse
import django_tables2 as tables
from . import models as m
GRADES = ['average_GPA', 'As', 'Bs', 'Cs', 'Ds', 'Fs']
def course_url(record):
return reverse('distributions:course_detail', args=[record.slug])
class CourseTable(tables.Table):
class Meta:
model = m.Course... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.views.generic import TemplateView, View
from django.views.generic.detail import BaseDetailView
from django.views.generic.edit import BaseFormView
from django.http import HttpResponseBadRequest, JsonResponse
from django.shortcuts import get_obj... |
from os import getcwd
import re
def parseIndex(rule: str):
idxRegex = re.search(r"(\d+): ", rule)
index = int(idxRegex.groups()[0])
rule = rule[idxRegex.span()[1]:]
return (index, rule)
def parsePattern(pattern: str, idxToPat: dict):
# this is an utterly sinful solution, but what... |
from __future__ import annotations
from typing import Optional
from .base_conv_layer import BaseConvLayer
from .base_layer import Layer
from .trainable_layer import TrainableLayer
from ..utils.initialization import Initialization
from ..utils.merge import MergeInputs
from ..utils.types import ActivationFunctions, Sha... |
from app import db
class entity(db.Model):
__tablename__ = "entity"
nome = db.Column(db.String, primary_key = True, unique = True)
cnpj = db.Column(db.String)
rua = db.Column(db.String)
bairro = db.Column(db.String)
cidade = db.Column(db.String)
cep = db.Column(db.String)
sobre = db.Co... |
import discord.ext.commands as disextc
import logging as lg
import yaml as yl
log = lg.getLogger(__name__)
class Config(disextc.Cog):
""" Configuration handler for the bot.
This is a yml file representation. Each configuration stored should be
under its own key:
discord:
exampledata1
... |
from ply4ever.parseTree import *
import ply.yacc as yacc
from ply4ever.consoleColor import bcolors
yacc.yacc()
print(f"""
{bcolors.HEADER + bcolors.BOLD}Welcome to PYLang!{bcolors.ENDC}
{bcolors.BOLD}------------------------------------------------{bcolors.ENDC}
Enter {bcolors.OKGREEN}exit();{bcolors.ENDC}... |
# imports
from functools import partial
import json
from twisted.internet.defer import Deferred
from twisted.internet.protocol import Protocol
from twisted.internet import reactor, task
from twisted.web.client import Agent
from utils import print_msg_with_class_name, show_error_window, gen_
# consts
RESOURCE_LABEL ... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime
from gaiatest import GaiaTestCase
from gaiatest.apps.calendar.app import Calendar
class... |
import requests
import pprint,json,os
from bs4 import BeautifulSoup
from pprint import pprint as pp
def scrap_top_list():
if os.path.exists('movie_list.json'):
with open('movie_list.json','r') as file:
new_file= json.load(file)
return new_file
else:
url = requests.get("h... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from re import match
class IIMAgent(object):
def __init__(self, module):
self._name = os.path.basename(__file__)
self.module = module
self.iim_path = self.module.params['iim_path']
... |
from __future__ import absolute_import
from .base import _StyleContainer
from ..extern.six import string_types
__all__ = [
'Font',
]
fonts_root2text = {
1: 'times-medium-i-normal',
2: 'times-bold-r-normal',
3: 'times-bold-i-normal',
4: 'helvetica-medium-r-normal',
5: 'helvetica-medium-o-norma... |
import calendar
from myproductivitytool.common.utils import *
from myproductivitytool.common.models import *
from myproductivitytool.common.responses import *
from myproductivitytool.common.serializers import *
from myproductivitytool.common.services import *
from django.conf import settings
from django.shortcuts im... |
#!/usr/bin/env python
# mpg123 lib on github
# https://github.com/20tab/mpg123-python
# mit licanse
from mpg123 import Mpg123, Out123
from tkinter import *
from tkinter import messagebox
from time import sleep
import threading
def main():
genislik = Pencere.winfo_screenwidth()
yukseklik = Pencere.winfo_scree... |
from django.db import migrations
def bootstrap(apps, schema_editor):
# create bootstrap objects
Layout = apps.get_model("load", "Layout")
LAYOUT_GENERIC = Layout.objects.create(name="Generic", description="")
LAYOUT_SKYLINE = Layout.objects.create(name="Skyline", description="")
ParserMapping = ap... |
"""Notifier."""
import asyncio
import logging
import os
import aiohttp
import pymsteams
from strategies.reds_per_report import reds_per_report
async def notify(log_level: int = None) -> None:
"""Notify our users periodically of the number of red metrics."""
logging.getLogger().setLevel(log_level or logging... |
#! /usr/bin/env python
# this import must comes first to make sure we use the non-display backend
import matplotlib
matplotlib.use('Agg')
# add parent folder to search path, to enable import of core modules like settings
import os, sys, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.cu... |
# -*- coding: utf-8 -*-
import re
import json
import tensorflow as tf
class Config(object):
def __init__(self, **entries):
self.__dict__.update(entries)
def get_config_from_json(json_file):
"""
Get the config from a json file
:param json_file:
:return: config(namespace) or config(diction... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser as DjangoAbstractBaseUser, PermissionsMixin
from .managers import UserManager
class AbstractBaseUser(DjangoAbstractBaseUser, PermissionsMixin):
'''
Fields inherited from PermissionsMixin:
password - is_superuser - groups... |
def register_to(bot):
def subject(bot, msg, match):
if msg['type'] == 'chat':
msg.reply('sorry! i can only change the subject for mucs!').send()
return True
bot.change_subject(match.group(1), msg['from'].bare)
return True
bot.respond('set subject to (.*)$', sub... |
vowels = 0
for char in s:
if char=='a' or char=='e' or char=='i' or char=='o' or char=='u':
vowels += 1
print('Number of vowels:', vowels)
|
n,k=map(int,input().split())
l=list(map(int,input().split()))
p=0
for i in range(n-1):
for j in range(i+1,n):
#print(l[i]+l[j])
if((l[i]+l[j])%k==0):
p+=1
print(p) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.