id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3238769 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-04-29 21:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependenc... | StarcoderdataPython |
1776365 | <reponame>kevincarrogan/mistune
import re
from mistune.scanner import escape_html
ABBR_PATTERN = re.compile(r"[*]\[(?P<key>[^\]]*)\][ ]?:[ ]*\n?[ ]*(?P<definition>.*)")
def render_html_abbr(key, definition):
title_attribute = ""
if definition:
definition = escape_html(definition)
title_attr... | StarcoderdataPython |
57489 | from __future__ import print_function
from expresso.libs.expresso_serial import ExpressoSerial
import sys
port = sys.argv[1]
number = int(sys.argv[2])
print()
print('setting device ID')
print(' port = {0}'.format(port))
print(' number = {0}'.format(number))
print()
dev = ExpressoSerial(port,checkId=False)
dev.... | StarcoderdataPython |
3257749 | #!/usr/bin/env python
#
# Copyright 2012 Google Inc.
#
# 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 o... | StarcoderdataPython |
1613273 | import pytest
from ..connectors.dummy import Dummy as DummyConnector
from ..worker import Worker
from ..brokers.standard import Standard as StandardBroker
from .fixtures import Adder, FakeAdder, AbstractAdder, RetryJob, ExceptionJob
class TestWorker(object):
@property
def connector(self):
return Dum... | StarcoderdataPython |
67672 | #!/usr/bin/env python
"""
same as myzeros() in MATLAB
MYZEROS same as zeros(x) but if x is a scalar interprets as zeros([x 1])
"""
import numpy as np
def myzeros(x):
print "x =", x
x = np.array(x)
if x.size > 1:
out=np.zeros(x)
else:
out=np.zeros((x,1))
return out
| StarcoderdataPython |
4832173 | <filename>Nn/__init__.py
import tensorflow as tf
from .tf1nn import *
from .noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
| StarcoderdataPython |
1689013 | # Generated by Django 2.1.3 on 2018-11-27 15:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("blog", "0016_auto_20181121_1412")]
operations = [
migrations.RemoveField(model_name="photoset", name="photos"),
migrations.RemoveField(model_name="photos... | StarcoderdataPython |
3310318 | <reponame>tofuman/RedStar-Badge-OS<filename>bootstrap.py<gh_stars>0
# TiLDA Badge Bootstrap script
# Automatically downloads the app library to the badge via wifi
import network, pyb, usocket, machine, os, json, ugfx, ujson, hashlib, binascii, uio, sys
### START lib/http_client.py ###
SUPPORT_TIMEOUT = hasattr(usocket... | StarcoderdataPython |
3393105 | <filename>ml-something/src/main/python/simple-model/StudentKnowledgeModel.py<gh_stars>0
import tensorflow as tf
import numpy as np
class KnowledgeData(object):
def __init__(self):
self.data_file = "data"
self.student_map = {}
self.student_index_map = {}
self.knowledge_map = {}
... | StarcoderdataPython |
3372319 | <gh_stars>0
#!/usr/bin/env python3
import xarray as xr
import numpy as np
import mesh_utils
def add_cube(verts, faces, material_ids, origin, dx, dy, dz, materials):
new_verts = np.array(origin, dtype=np.float64) + np.array([
[0 ,0 , 0], # 0 Ab
[dx,0 , 0], # 1 Bb
[0 ,dy, 0], # 2 Cb
... | StarcoderdataPython |
1642278 | <reponame>Swerved/Hulkster
"""
Database Passwords
Requires PWPPY.dll for PWP Databases
"""
from swerve.core import commandline
def pwp():
return commandline.cli_get_value_for_argument("pwp")
| StarcoderdataPython |
1661674 | <gh_stars>1-10
import pygit2
import argparse
import json
def format_component(submod):
return {"component":{"type":"git","git":{"commitHash":str(submod.head_id), "repositoryUrl":str(submod.url)}}}
def process_component(repo):
return [repo.lookup_submodule(submod) for submod in repo.listall_submodules()]
def ... | StarcoderdataPython |
1614202 | import unittest
import shutil
import tempfile
import numpy as np
import pandas as pd
import pymc3 as pm
from pymc3 import summary
from sklearn.gaussian_process import GaussianProcessRegressor as skGaussianProcessRegressor
from sklearn.model_selection import train_test_split
from pymc3_models.exc import PyMC3ModelsEr... | StarcoderdataPython |
3331365 | <reponame>kelvintaywl-cci/sample-django
from django.test import TestCase
class BArTestCase(TestCase):
def test_bar_1(self):
self.assertEqual("bar", "bar")
def test_bar_2(self):
self.assertEqual("bar" * 2, "barbar")
| StarcoderdataPython |
160229 | from resultstoresearch.resultstoresearchapi import (
resultstore_download_pb2_grpc as resultstoresearch_download_pb2_grpc,
resultstore_download_pb2 as resultstoresearch_download_pb2, invocation_pb2
as resultstoresearch_invocation_pb2, timestamp_pb2 as
resultstoresearch_timestamp_pb2, duration_pb2 as
... | StarcoderdataPython |
1728051 | <filename>python/labs/movie-review-database-update/starter-code/movie_reviewer.py
#!/usr/bin/python
#
# Copyright 2018 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
#
# http... | StarcoderdataPython |
1704618 | """
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.
You may assume ... | StarcoderdataPython |
3352919 | import lib.data
import lib.db
_TABLE = 'testtype'
_DBID = 'id'
_APIID = 'id'
_PUT_POST_FIELDS = [
{'db': 'val', 'api': 'val'}
]
def get(request):
cur = lib.db.sendtodb('''
select
t.id as id,
t.val as val
from %(table)s as t
''', {
'table': lib.db.AsIs(_TAB... | StarcoderdataPython |
3266251 | <reponame>jnbellinger/lta<gh_stars>1-10
#! /bin/env python
""" ... | StarcoderdataPython |
1685138 | # Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Driver for power_state for stumpy boards.
"""
import alex_power
class stumpyPower(alex_power.alexPower):
def _power_off(self):
# In test ima... | StarcoderdataPython |
3322599 | <filename>1D-CNN-byKeras.py
#training the NN
import shutil
import os
from pydub import AudioSegment
import numpy as np
from keras import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import adam
from keras.models import load_model
import time
from keras.models import model_from_... | StarcoderdataPython |
123502 | <reponame>1lo0/pexcel_openpyxl
#-*- coding:utf-8 -*-
# author:<EMAIL>
# software: PyCharm | StarcoderdataPython |
1671267 | import numpy as np
import threading
import gil_load
N_THREADS = 4
NPTS = 4096
gil_load.init()
def do_some_work():
for i in range(2):
x = np.random.randn(NPTS, NPTS)
x[:] = np.fft.fft2(x).real
gil_load.start()
threads = []
for i in range(N_THREADS):
thread = threading.Thread(target=do_some_w... | StarcoderdataPython |
3261708 | <reponame>shane-breeze/zinv-analysis<filename>zinv/modules/readers/ScribblerWrapper.py
import time
import logging
logger = logging.getLogger(__name__)
class ScribblerWrapper(object):
def __init__(self, scribbler):
logger.debug("{}.__init__".format(scribbler.name))
self.scribbler = scribbler
... | StarcoderdataPython |
110296 | ##################################################
## / ___/ _ \| _ \/ ___|| | | |_ _| \ | | ____|##
##| | | | | | |_) \___ \| |_| || || \| | _| ##
##| |__| |_| | _ < ___) | _ || || |\ | |___ ##
## \____\___/|_| \_\____/|_| |_|___|_| \_|_____|##
##################################################
#Usage: pytho... | StarcoderdataPython |
118687 | from my_code import year_100
def test_inc():
assert 2105 == year_100(15)
assert 2120 == year_100(0)
assert 2095 == year_100(25)
| StarcoderdataPython |
1717921 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[15]:
import pandas as pd
#s = pd.Series(Data, index = Index)
data1 =[1,4,8,6,5,6,10]
ans1 = pd.Series(Data1)
print(ans1)
data2 =['a', 'b', 'c', 'd', 'e', 'f', 'g']
ans2= pd.Series(data1, data2)
print(ans2)
# In[14]:
import pandas as pd
... | StarcoderdataPython |
1652308 | <reponame>limitedeternity/HeapLAB
#!/usr/bin/python3
from pwn import *
elf = context.binary = ELF("house_of_force")
libc = elf.libc
gs = '''
continue
'''
def start():
if args.GDB:
return gdb.debug(elf.path, gdbscript=gs)
else:
return process(elf.path)
# Select the "malloc" option, send size &... | StarcoderdataPython |
3345875 | from __future__ import annotations
import abc
import typing
from sims4 import localization
class SettingAbstract(abc.ABC):
IsSetting: bool
Key: str
Type: typing.Type
Default: typing.Any
Dialog: typing.Any
ListPath: str
ListPriority: typing.Union[float, int]
def __init_subclass__ (cls, **kwargs):
cls.On... | StarcoderdataPython |
161274 | '''
Семипроцентный барьер
'''
parties = []
votes = []
sum_votes = 0
with open('input.txt', 'r', encoding='utf8') as file:
flag = False
for line in file:
line_el = line.split()
line = line.replace('\n', '')
if (line_el[0][1:] == 'PARTIES:'):
continue
elif (line_el[0] =... | StarcoderdataPython |
118873 | <filename>chroma_core/models/filesystem.py
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from toolz.functoolz import pipe, partial, flip
from django.db import models
from django.db.models import CASCADE
from chroma_... | StarcoderdataPython |
1605615 | <filename>tests/unit/test_config.py<gh_stars>0
import pytest
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
from django_guid.config import Settings
def test_invalid_setting(monkeypatch):
monkeypatch.setattr(django_settings, 'DJANGO_GUID', {'invalid_set... | StarcoderdataPython |
1723945 | <filename>astr2600/sdss.py
'''
This module contains tools to download astronomical spectra from SDSS.
Functions:
getSDSS: Donwload, extract, and return a Sloan Digital Sky Survey (SDSS) spectrum from the web
getLabel: Returns a metadata label (string) corresponding to a given spectrum obtained from getSDSS
... | StarcoderdataPython |
3247572 | from pathlib import Path
import libtbx
import entrypoints
import pkgutil
class Environment:
"""
A replacement libtbx.env object that doesn't need configuration.
Designed to work via a mix of entry points and sane defaults for things
that shouldn't matter anyway.
"""
def under_base(self, pat... | StarcoderdataPython |
1736329 | # -*- coding: utf-8 -*-
__author__ = 'Jerry'
"""
SSDP Discovery
"""
import socket
SSDP_S = 'uuid:ijklmnop-7dec-11d0-a765-00a0c91e6bf6'
SSDP_ADDR = "172.16.17.32"
SSDP_PORT = 1900
SSDP_MX = 1
SSDP_ST = "CIG:CAP"
def ssdp_discovery():
'''
SSDP Discovery ,TO get IP address of Server
:return: IPaddress
'''
ssdpR... | StarcoderdataPython |
64516 | # -*- coding: utf-8 -*-
#
# 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 to in writing, software
... | StarcoderdataPython |
1607204 | from django.db import models
# Create your models here.
class Task(models.Model):
title = models.CharField(max_length = 200)
complete = models.BooleanField(default=False)
created = models.DateTimeField(auto_now_add=True) #creates date by default
def __str__(self):
return self.title | StarcoderdataPython |
161342 | """Meta Content presentation"""
amendment_header = [
"Amendment of Directive 85/611/EEC",
"Amendment of Directive 93/6/EEC",
"Amendment of Directive 2000/12/EC"
]
test_presentations = [
"Article 8 is replaced by the following:",
"In Article 7, paragraphs 1 and 2 are "
"replaced by the followin... | StarcoderdataPython |
3296349 | <gh_stars>0
from apiclient import discovery
from oauth2client import service_account
import httplib2
import os
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
KEY_FILE_LOCATION = 'private.json'
VIEW_ID = os.getenv("VIEW_ID")
# 设置代理
proxy_type = httplib2.socks.PROXY_TYPE_HTTP
proxy = httplib2.ProxyInfo... | StarcoderdataPython |
150449 | #!/usr/bin/env python3
# Copyright (c) 2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from decimal import (
Decimal,
)
from test_framework.util import (
Matcher,
assert_matches,
)
from test_... | StarcoderdataPython |
1741428 | # Simple path fixes
import os
import pickle
import sys
import PySimpleGUI as sg
# print("matplotlib sersion: {}".format(matplotlib.__version__))
cwd = os.getcwd()
sys.path.insert(0, cwd)
import driverScorer.driver_scoorer as drvr_scrr
LOGTARGET = "CSV"
# LOGTARGET = "CONSOLE"
driver_scorer = drvr_scrr.DrivingScorer... | StarcoderdataPython |
1734903 | n = int(input('Digite um número: '))
print('O dobro de {} vale {}{}{}'.format(n, '\033[7;46m', n * 2, '\033[m'))
print('O tripo de {} vale {}{}{}'.format(n, '\033[7;46m', n * 3, '\033[m'))
print('A raiz quadrada de {} é igual a {}{:.2f}{}'.format(n, '\033[7;46m', n ** (1/2), '\033[m')) | StarcoderdataPython |
3355568 | import config
import fabric.api as fab
from tool.log import warn
cfg = config.config()
fab.use_ssh_config = True
fab.env.host_string = cfg.get('deploy', 'prod.host')
def deploy(update_env=None):
code_dir = cfg.get('dev.code.dir')
with fab.cd(code_dir):
fab.run('git pull --ff-only origin master')
... | StarcoderdataPython |
3266373 | from pathlib import Path
import aiohttp_jinja2
import jinja2
from aiohttp_jinja2 import APP_KEY as JINJA2_APP_KEY
from sn_agent_web.settings import WebSettings
THIS_DIR = Path(__file__).parent
BASE_DIR = THIS_DIR.parent
settings = WebSettings()
@jinja2.contextfilter
def reverse_url(context, name, **parts):
"""... | StarcoderdataPython |
1718438 | """
Output backend abstraction and general implementation.
"""
from abc import ABC, abstractmethod
from typing import List, Dict
from .message import Message
from .utils import Serializable
class NoDeliveryCheck(Exception):
"""Backend has no delivery check exception.
Raised from output backends `send` metho... | StarcoderdataPython |
3377668 | # pylint: disable=redefined-outer-name
# pylint: disable=too-many-arguments
# pylint: disable=unused-argument
# pylint: disable=unused-variable
from copy import deepcopy
from pathlib import Path
from typing import (
Any,
AsyncIterable,
AsyncIterator,
Callable,
Dict,
List,
Optional,
Type... | StarcoderdataPython |
3288685 | <filename>src/location_datasources/yugabyte.py
# yugabyte
# Copyright (c) YugaByte, Inc.
# Apache 2.0 License https://github.com/yugabyte/yugabyte-db/blob/master/licenses/APACHE-LICENSE-2.0.txt
import csv
import requests as requests
import yaml
from util.utils import set_cwd
def preprocess():
url = "https://raw... | StarcoderdataPython |
3223739 | #!/usr/bin/env python2
from tempfile import TemporaryDirectory
import os
import sys
import subprocess
from pathlib import Path
import shutil
import unittest
from typing import List
TEST_ROOT = Path(__file__).resolve().parent
def run(cmd: List[str], **kwargs) -> subprocess.CompletedProcess:
print("$ " + " ".joi... | StarcoderdataPython |
153639 | <filename>data/JA/extract_phrases.py
from glob import glob
import multiprocessing as mp
import xml.etree.ElementTree as ET
def check_stopwords(title, stopwords):
for stop in stopwords:
if stop in title:
return True
return False
def check_separator(title):
for ch in ",;:() ":
if... | StarcoderdataPython |
105031 | <filename>moonleap/resource/prop.py
import typing as T
from dataclasses import dataclass
@dataclass(frozen=True)
class Prop:
get_value: T.Callable
set_value: T.Optional[T.Callable] = None
| StarcoderdataPython |
35992 | from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.
class Neighbor(models.Model) :
n_name = models.CharField(max_length=35)
n_location = models.CharField(max_length=35)
n_image = models.ImageField(upload_to='n_posts/')
n_title... | StarcoderdataPython |
191499 | <reponame>Manu-Fraile/Machine-Learning<gh_stars>0
# -*- coding: utf-8 -*-
import monkdata as m
import dtree as d
t = d.buildTree(m.monk1, m.attributes)
print(d.check(t, m.monk1test)) | StarcoderdataPython |
3231145 | <gh_stars>0
import pickle as pkl
import numpy as np
import argparse
import yaml
from utils import split_data
def evaluate_model(load_model_path, input_data_path, test_size, configuration):
X_train, X_test, y_train, y_test = split_data(input_data_path, test_size)
model = pkl.load(open(load_model_path, "rb" ))
fla... | StarcoderdataPython |
178552 | """Test file for float subgraph fusing"""
import random
from inspect import signature
import numpy
import pytest
from concrete.common.data_types.integers import Integer
from concrete.common.debugging.custom_assert import assert_not_reached
from concrete.common.optimization.topological import fuse_float_operations
fr... | StarcoderdataPython |
4807441 | <filename>theme_maker.py
import colorsys
def convert_color(color):
color = [round(comp * 255.0) for comp in color]
color = "".join([format(comp, "x") for comp in color])
color = color.zfill(6)
return f'"#{color}"'
theme = open("theme.yaml").read()
for color_name, color_hue in [
["Red", 0],
[... | StarcoderdataPython |
121709 | <reponame>VamsiKrishna1211/Hacker_rank_solutions
#!/usr/bin/env python
# coding: utf-8
# In[95]:
import math as m
def unique(socks_pile):
unique_pile=[]
for i in socks_pile:
if i not in unique_pile:
unique_pile.append(i)
else:
continue
return unique_pile
def sock... | StarcoderdataPython |
3365759 | # Generated by Django 2.0.1 on 2018-01-21 08:57
from django.db import migrations, models
import django_jalali.db.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bar',
fields=[
... | StarcoderdataPython |
1778645 | <filename>home/models.py
from django.db import models
from django.urls import reverse_lazy
from django.contrib.auth.models import User
from django.utils import timezone
# Create your models here.
class SchoolProfile(models.Model):
username = models.OneToOneField(User, on_delete=models.CASCADE)
contac... | StarcoderdataPython |
3306367 | <reponame>jonzxz/project-piscator
import re
import joblib
from sklearn.ensemble import RandomForestClassifier
# Cleans up a messed up HTML / tabbed raw content into space delimited content
def clean_up_raw_body(raw_text):
return ' '.join([line.strip() for line in raw_text.strip().splitlines() \
if line.strip(... | StarcoderdataPython |
140906 | <filename>topic_dynamics/parsing.py
"""
Parsing-related functionality.
"""
from collections import Counter
import datetime
from operator import itemgetter
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, List, NamedTuple, Tuple
from tqdm import tqdm
import tree_sitter
... | StarcoderdataPython |
1660550 | <gh_stars>1-10
import datetime
import json
import requests
from dateutil.relativedelta import relativedelta
if __name__ == '__main__':
API_KEY = 'FIXME'
INST_ID = 'FIXME'
USER_ID = 0
credentials = {
'api_key': API_KEY,
'inst_id': INST_ID
}
# Program analytics for the last mo... | StarcoderdataPython |
3384137 | <gh_stars>0
import random
import project
def get_next_seed(min=1,max=100000):
return random.randint(min, max)
def get_seed_args(min=1,max=100000):
return " -rtlarg ' +ntb_random_seed=%d ' " % get_next_seed(min, max)
FIXED_SEED_ARG = " -rtlarg ' +ntb_random_seed=0 '"
# ---------------------------------------... | StarcoderdataPython |
3227527 | from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | StarcoderdataPython |
3380309 | <reponame>pathtoknowhere/warden
import requests
import os
from flask import (Blueprint, flash, redirect, render_template, request,
url_for, current_app)
from flask_login import current_user, login_required, login_user
from werkzeug.security import generate_password_hash
from forms import Registratio... | StarcoderdataPython |
1680181 | """
Fast Marching Trees (FMT*)
@author: <NAME>
"""
import os
import sys
import math
import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
"/../../")
from Sampling_based_Planning.rrt_2D import ... | StarcoderdataPython |
196431 | # Time: O(m * k), where m is string length, n is dictionary size, k is word length
# Space: O(n)
# 30
# You are given a string, s, and a list of words, words,
# that are all of the same length. Find all starting indices of substring(s)
# in s that is a concatenation of each word in words exactly once and
# without an... | StarcoderdataPython |
3285256 | <reponame>felipe4334/Insomniac
# These constants can be set by the external UI-layer process, don't change them manually
is_ui_process = False
execution_id = ''
task_id = ''
db_name = 'insomniac.db'
def is_insomniac():
return execution_id == ''
| StarcoderdataPython |
1792291 | <reponame>ajeet1308/code_problems<gh_stars>10-100
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
i=0
for j in range(0, len(t)):
if i < len(s) and s[i] == t[j]:
i += 1
if i == len(s):
return True
else:
return False
... | StarcoderdataPython |
1782820 | <reponame>RahulRoyMattam/fever-baselines<filename>src/scripts/rte/mlp/fnc_riedel.py<gh_stars>10-100
from common.dataset.data_set import DataSet
from common.dataset.formatter import Formatter
from common.dataset.label_schema import LabelSchema
from common.dataset.reader import CSVReader
from common.features.feature_func... | StarcoderdataPython |
3299038 | input = """lhyrnfkp
bdxpggwq
owtzswtq
obxtfotk
hvdshmol
kpjqpftg
odyagvec
vqlbxrft
htwenegq
pcfoxgwm
bmnqzuiu
xidteswq
wiizqpqh
vnlueoku
hgzntafs
kfeswcad
lqskhvrj
uguljfpd
dfbmduuu
gajujozo
dckmgouu
hebcfxov
uwamfjjb
fjpuapzj
ygxbvkfm
erbfbfld
rsspowgs
zfxrshqw
gafegcak
lfcluytl
aqmvtdoc
dnjwbcit
jztgwbnc
tcwuxhjh
fpf... | StarcoderdataPython |
1709080 | import os
from setuptools import setup, find_packages
def read(fname):
try:
with open(os.path.join(os.path.dirname(__file__), fname)) as fh:
return fh.read()
except IOError:
return ''
requirements = read('REQUIREMENTS').splitlines()
tests_requirements = read('REQUIREMENTS-TESTS').... | StarcoderdataPython |
3244678 | <reponame>RaulMurillo/turisteo
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import re
import string
def del_sqrBrackets(text):
"""Removes the square brackets (and their content) from text.
:param str text: The text to be cleaned of [ ].
:return: Same text without square brackets.
"""
regex =... | StarcoderdataPython |
34220 | <filename>dqo/relational/tests/test_augmentation.py
from dqo.db.tests.datasets import employees_db_w_meta
from dqo.relational import SQLParser
from dqo.relational import parse_tree
test_db = employees_db_w_meta()
def test_condition_permutation():
sql = """
SELECT MIN(employees.salary)
FROM emp... | StarcoderdataPython |
179142 | <filename>beehyve/types.py
import re
from ast import literal_eval
from typing import Any, Dict, Tuple
import parse
@parse.with_pattern(r"\(([\"']?.+?[\"']?, ?)+?[\"']?.*?[\"']?\)")
def parse_tuple(string: str) -> Tuple[Any, ...]:
"""Parse a tuple from a given string.
:param string: the string representation... | StarcoderdataPython |
158692 | <filename>masci_tools/io/parsers/kkrimp_parser_functions.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tools for the impurity caluclation plugin and its workflows
"""
from __future__ import print_function, division
from __future__ import absolute_import
from builtins import object
from numpy import array, nda... | StarcoderdataPython |
160564 | ## Imports
import handybeam
import handybeam.opencl_wrappers.abstract_wrapper
import handybeam.propagator_mixins
import handybeam.propagator_mixins.clist_propagator
import handybeam.propagator_mixins.rect_propagator
import handybeam.propagator_mixins.hex_propagator
import handybeam.propagator_mixins.lamb_propagator
im... | StarcoderdataPython |
3364027 | <reponame>Severson-Group/MachEval
from .make_solid_base import MakeSolidBase
from ...tools.token_make import TokenMake
from ..dimensions.dim_angular import DimAngular
from ..location_2d import Location2D
__all__ = ["MakeRevolve"]
class MakeRevolve(MakeSolidBase):
"""Class defining how cross-sections are revolved... | StarcoderdataPython |
195205 | <reponame>Lionheart1810/pycopy-lib
# This file is part of the standard library of Pycopy project, minimalist
# and resource-efficient Python implementation.
#
# https://github.com/pfalcon/pycopy
# https://github.com/pfalcon/pycopy-lib
#
# The MIT License (MIT)
#
# Copyright (c) 2019-2020 <NAME>
# Bytecode prelude encod... | StarcoderdataPython |
3224760 | #!/usr/bin/env python
"""Command line interface for extending feed effective dates."""
import argparse
import csv
from datetime import datetime, timedelta
import logging
import os
import shutil
import sys
import zipfile
DOWNLOAD_DIRECTORY = 'gtfs'
# extend feed effective date range this far into the past and future
EF... | StarcoderdataPython |
3228102 | import class4pgm
from class4pgm.base_model import BaseModel
from class4pgm.edge_model import EdgeModel
from class4pgm.node_model import NodeModel
from class4pgm.service.base_element import Node, Edge
class BaseService:
def __init__(self, graph=None, class_manager=None):
self.graph = graph
self._c... | StarcoderdataPython |
1757841 | #!/usr/bin/env python3
import json
from ..api.api_service import APIService
class AlumnosRepository:
SHEET_ALUMNOS = 'Listado'
SHEET_RANGE = 'A1:E58'
def __init__(self, calendarService: APIService, spreadsheet_id: str) -> None:
self.__spreadsheet_id = spreadsheet_id
self.__service = calen... | StarcoderdataPython |
1727979 | import json
import argparse
import sys
import configs.config as config
import os
import numpy as np
import random
from datetime import datetime
from utils.utils import *
def main():
parser = argparse.ArgumentParser(description="Generate synth dataset images for disentanglement.")
parser.add_argument("--frames"... | StarcoderdataPython |
4823228 | """Test the burndown chart"""
from pathlib import Path
import numpy as np
import pandas as pd
from burndown.burndown import get_ideal_burndown
from burndown.excel_io import read_sheet, save_sheet
from burndown.plots import plot_burndown
from burndown.sprint_dates import SprintDates
def create_test_data(
sprint... | StarcoderdataPython |
79196 | <filename>tests/unit/beacons/test_network_settings.py<gh_stars>1-10
# coding: utf-8
# Python libs
from __future__ import absolute_import
# Salt testing libs
from tests.support.unit import skipIf, TestCase
from tests.support.mock import NO_MOCK, NO_MOCK_REASON
from tests.support.mixins import LoaderModuleMockMixin
try... | StarcoderdataPython |
3272791 | <gh_stars>10-100
# Cut-sence for Sengoku Era Questline when first meeting Ayame | Master Room (811000007)
# Author: Tiger
AYAME = 9130106
sm.spawnNpc(AYAME, 620, 187)
sm.hideNpcByTemplateId(AYAME, True, True) # removes Ayame temporarily, this is needed because
# for some reason when the NPC first spawns, it glides to... | StarcoderdataPython |
3328716 | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import ValidationError, DataRequired, URL
from app.models import Data
class UrlShortenerForm(FlaskForm):
url = StringField('Url to Shorter', validators=[DataRequired(), URL()])
submit = SubmitField('Short') | StarcoderdataPython |
41639 | """
Copyright (c) 2020 <NAME> <EMAIL>
zlib License, see LICENSE file.
"""
import json
import pygame
from draw import draw_polygon
from export import generate_shape_groups, write_frames, generate_horizontal_line_sets, generate_shapes, \
generate_horizontal_line_groups, optimize_screen_buffer_colors
... | StarcoderdataPython |
3388361 | <reponame>xakiy/muria
import time
import uuid
import hashlib
import binascii
from os import urandom
from datetime import date
from muria.util import get_timestamp
from .mixin import EntityMixin
from pony.orm import (
PrimaryKey,
Required,
Optional,
Set,
Discriminator,
LongStr
)
def define_enti... | StarcoderdataPython |
187757 | <gh_stars>0
### HW4 cnn
import keras
import numpy
from keras.datasets import cifar10
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.layers import BatchNormalization
from keras.layers.convolutional import Convolution2D
from ... | StarcoderdataPython |
126635 | import folium
import random
import pandas
import json
BaseMap = folium.Map(location=[40.76,-111.89],zoom_start=6, tiles="MapBox Bright")
PointSource = pandas.read_csv("Volcanoes_USA.txt")
LAT = list(PointSource["LAT"])
LON = list(PointSource["LON"])
VOLC_Names = list(PointSource["NAME"])
ELEV = list(PointSource["ELEV... | StarcoderdataPython |
1727729 | <filename>bin/transfers_all_chains.py
import os
import json
import logging
import pandas as pd
from substrateinterface.utils import ss58
import subscrape
from subscrape.db.subscrape_db import SubscrapeDB
def scrape(addresses, chains):
logging.info("scraping...")
for chain in chains:
config = {
... | StarcoderdataPython |
1621836 | from ....tools.decorators import method
from ....tools.normalize import log_cpm
from ....tools.normalize import log_scran_pooling
from ....tools.utils import check_version
from .utils import pca_op
import numpy as np
import scipy.sparse
import sklearn.neural_network
import sklearn.pipeline
import sklearn.preprocessi... | StarcoderdataPython |
3363967 | <filename>best/day09.py
from day01 import identify_sum_pair
from utils import minmax, timed
def parse(file):
with open(file) as f:
return [int(l.strip()) for l in f]
@timed(9, 1)
def part_1(nums):
"""
We can reuse the hashset-based sum pair finder from Day 1 as a subroutine here. With a little
... | StarcoderdataPython |
3381587 | ano = int(input("Digite o ano: "))
if ano%100 == 0 and ano%400 == 0:
print('Bissexto!!')
else :
if ano%4 == 0:
print('Bissexto!!')
else:
print('Não é Bissexto!')
| StarcoderdataPython |
1716252 | from typing import List, Tuple
import tensorflow as tf
from .speechset import SpeechSet
from ..config import Config
from ..datasets.tfrecord import TFRecordReader
class TFRecordDataset(SpeechSet):
"""Dataset for preprocessed tf-record.
"""
def __init__(self, config: Config, path: str, target: str):
... | StarcoderdataPython |
3376486 | #!/usr/bin/env python3
import os
import sys
import time
sys.path.append(os.getcwd()+'/CPDP')
sys.path.append(os.getcwd()+'/JinEnv')
sys.path.append(os.getcwd()+'/lib')
import CPDP
import JinEnv
from casadi import *
from scipy.integrate import solve_ivp
import scipy.io as sio
# ---------------------------------------l... | StarcoderdataPython |
78807 | import os
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, "day_07.data")
with open(filename) as f:
print('reading file...')
lines = map(lambda x: (x.strip()), f.readlines())
bag_rules = list(map(lambda x: (tuple(x.split('contain'))), lines))
def contains(bag):
containing_... | StarcoderdataPython |
104470 | import torch
import numpy
from deep_signature.nn.datasets import DeepSignatureEuclideanArclengthTupletsOnlineDataset
from deep_signature.nn.datasets import DeepSignatureEquiaffineArclengthTupletsOnlineDataset
from deep_signature.nn.datasets import DeepSignatureAffineArclengthTupletsOnlineDataset
from deep_signature.nn.... | StarcoderdataPython |
1756067 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QProgressBar, QPlainTextEdit, QMainWindow, QTextBrowser, \
QDialog, QMenu, QAction, QMessageBox, QStatusBar, QSlider, QLabel, QCheckBox, QDialogButtonBox
from PyQt5.QtGui import QIcon, QFont
from PyQt5 import uic, QtGui
import sys
from time import slee... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.