id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1713117 | <gh_stars>0
import streamlit as st
from pyecharts import options as opts
from pyecharts.charts import Liquid
from pyecharts.charts import WordCloud
from streamlit_echarts import JsCode
from streamlit_echarts import st_echarts
from streamlit_echarts import st_pyecharts
def main():
PAGES = {"Wordcloud": render_wor... | StarcoderdataPython |
1799882 | import pandas as pd
from pgmpy.estimators import BayesianEstimator
from pgmpy.models import BayesianModel
from pomegranate.BayesianNetwork import BayesianNetwork
from pomegranate.base import State
from pomegranate.distributions.ConditionalProbabilityTable import ConditionalProbabilityTable
from pomegranate.distribution... | StarcoderdataPython |
1683112 | <gh_stars>0
def get_count(n, k):
counts = 0
arr = [i for i in range(1, 13)]
length = len(arr)
for i in range(1 << length):
res = []
for j in range(length):
if i & (1 << j):
res.append(arr[j])
if len(res) == n and sum(res, start=0) == k:
c... | StarcoderdataPython |
69492 | from icevision.all import *
def test_voc_annotation_parser(samples_source, voc_class_map):
annotation_parser = parsers.voc(
annotations_dir=samples_source / "voc/Annotations",
images_dir=samples_source / "voc/JPEGImages",
class_map=voc_class_map,
)
records = annotation_parser.parse... | StarcoderdataPython |
3243522 | <filename>apache_downloader/downloader.py
import hashlib
import logging
import os
import sys
from math import ceil
from os.path import basename, dirname, isdir, expanduser
from urllib.parse import urlunparse, urlencode
import humanize
import requests
from progress.bar import FillingCirclesBar
from progress.spinner imp... | StarcoderdataPython |
4821821 | <gh_stars>0
from BusConsumer import BusConsumer
from ElasticConnector import ElasticConnector
from src.Config import es_url, topic_name, consumer_config
def get_es_connection_status():
return 'Success' if es_client.test_connection() else 'Failure'
es_client = ElasticConnector(es_url)
es_client.create_es_connect... | StarcoderdataPython |
88655 | <gh_stars>0
#!/usr/bin/env python
u"""
test_time.py (08/2020)
Verify time conversion functions
"""
import pytest
import warnings
import numpy as np
import icesat2_toolkit.time
#-- parameterize calendar dates
@pytest.mark.parametrize("YEAR", np.random.randint(1992,2020,size=2))
@pytest.mark.parametrize("MONTH", np.rand... | StarcoderdataPython |
1679404 | # dataset/table/_SUCCESS
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | StarcoderdataPython |
4825715 | <reponame>max-brambach/neural_tube_patterning_paper<filename>3d/testround_difftest_set.py
# -*- coding: utf-8 -*-
from scipy.integrate import solve_ivp
import matplotlib
#matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import inv
from copy import deepcopy
from matplotlib im... | StarcoderdataPython |
1695548 | """pytest fixtures for simplified testing."""
from __future__ import absolute_import
import pytest
pytest_plugins = ['aiida.manage.tests.pytest_fixtures']
@pytest.fixture(scope='function', autouse=True)
def clear_database_auto(clear_database): # pylint: disable=unused-argument
"""Automatically clear database in... | StarcoderdataPython |
197446 | import itertools
def raster(input_size):
return itertools.product(*[range(dim_size) for dim_size in input_size])
| StarcoderdataPython |
3343799 | from setuptools import setup
setup() | StarcoderdataPython |
30925 | <gh_stars>10-100
import logging
import os
from logging import FileHandler, Formatter
from logging.handlers import TimedRotatingFileHandler
from pathlib import Path
from rich.logging import RichHandler
def my_namer(default_name):
# This will be called when doing the log rotation
# default_name is the default ... | StarcoderdataPython |
1698639 | # Copyright 2022 The Nine Turn 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 applicab... | StarcoderdataPython |
3244350 | <gh_stars>1-10
import tkinter.messagebox
from tkinter import *
import tkinter.font as TkFont
from tkinter import ttk
window = Tk()
myFont = TkFont.Font(window, family="Helvetica", size=12)
def smallestnum():
if len(Entry1.get()) == 0 or len(Entry2.get()) == 0 or len(Entry3.get()) == 0:
tkinter.m... | StarcoderdataPython |
195372 | # Interview Question #5
# The problem is that we want to find duplicates in a one-dimensional array of integers in O(N) running time
# where the integer values are smaller than the length of the array!
# For example: if we have a list [1, 2, 3, 1, 5] then the algorithm can detect that there are a duplicate with value 1... | StarcoderdataPython |
3381446 | import random
import time
from augmentation.operations import OperationPipeline
from image_grabber.grab_settings import DEBUG_MODE
from utils.utils import FileUtil, ProgressBarUtil, NoImageFoundException, ExceptionUtil
class DatasetGenerator(OperationPipeline):
folder_path = None
num_files = None
save_t... | StarcoderdataPython |
146128 | <filename>{{cookiecutter.project_slug}}/app/__init__.py
# -*- coding: utf-8 -*-
# @Author : Aquish
# @Organization : NTT
| StarcoderdataPython |
47679 | from typing import Any
from .ast_expression import Expression
from .ast_statement import Statement
class Assertion(Statement):
def __init__(self, actual: Expression, expected: Expression) -> None:
self._actual = actual
self._expected = expected
@property
def actual(self) -> Expression:
... | StarcoderdataPython |
1741002 | <filename>ejercicios/f20211116/ejercicio_05.py
def myfunction(array_numbers):
#Se eliminan duplicados
score_mod = []
for item in array_numbers:
if item not in score_mod:
score_mod.append(item)
#Se ordena de mayor a menor
ordered_list = sorted(score_mod, reverse = True)
... | StarcoderdataPython |
1665493 | from lib.input import read_lines, blocks
input = read_lines(6)
def answered():
for block in blocks(input):
answers = set()
for line in block:
answers.update(line)
yield answers
def answered_by_all():
for block in blocks(input):
answers = [set(line) for line in block]
intersection = s... | StarcoderdataPython |
1602406 | from . import factorials
from . import numbers
| StarcoderdataPython |
1760292 | #!/usr/bin/python
#Original Author: <NAME>
#Original Date: Mar 6 2016
#Last Modified By: <NAME>
#Last Modified On: Mar 23 2016
import smbus
import sys
import logging
import i2cutil
#import sensor abstract
import abstractsensor
class VoltageSensor(abstractsensor.Sensor):
def __init__(self, bus=1, addr=0x40):
self.log... | StarcoderdataPython |
4829731 | <reponame>nickamon/grr
#!/usr/bin/env python
"""This file contains common grr jobs."""
import gc
import logging
import pdb
import time
import traceback
import psutil
from grr import config
from grr_response_client import client_utils
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import registr... | StarcoderdataPython |
1691399 | <gh_stars>0
# -*- coding: UTF-8 -*-
""" API access object """
__author__ = "d01"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2015, <NAME>"
__license__ = "MIT"
__version__ = "0.1.2a0"
__date__ = "2015-08-21"
# Created: 2015-07-30 04:44
import logging
import requests
logger = logging.getLogger(__name__)
api_... | StarcoderdataPython |
3274251 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
from selenium.webdriver.chrome.options import Options
import pandas as pd
import datetime
def set_chromium():
options = Options()
options.add_argument('--headless')
options.a... | StarcoderdataPython |
1658505 | <filename>ckanext/validation/utils.py
import os
import logging
from ckan.lib.uploader import ResourceUpload
from ckantoolkit import config, asbool
log = logging.getLogger(__name__)
def get_update_mode_from_config():
if asbool(
config.get(u'ckanext.validation.run_on_update_sync', False)):
re... | StarcoderdataPython |
4839883 | <reponame>jansforte/Inteligencia-Artificial<filename>Naive Bayes/SpellingCorrector/pruebas.py
import re
import pandas as pd
#numero = "111,245,954"
#numero = int(re.sub(",","",numero))
#print(numero-1)
#numero ="737799456456498797987979. él"
#numero = re.sub("[0-9]+.\s","",numero)
#print(numero)
#words = open('CREA_tot... | StarcoderdataPython |
2330 | <filename>swm-master/swm-master/calc/mean_e_calc.py
## PRODUCE MEAN CALCULATIONS AND EXPORT AS .NPY
from __future__ import print_function
path = '/home/mkloewer/python/swm/'
import os; os.chdir(path) # change working directory
import numpy as np
from scipy import sparse
import time as tictoc
from netCDF4 import Dataset... | StarcoderdataPython |
1610378 | <filename>delta/utils/loss/loss_utils.py
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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
... | StarcoderdataPython |
4802124 | from django.contrib.admin import TabularInline
from cinemanio.core.admin import GenreAdmin
from cinemanio.sites.kinopoisk.models import KinopoiskGenre
from cinemanio.sites.kinopoisk import signals # noqa
class KinopoiskGenreInline(TabularInline):
model = KinopoiskGenre
GenreAdmin.inlines = GenreAdmin.inlines ... | StarcoderdataPython |
3385762 | # 2019-11-14 10:01:24(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float... | StarcoderdataPython |
167474 | <reponame>WebberHuang/DeformationLearningSolver
__author__ = "<NAME>"
__contact__ = "<EMAIL>"
__website__ = "http://riggingtd.com"
import os
try:
from PySide import QtGui, QtCore
from PySide.QtGui import *
from PySide.QtCore import *
except ImportError:
from PySide2 import QtGui, QtCore, QtWidgets
... | StarcoderdataPython |
3234944 | import torch
import torch.nn as nn
from common.subsample import create_mask_for_mask_type
from models.neumann.operators import forward_adjoint_helper, gramian_helper
class NeumannNetwork(nn.Module):
def __init__(self, reg_network=None, hparams=None):
super(NeumannNetwork, self).__init__()
self.h... | StarcoderdataPython |
88355 | <reponame>Pro100Tema/ostap<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# @file ostap/plotting/makestyles.py
# Helper utilities to deal with ROOT styles
# ========================================================================... | StarcoderdataPython |
3286064 | <reponame>Violet26/usaspending-api<filename>usaspending_api/etl/transaction_loaders/fpds_loader.py
import logging
from psycopg2.extras import DictCursor
from psycopg2 import Error
from django.db import connections, connection
from usaspending_api.etl.transaction_loaders.field_mappings_fpds import (
transaction_fpd... | StarcoderdataPython |
4813223 | <reponame>d-wortmann/judft_tutorials
from aiida.orm import Dict, load_node
from aiida.engine import submit
from aiida import load_profile
# import the FleurinpgenCalculation
# load ingpen Code
# create a StuctureData
structures = [Fe_structrure, Ni_structrure, Co_structrure]
# create a parameters Dict
# option... | StarcoderdataPython |
3289940 | import asyncio
from ray import workflow
from ray.tests.conftest import * # noqa
from ray.workflow import workflow_storage
from ray.workflow.storage import get_global_storage
import pytest
def get_metadata(paths, is_json=True):
store = get_global_storage()
key = store.make_key(*paths)
return asyncio.get... | StarcoderdataPython |
3362642 | <gh_stars>1-10
acl_rule_ip = """
<config>
<{{address_type}}-acl
xmlns="urn:brocade.com:mgmt:brocade-{{address_type}}-access-list">
<{{address_type}}>
<access-list>
<{{acl_type}}>
<name>{{acl_name}}</name>
{% if address_type == "ip" %}
{% if acl_type == "extended"... | StarcoderdataPython |
90628 | # AUTOGENERATED! DO NOT EDIT! File to edit: 04_device.ipynb (unless otherwise specified).
__all__ = ['versions']
# Cell
def versions():
"Checks if GPU enabled and if so displays device details with cuda, pytorch, fastai versions"
print("GPU: ", torch.cuda.is_available())
if torch.cuda.is_available() == True:
... | StarcoderdataPython |
105434 | """
Implementation of the Deep Embedded Self-Organizing Map model
SOM layer
@author <NAME>
@version 1.0
"""
import tensorflow as tf
from tensorflow import keras # using Tensorflow's Keras API
from keras.engine.topology import Layer, InputSpec
class SOMLayer(Layer):
"""
Self-Organizing Map layer class with re... | StarcoderdataPython |
133039 | <filename>junebug/tests/test_channel.py
import logging
import json
from twisted.internet.defer import inlineCallbacks
from vumi.message import TransportUserMessage, TransportStatus
from vumi.transports.telnet import TelnetServerTransport
from junebug.utils import api_from_message, api_from_status, conjoin
from junebug... | StarcoderdataPython |
4825930 | """Test some FileHandler internals."""
import re
from pathlib import Path
import pytest
from file_groups.file_handler import FileHandler
from .conftest import same_content_files
# pylint: disable=protected-access
@same_content_files('Hi', 'y')
def test_no_symlink_check_registered_delete_ok(duplicates_dir, capsys... | StarcoderdataPython |
133580 | # 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 Apache License, Version 2.0
# (the "License"); you may not use ... | StarcoderdataPython |
157855 | import math
import numpy as np
import scipy.optimize as opt
import matplotlib.pyplot as plt
import matplotlib.gridspec as gdsc
class concreteSection:
def __init__(self,sct,units='mm'):
'''
Imports section.
Parameters
----------
sct : Section Object
... | StarcoderdataPython |
69005 | <reponame>HACFelipe/PSaaS
from typing import List
from entity.building_block import BuildingBlock
from entity.project_task import ProjectTask
class Code(BuildingBlock):
"""Model for Code"""
def __init__(self, description : str, linked_project_task : ProjectTask, source_code : str, testable : bool = False... | StarcoderdataPython |
1645308 | <reponame>aveetron/cafe3_resturant_management
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib import messages
from .forms import *
from .models import *
# Create your views here.
def home(request):
allItem = Item.objects.all().order_by('-pk')
context = {
... | StarcoderdataPython |
1788153 | <gh_stars>1-10
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------#
# author: <NAME> #
# email: <EMAIL> #
#--------------------------------------------#
import argparse
parser = argparse.ArgumentParser(description='rnn attention')
p... | StarcoderdataPython |
3313370 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-28 05:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_markdown.models
import taggit.managers
class Migration(migrations.Migration):
d... | StarcoderdataPython |
3225847 | # -*- coding: utf-8 -*-
from six.moves.urllib.parse import urlsplit
from lxml import html
from lxml.html import clean
# XXX move to iktomi.cms?
class Cleaner(clean.Cleaner):
safe_attrs_only = True
remove_unknown_tags = None
drop_empty_tags = frozenset()
dom_callbacks = []
allow_external_src = Fals... | StarcoderdataPython |
1753180 | # Copyright 2017 National Renewable Energy Laboratory. This software
# is released under the license detailed in the file, LICENSE, which
# is located in the top-level directory structure.
# ========================================================================
#
# Imports
#
# =======================================... | StarcoderdataPython |
77340 | <reponame>Eleveil/python-algorithm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-05-18 23:29:05
# @Author : <NAME> (<EMAIL>)
arr1 = [1, 3, 4, 6, 10]
arr2 = [2, 5, 8, 11]
ind = 0
ans = arr1.copy()
for i in range(len(arr2)):
while ind < len(arr1):
if arr2[i] <= arr1[ind]:
an... | StarcoderdataPython |
1620585 | # coding=utf-8
from setuptools import setup
from cms_support.utils.constants import Constants
# long_description=open('README.md').read(),
# https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/
setup(
name=Constants.PACKAGE_NAME,
version=Constants.VERSION,
author=C... | StarcoderdataPython |
1751132 | <gh_stars>0
from dataclasses import dataclass
'''
@property is getter method
getter use: Class.attribute
@attribute.setter is setter method
setter use: Class.attribute = attribute
dataclass(frozen=True) is immutable
'''
@dataclass
class SettingsModel:
'''
Data class for settings objects
'''
_dia... | StarcoderdataPython |
134967 | CORRECT_PIN = "1234"
MAX_TRIES = 3
tries_left = MAX_TRIES
pin = input(f"Insert your pni ({tries_left} tries left): ")
while tries_left > 1 and pin != CORRECT_PIN:
tries_left -= 1
print("Your PIN is incorrect.")
pin = input(f"Insert your pni ({tries_left} tries left): ")
if pin == CORRECT_PIN:
print("... | StarcoderdataPython |
1757575 | <reponame>zeqianli/douban-listing-helper
import numpy as np, pandas as pd
import os, re, requests, demjson,urllib, argparse
from bs4 import BeautifulSoup
def main(f_url_list='url_list.txt', dir_out=None):
if dir_out is None:
import time
dir_out=f'metadata_{int(time.time())}'
try:
os.m... | StarcoderdataPython |
188984 | """
MetaWIBELE: config module
Configuration settings
Copyright (c) 2019 Harvard School of Public Health
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 limi... | StarcoderdataPython |
3203645 | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | StarcoderdataPython |
3219612 | import os
indir="/afs/cern.ch/work/e/edreyer/public/madgraph5atlasval/source/MCVal/events_DM/"
outdir="/afs/cern.ch/work/e/edreyer/public/madgraph5atlasval/source/MCVal/events_DM/"
channels=["mumu","ee"]
masses=["500","1000","2000"]
couplings=["0p02"]
#variables=["n_l1","pdgid_l1","e_l1","px_l1","py_l1","pz_l1","pt_l1... | StarcoderdataPython |
78662 | <reponame>owitplat/aws-cloudwatch-log-minder<filename>src/aws_cloudwatch_log_minder/delete_empty_log_streams.py
import json
from datetime import datetime, timedelta
from typing import List
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError
from .logger import log
cw_logs = No... | StarcoderdataPython |
1601643 | from math import sqrt
import math
from math import atan2, degrees
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from skimage import io
import matplotlib.pyplot as plt
from scipy import stats
from scipy import spatial
import numpy as np
from scipy ... | StarcoderdataPython |
3296564 | <gh_stars>1-10
"""
18/12/18
Convert the XML annotations to csv
"""
from pathlib import Path
import pandas as pd
from vpv.annotations.impc_xml import load_xml
import yaml
from collections import defaultdict
xml_dir = Path('/home/neil/Desktop/xml_to_csv')
outfile = '/home/neil/Desktop/181218_xml_annotations_to_csv.cs... | StarcoderdataPython |
69059 | # -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import (absolute_import,
division,
print_function,
unicode_literals)
import itertools
import logging
from builtins impor... | StarcoderdataPython |
1770476 | <reponame>rlauer6/makala<filename>makala/__init__.py<gh_stars>0
from .lambda_config import LambdaConfig
from .makala_config import MakalaConfig
| StarcoderdataPython |
1731308 | <reponame>climbingdaily/spvnas
"""Visualization code for point clouds and 3D bounding boxes with mayavi.
Modified by <NAME>
Date: September 2017
"""
import argparse
import os
# import mayavi.mlab as mlab
import numpy as np
import torch
from torchsparse import SparseTensor
from torchsparse.utils.quantize import spars... | StarcoderdataPython |
1603494 |
from .MultivariateGaussianGenerator import MultivariateGaussianGenerator
from .InverseWishartGenerator import InverseWishartGenerator
from .ExponentialDecayGenerator import ExponentialDecayGenerator
from weakref import ReferenceType
class MatrixGeneratorAdapter:
def __init__(self, matrix_reference: ReferenceTy... | StarcoderdataPython |
100566 | import numpy as np
from itertools import product
from deep_rlsp.envs.gridworlds.env import Env, Direction, get_grid_representation
class BasicRoomEnv(Env):
"""
Basic empty room with stochastic transitions. Used for debugging.
"""
def __init__(self, prob, use_pixels_as_observations=True):
sel... | StarcoderdataPython |
1751391 | import pulumi
import pulumi_aws as aws
db_cluster = aws.rds.Cluster("dbCluster", master_password=pulumi.secret("<PASSWORD>"))
| StarcoderdataPython |
1715058 | '''
Utilities to convert metrics to inclusive.
'''
import calltree as ct
import pandas as pd
import pandas as pd
import index_conversions as ic
def convert_series_to_inclusive(series, call_tree):
'''
Converts a series having Cnode IDs as index from exclusive to inclusive.
Takes as input a CubeTreeNode ob... | StarcoderdataPython |
1630682 | <filename>osrefl/model/calculations.py
# Copyright (C) 2008 University of Maryland
# All rights reserved.
# See LICENSE.txt for details.
# Author: <NAME>
#Starting Date:6/5/2009
from numpy import greater, less, greater_equal, less_equal, min, max
from numpy import array, size, shape, hstack, vstack, linalg, cross
fr... | StarcoderdataPython |
23732 | <reponame>noahnisbet/human-rights-first-asylum-ds-noahnisbet<gh_stars>1-10
import os
os.environ["OMP_NUM_THREADS"]= '1'
os.environ["OMP_THREAD_LIMIT"] = '1'
os.environ["MKL_NUM_THREADS"] = '1'
os.environ["NUMEXPR_NUM_THREADS"] = '1'
os.environ["OMP_NUM_THREADS"] = '1'
os.environ["PAPERLESS_AVX2_AVAILABLE"]="false"
os.... | StarcoderdataPython |
1699621 | <reponame>SamirMitha/Denoising<gh_stars>0
import glob, os
import time
import tensorflow as tf
import numpy as np
import scipy.io as sio
import pickle
from models import FFDNet
from losses import mse
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger, Terminate... | StarcoderdataPython |
125176 | <reponame>gddcx/pytorch-ssd
# -*- coding: utf-8 -*-
# Author: <NAME>
# @Time: 2021/10/8 11:27
import os
import cv2 as cv
import random
import numpy as np
import torch
from torch.utils.data import Dataset
class VOCDataset(Dataset):
def __init__(self, data, image_root="", transform=None, train=True):
super(... | StarcoderdataPython |
3332692 | <reponame>SJISTIC-LTD/Create-and-Read-QR-code
pip install qrcode
#Import Library
import qrcode
#Generate QR Code
img=qrcode.make('Hello World')
img.save('hello.png')
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
qr.add_data("https://abhijithch... | StarcoderdataPython |
1791361 | #!/usr/bin/env python
# This file is part of the Mad Girlfriend software
# See the LICENSE file for copyright information
from rules import Rules
from alertgenerator import Alert, Alerter
from packetparser import Packet
import signal, sys, os, socket, time, traceback, exceptions
def getMemoryUsage():
data = ope... | StarcoderdataPython |
3391727 | """
DoMiniPigRegistrationPhase1.py
==================================
Description:
Author:
Usage:
"""
import errno
import os
import sys
if len(sys.argv) != 1:
print(
(
"""ERROR: Improper invocation
{PROGRAM_NAME} <Experiment.json>
* The experiment json contains the parameters needed to
*... | StarcoderdataPython |
1766256 | from nltk.stem.wordnet import WordNetLemmatizer
Lem = WordNetLemmatizer()
import pandas as pd
from generic_operations import print_to_file
import global_variables as v
def lemmatisation():
# open preprocessed tokens
wo_data = pd.read_excel(v.input_file_path_lemmatisation, sheet_name=v.input_file_sheet_name)
... | StarcoderdataPython |
14458 | <filename>get_variances.py
from itertools import *
import time
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
#my own variance function runs much faster than numpy or the Python 3 ported statistics module
def variance(data,u):
return sum([(i-u)**2 for i in data])/len(data)
##rounding the means... | StarcoderdataPython |
166182 | <reponame>levelupresearch/sparclur
import shutil
from typing import List, Dict, Any, Union
import os
import re
import locale
import shlex
import tempfile
import subprocess
from subprocess import DEVNULL, TimeoutExpired
import yaml
from sparclur._tracer import Tracer
from sparclur._parser import VALID, VALID_WARNINGS,... | StarcoderdataPython |
3201793 | <filename>lambdata_jbanks/mod.py
def enlarge(n):
return n*100
x= int(input("enter an integer"))
print(enlarge(x)) | StarcoderdataPython |
39260 | # terrascript/data/logicmonitor.py
import terrascript
class logicmonitor_collectors(terrascript.Data):
pass
class logicmonitor_dashboard(terrascript.Data):
pass
class logicmonitor_dashboard_group(terrascript.Data):
pass
class logicmonitor_device_group(terrascript.Data):
pass
__all__ = [
"l... | StarcoderdataPython |
54697 | _base_ = './cascade_rcnn_r101_fpn_1x.py'
model = dict(
pretrained='open-mmlab://msra/hrnetv2_w40',
backbone=dict(
_delete_=True,
type='HRNet',
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
... | StarcoderdataPython |
3259888 | <filename>cnn_architectures.py
class Architectures():
'''Helper class that returns python dictionary containing
shapes for CNN layers
'''
def xsmall(kernel_size, n_classes):
return {'conv1' : [kernel_size, kernel_size, 1, 32],
'conv2' : [kernel_size, kernel_size, 32, 64],
... | StarcoderdataPython |
3281414 | <gh_stars>0
# MIT License
#
# Copyright (c) 2019 <NAME> (g4 <at> novadsp <dot> com)
#
# 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 rig... | StarcoderdataPython |
1709526 | <gh_stars>0
#!/usr/bin/env python3
import abc
from typing import Dict, Type
import torch
from ml.rl.core.registry_meta import RegistryMeta
from ml.rl.models.base import ModelBase
from ml.rl.parameters import NormalizationParameters
from ml.rl.prediction.predictor_wrapper import ParametricDqnWithPreprocessor
from ml.r... | StarcoderdataPython |
129843 | <reponame>LuccaBiasoli/python-cola
#if e else
#exemplo if else
tempo = int(input('Quantos anos tem seu carro? '))
if tempo <=3:
print('carro novo')
else:
print('carro velho')
print('--FIM--')
#outro exemplo if else
n1 = float(input('Qual foi sua primeira nota ?'))
n2 = float(input('Qual foi sua segunda nota ?... | StarcoderdataPython |
3315350 | # Link --> https://www.hackerrank.com/challenges/30-hello-world/problem
# Code:
input_string = input()
print('Hello, World.')
print(input_string)
| StarcoderdataPython |
4831912 | <reponame>nile0316/propnet<filename>propnet/ext/tests/utils.py
from monty.serialization import dumpfn
from propnet.ext.aflow import AflowAPIQuery
from propnet.dbtools.aflow_ingester import AflowIngester
import os
import json
TEST_DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
... | StarcoderdataPython |
4809914 | from unittest import TestCase
import proverb
class TestSaying(TestCase):
def test_is_string(self):
s = proverb.saying()
self.assertTrue(isinstance(s, str))
| StarcoderdataPython |
3200009 | from sys import argv
from random import randint
from functools import reduce
k = int(argv[1])
shares = map(int, argv[2:])
print(sum(shares) % k) | StarcoderdataPython |
3381797 | colors = {"clean": "\033[m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"purple": "\033[35m",
"cian": "\033[36m"}
n1 = float(input("Enter in meters the height of your wall: "))
n2 = float(input("Enter in meters the the wi... | StarcoderdataPython |
3318278 | from string import punctuation
from filemanip import normalize_str, compare_normalized
def clean_text(text):
normalized = normalize_str(text)
trans_tbl = str.maketrans('','', punctuation)
return normalized.translate(trans_tbl)
if __name__ == '__main__':
raw = get_data(fname)
data = get_raw_verses... | StarcoderdataPython |
3384721 | # -*- coding: utf-8 -*
#!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""
Demo script showing detec... | StarcoderdataPython |
3242861 | <gh_stars>0
__author__ = "<NAME> (nam4dev)"
__since__ = "11/25/2019"
__copyright__ = """MIT License
Copyright (c) 2019 <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, ... | StarcoderdataPython |
1702568 | from typing import Optional, Union
from typing_extensions import Literal
from anndata import AnnData
import numpy as np
import pandas as pd
from pandas import DataFrame
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse.csgraph import shortest_path
import igraph... | StarcoderdataPython |
1657506 | <filename>webdjango/models/Core.py<gh_stars>1-10
import sys
from distutils.version import LooseVersion
from dirtyfields import DirtyFieldsMixin
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import validate_slug
from django.db import connection, models
from django.db.utils imp... | StarcoderdataPython |
1702614 | from .base import BaseRecognizer
from .TSN2D import TSN2D
from .TSN3D import TSN3D
__all__ = [
'BaseRecognizer', 'TSN2D', 'TSN3D'
]
| StarcoderdataPython |
3295072 | # Generated by Django 3.1.1 on 2020-11-25 04:39
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(setting... | StarcoderdataPython |
1656003 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
if... | StarcoderdataPython |
1728243 | <filename>btclib/address.py
import base64
from abc import ABC, abstractmethod
from hashlib import sha256, new as hashlib_new
from ecdsa import SigningKey, SECP256k1, VerifyingKey
from ecdsa.keys import BadSignatureError
from ecdsa.util import sigencode_der, sigencode_string, sigdecode_string
from base58check import b58... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.