text string | size int64 | token_count int64 |
|---|---|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011, Martín Raúl Villalba
#
# 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 So... | 3,273 | 1,127 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 3,181 | 1,066 |
#!/usr/bin/env python3
from time import sleep
import logging
import os
import subprocess
print("Nebra ECC Tool")
preTestFail = 0
afterTestFail = 0
ECC_SUCCESSFUL_TOUCH_FILEPATH = "/var/data/gwmfr_ecc_provisioned"
logging.basicConfig(level=os.environ.get("LOGLEVEL", "DEBUG"))
def record_successful_provision():
... | 2,678 | 932 |
DOIT_CONFIG = {'default_tasks': ['use_cmd', 'use_python']}
def task_compute():
def comp():
return {'x':5,'y':10, 'z': 20}
return {'actions': [(comp,)]}
def task_use_cmd():
return {'actions': ['echo x=%(x)s, z=%(z)s'],
'getargs': {'x': ('compute', 'x'),
'z': ('compute... | 641 | 237 |
#!/usr/bin/env python3
""" Simple example/demo of the unlinkable DP-3T design
This demo simulates some interactions between two phones,
represented by the contact tracing modules, and then runs
contact tracing.
"""
__copyright__ = """
Copyright 2020 EPFL
Licensed under the Apache License, Version 2.0 (the "... | 4,022 | 1,349 |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from rest_framework_simplejwt.state import User
from core.views import DeactivateSelfAPIView, BecomeCommercialAPIView
from tests.unittests.common import APIFactoryTestCase
class BecomeCommercialAPITes... | 2,409 | 758 |
"""Defines the unit tests for the :mod:`colour.colorimetry.spectrum` module."""
import colour
import numpy as np
import unittest
import scipy
from distutils.version import LooseVersion
from colour.algebra import CubicSplineInterpolator
from colour.colorimetry.spectrum import SPECTRAL_SHAPE_DEFAULT
from colour.colorim... | 55,929 | 35,301 |
# Comment
import pandas as pd
import re
from google.cloud import storage
from pathlib import Path
def load_data(filename, chunksize=10000):
good_columns = [
'created_at',
'entities',
'favorite_count',
'full_text',
'id_str',
'in_reply_to_screen_name',
'in_rep... | 5,483 | 1,716 |
from dash import dcc, html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
import numpy as np
import pandas as pd
import plotly.io as pio
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import yfinance as yf
import math
from sklearn.linear_model imp... | 18,988 | 7,529 |
import math
from collections import namedtuple
from . import geohash
Box = namedtuple("Box", ["s", "w", "n", "e"])
def geohash_bbox(gh):
ret = geohash.bbox(gh)
return Box(ret["s"], ret["w"], ret["n"], ret["e"])
def bbox(lat, lon, radius):
lat_delta = radius * 360 / 40000
lon_delta = lat_delta / ma... | 1,459 | 536 |
import torch
import torch.nn as nn
import torchvision
from collections import namedtuple
Config = namedtuple('Config', ['iSz', 'oSz', 'gSz'])
default_config = Config(iSz=160, oSz=56, gSz=112)
class Reshape(nn.Module):
def __init__(self, oSz):
super(Reshape, self).__init__()
self.oSz = oSz
de... | 7,398 | 2,840 |
nums = [0,1]
def calcFi():
n1 = nums[-2]
n2 = nums[-1]
sM = n1 + n2
phi = sM/n2
nums.append(sM)
return (phi)
for i in range(45):
if i % 15 == 0 or i == 44:
phi = calcFi()
print(phi)
if i == 44:
with open("outputs/phi.txt", "w") as f:
f... | 363 | 162 |
import os
import glob
import torch
import numpy as np
# from PIL import Image, UnidentifiedImageError
from torch.utils.data import Dataset
from torchvision.datasets import MNIST
class ToyDataset(Dataset):
def __init__(self, N_K=50, K=4, X=None, Y=None):
super().__init__()
if X is not None:
self.data,... | 3,657 | 1,494 |
from django.shortcuts import render, HttpResponse
from django.views.generic.list import ListView
from django.views.generic.edit import UpdateView, DeleteView, CreateView
from . models import OuverTimeRecord
from django.contrib.auth.models import User
from django.urls import reverse_lazy
from django.views import View
im... | 6,834 | 2,117 |
import unittest as ut
import time
class test_magick(ut.TestCase):
def test_us(self):
list_r = list(range(0, 100))
for i in list_r:
with self.subTest(case=i):
self.assertEqual(magick(i), i)
def magick(x=None, start=0, stop=100):
yes = ['да', 'д', 'yes', 'y', 'ye']... | 1,256 | 493 |
# coding=utf-8
# Copyright 2020 The Tensor2Robot 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 ... | 4,593 | 1,479 |
import numpy as np
from ..discretization import StructuredGrid, UnstructuredGrid
from ..utils import geometry
try:
import matplotlib.pyplot as plt
import matplotlib.colors
from matplotlib.collections import PathCollection, LineCollection
from matplotlib.path import Path
except (ImportError, ModuleNotFo... | 44,533 | 12,631 |
#!/usr/bin/env python3
import argparse
from pathlib import Path
import json
import random
import string
from botocore.exceptions import ClientError
module_info = {
"name": "rds__explore_snapshots",
"author": "Alexander Morgenstern alexander.morgenstern@rhinosecuritylabs.com",
"category": "EXFIL",
"one... | 9,342 | 2,642 |
"""
Executes the automation part of 1DMin
"""
import statistics
import autofile
from autorun import run_script
from mechroutines.trans._routines import _geom as geom
from mechroutines.trans._routines import _gather as gather
from mechroutines.trans.runner import lj as lj_runner
from mechlib import filesys
from mechlib... | 9,846 | 3,745 |
from exceptions import BarryFileException, BarryConversionException, BarryExportException, BarryDFException
import pandas as pd
import requests
from StringIO import StringIO
def detect_file_extension(filename):
"""Extract and return the extension of a file given a filename.
Args:
filename (str): name... | 7,182 | 1,955 |
from flask_script import Command
from app import db
class SeedCommand(Command):
""" Seed the DB."""
def run(self):
if (
input(
"Are you sure you want to drop all tables and recreate? (y/N)\n"
).lower() == "y"
):
print("Dropping tables...")
... | 451 | 127 |
a = [2, 4, 5, 7, 8, 9]
sum = 0
for i in range(len(a) - 1):
if a[i] % 2 == 0:
sum = sum + a[i]
print(sum)
| 118 | 71 |
# -*- coding: utf-8 -*-
"""
Core client, used for all API requests.
"""
import os
import platform
from collections import namedtuple
from plivo.base import ResponseObject
from plivo.exceptions import (AuthenticationError, InvalidRequestError,
PlivoRestError, PlivoServerError,
... | 8,724 | 2,291 |
# Part 3 of UWCSE's Project 3
#
# based on Lab Final from UCSC's Networking Class
# which is based on of_tutorial by James McCauley
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.addresses import IPAddr, IPAddr6, EthAddr
log = core.getLogger()
#statically allocate a routing table for... | 4,301 | 1,784 |
#students exams data entries for terminal report card
print("Westside Educational Complex--End Of second Terminal Report--Class-KKJA--Name:Theodora Obaa Yaa Gyarbeng")
while True:
student_score = float(input ("Enter the student score:"))
if student_score >= 1.0 and student_score <= 39.9:
print("stud... | 956 | 313 |
n = int(input())
l = []
c = 0
for i in range(0,n):
p = input()
print('c -> ', c)
if p in l:
c += 1
l.append(p)
print("Falta(m) {} pomekon(s).".format(151 - (n-c))) | 201 | 98 |
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def setting(name):
return getattr(settings, name, "")
#@register.filter
#def format_difference(value):
# number = int(value)
# if number > 0:
# ... | 551 | 178 |
# Given a series of input numbers, count the number of times
# the values increase from one to the next.
import pandas as pd
# Part 1
sample = pd.read_csv(".\Day1\sample.txt", header=None, squeeze=True)
input = pd.read_csv(".\Day1\input.txt", header=None, squeeze=True)
#print(type(input))
ans = input.diff(1).apply(l... | 507 | 191 |
import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
kivy.require('1.9.0')
class GUITestApp(App):
def build(self):
return BoxLayout()
glApp = GUITestApp()
glApp.run()
| 206 | 83 |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | 11,263 | 3,332 |
#
# @lc app=leetcode id=971 lang=python3
#
# [971] Flip Binary Tree To Match Preorder Traversal
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collect... | 988 | 301 |
import base64
import datetime
import io
import json
import os
import requests
from collections import namedtuple
from urllib.parse import urlparse
import faust
import numpy as np
import keras_preprocessing.image as keras_img
from avro import schema
from confluent_kafka import avro
from confluent_kafka.avro import Avr... | 5,799 | 1,922 |
import discord
from discord.ext import commands
from discord.utils import get
class c260(commands.Cog, name="c260"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Yikilth_Lair_of_the_Abyssals', aliases=['c260', 'Abyssal_11'])
async def example_embed(self, ctx):
... | 1,296 | 456 |
from .cli import entrypoint
if __name__ == "__main__": # pragma: no cover
entrypoint.main()
| 98 | 34 |
from flask import jsonify
from ..app import app
@app.route('/ping', methods=('GET',))
def get_ping():
return jsonify(ping='pong')
| 137 | 47 |
inst_25 = [(35,0,15),(29,0,20),(9,0,11),(9,13,35),(3,0,19),(37,0,8),(11,0,30),(19,0,25),(13,0,25),(39,0,18)]
inst_bait = [(10,0,10), (14,0,11), (33,0,26),(4,2,18),(4,20,30),(39,117,137),(12,5,21),(28,0,14),(32,5,14),(32,15,44),(36,0,9),(40,0,14),(2,1,15),(2,17,35),(5,160,168),(11,158,164),(13,116,131)]
inst_30 = []
... | 1,726 | 1,306 |
__version__ = '5.2.158 f.LUM'
| 30 | 19 |
import numpy as np
import pickle
expert_file = 'maze_expert.npy'
imitation_agent_file = 'maze_agent.npy'
with open(imitation_agent_file, 'rb') as handle:
agent_data = pickle.load(handle)
with open(expert_file, 'rb') as handle:
expert_data = pickle.load(handle)
print("OK") | 280 | 105 |
import unittest
from celestial import Celestial
from strings import CelestialStrings
from datetime import datetime
import pytest
import math
class TestCelestial(unittest.TestCase):
"""Testing the CelestialStrings class for generating celestial answers for TTS to read aloud"""
def setUp(self):
...
... | 3,967 | 1,438 |
import copy
import json
import logging
from . import utils
# -------------------------------------------------------------------------------------------------
def _update_config_by_args(config, args, prefix=""):
for k, v in config.items():
arg_name = prefix + k.replace("-", "_")
if isinstance(v,... | 3,290 | 925 |
from osmo import Osmo
import random
import time
class PositiveCalculator:
@staticmethod
def guard_something():
return True
@staticmethod
def step_something():
print("1. inside step")
# Random wait can be added inside test step
wait_ms = random.randint(200, 1000)
... | 746 | 241 |
#!/usr/bin/env python
# Author: Omid Mashayekhi <omidm@stanford.edu>
import sys
import os
import subprocess
import config
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
import ec2
temp_file_name = '_temp_file_'
def copy_binary_file_to_hosts(ip_addresses):
for ip in ip_addresse... | 3,475 | 1,321 |
frase = input().split()
for palavra in frase:
print(palavra[2], end='') | 75 | 30 |
#To run the code, write
#from ishashad import ishashad
#then ishashad(number)
def ishashad(n):
if n % sum(map(int,str(n))) == 0:
print("True")
else:
print("False")
return | 198 | 77 |
"""
This module tests utils
"""
from unittest.mock import patch, MagicMock
from superset_patchup.utils import get_complex_env_var, is_safe_url, is_valid_provider
from superset_patchup.oauth import CustomSecurityManager
class TestUtils:
"""
Class to test the utils module
"""
@patch("superset_patchup.... | 2,393 | 679 |
import random
import torch
import numpy as np
from torch.autograd import gradcheck, gradgradcheck
import xitorch as xt
from xitorch.integrate import quad, solve_ivp, mcquad, SQuad
from xitorch._tests.utils import device_dtype_float_test
################################## quadrature ############################... | 14,215 | 5,961 |
from hub.dataload.nde import NDEFileSystemDumper
class FigshareDumper(NDEFileSystemDumper):
SRC_NAME = "figshare"
| 120 | 48 |
# -*- coding: utf-8 -*-
"""
File Name: faiss_utils
Description : faiss工具类
Author : mick.yi
date: 2019/1/4
"""
import faiss
import numpy as np
def get_index(dimension):
sub_index = faiss.IndexFlatL2(dimension)
index = faiss.IndexIDMap(sub_index)
return index
... | 785 | 321 |
class Relogio:
def __init__(self):
self.horas = 6
self.minutos = 0
self.dia = 1
def __str__(self):
return f"{self.horas:02d}:{self.minutos:02d} do dia {self.dia:02d}"
def avancaTempo(self, minutos):
self.minutos += minutos
while(self.minutos >= 60):... | 475 | 175 |
import requests
from custom.api.utils import EndpointMixin
class MigrationException(Exception):
pass
class LogisticsEndpoint(EndpointMixin):
models_map = {}
def __init__(self, base_uri, username, password):
self.base_uri = base_uri.rstrip('/')
self.username = username
self.passw... | 3,201 | 937 |
# Generated by Django 2.2.5 on 2019-10-28 21:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20191028_1802'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='registered_a... | 432 | 155 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | 3,426 | 1,104 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import tensorflow as tf
from fewshot.models.kmeans_utils import compute_logits
from fewshot.models.model import Model
from fewshot.models.refine_model import RefineModel
from fewshot.models... | 1,928 | 729 |
"""
@Author : xiaotao
@Email : 18773993654@163.com
@Lost modifid : 2020/4/24 10:02
@Filename : __init__.py.py
@Description :
@Software : PyCharm
""" | 169 | 99 |
import numpy as np
import re as re
from molsysmt._private_tools.lists_and_tuples import is_list_or_tuple
def compatibles_for_a_single_molecular_system(items):
from molsysmt.basic.get_form import get_form
from molsysmt.basic.get import get
from molsysmt.forms import dict_has
output = True
if not ... | 3,864 | 1,265 |
#!/usr/bin/env python3
import argparse
import subprocess as sp
import select
import sys
import time
import yaml
if __name__ == '__main__':
"""
We can daemonize our connections to our remote machines, list the FL processes on remote
machines, or kill FL processes on remote machines. We can either pass a s... | 5,021 | 1,684 |
from .device import SampleDevice
from .codeobject import SampleDeviceCodeObject
__all__ = ['SampleDevice', 'SampleDeviceCodeObject']
| 134 | 34 |
from beaker import Beaker
def test_node_get(client: Beaker, beaker_node_id: str):
assert client.node.get(beaker_node_id).limits.gpu_count == 8
| 149 | 57 |
# coding: utf-8
# In[2]:
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
# Fetch the service account key JSON file contents
cred = credentials.Certificate('/Users/Solomon/Desktop/cau-hashkeyword-serviceAccountKey.json')
# Initialize the app with a service account, granti... | 5,984 | 2,739 |
#coding: utf-8
from aip import AipSpeech
from config import DefaultConfig as opt
class composer():
def __init__(self):
pass
def compose(self,text ='你好'):
#百度后台获取的秘�?
APP_ID = opt.baidu_app_id
API_KEY = opt.baidu_api_key
SECRET_KEY =opt.baidu_secret_key
client = ... | 614 | 223 |
import unittest
import os
import pathlib
import h5py
from desc.input_reader import InputReader
from desc.equilibrium_io import hdf5Writer, hdf5Reader
from desc.configuration import Configuration, Equilibrium
#from desc.input_output import read_input
#class TestIO(unittest.TestCase):
# """tests for input/output fun... | 8,754 | 2,775 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
import pytest
# Declare Fixtures
# --------------------------------------------------------------------
@pytest.fixture()
def driver():
driver = webdriver.Chrome()
d... | 880 | 253 |
#makes a toast with the given string ID
from sys import argv
def make_toast (string_id):
return "Toast.makeText(getBaseContext(), getString(R.string." + string_id + "), Toast.LENGTH_SHORT).show();"
if ( argv[0] == "makeToast.py" ):
print make_toast(argv[1])
| 264 | 101 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-22 23:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('calls', '0010_auto_20180119_2117'),
('calls', '0007_auto_20180122_2157'),
]
operati... | 334 | 152 |
from unittest import skip
import unittest2
from nose.plugins.attrib import attr
from nose.tools import assert_equals
@attr('test_nose_plugin')
class TestNosePlugin(unittest2.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_one(self):
"""first test, simulation p... | 572 | 180 |
# Copyright 2020-2021 Canonical 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 writi... | 2,359 | 686 |
#ecoding:utf-8
import DatasetLoader
import RICNNModel
import tensorflow as tf
import sys
import numpy as np
import regularization as re
import os
import trainLoader
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
TRAIN_FILENAME = '/media/liuqi/Files/dataset/test_mnist_ricnn_raw_100.h5'
TEST_FILENAME = '/media/liuqi/Files/da... | 5,034 | 1,695 |
#!/usr/bin/env python
"""Extract radial, sulcal, and gyral orientations from gyral coordinate NIFTI file"""
def main():
import argparse
parser = argparse.ArgumentParser("Extract radial, sulcal, and gyral dyads from a coord NIFTI file")
parser.add_argument('coord', help='name of the coord file')
parse... | 820 | 258 |
import binascii
from pyshark.packet.common import Pickleable, SlotsPickleable
class LayerField(SlotsPickleable):
"""
Holds all data about a field of a layer, both its actual value and its name and nice representation.
"""
# Note: We use this object with slots and not just a dict because
# it's mu... | 3,558 | 1,067 |
import pyautogui
import time
import datetime
class SwipeCard:
def __init__(self):
self.resolution = pyautogui.size()
def resolve_task(self):
try:
hide_card_position = pyautogui.center(
pyautogui.locateOnScreen(f"assets/tasks/swipe_card/main.png",
... | 1,264 | 396 |
# https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/
# Time: O(n)
# Space: 1
def reverseByMiddles(arr):
n = len(arr)
limit = n//2
for i in range(limit):
temp = arr[i]
arr[i] = arr[(n-1)-i]
arr[(n-1)-i] = temp
return arr
arr = [1,2,3]
result = reverseByMiddles(arr)
print(r... | 370 | 169 |
from service import Service
from unittest import TestCase
from mock import patch
import sys
class TestService(TestCase):
@patch('service.Service.bad_random', return_value=10)
def test_bad_random(self, bad_random):
self.assertEqual(bad_random(), 10)
@patch('service.Service.bad_random', return_value=10)
def test_... | 1,397 | 591 |
"""Use TIMESTAMP column for latest submission
Revision ID: eff79a07a88d
Revises: 83e6b2a46191
Create Date: 2017-01-08 22:20:43.814375
"""
# revision identifiers, used by Alembic.
revision = 'eff79a07a88d'
down_revision = '83e6b2a46191'
from alembic import op # lgtm[py/unused-import]
import sqlalchemy as sa # lgt... | 1,512 | 563 |
import pandas as pd
import numpy as np
import os
# Function, divided all data into groups by time period, like [1AM-3AM; 3AM-5Am ...]
def binning(column, points, labels=None, month=0, stop=0):
'''
Notes: The Row Data from MBTA webiste
The Time format is from 3:00 to 27:00, means 3:00 AM today to ne... | 3,499 | 1,160 |
from utils import default_args
from datetime import timedelta
from airflow import DAG
from airflow_kubernetes_job_operator import (
KubernetesJobOperator,
JobRunnerDeletePolicy,
KubernetesLegacyJobOperator,
)
dag = DAG(
"kub-job-op-test-jinja",
default_args=default_args,
description="Test base ... | 1,574 | 575 |
import json
import jsonpath
import paramiko
from spacecapsule.history import store_experiment, rollback_command
from subprocess import Popen, PIPE
from spacecapsule.k8s import prepare_api, copy_tar_file_to_namespaced_pod, executor_command_inside_namespaced_pod
from spacecapsule.template import chaosblade_prepare_scr... | 6,458 | 2,135 |
"""POD-NN modeling for 1D, unsteady Burger Equation."""
#%% Imports
import sys
import os
import pickle
import numpy as np
sys.path.append(os.path.join("..", ".."))
from poduqnn.podnnmodel import PodnnModel
from poduqnn.mesh import read_multi_space_sol_input_mesh
from poduqnn.handling import clean_dir, split_dataset
f... | 2,952 | 1,775 |
coordinates_01EE00 = ((121, 126),
(121, 132), (121, 134), (121, 135), (121, 137), (121, 138), (121, 139), (121, 140), (121, 141), (122, 114), (122, 115), (122, 116), (122, 117), (122, 119), (122, 125), (122, 127), (122, 128), (122, 142), (123, 110), (123, 111), (123, 112), (123, 113), (123, 120), (123, 124), (123, 12... | 13,981 | 11,623 |
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars -drivers
cars_driven = drivers
carpool_carpacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print("There are", cars, "cars available")
print("There are only", drivers, "drivers available")
prin... | 565 | 195 |
import json
import logging
import os
import click
import numpy as np
from keras import backend as K
from keras.models import load_model as keras_load
from sklearn.base import clone as sklearn_clone
from sklearn.externals import joblib
from faculty_xval.utilities import keras_clone_and_compile
LOGGER = logging.getLo... | 6,599 | 1,889 |
from bs4 import BeautifulSoup
import requests
import math
import time
start_url='https://www.macys.com'
domain='https://www.macys.com'
''' get soup '''
def get_soup(url):
# get contents from url
content=''
while content=='':
try:
content = requests.get(url,
... | 2,262 | 839 |
from django.conf.urls import url
from contactnetwork import views
# from django.views.generic import TemplateView
urlpatterns = [
url(r'^clusteringdata$', views.ClusteringData, name='clusteringdata'),
url(r'^clustering$', views.Clustering, name='clustering'),
url(r'^structure_clustering$', views.Clusterin... | 1,243 | 429 |
course = "Python Programming"
print(course.upper())
print(course.lower())
print(course.title())
course = " Python Programming"
print(course)
print(course.strip())
print(course.find("Pro"))
print(course.find("pro"))
print(course.replace("P", "-"))
print("Programming" in course)
print("Programming" not in course)
| 320 | 103 |
import re
from data_transformer.views import stringIsInteger
def validateEmailFormat(email):
emailPattern = r'^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$'
if(re.search(emailPattern, email)):
return True
return False
def validatePhoneFormat(phone):
if not stringIsInteger(phon... | 1,401 | 474 |
from pydantic import BaseModel, Field, EmailStr
class PostSchema(BaseModel):
id: int = Field(default=None)
title: str = Field(...)
content: str = Field(...)
class Config:
schema_extra = {
"example": {
"title": "Securing FastAPI applications with JWT.",
... | 1,173 | 325 |
__version__ = '1.0.2'
__author__ = 'Christian Musa <christianmusa@gmail.com>'
__url__ = 'https://github.com/crash7/griffin-powermate'
__all__ = []
from griffin_powermate import * | 188 | 78 |
def init():
# Set locale environment
# Set config
# Set user and group
# init logger
pass | 109 | 30 |
import unittest
from parameterized import parameterized
import os
from integration_tests.dataproc_test_case import DataprocTestCase
METADATA = 'flink-start-yarn-session=false'
class FlinkTestCase(DataprocTestCase):
COMPONENT = 'flink'
INIT_ACTION = 'gs://dataproc-initialization-actions/flink/flink.sh'
T... | 3,142 | 1,080 |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# 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 a... | 4,017 | 1,427 |
import numpy as np
from typing import List, Tuple
from .base import _DataSet
class NarrowPeakDataSet(_DataSet):
"""
The NarrowPeakDataSet expects that narrowPeak files have been added to the DataBase.
"""
SELECT_LABEL = (
" Bed.ChromosomeId, Bed.ConditionId, BedVirtual_{assembly}.ChromStart,... | 790 | 242 |
#!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2018-09-09 23:06:06 +0100 (Sun, 09 Sep 2018)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and opt... | 2,654 | 867 |
from vk_bot.core.modules.basicplug import BasicPlug
import time
class Counting(BasicPlug):
command = ("отсчет",)
doc = "Отсчет от 1 до 3"
def main(self):
for x in range(3, -1, -1):
if x == 0:
return
self.sendmsg(x)
time.sleep(1)
| 301 | 109 |
## Copyright © 2021, Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#!/usr/bin/env python
from setuptools import setup
setup(name='wind-marketplace-library',
version="1.0.0",
description='Robot Framework test librar... | 954 | 285 |
__version__="0.3" | 17 | 9 |
from django.http import JsonResponse
from django.shortcuts import reverse
from django.urls import NoReverseMatch
from django.views import View
from rest_framework import __version__ as drf_version
from rest_framework.exceptions import ValidationError
from rest_framework.permissions import AllowAny
from rest_framework.r... | 1,392 | 391 |
from verta import Client
import pickle
import mlflow
import mlflow.sklearn
from mlflow.tracking import MlflowClient
import os
def downloadArtifact(proj,exp_name,exp_run, serialization):
client = Client("http://localhost:3000")
proj = client.set_project(proj)
expt = client.set_experiment(exp_name)
run ... | 1,525 | 544 |
#!/usr/bin/env python
#*****************************************************************************
# dump_db.py
#
# Dump inventory database in XML format
#
# (c) 2006 Andres Heinloo, GFZ Potsdam
# (c) 2007 Mathias Hoffmann, GFZ Potsdam
#
# This program is free software; you can redistribute it and/or modify it
# und... | 3,832 | 1,101 |
import logging
from typing import Optional
from y import magic
from y.datatypes import UsdPrice
from y.typing import AnyAddressType, Block
logger = logging.getLogger(__name__)
def get_price(token: AnyAddressType, block: Optional[Block] = None) -> UsdPrice:
logger.warn('ypricemagic is in the process of being mig... | 619 | 172 |
from zerver.lib.actions import do_add_realm_playground
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmPlayground, get_realm
class RealmPlaygroundTests(ZulipTestCase):
def test_create_one_playground_entry(self) -> None:
iago = self.example_user("iago")
payload = {... | 4,248 | 1,300 |
#
# This is Seisflows
#
# See LICENCE file
#
#
###############################################################################
# Import system modules
import os
# Import Numpy
import numpy as np
# Local imports
from seisflows.tools import unix
from seisflows.tools.math import dot
from seisflows.tools.tools import lo... | 2,733 | 959 |