text stringlengths 1 927k |
|---|
import base64
import io
import os
import json
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from colour import Color
def generate_ascii_post(event, context):
try:
print("## ENVIRONMENT")
print(os.environ)
print("## EVENT")
print(event)
response = {
... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible 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, either version 3 of the License, or
#... |
from pecan import expose
class ErrorController(object):
default_status = (
"An Error Occurred",
"""
Sorry, something seems to have gone wrong in handling your request.
"""
)
status = {
401: (
"Unauthorized",
"Sorry, you don't have permission... |
import datetime as dt
import random
import typing as t
import hikari
# import lightbulb # You may need lightbulb if you extend this.
from lightbulb import slash_commands
from .. import GUILD_ID
# Create a slash command class. The name is automatically set to the
# lower case version of the class name.
class Userin... |
import sys
from setuptools import setup, find_packages
setup(
name='gql',
version='0.1.1',
description='GraphQL client for Python',
long_description=open('README.rst').read(),
url='https://github.com/graphql-python/gql',
author='Syrus Akbary',
author_email='me@syrusakbary.com',
license=... |
# Copyright (C) 2015 – 2021 Noa-Emil Nissinen (4shadoww)
from core.hakkuframework import *
from core import colors
import threading, queue
import itertools
from os.path import relpath
from core import getpath
conf = {
"name": "wordlist_gen", # Module's name (should be same as file name)
"version": "1.0", # Mo... |
import jinja2
import os
import pathlib
import tempfile
from vtam.utils.FileParams import FileParams
from vtam.utils.PathManager import PathManager
from vtam.utils.Singleton import Singleton
class RunnerWopmars(Singleton):
def __init__(self, command, cli_args_dic):
"""
:param command: takes one ... |
import datetime
import json
import os
import pytest
import subprocess
from mock import patch, Mock, DEFAULT
from teuthology import nuke
from teuthology import misc
from teuthology.config import config
class TestNuke(object):
#@pytest.mark.skipif('OS_AUTH_URL' not in os.environ,
# reason=... |
import pytest
from openssh_key.pascal_style_byte_stream import (
PascalStyleByteStream,
PascalStyleFormatInstruction,
PascalStyleFormatInstructionStringLengthSize
)
def test_read_fixed_bytes():
test_bytes = b'\x01\x02\x03\x04'
byte_stream = PascalStyleByteStream(test_bytes)
result = byte_stre... |
# Generated by Django 2.2.1 on 2019-07-09 13:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0026_auto_20190709_1604'),
]
operations = [
migrations.AddField(
model_name='sponsor',
name='category',
... |
#!/usr/bin/python
# coding=utf-8
import emoji
from telegram.ext import Updater
from telegram.ext import CommandHandler, CallbackQueryHandler, MessageHandler
from telegram.ext import filters
from telegram import ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
from SiriusRPC import SiriusRPC, Wrapper as RPCWrapper... |
#!/usr/bin/env python3
##
# Copyright (C) Benjamin D. McGinnes, 2013-2017
# ben@adversary.org
# OpenPGP/GPG key: 0x321E4E2373590E5D
#
# Version: 0.0.1
#
# BTC: 1KvKMVnyYgLxU1HnLQmbWaMpDx3Dz15DVU
#
#
#
# Requirements:
#
# * Python 3.4 or later.
# * Converted from scripts initially developed with Python 2.7.x.
#
# O... |
#!/usr/bin/env python3
import typing
from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import Callable, Iterator, List, Optional
from bunkai.base.annotation import Annotations, SpanAnnotation
def func_filter_span(spans_wide: typing.List[SpanAnnotation],
spans_narrow: t... |
import sys
input = sys.stdin.readline
# input
m = int(input())
sum_val = 0
xor_val = 0
for _ in range(m):
query = tuple(map(int, input().split()))
# process & output
'''
수열의 순서는 지킬 필요가 없다.
애초에 수열일 필요가 없음.
출력값은 결국 합 아니면 xor니까.
xor의 역연산은 xor?
'''
if query[0] == 1:
sum_val += query[1]
xor_val ^= query[1]
elif... |
import discord
from discord.ext import commands
import forklink
class Bot(commands.Bot):
def __init__(self):
super(Bot, self).__init__(command_prefix=["audio ", "wave ", "aw "])
self.add_cog(Music(self))
async def on_ready(self):
print(f"Logged in as {self.user.name} | {self.user.id... |
import os
import webbrowser
from slack_sdk import WebClient
from slack_sdk.oauth import AuthorizeUrlGenerator
from slack_sdk.oauth.state_store import FileOAuthStateStore
from flask import Flask, request, make_response
from threading import Timer
from slack_cleaner.cleaner import start
client_secret = os.environ["SL... |
#!/usr/bin/env python3
from os import path
from setuptools import setup, find_packages
import isim
def run_setup():
"""Run package setup."""
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
try:
with open(path.join(here, 'README.md')) as f:
... |
# -*- coding: utf-8 -*-
"""Algorithms for directed acyclic graphs (DAGs)."""
# Copyright (C) 2006-2016 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from fractions import gcd
import heapq
import networkx a... |
from tensorflow import keras
from tensorflow.keras import backend as K
class SeqSelfAttention(keras.layers.Layer):
ATTENTION_TYPE_ADD = 'additive'
ATTENTION_TYPE_MUL = 'multiplicative'
def __init__(self,
units=32,
attention_width=None,
attention_type=AT... |
# Generated by Django 2.0.9 on 2019-05-11 13:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('diary', '0001_squashed_0020_auto_20190424_1603'),
]
operations = [
migrations.AddField(
model_name='job',
name='keyw... |
"""High-pass filter and locally detrend the EEG signal."""
import logging
import mne
import numpy as np
from pyprep.utils import _eeglab_create_highpass, _eeglab_fir_filter
def removeTrend(
EEG,
sample_rate,
detrendType="high pass",
detrendCutoff=1.0,
detrendChannels=None,
matlab_strict=Fals... |
# encoding: utf-8
"""
Utilities for path handling.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this so... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
""" The Mail ServiceProvider for AppEngine Mail API """
from masonite.provider import ServiceProvider
from .driver import MailAppEngineDriver
class MailAppEngineProvider(ServiceProvider):
wsgi = False
def register(self):
self.app.bind('MailAppEngineDriver', MailAppEngineDriver)
def boot(self):... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Unit tests for out-of-the-box model classes.
"""
# =============================================================================
# IMPORTS AND DEPENDENCIES
# =============================================================================
import pytest
from niteshad... |
from numpy import arange, unique, array, column_stack, concatenate
from itertools import product
from ..reducers.sample_reducer import sample_reducer
class ParamGrid:
'''Suite for handling parameters internally within Talos
Takes as input the parameter dictionary from the user, and
returns a class obje... |
from django.utils.translation import gettext_lazy as _
class AccountTypeChoices:
AUTHOR = "AUTHOR"
MANAGER = "MANAGER"
CLIENT = "CLIENT"
USER_CHOICES = (
(AUTHOR, _("Author")),
(MANAGER, _("Manager")),
(CLIENT, _("Client")),
) |
""" Statistical methods used to define or modify position of glyphs.
References:
Wilkinson L. The Grammer of Graphics, sections 7, 7.1
Method Types:
- Bin: Partitions a space before statistical calculation
- Summary: Produces a single value comprising a statistical summary
- Region: Produces two value... |
from __future__ import division
import json
import os
import re
import sys
from subprocess import Popen, PIPE
from math import log, ceil
from tempfile import TemporaryFile
from warnings import warn
from functools import wraps
try:
import audioop
except ImportError:
import pyaudioop as audioop
if sys.version_... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class OracleSession(object):
"""Implementation of the 'Oracle Session.' model.
Specifies information about session configuration for an Oracle host.
Attributes:
location (string): Location is the path where Oracle is installed.
syst... |
"""retriever.lib contains the core Data Retriever modules."""
from .create_scripts import create_package
from .datasets import datasets
from .datasets import dataset_names
from .download import download
from .install import install_csv
from .install import install_json
from .install import install_msaccess
from .insta... |
# Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Image data base class for kitti"""
import cv2
import os
import numpy as np
import subprocess
from dataset.imdb import imdb
from utils.util import bbox_transform_inv, batch_iou
class kitti(imdb):
def __init__(self, image_set, data_path, mc):
imdb.__init_... |
print('Olá Mundo') |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def remove_filter(context, name, value):
data = context["request"].GET.copy()
values = data.getlist(name)
values.remove(str(value))
data.setlist(name, values)
return data.urlencode() |
#!/usr/bin/env python3
def find_equal_index(mylist):
len_of_list = len(mylist)
if len_of_list <= 1:
raise ValueError('Invalid list supplied')
sum1 = mylist[0]
sum2 = sum(mylist[1:])
if sum1 == sum2:
return 1
for pointer in range(1, len_of_list-1):
if sum1 == sum2:
... |
"""'pip wheel' tests"""
import os
import re
import sys
from os.path import exists
import pytest
from pip._internal.cli.status_codes import ERROR
from tests.lib import pyversion # noqa: F401
@pytest.fixture(autouse=True)
def auto_with_wheel(with_wheel):
pass
def add_files_to_dist_directory(folder):
(folde... |
import os
import textwrap
from conans import tools
from tests.utils.test_cases.conan_client import ConanClientTestCase
class TestInstalledLibraries(ConanClientTestCase):
conanfile = textwrap.dedent("""\
from conans import ConanFile
import os
class AConan(ConanFile):
settings... |
# Generated by Django 3.2 on 2021-06-11 13:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('catalog', '0007_alter_catalog_slug'),
]
operations = [
migrations.AlterUniqueTogether(
name='catalog',
unique_together={('name... |
from collections import OrderedDict
from django.db.models import OuterRef, Subquery, Q
from extras.models.tags import TaggedItem
from utilities.query_functions import EmptyGroupByJSONBAgg, OrderableJSONBAgg
from utilities.querysets import RestrictedQuerySet
class CustomFieldQueryset:
"""
Annotate custom fie... |
# coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
import requests
from django.test import RequestFactory
from guardian.shortcuts import assign_perm, remove_perm
from rest_framework import status
from onadata.apps.api.viewsets.data_viewset import DataViewSet
from onada... |
#!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
# -*- coding: utf-8 -*-
"""
pagarmeapisdk
This file was automatically generated by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
from pagarmeapisdk.api_helper import APIHelper
from pagarmeapisdk.configuration import Server
from pagarmeapisdk.controllers.base_controller import BaseController
from pagarmeapisdk.mode... |
"""Core Model"""
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
"""User Manager"""
def create_user(self, email, password=None, **extra_fields):
"""Cre... |
import time
import threading
import tkinter as tk
import functions
import find_window
import sys
from tkinter import messagebox
from tkinter import ttk
from ttkthemes import ThemedTk
from playsound import playsound
## VARs
build_version = 'v1.3'
build_title = ('NST', build_version)
build_contact = 'slackertools@gmail.... |
import pytest
from unittest.mock import Mock, patch, ANY, mock_open
from google.cloud import bigquery
from pipelinewise.fastsync.commons.target_bigquery import FastSyncTargetBigquery
@pytest.fixture(name='query_result')
def fixture_query_result():
"""
Mocked Bigquery Run Query Results
"""
mocked_qr = M... |
import numpy as np
from sklearn.metrics import accuracy_score
import json
import data_loader
import decision_tree
# load data
X_train, X_test, y_train, y_test = data_loader.discrete_2D_iris_dataset()
# set classifier
dTree = decision_tree.DecisionTree()
# training
dTree.train(X_train, y_train)
y_est_train = dTree.p... |
"""Wrappers around build rules
These set common default attributes and behaviors for our local repo
"""
load(
"@build_bazel_rules_nodejs//:index.bzl",
_COMMON_REPLACEMENTS = "COMMON_REPLACEMENTS",
_nodejs_test = "nodejs_test",
_pkg_npm = "pkg_npm",
)
load("@rules_codeowners//tools:codeowners.bzl", _co... |
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE A... |
from setuptools import setup
setup(
name='kd2otl',
version='0.0.1',
packages=['kd2otl'],
url='https://github.com/avryhof/kd2otl',
license='MIT',
author='Amos Vryhof',
author_email='amos@vryhofresearch.com',
description='My HAM Radio Website.',
classifiers=[
'Development St... |
import zlib
from reclaimer.h2.common_descs import *
from supyr_struct.defs.tag_def import TagDef
def tag_name_table_name_pointer(parent=None, new_value=None, **kwargs):
header = parent.parent.parent.parent
if new_value is None:
if parent.offset == -1:
return header.tag_name_table_offset
... |
import os
import pytest
import torch
import tests.base.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.core import memory
from pytorch_lightning.trainer.distrib_parts import parse_gpu_ids, determine_root_gpu_device
from pytorch_light... |
import vmraid
from vmraid import msgprint, throw, _
# ruleid: vmraid-missing-translate-function
throw("Error Occured")
# ruleid: vmraid-missing-translate-function
vmraid.throw("Error Occured")
# ruleid: vmraid-missing-translate-function
vmraid.msgprint("Useful message")
# ruleid: vmraid-missing-translate-function
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_generate_files
-------------------
Tests formerly known from a unittest residing in test_generate.py named
TestGenerateFiles.test_generate_files_nontemplated_exception
TestGenerateFiles.test_generate_files
TestGenerateFiles.test_generate_files_with_trailing_newli... |
import os
import unittest
import pandas as pd
import mofax
from mofax.plot import *
TEST_MODEL = os.path.join(os.path.dirname(__file__), "mofa2_test_model.hdf5")
class TestMofaModelConnection(unittest.TestCase):
def test_connection(self):
self.assertIsInstance(mofax.mofa_model(TEST_MODEL), mofax.mofa_m... |
import argparse
import os
import random
import shutil
import time
import warnings
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.multiprocessing as mp
import torch.utils.data
import torch.utils.data.distr... |
import os
import dataset
from stuf import stuf
'''HELPER FUNCTIONS'''
def init_local_db(local_db = os.path.expanduser(r'~/scripts/leavesdb.db'), src_db = r'/media/data_cifs/irodri15/data/db/leavesdb.db'):
'''
Whenever working on a new machine, run this function in order to make sure the main leavesdb.db file is sto... |
# Count substring sub in string s. Case-sensitive by design.
def count_substring(s: str, sub: str) -> int:
le = len(s)
suble = len(sub)
return (sum(1 for i in range(le - suble + 1) if s[i : i + suble] == sub)
if le >= suble else 0) |
import os
import pytest
from jina.helper import yaml
from jina.docker.hubio import HubIO
from jina.main.parser import set_hub_build_parser, set_hub_pushpull_parser, set_hub_new_parser
cur_dir = os.path.dirname(os.path.abspath(__file__))
@pytest.mark.timeout(360)
def test_hub_build_pull():
args = set_hub_build_p... |
from functools import reduce
import io
import json
import logging
import os
import platform
import random
import re
import shlex
import smtplib
import string
import subprocess
import time
import traceback
import stat
from copy import deepcopy
from email.mime.multipart import MIMEMultipart
from email.mime.text import MI... |
from datetime import datetime
from flask import request
from flask_restx import Resource, Namespace, fields, reqparse
from api_v1 import privilege_required
import pandas as pd
import pickle
from db import coll_accounts
api = Namespace("ai", path="/ai", description="Endpoints utilizing some of my trained scikit models.... |
"""
sphinx.cmd.build
~~~~~~~~~~~~~~~~
Build documentation from a provided source.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import argparse
import bdb
import locale
import multiprocessing
import os
import pdb
import sys
import tra... |
#3- Crie um função em Python para calcular a equação "2*a + b"
def Equacao(a, b):
A, B = int(a), int(b)
return 2*A + B
print(Equacao(1, 2)) |
import os
import warnings
import tempfile
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
import tensorflow.keras as keras
from keras import backend as K
from keras.models import Model,model_from_json
from keras.layers import Dense,Dropout,Input
from keras.callbacks import EarlyStopping
import... |
# coding: utf-8
"""
Peacemakr
This API describes the Peacemakr services, which enable seamless application layer encryption and verification. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
i... |
import requests
import json
from bs4 import BeautifulSoup
query="python"
res = requests.get(f'https://github.com/search?o=desc&q={query}&s=updated&type=Repositories')
soup = BeautifulSoup(res.text, 'html.parser')
start = soup.find_all('ul',class_='repo-list')
github=[]
for item in start:
repo = item.find_all('di... |
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import weakref
from django.utils.copycompat import deepcopy
from django.u... |
# Copyright 2014 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python
# Copyright (c) 2017-2018 The PIVX developers
# Copyright (c) 2018-present The BITWIN24 developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import os, sys
from subprocess import check_output
def count... |
#!python
from queue import Queue
import unittest
class QueueTest(unittest.TestCase):
def test_init(self):
q = Queue()
assert q.front() is None
assert q.length() == 0
assert q.is_empty() is True
def test_init_with_list(self):
q = Queue(['A', 'B', 'C'])
assert ... |
import torch
from torch import Tensor
from torch import nn
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
class Pooling(nn.Module):
"""Performs pooling (max or mean) on the token embeddings.
Using pooling, it generates from a variable sized sentence a fixed sized sentence embeddi... |
#
# @lc app=leetcode id=190 lang=python3
#
# [190] Reverse Bits
#
# https://leetcode.com/problems/reverse-bits/description/
#
# algorithms
# Easy (33.67%)
# Likes: 707
# Dislikes: 250
# Total Accepted: 209.8K
# Total Submissions: 619.6K
# Testcase Example: '00000010100101000001111010011100'
#
# Reverse bits of a... |
# Copyright (c) 2016 by Tegile Systems, 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
#
# Unle... |
'''Tests for multipletests and fdr pvalue corrections
Author : Josef Perktold
['b', 's', 'sh', 'hs', 'h', 'fdr_i', 'fdr_n', 'fdr_tsbh']
are tested against R:multtest
'hommel' is tested against R stats p_adjust (not available in multtest
'fdr_gbs', 'fdr_2sbky' I did not find them in R, currently tested for
cons... |
class Additive:
def __init__(self, value):
self.value = value
def __add__(self, other):
return Additive(self.value + other.value)
Additive(1) +<caret> Additive(1) |
BLACKLIST_ENDPOINT = ["kms", "sts"]
def is_blacklist(endpoint_name):
"""Protecting the args sent to kms, sts to avoid security leaks
if kms disabled test_kms_client in test/contrib/botocore will fail
if sts disabled test_sts_client in test/contrib/boto contrib will fail
"""
return endpoint_name i... |
import sys
from collections import defaultdict
def letter_counts(code):
counts = defaultdict(lambda: 0)
for c in code:
counts[c] += 1
return dict(counts)
def answer(path):
with open(path) as f:
codes = f.read().strip().split("\n")
n2, n3 = 0, 0
for code in codes:
cou... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "customer_rewards"
app_title = "Customer Rewards"
app_publisher = "Tridz"
app_description = "Customer referrals"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "example@tridz.... |
"""
Source: https://github.com/grantjenks/python-diskcache/blob/71db7753610bcd4bd7adda28abeb2b0fdebbc31f/diskcache/core.py
Deprecated in favor of v2
"""
import sys
import codecs
import contextlib as cl
import errno
import functools as ft
import inspect
import io
import json
import os
import os.path as op
import pickl... |
import abc
from collections import OrderedDict
import tensorflow as tf
from typing import Optional, Union, List
from zfit import ztf
from zfit.util import ztyping
from zfit.util.cache import Cachable
from zfit.util.graph import get_dependents_auto
from .baseobject import BaseObject, BaseDependentsMixin
from .interfac... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Animal(models.Model):
name = models.CharField(max_length=150)
latin_na... |
import config
import json
import os
import errno
from typing import Dict
def read_mastermac() -> str:
with open(config.MASTERMAC_FILE, 'rb') as file:
key = file.read()
return key
def write_mastermac(key: str) -> None:
with open(config.MASTERMAC_FILE, 'wb') as file:
file.write(key.encode(... |
from tkinter import *
import datetime
import random
import time
# done
# dac przycisk wyjdz podczas gry
slowa = ["serious","occur","media","ready","sign","thought","list","individual","simple","quality","pressure","accept","answer","hard","resource","identify","left","meeting","determine","prepare","disease","whate... |
# Copyright (c) 2021 PaddlePaddle Authors. 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 by appli... |
from django.conf.urls import url, include
from rest_framework import routers
from scrapper import views
from .views import ReviewViewSet,ProductsViewSet,ProductDetailViewSet,ProductFullSpecViewSet,LatestMobilesViewSet,ecommerceBasedSearchViewSet,CompareMobilesViewSet,getSubCategories
router = routers.SimpleRouter()
... |
"""FileDialog with magicgui."""
from pathlib import Path
from typing import Sequence
from magicgui import event_loop, magicgui
@magicgui(filename={"mode": "r"})
def filepicker(filename=Path("~")):
"""Take a filename and do something with it."""
print("The filename is:", filename)
return filename
# Sequ... |
import numpy as np
import logging
from pycqed.measurement import sweep_functions as swf
from pycqed.measurement.sweep_functions import Soft_Sweep
from pycqed.measurement.waveform_control_CC import waveform as wf
# FIXME: Commented out as there is no module named Experiments.CLEAR.prepare_for_CLEAR.prepare_for_CLEAR
# ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-07 20:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('rules', '0001_initial'),
]
o... |
"""
Section class is an abstract class.
Local axis of the section is as follows:
x-axis is the longitudinal axis that is directed from the start node to the end node of the element
y-axis is directed upward the section
z-axis is directed to the left
Properties(abstract methods):
properties are overridden by the inh... |
import itertools
from functools import partial
from nose import SkipTest
from nose.tools import (assert_equal, assert_true, assert_false,
assert_raises)
import numpy as np
from sklearn.datasets import load_iris
from sklearn.utils import extmath
from sklearn.linear_model import Lasso
from sklearn... |
"""
======================================================
Compute source power spectral density (PSD) in a label
======================================================
Returns an STC file containing the PSD (in dB) of each of the sources
within a label.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import glob
import os
root_path = "../junior/"
for file in glob.glob(os.path.join(root_path, "problem_*")):
# print(file)
# print(file.split("problem_")[1])
os.rename(file, os.path.join(root_path, "p" + file.split("problem_")[1])) |
from flask import Flask, g, jsonify
from auth import auth
import config
import models
from resources.users import users_api
from resources.restaurants import restaurants_api
from resources.reviews import reviews_api
app = Flask(__name__)
app.register_blueprint(users_api, url_prefix='/api/v1')
app.register_blueprint... |
#!/usr/bin/env python3.8
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import re
import sys
def usage():
print(
'Usage:\n'
' magma_generic_cc_gen.py INPUT EXISTING OUTPU... |
# Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n',
'c7n.actions',
'c7n.filters',
'c7n.reports',
'c7n.resources',
'c7n.ufuncs']
package_data = \
{'': ['*']}
install_requires = \
['argcomplete>=1.11.1,<2.0.0',
'boto3>=1.12... |
from django.conf import settings
from django.core import signing
from django.core.signing import BadSignature, SignatureExpired, TimestampSigner
class Registrations:
@staticmethod
def generate_registration_token(email):
return TimestampSigner().sign(signing.dumps({'email': email}))
@staticmethod
... |
"""COMMAND : .cpu, .uptime, .suicide, .env, .pip, .neofetch, .coffeehouse, .date, .stdplugins, .fast, .iwantsex, .telegram, .listpip, .pyfiglet, .kowsay, .name, .faast, .daddyjoke, .fortune, .qquote, .fakeid, .vpn, .kwot, .qpro, .covid"""
# This Source Code Form is subject to the terms of the Mozilla Public
# License, ... |
# Copyright (C) 2019 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import parser_lib
import subprocess
MEM_PATH = ['/proc/iomem', '/proc/meminfo']
TTY_PATH = '/sys/class/tty/'
SYS_IRQ_PATH = '/proc/interrupts'
CPU_INFO_PATH = '/proc/cpuinfo'
ttys_type = {
'0': 'PORT',
'3... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPygments(PythonPackage):
"""Pygments is a syntax highlighting package written in Python.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.