id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
4830825
<filename>visualisation/core/SaliencyMap.py import torch from .Base import Base from torch.nn import ReLU from torch.autograd import Variable from torchvision.transforms import * from .utils import convert_to_grayscale class SaliencyMap(Base): """ Simonyan, Vedaldi, and Zisserman, “Deep Inside Convolutional N...
StarcoderdataPython
3303717
# AZLyrics website AZ_LYRICS_BASE_URL = 'https://www.azlyrics.com' AZ_LYRICS_ARTIST_LETTER_LIST = [ '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', '19' ] # Scrapping SCRAPE_PROXY = 'socks5://127.0.0.1:9050' SCRAPE_RTD_MINIMUM = ...
StarcoderdataPython
41134
<reponame>happy-machine/ktrain<gh_stars>0 # Global version information __version__ = "0.7.2"
StarcoderdataPython
193779
<filename>lang/py/src/avro/tool.py #! /usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Ap...
StarcoderdataPython
1670403
<filename>ic3_labels/labels/modules/event_generator/multi_cascade_labels.py import numpy as np from icecube import dataclasses, icetray from ic3_labels.labels.base_module import MCLabelsBase from ic3_labels.labels.utils import high_level as hl from ic3_labels.labels.utils.cascade import get_cascade_em_equivalent cla...
StarcoderdataPython
1704648
import json import pymongo from flask import request, abort, json, render_template, Response from flask.ext import restful from flask.ext.restful import reqparse from flask_rest_service import app, api, mongo from bson.objectid import ObjectId from bson.code import Code # ----- /stats ----- class Stats(restful.Resour...
StarcoderdataPython
3232890
<filename>src/basic/03_advanced_features/slides.py # -*- coding: utf-8 -*- # 使用 切片实现 trim,更简洁的方法 def trim(s): print("input:",s) # 这里不要用 s[0],因为 s[:1]取得的是一个列表,可以为None while s[:1]==' ': print("res:",s) s = s[1:] while s[-1:]==' ': print("res:",s) s = s[:-1] return s # 使用 切片实现 trim, 更高效的方法 def trim2(s): i ...
StarcoderdataPython
4814038
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import absolute_import import sys def dependencies_string(): """ Return a string with versions of numpy, scipy and scikit-learn. Saved scikit-learn models may be not compatible between different numpy/scipy/scikit-learn versions; a string returned...
StarcoderdataPython
65147
<filename>web_version/languages/nl.py # -*- coding: utf-8 -*- { '!langcode!': 'nl', '!langname!': 'Nederlands', '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete ...
StarcoderdataPython
105848
<reponame>etiennegalea/MAS_ReinforcementLearning class State: 'Defined state of cell in grid world' def __init__(self, pos=[0,0], reward= -1, movable=True, absorbing=False, agent_present=False): self.pos = pos self.reward = reward self.movable = movable self.absorbing = absorbing...
StarcoderdataPython
153329
<filename>frn.py<gh_stars>0 import chainer import chainer.functions as F class FilterResponseNormalization(chainer.Link): def __init__(self, hidden_dim): """ Input ----- hidden_dim: # of hidden unit dimensions """ super(NodeFilterResponseNormalization, self).__init__...
StarcoderdataPython
157687
__all__ = ['GeneratorContentStyle'] from collections import defaultdict import torch from hidt.networks.generators import GeneratorBase class GeneratorContentStyle(GeneratorBase): # AdaIN auto-encoder architecture def __init__(self, params): super().__init__(params) self.style_dim = self.d...
StarcoderdataPython
189776
from django.urls import path from . import views urlpatterns = [ path('', views.customer_list, name='customer_list'), path('customer/<int:pk>', views.customer_detail, name='customer_detail'), path('customer/new', views.customer_new, name='customer_new'), path('customer/<int:pk>/edit', views.customer_ed...
StarcoderdataPython
191610
<gh_stars>0 #!/usr/bin/python3 #Abdirahman & Jason #perfmon.py #import modules import os, sys import time #display menu options os.system("clear") os.system('echo $USER') print(time.strftime('%b/%d/%Y')) print("Performance Monitor Started!\nChoose an option for more detailed information:\nMemory\nDrives\nUsers\nNet...
StarcoderdataPython
110479
class Solution: def MoneySum(self, )
StarcoderdataPython
195871
import subprocess from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module from Cython.Build import cythonize from common.cython_hacks import BuildExtWithoutPlatformSuffix sourcefiles = ['parser_pyx.pyx'] extra_compile_args = ["-std=c++11"] #ARCH = subprocess.check_output(["uname...
StarcoderdataPython
1653972
from django.db import models # Create your models here. class MovieRanking(models.Model): ranking = models.DecimalField(max_digits=20, decimal_places=5, default=0) title = models.CharField(max_length=100) class MovieReview(models.Model): title = models.CharField(max_length=100) code = models.Decim...
StarcoderdataPython
1652202
# -*- coding: utf-8 -*- import pytest import time import sys import socket from .test_base_class import TestBaseClass from .as_status_codes import AerospikeStatus from aerospike import exception as e aerospike = pytest.importorskip("aerospike") try: import aerospike except: print("Please install aerospike pyt...
StarcoderdataPython
1609273
<reponame>CommitThis/black-box-bmv2 from docker import DockerClient from docker import APIClient from simple_switch.simple_switch_runner import SimpleSwitchDocker from shutil import copytree from shutil import rmtree import os def compile_p4(source_dir, main): name = '.'.join(main.split('.')[:-1]) tmp_dir =...
StarcoderdataPython
1761871
# -*- coding:utf-8 -*- # author: Cone # datetime: 2020-01-10 17:09 # software: PyCharm def singleton(cls): _instance = {} def inner(): if cls not in _instance: _instance[cls] = cls() return _instance[cls] return inner class Singleton(object): def __init__(self, cls): ...
StarcoderdataPython
3295482
<gh_stars>0 # Copyright 2016-2021, Pulumi Corporation. # # 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...
StarcoderdataPython
4823299
from flask import Blueprint, request, jsonify, abort from main.auth import encode_jwt from main.auth import jwt_required from main.libs.password import hash_password, verify_password from main.models.user import UserModel from main.schemas.user import user_schema, password_validation_schema users = Blueprint("users",...
StarcoderdataPython
114720
from isce3.ext.isce3.antenna import *
StarcoderdataPython
1758444
<filename>fsleyes/actions/loaddicom.py #!/usr/bin/env python # # loaddicom.py - The LoadDicomAction class. # # Author: <NAME> <<EMAIL>> # """This module provides the :class:`LoadDicomAction` class, an :class:`.Action` which allows the user to load images from a DICOM directory. A few standalone functions are also defi...
StarcoderdataPython
1699657
#Напечатает: H a = 3 if a > 2: print("H") else: print("L") #Напечатает: H a = 1 if a > 2: print("H") else: print("L") #В результате выполнения такого кода будет напечатано: True a = 17 b = True if a > 10 else False print(b)
StarcoderdataPython
1685478
from typing import Any, Sequence from tango import Format, JsonFormat, Step from tango.common import DatasetDict from tango.common.testing import run_experiment @Step.register("train_data") class TrainData(Step): DETERMINISTIC = True CACHEABLE = False def run(self) -> Sequence[int]: # type: ignore ...
StarcoderdataPython
24206
<reponame>thamenato/pants # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.testutil.pants_integration_test import run_pants def test_goals() -> None: pants_run = run_pants(["goals"]) pants_run.assert_success() as...
StarcoderdataPython
1734137
import numpy as np import pandas as pd import bioframe from bioframe import binnify, frac_gene_coverage, frac_gc from bioframe import load_fasta from mirnylib.genome import Genome def gene_content(genome, binsize, gc=True): chrom_sizes = bioframe.fetch_chromsizes(genome) chrom_table = binnify(chrom_size...
StarcoderdataPython
3351267
<reponame>Pyramid-Surgeon/pyramid_python from functools import reduce from typing import List, Dict from math import gcd import random class Arnault: """ Solver class that attempts to find strong pseudoprimes to the miller-rabin test according to the method presented by <NAME> in https://www.sciencedirect.com...
StarcoderdataPython
1692124
""" Tests of sbml2julia command line interface (sbml2julia.__main__) :Author: <NAME> <<EMAIL>> :Date: 2020-04-26 :Copyright: 2020, <NAME> :License: MIT """ import capturer import mock import os import pkg_resources import re import sbml2julia import shutil import tempfile import unittest from sbml2juli...
StarcoderdataPython
127116
<gh_stars>1-10 import os from pathlib import Path PALETTE = { 'success': '#00c841', 'info': '#1976a3', 'error': '#d40000' } LINE = '-' * 100 ELEMENTS = [1, 0] DEFAULT_QUANTILE = 0.05 HOME_DIR = str(Path.home()) IPDF_DATADIR = os.getenv('IPDF_DATADIR') if not IPDF_DATADIR: IPDF_DATADIR = os.path.j...
StarcoderdataPython
100881
import inspect from argparse import ArgumentParser, Namespace from typing import Union, List, Tuple, Any def from_argparse_args(cls, args: Union[Namespace, ArgumentParser], **kwargs): """ Create an instance from CLI arguments. Args: args: The parser or namespace to take arguments from. Only known...
StarcoderdataPython
4812150
<reponame>yoelcortes/Bioindustrial-Complex<filename>BioSTEAM 2.x.x/biorefineries/lipidcane/units.py<gh_stars>10-100 # -*- coding: utf-8 -*- """ """ import os import sys import flexsolve as flx from thermosteam import MultiStream from biosteam import Unit from biosteam.units.decorators import cost, design from biosteam....
StarcoderdataPython
3343526
<reponame>aarunsai81/netapp # Copyright 2011 OpenStack Foundation # Copyright 2013 IBM Corp. # 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:/...
StarcoderdataPython
3367821
<filename>package/learning/main.py #!/usr/local/bin/python2.7 # -*-coding:UTF-8-sig -*- """ Module for executing calculation Learning Algorithm - 2015 - Subena """ import package.learning.parameter as learningParameter #import package.learning.structure as learningStructure def execute(): #crit...
StarcoderdataPython
1755459
<gh_stars>0 import ftplib import time import os import ast from pathlib import Path class FTPConnection: def __init__(self, server, port=21, username='anonymous', password='<PASSWORD>'): self.server = server self.port = port self.username = username self.password = password d...
StarcoderdataPython
4814885
import numpy as np import pandas as pd import requests from bs4 import BeautifulSoup from Helpers import find_between class CJH_Archives: def __init__(self, repo, url=False): self.repo = repo self.url = url def get_meta_data(self, object_type, page_to_start_at, maximum_pages_to_scrape): ...
StarcoderdataPython
61647
#!/usr/bin/env python """Basic operations on dataframes.""" import pandas as pd # This script isn't for execution, just for notes # explore the shape and contents of a dataframe df.describe() df.info() df.shape df.columns df.index df.head(10) df.tail(10) type(df) # <class 'pandas.core.frame.DataFrame'> type(df['a']...
StarcoderdataPython
1619000
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import sys import ConfigParser import json import urllib3 import pprint ####################################################################################### # # Retrieves and parses values via the Elasticsearch API # #########################...
StarcoderdataPython
1770248
<gh_stars>1-10 # Generated by Django 3.0.8 on 2020-07-31 13:35 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('picha', '0003_auto_20200731_1505'), ] operations = [ migrations.AddField( model_...
StarcoderdataPython
154219
""" import from core """ from holland.core.backup.base import BackupError, BackupRunner, BackupPlugin
StarcoderdataPython
73571
from torch.utils.data import ConcatDataset from ssd.config.path_catlog import DatasetCatalog from .voc_dataset import VOCDataset from .coco_dataset import COCODataset def build_dataset(dataset_list, transform=None, target_transform=None, is_test=False): assert len(dataset_list) > 0 datasets = [] for data...
StarcoderdataPython
1609016
<filename>dojo/components/views.py from django.shortcuts import render from django.db.models import Count, Q from dojo.utils import add_breadcrumb, get_page_items from dojo.filters import ComponentFilter from dojo.components.sql_group_concat import Sql_GroupConcat from django.db import connection from django.contrib.po...
StarcoderdataPython
117788
<filename>opencv_project_python-master/opencv_project_python-master/06.filter/morph_open_close.py import cv2 import numpy as np img1 = cv2.imread('../img/morph_dot.png', cv2.IMREAD_GRAYSCALE) img2 = cv2.imread('../img/morph_hole.png', cv2.IMREAD_GRAYSCALE) # 구조화 요소 커널, 사각형 (5x5) 생성 ---① k = cv2.getStructuringElem...
StarcoderdataPython
45116
import random import xml.etree.ElementTree import requests def get_data(host, parameters): result_data = {} url = f'http://{host}/mux_http' request_id = random.randint(4000, 6000) payload_header = f'id={request_id}&show=' data = '|'.join(parameters) payload = f'{payload_header}{data}~' ...
StarcoderdataPython
66144
<reponame>acrovato/geoGen<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # ## Onera M6 configuration module for geoGen # # <NAME> def getParams(): p = {} # Wing parameters (nP planforms for half-wing) p['airfPath'] = '../airfoils' # path pointing the airfoils directory (relative to this config...
StarcoderdataPython
4828494
<filename>tests/test_binary.py from scheme import * from tests.util import * class TestBinary(FieldTestCase): def test_construction(self): with self.assertRaises(TypeError): Binary(min_length='invalid') with self.assertRaises(TypeError): Binary(max_length='invalid') ...
StarcoderdataPython
3237088
import os import shutil import numpy as np class RebalanceManager(object): def __init__(self, root_dir, classes_dir, dst_folder): self.root_dir = root_dir self.classes_dir = classes_dir self.dst_folder = dst_folder def listdir_nohidden(self, path): for f in os.listdir(path):...
StarcoderdataPython
3231888
<gh_stars>100-1000 import argparse import glob import logging import multiprocessing as mp import os import time import cv2 from facenet.align_dlib import AlignDlib logger = logging.getLogger(__name__) align_dlib = AlignDlib(os.path.join(os.path.dirname(__file__), 'shape_predictor_68_face_landmarks.dat')) def mai...
StarcoderdataPython
3214994
# noinspection PyUnusedLocal # friend_name = unicode string def hello(friend_name): hello_friend = "Hello, "+friend_name+"!" return hello_friend
StarcoderdataPython
121314
<filename>seshat/vendor/tests/test_forms.py from django.test import TestCase from vendor import forms, models class VendorFormsTests(TestCase): ''' Test all forms in vendor application ''' def test_company_form_fields(self): ''' Test company form fields ''' ...
StarcoderdataPython
1774746
<gh_stars>0 # -*- coding: utf-8 -*- """ utils environment module. """ import os import sys import platform def get_os_name(): """ gets current os name. :rtype: str """ return platform.system() def is_linux(): """ gets a value indicating that underlying operating system is linux based....
StarcoderdataPython
3296679
<filename>scrapy_playwright/handler.py import asyncio import logging import warnings from collections import defaultdict from time import time from typing import Callable, Dict, Optional, Type, TypeVar from urllib.parse import urlparse from playwright.async_api import ( BrowserContext, Page, PlaywrightCont...
StarcoderdataPython
3381776
<gh_stars>0 from pandas import DataFrame from adjustText import adjust_text import pandas as pd import matplotlib.pyplot as plt plt.style.use("fivethirtyeight") def ew_v_w(df): agg = df.rename(columns = {"Win":"Wins", "Exp Win": "Exp Wins"})\ .sort_values(by="Exp Wins") print("get plot") ax ...
StarcoderdataPython
149942
<gh_stars>10-100 # Generated by Django 3.1 on 2021-04-19 12:47 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("additional_codes", "0003_auto_20210219_0955"), ] operations = [ migrations.RenameField( model_name="additionalcodedescrip...
StarcoderdataPython
1710744
class Calculator: @classmethod def __init__(cls,brand): cls.brand = brand cls.battery = 100 @staticmethod def add(x,y): return(x + y) @staticmethod def subtract(x,y): return(x - y) @classmethod def multiply(cls,x,y): cls.battery -= 10 re...
StarcoderdataPython
1757123
#!/bin/env python2.7 # Run around 1059 as early as 1055. # Polling times vary pick something nice. # Ghost checkout timer can be changed by # adjusting for loop range near bottom. # Fill out personal data in checkout payload dict. #TODO: wrap search and checkout in function #implement better threading/search thread ...
StarcoderdataPython
1775393
"""Field that handles JSON data.""" import json from django.db import models from south.modelsinspector import add_introspection_rules __all__ = ["JSONTextField",] class JSONTextField(models.TextField): def to_python(self, value): return value def validate(self, value, *args, **kwargs): su...
StarcoderdataPython
3266252
import aiohttp import asyncio import json async def fetch(session, url): async with session.get(url) as response: return await response.text() async def main(urls): tasks = [] results = [] async with aiohttp.ClientSession() as session: for url in urls: tasks.append(fetch(se...
StarcoderdataPython
32884
# encoding: utf-8 import os from website import settings WATERBUTLER_CREDENTIALS = { 'storage': {} } WATERBUTLER_SETTINGS = { 'storage': { 'provider': 'filesystem', 'folder': os.path.join(settings.BASE_PATH, 'osfstoragecache'), } } WATERBUTLER_RESOURCE = 'folder' DISK_SAVING_MODE = se...
StarcoderdataPython
3220582
primeiro = int(input("primeiro termo: ")) razão = int(input("razão: ")) termo = primeiro cont = 1 while cont <= 10: print("{}→".format(termo), end="") termo += razão cont += 1 print("ACABOU!")
StarcoderdataPython
1684464
from models import IcebergDriftingModel1, \ DriftSimulationConfiguration, \ EnvironmentConfiguration, \ IcebergConfiguration, \ ZonesConfiguration, \ Zones, \ ShipConfiguration, \ DistanceSimulation, \ Cost, \ IceCost import pandas as pd import matplotlib.pyplot as plt import random ...
StarcoderdataPython
1792792
<gh_stars>0 import serial import time ports = { "fpga_in": "COM15", "x_motor": "COM19", } fpga_in = serial.Serial(ports["fpga_in"], 115200) x_motor = serial.Serial(ports["x_motor"], 9600, timeout=1) fpga_in.name = "fpga_in" x_motor.name = "x_motor" def wait_then_write(interface, cmd, receive_interface=None...
StarcoderdataPython
197002
from core import DBHelp, Storage from flask import make_response, request svg_path = "api/svg_raw" styles = { "flat": {"svg_style": '<mask id="id_1"><rect width="%(width)s" height="%(height)s" rx="0" fill="#fff"/></mask>', "g_1": 'mask="url(#id_1)"'}, "for-the-badge": {"svg_style": "", "g_1": 'sh...
StarcoderdataPython
3399865
import io import json import os import pytest from extractnet import extract_news from extractnet.blocks import simple_tokenizer from extractnet.util import evaluation_metrics FIXTURES = os.path.join('test', 'datafiles') @pytest.fixture(scope="module") def html(): with io.open(os.path.join(FIXTURES, "models_te...
StarcoderdataPython
3234266
#!/usr/bin/env python # # Copyright 2018 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, p...
StarcoderdataPython
155620
<reponame>mritv/edflow<filename>tests/test_data/test_datasetmixin.py import pytest from edflow.data.dataset_mixin import DatasetMixin from edflow.debug import DebugDataset def test_dset_mxin(): class MyDset(DatasetMixin): def get_example(self, idx): return {"a": 1} def __len__(self):...
StarcoderdataPython
1789425
<filename>3-Python-Advanced (May 2021)/03-Multidimentional_Lists/01_Lab/03-Primary-Diagonal.py # 3. Primary Diagonal # Write a program that finds the sum of matrix primary diagonal. On the first line, you will receive an integer N – # the size of the square matrix. The next N lines holds the values for every row – N nu...
StarcoderdataPython
71066
# Copyright 2019 The Texar 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 ...
StarcoderdataPython
4843114
<gh_stars>1-10 from ..consts import CLOSE, MAX_FLOAT, LONG from ..dtypes import Trade from .base import Benchmark from typing import Set, Optional from collections import namedtuple PnlMarker = namedtuple("Marker", ("trd_id", "max_val", "min_val")) PnlAccumulator = namedtuple("Accumulator", ( "profit", "loss", "wi...
StarcoderdataPython
10212
# type: ignore __all__ = [ "readDatastoreImage", "datastore", ] def readDatastoreImage(*args): raise NotImplementedError("readDatastoreImage") def datastore(*args): raise NotImplementedError("datastore")
StarcoderdataPython
108967
'''Faça um programa que mostre a tabuada de varios numeros, um de cada vez, para cada valor digitado pelo usuario. O programa sera interrompido quando u número solicitado for negativo''' while True: n = int(input('Quer ver a taboada de qual valor: ')) print('-' * 35) if n < 0: break for c in ra...
StarcoderdataPython
1723305
<reponame>ueberBrot/scientific-computing-with-python<filename>budget_app/budget.py """ Category class for working with budgets. The method create_spend_chart can be used to plot a chart that show the percentage spent in each category passed in to the function. The percentage spent is calculated only with the withdrawa...
StarcoderdataPython
1637037
<gh_stars>0 # Time: O(n) # Space: O(1) import itertools class Solution(object): def minDominoRotations(self, A, B): """ :type A: List[int] :type B: List[int] :rtype: int """ intersect = reduce(set.__and__, [set(d) for d in itertools.zip(A, B)]) if not inte...
StarcoderdataPython
1729339
# JTSK-350111 # Problem 3.10 py # <NAME> # <EMAIL> def print_rectangle(n,m,c): for i in range(n): for j in range(m): if (i == 0 or i == n-1 or j == 0) and (j != m-1): print (c, end = "") elif (j == m-1): print (c) else: pri...
StarcoderdataPython
1653740
<reponame>Alampulo/instazone<filename>virtual/lib/python3.6/site-packages/imagekit/transform.py params = { "height": "h", "width": "w", "quality": "q", "crop": "c", "crop_mode": "cm", "focus": "fo", "format": "f", "rounded_corner": "r", "border": "b", "rotation": "rt", "blur"...
StarcoderdataPython
1741280
<reponame>jieyuan-bi/CMPUT404-assignment-web-client<gh_stars>0 #!/usr/bin/env python3 # coding: utf-8 # Copyright 2016 <NAME>, https://github.com/tywtyw2002, and https://github.com/treedust # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lic...
StarcoderdataPython
64813
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1.20.7 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six fr...
StarcoderdataPython
1734859
<reponame>weber8thomas/MISTIC-public<filename>src/visualization/visualization.py<gh_stars>1-10 import collections import seaborn as sns import matplotlib from sklearn import metrics from src.utils import utils from src.models import ML matplotlib.use('Agg', warn=False) import matplotlib.pyplot as plt from matplotlib....
StarcoderdataPython
1647492
<reponame>fdietzsc/aibc # pylint: disable=missing-module-docstring from aibc import async_make_request async def scanners() -> dict: """Returns an object contains four lists contain all parameters for scanners. Returns: celery.chain: Task chain returning `Scanner` resources """ return awa...
StarcoderdataPython
3296609
<reponame>bergran/pokemon_project_example from django.db import models class Team(models.Model): name = models.CharField(max_length=100, db_index=True) user = models.ForeignKey( "auth.User", on_delete=models.CASCADE, related_name="teams" ) pokemon = models.ManyToManyField( "pokemon.Po...
StarcoderdataPython
3278618
import os class Config: ''' ''' SOURCES_URL = 'https://newsapi.org/v2/sources?language=en&apiKey={}' NEWS_BY_SOURCES_URL = 'https://newsapi.org/v2/top-headlines?sources={}&apiKey={}' TOP_HEADLINES_URL = 'https://newsapi.org/v2/top-headlines?country=us&category={}&apiKey={}' # it displays news items...
StarcoderdataPython
3363439
import rasterio import numpy as np import pandas as pd import geopandas as gpd import tensorflow as tf import matplotlib.pyplot as plt import sklearn.model_selection from re import X from PIL import Image from cProfile import label from pyproj import transform #Loading prepared point dataset points = gpd.read_file("C:...
StarcoderdataPython
3265310
<gh_stars>1-10 ''' Created on Aug 3, 2015 @author: annette ''' #################### # Running config #################### debug= False #input data dataSet="Sample" #sleep time between execution loops # sleeptime=1 => 1s of emulator = gl.acc seconds of real time # sleeptime=0 => run at processor speed sleeptime=1 ...
StarcoderdataPython
3369953
<gh_stars>1-10 # pylint:disable=not-context-manager from contextlib import ContextDecorator from datetime import timedelta from functools import wraps from inspect import getframeinfo, iscoroutinefunction, stack from typing import Any, Callable class SyncAsyncContextDecorator(ContextDecorator): def __call__(self,...
StarcoderdataPython
1722562
<reponame>ezquire/python-challenges # Enter your code here. Read input from STDIN. Print output to STDOUT class TrieNode(): def __init__(self, char): self.character = char self.children = {} self.endOfWord = False def add(root, word): node = root for char in word: fo...
StarcoderdataPython
118545
from netmiko.ssh_dispatcher import ConnectHandler from netmiko.ssh_autodetect import SSHDetect from netmiko.ssh_exception import NetMikoTimeoutException from netmiko.ssh_exception import NetMikoAuthenticationException from paramiko.ssh_exception import SSHException from getpass import getpass #Use this for pas...
StarcoderdataPython
22448
import os class config(): input_dir = '' max_len = '128' pretrain_model_dir = '' home_dir = os.getcwd() + '/' data_dir = home_dir + 'raw_data/ske/' tf_serving_addr = '127.0.0.1:8501' bert_vocab_dir = home_dir + 'pretrained_model/chinese_wwm_ext_L-12_H-768_A-12/vocab.txt' bert_config_dir ...
StarcoderdataPython
46625
from GPy.kern import Kern from GPy.core.parameterization import Param import numpy as np import sys from paramz.transformations import Logexp from ..kernels.tree.C_tree_kernel import wrapper_raw_SubsetTreeKernel class SubsetTreeKernel(Kern): """ The SST kernel by Moschitti(2006), with two hyperparameters (la...
StarcoderdataPython
1718753
__author__ = 'federico'
StarcoderdataPython
3352806
def main(): f = [line.rstrip("\n") for line in open("Data.txt")] instructions = [] for line in f: instruction = line.split(" ") instruction[1:] = [int(i) for i in instruction[1:]] instructions.append(instruction) reg_dict = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0} while reg_di...
StarcoderdataPython
101429
<reponame>lovish1234/TPC # get the model as DPC-RNN import sys import math import torch import torch.nn as nn import torch.nn.functional as FN sys.path.append('../tpc-backbone') # to extract the features from select_backbone import select_resnet # to aggregate the features in one from convrnn import ConvGRU class ...
StarcoderdataPython
1628957
<filename>applications/cli/platform_resources/experiment.py # # Copyright (c) 2019 Intel Corporation # # 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/LI...
StarcoderdataPython
3344070
<reponame>WamBamBoozle/pants # coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_sta...
StarcoderdataPython
1750465
<filename>ramka/boxcollider.py from typing import Union, List import pygame from .math_utils import * from .transformbase import TransformBase from .collider import Collider from .gameobject import GameObject from .shared import Vector, Poly from .game import Game class BoxCollider(Collider): def __init__(self, ...
StarcoderdataPython
1716970
<reponame>MarsBighead/mustang #!/bin/python3 ''' Python program to count leaf nodes in Binary Tree https://www.geeksforgeeks.org/write-a-c-program-to-get-count-of-leaf-nodes-in-a-binary-tree/ ''' # A Binary tree node class Node: # Constructor to create a new node def __init__(self, data): ...
StarcoderdataPython
38877
<filename>gamestate/Main.py<gh_stars>1-10 from GameState import GameState, Game from Component import Component def main(): # Testing code """ game = Game('large_normal_186') game.load_events() game.process_events() print(game.generate_vote_count(278)) print('\nNow in RC style!\n') pri...
StarcoderdataPython
184056
<filename>ch03-14-switch-first-and-last-items-list.py #3.14 def trocaPU(list): """This function switches the first and last items in a list""" list[0], list[-1] = list[-1], list[0] return list ingredients = [] n = eval(input("Enter the number of ingredients: ")) for i in range(n): item = input("Item {}...
StarcoderdataPython
1723145
<filename>PyPI/login_data.py #!/san/bin/python3.7 # -*- Coding: utf-8 -*- ## PROGRAM MENGGUNAKAN PYTHON VERSI 3 ## import os, sys, requests, hashlib from time import sleep from getpass import getpass from multiprocessing.pool import ThreadPool s = requests.Session() url = "https://graph.facebook.com/{}" api="https:...
StarcoderdataPython
3256976
<gh_stars>0 # [기초-종합] 3의 배수는 통과?(설명) # <EMAIL> ''' 문제링크 : https://www.codeup.kr/problem.php?id=1088 ''' n = int(input()) for i in range(1, n+1): if i % 3 !=0: print(i, end= ' ')
StarcoderdataPython