text
string
size
int64
token_count
int64
#!/usr/bin/env python from geometry_msgs.msg import Pose, Point, Quaternion, Vector3 import numpy as np import tf def convert_pose(pose): """ convert pose between left and right-hand coordinate system :param pose: pose to be converted :return: converted pose """ data = Pose() data.position...
1,477
464
from core.model import Model class IFR_Generalized_SB(Model): name = "IFR generalized Salvia & Bollinger" shortName = "IFRGSB" # initial parameter estimates beta0 = 0.01 parameterEstimates = (0.1, 0.1) def hazardSymbolic(self, i, args): # args -> (c, alpha) f = 1...
518
210
import numpy as np import pandas as pd import talib big= 200 small= 50 threshold=0.02 #context.market (shortperiod, longperiod): #Market Values= 0-negative, 1-no trend, 2-positive def initialize(context): context.spy= sid(8554) schedule_function(check) def check(context, data): spydata= data.histo...
1,263
458
# -*- coding: utf-8 -*- """Google_Drive_Online_Decompression.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/16e0tv3LEkAFaYHmKH2H63Cg6rpCNWFky # **第一步 绑定GoogleDrive** """ #@markdown 点击左侧按钮,授权绑定GoogleDrive from google.colab import drive drive.mo...
6,097
3,760
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here n, m = map(int, input().strip().split()) a ...
678
241
"""APIs from ml.vision.io and ml.audio.io """ from .api import *
65
28
# -*- coding: utf-8 -*- """ The main addon module SPDX-License-Identifier: MIT """ # -- Imports ------------------------------------------------ import xbmcaddon import resources.lib.appContext as appContext import resources.lib.settings as Settings import resources.lib.logger as Logger import resources.lib.main as ...
738
231
from bflib import units from core import contexts from core.components import Component, listing from core.messaging import StringBuilder, Actor, Target, Verb @listing.register class Equipment(Component): NAME = "equipment" __slots__ = ["armor_restrictions", "weapon_restrictions", "weapon_size_restrictions", ...
6,226
1,923
from django.urls import path from . import views urlpatterns = [ path('', views.StartPageView.as_view()), path('accounts/created/', views.NotificationView.as_view()), path('accounts/<int:pk>/update/', views.StudentUpdate.as_view()), path('profile/', views.ProfilePageView.as_view()), path('profile/a...
544
172
"""Test agrirouter/environments/environments.py""" from agrirouter.environments.environments import ProductionEnvironment as PE from agrirouter.environments.environments import QAEnvironment as QAE from tests.constants import application_id class TestPE: def test_get_base_url(self): assert PE().get_base_...
4,478
1,577
#!/usr/bin/env python # -*- coding: UTF-8 -*- # (c) 2016 Mike Lewis import logging; log = logging.getLogger(__name__) from . import MultilangEndpointTestCase class MultiLangTestCase(MultilangEndpointTestCase): """ General """ def test_lang(self): """Test a wide swath of languages""" ...
556
165
# Copyright 2021 Google 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 to in writing, ...
4,923
1,607
import nox nox.options.sessions = ["test"] @nox.session def test(session): session.install("-e", ".[testing]") session.run("pytest") @nox.session def pack(session): session.install("build") session.run("python", "-m", "build", ".")
266
106
from __future__ import print_function import math, numpy as np from PIL import Image from klt import * from error import * from convolve import * from klt_util import * import goodFeaturesUtils class selectionMode: SELECTING_ALL = 1 REPLACING_SOME = 2 KLT_verbose = 1 #**********************************************...
9,085
3,518
#/bin/python3 import numpy as np from scipy import signal as sig class pySparSDRCompress(): ''' Implementation of the SparSDR Compressor based on Khazraee, M., Guddeti, Y., Crow, S., Snoeren, A.C., Levchenko, K., Bharadia, D. and Schulman, A., 2019, June. Sparsdr: Sparsity-proportional backhaul and comp...
3,345
1,068
from dirtyclean import clean import unittest class TestDirtyClean(unittest.TestCase): def setUp(self): self.uglystring = " st—up•id ‘char−ac ter..s’, in its’ string...”Ç " with open("multiline.txt") as mt: self.multiline = mt.read() def test_basic_clean(self): self.ass...
803
251
import csv control = "/Users/patrickmcgranaghan1/Documents/Python/python_work/SurveyApplications/source_data/control.csv" set_points = "/Users/patrickmcgranaghan1/Documents/Python/python_work/SurveyApplications/source_data/setPoints.csv" max_hypotenuse = 200 # Integer in feet # Note in the State Plane Coordinate Sys...
1,321
435
from json import dumps from pprint import PrettyPrinter from cerberus.validator import Validator from flask import request from flask_restx import Resource from werkzeug.exceptions import BadRequest from stac_compose.collections import ns as api from stac_compose.collections.business import CollectionsBusiness from s...
2,118
628
# 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 u...
6,070
1,829
pkgname = "xrandr" pkgver = "1.5.1" pkgrel = 0 build_style = "gnu_configure" hostmakedepends = ["pkgconf"] makedepends = ["libxrandr-devel"] pkgdesc = "Command line interface to X RandR extension" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://xorg.freedesktop.org" source = f"$(XORG_SITE)/app...
485
235
# Copyright 2021 Google, Inc. # # 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, this list of conditions and the following disclaimer; # redistribu...
2,477
914
# Validate input while True: print('Enter your age:') age = input() if age.isdecimal(): break print('Pleas enter a number for your age.')
164
54
from migrate import * def upgrade(migrate_engine): migrate_engine.execute( ''' begin; ALTER TABLE resource ADD COLUMN name text, ADD COLUMN resource_type text, ADD COLUMN mimetype text, ADD COLUMN mimetype_inner text, ADD COLUMN "size" bigint, ADD COLUMN last_modified timestamp ...
1,003
293
import pickle import pandas as pd import yaml from sklearn.linear_model import ElasticNet, LogisticRegression from sklearn.ensemble import RandomForestRegressor from config import Config Config.MODELS_PATH.mkdir(parents=True, exist_ok=True) with open ("params.yaml", "r") as fd: params = yaml.safe_load(fd) model...
1,153
416
# Copyright (c) 2016 The OpenTracing Authors. # # 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, pub...
8,226
2,519
# -*- coding: utf-8 -*- """Vision Transformer Dogs and Cats Python Generator Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/12u7r2OMkt_rFmOQq2g5FtX7Z0EbyPYFN See code at https://github.com/google-research/vision_transformer/ See paper at https://arxi...
29,950
10,519
import csv import sys import json import tests try: from cStringIO import StringIO except ImportError: from io import StringIO from six import with_metaclass from elex.cli.app import ElexApp from collections import OrderedDict DATA_FILE = 'tests/data/20151103_national.json' DATA_ELECTION_DATE = '2015-11-03' DE...
19,349
5,632
from typing import TypeVar, Generic, Optional, Type, Any, Union, Dict, TYPE_CHECKING from unipipeline.errors.uni_payload_error import UniPayloadParsingError, UniAnswerPayloadParsingError from unipipeline.errors.uni_sending_to_worker_error import UniSendingToWorkerError from unipipeline.answer.uni_answer_message import...
4,321
1,301
import gettext import os import re import subprocess import sys import time import tkinter as tk import tkinter.filedialog as tkf import uuid import webbrowser from datetime import date, datetime from enum import Enum from tkinter import * from tkinter import messagebox from tkinter.ttk import * import cv2 import num...
1,825
566
# # PySNMP MIB module Fore-Common-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-Common-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:14:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
8,039
4,042
################################################################################ # Styler & Logger ################################################################################ from logging.handlers import SysLogHandler import logging import json import pprint import time from .decoder import decode import collectio...
2,753
816
# --------------------------------------------------------------------- # inv.inv log plugin # --------------------------------------------------------------------- # Copyright (C) 2007-2018 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules ...
954
256
from arm.logicnode.arm_nodes import * class SeparateQuaternionNode(ArmLogicTreeNode): """TO DO.""" bl_idname = 'LNSeparateQuaternionNode' bl_label = "Separate Quaternion" arm_section = 'quaternions' arm_version = 1 def init(self, context): super(SeparateQuaternionNode, self).init(cont...
574
194
import getopt import sys import os import schema import server import orm CLIENT_TYPE = { '--client_lua_path' : "lua", '--client_cs_path' : "cs", '--client_cpp_path' : "cpp", '--client_js_path' : "js", '--client_python_path' : "python", } def export(): opts, args = getopt.getopt(sys.argv[...
3,110
1,421
import wx class App(wx.App): def OnInit(self): self.locale = wx.Locale(wx.LANGUAGE_CHINESE) return 1 def A(evt): print("hello") f.Maximize() def B(evt): b.SetBackgroundColour("#FFFFFF") def C(evt): b.SetBackgroundColour("#EFEFEF") app = App() f = wx.Frame(None, -1, "Hello", [700, 500]) wx...
707
331
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT # You must add a gamepad HID device inside your boot.py file # in order to use this example. # See this Learn Guide for details: # https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/hid-devices#custom-hid-dev...
2,048
855
import numpy as np import tensorflow as tf from .unet import UNet def tf2pytorch(checkpoint_path, num_instrumments): tf_vars = {} init_vars = tf.train.list_variables(checkpoint_path) # print(init_vars) for name, shape in init_vars: try: # print('Loading TF Weight {} with shape {}'...
3,345
1,137
import numpy as np import exceptions as ex def LogWalk(T, nSteps, mu, sigma, x_0=1, t_0=0, boundary=500): ex._check_params(T, nSteps, t_0) dt = T/(10*nSteps) x_t = [] t = t_0 for i in range((10*nSteps)): x = x_0*np.exp((mu - sigma**2/2)*t + sigma*np.random.randn()*np.sqrt(t)) if ...
1,920
784
import math from oscontainer.constants import CGROUP_TYPE_V2, PER_CPU_SHARES, NO_LIMIT from oscontainer.cgroup_subsystem import CgroupController, CgroupSubsystem from oscontainer.utils import limit_from_str CPU_WEIGHT = "cpu.weight" CPU_MAX = "cpu.max" CPU_CPUSET_CPUS = "cpuset.cpus" CPU_CPUSET_CPUS_EFFECTIVE = "cpus...
3,847
1,289
""" Custom hamcrest matchers. """ from hamcrest.core.base_matcher import BaseMatcher from json import dumps, loads class JSONMatcher(BaseMatcher): """ Match JSON content. """ def __init__(self, s): self.json = loads(s) def _matches(self, item): return loads(item) == self.json ...
460
152
# coding: utf-8 import sys import json from mailmerge import MailMerge # Le template contient à ce jour les champs : # auteur l'auteur du document # date_edition la date d'édition du document # confidentialite le destinataire du document # raison_sociale la raison sociale de l'entreprise # siret le numéro de SIRET de ...
2,741
949
""" Enum Assembler-Directives """ from enum import Enum, auto class AssemblerDirectives(Enum): START = auto() END = auto() ORG = auto() DEFINE = auto() @classmethod def to_string(cls): return "{START},{END},{ORG},{DEFINE}".format( START=cls.START.name, END=cls...
406
143
from Animal import Animal class Sheep(Animal): def __init__(self, sheep=None, position=None): super(Sheep, self).__init__(sheep, position) def clone(self): return Sheep(self, None) def initParams(self): self.power = 3 self.sign = 'S'
250
98
class Page(object): def __init__(self, params): self.size = 2 ** 10 self.Time = False self.R = False self.M = False
154
53
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def print_list(self): cur = self while cur: print(cur.val, end='->') cur = cur.next class Solution: # 전가산기구현 def addTwoNumbers(selfself, l1: ListNode, l2: List...
1,034
393
# -*- coding: utf-8 -*- """ Jokes below come from the "jokes_en.py" file. Translation to Polish: Tomasz Rozynek - provided under CC BY-SA 3.0 """ neutral = [ "W 2030 roku Beata z ulgą usunęła Python'a 2.7 ze swoich maszyn. 'No!' westchnęła, by za chwilę przeczytać ogłoszenia na temat Python'a 4.4.", "Zapytani...
15,516
6,146
from dataclasses import dataclass import pele_platform.Checker.main as ck import pele_platform.Frag.simulation as fr import pele_platform.Adaptive.simulation as ad from pele_platform.Allosteric.main import run_allosteric import pele_platform.gpcr.main as gpcr import pele_platform.out_in.main as outin from pele_platform...
2,335
744
# -*- coding: utf-8 -*- from .pandas_aw import PandasAw class AuditAw(object): """ @summary: 审核AW类,负责审核规则整体流程 """ def __init__(self): self.result = [] def audit_report(self, visit_data_path, visit_demand_path, outliers_path): """ @summary: 审核报告入口 """ # 1.获取...
1,607
658
""" all subsets of given subset """ def subsets_of_subset(subset): s = subset superset = subset while True: yield s s = (s - 1) & superset if s == superset: break # --- end of library --- def debugprint(g): for x in g: print(f"{x:06b}") TEST_1 = """ >>> ...
812
340
# ------------------------------------------------------------------------------------ # Sparse DETR # Copyright (c) 2021 KakaoBrain. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------------------ # M...
9,312
2,886
from bowtie_diagram import BowTie import matplotlib.pyplot as plt EXAMPLE_MONITOR_VALUES = [x for x in range(-5, 21)] bowtie = BowTie() state = {"monitor_values": {"lec_martingale": None}} true_y_vals = [] true_x_vals = [] for x_val in EXAMPLE_MONITOR_VALUES: true_x_vals.append(x_val) state["monitor_values"]...
496
224
#from https://www.assemblyai.com/blog/end-to-end-speech-recognition-pytorch/ from torch import nn import torch.nn.functional as F from hw_asr.base import BaseModel class CNNLayerNorm(nn.Module): def __init__(self, n_feats): super().__init__() self.layer_norm = nn.LayerNorm(n_feats) def forw...
3,760
1,427
import datetime from typing import List from reminders.events import Buttons, Alerts from reminders.screen import Screen # highest level, things that can be in a list menu class ListMenuItem: def __init__(self, name): self._name = str(name) @property def name(self): return self._name ...
9,198
2,813
import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_NAME from .const import ( CONF_CHILD_LOCK, CONF_CLIMATE, CONF_DEVICE_ID, CONF_DISPLAY_LIGHT, CONF_LOCAL_KEY, CONF_TYPE, CONF_TYPE_AUTO, CONF_TYPE_DEHUMIDIFIER, CONF_TYPE_FAN, CONF_TYPE_GECO_HEATER, CONF...
2,127
751
from nlp20 import get_england import re str = get_england() lines = str.split('\n') p = re.compile(r'^(=+)\s*(.+?)\s*=+') for l in lines: m = re.search(p, l) if m is not None: level = len(m.group(1)) - 1 print(m.group(2), level)
255
111
PROMQL = """ start: query // Binary operations are defined separately in order to support precedence ?query\ : or_match | matrix | subquery | offset ?or_match\ : and_unless_match | or_match OR grouping? and_unless_match ?and_unless_match\ : comparison_match | and_unless_match (AND | ...
4,913
2,120
"""This file contain the model for the usermanagement app.""" from django.contrib.auth.models import AbstractUser, Group, Permission from django.db import models class UserProfile(AbstractUser): """ Define a user. Here, we use heritage of abstract user and addition of the field nb_tries to detect if ...
2,750
840
# -*- coding: utf-8 -*-: from django import template import urllib import hashlib register = template.Library() def gravatar(email, size=80, username=None): gravatar_url = "http://www.gravatar.com/avatar.php?" gravatar_url += urllib.urlencode({ 'gravatar_id': hashlib.md5(email).hexdigest(), ...
572
209
# encoding=utf-8 """ Misc PyTorch utils Author: xuhaoyu@tju.edu.cn update 12.7 Usage: `from torch_utils import *` `func_name()` # to call functions in this file """ from datetime import datetime import math import os import torch import torch.nn as nn from tensorboardX import SummaryWriter ##############...
11,149
3,824
#!/usr/bin/python # Copyright (c) 2017 David LePage # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: route_vpn short_description...
19,421
5,099
# Lint as: python3 # Copyright 2020 Google LLC. 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 ...
6,407
1,825
#!/usr/bin/env python # # Public Domain 2014-2016 MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as ...
16,034
5,445
ftxus = { 'api_key':'YOUR_API_KEY', 'api_secret':'YOUR_API_SECRET' }
77
39
import argparse from distutils.util import strtobool def str2bool(x): return bool(strtobool(x)) def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--num_epochs', type=int, default=1000) parser.add_argument('--learning_rate', type=float, default=0.0005) parser.add_argument...
4,387
1,328
# Koki Kapoor # CSC 630 # Course Difficulty.py file # have each homework assignment be ranked based on difficulty of the course and on difficulty of the assignment itself # list_of_courses_and_difficulty only takes into consideration the difficulty of the course, not the assignment from array import * # install num...
4,955
1,502
import abc import textwrap class GitHook(metaclass=abc.ABCMeta): """ Base class to define a Git hook usable by `hooks` task. """ @abc.abstractmethod def name(self): """ :rtype: unicode :return: Name of hook. """ @abc.abstractmethod def script(self): ...
1,826
549
a = [1, 2, 3, 4] def subset(a, n): if n == 1: return n else: return (subset(a[n - 1]), subset(a[n - 2])) print(subset(a, n=4))
166
88
from trees.dasgupta.costtree import DasguptaTree
49
16
# This a training script launched with py_config_runner # It should obligatory contain `run(config, **kwargs)` method import sys from collections.abc import Mapping from pathlib import Path import torch from apex import amp from dataflow.datasets import VOCSegmentationOpencv from py_config_runner.config_utils import ...
11,810
3,680
from selenium import webdriver from selenium.webdriver.common.keys import Keys from time import sleep from tqdm import tqdm import random from EmailSender import * class InstagramBot: # Creates object and starts the browser def __init__(self, username, password): print("Hi, i'm your persona...
17,387
5,576
def print_formatted(number): # your code goes here for i in range(1, number +1): width = len(f"{number:b}") print(f"{i:{width}} {i:{width}o} {i:{width}X} {i:{width}b}")
198
80
#! usr/bin/dev python from stages import Stages #Le as fases from code import tanks #Responsável pelos tanques do player from images import imagens #imagens do jogo import pygame import random screen_Dimension=[32*20,32*20] pygame.init() screen = pygame.display.set_mode(screen_Dimension) pygame.display....
813
354
from typing import Dict from numba import njit import numpy as np import matplotlib.pyplot as plt plt.rcParams['image.cmap'] = 'binary' def read_parameters(filename: str) -> Dict[str, float]: """Read parameters from a file to a dictionary and return it.""" parameters = {} with open(filename, "r") as file:...
6,271
2,208
import unittest from streamlink import Streamlink try: from unittest.mock import ANY, MagicMock, call except ImportError: from mock import ANY, MagicMock, call from streamlink.plugins.ustreamtv import UStreamTV class TestPluginUStreamTV(unittest.TestCase): def test_can_handle_url(self): should_m...
1,362
431
def test_run(): import sklearn.datasets import xgboost data = sklearn.datasets.load_boston() X, y = data.data, data.target # pylint: disable=no-member xgb = xgboost.XGBRegressor(n_estimators=3) xgb.fit(X[:100], y[:100]) assert xgb.predict(X[100:]).shape == (len(X[100:]),)
304
132
# coding: utf-8 from __future__ import unicode_literals, absolute_import from boxsdk.config import API def test_get(mock_box_session, test_collaboration_allowlist_entry): entry_id = test_collaboration_allowlist_entry.object_id expected_url = '{0}/collaboration_whitelist_entries/{1}'.format(API.BASE_API_URL, ...
1,241
412
# Copyright 2021 The Brax Authors. # # 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 wri...
1,463
458
import json import scipy.stats import matplotlib.pyplot as plt import scipy.stats as st from decimal import Decimal, ROUND_HALF_UP from xml.dom import minidom import numpy as np def open_file(nameFile): try: f = open(nameFile + ".json", "r") dados = json.loads(f.read()) f.close() excep...
33,411
22,361
#!/usr/bin/env python u""" radial_basis.py Written by Tyler Sutterley (01/2022) Interpolates data using radial basis functions CALLING SEQUENCE: ZI = radial_basis(xs, ys, zs, XI, YI, polynomial=0, smooth=smooth, epsilon=epsilon, method='inverse') INPUTS: xs: scaled input X data ys: scaled input Y...
9,134
3,075
from flask import Flask, jsonify, request app = Flask(__name__) @app.route('/', methods =['GET', 'POST']) def index(): if (request.method == 'POST'): some_json = request.get_json() return jsonify({'you sent': some_json}),201 else: return jsonify({"about" : "Hello World!"}) @app.route('...
465
170
from mock.tests.base import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.template.defaultfilters import slugify from knowledge import settings from knowledge.models import Question, Response from knowledge.forms imp...
5,129
1,550
import re import string import sys from pyspark import SparkContext exclude = set(string.punctuation) def get_hash_tag(word, rmPunc): pattern = re.compile("^#(.*)") m = pattern.match(word) tag = None if m: match = m.groups() for m_word in match: tag = ''.join(letter for letter in m_word...
828
301
from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from . import views urlpatterns = [ url(r'^risks/$', views.RiskTypeList.as_view(), name='risks_list'), url(r'^risks/(?P<pk>[0-9]+)/$', views.RiskTypeDetail.as_view(), name='risk_details'), url(r'^fields/$', views...
417
155
import json import bs4 import requests url_base = 'https://dbase.tube/chart/channels/subscribers/all?page=%s&spf=navigate' max_page = 19084 html_doc = requests.get(url_base).text for i in range(max_page): url = url_base % i hot_bod = requests.get(url).text json_blob = json.loads(hot_bod) html_body = j...
534
204
class Solution: def coinChange(self, coins: List[int], amount: int) -> int: dp = [inf] * (amount + 1) dp[0] = 0 for coin in coins: for x in range(coin, amount + 1): dp[x] = min(dp[x], dp[x - coin] + 1) return dp[amount] if dp[amount] != inf else -1
315
121
from django.contrib import admin from ordered_model.admin import OrderedStackedInline, OrderedInlineModelAdminMixin from kanban_board.models import KanbanBoard, KanbanBoardState, Workflow, KanbanBoardElement class KanbanBoardAdmin(admin.ModelAdmin): list_display = ('name', 'workflow', 'element_count') filter_h...
1,166
366
"""Test for certbot_nginx.nginxparser.""" import copy import operator import tempfile import unittest from pyparsing import ParseException from certbot_nginx.nginxparser import ( RawNginxParser, loads, load, dumps, dump, UnspacedList) from certbot_nginx.tests import util FIRST = operator.itemgetter(0) class T...
16,705
5,408
# # PySNMP MIB module Intel-Common-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Intel-Common-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:54:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
6,522
3,214
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import textwrap from dataclasses import dataclass from typing import ClassVar, Iterable from pants.core.util_rules.external_tool import ( Downloade...
4,430
1,647
from django.apps import AppConfig class EmailAppConfig(AppConfig): name = 'app.emails' label = 'email_app' verbose_name = 'Emails App' default_app_config = 'app.emails.EmailAppConfig'
198
67
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from marshmallow import fields, post_dump, post_load, validate from polyaxon_schemas.constraints import ConstraintSchema from polyaxon_schemas.initializations import ( GlorotNormalInitializerConfig, InitializerSchema, ...
21,614
6,560
import pytest from ..model_base_test import ModelBaseTest from tests.sampleresponse.cardless_credit import cardless_credit_payment_response from xendit.models import CardlessCredit, CardlessCreditType # fmt: off class TestCreateCardlessCreditPayment(ModelBaseTest): @pytest.fixture def default_cardles...
5,556
1,763
from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver PROXY_URL_NO_AUTH_1 = 'http://<proxy hostname 1>:<proxy port 2>' cls = get_driver(Provider.RACKSPACE) driver = cls('username', 'api key', region='ord', http_proxy=PROXY_URL_NO_AUTH_1)
293
104
import os from cakechat.config import BASE_CORPUS_NAME, S3_MODELS_BUCKET_NAME, S3_TOKENS_IDX_REMOTE_DIR, \ S3_NN_MODEL_REMOTE_DIR, S3_CONDITIONS_IDX_REMOTE_DIR from cakechat.dialog_model.model import get_nn_model from cakechat.utils.s3 import S3FileResolver from cakechat.utils.text_processing import get_index_to_t...
2,576
869
name = input() class_school = 1 sum_of_grades = 0 ejected = False failed = 0 while True: grade = float(input()) if grade >= 4.00: sum_of_grades += grade if class_school == 12: break class_school += 1 else: failed += 1 if failed == 2: ejected ...
532
188
import os import sys import glob import time import copy import random import numpy as np import utils import logging import argparse import tensorflow as tf import tensorflow.keras as keras from model import NASNetworkCIFAR os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # os.environ['CUDA_VISIBLE_DEVICES'] = '1' # Basic m...
8,990
3,071
import studio def main(): c = studio.StudioClient('xxx') # put your app key here. # REGRESSION test_data = "" train_data = "" test_file_store_response = c.store('../csv/housing_test.csv') print(test_file_store_response) test_data = test_file_store_response['fileUrl'] train_data_store_...
1,585
494
import torch import torch.nn as nn class Encoder(nn.Module): def _conv_layer_factory(self, input_channels, output_channels, **kwargs): return nn.Sequential( nn.Conv2d(input_channels, output_channels, **kwargs), nn.LeakyReLU(), ) def __init__(self, input_channels=1, bot...
2,763
1,136
#!/usr/bin/env python3 import json data_json = {} with open('data/json_00.json', 'r') as file: data_json = json.load(file) print(data_json) print(data_json[0]) print(data_json[1]) print(data_json[2]) print(data_json[3]) print(data_json[4]) print(data_json[5]) print(data_json[6]) print(data_json[5][0]) print(d...
503
228
from app.models.classes_basicas.Pessoa import Pessoa class Empregado(Pessoa): id_empregado = None def getIdEmpregado(self): return self.id_empregado def setIdEmpregado(self, id_empregado): self.id_empregado = id_empregado
257
98