text
string
size
int64
token_count
int64
import os def define_env(env): """ This is the hook for the functions (new form) """ env.variables.cwd = os.getcwd() # use dot notation for adding env.variables.baz = env.variables.fix_url('foo') # Optional: a special function for making relative urls point to root fix_url = env...
699
230
""" MPLS_LDP_STD_MIB Copyright (C) The Internet Society (2004). The initial version of this MIB module was published in RFC 3815. For full legal notices see the RFC itself or see\: http\://www.ietf.org/copyrights/ianamib.html This MIB contains managed object definitions for the 'Multiprotocol Label Switching, Labe...
114,519
37,211
def find_bash(): import os if os.name == 'nt': return _find_windows_bash() return '/bin/bash' def _find_windows_bash(): winreg = _winreg_module() import csv StringIO = _get_string_io() from os.path import dirname sub_key = 'Directory\\shell\\git_shell\\command' value = w...
892
290
from .db import db from .userfollower import UserFollower from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin from sqlalchemy import Table, Column, Integer, ForeignKey, or_ from .directmessage import DirectMessage from .userequipment import UserEquipment from .equ...
9,104
3,058
from louie import Signal class update_finished(Signal): """ Sent by :class:`~pyflu.update.qt.UpdateDialogMixin` when an update finished successfully. It receives a single argument, containing the path of the patched files. """ class not_updated(Signal): """ Sent by :meth:`~pyflu.update....
397
125
import torch from torch import nn, Tensor from typing import Union, Tuple, List, Iterable, Dict from sentence_transformers import util from sentence_transformers.SentenceTransformer import SentenceTransformer class BatchHardTripletLossDistanceFunction: """ This class defines distance functions, that can be us...
9,443
2,916
from flask import Flask, Blueprint, request, make_response, jsonify from sqlalchemy.sql.expression import func from google.cloud import storage from .card import Cards from ..functions import valid_param, upload_file from .. import db bp = Blueprint('route', __name__, url_prefix = '/api') @bp.route('/cards') def geta...
2,505
898
import numpy as np import h5py import scipy import gc import pandas as pd import os import time import pkg_resources import scanpy as sc import scanpy.external as sce import sys import scrublet as scr # --------------------------------- # Scanpy Helpers # --------------------------------- def scanpy_adata_loader(pat...
6,804
2,379
from typing import Callable, Optional, Type from mypy.nodes import AssignmentStmt, NameExpr, Statement, TempNode, Var from mypy.plugin import ClassDefContext, Plugin READONLY_DECORATOR_NAME = "quacks.readonly" # this logic is mostly derived from the dataclasses plugin def make_statement_readonly(c: ClassDefContext,...
1,518
495
from .context import * import unittest from mail_panel.panels import MailToolbarPanel class ToolbarSuite(unittest.TestCase): def test_panel(self): """ General 'does it run' test. """ p = MailToolbarPanel(None) assert(p.toolbar is None) def suite(): suite = unittest.Te...
470
151
# Copyright 2016-2020 Blue Marble Analytics LLC. # # 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 ag...
8,130
2,971
from main import extract_data if __name__ == '__main__': top = {} out = extract_data('CrossoverWiki.xml') for name in out: for link in name['links']: w = link['with'] top[w] = top[w] + 1 if w in top else 1 top = dict(reversed(sorted(top.items(), key=lambda item: item[1])...
338
120
""" Flask application settings. """ import os DEBUG = True # Output un-merged files in debug mode. #ASSETS_DEBUG = DEBUG SECRET_KEY = os.environ.get('SECRET_KEY', None) MY_VAR = os.environ.get('MY_VAR', None) #: Mongodb settings MONGODB_SETTINGS = {'DB' : 'digfont'} #: CSRF key SECRET_KEY = "dig.font.s3cr3t"
316
133
#! /usr/bin/python3 ''' panogram.py - this program recongizes pangrams. by zorba ''' import sys def pangram_check(sentence_or_word): ''' checks the user input to see if it is a pangram. ''' letters = set('abcdefghijklmnopqrstuvwxyz') if sentence_or_word.lower() == 'done': z for le...
839
291
# -*- coding: utf-8 -*- """ Created on Sat Oct 10 15:31:57 2020 @author: Tarun Jaiswal """ dictone = { "bookname": "Recursion Sutras", "subject": "Recursion", "author": "Champak Roy" } dicttwo = dict(dictone) print(dicttwo)
232
112
# Copyright 2014 Au Yeong Wing Yau # # 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...
1,032
316
import math import time from compas_fab.backends import RosClient from compas.artists import Artist from compas.geometry import Frame with RosClient("localhost") as client: robot = client.load_robot(load_geometry=True) group = robot.main_group_name frame = Frame((0.4, 0.3, 0.05), (-1, 0, 0), (0, 1, 0)) ...
1,252
429
from io import StringIO import pytest from requests.exceptions import ConnectionError from awxkit.cli import run, CLI class MockedCLI(CLI): def fetch_version_root(self): pass @property def v2(self): return MockedCLI() @property def json(self): return { 'use...
1,306
431
# coding=utf-8 # Copyright 2014 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) from textwrap import...
10,797
3,760
import PIL import numpy as np def to_grayscale(img): return np.dot(img, [0.299, 0.587, 0.144]) def zero_center(img): return img - 127.0 def crop(img, bottom=12, left=6, right=6): height, width = img.shape return img[0: height - bottom, left: width - right] def save(img, path): pil_img = PIL....
364
156
from django.apps import AppConfig class SharingGroupsConfig(AppConfig): name = 'sharing_groups'
102
31
## backend.py """ The purpose of this script is to continuously monitor the blockchain to 1) determine if a holder aquires or loses an NFT: 2) if they do, generate a new image/movie for the tokens they hold, 3) upload the new image/movie to the hosting service 4) update the metadata file Repeat :) (The above ordering ...
5,310
1,935
""" :mod:`pyffi.formats.tga` --- Targa (.tga) ========================================= Implementation -------------- .. autoclass:: TgaFormat :show-inheritance: :members: Regression tests ---------------- Read a TGA file ^^^^^^^^^^^^^^^ >>> # check and read tga file >>> import os >>> from os.path import dir...
10,875
3,224
import telegram import os def main(): token = os.getenv("TOKEN", None) message = os.getenv("MESSAGE", "No message, please set MESSAGE env") chat_id = os.getenv("CHAT_ID", None) bot = telegram.Bot(token=token) bot.send_message(chat_id=chat_id, text=message, parse_mode=telegram.ParseMode.HTML) if...
355
134
"""Advent of Code 2018 Day 13.""" from copy import deepcopy CARTS = '<>^v' INTERSECTION = '+' CURVES = '\\/' cart_to_direction = { '<': 180, '^': 90, '>': 0, 'v': 270, } direction_to_move = { 0: (0, 1), 90: (-1, 0), 180: (0, -1), 270: (1, 0), } direction_to_cart = { 0: '>', 90:...
4,309
1,461
from goopylib.imports import * from pathlib import Path as pathlib_Path # I kinda wanted to scrap this, it wasn't that good. def create_custom_ease(): window = Window(title="goopylib: Create Custom Ease", width=get_screen_size()[1] * 0.7, height=get_screen_size()[1] * 0.7, autoflush=False, bk_c...
13,037
4,226
# -*- encoding: utf-8 -*- """ Filename :train.py Description :获取小作文摘要 Time :2021/06/22 15:21:08 Author :hwa Version :1.0 """ from app.lib.duplication_check.reply_database import ReplyDatabase import time def train_data(): start_time = time.time() db = ReplyDatabase....
537
207
"""Builder for generating evergreen configuration.""" from threading import Lock from typing import Set, List, Dict import inject from shrub.v2 import ShrubProject, BuildVariant, ExistingTask, Task from buildscripts.patch_builds.task_generation import validate_task_generation_limit from buildscripts.task_generation.c...
5,837
1,594
from vint.ast.node_type import NodeType from vint.ast.plugin.scope_plugin.identifier_attribute import ( IDENTIFIER_ATTRIBUTE, IDENTIFIER_ATTRIBUTE_DYNAMIC_FLAG, IDENTIFIER_ATTRIBUTE_DECLARATION_FLAG, IDENTIFIER_ATTRIBUTE_MEMBER_FLAG, IDENTIFIER_ATTRIBUTE_FUNCTION_FLAG, IDENTIFIER_ATTRIBUTE_AUTOL...
4,424
1,733
class Analyser: def __init__(self, callbacks, notifiers, state): self.cbs = callbacks self.state = state self.notifiers = notifiers def on_begin_analyse(self, timestamp): pass def on_end_analyse(self, timestamp): pass def analyse(self, event): event_nam...
1,130
354
from .nn_policy import NNPolicy # from .gmm import GMMPolicy # from .latent_space_policy import LatentSpacePolicy from .uniform_policy import UniformPolicy # from .gaussian_policy import GaussianPolicy from .stochastic_policy import StochasticNNPolicy, StochasticNNConditionalPolicy from .deterministic_policy impo...
348
105
""" Routes and views for the flask application. """ import os import json from flask import Flask, redirect, request, render_template, flash from pathlib import Path from flask_wtf import FlaskForm from wtforms import StringField,SelectField,PasswordField,BooleanField from wtforms.validators import InputRequired,Valida...
3,841
1,201
def retorno(): resp=input('Deseja executar o programa novamente?[s/n] ') if(resp=='S' or resp=='s'): verificar() else: print('Processo finalizado com sucesso!') pass def cabecalho(titulo): print('-'*30) print(' '*9+titulo+' '*15) print('-'*30) pass def mensage...
2,001
612
from policies import plc_get, plc_add, plc_update from sdk.color_print import c_print from tqdm import tqdm def migrate_builtin_policies(tenant_sessions: list, logger): ''' Updates the default/built in policies of all clone tenants so they are the same as the source tenant. Default policies can not be adde...
3,278
896
######################################################################################## ######################################################################################## ## # CODE LANGUAGE IS PYHTON! ## ## ## ## # DATE: 1-JULY-2021 ## ## ...
8,158
2,633
from instapy import InstaPy #insta_username = 'antonpuhonin' #insta_password = 'Bulbazavr36' insta_username = 'tonparfums' insta_password = 'ov9AN6NlnV' try: session = InstaPy(username=insta_username, password=insta_password, headless_browser=True, ...
512
183
from rest_framework import serializers from portal.academy import models from portal.applications.models import Submission, Challenge class GradeSerializer(serializers.ModelSerializer): notebook = serializers.FileField(source="feedback") class Meta: model = models.Grade fields = ( ...
1,462
386
from time import sleep c = ('\033[m', # 0 - Sem cores '\033[0;30;41m', # 1 - Vermelho '\033[0;30;42m', # 2 - Verde '\033[0;30;43m', # 3 - Amarelo '\033[0;30;44m', # 4 - Azul '\033[0;30;45m', # 5 - Roxo '\033[0;30m' # 6 - Branco ) #Programa princip...
323
176
from . import datasets, radialcenter
36
8
######################################## # Automatically generated, do not edit. ######################################## from pyvisdk.thirdparty import Enum VirtualMachineHtSharing = Enum( 'any', 'internal', 'none', )
236
64
# Generated by Django 3.1.12 on 2021-07-15 21:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reo', '0117_auto_20210715_2122'), ] operations = [ migrations.AddField( model_name='sitemodel', name='lifetime_emis...
1,710
540
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program 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 2 # of the License, or (at your option) any later version. # # This program is distrib...
16,287
5,173
import os.path import pytest import py from pynpact.steps import extract def test_binfile_exists(): assert extract.BIN assert os.path.exists(extract.BIN) def test_plan(gbkconfig, executor): extract.plan(gbkconfig, executor) filename = gbkconfig[extract.OUTPUTKEY] assert filename p = py.path...
771
263
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2019 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html #...
16,994
4,596
from collections import deque class Solution(object): def longestOnes(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ start, res = 0, 0 zeros = deque() for i in range(len(A)): if A[i] == 0: zeros.append(i)...
865
373
# # This script allows the user to control an Anki car using Python # To control multiple cars at once, open a seperate Command Line Window for each car # and call this script with the approriate car mac address. # This script attempts to save lap times into local mysql db running on the pi # Author: jstucken #...
3,000
939
import board from i2cperipheral import I2CPeripheral from analogio import AnalogOut from digitalio import DigitalInOut, Direction, Pull import struct import math import time regs = [0] * 16 index = 0 i2c_addr = 0x68 frame_id = 0 motor_control_mode = 0 backup_mode = 0 motor_switch_state = 0 hall_switch_state = 0 enc...
9,992
3,120
GOV_AIRPORTS = { "Antananarivo/Ivato": "big", "Antsiranana/Diego": "small", "Fianarantsoa": "small", "Tolagnaro/Ft. Dauphin": "small", "Mahajanga": "medium", "Mananjary": "small", "Nosy Be": "medium", "Morondava": "small", "Sainte Marie": "small", "Sambava": "small", "Toamasi...
360
161
def fibonacci(n): fibonacci = np.zeros(10, dtype=np.int32) fibonacci_pow = np.zeros(10, dtype=np.int32) fibonacci[0] = 0 fibonacci[1] = 1 for i in np.arange(2, 10): fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2] fibonacci[i] = int(fibonacci[i]) print(fibonacci) for i in np.arange(10): fibonacci_pow[i] ...
608
319
from scrapy import Spider from scrapy.spiders import CrawlSpider, Rule from scrapy.selector import Selector from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.linkextractors import LinkExtractor import scrapy from scrapy.spidermiddlewares...
24,800
11,193
import sys import re PATH_GLUT = 'glut.h' FILE_GLUT = 'glutbind.cpp' TEMPLATES = ['glutInit', 'glutTimerFunc'] def main(): """ Still some things have to be hand-made, like changing argv pargc values in the glutInit method definition Also change the TimerFunc method with some magic. """ make_...
10,622
3,607
import threading import time import random from multiprocessing.pool import ThreadPool from PyQt5 import QtCore, QtGui, QtWidgets bandera = False val1 = "" msg = 'Caballo ganador es: {}' # Clase Caballo class caballo(threading.Thread): def __init__(self, num, b1,resultado): global val...
1,602
593
# Copyright 2019-2021 Wingify Software Pvt. Ltd. # # 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 agr...
10,353
3,032
# -*- coding: utf-8 -*- #import some dope import sys import os import re import time from random import randrange from itertools import repeat numbers = { 'adam' :"+41111111111", 'bob' :"+41222222222", 'chris' :"+41333333333", 'dave' :"+41444444444", } print "Gespeicherte Empfänger: " for name in numbers: ...
2,687
1,207
# Copyright (c) 2020 NVIDIA Corporation # 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, publish, d...
2,582
925
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() # NOQA import unittest import chainer import chainer.functions as ...
3,601
1,217
# -*- coding: utf-8 -*- # Copyright (c) 2020 Red Hat, 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, copy, modi...
33,946
9,491
from abc import ABC as Contract, abstractmethod class AuthContract(Contract): @abstractmethod def user(self): pass @abstractmethod def save(self): pass @abstractmethod def delete(self): pass
244
69
#!/usr/bin/env python # -*- coding: utf-8 -*- """netblow_cli module.""" import argparse from netblow.netblow import NetBlow from netblow.version import __version__ def main(): """Entry function.""" parser = argparse.ArgumentParser( description="netblow. Vendor agnostic network testing framework to str...
2,202
674
''' ' Python Regular Expression 正则表达式 ' ''' import re def test_match(): s = 'hello python Hello' p = 'hello' o = re.match(p, s) print(o) print(dir(o)) print(o.group()) # 返回匹配的字符串 print(o.span()) # 范围 print(o.start()) # 开始处 print('*' * 30, 'flags参数的使用') o2 = re.match(p, s, re.L) print(o2.grou...
8,688
4,957
#! /usr/bin/env python2 # -*- coding: utf8 -*- from subprocess import check_output def get_pass(): return check_output("pass gmail/me", shell=True).strip("\n")
166
61
from __future__ import unicode_literals import pytest from hypothesis import ( strategies as st, given, ) from eth_utils.encoding import ( int_to_big_endian, big_endian_to_int, ) @pytest.mark.parametrize( 'as_int,as_big_endian', ( (0, b'\x00'), (1, b'\x01'), (7, b'\x...
1,139
496
import numpy as np # Normalize dataset such that all sequences have min value 0.0, max value 1.0 def normalize(dataset, lower_lim=0.0, upper_lim=1.0): seq_mins = dataset.min(axis=(1, 2, 3)) seq_maxes = dataset.max(axis=(1, 2, 3)) dataset -= seq_mins.reshape((-1, 1, 1, 1)) dataset /= (seq_maxes - seq...
1,086
429
from __future__ import absolute_import from setuptools import setup, find_packages from codecs import open with open('README.rst', encoding='utf-8') as f: long_description = f.read() setup( name='pypsa', version='0.19.1', author='PyPSA Developers, see https://pypsa.readthedocs.io/en/latest/develop...
1,487
512
from django.urls import path from . import views urlpatterns = [ path('', views.quiz_home, name='quiz-home'), path('page/<int:page_no>/', views.quiz_page, name='quiz-page' ), path('about/', views.quiz_about, name='quiz-about'), path('submit/', views.quiz_submit, name='quiz-submit'), ## after quiz...
556
206
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Jamf Config """ __author__ = "Sam Forester" __email__ = "sam.forester@utah.edu" __copyright__ = "Copyright (c) 2020 University of Utah, Marriott Library" __license__ = "MIT" __version__ = "1.0.4" import argparse import getpass import jamf import logging import plat...
3,500
1,085
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-03-12 17:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('menuCreate', '0001_initial'), ...
979
317
""" S3AIO Class Array access to a single S3 object """ from __future__ import absolute_import import SharedArray as sa import zstd from itertools import repeat, product import numpy as np from pathos.multiprocessing import ProcessingPool from six.moves import zip try: from StringIO import StringIO except Impor...
10,889
3,598
# -*- coding: utf-8 -*- """ Created on Fri Mar 21 15:11:31 2014 @author: ibackus """ __version__ = "$Revision: 1 $" # $Source$ import pynbody SimArray = pynbody.array.SimArray import numpy as np import gc import os import isaac import calc_velocity import ICgen_utils import ICglobal_settings global_settings = ICglo...
5,447
1,737
""" Diagonal Matrix with rank-1 updates. """ import itertools import torch from torch.functional import Tensor class DiagRankUpdate(object): """Diagonal Matrix with rank-1 updates""" def __init__(self, diag, rankUpdates): super(DiagRankUpdate, self).__init__() self.diag = diag self.ran...
8,243
2,706
import pickle from unittest import mock from nose2.tools.params import params import numpy as np import tensorflow as tf from garage.tf.envs import TfEnv from garage.tf.policies import GaussianMLPPolicyWithModel from tests.fixtures import TfGraphTestCase from tests.fixtures.envs.dummy import DummyBoxEnv from tests.fi...
4,074
1,412
# ####### # Copyright (c) 2018-2020 Cloudify Platform 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-2.0 # # Unless...
3,015
932
import unittest from selection.dbms.postgres_dbms import PostgresDatabaseConnector from selection.index import Index from selection.table_generator import TableGenerator from selection.workload import Column, Query, Table class TestDatabase(unittest.TestCase): @classmethod def setUpClass(cls): cls.db...
2,041
643
from sqlalchemy.orm.collections import InstrumentedList class BaseMixin: caller_stack = list() def extract_relations(self): return self.__mapper__.relationships.keys() def extract_columns(self): return self.__mapper__.columns.keys() def get_columns(self): result = dict() ...
2,012
569
# Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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...
1,274
360
from rest_framework import serializers from ... import models class DepartmentSerializers(serializers.ModelSerializer): """ Сериализатор кафедр """ class Meta: model = models.Department fields = ["short_name", "full_name"] class StudentSerializers(serializers.ModelSerializer): "...
918
261
from cinebot_mini import SERVERS import requests import numpy as np import json def base_url(): blender_dict = SERVERS["blender"] url = "http://{}:{}".format( blender_dict["host"], blender_dict["port"]) return url def handshake(): url = base_url() + "/api/ping" for i in range(5): ...
6,629
2,341
# -*- coding: utf-8 -*- # Copyright (c) 2018 The Regents of the University of California # 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 copy...
6,733
2,277
""" Module related to the argument parsing There is a fallback to the deprecated optparse if argparse is not found """ from pathlib import Path from argparse import ArgumentParser, SUPPRESS from poezio.version import __version__ def parse_args(CONFIG_PATH: Path): """ Parse the arguments from the command lin...
1,273
371
from celerybeatmongo.schedulers import MongoScheduler from mist.api.sharding.mixins import ShardManagerMixin from mist.api.poller.models import PollingSchedule from mist.api.poller.models import OwnerPollingSchedule from mist.api.poller.models import CloudPollingSchedule from mist.api.poller.models import MachinePoll...
1,125
353
from collections import Counter import json from pathlib import Path from PIL import Image import numpy as np import torch import torch.utils.data as data import torchvision.transforms as transforms from bootstrap.lib.logger import Logger from bootstrap.datasets import transforms as bootstrap_tf try:...
13,939
4,445
# https://www.hackerrank.com/challenges/one-week-preparation-kit-jesse-and-cookies/problem #!/bin/python3 import math import os import random import re import sys import heapq # # Complete the 'cookies' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # ...
921
354
from abc import ABCMeta, abstractmethod, abstractproperty import numpy __all__ = [ "BaseCapillarity", ] # See <https://stackoverflow.com/questions/35673474/using-abc-abcmeta-in-a-way-it-is-compatible-both-with-python-2-7-and-python-3-5> ABC = ABCMeta("ABC", (object,), {"__slots__": ()}) class BaseCapillarity(...
3,895
1,215
import bpy import glob from bpy.types import Panel, Operator from bpy.app.handlers import persistent import os import threading from queue import Queue from pathlib import Path from . mix_ops import * from . matgan_ops import * from . neural_ops import * cache_path = os.path.join(Path(__file__).parent.resolve(), '.ca...
23,988
7,219
""" Main entry point for running the demo. """ # Standard library import time import sys # Third party library import alsaaudio as aa # Local library from char import show_text from hs_logo import draw_logo from leds import ColumnedLEDStrip from music import calculate_levels, read_musicfile_in_chunks, calculate_col...
4,266
1,453
import re def part1(lines, yourbag="shiny gold"): # A nice little regex that will extract a list of all bags in a given line. # The first is the outermost bag, and the rest are inner bags. pattern = re.compile(r"(?:\d*)\s*(.*?)\s*bags?[.,]?(?: contain)?\s*") # We're going to use an adjacency list map...
2,924
886
""" Your chance to explore Loops and Turtles! Authors: David Mutchler, Dave Fisher, Vibha Alangar, Amanda Stouder, their colleagues and Alec Polster. """ import rosegraphics as rg ############################################################################### # DONE: 1. # On Line 5 above, replace PUT_YOUR_...
1,981
705
from backbone import entry_point if __name__ == '__main__': entry_point.main()
84
29
# encoding=utf-8 __author__ = 'lance' import tornado.web class BaseHandler(tornado.web.RequestHandler): pass
116
43
# Copyright (c) 2022 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 b...
2,958
1,220
#!/usr/bin/env python """\ make-leap-seconds.py - make leap second file for testing Optional args are date of leap second: YYYY-MM-DD and expiration date of file. Defaults are start of tomorrow (UTC), and 28 days after the leap. "Start of tomorow" is as soon as possible for testing. """ # SPDX-License-Identifier: BS...
1,948
892
# -*- encoding: utf-8 -*- from ddtrace.profiling import event from ddtrace.profiling import exporter from ddtrace.profiling import recorder from ddtrace.profiling import scheduler class _FailExporter(exporter.Exporter): @staticmethod def export(events): raise Exception("BOO!") def test_exporter_fail...
695
244
import scrapy,json,re,time,os,glob from scrapy.exceptions import CloseSpider from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutE...
5,546
1,706
from django.contrib import admin from notifications.models import Notification @admin.register(Notification) class NotificationAdmin(admin.ModelAdmin): list_display = ( 'sender', 'recipient', 'creation_time', 'verb', 'unread', ) list_filter = ( 'sender', ...
423
125
# -------------- # import the libraries import numpy as np import pandas as pd import seaborn as sns from sklearn.model_selection import train_test_split import warnings warnings.filterwarnings('ignore') # Code starts here df=pd.read_csv(path) print(df.head()) X=df.drop(columns='insuranceclaim') y=df['insuranceclaim']...
1,916
738
"""Convert a Caffe model file to TensorFlow checkpoint format. Assume that the network built is a equivalent (or a sub-) to the Caffe definition. """ import tensorflow as tf from nets import caffe_scope from nets import nets_factory slim = tf.contrib.slim # ==========================================================...
2,227
708
#!/usr/bin/env python import os import re from setuptools import find_packages, setup def get_version(*file_paths): filename = os.path.join(os.path.dirname(__file__), *file_paths) version_file = open(filename).read() version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) ...
1,211
388
import tensorflow as tf from detection.utils.misc import * class PyramidROIAlign(tf.keras.layers.Layer): def __init__(self, pool_shape, **kwargs): ''' Implements ROI Pooling on multiple levels of the feature pyramid. Attributes --- pool_shape: (height, width) of the o...
5,686
2,147
from ..router import Router from . import create_user, get_user router = Router() router.include(get_user.router) router.include(create_user.router)
150
48
from .base_constraint import BaseConstraint from .empty_constraint import EmptyConstraint class AnyConstraint(BaseConstraint): def allows(self, other): return True def allows_all(self, other): return True def allows_any(self, other): return True def difference(self, other): ...
712
198