text string | size int64 | token_count int64 |
|---|---|---|
# Copyright 2020 The ElasticDL 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 required by applicable law... | 3,241 | 970 |
# Training to a set of multiple objects (e.g. ShapeNet or DTU)
# tensorboard logs available in logs/<expname>
import sys
import os
sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))
)
import warnings
import trainlib
from model import make_model, loss
from render import NeRF... | 24,590 | 10,527 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 09 13:28:05 2017
@author: Marie Jankujova
"""
import sys
import os
from datetime import datetime, time, date
import pandas as pd
import numpy as np
from numpy import inf
import pytz
import logging
import scipy.stats as st
from scipy.stats import sem, t
from scipy import ... | 240,628 | 83,879 |
"""
basic.py : Some basic classes encapsulating filter chains
* Copyright 2017-2020 Valkka Security Ltd. and Sampsa Riikonen
*
* Authors: Sampsa Riikonen <sampsa.riikonen@iki.fi>
*
* This file is part of the Valkka library.
*
* Valkka is free software: you can redistribute it and/or modify
* it under the term... | 13,451 | 4,246 |
import os.path
from uuid import uuid4
def save_image(image, save_to='.'):
"""
Save image to local dick
"""
suffix = '.jpg'
if image.mode == 'P':
image = image.convert('RGBA')
if image.mode == 'RGBA':
suffix = '.png'
filename = uuid4().hex + suffix
if not os.path.isd... | 455 | 163 |
'''
191. Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3.
'''
class Solution(object):
de... | 670 | 235 |
#
# File:
# color4.py
#
# Synopsis:
# Draws sixteen sample color boxs with RGB labels.
#
# Category:
# Colors
#
# Author:
# Fred Clare
#
# Date of initial publication:
# January, 2006
#
# Description:
# This example draws sixteen color boxes using the RGB
# values for named colors. The boxes... | 3,817 | 1,689 |
from django.apps import AppConfig
class T4HotelConfig(AppConfig):
name = 't4_hotel'
| 90 | 33 |
import random
from evaluator import ChessEval
class ChessAI(object):
INF = 8000
def __init__(self,game,color):
self.game = game
self.evaluator = ChessEval(game)
self.color = color
self.drunkMode = False
self.points = {'Pawn': 10, 'Knight': 30, 'Bishop': 30, 'Rook': 5... | 4,495 | 1,265 |
import bpy
def Render_Animation():
bpy.ops.object.camera_add(enter_editmode=False, align='VIEW', location=(0, 0, 0), rotation=(1.60443, 0.014596, 2.55805))
bpy.ops.object.light_add(type='SUN', location=(0, 0, 5)) #setting camera and lights for rendering
cam = bpy.data.objects["Camera"]
scene = bpy.cont... | 604 | 239 |
# Copyright 2021 Sai Sampath Kumar Balivada
# 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 ... | 6,843 | 1,879 |
import re
from unittest import TestCase
from expects import expect, equal, raise_error, be_true, be_false
from slender import List
class TestInclude(TestCase):
def test_include_if_value_in_array(self):
e = List(['apple', 'bear', 'dog', 'plum', 'grape', 'cat', 'anchor'])
expect(e.include('bear'... | 494 | 172 |
# ----------------------------------------------------------------------------------------------------------------------
# Body Weight test cases
# ----------------------------------------------------------------------------------------------------------------------
# imports
import unittest
import tempfile
import ... | 7,261 | 1,627 |
import re
import time
import requests
from telethon import events
from userbot import CMD_HELP
from userbot.utils import register
import asyncio
import random
EMOJIS = [
"😂",
"😂",
"👌",
"💞",
"👍",
"👌",
"💯",
"🎶",
"👀",
"😂",
"👓",
"👏",
"👐",
"🍕",
"💥... | 8,164 | 3,114 |
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="test_drawing_objects.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softwar... | 16,175 | 4,698 |
import numpy as np
import matplotlib.pyplot as plt
import freqent.freqentn as fen
import dynamicstructurefactor.sqw as sqw
from itertools import product
import os
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
savepath = '/media/daniel/storage11/Dropbox/LLM_Danny/frequencySpaceDissipation/tests/freqentn_te... | 4,200 | 1,851 |
from setuptools import setup, find_packages
import versioneer
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="redmail",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
author="Mikael Koli",
author_email="koli.mikael@gmail.com",
url="https://... | 1,217 | 380 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-29 06:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import enumchoicefield.fields
import wagtailcomments.models
class Mig... | 1,691 | 504 |
from flask import url_for
from flexmock import flexmock
from packit_service import models
from packit_service.models import CoprBuildModel
from packit_service.service.views import _get_build_info
from tests_requre.conftest import SampleValues
def test_get_build_logs_for_build_pr(clean_before_and_after, a_copr_build_... | 4,286 | 1,590 |
from django.conf.urls import url,include
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$',views.index,name='hoodNews'),
url(r'^new/hood/',views.create_hood, name='newHood'),
ur... | 1,644 | 596 |
from werkzeug.security import generate_password_hash
from shopyoapi.init import db
from app import app
from modules.auth.models import User
from modules.school.models import Setting
# from modules.settings.models import Settings
def add_admin(name, email, password):
with app.app_context():
admin = User... | 1,088 | 312 |
import logging
from eventlet import corolocal
from eventlet.greenthread import getcurrent
"""
This middleware is used to forward user token to Contrail API server.
Middleware is inserted at head of Neutron pipeline via api-paste.ini file
so that user token can be preserved in local storage of Neutron thread.
This is ... | 1,256 | 361 |
from django.db import models
class TaxClass(models.Model):
"""
Tax rate for a product.
"""
title = models.CharField(max_length=100)
description = models.CharField(max_length=200, help_text='Description of products to be taxed')
def __unicode__(self):
return self.title
class Meta:... | 858 | 278 |
from brownie import interface
from rich.console import Console
from helpers.utils import snapBalancesMatchForToken
from .StrategyBaseSushiResolver import StrategyBaseSushiResolver
console = Console()
class StrategySushiDiggWbtcLpOptimizerResolver(StrategyBaseSushiResolver):
def confirm_rebase(self, before, afte... | 1,114 | 338 |
# -*- coding: utf-8 -*-
""""
Bandidos estocásticos: introducción, algoritmos y experimentos
TFG Informática
Sección 8.4.4
Figuras 26, 27 y 28
Autor: Marcos Herrero Agustín
"""
import math
import random
import scipy.stats as stats
import matplotlib.pyplot as plt
import numpy as np
def computemTeor(n,Del... | 8,161 | 3,475 |
from ..tool import clang_coverage
from ..util.setting import CompilerType, Option, TestList, TestPlatform
from ..util.utils import check_compiler_type
from .init import detect_compiler_type
from .run import clang_run, gcc_run
def get_json_report(test_list: TestList, options: Option):
cov_type = detect_compiler_ty... | 801 | 248 |
import os
import xml.etree.ElementTree as ET
from tempfile import NamedTemporaryFile
ENV_ASSET_DIR_V1 = os.path.join(os.path.dirname(__file__), 'assets_v1')
ENV_ASSET_DIR_V2 = os.path.join(os.path.dirname(__file__), 'assets_v2')
def full_v1_path_for(file_name):
return os.path.join(ENV_ASSET_DIR_V1, file_name)
... | 843 | 329 |
"""
LCCS Level 3 Classification
| Class name | Code | Numeric code |
|----------------------------------|-----|-----|
| Cultivated Terrestrial Vegetated | A11 | 111 |
| Natural Terrestrial Vegetated | A12 | 112 |
| Cultivated Aquatic Vegetated | A23 | 123 |
| Natural Aquatic Vegetated | A24 | 124 |
| Art... | 5,458 | 1,849 |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
from collections import defaultdict
n, m, ... | 1,115 | 386 |
# Generated by Django 3.0.2 on 2020-02-19 18:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('level1', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='conjugation',
name='he_future',
),
... | 893 | 277 |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class CaseStudiesApphook(CMSApp):
app_name = "case_studies"
name = "Case Studies Application"
def get_urls(self, page=None, language=None, **kwargs):
return ["rh.apps.case_studies.urls"]
apphook_pool.register(CaseStudiesA... | 328 | 116 |
from manimlib.imports import *
from srcs.utils import run
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_agg import FigureCanvasAgg
from sklearn import svm # sklearn = scikit-learn
from sklearn.datasets import make_moons
def mplfig_to_npimage(fig):
""" Converts a matplotlib ... | 2,989 | 1,252 |
from contextlib import contextmanager
from decimal import Decimal
from typing import *
import attr
from dlms_cosem import cosem, utils
from dlms_cosem.clients.dlms_client import DlmsClient
from dlms_cosem.cosem import Obis
from dlms_cosem.cosem.profile_generic import Data, ProfileGeneric
from dlms_cosem.protocol.xdlm... | 3,513 | 1,002 |
import copy
import datetime
import os
import random
import traceback
import numpy as np
import torch
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from inference.inference_utils import get_trange, get_tqdm
def init_random_seed(value=0):
random.seed(value)
np.random.seed(va... | 8,637 | 2,696 |
from django import forms
from app.models import Question, Profile, Answer
from django.contrib.auth.models import User
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwa... | 1,443 | 408 |
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
"""Language / domain filtering transforms."""
from functools import partial
import importlib
import inspect
import tldextract
from cc_emergency.functional.core import Filter
from cc_emergency.utils import first
class LanguageFilter(Filter):
"""Filters obj... | 3,722 | 1,006 |
from .__init__ import *
def volumeSphereFunc(maxRadius = 100):
r=random.randint(1,maxRadius)
problem=f"Volume of sphere with radius {r} m = "
ans=(4*math.pi/3)*r*r*r
solution = f"{ans} m^3"
return problem,solution
| 241 | 96 |
import os
import sys
import shutil
templateDir = "./Cylinder/WidgetTemplate"
widgetOutDir = "./Cylinder/rapyd/Widgets/"
if len(sys.argv) > 1:
name = sys.argv[1]
widgetDir = os.path.join(widgetOutDir, name)
if not os.path.exists(widgetDir):
if os.path.exists(templateDir):
os.mkdir(widg... | 841 | 257 |
import zmq
import time
import sys
import struct
import multiprocessing
from examples.sim_trace import generate_trace
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
socket_addr = "tcp://127.0.0.1:%s" % port
worker_count = multiprocessing.cpu_count() * 2 + 1
stop_signal = False
def worker(c... | 1,380 | 457 |
from dataclasses import dataclass
from typing import Optional, Union
from ensembl_genes.models import GeneForMHC
@dataclass
class Species:
name: str
common_name: str
assembly: str
ensembl_gene_pattern: str
enable_mhc: bool
mhc_chromosome: str
mhc_lower: int
mhc_upper: int
xmhc_low... | 3,532 | 1,434 |
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from model_bakery import baker
from app_covid19data.models import DataCovid19Item
from app_covid19data import views
class Covid19dataTest(TestCase):
def setUp(self):
""" Method which the testing framework ... | 1,294 | 393 |
from django.db import models
class Game(models.Model):
created_timestamp = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
release_date = models.DateTimeField()
esrb_rating = models.CharField(max_length=150)
played_once = models.BooleanField(default=False)
playe... | 407 | 127 |
import logging
import os
import datetime
import tba_config
import time
import json
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from consts.event_type import EventType
from consts.media_type imp... | 7,100 | 1,951 |
from typing import Optional, List
from aiogram import types, Dispatcher, filters
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import ReplyKeyboardMarkup
from handlers.common_actions_handlers import process_manual_enter, process_option_sel... | 3,841 | 1,174 |
"""Module related to processing of an outbound message"""
from typing import Dict, Optional
from utilities import integration_adaptors_logger as log
from builder.pystache_message_builder import MessageGenerationError
from message_handling.message_sender import MessageSender
import xml.etree.ElementTree as ET
logger = ... | 4,523 | 1,072 |
import string
def print_rangoli(size):
# your code goes here
'''
alphabets = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
symbol = '-'
array_size = size + 3*(size-1)
print(array_size)
for i in range(0,array_size):
for left_... | 809 | 319 |
import os
import matplotlib.pyplot as plt
import torch
from src.utils.get_model_and_data import get_model_and_data
from src.parser.visualize import parser
from .visualize import viz_epoch
import src.utils.fixseed # noqa
plt.switch_backend('agg')
def main():
# parse options
parameters, folder, checkpointna... | 779 | 248 |
from enum import Enum
from tortoise import fields
from tortoise.models import Model
class Status(str, Enum):
PENDING = "pending"
IMPORTED = "imported"
class Datasets(Model):
id = fields.CharField(36, pk=True)
provider = fields.CharField(10, null=False)
provider_id = fields.CharField(255, null=Fal... | 938 | 307 |
#!/usr/bin/env python
# Copyright 2018 Informatics Matters 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 applicab... | 6,046 | 1,738 |
#!/usr/bin/python3
################################################################################
# Copyright 2019 Supranational 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
#
# h... | 13,154 | 5,049 |
#-*- coding: utf-8 -*-
# StinoStarter.py
import os
import sublime
import sublime_plugin
st_version = int(sublime.version())
if st_version < 3000:
import app
else:
from . import app
class SketchListener(sublime_plugin.EventListener):
def on_activated(self, view):
pre_active_sketch = app.constant.global_settings.... | 23,422 | 8,711 |
def lambda_handler(event):
try:
first_num = event["queryStringParameters"]["firstNum"]
except KeyError:
first_num = 0
try:
second_num = event["queryStringParameters"]["secondNum"]
except KeyError:
second_num = 0
try:
operation_type = event["queryStringParame... | 1,358 | 435 |
from dqo.db.tests.datasets import employees_db_w_meta
from dqo.relational import SQLParser
from dqo.relational import parse_tree
test_db = employees_db_w_meta()
def test_condition_permutation():
sql = """
SELECT MIN(employees.salary)
FROM employees
WHERE employees.id > 200
""... | 3,994 | 1,301 |
import relstorage.storage
import ZODB.Connection
# Monkey patches, ook
def _ex_cursor(self, name=None):
if self._stale_error is not None:
raise self._stale_error
with self._lock:
self._before_load()
return self._load_conn.cursor(name)
relstorage.storage.RelStorage.ex_cursor = _ex_curs... | 1,326 | 429 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# ======================================================
# template1.py
# ------------------------------------------------------
# Created for Full Circle Magazine Issue #160
# Written by G.D. Walters
# Copyright (c) 2020 by G.D. Walters
# This source code is release... | 13,214 | 4,893 |
import numpy as np, pandas as pd
import math
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.tsa.stattools import adfuller, kpss, acf
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.figsize': (9, 7), 'figure.dpi': 120})
# Import data
def Read(name):
df = pd.read_csv(name + ... | 1,744 | 672 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 15:38:54 2020
@author: rayin
"""
# pic-sure api lib
import PicSureHpdsLib
import PicSureClient
# python_lib for pic-sure
# https://github.com/hms-dbmi/Access-to-Data-using-PIC-SURE-API/tree/master/NIH_Undiagnosed_Diseases_Network
from python_li... | 4,388 | 1,640 |
#!/usr/bin/env python3
import numpy as np
import h5py
import matplotlib.pyplot as plt
# import plotly.graph_objects as go
#========= Configuration ===========
DIR ="../data"
file_name = "particle"#"rhoNeutral" #"P"
h5 = h5py.File('../data/'+file_name+'.hdf5','r')
Lx = h5.attrs["Lx"]
Ly = h5.attrs["Ly"]
Lz = h5.at... | 672 | 319 |
import copy
import sys
from . import compat
from .compat import urlencode, parse_qs
class Request(compat.Request):
def __init__(self, url, parameters=None, headers=None):
self.parameters = parameters
if parameters is None:
data = None
else:
if sys.version_info >= (... | 882 | 239 |
import os
from flask import Flask
from dotenv import load_dotenv
from flask_cors import CORS
from flask_mail import Mail
# Database and endpoints
from flask_migrate import Migrate
from models.models import db
from endpoints.exportEndpoints import exportEndpoints
load_dotenv()
app = Flask(__name__, static_folder="../b... | 1,123 | 429 |
import getopt
import sys
import os
import logging.config
import time
import yaml
sys.path.append("../")
sys.path.append(os.path.abspath("."))
from core.app import APP
from core.utils.ciphersuites import CipherSuites
from core.utils.system_time import STime
from core.config.cycle_Info import ElectionPeriodValue
def ... | 5,812 | 2,185 |
from fastapi import FastAPI
from starlette.responses import RedirectResponse
from ratelimit import limits
import sys
import uvicorn
import requests
import json
import config
ONE_MINUTE = 60
app = FastAPI(title='Spraying conditions API',
description='API for real-time analysis of climatic conditions gene... | 3,274 | 1,040 |
import data_loader
import numpy as np
import pandas as pd
import pickle
import os
import nltk
import re
import timeit
from torch.autograd import Variable
import torch
from sklearn import preprocessing, svm
from sklearn.metrics import roc_auc_score, accuracy_score, classification_report
from sklearn.model_selection im... | 4,519 | 1,570 |
from setuptools import setup, find_packages
setup(
name='romodel',
version='0.0.2',
url='https://github.com/johwiebe/romodel.git',
author='Johannes Wiebe',
author_email='j.wiebe17@imperial.ac.uk',
description='Pyomo robust optimization toolbox',
packages=find_packages(),
install_require... | 344 | 119 |
"""
This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well
as testing instructions are located at http://amzn.to/1LzFrj6
For additional samples, visit the Alexa Skills Kit Getting Started guide at
http://amzn.to/1LG... | 11,138 | 3,308 |
from collections import defaultdict, Counter
import numpy as np
import time
from utils import one_hot_encode_seq, reverse_complement, overlap
import matplotlib.pyplot as plt
startt = time.time()
psis = []
data_path = '../../data'
save_to_cons = 'hipsci_majiq/exon/cons.npy'
introns_bef_start = 70 # introns
exons_afte... | 5,456 | 2,089 |
# Generated by Django 3.1.5 on 2021-03-17 21:30
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... | 8,228 | 2,034 |
# -*- coding: utf-8 -*-
"""
Iris classification example, pratice on using high-level API
Algorithms: Neutral Network
Reference: https://www.tensorflow.org/get_started/tflearn
Date: Jun 14, 2017
@author: Thuong Tran
@Library: tensorflow - high-level API with tf.contrib.learn
"""
from __future__ import absolute_impor... | 2,958 | 1,079 |
import discord
import os
import openpyxl
from deep_translator import GoogleTranslator
client = discord.Client()
TOKEN = os.getenv('TOKEN')
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author ==... | 1,728 | 531 |
# Import all libraries needed for the tutorial
import pandas as pd
import re
import requests
from bs4 import BeautifulSoup
from makePDFs import printPDFs
from time import sleep
#parses the rawtext into panda format
#add playerdata back
def generateStats(playerdata, teamName):
#Keys of all potential outcomes, dire... | 14,042 | 4,226 |
import os
import numpy as np
def load_utiris():
"""Fetches NIR images from UTIRIS dataset.
Retrieves image paths and labels for each NIR image in the dataset. There should already exist a directory named
'UTIRIS V.1'. If it does not exist then download the dataset from the official page (https://utiris.w... | 1,172 | 359 |
from crescent.core import Model
from .redirect_rule import RedirectRule
from .routing_rule_condition import RoutingRuleCondition
from .constants import ModelRequiredProperties
class RoutingRule(Model):
def __init__(self):
super(RoutingRule, self).__init__(required_properties=ModelRequiredProperties.ROUTIN... | 634 | 174 |
input1 = int(input("Enter the first number: "))
input2 = int(input("Enter the second number: "))
input3 = int(input("Enter the third number: "))
input4 = int(input("Enter the fourth number: "))
input5 = int(input("Enter the fifth number: "))
tuple_num = []
tuple_num.append(input1)
tuple_num.append(input2)
tuple_nu... | 457 | 166 |
import unittest
from finetune.util.input_utils import validation_settings
class TestValidationSettings(unittest.TestCase):
def test_validation_settings(self):
"""
Ensure LM only training does not error out
"""
val_size, val_interval = validation_settings(dataset_size=30, batch_siz... | 1,086 | 365 |
import copy
def combination_sum(candidates, target):
def backtrack(first, curr=[]):
if sum(curr) == target:
if curr not in output:
output.append(copy.deepcopy(curr))
return
if sum(curr) >target:
return
for i in range(first, n):
curr.append(candidates[first])
#print(c... | 1,743 | 570 |
import json
import microdata
import dateutil.parser
class ClaimReviewParser(object):
name_fixes = {
'Politifact': 'PolitiFact'
}
def parse(self, response, language='en'):
items = self.get_microdata_items(response)
scripts = response.css(
'script[type="application/ld+j... | 6,086 | 1,647 |
# Generated by Django 2.0.3 on 2018-03-16 00:17
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependenc... | 1,097 | 343 |
../UNET_EM_DATASET_BASE/utility.py | 34 | 17 |
import pandas as pd
from tqdm import tqdm
import json
import time
import os
from keras import backend, models, layers, initializers, regularizers, constraints, optimizers
from keras import callbacks as kc
from sklearn.model_selection import cross_val_score, KFold, train_test_split, GroupKFold
from sklearn.metrics impor... | 13,602 | 4,197 |
from ._unselected import Unselected
from plotly.graph_objs.scattermapbox import unselected
from ._textfont import Textfont
from ._stream import Stream
from ._selected import Selected
from plotly.graph_objs.scattermapbox import selected
from ._marker import Marker
from plotly.graph_objs.scattermapbox import marker
from ... | 430 | 124 |
from .commands import *
from .core.event_handler import *
from .utils import (
Constant
)
def plugin_loaded():
Constant.startup()
| 140 | 43 |
from .models import Post, Jcpaper
import django_filters
from django import forms
from django_filters.widgets import RangeWidget
class PostFilter(django_filters.FilterSet):
title = django_filters.CharFilter(
lookup_expr='icontains',
widget=forms.TextInput(attrs={'class': 'form-control'})
)
... | 1,584 | 498 |
import attr
from typing import List, Any, Dict, Union
import datetime as dt
from enum import Enum, unique, auto
from dateutil.relativedelta import relativedelta
import numpy as np # type: ignore
DATEFMT = "%Y-%m-%dT%H:%M:%SZ"
COMMON_FILE_HEADER_DATA = {
"creator_name": 'Donal Murtagh',
"creator_url": 'odi... | 11,293 | 4,002 |
# vim: set encoding=utf-8
from collections import defaultdict
from regparser.grammar import external_citations as grammar
from layer import Layer
class ExternalCitationParser(Layer):
# The different types of citations
CODE_OF_FEDERAL_REGULATIONS = 'CFR'
UNITED_STATES_CODE = 'USC'
PUBLIC_LAW = 'PUBLIC... | 2,549 | 766 |
import eventlet
import socketio
sio = socketio.Server(async_mode='eventlet')
app = socketio.WSGIApp(sio)
rooms = {}
instructors = {}
clients_in_rooms = {}
@sio.event
def connect(sid, environ):
print("[Server] ", sid, "connected")
@sio.event
def create_room(sid, name, room):
if room in rooms:
print... | 2,521 | 923 |
from telegram import Updater
from twilio.rest import TwilioRestClient
TELEGRAM_TOKEN = "INSERT_YOUR_TOKEN_HERE"
TWILIO_ACCOUNT_SID = "INSERT_ACCOUNT_SID_HERE"
TWILIO_AUTH_TOKEN = "INSERT_AUTH_TOKEN_HERE"
# initialize telegram updater and dispatcher
updater = Updater(token=TELEGRAM_TOKEN)
dispatcher = updater.dispatch... | 2,141 | 779 |
# Time: O(n!)
# Space: O(n)
class Solution(object):
def constructDistancedSequence(self, n):
"""
:type n: int
:rtype: List[int]
"""
def backtracking(n, i, result, lookup):
if i == len(result):
return True
if result[i]:
... | 899 | 277 |
#Longest Common Prefix in python
#Implementation of python program to find the longest common prefix amongst the given list of strings.
#If there is no common prefix then returning 0.
#define the function to evaluate the longest common prefix
def longestCommonPrefix(s):
p = '' #declare an empty s... | 868 | 243 |
import tweepy
from tweepy import OAuthHandler
import sys
import ConfigParser
from pymongo import MongoClient
import datetime
from random import randint
import time
# Mongo Settings
# Connect to MongoDB
client = MongoClient("hpc.iiitd.edu.in", 27017, maxPoolSize=50)
# Connect to db bitcoindb
db=client.activeprobing
s... | 2,827 | 1,051 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0060_customlink_button_class'),
]
operations = [
migrations.AddField(
model_name='customfield',
name='created',
field=models.DateField(auto_now... | 1,580 | 437 |
import http
import uuid
from itertools import chain, combinations
import pytest
import requests
import slash
def powerset(iterable):
s = list(iterable)
return (
frozenset(p) for p in chain.from_iterable((combinations(s, r)) for r in range(len(s) + 1))
)
def test_empty_issue(tracker):
with p... | 2,849 | 1,041 |
import os
import argparse
import six
import txaio
txaio.use_twisted()
import RPi.GPIO as GPIO
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.internet.error import ReactorNotRunning
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.wamp ... | 3,826 | 1,254 |
from celery.decorators import periodic_task
from celery.task.schedules import crontab
from celery.utils.log import get_task_logger
from utils import scraper
logger = get_task_logger(__name__)
# A periodic task that will run every minute
@periodic_task(run_every=(crontab(hour=10, day_of_week="Wednesday")))
def send_... | 468 | 156 |
from memsql.common import database
import sys
from datetime import datetime
DATABASE = 'PREPDB'
HOST = '10.1.100.12'
PORT = '3306'
USER = 'root'
PASSWORD = 'In5pir0n@121'
def get_connection(db=DATABASE):
""" Returns a new connection to the database. """
return database.connect(host=HOST, port=PORT, user=USER... | 806 | 266 |
from .global_options import *
class RemoveUserParser:
"""
Parser to removeusers command
"""
@staticmethod
def remove_user_parser(manager, command):
"""Method to parse remove user arguments passed by the user"""
remove_users_parser = manager.include(command)
remove_users_pa... | 534 | 140 |
#
# Create the FlightService enumeration that defines the following items (services):
# (free) snack, (free) refreshments, (free) meal, priority boarding,
# (free) onboard wifi, and an item for cases when services are not specified.
#
from enum import Enum
class FlightService(Enum):
unspecified = 0
snack = 1... | 6,819 | 1,948 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from documents.tests.utils import generate_random_documents
from categories.models import Category
class Command(BaseCommand):
args = '<number_of_documents> <category_id>'
help = 'Creates a given number of random d... | 722 | 221 |
import re
from typing import Any, Dict
from checkov.common.models.consts import DOCKER_IMAGE_REGEX
from checkov.common.models.enums import CheckResult
from checkov.kubernetes.checks.resource.base_container_check import BaseK8sContainerCheck
class ImagePullPolicyAlways(BaseK8sContainerCheck):
def __init__(self) -... | 2,004 | 562 |
# Generated by Django 3.2.6 on 2021-08-05 11:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0017_rename_user_recruiterpage_user_id'),
]
operations = [
migrations.RenameField(
model_name='recruiterpage',
old_n... | 381 | 138 |
import os
import glob
import sys
import argparse
import re
from collections import defaultdict
from celescope.__init__ import __CONDA__
from celescope.fusion.__init__ import __STEPS__, __ASSAY__
from celescope.tools.utils import merge_report, generate_sjm
from celescope.tools.utils import parse_map_col4, multi_opts, li... | 5,154 | 1,820 |