id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1751625 | # from Instrucciones.instruccion import Instruccion
# from storageManager.jsonMode import *
# import Tabla_simbolos.TablaSimbolos as TS
from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.instruccion import Instruccion
from tytus.parser.fase2.team21.Analisis_Ascendente.storageManager.jsonMode import *
fr... | StarcoderdataPython |
153517 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_Di... | StarcoderdataPython |
144596 | <reponame>econcarol/ISLR
# ISLR Ch 6 by <NAME>
import itertools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from sklearn.preprocessing import PolynomialFeatures, scale
from sklearn.model_selection import train_test_split, KFold, cross_val_score
from sklearn.linea... | StarcoderdataPython |
3312525 | <filename>pymialsrtk/interfaces/postprocess.py<gh_stars>0
# Copyright © 2016-2021 Medical Image Analysis Laboratory, University Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland
#
# This software is distributed under the open-source license Modified BSD.
"""PyMIALSRTK postprocessing functions.
It e... | StarcoderdataPython |
193739 | from dlcliche.image import *
from lib_fat2019 import *
APPNAME = 'final'
conf.DURATION = 1
conf.AUG_LEVEL = 1
conf.CV = 0
conf.RELABEL = 'COOC_PROB'
conf.DATA = Path('/mnt/dataset/freesound-audio-tagging-2019')
conf.ROOT = Path('/mnt/dataset/fat2019_files')
conf.WORK = Path('/mnt/dataset/work/fat2019')
conf.MODEL =... | StarcoderdataPython |
14685 | url = "https://www.delish.com/cooking/recipe-ideas/recipes/a53823/easy-pad-thai-recipe/"
url2 = "https://www.allrecipes.com/recipe/92462/slow-cooker-texas-pulled-pork/"
# opener = urllib.URLopener()
# opener.addheader(('User-Agent', 'Mozilla/5.0'))
# f = urllib.urlopen(url)
import requests
import html2text
h = html2... | StarcoderdataPython |
8868 | <reponame>mirfan899/MTTS
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ ... | StarcoderdataPython |
91052 | class ExitMixin():
def do_exit(self, _):
'''
Exit the shell.
'''
print(self._exit_msg)
return True
def do_EOF(self, params):
print()
return self.do_exit(params)
| StarcoderdataPython |
3247600 | <gh_stars>0
# Stack: A stack.
# Your implementation should pass the tests in stack.py.
# <NAME>
class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def pop(self):
return self.items.pop()
def peek(self):
if self.is_empt... | StarcoderdataPython |
1614364 | <filename>Code/animate_searching.py
import cv2
def visualize_exploration(world_map, start_location, end_location, branches, robot_radius, frame_skip):
print("[INFO]: Started Nodes Exploration Visualization from the INITIAL node to the GOAL node")
# convert the gray scale world map to bgr for visualization
... | StarcoderdataPython |
3298626 | <filename>setup.py
from setuptools import setup
import re
with open('ggd/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
requires = ["pyyaml"]
setup(
name="ggd",
version=version,
description="CLI for gog... | StarcoderdataPython |
96050 | <filename>lessnless/__init__.py
from mingus.midi import fluidsynth
fluidsynth.init('Nice-Keys-Ultimate-V2.3.sf2')
| StarcoderdataPython |
3204564 | <reponame>GrayChrysTea/coupled-values
#
# MIT License
#
# Copyright(c) 2020 GrayChrysTea
#
# 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 limitat... | StarcoderdataPython |
1753464 | #griffinc StackOverflow
import numpy as np
import matplotlib.pyplot as plt
from skimage.io import imread
from skimage.segmentation import random_walker
from skimage.color import rgb2grey
from scipy.ndimage.filters import gaussian_filter
#change to your directory
image = imread(r'C:\Users\YourNameHere\Do... | StarcoderdataPython |
1758906 | <gh_stars>1-10
"""
Commands which control or otherwise interact with the request queue.
"""
from __future__ import annotations
from abc import ABC
from typing import List, Iterator, Optional, Tuple, FrozenSet, Iterable, Union
from sahyun_bot.commander_settings import Command, ResponseHook, DEFAULT_MAX_SEARCH, DEFAULT... | StarcoderdataPython |
3388830 | <reponame>GLVis/pyglvis
version_info = (0, 3, 2)
__version__ = ".".join(map(str, version_info))
extension_version = "0.3.2"
| StarcoderdataPython |
3340590 | #!/usr/bin/env python
from pathlib import Path
import numpy as np
import h5py
from typing import Tuple
import xarray
"""
inputs:
spec: excitation rates, 3-D , dimensions time x altitude x reaction
output:
ver: a pandas DataFrame, wavelength x altitude
br: flux-tube integrated intensity, dimension lamb
See Eqn 9 of A... | StarcoderdataPython |
1719278 | <reponame>o74589055/voicefilter_torch_ws
import torch
import torch.nn as nn
class LinearNorm(nn.Module):
def __init__(self, hp):
super(LinearNorm, self).__init__()
self.linear_layer = nn.Linear(hp.embedder.lstm_hidden, hp.embedder.emb_dim)
def forward(self, x):
return self.linear_laye... | StarcoderdataPython |
125828 | from django.contrib.auth.models import User, Group
from .models import EveService, EveInvoice, EvePayment
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.db import transaction
from .email import send_service_request_notification, send_service_update_notification, send_inv... | StarcoderdataPython |
3228360 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... | StarcoderdataPython |
193008 | <filename>train_mimicry_phase1.py<gh_stars>10-100
import argparse
import os
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
from torch.utils import data
from diagan.datasets.predefined import get_predefined_dataset
from diagan.models.predefined_models import get_gan_model
from diagan.traine... | StarcoderdataPython |
4843206 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Testing utilities to be used with pytest.
"""
# Standard library imports
import shutil
import tempfile
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock # Python ... | StarcoderdataPython |
1642846 | <filename>lectures/extensions/hyperbolic_discounting/replication_code/src/data_simulation/simulate_main_dataset.py
"""Simulate main datasets for specifications of model based on :cite:`KeaneWolpin1994` (KW94)."""
import pandas as pd
import respy as rp
import yaml
from bld.project_paths import project_paths_join as ppj
... | StarcoderdataPython |
93119 | <filename>smith/input_fns.py
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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
#
... | StarcoderdataPython |
75705 | from django.urls import path
from . import views
# Objektivaated
from wiki.views import ArtikkelDetailView, IsikDetailView, OrganisatsioonDetailView, ObjektDetailView, KaardiobjektDetailView
# Filtreerimisvaated
from wiki.views import ArtikkelFilterView, IsikFilterView, OrganisatsioonFilterView, ObjektFilterView, Kaa... | StarcoderdataPython |
185399 | <filename>convert.py
#!/usr/bin/env python3
import os, sys, time
import xml.etree.ElementTree as ET
from utils import load_config, pretty_print_json, createDirectory
CONFIG_FILE = "config.yml"
class dataConverter(object):
"""Conver Polar Excercise XML data files to CSV and GeoJSON formats"""
def __init__(self):... | StarcoderdataPython |
3310128 | <gh_stars>0
"""
Unit tests for the features module
"""
import os
from configparser import ConfigParser
from unittest import mock
from pkg_resources import resource_exists
from oet.features import Features
def test_pubsub_precedence():
"""
Test that feature flags are set in the expected order:
1. by en... | StarcoderdataPython |
123568 | <reponame>jpweldon/Module_2_Challenge
# Import pathlib
from pathlib import Path
#Import fileio
from qualifier.utils import fileio
# Import Calculators
from qualifier.utils import calculators
# Import Filters
from qualifier.filters import credit_score
from qualifier.filters import debt_to_income
from qualifier.filter... | StarcoderdataPython |
101220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2018 <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, including ... | StarcoderdataPython |
1604845 | <gh_stars>1-10
# pytest requires at least one test case to run
def test_placeholder():
pass
| StarcoderdataPython |
3242269 | import sys, os, re, json, codecs
import cPickle as Pickle
from PyCoreNLP.PyCoreNLP import PyCoreNLP
def saveToPKL(filename, data):
with open(filename,'wb')as f:
Pickle.dump(data, f)
return
def loadFromPKL(filename):
with open(filename,'rb') as f:
data = Pickle.load(f)
return data
de... | StarcoderdataPython |
4830250 | # Copyright 2013 IBM Corp
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | StarcoderdataPython |
3241357 | <gh_stars>1-10
"""A module for the Coding DNA insertion Classifier."""
from typing import List
from .set_based_classifier import SetBasedClassifier
from variation.schemas.classification_response_schema import ClassificationType
class CodingDNAInsertionClassifier(SetBasedClassifier):
"""The Coding DNA insertion Cl... | StarcoderdataPython |
1743834 | import datetime
import json
import random
import pytest
import requests
from pylenium import Pylenium
from tests.pages.paybc import PayBCPage
from tests.utilities.settings import get_path_settings, get_settings, get_test_data
class TestPayment:
"""Payment test suite."""
# Only excute these tests by main fl... | StarcoderdataPython |
3303876 | import argparse
import glob
import os
from os.path import join
import h5py
import numpy as np
from tqdm import tqdm
from ..dataset.core import DHP19Core
from ..utils import load_heatmap
def convert_raw_labels_to_heatmap(x_path, width, height, out_dir):
filename = os.path.basename(x_path)
sub = filename[file... | StarcoderdataPython |
3330654 | # network create wireguard interface
from .ip_wrapper import ip_wrapper, Ip_Wrapper_Command_Error
from .network_create_namespace import netns_setdns
import wgconfig
from pprint import pprint
def wireguard_config_load(interface_name):
"""Load config from file."""
wc = wgconfig.WGConfig(interface_name)
try... | StarcoderdataPython |
3247944 | <reponame>ToraNova/library
#--------------------------------------------------
# auxtools.py
# this file acts like the swiss army knife of my python
# library, it will contain powerful and useful python functions
# which do not really match to any classes of operation
# created 01/09/2019 11:45pm
#---------------------... | StarcoderdataPython |
193889 | <gh_stars>1-10
"""Support for Rheem EcoNet water heaters."""
import logging
from pyeconet.equipment import EquipmentType
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
VOLUME_GALLONS,
)
from . import EcoNetEntity
from .const import DOMAIN, EQU... | StarcoderdataPython |
118917 | import os.path
import site
# add `lib` subdirectory as a site packages directory, so our `main` module can load
# third-party libraries.
site.addsitedir(os.path.join(os.path.dirname(__file__), 'lib'))
import logging
import os
from paste.deploy import loadapp
from pyramid.paster import (
setup_logging,
get_app... | StarcoderdataPython |
4805211 | <gh_stars>1-10
from __future__ import absolute_import
from builtins import range
import django_dynamic_fixture as fixture
from django.test import TestCase, RequestFactory
from django.contrib.contenttypes.models import ContentType
from rest_framework.test import APIClient
from rest_framework.test import APIRequestFacto... | StarcoderdataPython |
3265397 | <gh_stars>10-100
#!/usr/bin/env python
"""
psola.utilites.center_clipping
provides a function to do center clipping, i.e.,
moving values *close* to zero to zero
Author: jreinhold
Created on: Aug 10, 2017
"""
import numpy as np
def center_clipping(x, percent=30):
"""
Performs center clipping, a spectral wh... | StarcoderdataPython |
3277765 | from setuptools import find_packages, setup
setup(
name='asyncirc',
version='0.0.1',
description='Python 3.6+ asyncio irc server and client library',
long_description='',
author='<NAME>',
author_email='<EMAIL>',
maintainer='<NAME>',
maintainer_email='<EMAIL>',
url='https://github.co... | StarcoderdataPython |
1733786 | <gh_stars>0
from sqlalchemy import Column, ForeignKey, String, JSON
from sqlalchemy.orm import relationship
from src.utilities.database import Base
from src.models.veterans import Veteran
class MedicalSheet(Base):
__tablename__ = "MEDICAL_SHEETS"
user = relationship("Veteran", back_populates="medical")
t... | StarcoderdataPython |
1656683 | from setuptools import setup, find_packages
def get_version(path):
""" Parse the version number variable __version__ from a script. """
import re
string = open(path).read()
version_re = r"^__version__ = ['\"]([^'\"]*)['\"]"
version_str = re.search(version_re, string, re.M).group(1)
return versi... | StarcoderdataPython |
3253934 | <reponame>erikhvatum/wautofocuser
# The MIT License (MIT)
#
# Copyright (c) 2014 WUSTL ZPLAB
#
# 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 limitatio... | StarcoderdataPython |
74749 | from flask import Blueprint, render_template, current_app, make_response
from webargs import fields, flaskparser
from ._utils import route
REFRESH_SECONDS = 60
blueprint = Blueprint('latest-page', __name__)
@blueprint.route("/latest")
@flaskparser.use_kwargs({'nsfw': fields.Bool(missing=False)})
def get(nsfw):
... | StarcoderdataPython |
5020 | <reponame>linuxdaemon/poly-match
from polymatch import PolymorphicMatcher
class ExactMatcher(PolymorphicMatcher):
def compile_pattern(self, raw_pattern):
return raw_pattern
def compile_pattern_cs(self, raw_pattern):
return raw_pattern
def compile_pattern_ci(self, raw_pattern):
re... | StarcoderdataPython |
3243347 | <reponame>thusser/spexxy
import numpy as np
from spexxy.utils import continuum
MAXRMS = 0.3
def data():
# create polynomial of 3rd order
x = np.linspace(0, 4, 1000)
y = -(x - 2) ** 3 - (x - 2) ** 2 + 2 * (x - 2)
# add noise
yn = y + np.random.normal(0, 0.2, x.shape)
# return it
return... | StarcoderdataPython |
3215169 | import json
import logging
import inspect
from .decorators import pipeline_functions, register_pipeline
from indra.statements import get_statement_by_name, Statement
logger = logging.getLogger(__name__)
class AssemblyPipeline():
"""An assembly pipeline that runs the specified steps on a given set of
statem... | StarcoderdataPython |
3289392 | palindromo = str(input('Digite uma frase: ')).strip().upper() #espaços eliminados
palavras = palindromo.split() #gerou uma lista
frase = ''.join(palavras) #juntou a lista sem espaço
inverso = frase[::-1]
print('O inverso de {} é {}'.format(frase, inverso))
if inverso == frase:
print('A frase é um palíndromo!')... | StarcoderdataPython |
3303603 | <reponame>sidewalkchalka/species-finder
#Put the clip name and species in this exact way (spelling and capitalization counts but not order)
Ace = "Fox"
Ash = "Coyote"
Beta = "Dragon, Wolf"
Blu = "Dragon"
Caffeine = "Fox"
Chip = "Cat"
Crash = "Wolf"
Foofi = "Fox"
Majira = "Fox"
Nos = "Hyena"
Spoctor = "Dragon"
Stormi = ... | StarcoderdataPython |
1771959 | '''
Copyright (c) 2008 <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, including without limitation the rights
to use, copy, modify, merge, publish... | StarcoderdataPython |
1628821 | <filename>Lib/site-packages/eventtools/__init__.py
from . import _version
__version__ = _version.__version__
| StarcoderdataPython |
28467 | '''
Created on Oct 10, 2012
@author: <NAME>
@contact: <EMAIL>
'''
class Color:
def __init__(self, red=0., green=0., blue=0., alpha=1.0):
self.__red = red
self.__green = green
self.__blue = blue
self.__alpha = alpha
def get_rgba(self):
return self.__red, se... | StarcoderdataPython |
156186 | from sys import argv
def rot(chave, texto):
tabela = {}
alfabeto = 'abcdefghijklmnopqrstuvwxyz'
for a in range(0, 26):
tabela[alfabeto[a]] = alfabeto[(a + 26 + chave) % 26]
tabela[alfabeto[a].upper()] = alfabeto[(a + 26 + chave) % 26].upper()
novo = '';
for x in texto:
... | StarcoderdataPython |
3360352 | """
PyISYLink Helpers
"""
from .Tester import Tester
from .Foscam1 import Foscam1
from .DateAndTime import DateAndTime
from .Maker import Maker
from .FauxMo import FauxMo
from .PyHue import PyHue
from .PyHarmony import PyHarmony
class Helpers(object):
def __init__(self,logger,sched,co... | StarcoderdataPython |
39014 | import os
import unittest
import invirtualenv.contextmanager
class TestContextmanager(unittest.TestCase):
def test__revert_file(self):
with invirtualenv.contextmanager.InTemporaryDirectory():
with open('testfile', 'w') as fh:
fh.write('original')
self.assertEqual('o... | StarcoderdataPython |
111619 | <filename>src/main/anonymization/base_anonymization.py<gh_stars>100-1000
from abc import ABC, abstractmethod
class BaseAnonymization(ABC):
"""
Base anonymization class for the detection and the semantic anonymization
"""
@abstractmethod
def blurring(self, image, response, degree=None, id=None, mas... | StarcoderdataPython |
132043 | <reponame>mixilchenko/exchange_calendars<gh_stars>0
from unittest import TestCase
import pandas as pd
import pandas.testing as tm
from exchange_calendars.exchange_calendar_xkrx import XKRXExchangeCalendar
from .test_exchange_calendar import NoDSTExchangeCalendarTestBase
from .test_utils import T
class XKRXCalendar... | StarcoderdataPython |
1674746 |
import sys
import getopt
import numpy as np
from cplate.libio import *
def simulate_permutation_null(cfg):
# Extract paths
y_path = cfg['data']['chrom_path'].strip().format(**cfg)
regions_path = cfg['data']['regions_path'].strip().format(**cfg)
null_path = cfg['data']['null_path'].strip().format(**cfg)
... | StarcoderdataPython |
1644495 | """
Access frequency base class
"""
import logging
from marshmallow import Schema, fields
from py_abac.policy.conditions.base import ConditionBase, ABCMeta, abstractmethod
from shapely.geometry import LineString, Point, Polygon
LOG = logging.getLogger(__name__)
def is_valid_argument(value) -> bool:
isValid... | StarcoderdataPython |
1724247 | #!/usr/bin/env python3
# -*- coding=utf-8 -*-
# Project: dspus
# injections.py
# Created by @wenchieh on <1/12/2020>
__author__ = 'wenchieh'
# sys
from random import sample
# third-part libs
import numpy as np
from scipy import linalg
from scipy.sparse import *
# parameters in injection -
# spike(M... | StarcoderdataPython |
58450 | from sql_gen.commands import CreateSQLTaskCommand
from sql_gen.database import Connector, EMDatabase
from emtask.database import addb
class RewireVerbSQLTask(object):
def create_rewire_verb_template(self, verb, new_path):
self._create_sql(
"rewire_verb.sql",
entity_def_id=verb._en... | StarcoderdataPython |
1685106 | # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
import unittest
from django.db import connection
from django.db.backends.signals import connection_created
from django.conf import settings
class Callproc(unittest.TestCase):
def test_dbms_session(self):
# If the backend is Oracle... | StarcoderdataPython |
3335171 | # coding=utf-8
# Author: <NAME> & <NAME>
# Date: Jan 06, 2021
#
# Description: Parse Instagram timelines and extract dictionary matches
#
import os
import sys
#
include_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'include'))
# include_path = '/nfs/nfs7/home/rionbr/myaura/include... | StarcoderdataPython |
176398 | <gh_stars>0
"""
1 - Faça um programa que receba dois números e mostre qual deles é o maior.
"""
numero1 = int(input("Digite o primeiro número: "))
numero2 = int(input("Digite o segundo número: "))
if numero1 > numero2:
print(f"Entre os números {numero1} e {numero2} .O número maior é: {numero1}")
elif numero1 == ... | StarcoderdataPython |
13335 | import os
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_vtable_extraction_x86_64():
p = angr.Project(os.path.join(test_location, "x86_64", "cpp_classes"), auto_load_libs=False)
vtables_sizes = {0x403cb0: 24, 0x403cd8: 1... | StarcoderdataPython |
30034 | from django.db import models
# Create your models here.
class user(models.Model):
name = models.CharField(max_length=25)
phone = models.CharField(max_length=25,default='+92')
email = models.EmailField()
city = models.CharField(max_length=20)
content = models.TextField()
def __str__(self):
... | StarcoderdataPython |
3227062 | # Copyright (c) maiot GmbH 2020. 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 applica... | StarcoderdataPython |
92437 | import day14.data as data
def part1():
value = data.INPUT
def calculate_value(mask, base_value):
binary = f"{base_value:b}".zfill(len(mask))
result = ""
for idx in range(len(mask)):
m = mask[idx]
if m in ["0", "1"]:
result += m
else... | StarcoderdataPython |
3241941 | <filename>test/test_execute_task_SE.py
def test_execute_task_se_education(app, json_basic_info):
# Доступны варианты json_basic_info, data_basic_info (тестовые данные выбираются в зависимости от названия переменной)
old_number_tasks = app.task.get_task_list()
app.task.add_task_audit_se_education()
new_n... | StarcoderdataPython |
3369414 | <reponame>sweatybridge/text-to-anime<gh_stars>0
import math
import os
import time
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader
from loader import TextLandmarkCollate, TextLandmarkLoader
from model import TextLandmarkModel
from utils import HParams
class Tacotron2Loss(... | StarcoderdataPython |
3240129 | import os
import subprocess
import sys
input_file = sys.argv[1]
test_file = sys.argv[2]
prediction_file = sys.argv[3]
out_dir = sys.argv[4]
fold = sys.argv[5]
os.chdir('./methods/iDeepS')
if not os.path.isdir('./EDeN'):
# subprocess.run(['unzip', 'EDeN.zip'])
print subprocess.Popen(['unzip', 'EDeN.zip'], std... | StarcoderdataPython |
195038 | <reponame>yvan-vin/nevergrad
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import warnings
import threading
import queue
import numpy as np
import nevergrad.common.typ... | StarcoderdataPython |
3291671 | <reponame>changmeng72/leecode_python3<gh_stars>0
class Solution:
def minStartValue(self, nums: List[int]) -> int:
s = 0
m = nums[0]
for num in nums:
s += num
if s<m:
m = s
if m<1:
return 1-m
else:
retu... | StarcoderdataPython |
4841765 |
def addArrays(x, y):
z = []
for i in range(0,len(x)):
z.append( x[i] + y[i] )
return z
if __name__ == "__main__":
# Don't run this code if this script is being
# imported as a module
a = [ 1, 2, 3, 4 ]
b = [ 5, 6, 7, 8 ]
c = addArrays(a, b)
print( c )
| StarcoderdataPython |
1621980 | from django.contrib.auth.backends import ModelBackend, UserModel
USERNAME_FIELD = UserModel.USERNAME_FIELD if hasattr(
UserModel, 'USERNAME_FIELD') else 'username'
class PasswordlessAuthBackend(ModelBackend):
def authenticate(self, username=None):
try:
return UserModel.objects.get(**{USE... | StarcoderdataPython |
41460 | <filename>tests/util/answers.py
from tests.util.params import LOGO_BASE64
PROJECTS_LIST = {
'projects': [{
"id": "15c578ea47a5466db2aeb57dc8443676",
"name": "pr1",
"url": "http://11111.selvpc.ru",
"enabled": True,
"theme": {
"color": "",
"logo": "",
... | StarcoderdataPython |
96171 | <filename>kgdata/wikidata/datasets/entity_redirection_dump.py
from bz2 import BZ2File
from gzip import GzipFile
from operator import itemgetter
from typing import BinaryIO, Union
from kgdata.config import WIKIDATA_DIR
from kgdata.spark import (
does_result_dir_exist,
get_spark_context,
head,
saveAsSing... | StarcoderdataPython |
3293159 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | StarcoderdataPython |
3381739 | <gh_stars>0
import sys
sys.path.append('core')
import argparse
import os
import cv2
import glob
import numpy as np
import torch
from PIL import Image
from raft import RAFT
from utils import flow_viz
from utils.utils import InputPadder
from io_list import save_list
DEVICE = torch.device('cuda' if torch.cuda.is_avail... | StarcoderdataPython |
3210982 |
import torch
import torchvision.models as models
from torch.profiler import profile, record_function, ProfilerActivity
from torch.profiler import profile, tensorboard_trace_handler
model = models.resnet18()
inputs = torch.randn(5, 3, 224, 224)
with profile(activities=[ProfilerActivity.CPU],
record_shapes... | StarcoderdataPython |
3268840 | <filename>tools/genGLXMacrosHeader.py
#!/usr/bin/env python3
import os
import sys
import datetime
def textFinder(file_contents, line_prefix):
for line in file_contents.split("\n"):
if line.startswith(line_prefix):
yield line
glxmacros_hdr = open(f"{sys.argv[2]}/GLXMacros.h", 'w')
glew_source... | StarcoderdataPython |
126364 | <gh_stars>1-10
"""FreeCAD init script of the Battery pack module"""
# Not sure what I am supposed to put here | StarcoderdataPython |
3325138 | from datetime import timedelta
import datetime
import pandas as pd
import numpy as np
def smooth_with_rolling_average(
series: pd.Series,
window: int = 7,
include_trailing_zeros: bool = True,
exclude_negatives: bool = True,
):
"""Smoothes series with a min period of 1.
Series must have a date... | StarcoderdataPython |
3337894 | AUGTZ_MOLPRO = '''basis={
!
! HYDROGEN (5s,2p) -> [3s,2p]
! HYDROGEN (4s,1p) -> [2s,1p]
! HYDROGEN (1s,1p)
s, H , 13.0100000, 1.9620000, 0.4446000, 0.1220000, 0.0297400
c, 1.3, 0.0196850, 0.1379770, 0.4781480
c, 4.4, 1
c, 5.5, 1
p, H , 0.7270000, 0.1410000
c, 1.1, 1
c, 2.2, 1
! LITHIUM (10s,5p,2... | StarcoderdataPython |
7100 | print('this is a test2 file')
| StarcoderdataPython |
18937 |
import random
import cocos
from cocos.tiles import TileSet, RectCell, RectMapLayer
from cocos.director import director
from cocos.layer.scrolling import ScrollingManager
import pyglet
from game import Game
from views import WorldMap, CharacterView2
class MainLayer(cocos.layer.Layer):
is_event_handler = True
... | StarcoderdataPython |
118778 | # -*- coding: utf-8 -*-
"""<EMAIL>.
功能描述:one hot encoding for manifacture name
"""
import os
from pyspark.sql import SparkSession
from dataparepare import *
from interfere import *
from pdu_feature import *
from pyspark.sql.types import *
from pyspark.sql.functions import when
from pyspark.sql.functions import explo... | StarcoderdataPython |
1771089 | """
Last edited: May 15 2018
@author: <NAME>
"""
from .lopf import LinearOptimalPowerFlow
from .conversionDynamic import ConversionDynamic
from .conversionPartLoad import ConversionPartLoad
from .DSM import DemandSideManagementBETA
from .storageExt import StorageExtBETA
| StarcoderdataPython |
1690928 | <filename>src/models/users/__init__.py
from src.models.users.users import UserModel
from src.models.users.bouncer import BouncerModel
from src.models.users.clients import ClientModel
| StarcoderdataPython |
115675 | """
# Copyright 2020 <NAME>, Inc. 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
Author: <NAME>, <EMAIL>
Status: Active
"""... | StarcoderdataPython |
177174 | <reponame>eengineergz/Lambda<filename>0-notes/job-search/Cracking the Coding Interview/C04TreesGraphs/questions/4.6-questions.py
# 4.6 Successor
# Write an algorithm to find the "next" node (i.e. in-order successor) of a given node in a binary
# search tree.
# You may assume that each node has a link to its pare... | StarcoderdataPython |
3343978 | <gh_stars>0
import sys
import commons.file_operations as file_operations
from entities.map import Map
from entities.node import Node
from commons.utils import create_matrix
from pathfinding import find_path
def main():
location_start = list()
location_end = list()
file_path = ""
try:
file_path ... | StarcoderdataPython |
3330671 | <filename>dyads.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 16 15:06:42 2018
@author: Mike
"""
#import pandas as pd
#import numpy as np
import networkx as nx
#from states_update import states_update
#from edges_update import edges_update
from import_data import syncNet
"""Create and prepare nx ... | StarcoderdataPython |
1736058 | <gh_stars>1-10
# @Time : 2020/12/17
# @Author : <NAME>
# @Email : <EMAIL>
# UPDATE
# @Time : 2020/12/29, 2021/1/4
# @Author : <NAME>, <NAME>
# @email : <EMAIL>, <EMAIL>
import os
import torch
from torch import nn
from transformers import BertModel
from crslab.config import MODEL_PATH
from crslab.data import d... | StarcoderdataPython |
3251669 | from pygame.image import load
def load_sprite(name, with_alpha=True):
path = f"assets/sprites/{name}.png"
loaded_sprite = load(path)
if with_alpha:
return loaded_sprite.convert_alpha()
else:
return loaded_sprite.convert()
| StarcoderdataPython |
3385046 | """Docstring."""
from random import choice as rand_choice
from itertools import repeat as iter_repeat
from re import findall
def gen_suite(suite):
"""Funcdoc."""
return [n + suite for n in ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']]
class Deck(object):
"""Classdoc."""
def get_... | StarcoderdataPython |
8099 | import glob
import numpy as np
X = np.empty((0, 193))
y = np.empty((0, 10))
groups = np.empty((0, 1))
npz_files = glob.glob('./urban_sound_?.npz')
for fn in npz_files:
print(fn)
data = np.load(fn)
X = np.append(X, data['X'], axis=0)
y = np.append(y, data['y'], axis=0)
groups = np.append(groups, dat... | StarcoderdataPython |
3253584 | <reponame>SCECcode/cybershake-tools<filename>runs/runmanager/cron_run_check.py
#!/usr/bin/env python
# Add RunManager modules to PYTHONPATH
import sys
sys.path.append('/home/scec-02/cybershk/runs/runmanager/RunManager/')
# General imports
import time
import socket
from RunManager import *
from Condor import *
from M... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.