text
string
size
int64
token_count
int64
import torch import utility import data import model import loss from option import args from trainer import Trainer def print_network(net): num_params = 0 for param in net.parameters(): num_params += param.numel() print(net) print('Total number of parameters: %d' % num_params) def print_set...
1,342
448
from rest_framework.views import APIView from rest_framework.response import Response from auth_API.helpers import get_or_create_user_information class CheckConnection(APIView): def post(self, request, format=None): # --> 1. Get connection status and id user_info = get_or_create_user_informatio...
710
209
from models.statistical.ml_classifier import MLClassifier from models.statistical.models import ModelsFactory from models.statistical.tokenizer import TokenizerFactory # can be loaded from a config file model_name = 'xgb' tokenizer_name = 'default' ngrams = 2 name = 'sst2' stopwords = False max_features = 5000 test_...
2,295
611
"""" Test data generated with: ```python import numpy as np import shapely.geometry as sg def ccw(a): # Ensure triangles are counter-clockwise for i in range(len(a)): t = a[i] normal = (t[1][0] - t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]) if normal < 0: ...
6,215
3,442
from app.main import create_app from waitress import serve if __name__ == "__main__": app = create_app() serve(app, host='0.0.0.0', port='5000')
155
61
# Vencedor do jogo da velha # Faça uma função que recebe um tabuleiro de jogo da velha e devolve o vencedor. O tabuleiro é representado por uma lista de listas como o mostrado a seguir: # [['X', 'O', 'X'], ['.', 'O', 'X'], ['O', '.', 'X']] # Note que a lista acima é idêntica a: # [ # ['X', 'O', 'X'], # ...
2,575
869
from django.apps import AppConfig class ReservierungConfig(AppConfig): name = 'reservierung'
99
30
import martian from martian.error import GrokError from grokcore.component import name as namedirective from zope import component from bst.pygasus.datamanager.model import ExtBaseModel from bst.pygasus.datamanager.interfaces import IModelTransformer from bst.pygasus.datamanager.transformer import ModelTransfomerUtili...
1,065
306
""" Provides a list of functions for building opil objects. """ from intent_parser.intent.measure_property_intent import MeasuredUnit from intent_parser.intent_parser_exceptions import IntentParserException import intent_parser.utils.sbol3_utils as sbol3_utils import intent_parser.table.cell_parser as cell_parser impor...
4,833
1,398
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
6,741
2,026
#!/usr/bin/env python3 import logging from os import getuid, getgid from os.path import join import docker from .logger import log_from_docker class DockerRsync(object): def __init__(self, client=docker.from_env()): self.client = client def _run_rsync(self, volumes, from_path, to_path, relative): ...
4,063
1,058
#!/usr/bin/python # -*- coding: utf-8 -*- # compiled font is a binary blob: # 1. magic (MFNT) - 4 bytes # 2. number of symbols - 4 bytes # 3. font y advance - 4 bytes # 4. an array of glyphs (offset_x, offset_y, width, height, tx, ty, tx2, ty2, x_advance) - 36 * number of symbols # (iiIIffffI) # 5. png texture imp...
1,537
689
import json from django.conf import settings from django.test import TestCase, override_settings from django.urls import reverse from trojsten.people.models import User @override_settings(SITE_ID=10, ROOT_URLCONF="trojsten.urls.login") class LoginViewsTests(TestCase): fixtures = ["sites.json"] def test_log...
2,047
650
#!/usr/bin/env python import collections import re def write_constants(out, lua_version): out.write("EMSCRIPTEN_KEEPALIVE\n") out.write("emlua_constant emlua_constants[] = {\n") with open("lists/lua5{}/constants".format(lua_version)) as constants_file: for line in constants_file: c...
3,735
1,306
import mysql.connector from models.group import Group from models.contact import Contact class DbFixture(): def __init__(self, host, name, user, password): self.host = host self.name = name self.user = user self.password = password self.connection = mysql.connector.connect...
3,183
815
import pytest from django.urls import reverse from tests.users import factories as users_factories @pytest.mark.django_db class TestTicketCreateView: def test_get(self,client): url = reverse('support:support-contact') response = client.get(url) assert response.status_code == 200 def ...
1,171
354
"""Leetcode 415. Add Strings Easy URL: https://leetcode.com/problems/add-strings/ Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: - The length of both num1 and num2 is < 5100. - Both num1 and num2 contains only digits 0-9. - Both num1 and num2 does not cont...
1,827
642
"""Tests for handling the users resource""" import unittest import json from app import create_app from app.API.utilities.database import connection class UserTestCase(unittest.TestCase): """Unit testiing for the user regsitration endpoint""" def setUp(self): """Initialize the app and database connect...
4,574
1,372
import numpy as np import torch import torch.nn as nn from collections import OrderedDict def tf2th(conv_weights): """Possibly convert HWIO to OIHW.""" if conv_weights.ndim == 4: conv_weights = conv_weights.transpose([3, 2, 0, 1]) return torch.from_numpy(conv_weights) def _rename_...
3,268
1,138
import unittest from convert import jboss_command_to_http_request class TestJBOSSCommandToHTTPGETRequestOperationOnlyTestCase(unittest.TestCase): """Test case for JBOSS CLI commands operation only commands using HTTP GET""" def test_no_path_one_operations_no_params_http_get(self): """See if we only o...
10,975
3,104
from . import baselines from . import common from . import reward_machines from . import rl from . import worlds
113
33
from hipo_rank import Scores, Document, Summary from summa.summarizer import summarize class TextRankSummarizer: def __init__(self, num_words: int = 200, stay_under_num_words: bool = False): print('\n-------------------------\ninit textrank\n-------------------------\n') self.num_words = num_words ...
1,328
390
from django.db.models import Q, Sum, Avg from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.views import APIView from ratechecker.models import Region, Rate, Adjustment, Fee from ratechecker.ratechecker_parameters import Pa...
8,415
2,619
from sc2.ids.effect_id import EffectId from sc2.position import Point2 from sc2.units import Units from sharpy.managers.combat2 import MicroStep, Action, MoveType from sc2 import AbilityId from sc2.unit import Unit class MicroVoidrays(MicroStep): def should_retreat(self, unit: Unit) -> bool: if unit.shiel...
2,247
732
# # Copyright (c) 2019 EXXETA AG and others. # # This file is part of k8s-python-tools # (see https://github.com/EXXETA/k8s-python-tools). # # 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...
2,861
938
# Licensed under a 3-clause BSD style license - see LICENSE.rst """WCS related utility functions.""" from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from astropy.wcs import WCS from astropy.coordinates import Angle __all__ = [ 'linear_wcs_to_arrays', 'linea...
5,375
2,067
import pandas as pd import psycopg2 import sqlite3 # don't commit this dbname = '' user = '' password = '' host = '' pg_conn = psycopg2.connect(dbname=dbname, user=user, password=password, host=host) # connection object and cursor pg_conn pg_curs = pg_conn.cursor() # extract: csv file tita...
2,503
881
import yaml from merceedge.exceptions import MerceEdgeError from merceedge.settings import ( logger_access, logger_code, logger_console ) _LOGGER = logger_code def load_yaml(fname): """Load a YAML file.""" try: with open(fname, encoding='utf-8') as conf_file: # If configuratio...
999
310
#!/usr/bin/env python # Copyright 2016, DELLEMC, Inc. """ The script generate a new manifest for a new branch according to another manifest. For example, new branch: release/branch-1.2.3 date: 2016-12-15 00:00:00 The generated new manifest: branch-1.2.3-20161215 usage: ./on-tools/manifest-build-tools/HWIMO-BUILD on-...
4,891
1,402
from model_cgg import model ckpt = "cgg_36" mode = 1 from infer import infer, trim_str from itertools import islice from util_cw import CharWright from util_io import load_txt, save_txt from util_np import np, partition from util_tf import tf sess = tf.InteractiveSession() # load model cws = CharWright.load("../data/...
1,132
460
from future.utils import python_2_unicode_compatible from ..event_type import EventType from viberbot.api.viber_requests.viber_request import ViberRequest class ViberSeenRequest(ViberRequest): def __init__(self): super(ViberSeenRequest, self).__init__(EventType.SEEN) self._message_token = None self._user_id = ...
858
312
import torch import auraloss input = torch.rand(8, 2, 44100) target = torch.rand(8, 2, 44100) loss = auraloss.freq.SumAndDifferenceSTFTLoss() print(loss(input, target))
172
81
# *************************************************************************************** # *************************************************************************************** # # Name : processcore.py # Author : Paul Robson (paul@robsons.org.uk) # Date : 22nd December 2018 # Purpose : Convert vocabulary.as...
931
286
from basars_addons.schedules.cosine_decay import InitialCosineDecayRestarts from basars_addons.schedules.cosine_decay import CosineDecayWarmupRestarts
151
54
import random import hashlib import requests from cctrans import conf import cctrans def _sign(app_key, secret_key, text): salt = random.randint(32768, 65536) sign = app_key + text + str(salt) + secret_key return hashlib.md5(sign.encode('utf8')).hexdigest(), salt def _request_data(url, app_key, text, s...
1,221
410
import os import sys from time import sleep from typing import Optional from joint_teapot.utils.logger import logger current_path = sys.path[0] sys.path.remove(current_path) from git import Repo from git.exc import GitCommandError sys.path.insert(0, current_path) from joint_teapot.config import settings class Git...
3,648
1,051
#!/usr/bin/env bash trap 'ret=$?; printf "%s\n" "$ERR_MSG" >&2; exit "$ret"' ERR for file in $(find $1 -name \*.lp.bz2) ; do echo $file outputname="../gr/subgraphs/$(basename $file).gr" ./lp2dgf.py -f $file > $outputname if [ $? -ne 0 ]; then echo 'ERROR stopping...' exit 1 fi done
307
133
from django.conf.urls import include, url from formulario import views urlpatterns = [ url(r'^form/registro/(?P<pk>\d+)/$', views.RegistroSupraForm.as_view(), name='form_registro'), url(r'^form/registro/create/$', views.RegistroCreateSupraForm.as_view(), name='form_crear_registro'), url(r'^list/campo/$', views.Camp...
362
138
# Generated by Django 2.1.4 on 2019-01-27 04:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('customerauth', '0001_initial'), ] operations = [ migrations.AlterField( model_name='customers', name='address', ...
381
126
from .watch_time import time_str import fitlog class Logger: def __init__(self , fil_path = None): self.log_fil = open(fil_path , "w" , encoding = "utf-8") def nolog(self , cont = ""): pass def log_print(self , cont = ""): self.log_fil.write(cont + "\n") self.log_fil.flush() print (cont) fitlog.add_t...
424
180
import cv2 import numpy as np import os under_layer_path = '/home/ubuntu/share/cam_lidar/Tu_indoor/red2' upper_layer_path = "/home/ubuntu/share/cam_lidar/Tu_indoor/aisle02_dir" target_files = os.listdir(upper_layer_path) target_imgs = [f for f in target_files if os.path.isfile(os.path.join(upper_layer_path, f))] try: ...
1,798
715
# coding: utf-8 # users.py - functions for validating the user to change information for # # Copyright (C) 2013 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # ...
2,233
663
"""web dev chapter3 quiz total score Revision ID: 00f001a958b1 Revises: b95f0132b231 Create Date: 2022-03-02 11:57:04.695611 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '00f001a958b1' down_revision = 'b95f0132b231' branch_labels = None depends_on = None d...
1,739
661
import csv import json import re import os import sys import requests import base64 PATH = "./output" stuff = [] with open("thing.txt", "w+") as r: for path, dirs, files in os.walk(PATH): for filename in files: fullpath = os.path.join(path, filename) with open(fullpath, "r") as f:...
1,448
410
''' Events Model ''' import uuid from django.db import models # Utils Model from eventup.utils.models import GeneralModel class Event(GeneralModel): ''' Event Model ''' # Id id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) # Event data name = models.CharField(max_leng...
1,028
329
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import uuid from unittest import TestCase from hestia.tz_utils import local_now from marshmallow import ValidationError from tests.utils import assert_equal_dict from polyaxon_schemas.api.experiment import ExperimentConfig from...
3,198
965
# -*- coding: utf-8 -*- from odoo import api, fields, models, _ class AssignMechanicWizard(models.TransientModel): _name = 'assign.mechanic.wizard' _description = 'Assign Mechanic Wizard' # relations mechanic_ids = fields.Many2many('hr.employee', string="Assign Mechanic") repair_id = fields.Many2...
916
314
import datetime from python_to_you.extensions.database import db from sqlalchemy_serializer import SerializerMixin class Profile(db.Model, SerializerMixin): __tablename__ = 'profiles' id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.ForeignKey('users.id', ondelete="CASCADE")) addres...
1,077
385
from ..fuzzable import Fuzzable class Simple(Fuzzable): """Simple bytes value with manually specified fuzz values only. :type name: str, optional :param name: Name, for referencing later. Names should always be provided, but if not, a default name will be given, defaults to None :type default...
861
250
#schedule.py #importing time import time #Making time readable format clock = (time.ctime()) hour = clock[11:13] minute = clock[14:16] currenttime = 60*int(hour) + int(minute) day = clock[0:3] print (currenttime) print (clock) #IDK why this is here whatclass = ("none") #used to read White and Gold week Value def read...
12,671
4,027
from .nodes import Host, HostSchema, Session, SessionSchema, Project, SSHKey
77
20
""" https://www.codewars.com/kata/56269eb78ad2e4ced1000013/train/python Given an int, return the next 'integral perfect square', which is an integer n such that sqrt(n) is also an int. If the given int is not an integral perfect square, return -1. """ def find_next_square(sq: int) -> int: sqrt_of_sq = sq ** (1/2...
973
413
#! /usr/bin/env python import django from django.conf import settings django.setup() from geocamTiePoint.models import Overlay def moveCenterPtOutOfExtras(): overlays = Overlay.objects.all() for overlay in overlays: overlay.centerLat = overlay.extras.centerLat overlay.centerLon = overlay.extr...
483
154
#!usr/bin/env python3 # -*- coding: UTF-8 -*- from functools import reduce from PIL import Image, ImageFont, ImageDraw import numpy as np from matplotlib.colors import rgb_to_hsv, hsv_to_rgb import colorsys def compose(*funcs): """Compose arbitrarily many functions, evaluated left to right. Reference: https:...
11,087
4,394
import os constants = { 'print_frequency': 10_000, 'flush_threshold': 10_000, 'tile_size': 5_000, 'project_root': os.path.realpath(os.path.join(os.path.dirname(__file__), '../../../')), 'colours': { 'background': 'black' }, 'escapes': { 'line_up': '\x1b[A', 'line_delete': '\x1b[K' }, 'units': { '...
416
222
import random import numpy as np MATRIX = [(7, 6, 2, 1, 0, 3, 5, 4), (6, 5, 0, 1, 3, 2, 4, 7), (1, 0, 3, 7, 5, 4, 6, 2), (7, 5, 2, 6, 1, 3, 0, 4), (0, 4, 2, 3, 7, 1, 6, 5), (7, 1, 0, 2, 3, 5, 6, 4), (3, 4, 2, 6, 0, 7, 5, 1), (6, 1, 5, 2, 7, 4, 0, 3), (3, 1, 4, 5, 0, 7, 2, 6), (3, 2, 6, 5, 0, 4, 1, 7), (3, 0, 6, 1, 7, ...
7,143
6,627
import sys # Set up a list for our code to work with that omits the first CLI argument, # which is the name of our script (fizzbuzz.py) inputs = sys.argv inputs.pop(0) # Process the "inputs" list as directed in your code inputs = [int(x) for x in sys.argv[0:]] for x in inputs: if x % 3 == 0 and x % 5 == 0: ...
453
171
import numpy as np import matplotlib.pyplot as plt # sensor object to inherit for different sensors class Sensor: def __init__(self, name, mean, cov, state): self.name_ = name # add the sensor noise characteristics self.mean_ = mean self.cov_ = cov self.H = None self...
2,414
729
"""Asynchronous Python client for the Ambee API."""
52
15
#coding:utf-8 import threading class Singleton(object): def __new__(cls, *args, **kwargs): lock = threading.Lock() lock.acquire() if not hasattr(cls, "_instance"): cls._instance = object.__new__(cls) cls._instance.__Singleton_Init__(*args, **kwargs) lock.rele...
458
136
from django.urls import path, include from . import views urlpatterns = [ path('endpoints/', views.GetEndpoints.as_view()), path('endpoint/<str:endpoint_id>/', views.GetEndpoint.as_view()), path('packages/', views.GetPackages.as_view()), path('endpoint/quickscan/<str:endpoint_id>/', views.GetQuickSc...
661
224
class Ledfade: def __init__(self, *args, **kwargs): if 'start' in kwargs: self.start = kwargs.get('start') if 'end' in kwargs: self.end = kwargs.get('end') if 'action' in kwargs: self.action = kwargs.get('action') self.transit = self.end - self.start def ledpwm(self, p): c = 0.181+(0.0482*p)+(0.00...
670
344
from generator.actions import Actions import random import string import struct import numpy as np import math import datetime as dt import ctypes def kaprica_mixin(self): if hasattr(self, 'xlat_seed'): return def xlat_seed(seed): def hash_string(seed): H = 0x314abc86 f...
6,612
2,278
# Kano or Terminator # By Jean-Jacques F. Reibel # I will not be held responsible for: # any shenanigans import os # ಠ_ಠ # ¯¯\_(ツ)_/¯¯ # (╭ರ_•́) os.system("printf '\e[0;35;1;1m (╭ರ_'") os.system("printf '\e[0;31;1;5m°'") os.system("printf '\e[0;35;1;1m)\n'")
267
146
import pytest from affordable_leggins.leggins_list import get_rrp_from_single_site from affordable_leggins.leggins_list import get_list_of_leggins_from_page from affordable_leggins.leggins_list import get_list_of_leggins from affordable_leggins.store import store_data, read_data, read_data_from_database from affordable...
4,754
2,000
import os import re import urllib.request import click import requests from tqdm import tqdm URL_UPTODOWN = 'https://spotify.de.uptodown.com/android/download' URL_GHAPI = 'https://api.github.com/repos/Theta-Dev/Spotify-Gender-Ex/commits/master' URL_RTABLE = 'https://raw.githubusercontent.com/Theta-Dev/Spotify-Gender-...
2,665
872
# Intraday latency check function from datetime import datetime import pytz from datacoco_batch.batch import Batch from datacoco_core.logger import Logger log = Logger() def convert_time(t): # convert naive datetime object to utc aware datetime utc = pytz.utc timetz = utc.localize(t) return timetz ...
2,408
735
import numpy as np class BatchGenerator(object): '''Generator for returning shuffled batches. data_x -- list of input matrices data_y -- list of output matrices batch_size -- size of batch input_size -- input width output_size -- output width mini -- create subsequences for truncating back...
3,633
1,209
#!/usr/bin/env python # -*- coding: utf-8 -*- import open3d as o3d def downSample(pointcloud_file_path, down_sample_cluster_num, save_pointcloud_file_path): print("[INFO][downSample]") print("\t start down sampling pointcloud :") print("\t down_sample_cluster_num = " + str(down_sample_cluster_num) + "..."...
720
248
import asyncio import pickle from congregation.net.messages import * class Handler: def __init__(self, peer, server: [asyncio.Protocol, None] = None): self.peer = peer self.server = server self.msg_handlers = self._define_msg_map() def handle_msg(self, data): """ deter...
3,562
1,103
# coding: utf-8 # # k-means with text data # In this assignment you will # * Cluster Wikipedia documents using k-means # * Explore the role of random initialization on the quality of the clustering # * Explore how results differ after changing the number of clusters # * Evaluate clustering, both quantitatively and q...
44,224
13,582
from machine import UART, Pin import time from httpParser import HttpParser ESP8266_OK_STATUS = "OK\r\n" ESP8266_ERROR_STATUS = "ERROR\r\n" ESP8266_FAIL_STATUS = "FAIL\r\n" ESP8266_WIFI_CONNECTED="WIFI CONNECTED\r\n" ESP8266_WIFI_GOT_IP_CONNECTED="WIFI GOT IP\r\n" ESP8266_WIFI_DISCONNECTED="WIFI DISCONNECT\r\n" ESP826...
18,504
5,822
from datetime import datetime, timezone def get_timestamp_isoformat(): """ Generate a timestampt in iso format. """ dt = datetime.utcnow().replace(microsecond=0).isoformat("T") + "Z" return dt def get_timestamp_unix(): """ Generate a timestampt in unix format. ########.### """ ...
436
142
# -*- coding: utf-8 -*- ''' This script demonstrates using the crab gateway to walk the entire address tree (street and number) of a `gemeente`. ''' from crabpy.client import crab_request, crab_factory from crabpy.gateway.crab import CrabGateway g = CrabGateway(crab_factory()) gemeente = g.get_gemeente_by_id(1) pri...
511
193
"""Foreign Key Solving base class.""" class ForeignKeySolver(): def fit(self, list_of_databases): """Fit this solver. Args: list_of_databases (list): List of tuples containing ``MetaData`` instnces and table dictinaries, which contain table names as in...
1,127
272
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Evaluators. """ # ---------------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------------- # Standard library modules import importlib import time from datetime import date ...
10,963
3,136
#!/usr/bin/env python3 import os from posixpath import normpath path = "///data/video/project1//" normalized_path = os.path.normpath(path) sep_path = normalized_path.split(os.sep) path_tail = sep_path[-1] #last word in path - need to be volume name currentPath = '' for folder in sep_path: if folder: current...
368
121
# MIT License # # Copyright (c) 2018 k1dd00 # # 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, publi...
2,325
773
## メッシュ名をオブジェクト名に変更し、メッシュリンクなオブジェクトを選択 import bpy objects = bpy.data.objects shareObjects = list() ## Deselect All for object in objects: bpy.context.scene.objects[(object.name)].select_set(False) ## Copy Name obj to mesh for obj in objects: if obj.data and obj.data.users == 1: ## if no shared mesh o...
519
197
from telegram.ext import Updater import os from dotenv import load_dotenv load_dotenv() BOT_API = os.getenv("BOT_API") updater = Updater(token=BOT_API, use_context=True) dispatcher = updater.dispatcher import logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', ...
9,311
3,310
#@PydevCodeAnalysisIgnore # XXX This module needs cleanup. from ctypes import * DWORD = c_ulong WORD = c_ushort BYTE = c_byte ULONG = c_ulong LONG = c_long LARGE_INTEGER = c_longlong ULARGE_INTEGER = c_ulonglong HANDLE = c_ulong # in the header files: void * HWND = HANDLE HDC = HANDLE HMODULE = HANDLE HINSTANCE ...
2,387
852
import unittest from models import FeedSet, Base, RSSContent import config import sqlalchemy from sqlalchemy.orm import sessionmaker from unittest.mock import MagicMock from test_data.feedparser_data import fake_response from helpers import RSSContentHelper, FeedSetHelper class TestFeedSet(unittest.TestCase): def ...
2,899
885
## -*- coding: utf-8 -*- """ Created on Tue Sep 26 13:38:17 2017 @author: Administrator """ import dlib import cv2 import numpy as np from sklearn.externals import joblib import os import pathAttributes #ap = argparse.ArgumentParser() #ap.add_argument("-p", "--shape-predictor", metavar="D:\\用户目录\\下载\\sh...
7,474
2,605
from gamegym.game import Game, Situation from gamegym.utils import get_rng from gamegym.distribution import Explicit from gamegym.value_learning.valuestore import LinearValueStore import numpy as np import pytest from scipy.sparse import csr_matrix def test_init(): LinearValueStore(shape=(3, 3)) LinearValueSt...
1,005
393
# Copyright 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" file accompanyin...
9,951
3,068
import os import subprocess import shutil from itertools import chain import __main__ import numpy as np import desicos.abaqus.abaqus_functions as abaqus_functions import desicos.conecylDB as conecylDB import desicos.abaqus.conecyl as conecyl import desicos.abaqus.study as study from desicos.abaqus.constants import ...
21,922
7,705
# -*- coding: utf-8 -*- # # Copyright © 2009 Pierre Raybaut # Licensed under the terms of the MIT License # (see pydeelib/__init__.py for details) """ Text Editor Dialog based on PyQt4 """ # pylint: disable-msg=C0103 # pylint: disable-msg=R0903 # pylint: disable-msg=R0911 # pylint: disable-msg=R0201 f...
2,277
852
from __future__ import annotations from typing import TYPE_CHECKING, List from lxml import etree from .types import ProductSummary, XMLDict from .utils import dict_to_xml, format_price if TYPE_CHECKING: from invoices.models import Invoice, Sender, Address NAMESPACE_MAP = { "p": "http://ivaservizi.agenziae...
5,553
1,698
""" sentry.db.models.fields.foreignkey ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.db.models import ForeignKey __all__ = ('FlexibleForeignKey', ) c...
685
217
# Helper functions to observe files and directories import os import re def collect_directory_contents(directory, file_filter=None, collect_file_contents=False): """ Collect an object reflecting the contents of a directory :param directory: the ...
3,235
824
import operator as op from p4z3.base import log, z3_cast, z3, copy_attrs, copy, gen_instance from p4z3.base import P4ComplexInstance, P4Expression, P4ComplexType class P4Initializer(P4Expression): def __init__(self, val, instance_type=None): self.val = val self.instance_type = instance_type d...
18,611
6,120
# coding:utf-8 #!/usr/bin/python # # Copyright (c) Contributors to the Open 3D Engine Project. # For complete copyright and license terms please see the LICENSE at the root of this distribution. # # SPDX-License-Identifier: Apache-2.0 OR MIT # # # ------------------------------------------------------------------------...
18,597
5,686
import importlib import platform import site import subprocess import sys import traceback class InstallerClass: sci_win = ['python', '-m', 'pip', 'install', 'scikit-learn'] nump_win = ['python', '-m', 'pip', 'install', 'numpy'] pan_win = ['python', '-m', 'pip', 'install', 'pandas'] req_win = ['python...
4,672
1,518
# Copyright (c) 2021 Ichiro ITS # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribu...
5,871
1,645
"""RCNN model """ import tensorflow as tf from define_scope import define_scope # custom decorators class Model: def __init__(self, X, y, output_size=None, learning_rate=1e-5, learning_rate_decay=0.95, reg=1e-5, dropout=0.5, verbose=False): """ Initalize the model. Inputs: - output_size: number of clas...
6,560
2,793
# -*- coding: utf-8 -*- # MIT License # Copyright (c) 2021 Alexsandro Thomas # 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 # ...
4,016
1,224
""" predefined params for openimu """ JSON_FILE_NAME = 'openimu.json' def get_app_names(): ''' define openimu app type ''' app_names = ['Compass', 'IMU', 'INS', 'Leveler', 'OpenIMU', 'VG', 'VG_AHRS', ...
437
152
from flask import Flask, request, Response from flask_cors import CORS import drone_awe import json import copy import traceback import utilities ''' Notes: - Need to disable plotting in the library - if possible remove matplotlib entirely from the library - if possible remove gekko object from a.output in...
4,073
1,134
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Author : @Ruulian_ # Date created : 31 Oct 2021 from random import choice from requests_html import HTMLSession from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.firefox.options import Optio...
25,521
8,858
import json import search import test_data import copy from utils import Error def test_no_args(client): ''' Tests search without arguments. ''' rv = client.get('/search') response = json.loads(rv.data) assert response == {'success': False, 'error': Error.MISSING_KEYWOR...
4,079
1,376