text string | size int64 | token_count int64 |
|---|---|---|
from django.utils import timezone
from django.utils.translation import ugettext
from mediane.algorithms.enumeration import get_name_from
from mediane.algorithms.lri.BioConsert import BioConsert
from mediane.algorithms.lri.ExactAlgorithm import ExactAlgorithm
from mediane.algorithms.misc.borda_count import BordaCount
f... | 8,792 | 2,660 |
def percentage_format(x: float) -> str:
return f"{(x * 100):.1f}%"
| 71 | 32 |
# Generated by Django 2.2.2 on 2020-05-08 12:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0002_auto_20200508_1115'),
]
operations = [
migrations.AlterField(
model_name='yourorder',
name='phone',
... | 399 | 147 |
from .map import Map
print("Soon... https://github.com/pybomberman/pybomberman")
| 82 | 32 |
"""JSON Schemas."""
import csv
from collections import defaultdict
from datetime import date
from os.path import dirname, join, realpath
from flask import current_app
from marshmallow import Schema, fields
from cd2h_repo_project.modules.records.resource_type import ResourceType
class DataCiteResourceTypeMap(object)... | 3,935 | 1,129 |
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""
:mod:`dazl.model` package
=========================
This module is deprecated. These types have generally moved to :mod:`dazl.client` (for the API
introduced in dazl v5) or ... | 1,068 | 370 |
from cinder.openstack.common import log as logging
from cinder.openstack.common.scheduler import filters
from cinder.openstack.common.scheduler.filters import extra_specs_ops
LOG = logging.getLogger(__name__)
class StorageProtocolFilter(filters.BaseHostFilter):
"""StorageProtocol filters based on volume host's ... | 1,559 | 398 |
import sys
from copy import deepcopy
mass_file=open('integer_mass_table.txt')
mass_table = {}
for line in mass_file:
aa, mass = line.rstrip().split(' ')
mass_table[int(mass)] = aa
# mass_table[4] = 'X'
# mass_table[5] = 'Z'
def PeptideSequencing(spectral_vector):
spectral_vector = [0] + spectral_vector
... | 1,771 | 607 |
#!/usr/bin/env python3
import unittest
import torch
from gpytorch.distributions import MultitaskMultivariateNormal
from gpytorch.lazy import KroneckerProductLazyTensor, RootLazyTensor
from gpytorch.likelihoods import MultitaskGaussianLikelihood
from gpytorch.test.base_likelihood_test_case import BaseLikelihoodTestCa... | 2,465 | 873 |
import zipfile
import sys
for arg in sys.argv[1:]:
senha = str(arg)
z = zipfile.ZipFile("protegido.zip")
files = z.namelist()
z.setpassword(senha)
z.extractall()
z.close()
for extracted_file in files:
print "Nome do arquivo: "+extracted_file+"\n\nConteudo: "
with open(extracted_file) as f:
... | 399 | 153 |
from django import forms
from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
from django.contrib.auth.models import User
from .models import Profile,Project,Review
class RegForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ('usernam... | 948 | 254 |
import subprocess
from setuptools import setup, Extension
try:
pandoc = subprocess.Popen(['pandoc', 'README.md', '--to', 'rst'],
stdout=subprocess.PIPE)
readme = pandoc.communicate()[0].decode()
except OSError:
with open('README.md') as f:
readme = f.read()
cmdclass... | 1,269 | 427 |
#!/usr/bin/python
#coding = utf-8
import numpy as np
import pandas as pd
import mysql.connector
class mysqlTool():
"""
This is the API to connect with mysql database.
"""
def __init__(self,databaseNameString:str,hostAddress:str,userName:str,passWord:str):
self.targetDB = mysql.connector.connect(
host = hostA... | 8,830 | 3,205 |
data_size_plus_header = 1000001
train_dir = 'train'
subset_train_dir = 'sub_train.txt'
fullfile = open(train_dir, 'r')
subfile = open(subset_train_dir,'w')
for i in range(data_size_plus_header):
subfile.write(fullfile.readline())
fullfile.close()
subfile.close()
| 270 | 109 |
import json
import os
import traceback
from datetime import datetime
from uuid import uuid4
import boto3
from aws.ssm import get_ssm_params
from database import Jobs
from gp_file_parser.parser import parse_gp_extract_file_s3
from jobs.statuses import InputFolderType, InvalidErrorType, JobStatus, ParseStatus
from lr_lo... | 12,095 | 3,455 |
"""
NOAA/ESRL/PSD Jython functions
"""
def calcMonAnom(monthly, ltm, normalize=0):
""" Calculate the monthly anomaly from a long term mean.
The number of timesteps in ltm must be 12
"""
from visad import VisADException
monAnom = monthly.clone()
months = len(ltm)
if (not months == 12):
raise VisAD... | 1,258 | 439 |
from bitmovin_api_sdk.account.organizations.groups.groups_api import GroupsApi
from bitmovin_api_sdk.account.organizations.groups.tenants.tenants_api import TenantsApi
from bitmovin_api_sdk.account.organizations.groups.invitations.invitations_api import InvitationsApi
from bitmovin_api_sdk.account.organizations.groups.... | 370 | 109 |
long_number = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930358... | 1,268 | 1,117 |
from django.shortcuts import render
# Create your views here.
from django.views.generic import TemplateView
from . import models, serializers
class HomeView(TemplateView):
template_name = 'Data.html'
class FrontView(TemplateView):
template_name = 'index.html'
| 272 | 77 |
import numpy as np
import random
N = 10
def null(a, rtol=1e-5):
u, s, v = np.linalg.svd(a)
rank = (s > rtol*s[0]).sum()
return rank, v[rank:].T.copy()
def gen_data(N, noisy=False):
lower = -1
upper = 1
dim = 2
X = np.random.rand(dim, N)*(upper-lower)+lower
while True:
Xsa... | 755 | 330 |
# Copyright 2018 Oursky 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 in writing, ... | 4,431 | 1,524 |
# Copyright 2018 Cristian Mattarei
#
# Licensed under the modified BSD (3-clause BSD) License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the ... | 9,213 | 3,007 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 6,767 | 1,967 |
# -*-coding: utf-8 -*-
"""
@Author : panjq
@E-mail : pan_jinquan@163.com
@Date : 2021-07-28 15:32:44
"""
import torch
import torch.optim as optim
import torch.nn as nn
import numpy as np
from .WarmUpLR import WarmUpLR
from ..callbacks.callbacks import Callback
class MultiStepLR(Callback):
def __ini... | 2,952 | 1,078 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import os
import yaml
from tools.times import timestamp
from config.conf import ELEMENT_PATH, LOCATE_MODE
def inspect_element():
"""审查所有的元素是否正确"""
start_time = timestamp()
for i in os.listdir(ELEMENT_PATH):
_path = os.path.join(ELEMENT_PATH, i)
... | 1,232 | 451 |
from pathlib import Path
import sys
import yaml
import typing as t
import click
import requests
from rich.panel import Panel
from rich.pretty import Pretty
from fs import open_fs
from starwhale.base.store import LocalStorage
from starwhale.consts import (
DEFAULT_DATASET_YAML_NAME,
DEFAULT_MANIFEST_NAME,
... | 7,201 | 2,164 |
#!/usr/bin/env python
__author__ = "Mario Carrillo"
import random
import time
import argparse
from influxdb import InfluxDBClient
INFLUX_SERVER = ""
INFLUX_PORT = ""
INFLUX_PASS = ""
INFLUX_USER = ""
def send_data(json_file):
client = InfluxDBClient(INFLUX_SERVER, INFLUX_PORT,
... | 2,578 | 843 |
import typer
from .dice import roll, roll_from_string
app = typer.Typer()
@app.command("hello")
def hello_world():
"""our first CLI with typer!
"""
typer.echo("Opening blog post...")
typer.launch(
"https://pluralsight.com/tech-blog/python-cli-utilities-with-poetry-and-typer"
)
@app.com... | 1,767 | 639 |
#!/usr/bin/env python
import numpy
import itertools
from pymatgen.core.lattice import Lattice
from pymatgen.core.operations import SymmOp
from pymatgen.core.structure import Structure
from crystal import fillcell, tikz_atoms
def dfh(single = True, defect = False):
if defect:
single = False
a = 5.43
... | 2,311 | 941 |
import argparse
import os.path
from .instagram.post import Downloader
from .instagram.url import URLScraper
from .utils.webaddr import get_url, validate_url
from .web.client import HTTPHeaders
from .web.geckoloader import GeckoLoader
def get_arguments():
"""Get arguments passed to the program by the user."""
... | 3,458 | 1,035 |
import logging
def create_app(config=None, testing=False):
from airflow.www_rbac import app as airflow_app
app, appbuilder = airflow_app.create_app(config=config, testing=testing)
# only now we can load view..
# this import might causes circular dependency if placed above
from dbnd_airflow.airfl... | 649 | 197 |
"""Generate a random string."""
# pyright: reportIncompatibleMethodOverride=none
from __future__ import annotations
import logging
import secrets
import string
from typing import TYPE_CHECKING, Any, Callable, List, Sequence, Union
from typing_extensions import Final, Literal
from ...utils import BaseModel
from .base... | 3,793 | 1,118 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Loki module for Exchange
Input:
inputSTR str,
utterance str,
args str[],
resultDICT dict
Output:
resultDICT dict
"""
DEBUG_Exchange = True
userDefinedDICT = {"歐元":"EUR",
... | 4,523 | 1,828 |
import pywintypes
import struct
import win32event, win32api
import os
import win32com.directsound.directsound as ds
def wav_header_pack(wfx, datasize):
return struct.pack(
"<4sl4s4slhhllhh4sl",
"RIFF",
36 + datasize,
"WAVE",
"fmt ",
16,
wfx.wFormatTag,
... | 1,396 | 589 |
# coding: utf-8
"""
@brief test log(time=1s)
"""
import unittest
import pandas
import numpy
from scipy.sparse.linalg import lsqr as sparse_lsqr
from pyquickhelper.pycode import ExtTestCase, ignore_warnings
from pandas_streaming.df import pandas_groupby_nan, numpy_types
class TestPandasHelper(ExtTestCase):
d... | 5,322 | 1,785 |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classification.tl_classifier import TLCla... | 6,769 | 2,021 |
#Import required Modules:
import pygame
import constants
from paddle import Paddle
from ball import Ball
from score import Score
from text import Text
from screenState import ScreenState
#This function basically executes everything in the "screenState" module's class
def init():
#Initialize all the c... | 1,601 | 569 |
class Game:
def __init__(self,span=[0,100],sub_fun="Square"):
self.span=span
self.func_dict = {
"Square":lambda x: pow(x,2),
"Odd":lambda x: 1 + (x-1)*2,
"Even":lambda x: x*2,
"Identity":lambda x: x,
"Logarithm":lambda x: pow(10,x-1)
... | 1,965 | 578 |
from .FirewallName import FirewallName
from .FirewallUUID import FirewallUUID
from .FirewallAccessLayer import FirewallAccessLayer
class Firewall(object):
def __init__(self, uuid: FirewallUUID, name: FirewallName, access_layer: FirewallAccessLayer):
self.uuid = uuid
self.name = name
self.... | 983 | 295 |
# -*- coding: utf-8 -*-
__author__ = 'ivanov'
import pymysql
# соединяемся с базой данных
connection = pymysql.connect(host="localhost", user="root", passwd="1112223334", db="testdb", charset='utf8', cursorclass=pymysql.cursors.DictCursor)
try:
with connection.cursor() as cursor:
#create new record
# ... | 3,479 | 1,128 |
from torchvision.datasets import MNIST
from torchvision import transforms
import pytorch_lightning as pl
from torch.utils.data import DataLoader, random_split
from multiprocessing import cpu_count
from typing import Any, Optional, Union
from pl_bolts.datamodules import CIFAR10DataModule
from pl_bolts.transforms.datas... | 3,461 | 1,101 |
import tensorflow as tf
from typing import List
from ..utils.tf_utils import gen_CNN
from ...utils import MODEL
from ..utils.pointnet import pointnet2_utils
class Pointnet2MSG(tf.keras.layers.Layer):
def __init__(
self,
in_channels=6,
use_xyz=True,
SA_config={
... | 9,678 | 2,925 |
import argparse
import json
from easydict import EasyDict
def get_args():
argparser = argparse.ArgumentParser(description=__doc__)
argparser.add_argument(
'-c', '--config',
metavar='C',
default=None,
help='The Configuration file')
argparser.add_argument(
'-i', '--id... | 1,374 | 430 |
import shutil
import numpy as np
ALL_SYNTHS_LIST = 'synth_imgs.txt'
TRAIN_IMAGES_LIST = 'train_imgs.txt'
VAL_IMAGES_LIST = 'val_imgs.txt'
TEST_IMAGES_LIST = 'test_imgs.txt'
TRAIN_STOP = 342000
VAL_STOP = TRAIN_STOP + 38000
'''
390000 examples : 342000 train and 38000 val (90/10 splits on 380000), 10000 test
'''
wi... | 1,887 | 807 |
from typing import List
from typing import Optional
from pydantic import BaseModel
class WebFingerRequest(BaseModel):
rel: Optional[str] = 'http://openid.net/specs/connect/1.0/issuer'
resource: str
class AuthorizationRequest(BaseModel):
acr_values: Optional[List[str]]
claims: Optional[dict]
cla... | 803 | 261 |
import importlib
import json
import os
import pdb
import sys
import fnet
import pandas as pd
import tifffile
import numpy as np
from fnet.transforms import normalize
def pearson_loss(x, y):
#x = output
#y = target
vx = x - torch.mean(x)
vy = y - torch.mean(y)
cost = torch.sum(vx * vy) / (torch.sq... | 3,957 | 1,521 |
import os
import pandas as pd
import pymongo
import requests
import time
from splinter import Browser
from bs4 import BeautifulSoup
from selenium import webdriver
print(os.path.abspath("chromedriver.exe"))
def init_browser():
executable_path = {"executable_path": os.path.abspath("chromedriver.exe")}
return B... | 3,151 | 1,108 |
import json
import pytest
from indy_common.constants import JSON_LD_CONTEXT, RS_CONTEXT_TYPE_VALUE, RS_ID, GET_RICH_SCHEMA_OBJECT_BY_ID, \
GET_RICH_SCHEMA_OBJECT_BY_METADATA, RS_NAME, RS_VERSION, RS_TYPE
from indy_node.test.api.helper import sdk_build_rich_schema_request, sdk_write_rich_schema_object_and_check
fr... | 3,989 | 1,307 |
# -*- coding: utf-8 -*-
# @Time : 2021/01/05 22:53:23
# @Author : ddvv
# @Site : https://ddvvmmzz.github.io
# @File : about.py
# @Software: Visual Studio Code
__all__ = [
"__author__",
"__copyright__",
"__email__",
"__license__",
"__summary__",
"__title__",
"__uri__",
"__ver... | 613 | 282 |
import random
from torchvision.transforms import functional as F
from torchvision.transforms import transforms
from PIL import Image | 135 | 35 |
from __future__ import annotations
from sourse.ui.modules.base_qdockwidget_module import BaseUIModule
from PyQt5 import QtWidgets, QtCore, QtGui
from sourse.marketmaker import MarketMaker
import typing
import json
class InputFormat:
def __init__(
self,
widget_type: typing.Type[QtWidgets.QWidget],... | 13,332 | 3,722 |
import lyricsgenius
geniustoken = "Akf1AHXpbqaKHSQ06hesk8q1urZkHWJ334bzLr1SwZ1BBPSMGUm3NcbcbDR8ye7Z"
genius = lyricsgenius.Genius(geniustoken)
songname = input("")
def lysearch(songname):
import lyricsgenius
geniustoken = "Akf1AHXpbqaKHSQ06hesk8q1urZkHWJ334bzLr1SwZ1BBPSMGUm3NcbcbDR8ye7Z"
genius = lyr... | 613 | 286 |
import numpy as np
import numpy.random as rand
from functools import reduce
class Network:
def __init__(self, layer_sizes):
# layer_sizes: list of numbers representing number of neurons per layer
# Create a numpy array of biases for each layer except the (first) input layer
self.biases =... | 987 | 336 |
"""Let's score the unlabeled data for the active learning"""
from al_helper.apis import build
from al_helper.helpers import ALHelper, ALHelperFactory, ALHelperObjectDetection
__version__ = "0.1.0"
__all__ = ["build", "ALHelper", "ALHelperFactory", "ALHelperObjectDetection"]
| 276 | 87 |
from flask_cache import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_assets import Environment
from flask_migrate import Migrate
from flocka.models import User
# Setup flask cache
cache = Cache()
# Init flask assets
assets_env = Environment()
# Debug Too... | 568 | 172 |
from .models import *
from .urls import *
from .views import *
from .integration import *
| 90 | 25 |
from . import configure, core, draw, io, interp, retrieve, qc
__all__ = ["configure", "core", "draw", "io", "interp", "qc", "retrieve"]
| 137 | 51 |
import sys
sys.path.append('../') # 新加入的
sys.path.append('.') # 新加入的
from flasgger import Swagger
from flask import Flask
from v1.sum_ab_controller import demo_sum
app = Flask(__name__)
# API 文档的配置
template = {
"swagger": "2.0",
"info": {
"title": "XXX 在线API",
"description": "在线API 调用测试",
"contact":... | 979 | 429 |
"""Unit tests for testing support
"""
import logging
import os
import unittest
import numpy
from astropy import units as u
from astropy.coordinates import SkyCoord
from arl.data.polarisation import PolarisationFrame
from arl.image.operations import export_image_to_fits
from arl.imaging.base import create_image_fro... | 2,169 | 764 |
"""
Start with a tree file, use ete3 to create a pairwise distance for all nodes. Basically this is the
distance matrix but as tuples.
if we have a tree like
----A
_____________|y
| |
| ----B
________|z
| ... | 3,676 | 1,157 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
A,B,M = map(int,input().split())
A_prise = list(map(int,input().split()))
B_prise = list(map(int,input().split()))
Most_low_prise = min(A_prise)+min(B_prise)
for i in range(M):
x,y,c = map(int,input().split())
Post_coupon_ori... | 508 | 202 |
# 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, ... | 51,310 | 18,321 |
from django.conf.urls import patterns, include, url
from .views import (show_job_submitted, dynamic_input, dynamic_finished,
ogusa_results, dynamic_landing, dynamic_behavioral,
behavior_results, edit_dynamic_behavioral, elastic_results,
dynamic_elasticities, ... | 1,269 | 461 |
import numpy as np
import numpy.ctypeslib as npct
import ctypes
from .histogram import get_bins_maps
from .lib_utils import *
class BoostUtils:
def __init__(self, lib):
self.lib = lib
self._boostnode = None
def _set_gh(self, g, h):
self.lib.SetGH(self._boostnode, g, h)
def _set_b... | 8,866 | 2,661 |
#!/usr/bin/env python3
# 2018-10-13 (cc) <paul4hough@gmail.com>
'''
pips:
- testinfra
- molecule
- tox
'''
class test_role_ans_dev (object):
''' test_role_ans_dev useless class
'''
assert packages.installed(
yaml.array( pkgs[common],
pkgs[os][common],
... | 443 | 167 |
import collections
import torch
import einops
import cached_property
import padertorch as pt
# loss: torch.Tenso r =None,
# losses: dict =None,
# scalars: dict =None,
# histograms: dict =None,
# audios: dict =None,
# images: dict =None,
class ReviewSummary(collections.abc.Mapping):
"""
>>> review_summary... | 8,310 | 2,506 |
#!/usr/bin/env python3
# Rescue mission in the mountains 2
# if running locally, you need to install the djitello module
# run this on your linux or mac machine
# pip3 install djitello
######## PARAMETERS ###########
fspeed = 117/10 # Foward Speed in cm/s (15cm/s)
aspeed = 360/10 # Angular Speed Degrees/s
interval ... | 907 | 358 |
import datetime
import inspect
import numpy.testing as npt
import os.path
import pandas as pd
import pandas.util.testing as pdt
import sys
from tabulate import tabulate
import unittest
# #find parent directory and import model
# parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
# sy... | 43,992 | 13,983 |
import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def xavier_init(fan_in,fan_out,constant = 1):
low = -constant * np.sqrt(6.0 /(fan_in + fan_out))
high = constant * np.sqrt(6.0 /(fan_in + fan_out))
return tf.random_unif... | 3,851 | 1,612 |
# Generated by Django 2.1.4 on 2019-01-21 03:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 1,296 | 384 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=os-command-injection@v1.0 defects=1}
def exec_command_noncompliant():
from paramiko import client
from flask import request
address = request.args.get("address")
cmd = "ping -c 1 %s... | 951 | 319 |
import logging
import json
from typing import List
from src.Entity.Part import Part
from datetime import date
from sqlite3 import Connection
class Parts:
def __init__(self, file_name: str, logger: logging, connection: Connection):
self.file_name = file_name
self.logger = logger
self.conne... | 922 | 255 |
import matplotlib.pyplot as plt
import numpy as np
import numpy.ma as ma
import utils.image_util as iu
from utils.custom_types import Vector
def plot_history(loss, acc, val_loss, val_acc):
plt.figure(figsize=(20, 10))
plt.subplot(2, 1, 1)
plt.title("Loss")
plt.grid()
plt.plot(loss)
plt.plot(v... | 4,300 | 1,522 |
"""
Your application
"""
from submodule.main import *
from main import *
| 80 | 28 |
import httpx
import json
import base64
from loguru import logger
import urllib3
import ssl
try:
ssl_context = httpx.create_ssl_context()
except:
ssl_context = ssl.create_default_context()
ssl_context.options ^= ssl.OP_NO_TLSv1 # Enable TLS 1.0 back
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestW... | 4,190 | 1,318 |
#!/usr/bin/env python
#
# Author: Justin Lintz
# Copyright 2013 Chartbeat
# http://www.chartbeat.com
#
# Nagios check to alert on any retiring instances or
# instances that need rebooting
#
import getopt
import sys
import re
from datetime import datetime
from datetime import timedelta
from boto.ec2 import connect_to_... | 4,783 | 1,475 |
# ------------------------------------------------------------------------------
# CodeHawk C Analyzer
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2017-2020 Kestrel Technology LLC
#
# Permission is hereby granted, free ... | 7,917 | 2,443 |
# -*- coding: utf-8 -*-
from amplify.agent.common.context import context
from amplify.agent.common.util import subp
__author__ = "Grant Hulegaard"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "Grant Hulegaard"
__email__ = "grant.hulegaard@nginx.com"
VERSION_CMD ... | 1,496 | 535 |
from protera_stability.engine.default import get_cfg, setup_train, DefaultTrainer
from protera_stability.engine.lightning_train import (
default_cbs,
DataModule,
LitProteins,
TrainingPl,
)
__all__ = [
"DataModule",
"DefaultTrainer",
"LitProteins",
"TrainingPl",
"default_cbs",
"g... | 385 | 138 |
"""1122. Relative Sort Array"""
class Solution(object):
def relativeSortArray(self, arr1, arr2):
"""
:type arr1: List[int]
:type arr2: List[int]
:rtype: List[int]
"""
####
pos = {num:i for i, num in enumerate(arr2)}
return sorted(arr1, key=lambda x: p... | 416 | 147 |
import itertools
_THRESHOLD = 64
def merge_sort(arr, lo, hi):
if hi - lo <= _THRESHOLD:
_insert_sort(arr, lo, hi)
return
mi = (lo + hi) // 2
merge_sort(arr, lo, mi)
merge_sort(arr, mi, hi)
_merge(arr, lo, mi, hi)
def _insert_sort(arr, lo, hi):
for i in range(lo, hi):
... | 1,037 | 428 |
#!/usr/bin/python
# encoding: utf-8
"""
adobeutils.py
Utilities to enable munki to install/uninstall Adobe CS3/CS4/CS5 products
using the CS3/CS4/CS5 Deployment Toolkits.
"""
# Copyright 2009-2014 Greg Neagle.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | 59,661 | 16,594 |
import colorgb
print(colorgb.fore("Hi!", "green"))
| 52 | 22 |
import sys, pygame
pygame.init()
world_size = width, height = 10000, 9000
speed = [2, 2]
DX, DY = 0.1, 0.1
position = [width / 2, height / 2]
screen_size = int(DX * width), int(DY * height)
black = 0, 0, 0
screen = pygame.display.set_mode(screen_size)
ball = pygame.image.load("intro_ball.gif")
ballrect = ball.get_r... | 1,513 | 608 |
#! python
from airtable import Airtable
import discord, fstrings, re, random, os
from datetime import datetime
# datetime object containing current date and time
AIRTABLE_API_KEY = os.getenv('AIRTABLE_API_KEY') # stored in .env
AIRTABLE_BASE_KEY = os.getenv('AIRTABLE_BASE_KEY') # stored in .env
CAMPAIGN_NAME = os.g... | 18,808 | 5,995 |
"""
Distributed under the MIT License. See LICENSE.txt for more info.
"""
import json
import uuid
from ..utility.display_names import (
OPEN_DATA,
SIMULATED_DATA,
BINARY_BLACK_HOLE,
DYNESTY,
NESTLE,
EMCEE,
FIXED,
UNIFORM,
SKIP,
SUBMITTED,
QUEUED,
IN_PROGRESS,
DRAFT,... | 13,620 | 3,814 |
# Generated by Django 3.2.5 on 2021-07-04 19:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activities', '0002_rename_currentactivity_currentactivitie'),
]
operations = [
migrations.AlterField(
model_name='currentactivit... | 574 | 183 |
#!/usr/bin/env python
"""
Created by howie.hu at 2021/4/9.
Description:微信相关通用函数
Changelog: all notable changes to this file will be documented
"""
from ruia import Request
from src.config import Config
from src.databases import MongodbManager
async def get_wf_url():
"""
获取 wechat-feeds 资源链接
... | 1,209 | 467 |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import sys
import unittest
import datadog_api_client.v2
from datadog... | 857 | 249 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Unit tests for the item() utility function.
'''
import unittest
from collector.utilities.item import item
class TestUtilityItem(unittest.TestCase):
'''
Tests for the item() utility function.
'''
def test_item_returns_correct_type(self):
'''
Tests that the... | 442 | 140 |
# flake8: noqa
import json
import time
import requests
from django.conf import settings
from websocket import create_connection
from open.core.scripts.swarm_ml_services import get_random_prompt
from open.core.writeup.constants import TEXT_GENERATION_URL
"""
this script's design was to compare performance behind djan... | 1,696 | 557 |
import http.client, urllib.request, urllib.parse, urllib.error, base64, time, json, ast, datetime, math, keys
import logging
logging.basicConfig(filename='io.log', level=logging.INFO, format='%(asctime)s %(message)s')
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': keys.OCP_APIM_SUBSCRIPTION_KEY,
... | 1,031 | 373 |
"""About this package."""
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
__title__ = "argo-events"
__summary__ = "Community Maintained Python client for Argo Events"
__uri__ = "https://github.com/argoproj-l... | 518 | 207 |
# Copyright (c) 2016-2019 Oleksandr Tymoshenko <gonzo@bluezbox.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# ... | 2,465 | 799 |
# Escreva um programa que pergunte a quantidade de Km
# percorridos por um carro alugado e a quantidade de dias pelos
# quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro
# custa R$60 por dia e R$0.15 por Km rodado.
km = float(input("Quantos km percorreu?: "))
dia = int(input("Quantos dias ele foi alu... | 399 | 158 |
#!/usr/bin/env python
import sys
import argparse
import os
import subprocess
import platform
import io
import string
try:
# For Python >= 3.0
from urllib.request import urlopen
except ImportError:
# For Python < 3.0
from urllib2 import urlopen
import shutil
import stat
def run(args):
nugetFolder = ... | 3,241 | 1,120 |
# Copyright (c) 2021, Salim and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class MPESAPayment(Document):
pass
| 192 | 60 |
import time
import random
def main():
print("You are trying to find your way to the centre of a maze where there is a pot of gold!")
time.sleep(2)
print("What you don't know is that this is a dangerous maze with traps and hazards.")
time.sleep(2)
start = input ("Do you want to enter the maze? (... | 3,292 | 888 |
import os
from PyQt5 import QtWidgets
from .qtd import Ui_MainWindow
from version import __version__
from utils import SpinBoxFixStyle
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
Main window
"""
def __init__(self, parent=None):
# initialization of the superclass
super(... | 2,081 | 690 |
import unittest
from unittest import mock
from django.utils.translation import ugettext_lazy as _
from tethys_services.models import DatasetService, SpatialDatasetService, WebProcessingService, PersistentStoreService
from tethys_services.admin import DatasetServiceForm, SpatialDatasetServiceForm, WebProcessingServiceF... | 4,622 | 1,319 |