id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
191255 | import pandas as pd
import numpy as np
df = pd.read_csv('all_countries.csv')
#df.fillna('-', inplace=True)
main_pf = ['pf_rol', 'pf_ss', 'pf_movement', 'pf_religion', 'pf_association', 'pf_expression', 'pf_identity']
main_ef = ['ef_government', 'ef_legal', 'ef_money', 'ef_trade', 'ef_regulation']
other_cat_pf = ['pf... | StarcoderdataPython |
3202097 | <reponame>omnivore/esky
# Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.
# All rights reserved; available under the terms of the BSD License.
"""
esky.slaveproc: utilities for running a slave process.
A "slave process" is one that automatically dies when its master process dies.
To implement this, the slave pro... | StarcoderdataPython |
1690273 | import src.data_process.dataset_analysis as dataset_analysis
if __name__ == "__main__":
dataset_analysis.plot_avg_tracks_per_artist_by_genre()
| StarcoderdataPython |
1637617 | <reponame>kuanhungchen/leetcode-practice<gh_stars>1-10
class Solution:
def customSortString(self, S, T):
pr_s = {c: i for i, c in enumerate(S)}
cnt_t = {}
for c in T:
if c not in cnt_t: cnt_t[c] = 1
else: cnt_t[c] += 1
ans = [""] * 27
for k, v in cnt_t... | StarcoderdataPython |
3207862 | from binaryninja import (Architecture, LowLevelILOperation, LowLevelILLabel,
log_info, LLIL_TEMP)
def add_trunc(a, b, bits=16):
maxval = (1 << bits) - 1
r = a + b
return r & maxval
def _get_2b_reg(il, register):
register = register.lower()
return il.reg_split(1, register... | StarcoderdataPython |
172193 | <reponame>QuietImCoding/Nines
import os, subprocess
import random, sys
if len(sys.argv) == 1:
n_boards = 1
else:
n_boards = int(sys.argv[1])
def demo_board(fname):
pieces = ["pieces/" + p for p in os.listdir('pieces')]
pieces.sort()
print(pieces)
for row in range(27):
selection=[]
... | StarcoderdataPython |
170065 | #!/usr/bin/env python3
import collections
from .symbols import SymbolScope
from .ast import ASTVisitor, ASTScopedVisitorMixin
from .mtypes import MethodType
from .opcodes import Opcodes
from . import asm
# Function activation block:
# arguments...
# retval
# retaddr
# locals
class StackSize(ASTScopedVisitorMixin, ... | StarcoderdataPython |
149461 | <reponame>gelnior/couchdbkit
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
from .fs import FSDoc, document, push, pushdocs, pushapps, clone
| StarcoderdataPython |
86880 | <gh_stars>1-10
# Generated by Django 3.1 on 2021-02-02 18:02
import django.db.models.deletion
from django.db import migrations, models
import websites.models
class Migration(migrations.Migration):
dependencies = [
("websites", "0002_websitecontent_hugo_filepath"),
]
operations = [
migr... | StarcoderdataPython |
133530 | <reponame>chinghwayu/mimesis<filename>mimesis/data/int/text.py
# -*- coding: utf-8 -*-
"""Provides all the data related to text."""
SAFE_COLORS = [
"#1abc9c",
"#16a085",
"#2ecc71",
"#27ae60",
"#3498db",
"#2980b9",
"#9b59b6",
"#8e44ad",
"#34495e",
"#2c3e50",
"#f1c40f",
"... | StarcoderdataPython |
4829389 | <gh_stars>1-10
import logging
from typing import Dict, List, Union
import arrow
import discord
from discord.ext import commands
from naotimes.bot import naoTimesBot
from naotimes.context import naoTimesContext
from naotimes.paginator import DiscordPaginator, DiscordPaginatorUI
from naotimes.showtimes import Showtimes... | StarcoderdataPython |
1779204 | import matplotlib.pyplot as plt
import numpy as np
#input args:
# time_array: time series for plotting
# final_output: filtered seismic measurement after using wiener filter
# true: original noisy seismic measurement
def wiener_filter_performance_visualization(time_array,final_output,true):
... | StarcoderdataPython |
1726085 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 15 23:23:10 2021
@author: Rares
"""
from .preprocess import extractFeatures
import librosa
from librosa import util
import xgboost as xgb
import pandas as pd
import numpy as np
from object_cache import object_cache
@object_cache
def loadAndGetMfcc(folder, ... | StarcoderdataPython |
1662884 | from . import constants as CONSTANTS
from .producer_property import ProducerProperty
from common.telemetry import telemetry_py
from common.telemetry_events import TelemetryEvent
class Image:
"""
If ``string`` is used, it has to consist of digits 0-9 arranged into
lines, describing the image, for example::... | StarcoderdataPython |
4834492 | """
Electrum module to implement atomicswap support
"""
from Jumpscale import j
import json
class ElectrumAtomicswap:
"""
ElectrumAtomicswap class
This class wraps the binaries provided by https://github.com/rivine/atomicswap/releases
"""
def __init__(self, wallet_name, data_dir, rpcuser, rpcpass... | StarcoderdataPython |
1622734 | #!/usr/bin/env python
import os
from shipper import Shipper, run, command
import subprocess
# DOCKER_URL = "/var/run/docker.sock"
DOCKER_HOST = "localhost:4243"
DOCKER_URL = "tcp://127.0.0.1:4243"
s = Shipper([DOCKER_HOST])
def pmk(t):
rootdir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
ret... | StarcoderdataPython |
1701774 | <filename>keypad/driver/lighting/image.py
import config
from neopixel import NeoPixel
from lighting.program import LightingProgram
from messaging import CommandBus, CommandType
class ImageProgram(LightingProgram):
def __init__(self, pixels: NeoPixel, message_bus: CommandBus):
self.pixels = pixels
... | StarcoderdataPython |
32624 | #####################################
##### Class to Query Census API #####
#####################################
import requests
import json
import pandas as pd
import datascience as ds
from .utils import *
class CensusQuery:
"""Object to query US Census API"""
_url_endings = {
"acs5": "acs/acs5",
"acs1": "ac... | StarcoderdataPython |
1683403 | <filename>log.py
import torchvision
import torch
import os
import matplotlib.pyplot as plt
import numpy as np
import torchsnooper
def scale_to_tensorboard(losses, writer, unet_options, loss_options, iter_overall, output=None):
for item in losses:
if item == 'final':
if loss_options.min_grad_m... | StarcoderdataPython |
3311618 | <gh_stars>0
import numpy as np
import pandas as pd
import copy
import os
import pathlib
import pdb
import model_eval
import gmp_feature_selection as gfs
#from gmp_feature_selection import constants, gmp_feature_selector
class random_search(gfs.gmp_feature_selector):
def __init__(self, data, model_eval_params):
... | StarcoderdataPython |
1604722 | <reponame>dib-lab/2018-snakemake-eel-pond
#!/usr/bin/env python
import subprocess
import os
import glob
import tempfile
import shutil
import pytest
import yaml
import pandas as pd
from .utils import TempDirectory, write_yaml
from .const import (here, test_config_yaml, elvers_cmd)
elvers_dir = os.path.dirname(os.path... | StarcoderdataPython |
1758268 | <reponame>apoorvkk/LeetCodeSolutions
'''
URL: https://leetcode.com/problems/task-scheduler/description/
Time complexity: O(n) where n is number of tasks
Space complexity: O(26) where n is number of tasks
'''
from collections import Counter
from heapq import heappush, heappop
class Solution:
def leastInterval(self... | StarcoderdataPython |
3284677 | <filename>pandajedi/jediorder/JediDaemon.py<gh_stars>1-10
from pandacommon.pandalogger import logger_utils
from pandajedi.jediconfig import jedi_config
from pandajedi.jedidaemons.utils import DaemonMaster
# logger
base_logger = logger_utils.setup_logger(__name__.split('.')[-1])
# launch
def launcher(taskBufferIF,... | StarcoderdataPython |
1737323 | import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.externals import joblib
def read_data():
pass
xtr, ytr = read_data()
params = joblib.load('params.pkl')
n_neg = len(ytr[np.isclose(ytr, 0)])
n_ot = len(ytr) - n_neg
ot_weight = n_neg / n_ot
sw = np.ones_like(ytr)
sw[~np.isclose(y... | StarcoderdataPython |
3340401 | <filename>puzzle8/8b.py
instructions = []
lineCount = {}
changeList = []
with open("C:\\Privat\\advent_of_code20\\puzzle8\\input1.txt") as f:
i = 0
for line in f:
line = line.strip()
instructions.append(line)
lineCount[i] = 0
if 'nop' in line or 'jmp' in line:
change... | StarcoderdataPython |
1748491 | import numpy as np
import soundfile as sf
import torch
from asteroid.data.librimix_dataset import LibriMix
import random as random
from scipy import signal
class MetricGAN(LibriMix):
def __getitem__(self, idx):
# Get the row in dataframe
row = self.df.iloc[idx]
# Get mixture path
... | StarcoderdataPython |
1665226 | import MagModule as M
def main():
print(" - Think of a Number from Given Cards and Write the Cards number or numbers on which your chosen number Appears on\n\n - For Example if your chosen number appears on card no 1 and 2 then you write 1<Enter>2 to finish after the last number <Enter>0\n\n - Aft... | StarcoderdataPython |
37526 | import asyncio
import math
import networkx as nx
import ccxt.async_support as ccxt
import datetime
import logging
from .logging_utils import FormatForLogAdapter
__all__ = [
'FeesNotAvailable',
'create_exchange_graph',
'load_exchange_graph',
]
adapter = FormatForLogAdapter(logging.getLogger('peregrinearb.u... | StarcoderdataPython |
3299329 | <filename>skeleton.py
# encoding: utf-8
'''Use trees of files and directories as templates.
Copyright (c) 2008-2009 <NAME>
'''
import sys, os, shutil, re
REPLACE_PLACEHOLDER_TPL = '${%s}'
if sys.version_info[0] >= 2 and sys.version_info[1] >= 6:
relpath = os.path.relpath
else:
def relpath(path, start=os.path... | StarcoderdataPython |
85715 | from typing import Optional, Dict
import falcon
class Request:
def __init__(self, request: falcon.Request, request_number: int):
self.cookies: Optional[Dict[str, str]] = request.cookies
self.body: Optional[bytes] = request.bounded_stream.read()
self.content_type: Optional[str] = request.c... | StarcoderdataPython |
4820590 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# command.py
# SciML-Bench
# Copyright © 2021 Scientific Machine Learning Research Group
# Scientific Computing Department, Rutherford Appleton Laboratory
# Science and Technology Facilities Council, UK.
# All rights reserved.
"""
Main entry of the program
"""
import... | StarcoderdataPython |
3316705 | <reponame>rdl-telecom/billing
import sqlite3
from settings import trains_file
query = 'select name, network from bundles b, ranges r where b.id = r.bundle_id and b.id=%s and r.network not like "10.253.%%";'
directions = {
'St.' : 'spb',
'Belgorod' : 'blg',
'Nice' : 'nice',
'Strizh' : 'nng',
'Lev'... | StarcoderdataPython |
4836084 | #ETL using Spark
# To MariaDB
# Create Schema using
import pyspark
from pyspark.sql import SparkSession
#from pyspark
from pyspark.sql import Row as Row
from pyspark.sql.types import *
from pyspark.sql import functions as f
import datetime as dt
#declaring schema for the dataframe
'''schema = StructType... | StarcoderdataPython |
3278361 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_forms/login_form02.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialo... | StarcoderdataPython |
198064 | <filename>test/test_point.py<gh_stars>0
from __future__ import print_function
import unittest
from random import random
from svgelements import *
class TestElementPoint(unittest.TestCase):
def test_point_init_string(self):
p = Point("(0,24)")
self.assertEqual(p, (0, 24))
se... | StarcoderdataPython |
3395796 | <reponame>PeterYangJChen/Bone-density-predict-project
# import the necessary packages
from sklearn.preprocessing import LabelBinarizer
from sklearn.preprocessing import MinMaxScaler
import tensorflow as tf
from tensorflow import feature_column
from tensorflow.keras import layers
from sklearn.model_selection import trai... | StarcoderdataPython |
1763337 | # -*- coding: utf-8 -*-
"""
#%%##############################################################
# IMERG / GSMAP EXTRACTION v 1.4
###############################################################
@ author: <NAME>
@ correspondence <NAME>
@ <EMAIL>
@ version v 1.4
Variables:
parameter... | StarcoderdataPython |
3375792 | import unittest
import collections
from typing import List, Deque, Tuple
from leetcode.common import TreeNode
class Solution:
"""
This iterative solution keeps a queue of unvisited nodes and their depth
to implement the level order traversal.
The algorithm starts by queueing the root and its level, i... | StarcoderdataPython |
1622415 | import requests
from command import *
from util import *
def _bully_handler(author, text, thread_id, thread_type):
if not len(text):
return False
user = match_user_in_group(thread_id, text)
if user:
reply = ""
if user["Priority"] > author["Priority"]:
reply += "{} is a... | StarcoderdataPython |
133584 | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import gensim.downloader as api
import re
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
class process_txt:
def __init__(self):
print("Loading pre-trained Word2Vec model...")
... | StarcoderdataPython |
3297543 | import random
from functools import partial
from typing import Iterator, Callable
import spacy
from spacy.language import Language
from spacy.training import Example
from ..augment_utilities import make_text_from_orth
@spacy.registry.augmenters("grundtvigian_spacing_augmenter.v1")
def create_grundtvigian_spacing_au... | StarcoderdataPython |
1606433 | <reponame>dfki-asr/morphablegraphs
#!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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 th... | StarcoderdataPython |
3239700 | <gh_stars>0
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn import neighbors
from sklearn.metrics import mean_squared_error
from math import sqrt
import matplotlib.pyplot as plt
tweet_df = pd.read_pickle("/Users/stenzel/Documents/EE... | StarcoderdataPython |
1691638 | una_variable = 100
hex(10)
int("0xa", 16)
def dividir(x, y): # Comentario
return x / y
if una_variable % 2 == 0:
print("El valor es par")
elif una_variable < 0:
print("El valor es impar y negativo")
elif una_variable > 100:
print("El valor es impar y mayor a 100")
else:
print("El valor no cu... | StarcoderdataPython |
1652598 | import numpy as np
import pandas as pd
import tensorflow as tf
import seaborn as sns
import pickle
import matplotlib
import matplotlib.pyplot as plt
from scipy import stats
from pylab import rcParams
from sklearn import metrics
from sklearn.model_selection import train_test_split
import datetime
# Just disables the wa... | StarcoderdataPython |
3250606 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/10/12 1:46 下午
# @Author : Roamoin
# @File : afm.py
import tensorflow as tf
from utils.common import LinearModel, EmbedModel
class AttentionalFactorizationMachine(tf.keras.Model):
def __init__(self, feature_cards, factor_dim, attention_size, nam... | StarcoderdataPython |
128778 | """
Implementation of Total Variation Loss
(https://en.wikipedia.org/wiki/Total_variation_denoising) copied and slightly
modified from the original Apache License 2.0 traiNNer
Authors https://github.com/victorca25/traiNNer/tree/master
# Copyright 2021 traiNNer Authors
#
# Licensed under the Apache License, Version 2.... | StarcoderdataPython |
45424 | <reponame>slgero/check_parser
"""A package which allow parsing Reussian receipts."""
__version__ = "0.0.28"
__license__ = "MIT"
from .receipt_parser import RuleBased # type: ignore
from .finder import Finder # type: ignore
from .normalizer import Normalizer # type: ignore
from .cat_model import PredictCategory #... | StarcoderdataPython |
1679511 | import os
from glob import glob
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from toolkit import (generate_master_flat_and_dark, photometry,
PhotometryResults, PCA_light_curve, params_b,
transit_model_b)
# Image paths
image_paths = sorted(glob(... | StarcoderdataPython |
90790 | <filename>tests/test_constrained_decoding.py
import unittest
import copy
import numpy as np
from constrained_decoding.translation_model import AbstractConstrainedTM
from constrained_decoding import ConstraintHypothesis, init_coverage
# DUMBEST POSSIBLE IMPLEMENTATION of generation functions
# Note that generation a... | StarcoderdataPython |
116713 | NAME = "admin-extra-urls"
VERSION = __version__ = "2.1.0"
__author__ = 'sax'
| StarcoderdataPython |
4806836 | # 094
# Display an array of five numbers. Ask the user to select one
# of the numbers. Once they have selected a number, display the
# position of that item in the array. If they enter something that
# is not in the array, ask them to try again until they select
# a relevant item.
import array as ar
import numpy as np... | StarcoderdataPython |
58950 | <reponame>Smugaski/cenzura<filename>cenzura/bot/lib/embed.py
class Embed:
def __init__(self, **kwargs):
allowed_args = ("title", "description", "color")
for key, value in kwargs.items():
if key in allowed_args:
setattr(self, key, value)
def set_image(self, *, url: s... | StarcoderdataPython |
106840 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Alexa responses for the english version
"""
import config as conf
INIT_RESPONSE = {
conf.Language.EN : {
'session_attributes': {},
'card_title': "Welcome to ROFEX Skill",
'card_output': "Please, tell me an instrument and I'll give you the last price "... | StarcoderdataPython |
1673611 | # playgui.py
# Source: https://github.com/DrGFreeman/rps-cv
#
# MIT License
#
# Copyright (c) 2017-2019 <NAME> <<EMAIL>>
#
# 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 |
1770003 | <filename>opta/commands/init_templates/template.py<gh_stars>100-1000
import copy
from os import path
from typing import Any, Callable, List, Optional
import yaml
from colored import attr, fg
from opta.constants import init_template_path
def load_template(template_type: str, template_name: str) -> dict:
file_pat... | StarcoderdataPython |
4815848 | import jupyterworkflow.data as jwd
import pandas as pd
import numpy as np
def test_fremont_data():
data = jwd.get_fremont_data()
assert all(data.columns == [u'East', u'West', u'Total'])
assert isinstance(data.index, pd.DatetimeIndex)
assert len(np.unique(data.index.time)) == 24
| StarcoderdataPython |
4801413 | from typing import Optional, Sequence
from http_types import Request, Response
from openapi_typed_2.openapi import OAuth2SecurityScheme, OpenAPIObject
from .matcher import truncate_path
def generate_code():
return "xyz"
def gen_authflow_response(req: Request):
if "redirect_uri" not in req.query:
r... | StarcoderdataPython |
85611 | #!/usr/bin/env/python
#-*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import csv
#Coloque aquí el tipo de estrella con el que se va a trabajar. OPCIONES= 'Cefeida', 'RR_Lyrae', 'BinariaECL'.
tipo_estrella='RR_Lyrae';
#Importar los números de las estrellas desde el archivo csv:
ID_estrellas=n... | StarcoderdataPython |
3326954 | <reponame>gifford-lab/seqgra<gh_stars>0
"""
seqgra learner hierarchy - PyTorch
Classes:
- :class:`~seqgra.learner.torch.torchlearner.TorchDNAMultiClassClassificationLearner`: PyTorch implementation of DNA-based multi-class classification learner
- :class:`~seqgra.learner.torch.torchlearner.TorchDNAMultiLabelCl... | StarcoderdataPython |
4800713 | <filename>mpi/python/cupy/Reduce.py<gh_stars>1-10
import chainer.cuda
from chainermn.communicators import _memory_utility
import cupy
from mpi4py import MPI
import time
import common
import utils
def main():
comm = MPI.COMM_WORLD
intra_rank = utils.get_intra_rank(comm)
chainer.cuda.get_device(intra_rank)... | StarcoderdataPython |
3229698 | # This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright in portions of this softwar... | StarcoderdataPython |
3339234 | """An implemention of the Epicast methodology applied to COVID-19."""
# standard library
import statistics
# third party
import numpy as np
import scipy.stats
# first party
from delphi.epidata.client.delphi_epidata import Epidata
import delphi.flu_contest.covid.constants as Constants
from delphi.flu_contest.covid.ta... | StarcoderdataPython |
3299870 | <reponame>mastering-python/code_2
def square(n: int) -> int:
'''
>>> square('x')
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for ** or pow(): ...
'''
return n ** 2
if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.EL... | StarcoderdataPython |
3285687 | from datetime import date, datetime
today = date.today()
now = datetime.now()
now = datetime.strftime(now, format('%Y-%m-%d %H:%M:%S'))
result = []
lay_outs = """---
layout: post
title: "标题"
subtitle: "{subtitle}"
date: {format_date}
author: "soaringsoul"
header-img: "img/posts/defau... | StarcoderdataPython |
18482 | """
lambdata - a collection of Data Science helper functions
"""
import pandas as pd
import sklearn | StarcoderdataPython |
1674793 | <gh_stars>1-10
"""序列化等格式转换功能"""
from collections import OrderedDict
from functools import reduce
import json, decimal
from typing import List, Mapping
def yabee_nvarchar(data: str) -> str:
"""对数据库的不合适的中文字段进行修正"""
if isinstance(data, str) and not data.isascii():
try:
s = data.encode('Latin1... | StarcoderdataPython |
120504 | <gh_stars>1-10
from collections import defaultdict, namedtuple
from functools import lru_cache
from itertools import cycle, product
from typing import Dict
GameState = namedtuple("GameState", "spaces scores turn")
def play_roll(state: GameState, roll: int) -> GameState:
spaces, scores, turn = state
space, sc... | StarcoderdataPython |
3339788 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask import Flask, render_template
from pymongo import MongoClient
from flask_mail import Mail
#Instaciando objeto Flask
app = Flask(__name__)
@app.route("/")
def index_page():
return render_template("landing.html")
app.config.update(
DEBUG=Tr... | StarcoderdataPython |
3208519 | <reponame>jpbarret13/MAG-model-code
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# %pip install tensorflow==2.4.1
# %pip install transformers
# %pip install pyarrow
# %pip install tensorflow-addons
# In[1]:
import tensorflow as tf
import pandas as pd
import pickle
import os
import tensorflow_addons as tfa
from... | StarcoderdataPython |
1615119 | #!/usr/bin/python
import re
import os
import subprocess
import json
MON_REGEX = r"^\d: ([0-9\.]*):\d+/\d* mon.([^ ]*)$"
#kubctl_command = 'kubectl get pods --namespace=${CLUSTER} -l daemon=mon -o template --template="{ {{range .items}} \\"{{.metadata.name}}\\": \\"{{.status.podIP}}\\" , {{end}} }"'
kubectl_command ... | StarcoderdataPython |
3280800 | """Portfolio optimization context API."""
import os
from openbb_terminal.helper_classes import ModelsNamespace as _models
# flake8: noqa
# pylint: disable=unused-import
# Context menus
from openbb_terminal.portfolio.portfolio_optimization.optimizer_view import (
display_equal_weight as equal,
)
from openbb_termin... | StarcoderdataPython |
3319668 | <gh_stars>0
class t:
def __init__(self, lang):
self.lang = lang
def get(self, code):
############################################
# English
############################################
if self.lang == "en":
if code == "sudoerr":
return "Couldn't get required root access!\n"\
"Is the grap... | StarcoderdataPython |
1669243 | import numpy as np
from util.tensor_provider import TensorProvider
from models.model_base import DetektorModel
from sklearn.svm import SVC
class SVMSK(DetektorModel):
@classmethod
def _class_name(cls):
return "Support Vector Machine (Scikit-learn)"
def __init__(self, tensor_provider, use_bow=True... | StarcoderdataPython |
1615714 | # Generated by Django 2.2.13 on 2020-12-14 08:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0105_auto_20201211_0758'),
]
operations = [
migrations.AddField(
model_name='country',
... | StarcoderdataPython |
103204 | <filename>boosting_preprocess.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 26 22:19:57 2017
@author: ethan
"""
import pandas as pd
import numpy as np
import os
from sklearn.preprocessing import Imputer
from sklearn.utils import resample #module for resampling
#import results of augmented... | StarcoderdataPython |
1793713 | import sys
first = True
for line in sys.stdin.readlines():
if first:
first = False
else:
elems = line.strip().split("\t")
print("<http://www.lexvo.org/id/iso639-3/%s> <http://www.w3.org/2000/01/rdf-schema#label> \"%s\"@en ." % (elems[0], elems[3]))
| StarcoderdataPython |
3230089 | <filename>tools/test.py
# coding: utf-8
# MIT License
#
# Copyright (c) 2018 <NAME>, 4IF, INSA Lyon
#
# 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 li... | StarcoderdataPython |
3390124 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import gc
import os
import sys
import threading
# -*- coding: UTF-8 -*-
import unittest
import numpy as np
from helper import get_name
import onnxruntime as onnxrt
from onnxruntime.capi.onnxruntime_pybind11_state import Fa... | StarcoderdataPython |
1644849 | # # -*- encoding: utf-8 -*-
# Mandrake by vp1147 -- 05/03/19 -->
# External libs
from random import randint
import sys
# Own libs
sys.path.append('./modules')
import utils, Gen, shared, JsonFunctions, Area, Arit, Prime, UtilTools, Functions, Equations
def GameMenu():
while 1:
utils.LogoType(shared.LogoPath)
pri... | StarcoderdataPython |
125861 | <reponame>darksigma/traceless
from . import view_manager
from flask import jsonify, request, abort
from flask import current_app as app
import os
from .. import traceless_crypto
import requests
import json
@view_manager.route('/', methods = ['POST'])
def hello_world():
print "hello world"
return "hello world"
... | StarcoderdataPython |
3376627 | <filename>create_graphs.py
import mne
import sys
import numpy as np
from nitime import TimeSeries
from nitime.analysis import CorrelationAnalyzer
from my_settings import *
bands = ["delta", "theta", "alpha", "beta", "gamma1", "gamma2"]
times = np.arange(-2000, 2001, 1.95325)
times = times / 1000.
for subject in sub... | StarcoderdataPython |
4825531 | <filename>LeetCodeSolutions/python/6_ZigZag_Conversion.py
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows <= 1 or numRows >= len(s): return s
strs = [''] * numRows
row, step = 0, 1
... | StarcoderdataPython |
15498 | """
____ _____ _ _ _
| _ \ | __ \ (_) | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/
|____/ \__, | |_| ... | StarcoderdataPython |
1633871 | #!/usr/bin/env python2
from hermes_python.hermes import Hermes
import sys
import pprint
from rm3_mini_controller import broadlink
import time
import re
import binascii
#------------------------------------------------------------------------------
def send(device, cmd):
commands = {
"TVOn": '26004600949412371237... | StarcoderdataPython |
3272389 | <filename>tests/nightly/dist_device_sync_kvstore_horovod.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 f... | StarcoderdataPython |
3320034 |
sal_data_keys = ["Austin", "Portland", "Dallas","Atlanta"]
sal_data_values = [91185,110123, 89123, 112000]
sal_info = {}
print("#### Creating a dictionary without using comprehension")
for key, value in zip(sal_data_keys,sal_data_values):
sal_info[key] = value
print (sal_info)
#sal_info.clear()
#Using ... | StarcoderdataPython |
172513 | <reponame>thatch/BitSwanPump
import pprint
import logging
from ...abc import Expression
###
L = logging.getLogger("bspump.declarative.DEBUG")
###
class DEBUG(Expression):
"""
Transform "string" to lowercase.
"""
def __init__(self, app, *, arg_what):
super().__init__(app)
self.What = arg_what
def __call... | StarcoderdataPython |
1778140 | from .models import FlowRow, RunRow, StepRow, TaskRow, ArtifactRow, MetadataRow
| StarcoderdataPython |
131023 | <gh_stars>0
# %%
#######################################
def get_group_members(group_name=None):
"""Returns a DataFrame containing the local computer's groups, GID, and group members.
Examples:
>>> get_group_members()\n
0 1 2 3\n
0 ... | StarcoderdataPython |
1000 | # -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | StarcoderdataPython |
3326986 | <reponame>jialing3/corner_cases
from collections import defaultdict
def is_prime(n):
if n == 2 or n == 3: return True
if n < 2 or n%2 == 0: return False
if n < 9: return True
if n%3 == 0: return False
r = int(n ** .5)
f = 5
while f <= r:
if n%f == 0: return False
if n%(f+2) == 0: return False
... | StarcoderdataPython |
94845 | <gh_stars>1-10
from typing import List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from db_api import crud, models, schemas
from db_api.api import deps
router = APIRouter()
@router.get("/", response_model=List[schemas.UserRating])
def read_user_ratings(
skip: int = ... | StarcoderdataPython |
118355 | <reponame>daboross/qxlc
from datetime import datetime
from sqlalchemy import MetaData, create_engine, Table, Column, String, select
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql.sqltypes import Integer, DateTime
from qxlc import config
db_path = config.get('database')
db_engine = create_engine(db_path)... | StarcoderdataPython |
3345257 | #!/usr/bin/env python
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, window, asc, desc, lead, lag, udf, hour, month, dayofmonth, collect_list, lit, year, date_trunc, dayofweek
import pyspark.sql.functions as F
from pyspark.sql.window import Window
from pyspark.sql.types import FloatType, In... | StarcoderdataPython |
1743883 | from .rpc import worker_client
from .rpc import worker_server
from .rpc import scheduler_client
from .rpc import scheduler_server
| StarcoderdataPython |
167081 | <gh_stars>10-100
from .client import Client
class Feed(Client):
"""Feed"""
def __init__(self, auth_token):
Client.__init__(self, auth_token)
self.path = 'feeds/'
| StarcoderdataPython |
1749126 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from operator import itemgetter
import glob
import os
import struct
import zlib
class AD1Reader(object):
def __init__(self, ad1_path, separator='/', margin=512, string_encoding='utf-8'):
self.separator = separator
... | StarcoderdataPython |
1797025 | from nautobot.core.apps import NautobotConfig
class VirtualizationConfig(NautobotConfig):
name = "nautobot.virtualization"
| StarcoderdataPython |
3351243 | import pytest
@pytest.fixture(scope='module')
def view():
from model import Model
from config import DATA_FILES, DATA_MERGE_KEYS
from view import View
try:
view = View( Model( DATA_FILES['companies'], DATA_FILES['users'], DATA_MERGE_KEYS['companies'], DATA_MERGE_KEYS['users'] ) )
return... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.