text
string
size
int64
token_count
int64
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def __str__(self, depth=0): ret = '' if self.right != None: ret += self.right.__str__(depth + 1) if not self.val: ret += '\n' else: ...
1,138
396
import hypothesis.strategies as st from hypothesis.extra.numpy import arrays from hypothesis import given import unittest import numpy as np from sklearn.base import BaseEstimator import inspect import src.quality_measures as qm from .logging import logger # old functions to test against while refactoring def old_ce...
17,936
6,065
import logging _logger = logging.getLogger(__name__) from odoo import api, fields, models class TrendSearchMapping(models.Model): _name = 'trend.search.mapping' _order = "sequence" name = fields.Char(string="Keywords", required=True, help="Name of product") trend_search_mapping_id = fields.Many2one('e...
797
257
# ================================================================================================== # Copyright 2011 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
25,363
7,403
import base64 import os import matplotlib.pyplot as plt import cv2 import numpy as np from PyQt5 import uic from PyQt5 import QtWidgets from PyQt5 import QtMultimedia from PyQt5 import QtMultimediaWidgets from PyQt5.QtGui import QImage, QPixmap from PyQt5.QtWidgets import QDesktopWidget from nas.gui.login_stimulation_w...
3,838
1,274
import matplotlib.pyplot as plt # Diagramm und Achsen definieren fig, ax = plt.subplots() # Werte für Tabelle erstellen table_data=[ ["1", 30, 34], ["2", 20, 223], ["3", 33, 2354], ["4", 25, 234], ["5", 12, 929] ] #Tabelle erstellen table = ax.table(cellText=table_data, loc='center', colLabels=[...
445
209
''' Copyright (c) 2016, 2017, 2019 Timothy Savannah All Rights Reserved. Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE ''' import ...
5,242
1,346
from django.contrib import admin from .models import Image,Areas,Category # Register your models here. admin.site.register(Image) admin.site.register(Areas) admin.site.register(Category)
190
57
# -*- coding: utf-8 -*- from unittest import TestCase from mock import Mock, patch from lamvery.cli import ( main, init, build, configure, deploy, encrypt, encrypt_file, events, decrypt, set_alias, invoke, rollback, api, generate ) class FunctionsTestCase(TestC...
1,985
612
import sqlite3 from util import post_listing_to_slack from slackclient import SlackClient import settings sc = SlackClient(settings.SLACK_TOKEN) con = sqlite3.connect('listings.db') # with con: # con.row_factory = sqlite3.Row # cur = con.cursor() # # print("SQLite version: %s" % data) # cur.execute("...
569
199
############################################################################# # # 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 # # ...
15,630
5,084
from utils import PATH_LABEL from utils import PATH_DATA_FOLDER import pickle import torch import torch.nn as nn import torch.utils.data as dat class ResBlock(nn.Module): def __init__(self, inChannels, outChannels): super(ResBlock, self).__init__() self.matchDimension = None if inChannels != outChannels: ...
1,883
865
__all__ = [ 'AppProject', 'App', 'AppItem', 'AppItemsCreateRequest', 'AppBatch', 'AppBatchCreateRequest' ] import datetime import decimal from enum import unique from typing import Dict, Any, List from ..primitives.base import BaseTolokaObject from ..project.field_spec import FieldSpec from ......
6,623
1,882
# Utility functions for Strings (i.e. storing common strings once) #define common strings ERR_MISSING_KEY = "The field(s) {0} must be filled in this form." ERR_INVALID_KEY = "The field '{0}' contains an invalid value." ERR_UNAUTHORIZED = "The logged in user does not have access to this value: {0}" MSG_FINISHED_TRAININ...
760
249
#!/usr/bin/env python import sys import math maxprime = 12 twomult = 2**2 #==================== def prime_factors(n): """ Return the prime factors of the given number. """ # < 1 is a special case if n <= 1: return [1] factors = [] lastresult = n while True: if lastresult == 1: break c = 2 while True...
2,184
932
# MIT License # Copyright (c) 2016 Aashiq Ahmed, Shuai Chen, Meha Deora, Douglas Hu # 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 rig...
2,027
838
#!/usr/bin/env python # coding: utf-8 # In[2]: pip install instaloader # In[4]: import instaloader # In[6]: ig = instaloader.Instaloader() dp = input("Enter Insta Username:") ig.download_profile(dp, profile_pic_only = True) # In[ ]:
251
109
import json import urllib.request from bottoman import TwitchBot import config from db.db import DatabaseManager def get_user_id_display(user): """ uses twitch's API to get a user's token with their (case insensitive) user name """ client_id = config.client_id token = "srtajsl3jjbhhtfrv...
2,180
649
from minigame.waveshare.button import Button from minigame.waveshare.display import Display from minigame.games.snake import Snake WIDTH = 20 HEIGHT = 20 STEP_TIME = 0.5 BLOCK_SIZE = 32 def main(): display = Display() l_button = Button(5) r_button = Button(26) u_button = Button(6) d_button = Butt...
478
194
from api.api_v1 import api_urls from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ) ''' RANDOM URLs ''' urlpatterns += patterns('etc.views', url(r'^about/?$', 'about', name = 'about'), url(r'^help/?$', 'h...
8,636
3,220
# The MIT License # # Copyright (c) 2020 Vincent Liu # # 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, mer...
2,830
998
import time from locust import HttpUser, task, between # https://docs.locust.io/en/stable/quickstart.html class QuickstartUser(HttpUser): wait_time = between(5, 10) @task def index_page(self): self.client.get("/index.php", verify=False) self.client.get("/contact", verify=False) se...
721
242
def aep_pep_test(**kwargs): """ Calculates two different things: 1.) The x and y coordinates of the AEP and PEP, relative to the coxa of a respective leg 2.) The swing phases and the stance phases, identifying on a frame by frame basis Return: results data frame with 30 key value pairs: x6 all...
25,015
7,678
# -------------------------------------------- # Test the Approximate Knapsack function test # -------------------------------------------- # Pull in the knapsack library. import random from pyspark.sql import SparkSession from knapsack import knapsack # Create the SparkContext. sc = SparkSession \ .builder \ ...
1,601
532
from django.shortcuts import render,get_object_or_404 from .models import BlogArticles # Create your views here. def blog_title(request): blogs=BlogArticles.objects.all() return render(request,"blog/titles.html",{"blogs":blogs}) def article(request,a_id): blog=get_object_or_404(BlogArticles,id=a_id) publish_time=...
413
145
import pygluu.kubernetes.postgres as module0 from pygluu.kubernetes.postgres import Postgres def test_base_exception(): try: var0 = module0.Postgres() except BaseException: pass
204
65
# 918. Maximum Sum Circular Subarray # Runtime: 1028 ms, faster than 5.09% of Python3 online submissions for Maximum Sum Circular Subarray. # Memory Usage: 18.6 MB, less than 33.98% of Python3 online submissions for Maximum Sum Circular Subarray. import math class Solution: def maxSubarraySumCircular(self, num...
1,367
492
import numpy as np import matplotlib.pyplot as plt from scipy.signal import convolve from matplotlib.gridspec import GridSpec import matplotlib as mpl rng = np.random.default_rng() def k_cap(input, cap_size): """ Given a vector input it returns the highest cap_size entries from cap_zie ...
10,644
3,567
from collections import Counter, defaultdict from datetime import datetime from statistics import mean from dateutil.parser import parse as parse_datetime from dateutil import rrule def num_comments_by_user(comments): commenters = (comment['from']['name'] for comment in comments) counter = Counter(commenters...
4,398
1,245
import app.model.model as model import hashlib class UserSignup(model.Model): def __init__(self): super(UserSignup, self).__init__() def signup(self, username, password, email): cursor = self.matchadb.cursor(dictionary=True) query = [ username, email, ]...
741
213
import os import shutil import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt def find_bin(comp, nbins): bins = np.linspace(0, 1, nbins) for bi in range(len(bins) - 1): if comp > bins[bi] and comp < bins[bi + 1]: return bi return nbins - 1 def compositional_histogr...
2,125
723
from django.urls import path from .views import contactMe urlpatterns = [ path('contact', contactMe) ]
109
34
import os.path as osp from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QAction from PyQt5.QtWidgets import QFileDialog from PointMatcher.utils.filesystem import icon_path class ExportAction(QAction): def __init__(self, parent): super(ExportAction, self).__init__('Export', parent) self.p ...
1,256
379
import unittest from mock import Mock from test.robotTestUtil import RobotTestUtil class MyTestCase(unittest.TestCase): def test_head_turn(self): robot = RobotTestUtil.make_fake_dash() robot.stage_cmds = Mock() m = robot.stage_cmds robot.commands.head.do_pan_angle (90) ...
1,345
545
import click class ExperimentOption(): def __init__(self): self.data_set_size = -1 self.ignore_number = True self.use_github_issue = True self.use_jira_ticket = True self.use_comments = True self.use_bag_of_word = True self.positive_weights = [0.5] s...
3,866
1,170
class Macros: def __init__(self, title, cmds): self.title = title self.cmds = cmds def __call__(self): return self def start(self, app, para=None, callafter=None): app.run_macros(self.cmds, callafter)
247
86
import copy import os import json from pathlib import Path from typing import Callable, Optional from . import rust, version class BaseProgressNotifier: def notify_total_bytes(self, total_size: int): raise NotImplementedError() def notify_writing_file(self, file_name: bytes, file_bytes: int): ...
2,038
670
# -*- coding: UTF-8 -*- import os from secistsploit.core.exploit import * from secistsploit.core.http.http_client import HTTPClient class Exploit(HTTPClient): __info__ = { "name": "whatweb", "description": "whatweb", "authors": ( "jjiushi", ), "references": ( ...
3,453
1,073
from pathlib import Path import logging import xarray from time import time from typing import Union # from .io import opener from .rinex2 import rinexnav2, _scan2 from .rinex3 import rinexnav3, _scan3 # for NetCDF compression. too high slows down with little space savings. COMPLVL = 1 def readrinex(rinexfn: Path, o...
3,285
1,232
from typing import TYPE_CHECKING import networkx as nx from .fas import eades_fas if TYPE_CHECKING: # Prevent circular import from .pref_dag import PrefDAG class PrefGraph(nx.DiGraph): """ `PrefGraph` represents a possibly cyclic set of preferences over clips as a weighted directed graph. Edge weigh...
5,201
1,634
from __future__ import unicode_literals from django.views import generic from .models import {% for model in app.models %}{{ model.name }}{% if not loop.last %}, {% endif %}{% endfor %} {% for model in app.models %}class {{ model.name }}IndexView(generic.ListView): model = {{ model.name }} template_name = '...
516
162
""" Reviews permissions.""" # Python import logging # Django Rest Framework from rest_framework.permissions import BasePermission class IsServiceOwner(BasePermission): """ This permission allow determine if the user is a client, if not permission is denied. """ def has_permission(self, request,...
683
163
import sys import torch import timeit sys.path.append('../JDE') from mot.models.backbones import ShuffleNetV2 from sosnet import SOSNet if __name__ == '__main__': print('SOSNet PK ShuffleNetV2') model1 = ShuffleNetV2( stage_repeat={'stage2': 4, 'stage3': 8, 'stage4': 4}, stage_out_ch...
1,678
657
import pandas as pd NETMHCPAN_3_0_DEST = "test_netmhcpan_3_0_alleles.py" NETMHCPAN_3_0_SOURCE = "netmhcpan_3_0_alleles.txt" NETMHCPAN_4_0_DEST = "test_netmhcpan_4_0_alleles.py" NETMHCPAN_4_0_SOURCE = "netmhcpan_4_0_alleles.txt" special_chars = " *:-,/." def generate(src, dst, exclude=set()): alleles = set() ...
2,255
751
class Solution: def XXX(self, height: List[int]) -> int: ans, i, j = 0, 0, len(height) - 1 while i < j: val = min(height[i], height[j]) ans = max(val * (j - i), ans) if height[i] == val: i += 1 if height[j] == val: j -=...
343
116
# from linked_list.linked_list import LinkedList # def test_import(): # assert LinkedList
96
30
import requests import re import json headers = { "Origin": "https://bj.meituan.com", "Host": "apimobile.meituan.com", "Referer": "https://bj.meituan.com/s/%E7%81%AB%E9%94%85/", "Cookie": "uuid=692a53319ce54d0c91f3.1597223761.1.0.0; ci=1; rvct=1; _lxsdk_cuid=173e1f47707c8-0dcd4ff30b4ae3-3323765-e1000-1...
2,156
1,067
from __future__ import annotations import json from typing import List, Dict from entity_resolution import EntityResolution class Entity: def __init__(self, entity_fields: List[str], data: List[str], source_fields: List[str], attr_dicts: Li...
4,071
1,183
import subprocess import sys import os subprocess = subprocess sys = sys os = os def output(command: str, remlstc: bool) -> str: """ Get output from console command. If remlstc is True, it's return an output without a useless newline. :param command: The command. :param remlstc: R...
523
173
# -*- coding: utf-8 -*- """ Program to batch create categories. The program expects a generator containing a list of page titles to be used as base. The following command line parameters are supported: -always (not implemented yet) Don't ask, just do the edit. -overwrite (not implemented yet). -parent...
2,612
820
"""Classification and regression loss functions for object detection. Localization losses: * WeightedL2LocalizationLoss * WeightedSmoothL1LocalizationLoss Classification losses: * WeightedSoftmaxClassificationLoss * WeightedSigmoidClassificationLoss """ from abc import ABCMeta from abc import abstractmethod impo...
10,287
2,980
import json from datetime import datetime, timedelta from dateutil import parser as dateparser from django.contrib.auth.decorators import user_passes_test from django.db.models import Q from django.http import HttpResponseNotFound, JsonResponse from django.shortcuts import render from django.utils import timezone fro...
19,282
6,053
import os from torch.utils.data import Dataset,DataLoader import torch import torch.nn as nn from sklearn.metrics import f1_score def build_corpus(split, make_vocab=True, data_dir="data"): """读取数据""" assert split in ['train', 'dev', 'test'] word_lists = [] tag_lists = [] with open(os.path.join(dat...
5,575
2,034
''' Created on 28 Jan 2021 @author: thomasgumbricht ''' from string import whitespace def CheckWhitespace(s): ''' ''' return True in [c in s for c in whitespace] s = 'dumsnut' print (CheckWhitespace(s))
245
88
""" link: https://leetcode.com/problems/longest-palindrome problem: 问用s中字符组成的最长回文串长度 solution: map 记录字符出现次数 """ class Solution: def longestPalindrome(self, s: str) -> int: m, res = collections.defaultdict(int), 0 for x in s: m[x] += 1 for x in m: res += m[x] // 2...
362
155
import yaml import os import sys current_dir = os.path.dirname(os.path.realpath(__file__)) project_dir = os.path.realpath(os.path.join(current_dir, "..")) class ConfigManager: network = None config = None @classmethod def load(clss): if clss.network: config_filepath = os.path.join...
847
271
from django.shortcuts import render from django.shortcuts import redirect from django.shortcuts import get_object_or_404 from django.utils import timezone from .forms import QuestionForm from .forms import AnswerForm from .models import Question from .models import Answer def question_list(request): questions = Qu...
2,277
652
""" Unit tests for labe. Most not mocked yet, hence slow. """ import collections import socket import pytest import requests from labe.oci import get_figshare_download_link, get_terminal_url def no_internet(host="8.8.8.8", port=53, timeout=3): """ Host: 8.8.8.8 (google-public-dns-a.google.com) OpenPort...
1,648
622
"""tests dynamic cards and dynamic load cards""" import unittest from io import StringIO import numpy as np import pyNastran from pyNastran.bdf.bdf import BDF, read_bdf, CrossReferenceError from pyNastran.bdf.cards.test.utils import save_load_deck #ROOT_PATH = pyNastran.__path__[0] class TestDynamic(unittest.TestCas...
26,404
10,125
import subprocess import argparse import os import random from collections import OrderedDict from parse import parse from bokeh.io import export_png from bokeh.plotting import figure, output_file, show, save from bokeh.models import ColumnDataSource, FactorRange from bokeh.transform import factor_cmap from bokeh.layou...
4,691
1,790
# -*- coding: utf-8 -*- # BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data # (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP # (c) 07/2019-05/2021 : DESY PHOTON SCIENCE # authors: # Jerome Carnis, carnis_jerome@yahoo.fr from pathlib import Path import unittest from bcdi.u...
2,792
959
""" # [REPO NAME] ## Table of contents [Here you can use a table of contents to keep your README structured.] ## Overview [Here you give a short overview over the motivation behind your project and what problem it solves.] ## How to use it [Here you can explain how your tool/project is usable.] ### Requirements an...
567
145
# -*- coding: utf-8 -*- from ..core import db from ..helpers import JSONSerializer class BaseModel(db.Model, JSONSerializer): __abstract__ = True
152
49
#!/usr/bin/python3 # Demonstrates OpenGL color triangle # Ben Smith # benjamin.coder.smith@gmail.com # # based heavily on ccube.cpp # OpenGL SuperBible # Program by Richard S. Wright Jr. import math from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * ESCAPE = b'\033' xRot...
2,652
1,013
import binascii from base64 import b64decode from typing import Optional from fastapi import Depends, Header, status from fastapi.exceptions import HTTPException def _user_header(authorization: Optional[str] = Header(None)) -> str: if not authorization: raise HTTPException(status.HTTP_401_UNAUTHORIZED) ...
1,379
439
import torch.nn as nn import os import torch.optim as optim from tqdm import tqdm import numpy as np import torch import torch.nn.functional as nnf import SimpleITK as sitk import json from scipy import ndimage import medpy.io as mio from Utils import find_binary_object from MyDataloader import get_train_...
19,175
6,896
import beneath from generators import earthquakes with open("schemas/earthquake.graphql", "r") as file: EARTHQUAKES_SCHEMA = file.read() if __name__ == "__main__": p = beneath.Pipeline(parse_args=True) p.description = "Continually pings the USGS earthquake API" earthquakes = p.generate(earthquakes.ge...
534
189
# Copyright 2020 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://www.apache.org/licenses/LICENSE-2.0 # or in the "license" file...
5,073
1,395
# Minimal setup.py # # Enables installing requirements as declared in setup.cfg. # From this directory, run: # pip install . from setuptools import setup setup()
167
48
# -*- coding:utf-8 -*- """ common models """ from django.db import models from apps.common.models import BaseModel from apps.datasource.models import DsInterfaceInfo class FeatureType(models.Model): id = models.AutoField(u'主键', primary_key=True) feature_type_desc = models.CharField(u'特征类型解释', max_length=...
7,113
3,038
import random from typing import Optional from .grid import * class Solver: def __init__(self, grid: Grid): self._grid = grid self._backtrack = [] self._pos = (0, 0) self._dir = None self._backtracking = False self._branches = { self._pos: set(self.vali...
4,007
1,153
from keras_segmentation.pretrained import pspnet_101_voc12 pspnet_101_voc12()
78
39
from odbAccess import * from abaqusConstants import * from textRepr import * import timeit import numpy as np import os import sys start_time = timeit.default_timer() index = sys.argv[-1] # print(index) # index = float(index) index = int(index) # print(index) odbFile = os.path.join(os.getcwd(), "single_element_simul...
1,224
483
""" Tools to perform analyses by shuffling in time, as in Landau & Fries (2012) and Fiebelkorn et al. (2013). """ import os import yaml import numpy as np import statsmodels.api as sm from statsmodels.stats.multitest import multipletests from .utils import avg_repeated_timepoints, dft # Load the details of the behavi...
8,526
2,842
from m5.objects import * # https://en.wikipedia.org/wiki/Raspberry_Pi # https://en.wikipedia.org/wiki/ARM_Cortex-A7 # Instruction Cache class ARM_A7_ICache(Cache): tag_latency = 1 data_latency = 1 response_latency = 1 mshrs = 2 tgts_per_mshr = 8 size = '16kB' # OK assoc = 2 is_read_...
1,411
622
from .create_db import Session, engine, Base from .models import User, Post, Tag __all__ = [ "Session", "engine", "Base", "User", "Post", "Tag", ]
172
62
""" Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 ...
1,405
464
import nltk nltk.download('vader_lexicon')
42
18
from tkinter import* from tkinter import Button, font from tkinter.font import BOLD import tkinter.ttk as ttk from tkhtmlview import HTMLLabel from tkhtmlview import HTMLText def frameButton(frame, xx, yy, text, backgroundcolor, foregroundcolor, cmd, images): def IN(e): button['background'] = back...
880
281
import pyqtgraph as pg import pyqtgraph.exporters import numpy as np import math from time import sleep f = 10 t = 0 Samples = 1000 # while True: # y2 = np.sin( 2* np.pi * f * t) # print(y) # t+=0.01 # sleep(0.25) def update(): global f, t, ys, y2 print(len(y2)) if len(y2) == Samples: ...
864
382
#--- Exercicio 2 - Dicionários #--- Escreva um programa que leia os dados de 11 jogadores #--- Jogador: Nome, Posicao, Numero, PernaBoa #--- Crie um dicionario para armazenar os dados #--- Imprima todos os jogadores e seus dados lista_jogador = [] for i in range(0,11): dicionario_jogador = {'Nome':'', 'Posicao':'...
931
384
# Iterate over epochs. for epoch in range(3): print(f'Epoch {epoch+1}') # Iterate over the batches of the dataset. for step, x_batch_train in enumerate(train_data): with tf.GradientTape() as tape: reconstructed = autoencoder(x_batch_train) # Compute reconstruction loss loss = mse_loss(x_b...
669
233
################################################################ # Generate top-N words for topics, one per line, to stdout ################################################################ import os import sys import argparse import numpy as np import file_handling as fh def get_top_n_topic_words(beta, vocab, n=30): ...
1,422
458
# Quando tivermos um programa onde claramente temos um caso # indesejável, então podemos usar a função do python dita # try_and_except. # Vamos supor que desejamos fazer uma função que faça uma # divisão, então podemos fazer a seguinte estrutura de # código def divisão(divideBy): return 42 / divideBy # veja que n...
918
333
from jnius import autoclass, cast from kivy.logger import Logger from plyer_lach.facades import Email from plyer_lach.platforms.android import activity Intent = autoclass('android.content.Intent') AndroidString = autoclass('java.lang.String') URI = autoclass('android.net.Uri') class AndroidEmail(Email): def _send...
1,577
438
"""Main class for sudoku game. Run this to solve the game.""" from board import Board # ENTRIES contains the values of each cell ENTRIES = [0, 0, 0, 2, 6, 0, 7, 0, 1, 6, 8, 0, 0, 7, 0, 0, 9, 0, 1, 9, 0, 0, 0, 4, 5, 0, 0, 8, 2, 0, 1, 0, 0, 0, 4, 0, 0, 0, 4, 6, 0, 2, 9, 0, 0, 0, 5, 0, 0, 0, 3, 0, 2...
452
298
import abc class Abstract_Strategy(metaclass=abc.ABCMeta): @abc.abstractmethod def generate(self): pass
121
37
# Generated by Django 2.2.10 on 2020-03-04 09:21 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('virtualization', '0013_deterministic_ordering'), ('dcim', '0099_powerfeed_negative_voltage'), ] operations...
2,215
647
#!/usr/bin/env python import os import sys import smtplib import time import syslog import telegram import yaml from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText # Author:: Alexander Schedrov (schedrow@gmail.com) # Copyright:: Copyright (c) 2019 Alexander Schedrov # License:: MIT def ...
1,934
684
# -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2018-2019 Groupe Allo-Media # # 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 r...
40,263
11,014
from .mock_api.utils import GetSelection from .viewAccounts import ViewAccounts from .addAccount import AddAccount def MainMenue(): headerMessage = ( """\n\n=========================================================\n===================== Main Menue ========================\n""") print(headerMessage) ...
889
216
import torch import torchvision from torchvision import datasets, transforms from torch.utils.data import DataLoader import os def get10(batch_size, data_root='/tmp/public_dataset/pytorch', train=True, val=True, **kwargs): data_root = os.path.expanduser(os.path.join(data_root, 'cifar10-data')) num_workers = kw...
7,342
2,448
# Copyright 2021 Huawei Technologies Co., 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 a...
25,604
10,642
# Copyright 2020 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://www.apache.org/licenses/LICENSE-2.0 # # or in th...
4,181
1,276
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at...
844
275
import mnist_loader import network2 import numpy as np training_data, validation_data, test_data = mnist_loader.load_data_wrapper() eta = 0.9 m_b_s = 10 epochs = 30 trials = 10 trial_ev = [] for t in xrange(trials): net = network2.Network([784, 50, 50, 50, 50, 10], cost=network2.CrossEntropyCost) net.defaul...
827
347
from abc import ABC, abstractmethod from typing import List, Any from ipaddress import IPv4Address from dataclasses import dataclass, FrozenInstanceError from types import SimpleNamespace from enum import Enum, auto class Kind(Enum): CREATE_WHOIS = auto() GET_WHOIS = auto() GET_WHOIS_BY_IP = auto() GE...
1,918
597
import cobra from optaux import resources resource_dir = resources.__path__[0] met_to_rs = {'EX_pydam_e': ['PDX5PS', 'PYDXK', 'PYDXNK'], 'EX_orot_e': ['DHORTS', 'UPPRT', 'URIK2'], 'EX_thr__L_e': ['PTHRpp', 'THRS'], 'EX_pro__L_e': ['AMPTASEPG', 'P5CR'], 'EX_skm_e': ...
1,079
477
import os import sys def get_workdir(): """ get_workdir() -> workdir: [str] Returns the current workdir. """ return os.path.realpath(os.path.dirname(sys.argv[0]))
186
67
import csv import MySQLdb # installing MySQL: https://dev.mysql.com/doc/refman/8.0/en/osx-installation-pkg.html # how to start, watch: https://www.youtube.com/watch?v=3vsC05rxZ8c # or read this (absolutely helpful) guide: https://www.datacamp.com/community/tutorials/mysql-python # this is mainly created to get a data...
10,430
3,149