text
string
size
int64
token_count
int64
# coding: utf-8 """ Accounting API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 Contact: api@xero.com Generated by: https://openapi-generator.tech """ import re # noqa: F401 from xero_python.models import BaseModel clas...
6,358
2,061
# Copyright FuseSoC contributors # Licensed under the 2-Clause BSD License, see LICENSE for details. # SPDX-License-Identifier: BSD-2-Clause import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="fusesoc", packages=["fuse...
1,568
549
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-28 09:09 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('planner', '0019_auto_20171028...
2,980
899
""" This code will read file given as parameter and list what mana symbols it contains. created Apr 2017 by CheapskateProjects --------------------------- The MIT License (MIT) Copyright (c) 2017 CheapskateProjects Permission is hereby granted, free of charge, to any person obtaining a copy of this software and as...
2,460
869
import pprint #Dictionary to hold impact, severe impact and output data data=dict() impactDict=dict() severeImpactDict=dict() estimate=dict() keylist=["currentlyInfected","infectionsByRequestedTime","severeCasesByRequestedTime","hospitalBedsByRequestedTime", "casesForICUByRequestedTime","casesForVentilatorsByReque...
2,922
1,166
from django.test import Client, TestCase from tests.base import BrowserTest from pretix.base.models import User class LoginFormBrowserTest(BrowserTest): def setUp(self): super().setUp() self.user = User.objects.create_user('dummy@dummy.dummy', 'dummy@dummy.dummy', 'dummy') def test_login(se...
3,739
1,189
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license"...
1,871
627
# 11/03/21 # What does this code do? # This code introduces a new idea, Dictionaries. The codes purpose is to take an input, and convert it into the numbers you'd need to press # on an alphanumeric keypad, as shown in the picture. # How do Dictionaries work? # To use our dictionary, we first need to initial...
1,451
536
# -*- coding: utf-8 -*- """ Created on Sun Mar 14 09:40:01 2021 @author: eliphat """ from ..type_var import TypeVar from ..type_repr import RecordType, BottomType from ..system import TypeSystem from .base_constraint import BaseConstraint from .equality_constraint import EqualityConstraint class MemberConstraint(Bas...
1,177
368
from __future__ import annotations from conflowgen.posthoc_analyses.inbound_and_outbound_vehicle_capacity_analysis import \ InboundAndOutboundVehicleCapacityAnalysis from conflowgen.reporting import AbstractReportWithMatplotlib class InboundAndOutboundVehicleCapacityAnalysisReport(AbstractReportWithMatplotlib): ...
3,592
1,050
"""Transformer from 'Attention is all you need' (Vaswani et al., 2017)""" # Reference: https://www.tensorflow.org/text/tutorials/transformer # Reference: https://keras.io/examples/nlp/text_classification_with_transformer/ import numpy as np import tensorflow as tf class Transformer(tf.keras.Model): def __init__(...
15,799
5,540
import inspect import pytest from django.db.models import TextField from django.urls import reverse from rest_framework.status import HTTP_200_OK, HTTP_204_NO_CONTENT from baserow.contrib.database.table.cache import ( generated_models_cache, ) from baserow.contrib.database.fields.dependencies.handler import Field...
43,464
14,302
from oil.utils.utils import export import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.animation as animation import numpy as np @export class Animation(object): def __init__(self, qt,body=None): """ [qt (T,n,d)""" self.qt = qt.data.numpy() T...
2,647
1,010
from functools import wraps from opentracing import global_tracer, tags, logs from contextlib import contextmanager def operation_name(query: str): # TODO: some statement should contain two words. For example CREATE TABLE. query = query.strip().split(' ')[0].strip(';').upper() return 'asyncpg ' + query ...
1,791
577
# # PySNMP MIB module Juniper-V35-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-V35-CONF # Produced by pysmi-0.3.4 at Wed May 1 14:04:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
3,281
1,295
"""Defines commonly used segment predicates for rule writers. For consistency, all the predicates in this module are implemented as functions returning functions. This avoids rule writers having to remember the distinction between normal functions and functions returning functions. This is not necessarily a complete ...
3,588
1,046
""" uncond_dcgan1 made with 64x64 images from https://s3.amazonaws.com/udipublic/acro.images.tgz for train.tar.gz """ import argparse parser = argparse.ArgumentParser(description='train uncoditional dcgan') parser.add_argument('--desc', default='uncond_dcgan', help='name to uniq...
28,152
11,122
# Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT import os import shutil from requre import RequreTestCase from requre.utils import get_datafile_filename class CheckBaseTestClass(RequreTestCase): def tearDown(self): super().tearDown() data_file_path = get_datafile_f...
686
224
from collections import OrderedDict from evidence import Evidence def get_name(item, entity='all'): from ._add_reference_to_evidence import _add_reference_to_evidence evidence = Evidence() fullName = item['uniprot']['entry']['protein']['recommendedName']['fullName'] if type(fullName)==str: ...
1,098
330
from ._flight_availabilities import FlightAvailabilities __all__ = ['FlightAvailabilities']
93
30
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
6,523
2,044
#!/usr/bin/env python3 from dataknead import Knead from facetool import config, media, util from facetool.constants import * from facetool.path import Path from facetool.profiler import Profiler from facetool.errors import ArgumentError from facetool.util import message, force_mkdir, sample_remove, is_json_path from r...
20,228
5,991
from django.contrib.auth import authenticate from django.contrib.auth.decorators import login_required from django.http import JsonResponse from django.shortcuts import render, redirect, get_object_or_404 from _datetime import datetime # from django.http import HttpResponse, HttpResponseNotAllowed from django.contrib...
26,538
8,231
"""Frame to show all service\'s register\'s. """ import tkinter.ttk from src.view import constants from src.view.services_page import ServicesPage class ServicesReadPage(ServicesPage): def __init__(self, parent, controller, *args, **kwargs): super(ServicesReadPage, self).__init__(parent, *args, **kwargs...
3,106
891
from torchvision.datasets import VisionDataset from datamodules.dsfunction import imread from torch.utils.data import Dataset, RandomSampler, Sampler, DataLoader, TensorDataset, random_split, ConcatDataset import os import glob from typing import List, Sequence, Tuple from itertools import cycle, islice import torch fr...
6,649
2,125
# -*- coding: utf8 -*- """ Common user interface operations. Author: Eduardo Ferreira License: MIT (see LICENSE for details) """ # Module import # -------------------------------------------------------------------------------------------------- from os import walk from os.path import isdir, isfile, join import argp...
5,251
1,353
from intentionally_blank.formatter import Formatter class NewlineAtEofFormatter(Formatter): """Ensure the last line of the file has a newline terminator. """ def format(self, lines): """ Args: lines: An iterable series of strings, each with a newline terminator. ...
585
165
""" Script for analyzing model's performance """ import argparse import sys import collections import yaml import tensorflow as tf import tqdm import numpy as np import net.data import net.ml import net.utilities def report_iou_results(categories_intersections_counts_map, categories_unions_counts_map): """ ...
5,049
1,465
# --- Day 12: Rain Risk --- # https://adventofcode.com/2020/day/12 import time simple = False verbose = 1 if simple: data = 'F10\nN3\nF7\nR90\nF11'.splitlines() else: file = open('12_input.txt', 'r') data = file.read().splitlines() class Ship(object): def __init__(self, d=0, x=0, y=0,...
5,095
1,727
from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User # Create your models here. class Chat(models.Model): content = models.TextField() sender = models.ForeignKey(User) receiver = models.ForeignKey(User) date_created = models.DateTimeField(aut...
335
96
from collections import OrderedDict from .abstract_model_helper import ModelHelper from tflite.Tensor import Tensor from tflite.Model import Model from tflite.TensorType import TensorType from typing import List class TFLiteModelHelper(ModelHelper): TFLITE_TENSOR_TYPE_TO_DTYPE = {} TFLITE_TENSOR_TYPE_TO_DTYPE[...
4,118
1,354
import numpy as np def mean_momentcoefficient(wing, airfoil_db): """calculate mean coefficient of moment for wing Parameters ---------- wing : Wing object describing wing airfoil_db : dict dictionary containing airfoil data """ try: c_m0s = [airfoil_db[sec.airf...
584
207
from typing import List, Tuple import sqlite3 import os import random import json from vqa_benchmarking_backend.datasets.dataset import DatasetModelAdapter, DiagnosticDataset, DataSample from vqa_benchmarking_backend.metrics.bias import eval_bias, inputs_for_image_bias_featurespace, inputs_for_image_bias_wordspace, in...
22,333
6,997
from django.urls import path from . import views app_name = "hospitals" urlpatterns = [ path("hospitalList", views.HospitalDetailedList.as_view(), name="hospital_list"), path("hospitalDetail", views.HospitalDetailedSingle.as_view(), name="hospital_read"), ]
268
88
def maior_numero(lista): a = lista[0] for i in range(len(lista)): if lista[i] > a: a = lista[i] return a def remove_divisores_do_maior(lista): maiornumero=maior_numero(lista) for i in range(len(lista)-1,-1,-1): if (maiornumero%lista[i])==0: lista.pop(i) re...
335
128
from .. import Globals import PyFileIO as pf import os import numpy as np def _ReadSPDF(sc='a'): ''' Reads the SPDF SSCWeb text files (scraped from their HTML output). Input: sc: Spacecraft 'a' or 'b' Returns: numpy.recarray ''' #set up dtype to load dtype = [('Year','int32'),('DOY','int32'),('ut','U...
1,613
734
from distutils.core import setup setup( name='python-dmenuwrap', author='Klaas Boesche', author_email='klaas-dev@boesche.me', url='https://github.com/KaGeBe/python-dmenuwrap', version='0.1.0', license='BSD 2-clause', py_modules=['dmenuwrap'] )
273
108
from django.conf.urls import url from . import views urlpatterns = [ url(r'^remove/(?P<obj_type>\S+)/(?P<obj_id>\S+)/$', views.remove_comment, name='crits-comments-views-remove_comment'), url(r'^(?P<method>\S+)/(?P<obj_type>\S+)/(?P<obj_id>\S+)/$', views.add_update_comment, name='crits-comments-views-add_upda...
967
371
""" DBA 1337_TECH, AUSTIN TEXAS © MAY 2020 Proof of Concept code, No liabilities or warranties expressed or implied. """ # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from datetime import datetime from .cryptoutils import CryptoTools from base64 import b64encode, b64dec...
19,511
6,522
# -*- coding: utf-8 -*- import mock import string import unittest import random from pprint import pprint from bitshares import BitShares from bitshares.account import Account from bitsharesbase.operationids import getOperationNameForId from bitshares.amount import Amount from bitsharesbase.account import PrivateKey fr...
9,946
3,493
from __future__ import unicode_literals from frappe import _ def get_data(): return [ { "label": _("WMS"), "icon": "octicon octicon-briefcase", "items": [ { "type": "doctype", "name": "WMS Lead", ...
2,068
575
# Copyright (c) 2020 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 applic...
7,424
2,198
# Author: Kaylani Bochie # github.com/kaylani2 # kaylani AT gta DOT ufrj DOT br ### K: Model: LSTM import sys import time import pandas as pd import os import math import numpy as np from numpy import mean, std from unit import remove_columns_with_one_value, remove_nan_columns, load_dataset from unit import display_ge...
16,828
5,491
from enum import unique, Enum from typing import Union @unique class DataType(Enum): STR = "str" SET = "set" class BaseDataStructure: __slots__ = {"data", "type", "expire_at"} def __init__(self, data: Union[str, set]): self.data = data # This will raise an error if type is not supp...
866
261
import datetime from pychpp import ht_model from pychpp import ht_xml from pychpp import ht_team, ht_match, ht_datetime class HTMatchesArchive(ht_model.HTModel): """ Hattrick matches archive """ _SOURCE_FILE = "matchesarchive" _SOURCE_FILE_VERSION = "1.4" # URL PATH with several params avai...
6,350
2,008
""" langcodes knows what languages are. It knows the standardized codes that refer to them, such as `en` for English, `es` for Spanish and `hi` for Hindi. Often, it knows what these languages are called *in* a language, and that language doesn't have to be English. See README.md for the main documentation, or read it ...
46,339
13,227
# -*- coding: utf-8 -*- # # Copyright 2017-2020 AVSystem <avsystem@avsystem.com> # # 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 ...
2,892
905
import torch from torch.utils.data import Dataset import os import pickle class GNNdataset(Dataset): # train and test def __init__(self, data_dir): super().__init__() self.data_dir = data_dir self.file_list = os.listdir(self.data_dir) def __len__(self): return len(self....
829
304
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from types import MethodType sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/detail') from Utils import Utils try: from AutoNapt import AutoNapt except Exception as ex: Utils.print_exception(ex) def expects_type(self, name, ...
701
240
import pytest from pynormalizenumexp.expression.base import NNumber, NotationType from pynormalizenumexp.utility.dict_loader import DictLoader from pynormalizenumexp.normalizer.number_normalizer import NumberNormalizer @pytest.fixture(scope="class") def number_normalizer(): return NumberNormalizer(DictLoader("ja...
16,355
6,710
from kivy.uix.widget import Widget class MyWidget(Widget): def __init__(self, **kwargs): super(MyWidget, self).__init__(**kwargs) def callback(*l): self.x = self.y self.fbind('y', callback) callback()
253
81
# sample\core.py def run_core(): print("In pycharm run_core")
69
29
import asyncio import base64 import os from telethon import functions, types from telethon.tl.functions.messages import ImportChatInviteRequest as Get from userbot import CMD_HELP from userbot.plugins import BOTLOG, BOTLOG_CHATID from userbot.utils import lightning_cmd, edit_or_reply, sudo_cmd @bot.on(lightning_cmd...
18,537
5,582
l = float(input('Digite a largura da parede em metros: ')) al = float(input('Digite a altura da parede em metros: ')) #Um litro de tinta pinta 2m², largura * altura da parede obtemos a área dela em m² e dividimos por dois para obter a quantidade de tinta necessária. lt = (l * al) / 2 print(f'Com uma parede {l}x{al}, ...
352
136
from random import choice from string import Template from . import BaseGenerator class Name(BaseGenerator): def __init__(self, company): self.company = company self.data = self._load_json('name.json') self.templates = self.data.pop('templates') self.noun...
1,840
529
""" Support a user-defined per-request session. """ from flask import g def register_session_factory(graph, key, session_factory): """ Register a session creation function so that a new session (of user-defined type) will be saved to `flask.g` on every request (and closed on teardown). In other word...
1,046
288
#! /usr/bin/env python2.7 import requests import json import heapq as hq #heap def check_order(order_id,order_info): for i in order_info: if i[1] == order_id: return True return False def check_if_dispatched(order_id): # URL = "https://spreadsheets.google.com/feeds/list/1ria...
5,188
2,107
#!/usr/bin/env python3 import os.path import subprocess import shutil def get_compiler_path(): compiler_path = os.path.abspath("../../debug-compiler-theory-samples/llvm_4") if not os.path.exists(compiler_path): raise ValueError('compiler llvm_4 not found') return compiler_path class Runner: d...
1,065
363
from dateutil.relativedelta import relativedelta from django.core.management.base import BaseCommand from django.utils import timezone from cropwatch.apps.ioTank.models import ioTank, SensorReading from cropwatch.apps.metrics.tasks import * class Command(BaseCommand): help = 'Performs uptime validation every 5' ...
1,282
352
#!/usr/bin/env python # -*- coding: utf-8 -*- """Asynchronous task support for discovery.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from datetime import datetime, timedelta from functools import partial impo...
12,946
3,584
from django.test import TestCase import sys import os lib_path = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'bibliotools3', 'scripts')) sys.path.append(lib_path) from parse_and_group import is_year_within_span from parse_and_group import create_span_files from parse_and_group import separate_years from ...
7,125
2,723
''' Module containing a preprocessor that keeps cells if they match given expression. ''' # Author: Juan M. Barrios <j.m.barrios@gmail.com> import re from typing import Pattern from traitlets import Unicode from nbconvert.preprocessors import Preprocessor class HomeworkPreproccessor(Preprocessor): '''Keeps cell...
968
270
raise NotImplementedError("Getting an NPE trying to parse this code") class KeyValue: def __init__(self, key, value): self.key = key self.value = value def __repr__(self): return f"{self.key}->{self.value}" class MinHeap: def __init__(self, start_size): self.heap = [None]...
2,455
850
#!/usr/bin/env python3 import socket import threading import logging logging.basicConfig(filename='meca.log', level=logging.DEBUG) PROGRAM_FILE = 'program_output.txt' # Dictionary of status indexes in robot status message statusDict = {'activated': 0, 'homed': 1, 'simulating': 2, '...
15,359
4,903
# -*- coding: utf-8 -*- # # Copyright 2020 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
1,750
633
import os import numpy as np import tensorflow as tf from PIL import Image def modcrop(im, modulo): if len(im.shape) == 3: size = np.array(im.shape) size = size - (size % modulo) im = im[0 : size[0], 0 : size[1], :] elif len(im.shape) == 2: size = np.array(im.shape) size = size - (size % modulo) im = im...
2,493
1,189
import sh from dotenv import load_dotenv import os load_dotenv() PASSWORD = os.environ.get("sudo_password") def c_registry(): with sh.contrib.sudo(password=PASSWORD, _with=True): sh.docker('run', '-d', '-p', '5000:5000', '--restart=always', '--name', 'registry', 'registry:2')
294
113
from django.conf.urls import url from api.guids import views app_name = 'osf' urlpatterns = [ url(r'^(?P<guids>\w+)/$', views.GuidDetail.as_view(), name=views.GuidDetail.view_name), ]
191
78
# Generated by Django 3.1.2 on 2020-10-29 04:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recipes', '0001_initial'), ('ingredients', '0001_initial'), ('drinks', '0001_initial'), ] operations = [ migrations.AddField...
500
174
import sys import json import os import platform import subprocess import contextlib import requests CHECKLIST_NAME = 'Commands' ICON_READY, ICON_IP, ICON_DONE, ICON_FAIL = '⚪', '⌛', '🔵', '🔴' _CREDS = None def CREDS(): global _CREDS if _CREDS is None: c = {} if os.path.exists(os.path.expan...
5,971
1,928
# -*- coding: utf-8 -*- import pygame, sys, os, json from pygame.locals import * IMAGE_PATH = os.path.join('assets', 'images') SPRITE_SHEET_PATH = os.path.join('assets', 'sprites') STAGE_CONF_PATH = os.path.join('assets', 'stages') ROOM_CONF_PATH = os.path.join('assets', 'rooms') DIALOGUE_CONF_PATH = os.path.join('as...
7,363
2,147
# Generated by Django 3.2 on 2021-04-28 12:31 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] opera...
1,307
385
# Copyright 2017 Battelle Energy Alliance, 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 agreed t...
6,268
1,626
""" This module provides functions to render placeholder content manually. The functions are available outside the regular templatetags, so it can be called outside the templates as well. Contents is cached in memcache whenever possible, only the remaining items are queried. The templatetags also use these functions ...
908
261
# -*- coding:utf-8 -*- """ @project = 0602-1 @file = simple_linear_regression @author = Liangjisheng @create_time = 2018/6/2 0002 下午 17:16 """ import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model # 加载用于回归模型的数据集 # 这个数据集中一共有442个样本,特征向量维度为10 # 特征向量每个变量为实数,变化范围(-.2 ,.2) # 目标输出为实数,变...
1,615
1,008
import tkinter as tk from abc import ABCMeta, abstractmethod from ...frames.templates import FrameTemplate from ...elements import AddButton, EditButton, DeleteButton class ListFrameTemplate(FrameTemplate, metaclass=ABCMeta): def __init__(self, top, *args, **kw): super().__init__(top, *args, **kw) ...
2,104
634
import matplotlib.pyplot as plt import numpy as np def main(): a = -1 b = 1 y, x = np.ogrid[-5:5:100j, -5:5:100j] plt.contour( x.ravel(), y.ravel(), pow(y, 2) - pow(x, 3) - x * a - b, [0] ) plt.plot(1, 1, 'ro') plt.grid() plt.show() if __name__ == '__ma...
337
156
"""Django command for rebuilding cohort statistics after import.""" import aldjemy from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist from django.core.management.base import BaseCommand, CommandError from django.db import transaction from django.conf import settings f...
2,312
622
n = int(input()) c = [0]*n for i in range(n): l = int(input()) S = input() for j in range(l): if (S[j]=='0'): continue for k in range(j,l): if (S[k]=='1'): c[i] = c[i]+1 for i in range(n): print(c[i])
273
112
#! /usr/bin/env python import unittest from unittest import mock from mock import patch from parameterized import parameterized, parameterized_class import sys import logging import numpy as np from Bio import AlignIO import os from os import path import CIAlign import CIAlign.cropSeq as cropSeq class CropSeqsTest...
3,294
1,334
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from .. import BaseModel, register_model from .knowledge_base import KGEModel @register_model("rotate") class RotatE(KGEModel): r""" Implementation of RotatE model from the paper `"RotatE: Knowledge Graph Embedding by...
1,871
622
from __future__ import unicode_literals from django_evolution.mutations import AddField from django.db import models MUTATIONS = [AddField("LocalSite", "public", models.BooleanField, initial=False)]
198
55
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os print("方法分类",os.listdir("/Users/zhangxinxin/Code/Algorithm-Swift/方法分类")) print("二分查找",os.listdir("/Users/zhangxinxin/Code/Algorithm-Swift/方法分类/二分查找")) print("双指针",os.listdir("/Users/zhangxinxin/Code/Algorithm-Swift/方法分类/双指针")) print("贪心算法",os.listdir("/Users/zh...
996
498
import os from os import mkdir from os.path import join from os.path import exists import json import importlib.resources import jinja2 from jinja2 import Environment from jinja2 import BaseLoader with importlib.resources.path('mititools', 'fd_schema.json.jinja') as file: jinja_environment = Environment(loader=Ba...
1,392
437
import rest_framework.urls from django.conf import settings from django.contrib import admin from django.urls import include, path, re_path from rest_framework import routers from rest_framework_swagger.views import get_swagger_view from leasing.views import ktj_proxy from leasing.viewsets.basis_of_rent import BasisOf...
2,216
710
import rebound import math from visual import * import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np k = 0.01720209895 how_long = 600 start_pos = vector(0, 0, 1.5) start_v = vector(0.7, 0.7, 0) sim = rebound.Simulation() #sun: sim.add(m = 1.) #asteroid: sim.add(m = 0, x = start...
1,860
1,108
# Copyright 2018 ARICENT HOLDINGS LUXEMBOURG SARL and Cable Television # Laboratories, 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 # #...
26,362
8,789
#!/usr/bin/python3 import numpy as np def meeting_planes(a1, b1, c1, a2, b2, c2, a3, b3, c3): return [] def main(): a1=1 b1=4 c1=5 a2=3 b2=2 c2=1 a3=2 b3=4 c3=1 x, y, z = meeting_planes(a1, b1, c1, a2, b2, c2, a3, b3, c3) print(f"Planes meet at x={x}, y={y} and z={z}"...
361
193
# -*- coding:utf-8 -*- from setuptools import setup setup( name = "datas_utils", packages = ["datas_utils", "datas_utils.env", "datas_utils.log", "datas_utils.aws", ], version = "0.0.1", description = "Tools for Datas Project", author ...
566
198
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from .T_S_I_V_ import table_T_S_I_V_ class table_T_S_I_B_(table_T_S_I_V_): pass
181
79
from pathlib import Path from typing import List from src.user_errors import NoItemToRenameError from src.user_types import Inode, InodesPaths def paths_to_inodes_paths(paths: List[Path]) -> InodesPaths: """ Given a list of paths, return a mapping from inodes to paths. Args: paths: list of Path ...
1,012
302
import re import gensim.utils as gensim_utils def normalize_text_proximity(message): """ Clean text of dots between words Keyword arguments: message -- a plain sentence or paragraph """ sent = message.lower() sent = sent.replace("á", "a") sent = sent.replace("é", "e") sent = sen...
9,655
3,505
# # PySNMP MIB module CHECKPOINT-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHECKPOINT-TRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:31:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
21,722
9,879
import socket def is_connected(): REMOTE_SERVER = "www.google.com" try: # see if we can resolve the host name -- tells us if there is # a DNS listening host = socket.gethostbyname(REMOTE_SERVER) # connect to the host -- tells us if the host is actually # reachable ...
452
137
# # # Copyright (c) 2013, Georgia Tech Research Corporation # 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 copyright # notice, ...
185,256
119,387
import extcolors import PIL def new_image(image, x1, y1, x2, y2): area = (x1, y1, x2, y2) tmp = image.crop(area) return tmp def nbColor_daltonisme(image, total): protanopie = [] # Ne voit pas le rouge deutéranopie = [] # Ne voit pas le vert tritanopie = [] # Ne voit pas le bleu color_...
2,401
916
import json import pymysql import datetime from dbutils.pooled_db import PooledDB import pymysql from conf.common import * class MysqlClient(object): __pool = None def __init__(self): """ :param mincached:连接池中空闲连接的初始数量 :param maxcached:连接池中空闲连接的最大数量 :param maxshared:共享连接的最大数...
3,822
1,202
from sklearn import model_selection from sklearn.externals.joblib import Parallel from tqdm import tqdm from script.sklearn_like_toolkit.warpper.base.MixIn import ClfWrapperMixIn, MetaBaseWrapperClfWithABC import multiprocessing CPU_COUNT = multiprocessing.cpu_count() # TODO using packtools.grid_search Grid...
2,065
638
from django import forms from sistema.mail import send_mail_template from .models import Cliente from usuario.models import Usuario from carteira.models import Carteira from eth_account import Account class MostrarCarteira(forms.ModelForm): name = forms.CharField(widget=forms.TextInput(attrs={'readonly':'True'}))...
3,331
1,254
# -*- coding: utf-8 -*- import os import random BOT_NAME = 'spider' SPIDER_MODULES = ['spiders'] NEWSPIDER_MODULE = 'spiders' ROBOTSTXT_OBEY = False cookies_file = os.path.join(os.path.split(os.path.realpath(__file__))[0], 'cookies.txt') with open(cookies_file, 'r', encoding='utf-8-sig', newline='') as f: cooki...
1,584
724