text
string
size
int64
token_count
int64
import sqlite3 import subprocess, datetime from flask import Flask, request, session, g, redirect, url_for, \ abort, render_template, flash from contextlib import closing from tquery import get_latest_record from config import * app = Flask(__name__) app.config.from_object(__name__)...
5,210
1,528
"""Helper functions to tests.""" import numpy as np def norm(vs: np.array) -> float: """Compute the norm of a vector.""" return np.sqrt(np.dot(vs, vs)) def create_random_matrix(size: int) -> np.array: """Create a numpy random matrix.""" return np.random.normal(size=size ** 2).reshape(size, size) ...
818
271
from typing import List class Solution: def findRepeatNumber(self, nums: List[int]) -> int: # solution one: 哈希表 n = len(nums) flag = [False for i in range(n)] for i in range(n): if flag[nums[i]] == False: flag[nums[i]] = True else: ...
1,046
374
import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from gwu_nn.gwu_network import GWUNetwork from gwu_nn.layers import Dense from gwu_nn.activation_layers import Sigmoid np.random.seed(8) num_obs = 8000 # Create our features to draw from two distinct 2D...
1,702
744
import itertools as it import numpy as np import mdtraj as md from progressbar import ProgressBar from scattering.utils.utils import get_dt from scattering.utils.constants import get_form_factor def compute_van_hove(trj, chunk_length, water=False, r_range=(0, 1.0), bin_width=0.005, n_bins=None,...
6,227
1,927
# -*- coding: utf-8 -*- # nn_benchmark # author - Quentin Ducasse # https://github.com/QDucasse # quentin.ducasse@ensta-bretagne.org from __future__ import absolute_import __all__ = ["lenet","lenet5","quant_lenet5", "quant_cnv", "quant_tfc", "mobilenetv1","quant_mobilenetv1", "vggnet...
785
275
#pylint:disable=no-member import cv2 as cv import numpy as np img = cv.imread('/Users/webileapp/Desktop/niharika_files/projects/opencv_course_master/Resources/Photos/cats.jpg') cv.imshow('Cats', img) # blank = np.zeros(img.shape[:2], dtype='uint8') cv.imshow('Blank', blank) gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)...
820
378
from . import fcosr_tools __all__ = ['fcosr_tools']
51
21
# Copyright (c) 2022, Juve and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class Practitioner(Document): def before_save(self): self.practitioner_full_name = f'{self.first_name} {self.second_name or ""}'
287
96
import sys from os import path import urllib; from urllib.request import urlretrieve from subprocess import call def install_hooks(directory): checkstyleUrl = 'https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.36.1/checkstyle-8.36.1-all.jar' preCommitUrl = 'https://gist.githubusercontent....
1,617
581
""" Micro webapp based on WebOb, Jinja2, WSGI with a simple router """ import os import hmac import hashlib import mimetypes from wsgiref.simple_server import WSGIServer, WSGIRequestHandler from webob import Request from webob import Response from jinja2 import Environment, FileSystemLoader class MicroServer(obje...
3,962
1,107
import logging from django.core import mail from django.conf import settings from django.core.management.base import BaseCommand import amo.utils from users.models import UserProfile log = logging.getLogger('z.mailer') FROM = settings.DEFAULT_FROM_EMAIL class Command(BaseCommand): help = "Send the email for bu...
2,234
706
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Specify and constraints to determine which targets are observable for an observer. """ from __future__ import (absolute_import, division, print_function, unicode_literals) # Standard library from abc import ABCMeta, abstractme...
49,605
13,985
from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.core.urlresolvers import reverse from django.shortcuts import render from django.http import HttpResponseRedirect from core.models import Po...
6,191
1,869
import dataclasses import io import multiprocessing as _mp import uuid import zipfile from concurrent.futures import Future from multiprocessing.connection import Connection from typing import List, Optional, Tuple import numpy from tiktorch import log from tiktorch.rpc import Shutdown from tiktorch.rpc import mp as ...
2,953
956
from openpype.modules.ftrack.lib import BaseEvent from openpype.modules.ftrack.lib.avalon_sync import CUST_ATTR_ID_KEY from openpype.modules.ftrack.event_handlers_server.event_sync_to_avalon import ( SyncToAvalonEvent ) class DelAvalonIdFromNew(BaseEvent): ''' This event removes AvalonId from custom attri...
1,816
505
import unittest import tests.settings_mock as settings_mock from tests.activity.classes_mock import FakeLogger from workflow.workflow_IngestAcceptedSubmission import workflow_IngestAcceptedSubmission class TestWorkflowIngestAcceptedSubmission(unittest.TestCase): def setUp(self): self.workflow = workflow_I...
518
147
from urllib import urlencode import urlparse from django.shortcuts import Http404, redirect from django.contrib.auth.views import logout from django.contrib import messages from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from vumi.utils import load_class_by_strin...
2,436
729
from typogrify.filters import amp, caps, initial_quotes, smartypants, titlecase, typogrify, widont, TypogrifyError from functools import wraps from django.conf import settings from django import template from django.utils.safestring import mark_safe from django.utils.encoding import force_unicode register = template....
1,142
351
"""Read, write, create Brainvoyager VMR file format.""" import struct import numpy as np from bvbabel.utils import (read_variable_length_string, write_variable_length_string) # ============================================================================= def read_vmr(filename): """Read...
18,065
5,195
# 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...
2,279
833
# (c) Copyright [2018-2022] Micro Focus or one of its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # You may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
139,271
39,423
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ example.py ~~~~~~~~~ A simple command line application to run flask apps. :copyright: 2019 Miller :license: BSD-3-Clause """ # Known bugs that can't be fixed here: # - synopsis() cannot be prevented from clobbering existing # loaded modules. ...
6,918
2,246
from enum import Enum class content_type(Enum): # https://www.iana.org/assignments/media-types/media-types.xhtml css = 'text/css' gif = 'image/gif' htm = 'text/html' html = 'text/html' ico = 'image/bmp' jpg = 'image/jpeg' jpeg = 'image/jpeg' js = 'application/javascript' png = ...
429
164
# -*- coding: utf-8 -*- __author__ = """Hendrix Demers""" __email__ = 'hendrix.demers@mail.mcgill.ca' __version__ = '0.1.0'
125
61
import os import logging from tempfile import mkstemp, mkdtemp from shutil import rmtree from zipfile import ZipFile, ZIP_DEFLATED from datetime import datetime from boto.s3.connection import S3Connection from boto.s3.key import Key __version__ = "0.1.8" __author__ = "Mark Embling" __email__ = "mark@markembling.info" ...
4,082
1,172
# Generated by Django 2.0.2 on 2019-03-08 13:03 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Delivery', fields=[ ('create_time', models....
963
328
#!/usr/bin/env python3 def date_time(time): months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] hour, minute = int(time[11:13]), int(time[14:16]) return f"{int(time[0:2])} {months[int(time[3:5])-1]} {time[6:10]} year {h...
721
330
# Copyright (c) 2017, Neil Booth # # All rights reserved. # # The MIT License (MIT) # # 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...
10,361
3,034
"""Test deCONZ diagnostics.""" from unittest.mock import patch from pydeconz.websocket import STATE_RUNNING from homeassistant.const import Platform from .test_gateway import DECONZ_CONFIG, setup_deconz_integration from tests.components.diagnostics import get_diagnostics_for_config_entry async def test_entry_dia...
1,787
542
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
32,821
10,800
"""Run from rhucrl_experiments.evaluate folder.""" import socket from lsf_runner import init_runner, make_commands from rhucrl_experiments.evaluate.utilities import ENVIRONMENTS RARL_DIR = "../../runs/RARLAgent" ZERO_SUM_DIR = "../../runs/ZeroSumAgent" SCRIPT = "evaluate_mass_change.py" EXPERIMENTS = { "supermod...
964
384
from __future__ import absolute_import import six from rest_framework.response import Response from sentry.api.bases.project import ProjectEndpoint from sentry.models import TagKey, TagKeyStatus class ProjectTagsEndpoint(ProjectEndpoint): def get(self, request, project): tag_keys = TagKey.objects.filte...
739
208
from __future__ import print_function # For Py2/3 compatibility import async_eel import random import asyncio loop = asyncio.get_event_loop() @async_eel.expose async def py_random(): return random.random() async def print_num(n): """callback of js_random""" print('Got this from Javascript:', n) asyn...
871
285
# coding=utf-8 """ Access methods for indexing datasets & products. """ import logging from datacube.config import LocalConfig from datacube.drivers import index_driver_by_name, index_drivers from .index import Index _LOG = logging.getLogger(__name__) def index_connect(local_config=None, application_name=None, val...
1,578
426
#!/usr/bin/env python3 # # load_message.py - takes a single email or mbox formatted # file on stdin or in a file and reads it into the database. # import os import sys from optparse import OptionParser from configparser import ConfigParser import psycopg2 from lib.storage import ArchivesParserStorage from lib.mbox ...
6,560
2,015
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-03-10 14:30 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shop', '0008_auto_20200310_1134'), ] operations =...
860
288
from dataset.baseset import BaseSet import random, cv2 import numpy as np class iNaturalist(BaseSet): def __init__(self, mode='train', cfg=None, transform=None): super(iNaturalist, self).__init__(mode, cfg, transform) random.seed(0) self.class_dict = self._get_class_dict() ...
1,351
476
# -*- coding: utf-8 -*- import mock from nose.tools import * # noqa (PEP8 asserts) import hmac import hashlib from StringIO import StringIO from django.core.exceptions import ValidationError from django.db import IntegrityError import furl from framework.auth import get_or_create_user from framework.auth.core impo...
27,964
8,547
import socketserver import socket import sys import threading import json import queue import time import datetime import traceback class TCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): def server_bind(self): self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.soc...
4,060
1,172
# -*- coding: ascii -*- import sys import json def check(data): OnOffstart = data.find(b"OnOff") if OnOffstart != -1: fxName="" OnOffblockSize = 0x30 for j in range(12): if data[OnOffstart + j + OnOffblockSize] == 0x00: break fxName ...
3,917
1,291
# 随机6位密码 a-zA-Z0-9下划线 import random source = '' lower_char = [chr(x) for x in range(ord('a'), ord('z') + 1)] upper_char = [chr(x) for x in range(ord('A'), ord('Z') + 1)] number_char = [chr(x) for x in range(ord('0'), ord('9') + 1)] source += "".join(lower_char) source += "".join(upper_char) source += "".join(number_ch...
475
222
from django.test import TestCase from rest_framework.test import APIRequestFactory from .models import GBIC, GBICType from .views import GBICListViewSet # Create your tests here. class GBICTest(TestCase): def test_gbic_view_set(self): request = APIRequestFactory().get("") gbic_detail = GBICListVi...
1,237
420
import inspect from typing import List, Union, Set, Any import numpy as np from fruits.cache import Cache, CoquantileCache from fruits.scope import force_input_shape, FitTransform from fruits.core.callback import AbstractCallback from fruits.signature.iss import SignatureCalculator, CachePlan from fruits.words.word i...
23,239
6,544
import os import argparse import subprocess import socket import sys import click from django.core.management import execute_from_command_line from workoutizer.settings import WORKOUTIZER_DIR, WORKOUTIZER_DB_PATH, TRACKS_DIR from workoutizer import __version__ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SE...
9,863
3,128
"""Provide trimming of input reads from Fastq or BAM files. """ import os import sys import tempfile from bcbio.utils import (file_exists, safe_makedir, replace_suffix, append_stem, is_pair, replace_directory, map_wrap) from bcbio.log import logger from bcbio.bam impor...
8,807
2,978
from rest_framework.response import Response from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from dashboard.models import projects from .models import AnalysisConfig, SolverResults, SolverProgress, DockerLogs from rest_framework.parsers import FormParser, JSONParser, MultiPartPar...
13,419
3,699
# coding: utf-8 """``AppFS`` opener definition. """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from .base import Opener from .errors import OpenerError from ..subfs import ClosingSubFS from .. import appfs class AppFSOpener(Opener): """``...
1,627
500
import numpy as np from sklearn.metrics import fbeta_score, roc_curve, auc, confusion_matrix from sklearn.decomposition import PCA from sklearn import random_projection from sklearn import svm from sklearn.ensemble import IsolationForest import matplotlib.pyplot as plt from keras.layers import Dense, Input, Dropout fro...
23,180
7,206
# encoding: utf-8 import unittest import os import sys sys.path.append(os.getcwd()) from notifo import Notifo, send_message class TestNotifyUser(unittest.TestCase): def setUp(self): self.provider = "test_provider" self.provider_banned = "test_provider_msg_banned" self.user = "test_user" ...
1,896
711
#!/usr/bin/env python # -*- coding: utf-8 -*- # import numpy as np import .Selection as Sel import .Exploration as Exp import .CatUtils as CU #----------------------------------------------------------------------------------------- def GaussWin (Dis, Sig): return np.exp(-(Dis**2)/(Sig**2.)) #------------------...
1,931
752
from typing import List from presidio_analyzer import EntityRecognizer, RecognizerResult, AnalysisExplanation from presidio_analyzer.nlp_engine import NlpArtifacts from hebsafeharbor.common.terms_recognizer import TermsRecognizer class LexiconBasedRecognizer(EntityRecognizer): """ A class which extends the E...
2,759
725
# encoding: utf-8 # # Copyright (C) 2018 ycmd contributors # # This file is part of ycmd. # # ycmd is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
35,966
12,959
""" Config class containing all the settings for running sentiment scoring tool """ import jsonpickle class Config(object): """Container for sentiment scoring tool settings. """ def __init__(self): """Initializes the Config instance. """ #Elasticsearch settings self.elasti...
1,032
300
# Copyright 2020 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 agreed to...
9,184
2,938
from parameterized import parameterized from numpy.testing import TestCase from .. import candy class TestCollectCandies(TestCase): @parameterized.expand( [(5, 5, 12, [[2, 1, 1, 1, 1], [2, 2, 1, 1, 1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 3], [2, 2, 2, 2, 2]])] ) def test_candy(self...
748
311
import time import subprocess import os print os.uname() if not os.uname()[0].startswith("Darw"): import pygame pygame.mixer.init() # Plays a song def playSong(filename): print "play song" if not os.uname()[0].startswith("Darw"): pygame.mixer.music.fadeout(1000) #fadeout current music over 1 sec. pygame.m...
442
176
from __future__ import absolute_import, unicode_literals, print_function import mock import unittest import d43_aws_tools as aws_tools from boto3.dynamodb.conditions import Attr class DynamoDBHandlerTests(unittest.TestCase): @classmethod def setUpClass(cls): with mock.patch("d43_aws_tools.dynamodb_han...
4,783
1,432
from dash import Dash, html, dcc import plotly.express as px import pandas as pd app = Dash(__name__) server = app.server # assume you have a "long-form" data frame # see https://plotly.com/python/px-arguments/ for more options df = pd.DataFrame({ "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Ba...
799
295
# pypi import six # local from ...lib import db as lib_db from ...lib import utils from ...model import objects as model_objects from ...model import utils as model_utils from . import formhandling # ============================================================================== def decode_args(getcreate_args): ...
23,759
6,676
# # Copyright 2020–2021 Xilinx, 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 # # Unless required by applicable law or agreed to in w...
5,568
1,943
item1='phone' item1_price = 100 item1_quantity = 5 item1_price_total = item1_price * item1_quantity print(type(item1)) # str print(type(item1_price)) # int print(type(item1_quantity)) # int print(type(item1_price_total)) # int # output: # <class 'str'> # <class 'int'> # ...
357
133
_base_ = "./FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan.py" OUTPUT_DIR = "output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/16_36WoodBlock" DATASETS = dict(TRAIN=("ycbv_036_woo...
342
193
from .columns import OC from .paging import get_page, select_page, process_args from .results import serialize_bookmark, unserialize_bookmark, Page, Paging __all__ = [ 'OC', 'get_page', 'select_page', 'serialize_bookmark', 'unserialize_bookmark', 'Page', 'Paging', 'process_args' ]
316
113
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
6,609
2,051
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import time import board import busio from adafruit_icm20x import ICM20948 cycles = 200 i2c = busio.I2C(board.SCL, board.SDA) icm = ICM20948(i2c) # Cycle between two data rates # Best viewed in the Mu serial plotter where y...
721
295
a = int(input()) while a: for x in range(a-1): out = '*' + ' ' * (a-x-2) + '*' + ' ' * (a-x-2) + '*' print(out.center(2*a-1)) print('*' * (2 * a - 1)) for x in range(a-1): out = '*' + ' ' * x + '*' + ' ' * x + '*' print(out.center(2*a-1)) a = int(input())
304
147
import datetime import json import os from pathlib import Path from types import SimpleNamespace from typing import List from typing import NamedTuple, Union, Optional, Callable from uuid import uuid3, NAMESPACE_DNS from dateutil.parser import parse _VIDEO_SUFFIXES = [".mkv", ".mp4"] _IMAGE_SUFFIXES = [".jpg"] _PERMI...
8,032
2,682
# Generated by Django 2.2.1 on 2019-09-27 14:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('schoolio', '0004_auto_20190927_0405'), ] operations = [ migrations.AlterField( model_name='student_assessment', name...
807
260
class Dataset: _data = None _first_text_col = 'text' _second_text_col = None _label_col = 'label' def __init__(self): self._idx = 0 if self._data is None: raise Exception('Dataset is not loaded') def __iter__(self): return self def __next__(self): ...
1,733
522
#!/usr/bin/env python3 # This Source Code Form is subject to the terms of the MIT # License. If a copy of the same was not distributed with this # file, You can obtain one at # https://github.com/akhilpandey95/scholarlyimpact/blob/master/LICENSE. import os import csv import glob import json import requests import sub...
7,732
2,129
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pathobject.py __version__=''' $Id$ ''' __doc__=""" PDFPathObject is an efficient way to draw paths on a Canvas. Do not instantiate directly, obt...
4,672
1,645
import wikipedia import re import TCPclient as client WORDS = ["WIKIPEDIA","SEARCH","INFORMATION"] def handle(text,mic,profile): # SEARCH ON WIKIPEDIA # ny = wikipedia.summary("New York",sentences=3); # mic.say("%s"% ny) #mic.say("What you want to search about") #text = mic.activeListen() print "entering wik...
687
267
import random print("Title : Eat, Drink, And Be Sick") noun = [] for i in range(4): n = input("Enter noun : ") noun.append(n) plural = [] for i in range(6): pn = input("Enter plural noun : ") plural.append(pn) adjective = [] for i in range(2): a = input("Enter adjective : ") adjective.append(a) ...
1,447
464
import numpy g = open('/home/srallaba/mgc/transposed/arctic_a0404.mgc','w') x = numpy.loadtxt('/home/srallaba/mgc_spaces/arctic_a0404.mgc') numpy.savetxt(g, numpy.transpose(x)) g.close()
191
91
from zone_api.core.zone_manager import ZoneManager from zone_api import platform_encapsulator as pe from zone_api.core.zone import Zone from zone_api.core.zone_event import ZoneEvent from zone_api.core.devices.dimmer import Dimmer from zone_api.core.devices.switch import Fan, Light, Switch from zone_api.core.devices.i...
7,337
2,486
from rest_framework.response import Response from rest_framework.views import APIView from django_redis import get_redis_connection from goods.models import SKU from decimal import Decimal from rest_framework.generics import CreateAPIView,ListAPIView from rest_framework.mixins import ListModelMixin from orders.serializ...
2,796
988
import argparse import errno import logging import os import platform import signal import sys from collections import OrderedDict from contextlib import closing from distutils.version import StrictVersion from functools import partial from gettext import gettext from itertools import chain from pathlib import Path fro...
37,841
11,000
from io import BytesIO from io import StringIO import json from bson.dbref import DBRef import datetime from bson import json_util import logging import base64 jsonCode ={ "building":{ "Essae Vaishnavi Solitaire": { "id": "B1", "division": { "SS"...
16,807
4,885
# python3 # coding=utf-8 # Copyright 2020 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 ...
3,489
1,249
from django.core.management.base import BaseCommand import logging import re from talentmap_api.common.xml_helpers import XMLloader, strip_extra_spaces, parse_boolean, parse_date, get_nested_tag from talentmap_api.language.models import Language, Proficiency from talentmap_api.position.models import Grade, Skill, Pos...
10,781
3,731
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unit tests for gluon.recfile """ import unittest import os import shutil import uuid from .fix_path import fix_sys_path fix_sys_path(__file__) from gluon import recfile class TestRecfile(unittest.TestCase): def setUp(self): os.mkdir('tests') d...
2,581
798
import json import os import subprocess from dotenv import load_dotenv from subprocess import check_output, Popen, PIPE load_dotenv() # Accessing variables. CLIENT_ID = os.environ.get('CLIENT_ID') CLIENT_SECRET = os.environ.get('CLIENT_SECRET') USERNAME = os.environ.get('USERNAME') BUCKET_NAME = os.environ.get('BUCK...
1,022
339
# -*- coding: utf-8 -*- ########################################################################### ## Python code generated with wxFormBuilder (version Aug 8 2018) ## http://www.wxformbuilder.org/ ## ## PLEASE DO *NOT* EDIT THIS FILE! ########################################################################### impo...
13,520
5,594
""" dependencies.contrib.celery --------------------------- This module implements injectable Celery task. :copyright: (c) 2016-2020 by dry-python team. :license: BSD, see LICENSE for more details. """ from _dependencies.contrib.celery import shared_task from _dependencies.contrib.celery import task __all__ = ["sha...
339
109
"""Miscellaneous utility functions.""" from functools import reduce from PIL import Image import numpy as np from matplotlib.colors import rgb_to_hsv, hsv_to_rgb def compose(*funcs): """Compose arbitrarily many functions, evaluated left to right. Reference: https://mathieularose.com/function-composition-in-...
7,838
3,679
import logging import pathlib logging.basicConfig(level=logging.INFO) # Dirs ROOT_DIR = pathlib.Path(__file__).parent.absolute() DUMP_DIR = ROOT_DIR / 'dumps'
161
58
import re from pyquery import PyQuery as pq from .. import utils from .constants import RANKINGS_SCHEME, RANKINGS_URL from six.moves.urllib.error import HTTPError class Rankings: """ Get all Associated Press (AP) rankings on a week-by-week basis. Grab a list of the rankings published by the Associated Pr...
8,482
2,195
import importlib from ditk import logging from collections import OrderedDict from functools import wraps import ding ''' Overview: `hpc_wrapper` is the wrapper for functions which are supported by hpc. If a function is wrapped by it, we will search for its hpc type and return the function implemented by hpc. ...
5,937
1,936
#Return the count of int(s) in passed array. def number_of_occurrences(s, xs): return xs.count(s)
102
38
import re from zlib import crc32 from ..utils import snake_to_camel_case CORE_TYPES = ( 0xbc799737, # boolFalse#bc799737 = Bool; 0x997275b5, # boolTrue#997275b5 = Bool; 0x3fedd339, # true#3fedd339 = True; 0x1cb5c415, # vector#1cb5c415 {t:Type} # [ t ] = Vector t; ) # https://github.com/telegramde...
10,343
3,175
"Actions for compiling resx files" load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetResourceInfo", ) def _make_runner_arglist(dotnet, source, output, resgen): args = dotnet.actions.args() if type(source) == "Target": args.add_all(source.files) else: args.add(so...
2,469
740
# Owner(s): ["oncall: jit"] import torch import os import sys from torch.testing._internal.jit_utils import JitTestCase # Make the helper files in test/ importable pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(pytorch_test_dir) if __name__ == '__main__': raise Ru...
1,035
334
import gym import pix_sample_arena import time import pybullet as p import pybullet_data import cv2 if __name__ == "__main__": env = gym.make("pix_sample_arena-v0") x = 0 while True: p.stepSimulation() time.sleep(100)
242
92
from datetime import time import pytest from i3_battery_block_vgg.timeparser import __parse_time_manually from i3_battery_block_vgg.timeparser import parse_time @pytest.mark.parametrize( "time_input, expected", [ ("12:13", time(hour=12, minute=13)), ("12:13:14", time(hour=12, minute=13, seco...
916
360
# RUN: %PYTHON% %s 2>&1 | FileCheck %s from __future__ import annotations import mlir import pycde from pycde import (Input, Output, Parameter, module, externmodule, generator, types, dim) from circt.dialects import comb, hw @module def PolynomialCompute(coefficients: Coefficients): class Pol...
4,720
1,897
#! /usr/bin/env python import arc import sys import os def retrieve(uc, endpoints): # The ComputingServiceRetriever needs the UserConfig to know which credentials # to use in case of HTTPS connections retriever = arc.ComputingServiceRetriever(uc, endpoints) # the constructor of the ComputingServiceRetr...
3,430
1,101
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
46,071
13,316
"""For neatly implementing static typing in packaging. `mypy` - the static type analysis tool we use - uses the `typing` module, which provides core functionality fundamental to mypy's functioning. Generally, `typing` would be imported at runtime and used in that fashion - it acts as a no-op at runtime and does not h...
1,755
488
from cereal import car from common.numpy_fast import clip, interp from selfdrive.car import apply_toyota_steer_torque_limits, create_gas_interceptor_command, make_can_msg from selfdrive.car.toyota.toyotacan import create_steer_command, create_ui_command, \ create_accel_command...
7,024
2,629