text
string
size
int64
token_count
int64
#!/usr/bin/env python import requests def kv2dict(kvinfo): kv = {} for item in kvinfo.split(","): item_list = item.split("=") kv[item_list[0]] = item_list[1].strip('"') return kv def get_service_realm(registry_url): registry_api_url = ( registry_url if registry_url.endswith("...
914
316
from flask import Flask, g from flask_cors import CORS from flask_jwt_extended import JWTManager from config import config from app.models import db, ma from app.models.RevokedToken import RevokedToken def create_app(config_name): app = Flask(__name__) CORS(app, resources={r"/api/*": {"origins": "*"}}) ap...
1,081
382
# Send .autoscroll in any chat to automatically read all sent messages until you call # .autoscroll again. This is useful if you have Telegram open on another screen. from pyrogram import Client, filters from pyrogram.types import Message app = Client("my_account") f = filters.chat([]) @app.on_message(f) def auto_...
730
233
from intermezzo import Intermezzo as mzo curCol = [0] curRune = [0] backbuf = [] bbw, bbh = 0, 0 runes = [' ', '░', '▒', '▓', '█'] colors = [ mzo.color("Black"), mzo.color("Red"), mzo.color("Green"), mzo.color("Yellow"), mzo.color("Blue"), mzo.color("Magenta"), mzo.color("Cyan"), mzo.c...
2,977
1,283
import logging from .media_reader import MediaReader from .util.media_type import MediaType class MediaReaderCLI(MediaReader): auto_select = False def print_results(self, results): for i, media_data in enumerate(results): print("{:4}| {}\t{} {} ({})".format(i, media_data.global_id, media...
1,896
566
""" Dependency management package. """ def debug_print(message: str, verbose: bool): """ Print if verbose is set to true. :param message: message to print :param verbose: whether to print :return: """ if verbose: print(message) def download_and_unzip_archive(url: str, zip_file_f...
1,272
390
from suds.client import Client from suds import WebFault from model.project import Project class SoapHelper: def __init__(self, app): self.app = app def can_login(self, username, password): client = Client("http://localhost/mantisbt-1.2.20/api/soap/mantisconnect.php?wsdl") try: ...
1,096
304
import torch import wandb def val( criterion=None, metric=None, loader=None, model=None, device=None ): r''' Args: criterion: a differentiable function to provide gratitude for backward metric: a score to save best model loader: a ...
1,113
339
def calculate(num1, num2=4): res = num1 * num2 print(res) print(calculate(5, 6))
89
39
######################################## # plot_fig07d_anaa_practical.py # # Description. Script used to actually plot Fig. 07 (d) of the paper. # # Author. @victorcroisfelt # # Date. December 29, 2021 # # This code is part of the code package used to generate the numeric results # of the paper: # # Crois...
4,428
1,906
import datetime from time import sleep import re import pytz # try: # from .emhmeter import MeterBase, create_input_vars, logger # except ModuleNotFoundError: # from emhmeter import MeterBase, create_input_vars, logger # TODO: Not working class GetTime: def __init__(self, input_vars): self.inpu...
6,697
2,291
# Results.py # # Created: Jan 2015, T. Lukacyzk # Modified: Feb 2016, T. MacDonald from SUAVE.Core import Data class Results(Data): pass
143
62
import re from typing import List from .utils import dumps from .types import DirectThread, DirectMessage from .exceptions import ClientNotFoundError, DirectThreadNotFound from .extractors import extract_direct_thread, extract_direct_message class Direct: def direct_threads(self, amount: int = 20) -> List[Direc...
3,889
1,077
""" This module contains the visualization bar class. """ import glob import os import re import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx from mpl_toolkits.mplot3d import Axes3D from matplotlib.ticker import FuncFormatter from cybercaptain.utils.exceptio...
26,090
7,991
import graphene from app.common.library import graphql from app.common.models import City from ..models import Profile from .queries import ProfileNode # queries class Query(graphene.ObjectType): pass # mutations class ProfileUpdateMutation(graphene.Mutation): Output = ProfileNode class Arguments: ...
3,560
986
# coding: utf-8 """ KubeVirt API This is KubeVirt API an add-on for Kubernetes. OpenAPI spec version: 1.0.0 Contact: kubevirt-dev@googlegroups.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class V1Genera...
7,401
2,000
# Copyright 2021 Tom Eulenfeld, MIT license import matplotlib as mpl import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import pickle from qopen.core import get_pair, Gsmooth from qopen.rt import G as G_func def set_gridlabels(ax, i, n, N, xlabel='frequency (Hz)', ylabel=None):...
3,352
1,481
import unittest import os import numpy as np from pymatgen import Structure from magmango.calculation.potcar import PotcarSettings # # class PotcarSettingsTest(unittest.TestCase): # def setUp(self): # self.potcar_file_path = "data/potcar_pto" # #self.structure = Structure.from_file(self.poscar_file_pa...
957
333
def pangram(s): a = "abcdefghijklmnopqrstuvwxyz" for i in a: if i not in s.lower(): return False return True # main string1 = input() if(pangram(string1) == True): print("Yes") else: print("No")
225
90
# -*- coding: utf-8 -*- """Serializer tests for the Dropbox addon.""" from nose.tools import * # noqa (PEP8 asserts) from website.addons.base.testing.serializers import StorageAddonSerializerTestSuiteMixin from website.addons.dropbox.tests.utils import MockDropbox from website.addons.dropbox.tests.factories import Dr...
773
233
import os import urllib import json import pprint from google.appengine.api import users from google.appengine.ext import ndb from google.appengine.api import urlfetch import jinja2 import webapp2 JINJA_ENVIRONMENT = jinja2.Environment( loader = jinja2.FileSystemLoader(os.path.dirname(__file__) + '/templates'),...
9,357
2,884
import datetime import unittest import contextlib import unittest.mock from typing import Any, Dict, Tuple, Mapping, Iterator, Optional import fakeredis from django_lightweight_queue.job import Job from django_lightweight_queue.types import QueueName from django_lightweight_queue.backends.reliable_redis import ( R...
9,348
2,870
from django.db import migrations def fill_allocation_user_usage(apps, schema_editor): AllocationUserUsage = apps.get_model('waldur_slurm', 'AllocationUserUsage') for item in AllocationUserUsage.objects.all(): item.allocation = item.allocation_usage.allocation item.year = item.allocation_usage...
653
204
# Get all carbon sources and return the objective flux. It can be normalized by the carbon input def get_carbon_sources(model,carbon_uptake=-10,normalize=True,original_source='EX_glc__D_e',carbon_source_list=[]): cobra.io.write_sbml_model(model,"tmp.xml") if len(carbon_source_list)==0: for reaction in m...
2,430
766
import sys sys.path.append('../') import unittest import sys sys.path.insert(0,"C:/Users/jcroz/github/StableMotifs") import pystablemotifs as sm import pyboolnet.file_exchange class test_StableMotifs(unittest.TestCase): rules='''A*=B B*=A C*=A or not D D*=C E*=B and F F*=E ''' rules_pbn = sm.format.booleanne...
17,970
6,373
# -*- coding: utf-8 -*- """ Copyright 2018 Alexey Melnikov and Katja Ried. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Please acknowledge the authors when re-using this code and maintain this notice intact. Code written by Katja Ried...
4,584
1,440
from __future__ import (absolute_import, division, print_function, unicode_literals) class Slit: def __init__(self, x, y, length, width, pa, name): ''' Representation of a slit in a mask. Coordinates are relative to the mask, so that the x-axis is along the lon...
1,174
366
from .abstract_builder import AbstractBuilder from gemmforge.symbol_table import SymbolType, Symbol from gemmforge.basic_types import RegMemObject, ShrMemObject from gemmforge.instructions import RegisterAlloc, ShrMemAlloc from gemmforge.basic_types import GeneralLexicon from abc import abstractmethod class AbstractA...
1,940
631
__________________________________________________________________________________________________ sample 32 ms submission class Solution: def lastStoneWeightII(self, stones: List[int]) -> int: total = sum(stones) sums = {0} for s in stones: sums |= {s + i for i in sums} ...
1,104
307
# # @lc app=leetcode id=809 lang=python3 # # [809] Expressive Words # # https://leetcode.com/problems/expressive-words/description/ # # algorithms # Medium (46.84%) # Likes: 320 # Dislikes: 823 # Total Accepted: 45.2K # Total Submissions: 96.2K # Testcase Example: '"heeellooo"\n["hello", "hi", "helo"]' # # Somet...
3,043
1,085
Size = (1255, 1160) Position = (39, 26) ScaleFactor = 1.0 ZoomLevel = 32.0 Orientation = 0 Mirror = False NominalPixelSize = 0.125 filename = 'Z:\\All Projects\\Crystallization\\2018.08.27.caplilary with crystals inspection\\2018.08.27 CypA 2.jpg' ImageWindow.Center = (649, 559) ImageWindow.ViewportCenter = (2.41796875...
1,601
786
# -*- coding: utf-8 -*- """Utilities for the ROCKE3D output.""" import dask.array as da import xarray as xr from grid import reverse_along_dim, roll_da_to_pm180 from model_um import calc_um_rel from names import rocke3d __all__ = ("adjust_rocke3d_grid", "calc_rocke3d_rei", "calc_rocke3d_rel") calc_rocke3d_rel = calc...
3,259
1,264
from wordcloud import WordCloud,STOPWORDS import matplotlib.pyplot as plt import numpy as np import pandas as pd import re import multidict as multidict from collections import Counter import json import datetime import os plt.switch_backend('agg') def removePunctuation(text): text = re.sub(r'[{}]+'.format('!,;:?`"...
4,090
1,549
from python_graphql_client import GraphqlClient import pathlib import re import os root = pathlib.Path(__file__).parent.resolve() client = GraphqlClient(endpoint="https://graphql.anilist.co") TOKEN = os.environ.get("ANILIST_TOKEN", "") def replace_chunk(content, marker, chunk, inline=False): r = re.compile( ...
2,996
944
# Generated by Django 2.0.6 on 2019-07-10 03:56 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='WateringSession', fields=[ ('identifier', m...
844
220
# coding: utf-8 """ Sematext Cloud API API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`. # noqa: E501 OpenAPI spec version: v3 ...
30,324
8,912
from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib import messages from app_startup4.models import StartupCompetition def registerListView(request): """ จัดการข้อมูลและพิจารณา ผู้สมัครที่ส่งข้อมูลเข้ามา """ queryset = StartupCompetition.objects.filter(s...
3,706
1,524
# -*- python -*- # This software was produced by NIST, an agency of the U.S. government, # and by statute is not subject to copyright in the United States. # Recipients of this software assume all responsibilities associated # with its operation, modification and maintenance. However, to # facilitate maintenance we ...
3,462
1,316
# -*- coding: utf-8 -*- """ Created on 21 October 2017 implements Listing 1.2. MATLAB Program “fig1_12.m” in Mahafza radar book @author: Ashiv Dhondea """ import numpy as np import RadarBasics as RB import RadarConstants as RC import RadarEquations as RE # Importing what's needed for nice plots. import matplotlib...
4,366
2,206
# coding=utf-8 import functools import warnings from django.shortcuts import render from .forms import ContactForm from catalog.views import Product from django.views.generic import View, TemplateView, CreateView from django.contrib.auth import get_user_model from django.contrib import messages # Sobrecarga da classe...
4,770
1,270
/home/runner/.cache/pip/pool/d9/2c/a4/7718a956dd946c833114214fec833728fef3062ae858a03a9d82cf9dc7
96
73
import unittest import jekpost.jekpost_create as jek from datetime import date class JekpostTests(unittest.TestCase): def test_date_gets_formatted(self): """ Check 31-DEC-2016 (2016-12-31) 1-NOV-2015 (2015-11-01) 11-JAN-2015 (2015-01-11) """ sam...
1,087
421
# This example demonstrates how to regrid between a mesh and a locstream. import ESMF import numpy import ESMF.util.helpers as helpers import ESMF.api.constants as constants # This call enables debug logging # ESMF.Manager(debug=True) from ESMF.util.mesh_utilities import mesh_create_5, mesh_create_5_parallel from E...
2,636
979
HISTORYDAY = 7 DAYTIMESTEP = 24 * 12
36
21
""" # ============================================================================== # ToPy -- Topology optimization with Python. # Copyright (C) 2012, 2015, 2016, 2017 William Hunter. # Copyright (C) 2020, 2021, Tarcísio L. de Oliveira # ============================================================================== "...
714
239
# -*- coding: utf-8 -*- """ @Project : @FileName: @Author :penghr @Time :2021/11/xx xx:xx @Desc : FIDTM-train/dataset/FIDTM/ ├── test │ ├── gt_fidt_map │ │ └── IMG_8.h5 │ ├── g...
4,788
1,894
try: from django.urls import path, include except: from django.conf.urls import url as path, include from django.contrib import admin urlpatterns = [ path(r'^admin/', admin.site.urls), path(r'^app/', include('tests.app.urls')), path(r'^adyen/notifications/', include('djadyen.notifications.urls', n...
356
117
from .ArrayType import * from .ArrayTypeRef import * from .CompositeType import * from .FunctionType import * from .FunctionTypeRef import * from .IntegerType import * from .IntegerTypeRef import * from .NamedType import * from .ParamTypes import * from .PointerType import * from .PointerTypeRef import * from .StructTy...
583
165
XiphPackage ('speex', 'speex', '1.2rc1')
41
21
# Create by Packetsss # Personal use is allowed # Commercial use is prohibited from django.shortcuts import render # Create your views here. from django.http import HttpResponse, HttpResponseRedirect from .models import ToDoList, Item from .forms import Create_list def index(response, id): lst = ToDoList.objects...
2,105
640
import asyncio from discord.ext import commands from src.BaseCog import BaseCog from src.DB import DB from src.Reasons import Reasons class Commands(BaseCog): def __init__(self, bot, config): super().__init__(bot, config) self.reasons = Reasons() HELP_MESSAGE = """ Command: `/kkb <action>...
5,610
1,721
from cmath import nan from sqlite3 import DatabaseError import pandas as pd import numpy as np import json def load_from_csv(path): dt = pd.read_csv(path, sep=';', dtype={'matricule': object}) return dt.set_index('matricule') def fix_matricule(matricule): if matricule.startswith('195'): return '19...
2,981
1,084
from compressor.storage import CompressorFileStorage class CanvasFileStorage(CompressorFileStorage): def url(self, path): return "//canvas-dynamic-assets.s3.amazonaws.com/static/" + path
201
60
import numbers class NoneT(object): def __repr__(self): return 'NoneT()' def __str__(self): return 'None' def msct(self, other): if isinstance(other, NoneT): return self return MaybeT(other) class MaybeT(object): def __init__(self, childT): self....
6,104
1,921
import os import numpy import copy import argparse from matplotlib import pyplot from src.radiotelescope import RadioTelescope from src.radiotelescope import BaselineTable from src.skymodel import SkyRealisation from simulate_beam_covariance_data import compute_baseline_covariance from simulate_beam_covariance_data im...
5,705
1,775
# Generated by Django 4.0.1 on 2022-01-20 15:12 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('wspay', '0003_rename_wspaytransaction_transactionhistory_and_more'), ] operations = [ migrations.RemoveField( model_name='wspayrequest',...
371
128
from anthill.common.validate import validate from anthill.common import admin as a, update from . model.event import EventNotFound, CategoryNotFound, EventFlags, EventEndAction import ujson import collections EVENT_END_ACTION_DESCRIPTION = """ <b>Send Message</b><br>A message with detailed information about event ...
24,456
6,545
import sys, os # sys.path.append(os.path.join(os.path.dirname(__file__)) #TODO: Is this a good idea? Dunno! It works! # print(os.path.join(os.path.dirname(__file__))) import argparse import markov_pilot.environment.properties as prp from markov_pilot.environment.environment import NoFGJsbSimEnv_multi, J...
15,704
5,235
# -*- coding: utf-8 -*- """Core ATM module. This module contains the ATM class, which is the one responsible for executing and orchestrating the main ATM functionalities. """ import logging import random import time from datetime import datetime, timedelta from operator import attrgetter from tqdm import tqdm from...
19,781
5,196
""" Leeds Sports Pose (LSP) Dataset download/process functions. """ from dbcollection.datasets import BaseDataset from .keypoints import Keypoints, KeypointsOriginal urls = ( 'http://sam.johnson.io/research/lsp_dataset_original.zip', { 'url': 'http://sam.johnson.io/research/lsp_dataset.zip', ...
742
241
#!/usr/bin/env python from __future__ import print_function import tables import argparse import numpy as np import sys def check_mainbrain_h5_contiguity( filename, slow_but_less_ram=False, shortcircuit=False, verbose=False ): failed_obj_ids = [] if verbose: print("opening %r" % filename) with...
3,505
1,101
import sys import traceback import webbrowser from argparse import ArgumentParser, Namespace from os import path from tkinter import Tk, messagebox, filedialog from mangareader.mangarender import extract_render from mangareader import templates from time import sleep def parse_args() -> Namespace: parser = Argume...
2,304
705
#!/usr/bin/env python3 import socket import os import time import threading def power_on(): os.system("sudo bash ./start_vm.sh") if __name__ == "__main__": n=os.fork() if n>0: os.system("sleep 2") os.system("sudo ip addr add 172.19.0.1/24 dev tap1") os.system("...
483
175
# Copyright (c) 2018 R. Tohid # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) from phylanx import Phylanx, PhylanxSession @Phylanx def foo(): a = 2 return a def main(): assert (2 == foo()) if _...
381
162
import requests import json def openPosts(): data = "" try: f = open("scifi_stackexchange.json") data = f.read() except IOError: stackExchangeData ="https://storage.googleapis.com/quepid-sample-datasets/elasticsearch/scifi_stackexchange.json" resp = requests.get(stackExchan...
1,073
321
import os import zipfile from ..core import Instance def get_test_instance(zip, filename): directory = os.path.dirname(__file__) zip_path = os.path.join(directory, zip) zip_obj = zipfile.ZipFile(zip_path) data = zip_obj.read(filename) return Instance.from_mm(path=None, content=data.decode().splitl...
332
111
#This program shows the amount of each ingredient needed for a numbers of cookies. #constants sugar = 1.5 butter = 1 flour = 2.75 cookies = 48 #input numOfCookies = int(input('Enter the number of cookies:')) #calculation amtSugar = sugar / cookies * numOfCookies amtButter = butter / cookies * numOfCookies amtFlour ...
1,634
686
import unittest from datetime import datetime, timedelta from pkg_resources import parse_version import reqcheck.versions as versions class GetBehindNumVersionsTest(unittest.TestCase): def setUp(self): self.versions = [ {'version': parse_version('1.0.1')}, {'version': parse_versi...
3,778
1,438
#!/usr/bin/env python from seoaudit.checks.element import ElementCheck from seoaudit.checks.page import PageCheck from seoaudit.checks.site import SiteCheck page_tests = [(PageCheck.TEXT_TO_CODE_RATIO, {"min_ratio": 0.1}), (PageCheck.DOM_SIZE, {"max_size": 1500}), [PageCheck.ELEMENTS_SIMILA...
2,437
844
# Copyright (c) <2015> <Sergi Delgado Segura> # Distributed under the BSD software license, see the accompanying file LICENSE from pyasn1.codec.der import encoder, decoder from pyasn1_modules.rfc2459 import Certificate from Crypto.PublicKey import RSA from M2Crypto import X509 from hashlib import sha256 from os import...
3,822
1,168
import random import sys sys.setrecursionlimit(15000) count_columns = 50 count_rows = 40 matrix = [[random.randint(0, 1) for i in range(count_columns)] for j in range(count_rows)] matrix = [[0] * count_columns for _ in range(count_rows)] for _ in range(10): matrix[random.randint(0, count_rows - 1)][random.randin...
1,340
475
from portabletext_html.renderer import PortableTextRenderer, render __all__ = ['PortableTextRenderer', 'render']
114
33
def cg(n, a1=1, q=2): n = n - 1 while n > 0: a1 = a1 * q n = n - 1 return a1 print("{} wyraz ciagu geometrycznego gdzie a1 = {}, q = {} wynosi {}".format(4, 1, 5, cg(4, 1, 5))) print("{} wyraz ciagu geometrycznego gdzie a1 = {}, q = {} wynosi {}".format(7, 1, 2, cg(7)))
309
147
import click import IPython from code42cli import BANNER from code42cli.options import sdk_options @click.command() @sdk_options() def shell(state): """Open an IPython shell with py42 initialized as `sdk`.""" IPython.embed(colors="Neutral", banner1=BANNER, user_ns={"sdk": state.sdk})
296
103
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Yee_172' __date__ = '2017/12/03' import sys PATH = sys.path[0][:-4] sys.path.append(PATH) from src.Func import * win = MainWin() sys.exit(app.exec_())
216
104
import requests, os dir_name = os.path.basename(os.path.dirname(os.path.realpath(__file__))) save_path = "../../lists/"+dir_name+"/" def main(): ips = set() with open(save_path+"all.txt","r",encoding="UTF-8") as f: for line in f: ips.add(line[:-1]) url_ = 'https://api.protonmail.c...
1,191
475
# Dakota Python Driving Script # necessary python modules import dakota.interfacing as di import subprocess import sys import os import multiprocessing sys.path.append('../../scripts') import input as inp import output as oup import external_cym cycdir = '../../cyclus-files/sobol/' # -----------------...
2,809
1,043
""" BASIC LINEAR REGRESSION CODE Consider this my first application of what I understood about ML/DL so far. I wrote this to check my understanding of the basic concepts. It's pretty simple but I needed to get my feet wet with code. Any suggestions for modifications are welcome! """ #x and y data...
873
376
""" Debug helpers. """ import io import logging from typing import Union, Optional, Callable import numpy as np import pandas as pd _printt_log_method = print def set_log_method(log_method: Optional[Callable] = None) -> None: global _printt_log_method # pylint: disable=global-statement if log_method is no...
5,690
1,917
import os import re import sys from collections import defaultdict try: from setuptools import setup except ImportError: from distutils.core import setup def get_version(*file_paths): """Retrieves the version from django_directed/__init__.py""" filename = os.path.join(os.path.dirname(__file__), *file...
3,862
1,246
import json import os import shutil from copy import deepcopy from pathlib import Path def create_and_overwrite_dir(path_dir): # Create the directory Path(path_dir).mkdir(parents=True, exist_ok=True) # Overwrite the directory for path in os.listdir(path_dir): try: os.remove(os.path.join(p...
2,050
652
# -*- coding: utf-8 -*- """ Created on Wed Feb 6 23:26:38 2019 @author: avaca """ import pandas as pd import numpy as np from sklearn.model_selection import GridSearchCV complete_data = pd.read_csv('', encoding = 'utf-8') vars_categ = ['HY_provincia', 'HY_tipo']
269
114
import re inputfile = '/Users/csiu/project/webCrawler/extractPrimer/test.txt' primerStart = """5'""" primerEnd = """3'""" nucleotides = '[ATGCN]' linePrimerEnding = re.compile(nucleotides + '$') linePrimerStarting = re.compile('^' + nucleotides) with open(inputfile, 'r') as f: for line in f: if primerSt...
1,326
367
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.models import User from django.utils.translation import gettext as _ from core import models class UserAdmin(BaseUserAdmin): """Admin panel configuration for User model""" list_display ...
1,213
363
import pytest import os import json import boto3 from click.testing import CliRunner from moto import mock_ssm @pytest.fixture def runner(): return CliRunner() @pytest.fixture(scope='function') def aws_credentials(): """Mocked AWS Credentials for moto.""" os.environ['AWS_ACCESS_KEY_ID'] = 'test' os...
1,806
620
"""Create plots for learning from varying numbers of demonstrations.""" import os import matplotlib import matplotlib.pyplot as plt import pandas as pd from predicators.scripts.analyze_results_directory import create_dataframes, \ get_df_for_entry pd.options.mode.chained_assignment = None # default='warn' # pl...
5,656
1,944
import os from collections import OrderedDict try: import joblib except ImportError: pass try: import numpy as np except ImportError: pass from pyaedt import constants from pyaedt.generic.general_methods import generate_unique_name from pyaedt.generic.general_methods import pyaedt_function_handler fro...
85,638
25,044
"""Retainn web-fetching functions.""" try: # Python 3 from urllib.request import Request, urlopen except ImportError: # Python 2 from urllib2 import Request, urlopen def http_get_deck_and_etag(gist_url): """Download the markdown and etag of a deck URL.""" response = urlopen(gist_url + "/raw")...
1,119
385
from django.conf.urls.defaults import * urlpatterns = patterns('clwmail.admin.views', (r'user/manage/page/(?P<page_num>\d{1,})/$' ,'usermanage'), (r'user/manage/page/$' ,'usermanage'), (r'user/add/$' ,'useradd'), (r'user/...
1,511
517
import os import torch import pandas as pd from skimage import io, transform import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils # Ignore waring import warnings warnings.filterwarnings('ignore') plt.ion() landmarks_frame = pd.r...
670
229
import logging as log import sys from extra.introspection import collect_datasets, collect_wrong_solutions from implementation.checker import output_reader, checker as check from implementation.solver import input_reader, solver as solve, hinter as get_hint from pre_definition.solve_caller import call_with_args from p...
6,020
1,806
from .locale import LocaleValidator from .timezone import TimezoneValidator __all__ = ( 'LocaleValidator', 'TimezoneValidator', )
139
41
class Solution: # @param a list of integers # @return an integer def removeDuplicates(self, A): length = len(A) if length <= 1: return length index = 1 for i in range(1, length): if A[i] != A[i-1]: A[index] = A[i] index ...
346
105
# Generated by Django 2.0.10 on 2019-02-01 01:36 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('algorithms', '0002_auto_20190201_0013'), ] operations = [ migrations.RemoveField( model_name='algorithmimage', name='algori...
421
145
# Copyright (C) 2002-2021 S[&]T, The Netherlands. # 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 notice, # this list of condi...
3,704
1,150
# -*- coding: utf-8 -*- """Watching for registration events""" import time from dataclasses import dataclass, asdict import iscc_registry from loguru import logger as log import iscc from iscc_registry.conn import db_client from iscc_registry.publish import get_live_contract from iscc_registry import tools from iscc_re...
3,473
1,213
from erdos.data_stream import DataStream from erdos.message import Message from erdos.op import Op from erdos.timestamp import Timestamp from erdos.utils import setup_logging import flux_utils from flux_utils import is_control_stream, is_not_control_stream from flux_buffer import Buffer import threading class FluxEg...
2,670
784
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 10 11:07:05 2018 @author: chrispedder To train the model, run from the top-level dir as: python3 -m src.CNN_models.train_model --args ... """ import numpy as np import os import argparse import json import tensorflow as tf from abc import ABC, ...
6,400
1,990
""" Transform SQLAlchemy Models to PFB Schema """ import os import logging import inspect import subprocess from collections import defaultdict import timeit from pprint import pformat from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.inspection import inspect as sqla_inspect from sqlalchemy.orm.properti...
8,063
2,257
"""ASCII-ART 2D pretty-printer""" from .pretty import pprint, pprint_use_unicode, pretty, pretty_print
104
39