text
string
size
int64
token_count
int64
""" This is a Django_ integration of Select2_. The application includes Select2 driven Django Widgets and Form Fields. .. _Django: https://www.djangoproject.com/ .. _Select2: https://select2.org/ """ from django import get_version if get_version() < '3.2': default_app_config = "django_select2.apps.Select2AppCon...
325
106
# O(n ** 2) def bubble_sort(slist, asc=True): need_exchanges = False for iteration in range(len(slist))[:: -1]: for j in range(iteration): if asc: if slist[j] > slist[j + 1]: need_exchanges = True slist[j], slist[j + 1] = slist[j + 1], ...
673
265
"A Console-Based Email Client" #!/usr/local/bin/python """ ########################################################################## pymail - a simple console email interface client in Python; uses Python poplib module to view POP email messages, smtplib to send new mails, and the email package to extract mail header...
8,247
2,429
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017~2999 - cologler <skyoflw@gmail.com> # ---------- # # ---------- import typing import inspect from .errors import ParameterTypeResolveError class ParameterTypeResolver: ''' desgin for resolve type from parameter. ''' def __init__(self, name_...
1,027
290
import io import os from flask import Flask, request, jsonify from PIL import Image from resnet_model import MyResnetModel app = Flask(__name__) # max filesize 2mb app.config['MAX_CONTENT_LENGTH'] = 2 * 1024 * 1024 # setup resnet model model = MyResnetModel(os.path.dirname(os.path.abspath(__file__))) @app.route("/...
639
220
from django.urls import reverse from rest_framework import status from .base import BaseTestCase class FollowTestCase(BaseTestCase): """Testcases for following a user.""" def test_follow_user_post(self): """Test start following a user.""" url = reverse('follow', kwargs={'username': 'test2'}) ...
2,945
943
# -*- coding: utf-8 -*- """ =============================================================================== module __GenericPhase__: Base class for building Phase objects =============================================================================== """ from OpenPNM.Network import GenericNetwork import OpenPNM.Phases...
6,585
1,780
#!/usr/bin/env python3 import sys import copy from moveit_commander import move_group import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg from math import pi, sqrt, pow from std_msgs.msg import String import io import shutil import json #used to convert the points from the gui in a va...
2,860
837
# -*- coding: utf-8 -*- from django.contrib import admin from .models import Mail class MailAdmin(admin.ModelAdmin): list_display = ['subject', 'sent_time', 'recipients_total', 'successful_mails', 'failed_mails', 'done_sending'] ordering = ['-sent_time'] # Prevent creation def has_add_permission(s...
596
192
from uuid import uuid4 from fastapi.testclient import TestClient from ..main import app client = TestClient(app) class Test_Event: record = { "name": "Winter of CP", "description": "It is a coding event held in the month of Decemeber by Programming Club", "created_on": "2022-01-28T21:33...
2,922
1,043
class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str """ cycle = 2*(numRows-1) if numRows == 1: cycle = 1 map = [] for i in range(numRows): map.append('') for j ...
629
186
#!/usr/bin/python """ (C) Copyright 2019 Intel Corporation. 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...
24,837
7,142
"""This is the Solution for Year 2020 Day 06""" import re from aoc.abstracts.solver import Answers, StrLines class Solver: def __init__(self, data: str) -> None: self.data = data def _preprocess(self) -> StrLines: delim = "\n\n" return self.data.split(delim) def _solve_part_one...
1,066
353
from setuptools import find_packages, setup setup( name="typer", packages=find_packages(), )
98
31
import numpy as np from numba import jit, prange from scipy.stats import mode from sklearn.metrics import accuracy_score __all__ = ['dtw_distance', 'KnnDTW'] @jit(nopython=True, fastmath=True) def cosine_distance(u:np.ndarray, v:np.ndarray): assert(u.shape[0] == v.shape[0]) uv = 0 uu = 0 vv = 0 ...
7,105
2,306
from setuptools import setup setup( name='uam_simulator', version='1.0', description='A tool to simulate different architectures for UAM traffic management', author='Coline Ramee', author_email='coline.ramee@gatech.edu', packages=['uam_simulator'], install_requires=['numpy', 'scikit-learn',...
470
149
class Solution: def maxLength(self, arr) -> int: def helper(word): temp=[] temp[:0]=word res=set() for w in temp: if w not in res: res.add(w) else: return None return res ...
1,115
391
# Generated by Django 3.0.6 on 2020-05-25 22:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('addresses', '0001_initial'), ] operations = [ migrations.AddField( model_name='address', name='picture', ...
419
139
from collections import namedtuple from datetime import timedelta import itertools from operator import attrgetter from pando.utils import utcnow from psycopg2.extras import execute_batch from ..constants import SEPA from ..exceptions import ( AccountSuspended, MissingPaymentAccount, RecipientAccountSuspended, ...
34,809
10,077
# -*- coding:utf-8 -*- from vendor.errors.feature import FeatureProcessError """ 此目录下所有功能函数均为: 按一定条件检查传入参数合法性 **若不合法, 将抛出异常** """ def f_assert_not_null(seq): """检测值是否非空或值得列表是否存在非空元素""" if seq in (None, '', [], {}, ()): raise FeatureProcessError("value: %s f_assert_not_null Error...
4,967
1,877
import time from os import system, walk from config import CONFIG from encry import ENCRY from decry import DECRY # Функция настройки конфигурации def conf_setting(): system('CLS') print("Enter key elements: ") # Выбор алфавита alphabet = input("Select the used alphabet [EN]GLISH | [RU]SSIAN: ") #...
4,993
1,361
# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies and contributors # License: MIT. See LICENSE import frappe from frappe.model.document import Document class EmailQueueRecipient(Document): DOCTYPE = "Email Queue Recipient" def is_mail_to_be_sent(self): return self.status == "Not Sent" def is_m...
504
194
# -*- coding: utf-8 -*- # pylint: disable=unused-argument,pointless-statement """Tests for the `PseudoDojoFamily` class.""" import pytest from aiida_pseudo.data.pseudo import UpfData, Psp8Data, PsmlData, JthXmlData from aiida_pseudo.groups.family import PseudoDojoConfiguration, PseudoDojoFamily def test_type_string(...
3,211
1,054
import sys import os if sys.version_info[0] != 3 : print("Running in python "+sys.version_info[0]+", should be python 3.") print("Please install python 3.7 from the official site python.org") print("Exiting now.") exit() import shutil import argparse import fbx2tree import builder_fromfbx import time # config is...
1,743
564
import sys import json import plotly from flask import Flask from flask import render_template, request from plotly.graph_objects import Heatmap, Bar from sklearn.externals import joblib from sqlalchemy import create_engine sys.path.append("common") from common.nlp_common_utils import * if len(sys.argv) == 1: s...
4,256
1,308
import re import sys from nltk.tokenize import word_tokenize from unidecode import unidecode from nltk.tokenize import sent_tokenize import argparse parser = argparse.ArgumentParser() parser.add_argument('fin') parser.add_argument('fout') args = parser.parse_args() textproc = TextProc() tokenizer = Tokenizer() sente...
840
305
""" Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um numero entre 0 e 10. Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer """ """ from random import randint tentativas = 1 computador = randint(0, 10) jogador = int(input('Infor...
1,071
386
# coding: utf-8 import re import utility from commands import Command def google_pages(string): url = 'http://www.google.se/search?q=' + utility.escape(string) + '&ie=UTF-8&oe=UTF-8' response = utility.read_url(url) data = response["data"] search = re.search('swrnum=(\d+)">', data) if search: result = searc...
1,550
705
import os min=512 max=512 def app_server_tuning(server_confid): server_name=AdminConfig.showAttribute(server_confid, "name") threadpool_list=AdminConfig.list('ThreadPool',server_confid).split("\n") for tp in threadpool_list: if tp.count('WebContainer')==1: print "Modify Server '%s' Web...
457
159
"""This module contains objects for saleorders endpoints""" from flask import Flask, jsonify, request, abort, make_response from flask_restful import Resource from flask_jwt_extended import get_jwt_identity, jwt_required from . import common_functions from ..models import products, saleorders from ..utils import veri...
6,770
1,808
default_app_config = "nautobot.circuits.apps.CircuitsConfig"
61
23
import copy import numpy as np from scipy.special import wofz from scipy.integrate import quad from typing import List, Tuple import autoarray as aa from autogalaxy.profiles.mass_profiles import MassProfile from autogalaxy.profiles.mass_profiles.mass_profiles import ( MassProfileMGE, MassProfileCSE...
54,559
17,436
from core.terraform.resources import BaseTerraformVariable class TerraformVariable(BaseTerraformVariable): """ Base resource class for Terraform tfvar variable Attributes: variable_dict_input (dict/none): Var dict values available_args (dict): Instance configurations variable_type...
627
167
class Node(object): def __init__(self, name): self.name = name; self.adjacencyList = []; self.visited = False; self.predecessor = None; class BreadthFirstSearch(object): def bfs(self, startNode): queue = []; queue.append(startNode); startNode.visited = True; # BFS -> queue ...
887
377
"""Connection object for Network Manager.""" from ipaddress import ip_address, ip_interface from typing import Optional from ...const import ATTR_ADDRESS, ATTR_PREFIX from ...utils.gdbus import DBus from ..const import ( DBUS_ATTR_ADDRESS_DATA, DBUS_ATTR_CONNECTION, DBUS_ATTR_GATEWAY, DBUS_ATTR_ID, ...
3,932
1,263
from __future__ import print_function, absolute_import from .beats import Beat from StringIO import StringIO import sys import os import json import urllib import webbrowser try: import pycurl except: print("Need pycurl dependency to use qubole as the deployment platform. Run pip install pycurl in your virtuale...
4,969
1,549
# Copyright 2020 Alexis Lopez Zubieta # # 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, ...
9,658
2,930
# -*- coding: utf-8 *-* import logging from unittest import TestCase from nicepy import assert_equal_struct, multi_assert_equal_struct, pretty_repr, permuteflat log = logging.getLogger(__name__) class Foo(object): def __init__(self, **kwargs): for k, v in kwargs.iteritems(): self[k] = v ...
11,453
3,379
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-03-20 16:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('awards', '0073_auto_20170320_1455'), ] operations = [ migrations.AlterField...
4,322
1,255
from django.apps import AppConfig class PasssystemConfig(AppConfig): name = 'passsystem'
100
33
from base_interval import BaseInterval class OnceInterval(BaseInterval): @staticmethod def next_interval(start_date): return start_date @staticmethod def approximate_period(): return 0
220
59
# # Copyright (c) Microsoft and contributors. 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 requi...
118,437
30,149
#!/usr/bin/env python2 # Copyright 2015 Dejan D. M. Milosavljevic # # 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 r...
1,832
634
import os policy_model_dir = os.environ.get("POLICY_MODEL_DIR", "models/dialogue/") rasa_nlu_config = os.environ.get("RASA_NLU_CONFIG", "nlu_config.yml") account_sid = os.environ.get("ACCOUNT_SID", "") auth_token = os.environ.get("AUTH_TOKEN", "") twilio_number = os.environ.get("TWILIO_NUMBER", "") platform_api =...
1,127
487
# -*- coding:utf-8 -*- from moderation_sdk.gettoken import get_token from moderation_sdk.moderation_text import moderation_text from moderation_sdk.utils import init_global_env if __name__ == '__main__': # Services currently support North China-Beijing(cn-north-4),China East-Shanghai1(cn-east-3), CN-Hong Kong(ap-s...
876
337
from .base import BaseActionTestCase class GeneralActionWSGITester(BaseActionTestCase): """ Tests the action WSGI application in general. """ def test_request_wrong_method(self) -> None: response = self.client.get("/") self.assert_status_code(response, 405) def test_request_wrong...
2,195
696
from .common import * HEADER = r'''\usepackage{tikz} \definecolor{purple}{cmyk}{0.55,1,0,0.15} \definecolor{darkblue}{cmyk}{1,0.58,0,0.21} \usepackage[colorlinks, linkcolor=black, urlcolor=darkblue, citecolor=purple]{hyperref} \urlstyle{same} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{L...
2,897
933
# -*- coding: utf-8 -*- """ Created on Thu Apr 15 11:31:06 2021 @author: a77510jm """
88
57
#!/usr/bin/env python # coding: utf-8 # <a id='top'></a> # # # # $\texttt{GiRaFFEfood}$: Initial data for $\texttt{GiRaFFE}$ # # ## Aligned Rotator # # $$\label{top}$$ # # This module provides another initial data option for $\texttt{GiRaFFE}$. This is a flat-spacetime test with initial data $$A_{\phi} = \frac{\mu \va...
6,133
2,205
""" 比requests更强大python库,让你的爬虫效率提高一倍 https://mp.weixin.qq.com/s/jqGx-4t4ytDDnXxDkzbPqw HTTPX 基础教程 https://zhuanlan.zhihu.com/p/103824900 """ def interface(url, data): import httpx head = {"Content-Type": "application/json; charset=UTF-8"} return httpx.request('POST', url, json=data, headers=head) if __...
803
380
#!/usr/bin/env python # -*- coding: utf-8 -*- """ THOR detects differential peaks in multiple ChIP-seq profiles associated with two distinct biological conditions. Copyright (C) 2014-2016 Manuel Allhoff (allhoff@aices.rwth-aachen.de) This program is free software: you can redistribute it and/or modify it under the te...
9,034
2,829
from http import HTTPStatus from typing import Tuple from uuid import UUID from fastapi import status, APIRouter, Response, Depends, HTTPException from command.command_handler import Status from domain.classroom.classroom_creation_command_handler import ClassroomCreated from domain.classroom.classroom_type import Cla...
5,864
1,463
############################################################### # # This function is... INSUFFICIENT. It was developed as an # illustration of EDA lessons in the 2021 class. It's quick and # works well. # # Want a higher grade version of me? Then try pandas-profiling: # https://github.com/pandas-profiling/pandas-...
2,145
645
import logging l = logging.getLogger("angr.codenode") class CodeNode(object): __slots__ = ['addr', 'size', '_graph', 'thumb'] def __init__(self, addr, size, graph=None, thumb=False): self.addr = addr self.size = size self.thumb = thumb self._graph = graph def __len__(sel...
2,778
885
import os scrapy_project_path = '/Users/kingname/book/chapter_12/DeploySpider' os.chdir(scrapy_project_path) #切换工作区,进入爬虫工程根目录执行命令 os.system('scrapyd-deploy') import json import time import requests start_url = 'http://45.76.110.210:6800/schedule.json' start_data = {'project': 'DeploySpider', 'spider':...
806
357
""" Simple math operating functions for unit test """ def add(a, b): """ Adding to parameters and return result :param a: :param b: :return: """ return a + b def minus(a, b): """ subtraction :param a: :param b: :return: """ return a - b def multi(a, b): ...
511
189
from __future__ import print_function, division, absolute_import import itertools import sys # unittest only added in 3.4 self.subTest() if sys.version_info[0] < 3 or sys.version_info[1] < 4: import unittest2 as unittest else: import unittest # unittest.mock is not available in 2.7 (though unittest2 might cont...
144,055
49,240
""" jsnek_saved_games_dataset that returns flat (vectorized) data """ from .jsnek_base_dataset import JSnekBaseDataset from .. import utils class JSnekDataset(JSnekBaseDataset): """Represents a board state in the following way: board_state: `torch.Tensor` Board state in torch.Tensor format. Board st...
1,731
520
# Generated by Django 3.2.7 on 2021-09-15 15:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('posts', '0006_auto_20210914_0910'), ] operations = [ migrations.AddField( model_name='recipe', name='preface', ...
391
144
import os import databases import sqlalchemy DB_CONNECTOR = os.getenv('APP_DB_CONNECTOR') DB_USERNAME = os.getenv('APP_DB_USERNAME') DB_PASSWORD = os.getenv('APP_DB_PASSWORD') DB_HOST = os.getenv('APP_DB_HOST') DB_PORT = os.getenv('APP_DB_PORT') DB_DATABASE = os.getenv('APP_DB_DATABASE') DB_URL = f'{DB_CONNECTOR}://...
490
203
import os import time import argparse import torchvision import torch import torch.nn as nn from util import AverageMeter, TwoAugUnsupervisedDataset from encoder import SmallAlexNet from align_uniform import align_loss, uniform_loss import json def parse_option(): parser = argparse.ArgumentParser('STL-10 Repres...
7,631
2,854
from flask import Flask """ 1. Creating a flask application instance, the name argument is passed to flask application constructor. It's used to determine the root path""" app = Flask(__name__) app.config.from_object('config') from app import views, models
259
70
# SPDX-License-Identifier: Apache-2.0 # Copyright(c) 2021 Open Networking Foundation import time from ipaddress import IPv4Address from pprint import pprint from trex_test import TrexTest from grpc_test import * from trex_stl_lib.api import ( STLVM, STLPktBuilder, STLStream, STLTXCont, ) import ptf.t...
5,305
1,898
from rest_framework import serializers from archives_app.documents_models import (FrequencyRelation, BoxArchiving, AdministrativeProcess, OriginBox, FrequencySheet, DocumentTypes) class FrequencySupport(serializers.ModelSerializer):...
6,209
1,678
# -*- coding: utf-8 -*- ############################################################################## # Copyright (c) 2017 Science and Technology Facilities Council # # All rights reserved. # # Modifications made as part of the fparser project are distributed # under the following license: # # Redistribution and use i...
7,132
2,183
from elsa import cli from pyvecorg import app cli(app, base_url='http://pyvec.org')
87
33
import curtsies.events as ev import sys DELIMITERS = ' .' WHITESPACE = ' ' def print_console(txt, npadding=0, newline=False, flush=True): """ Prints txt without newline, cursor positioned at the end. :param txt: The text to print :param length: The txt will be padded with spaces to fit this length ...
10,397
2,976
from django.core.exceptions import ValidationError from django.utils import timezone from django.test import TestCase from events.models import Event, Invitee from users.tests.factories import UserFactory from users.models import get_sentinel_user class EventModelTestCase(TestCase): def setUp(self): self....
1,601
511
cryptolist = ['ETH','BTC','XRP','EOS','ADA','NEO','STEEM', 'BTS','ZEC','XMR','XVG','XEM','OMG','MIOTA','XTZ','SC', 'CVC','BAT','XLM','ZRX','VEN']
145
76
# Copyright (c) 2017 Sony 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
2,615
873
# 给出 n 个数对。 在每一个数对中,第一个数字总是比第二个数字小。 # # 现在,我们定义一种跟随关系,当且仅当 b < c 时,数对(c, d) 才可以跟在 (a, b) 后面。我们用这种形式来构造一个数对链。 # # 给定一个对数集合,找出能够形成的最长数对链的长度。你不需要用到所有的数对,你可以以任何顺序选择其中的一些数对来构造。 # # 示例 : # # 输入: [[1,2], [2,3], [3,4]] # 输出: 2 # 解释: 最长的数对链是 [1,2] -> [3,4] # 注意: # # 给出数对的个数在 [1, 1000] 范围内。 # # 来源:力扣(LeetCode) # 链接:https://leetc...
819
544
from FactorTest.FactorTestPara import * from FactorTest.FactorTestBox import * class FactorTest(): def __init__(self): self.startdate=20000101 self.enddate=21000101 self.factorlist=[] self.FactorDataBase={'v':pd.DataFrame(columns=['time','code'])} self.filterStock...
19,044
6,927
from __future__ import division from qm.qm_calculator import QM_calculator from misc import call_name import os class TeraChem(QM_calculator): """ Class for common parts of TeraChem :param string basis_set: Basis set information :param string functional: Exchange-correlation functional information...
3,094
956
# -*- coding: utf-8 -*- ''' :synopsis: Unit Tests for Windows Registry Module 'module.reg' :platform: Windows :maturity: develop :codeauthor: Damon Atkins <https://github.com/damon-atkins> versionadded:: 2016.11.0 ''' # Import Python future libs from __future__ import absolute_import from __future__...
11,668
3,578
import traceback import re import sys import logging """ ********** Note by wvmarle: This file contains the complete code from chained_exception.py plus the error handling code from GlacierWrapper.py, allowing it to be used in other modules like glaciercorecalls as well. ********** """ class GlacierException(Except...
9,197
2,398
# Copyright 2022 @ReneFreingruber # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
29,912
8,846
#!/usr/bin/env python """ Simple occupancy-grid-based mapping without localization. Subscribed topics: /scan Published topics: /map /map_metadata Author: Nathan Sprague Version: 2/13/14 """ import rospy from nav_msgs.msg import OccupancyGrid, MapMetaData from geometry_msgs.msg import Pose, Point, Quaternion from ...
5,590
1,589
""" flags.py . should be renamed helpers... . This file is scheduled for deletion """ """ valid accessory tags: "any_tag": {"code": "code_insert_as_string"} # execute arbitrary code to construct this key. "dialect": csv.excel_tab # dialect of the file, default = csv, set this to use tsv. or sniffer "skip_lines": num...
469
148
import os import tornado.ioloop import tornado.web from jet_bridge.handlers.temporary_redirect import TemporaryRedirectHandler from jet_bridge_base import settings as base_settings from jet_bridge_base.views.api import ApiView from jet_bridge_base.views.image_resize import ImageResizeView from jet_bridge_base.views.f...
2,106
657
import requests from ...shared.exceptions import MediaServiceException from ...shared.interfaces.logging import LoggingModule from .interface import MediaService class MediaServiceAdapter(MediaService): """ Adapter to connect to media service. """ def __init__(self, media_url: str, logging: LoggingM...
1,553
451
import async from async.services import EchoUpperData server = async.server('10.211.55.3', 20007) async.register(transport=server, protocol=EchoUpperData) async.run()
169
63
from ..alert_code import AlertCode class EVMNodeAlertCode(AlertCode): NoChangeInBlockHeight = 'evm_node_alert_1' BlockHeightUpdatedAlert = 'evm_node_alert_2' BlockHeightDifferenceIncreasedAboveThresholdAlert = 'evm_node_alert_3' BlockHeightDifferenceDecreasedBelowThresholdAlert = 'evm_node_alert_4' ...
533
196
from blaze import compute, resource, symbol, discover from blaze.utils import example flag = [False] def mymap(func, *args): flag[0] = True return map(func, *args) def test_map_called_on_resource_star(): r = resource(example('accounts_*.csv')) s = symbol('s', discover(r)) flag[0] = False a ...
422
151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ mwtab.mwschema ~~~~~~~~~~~~~~ This module provides schema definitions for different sections of the ``mwTab`` Metabolomics Workbench format. """ import sys from schema import Schema, Optional, Or if sys.version_info.major == 2: str = unicode metabolomics_wor...
15,186
5,642
import datetime import xml.dom.minidom import logging from PyQt5 import QtCore, QtWidgets from functions.button_functions import add_read NAMESPACE_URI = 'http://www.eufar.net/ASMM' def create_asmm_xml(self, out_file_name): logging.debug('asmm_xml.py - create_asmm_xml - out_file_name ' + out_file_name) doc =...
27,544
8,331
from django.db import models # Create your models here. class Hiren(models.Model): access_token = models.CharField(max_length=200) authorized = models.BooleanField(default=False)
191
60
#!/usr/bin/python # # Copyright (C) 2004 British Broadcasting Corporation and Kamaelia Contributors(1) # All Rights Reserved. # # You may only modify and redistribute this under the terms of any of the # following licenses(2): Mozilla Public License, V1.1, GNU General # Public License, V2.0, GNU Lesser Gener...
4,973
1,602
""" flux related class and functions """ from scipy.integrate import quad import pandas as pd from .helper import LinearInterp, polar_to_cartesian, lorentz_boost, lorentz_matrix from .oscillation import survival_solar from .parameters import * def _invs(ev): return 1/ev**2 class FluxBaseContinuous: def ...
63,005
23,535
# Author : Pavel Vitis "blackdaemon" # Email : blackdaemon@seznam.cz # # Copyright (c) 2010, Pavel Vitis <blackdaemon@seznam.cz> # 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. Redistri...
7,252
2,157
import unittest from unittest.mock import Mock import json from processor import scrape_article import main class ArticleCurationTestCase(unittest.TestCase): def test_article_fetch(self): response = scrape_article( url='https://www.cnn.com/2019/03/25/us/yale-rescinds-student-admissions-scand...
3,597
1,258
import unittest class PerlinTestCase(unittest.TestCase): def test_perlin_1d_range(self): from noise import pnoise1 for i in range(-10000, 10000): x = i * 0.49 n = pnoise1(x) self.assertTrue(-1.0 <= n <= 1.0, (x, n)) def test_perlin_1d_octaves_range(self): ...
4,715
1,981
# -*- coding: utf-8 -*- import platiagro import pandas as pd from werkzeug.exceptions import NotFound from pipelines.database import db_session from pipelines.models import Operator from pipelines.models.utils import raise_if_experiment_does_not_exist def get_dataset_name(experiment_id, operator_id,): """Retrie...
3,829
1,030
import pytest from flask_mailing.schemas import Message, MultipartSubtypeEnum from flask_mailing.msg import MailMsg import os CONTENT = "file test content" def test_initialize(): message = Message( subject="test subject", recipients=["uzezio22@gmail.com"], body="test", subtype="pl...
4,545
1,458
import discord def check(ctx): def inner(m): return m.author == ctx.author return inner def Membercheck(ctx): def inner(m): return m.author == ctx.guild.me return inner def warn_permission(ctx, Member): if isinstance(ctx.channel, discord.TextChannel): return ctx.author.guild_permissions.ma...
1,239
409
"""Rigbits eye rigger tool""" import json import traceback from functools import partial import mgear.core.pyqt as gqt import pymel.core as pm from maya.app.general.mayaMixin import MayaQWidgetDockableMixin from mgear.core import meshNavigation, curve, applyop, node, primitive, icon from mgear.core import transform, ...
46,670
14,092
#!/usr/bin/env python3 import os import shutil import sys import pathlib import logging # I will NEVER EVER use subproccess again # At least not for something like Popen try: from sh import wget except Exception: print('[!] Just install sh right now!(pip install --user sh)') sys.exit(0) # Dumb Python2 sup...
3,260
1,086
import ase from ase import Atoms from ase.atom import Atom import sys from ase.visualize import view import pickle f = open(sys.argv[1],'r') #The .amc file p = pickle.load(f) positions = p['atomspositions'] atms = Atoms() for p0 in positions: a = Atom('Au',position=p0) atms.append(a) atms.center(vacuum=2) view(atm...
323
137
# это dev среда TELEGRAM_TOKEN = "..." RELATIVE_CHAT_IDS = [ "...", '...'] TEXT = { "bot_info": ('Привет, я бот, который отвечает за равномерное распределение участников по комнатам.\n\n' 'Нажми кнопку, если готов сменить комнату'), "get_link": "Получить рекомендацию", "new_room": "Ваша н...
453
184
######################################################################## # test/xslt/sm20000304.py # Example from Steve Muench <smuench@us.oracle.com> # to Jon Smirl <jonsmirl@mediaone.net> # on 4 March 2000 """ From: "Steve Muench" <smuench@us.oracle.com> To: <xsl-list@mulberrytech.com> Subject: Re: SVG charts and gr...
8,270
3,210
import json def Config(config_path): with open(config_path) as config_file: return json.load(config_file)
123
39