id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1605555 | # Copyright 2021 <NAME>
#
# 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,... | StarcoderdataPython |
7248 | <reponame>kykrueger/redash
import calendar
import datetime
from unittest import TestCase
import pytz
from dateutil.parser import parse as date_parse
from tests import BaseTestCase
from redash import models, redis_connection
from redash.models import db, types
from redash.utils import gen_query_hash, utcnow
class Da... | StarcoderdataPython |
1657012 | import numpy as np
import pandas as pd
from climate.s3_bucket_operations.s3_operations import S3_Operation
from sklearn.impute import KNNImputer
from sklearn.preprocessing import StandardScaler
from utils.logger import App_Logger
from utils.read_params import read_params
class Preprocessor:
"""
Written By : ... | StarcoderdataPython |
3393578 | import os
from typing import List
import numpy as np
import torch
import pytest
from persia.helper import ensure_persia_service
from persia.ctx import BaseCtx, DataCtx
from .utils import random_port
EMBEDDING_CONFIG = {"slots_config": {"age": {"dim": 8}}}
RAW_EMBEDDING_CONFIG = {
"slots_config": {
"use... | StarcoderdataPython |
1778167 | <reponame>maroozm/AliPhysics
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. ... | StarcoderdataPython |
52047 | <reponame>cloudmesh/cloudmesh-flow
from cloudmesh.compute.aws import Provider as AWSProvider
from cloudmesh.compute.azure import AzProvider
from cloudmesh.flow.Flow import Flow
class MyFlow(Flow):
def spawn_aws(self):
pass
def spawn_azure(self):
pass
def ping_aws(self):
pass
... | StarcoderdataPython |
3293490 | <gh_stars>0
from skimage import io, data
import numpy as np
from matplotlib import pyplot as plt
im = data.camera()
im = im.astype('float')
lin, col = im.shape
#im2 = im.copy()
im2 = np.zeros((lin,col))
filtro = np.array([[1/9, 1/9, 1/9],
[1/9, 1/9, 1/9],
[1/9, 1/9, 1/9]])
fil... | StarcoderdataPython |
189555 | <reponame>gjbadros/elkm1<gh_stars>10-100
"""Definition of an ElkM1 Custom Value"""
from .const import Max, TextDescriptions
from .elements import Element, Elements
from .message import cp_encode, cw_encode
class Setting(Element):
"""Class representing an Custom Value"""
def __init__(self, index, elk):
... | StarcoderdataPython |
1634648 | # Selection Sort
from random import shuffle, randint
import matplotlib.pyplot as plt
import matplotlib.animation as ani
raw = [randint(0, 100) for i in range(101)]
shuffle(raw)
x = [i for i in range(101)]
tempmax = len(raw)
fig, ax=plt.subplots()
ax.set_xlim(-1, 101)
def bubble_sort_step():
global tempmax, raw,... | StarcoderdataPython |
136101 | #!/usr/bin/env python
# coding=utf-8
"""Message Handler.
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
Plays the server role in communication_node
Relations
----------
subscribes from /message_server topic,
publishes on corresponding nodes /ns/message_status topic
"""
import os
... | StarcoderdataPython |
3246197 | # Generated by Django 2.0.3 on 2020-06-01 16:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ApiManager', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SshInfo',
fields=[
('id... | StarcoderdataPython |
3252129 | # Mail Service
from threading import Thread
from flask_mail import Message
from run import flask_app, mail
def send_async_email(app, msg):
with app.app_context():
try:
mail.send(msg)
print('Mail sent')
except ConnectionRefusedError:
return 'MAIL SERVER] not wor... | StarcoderdataPython |
3281176 | <gh_stars>0
while True:
try:
print('\nPlease input number only')
price = input('The price of the product: ')
while True:
a = input('If this product include multiple packages, please input a to provide more information, '
'else press enter to continue. ')
... | StarcoderdataPython |
4822435 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Functions to call when running the module.
"""
import numpy as np
import os
import pandas as pd
from delphi_utils import read_params
from .qualtrics import make_fetchers,get
def run_module():
params = read_params()
qparams = params['qualtrics']
qparams['qualtrics_dir... | StarcoderdataPython |
27238 | <reponame>PingHuskar/hackerrank<filename>algorithms/warmup/compare-the-triplets.py
# Algorithms > Warmup > Compare the Triplets
# Compare the elements in two triplets.
#
# https://www.hackerrank.com/challenges/compare-the-triplets/problem
#
a = map(int, input().split())
b = map(int, input().split())
alice, b... | StarcoderdataPython |
3365309 | from django.core.exceptions import ValidationError
from django.forms import inlineformset_factory
from django.utils import translation
from parler.forms import TranslatableModelForm
from .utils import AppTestCase
from .testapp.models import (SimpleModel, UniqueTogetherModel, ForeignKeyTranslationModel, RegularModel,
... | StarcoderdataPython |
3308910 | #
# @lc app=leetcode id=489 lang=python
#
# [489] Robot Room Cleaner
#
# https://leetcode.com/problems/robot-room-cleaner/description/
#
# algorithms
# Hard (68.53%)
# Likes: 899
# Dislikes: 53
# Total Accepted: 45.5K
# Total Submissions: 66.4K
# Testcase Example: '[[1,1,1,1,1,0,1,1],[1,1,1,1,1,0,1,1],[1,0,1,1,1... | StarcoderdataPython |
1726517 | import logging
logging.basicConfig(filename=r'travel.log', filemode='w', level=logging.INFO, format='%(message)s')
def get_log(msg):
logging.info(msg)
| StarcoderdataPython |
3322698 | <gh_stars>1-10
"""
Num
8-bit : TinyInt UnsignedTinyInt
16-bit: SmallInt UnsignedSmallInt
24-bit: MediumInt UnsignedMediumInt
32-bit: Int UnsignedInt
64-bit: BitInt UnsignedBitInt
FloatField: DOUBLE
DecimalField
EnumField
IntEnumField 0 <= value < 32768
Char... | StarcoderdataPython |
93501 | password = input()
alpha = False
upalpha = False
digit = False
for i in password:
if i.isspace():
print("NOPE")
break
if i.isdigit():
digit = True
if i.isalpha():
if i.isupper():
upalpha = True
if i.islower():
alpha = True
else:
if alpha an... | StarcoderdataPython |
3290697 | """Rules for generating code from Arcs schemas.
Rules are re-exported in build_defs.bzl -- use those instead.
"""
load("//devtools/build_cleaner/skylark:build_defs.bzl", "register_extension_info")
load(":kotlin.bzl", "arcs_kt_library", "arcs_kt_plan")
load(":manifest.bzl", "arcs_manifest")
load(":tools.oss.bzl", "arc... | StarcoderdataPython |
80057 | <filename>erigam/__init__.py
import logging
import os
import traceback
from flask import Flask, request, render_template
from erigam.lib.request_methods import (
connect_redis,
create_session,
set_cookie,
db_commit,
disconnect_redis,
disconnect_sql,
cache_breaker
)
from erigam.views impor... | StarcoderdataPython |
197010 | <reponame>hongyuanChrisLi/StartupInsights
import os
import logging
import sys
import __init__ as init
def get_env_variable(var_name):
"""
Get environment variable or return exception
"""
logging.config.fileConfig('logging.ini')
logger = logging.getLogger(__name__)
try:
return os.envir... | StarcoderdataPython |
1604453 | """
Solvers
-------
This part of the package provides wrappers around Assimulo solvers.
"""
from assimulo.problem import Explicit_Problem
import numpy as np
import sys
from means.simulation import SensitivityTerm
from means.simulation.trajectory import Trajectory, TrajectoryWithSensitivityData
import inspect
from mean... | StarcoderdataPython |
1686476 | <reponame>MaxRichter/fastapi-celery
from app.db import models
def test_get_users(client, test_superuser, superuser_token_headers):
response = client.get("/api/v1/users", headers=superuser_token_headers)
assert response.status_code == 200
assert response.json() == [
{
"id": test_superus... | StarcoderdataPython |
3234443 | from pathlib import Path
import pyspark.sql.functions as F
import pyspark.sql.types as T
from pyspark.sql import SparkSession
# covered by cleaner
spark = (
SparkSession.builder.appName("Process ChEMBL25 Assays")
.config("spark.sql.execution.arrow.enabled", "true")
.getOrCreate()
)
_data_root = Path("/lo... | StarcoderdataPython |
3239253 | from django.db import models
# Model Tasks 1-5
#####################################
class Teacher(models.Model):
firstname = models.CharField(max_length=100)
surname = models.CharField(max_length=100)
def __str__(self):
return self.firstname
class Student(models.Model):
firstn... | StarcoderdataPython |
3291379 | <reponame>githubhjx/Tfrecords<gh_stars>0
from skimage import io, transform
import glob
import os
import numpy as np
import tensorflow as tf
path = '../train.tfrecords'
def read_and_decode(filename):
filename_queue = tf.train.string_input_producer([filename])
reader = tf.TFRecordReader()
_, serialized_ex... | StarcoderdataPython |
3262961 | <reponame>NeonDaniel/combo-lock
from memory_tempfile import MemoryTempfile
import os
def get_ram_directory(folder):
tempfile = MemoryTempfile(fallback=True)
path = os.path.join(tempfile.gettempdir(), folder)
if not os.path.exists(path):
os.makedirs(path)
return path
| StarcoderdataPython |
82227 | from typing import Dict, Optional
from pyspark.sql import Column, DataFrame
from pyspark.sql.functions import when
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
from spark_auto_mapper.data_types.data_type_base import AutoMapperDataTypeBase
from spark_auto_mapper.data_types.expr... | StarcoderdataPython |
5196 | <filename>pyopenproject/business/services/command/configuration/find.py<gh_stars>1-10
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from... | StarcoderdataPython |
3370485 | # -*- coding: <utf-8> -*-
"""
Module that implements a client and server interface useful for controlling a
vim server.
This module could be used for unit testing or integration testing
for a Vim plugin written in Python. Or you can use it to interactively control
a Vim editor by Python code, for example, in an Ipytho... | StarcoderdataPython |
1722464 | from __future__ import absolute_import
from changes.api.base import APIView
from changes.config import db
from changes.constants import Result
from changes.models.build import Build
from changes.models.job import Job
from changes.models.test import TestCase
from changes.models.source import Source
# This constant mu... | StarcoderdataPython |
1792028 | #!/usr/bin/env python3
"""
Extracts images from the data stored with generate_data.py or optimal_trajectory_gen.py. Applies several transformation
to all images, if wished.
"""
import pathlib
import random
import argparse
import json
import shutil
from typing import List, Callable
import yaml
import numpy as np
impo... | StarcoderdataPython |
1708865 | import copy
import dateutil
from bson import ObjectId
from aquascope.tests.aquascope.webserver.data_access.db.dummy_uploads import DUMMY_UPLOADS
from aquascope.webserver.data_access.db import Item
from aquascope.webserver.data_access.db.items import DEFAULT_ITEM_PROJECTION, ANNOTABLE_FIELDS
from aquascope.webserver.d... | StarcoderdataPython |
3282752 | """
plot data from isingWorm2d.py
"""
from __future__ import division, print_function
import cPickle as pickle # for reading/writing data to text files.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
from matplotlib import rcParams # for turning off legend frame
from scipy impo... | StarcoderdataPython |
1666501 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Contact : <EMAIL>
# @Time : 10/9/2020 5:34 PM
# @File : CirculantMatrixTracker.py
# @Software: PyCharm
from __future__ import print_function
import os
import os.path
import sys
import glob
import time
from optpars... | StarcoderdataPython |
30221 | <reponame>mengelhard/cft
import numpy as np
import pandas as pd
import tensorflow as tf
import itertools
import datetime
import os
from sklearn.metrics import roc_auc_score
from model import mlp, lognormal_nlogpdf, lognormal_nlogsurvival
from model_reddit import load_batch
from train_reddit import get_files
from trai... | StarcoderdataPython |
197729 | from app import db
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
token = db.Column(db.String(80), index=True, unique=True)
username = db.Column(db.String(64), index=True, unique=Tru... | StarcoderdataPython |
57843 | <reponame>zxdavb/evohome-radio<filename>evohome/logger.py<gh_stars>0
"""Evohome serial."""
import logging
from .const import LOGGING_FILE
# CON_FORMAT = "%(message).164s" # Virtual
CON_FORMAT = "%(message).220s" # Laptop
# CON_FORMAT = "%(message).292s" # Monitor
LOG_FORMAT = "%(asctime)s.%(msecs)03d %(levelname)... | StarcoderdataPython |
1713316 | <reponame>glstr/python_learning
#!/usr/bin/python
# coding=utf-8
def keyvaidir():
d = {"hello": 1}
for key, value in d.items():
print key, 'corresponds to', value
for key in d:
print key, 'corresponds to', d[key]
| StarcoderdataPython |
175377 | <filename>tests/core/test_utils.py
import asyncio
from unittest import mock
import pytest
from tests.utils import async
from waterbutler.core import utils
class TestAsyncRetry:
@async
def test_returns_success(self):
mock_func = mock.Mock(return_value='Foo')
retryable = utils.async_retry(5,... | StarcoderdataPython |
4838944 | <gh_stars>0
# -*-coding:utf8-*-
""" SendPulse REST API usage example
Documentation:
https://login.sendpulse.com/manual/rest-api/
https://sendpulse.com/api
"""
from pysendpulse.pysendpulse import PySendPulse
if __name__ == "__main__":
REST_API_ID = ''
REST_API_SECRET = ''
TOKEN_STORAGE = 'memcach... | StarcoderdataPython |
3302062 | from .base import Job
| StarcoderdataPython |
3212577 | <reponame>8by8-org/usvotes<gh_stars>1-10
from app.services.steps import Step
from flask import g
# this is a placeholder. No action required, just routing to change-or-apply
class Step_1(Step):
form_requirements = []
step_requirements = []
endpoint = '/change-or-apply'
prev_step = 'Step_0'
next_ste... | StarcoderdataPython |
161785 | # michaelpeterswa
# kulo.py
import csv
import geojson
import datetime
import numpy as np
from shapely.geometry import shape, MultiPolygon, Polygon, Point
from keras.models import Sequential
from keras.layers import Dense
from keras.callbacks import TensorBoard
input_file = "..\data\Washington_Large_Fires_1973-2019.g... | StarcoderdataPython |
3238297 | <gh_stars>0
from django.db import models
class Aluno(models.Model):
def save(self):
if (self.email == ''):
self.email = 'email nao fornecido'
if (self.login == ''):
raise Exception("Esta faltando o login")
if (len(Aluno.objects.filter(login=self.l... | StarcoderdataPython |
34181 |
import re
import time
import requests
from telethon import events
from userbot import CMD_HELP
from userbot.utils import register
import asyncio
import random
EMOJIS = [
"😂",
"😂",
"👌",
"💞",
"👍",
"👌",
"💯",
"🎶",
"👀",
"😂",
"👓",
"👏",
"👐",
"🍕",
"💥... | StarcoderdataPython |
4811935 | <filename>src/TestScale.py
#!/usr/bin/python3
import threading
import time
import random
class Scale(threading.Thread):
def __init__(self, comPort, container, index) :
threading.Thread.__init__(self, daemon=True)
self._stop = threading.Event()
self.container = container
self.inde... | StarcoderdataPython |
3333989 | # -*- coding: utf-8 -*-
# Author: sunzheng
# Time: 2018/12/26
from selenium.webdriver.common.by import By
class Retail_Sys:
login_username=(By.XPATH,'//input[@id="username"]')
login_pwd=(By.XPATH,'//input[@id="password"]')
login_submit=(By.XPATH,'//button[@id="submit_btn"]')
#登录账号
login_account=(B... | StarcoderdataPython |
57018 | <gh_stars>10-100
"""
Problem:
You are given an array X of floating-point numbers x1, x2, ... xn. These can be rounded
up or down to create a corresponding array Y of integers y1, y2, ... yn.
Write an algorithm that finds an appropriate Y array with the following properties:
The rounded sums of both arrays should be ... | StarcoderdataPython |
4823874 | <filename>ledger/address/__init__.py
default_app_config = 'ledger.address.config.AddressConfig'
| StarcoderdataPython |
3262883 |
# TODO: implement standard library here
def rgb_to_yiq(r, g, b):
y = 0.30*r + 0.59*g + 0.11*b
i = 0.74*(r-y) - 0.27*(b-y)
q = 0.48*(r-y) + 0.41*(b-y)
return (y, i, q)
| StarcoderdataPython |
30958 | <gh_stars>0
import json
import typing
from collections.abc import Collection
from decimal import Decimal
from functools import reduce
class QueryPredicate:
AND = "AND"
OR = "OR"
_operators = {
"exact": "=",
"gte": ">=",
"lte": "=<",
"lt": "<",
"gt": ">",
"i... | StarcoderdataPython |
163838 | from django.http import HttpResponseRedirect, HttpResponse
#, HttpResponseBadRequest, HttpResponseNotFound, HttpResponseServerError
from django.shortcuts import render
from datetime import datetime
import simplejson
import sys
import threading
import time
import traceback
from src.helper import *
from src.helper_form... | StarcoderdataPython |
1691079 | <filename>tests/unit/test_config.py
import json
from ward import test, raises
import pydantic
from hautomate.settings import HautoConfig
from tests.fixtures import cfg_data_hauto
@test('HAutoConfig validates input', tags=['unit'])
def _(opts=cfg_data_hauto):
model = HautoConfig(**opts)
# remove because co... | StarcoderdataPython |
68395 | <filename>rheia/CASES/H2_MOBILITY/h2_mobility.py<gh_stars>1-10
"""
The :py:mod:`h2_mobility` module contains a class to read the required data and
a class to evaluate the power-to-mobility system.
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pvlib
class ReadData:
""... | StarcoderdataPython |
3266880 | import sqlite3
DATASET = [
("Tencho", "2018-12-03"),
("Bessho", "2018-12-03"),
("Emoto", "2020-12-03"),
("Gamo", "2020-12-03"),
("Funakoshi", "2020-12-03"),
("Funakoshi", "2020-12-03"),
("Doigaki", "2020-12-03"),
("Doigaki", "2020-20-03"),
("Chikura", "2020-12-03"),
("Akabane", ... | StarcoderdataPython |
1783256 | <reponame>cccaaannn/fizzbuzz_api
# Write a program that prints the numbers from 1 to 100.
# But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.
# For numbers which are multiples of both three and five print “FizzBuzz”.
class FizzBuzz:
def __init__(self):
... | StarcoderdataPython |
174747 | <reponame>DavidLutton/Coursework<filename>labtoolkit/Switch/HP3488A.py
from ..GenericInstrument import GenericInstrument
from ..IEEE488 import IEEE488
from ..SCPI import SCPI
import pandas as pd
class Switch:
def load_switchpath(self, switchpaths):
df = pd.read_excel(switchpaths, sheet_name='Data').drop... | StarcoderdataPython |
1713225 | """Module to hold the Invoice resource."""
from fintoc.mixins import ResourceMixin
class Invoice(ResourceMixin):
"""Represents a Fintoc Invoice."""
mappings = {
"issuer": "taxpayer",
"receiver": "taxpayer",
}
| StarcoderdataPython |
43139 | <reponame>vlegoff/tsunami
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | StarcoderdataPython |
3369302 | <reponame>svaswani/STEALTH
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-02-14 19:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tools', '0003_tool_model_pic'),
]
operations = [
... | StarcoderdataPython |
3340746 | <filename>option_2_dict.py
#!/usr/bin/env python
'''
This caching option uses a global dictionary to store results.
This is a better result than using global variables, since we now have "keys"
for each operation.
The downside is (possibly) we need to control key generation, and each function
needs to check t... | StarcoderdataPython |
134460 | from __future__ import unicode_literals
from utils import CanadianJurisdiction
from pupa.scrape import Organization
class Oshawa(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:3518013'
division_name = 'Oshawa'
name = 'Oshawa City Council'
url = 'ht... | StarcoderdataPython |
1745418 | from setuptools import setup
setup(
name='search',
version='0.0.1',
py_modules=['index'],
)
| StarcoderdataPython |
131607 | # -*- coding: utf-8 -*-
'''
Watch files and translate the changes into salt events
:depends: - pyinotify Python module >= 0.9.5
:Caution: Using generic mask options like open, access, ignored, and
closed_nowrite with reactors can easily cause the reactor
to loop on itself.
'''
# Import Py... | StarcoderdataPython |
1755371 | <reponame>ramezrawas/galaxy-1
from galaxy.util import bunch
import logging
log = logging.getLogger( __name__ )
def form( *args, **kwargs ):
return FormBuilder( *args, **kwargs )
class FormBuilder( object ):
"""
Simple class describing an HTML form
"""
def __init__( self, action="", title="", na... | StarcoderdataPython |
1667106 | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import sys
'''
A basic script to graph test score quantities and calculate statistical data.
'''
def retrieve():
# Gets test scores from text file passed as command line arg
try:
with open(sys.argv[1]) as data:
... | StarcoderdataPython |
88623 | # Generated by Django 3.1.8 on 2021-06-24 15:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('employees', '0011_auto_20210624_2313'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='dept_role'... | StarcoderdataPython |
67374 | """
Module for representing PredPatt and UDS graphs
This module represents PredPatt and UDS graphs using networkx. It
incorporates the dependency parse-based graphs from the syntax module
as subgraphs.
"""
| StarcoderdataPython |
89360 | # coding:utf-8
from django.contrib.auth.models import User
from .models import WeChatUser, PhoneUser, FeedBack, StarList, BookListComment
from rest_framework.serializers import (
SerializerMethodField,
ModelSerializer,
ValidationError,
DateTimeField,
CharField,
IntegerField,
)
f... | StarcoderdataPython |
3281823 | #!/usr/bin/env python3
# Copyright 2020 Stanford University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
4803701 | from matern import Matern52
from sum_kernel import SumKernel
from product_kernel import ProductKernel
from noise import Noise
from scale import Scale
from transform_kernel import TransformKernel
__all__ = ["Matern52", "SumKernel", "ProductKernel", "Noise", "Scale", "TransformKer... | StarcoderdataPython |
1792910 | <filename>modules/search.py<gh_stars>0
from whoosh import qparser
def searchParsed(q, index, modelScoring, limit):
with index.searcher(closereader=False, weighting=modelScoring) as s:
return s.search(q, limit=limit)
def search(query, index, weighting, limit, wildcard):
parser = qparser.QueryParser("... | StarcoderdataPython |
3311161 | import random
noun_list = list()
noun_list.append("Doubt")
noun_list.append("Homeland")
noun_list.append("Marsh")
noun_list.append("Tilt")
noun_list.append("Piss")
noun_list.append("Meaning")
noun_list.append("Omnivore")
noun_list.append("Cloth")
noun_list.append("Vignette")
noun_list.append("Nerve")... | StarcoderdataPython |
3329809 | import requests
BASE_URL = "https://internshala.com/"
| StarcoderdataPython |
178487 | <reponame>edimatt/CS2qif
import argparse
import csv
import json
import logging
import os
import re
from datetime import datetime
from io import open
import chardet
__all__ = ["QifConverter", "processCsv"]
class QifConverter:
def __init__(
self,
file_name_inp,
file_name_out,
cc=Fa... | StarcoderdataPython |
1707433 | <gh_stars>0
import pytest
from rpy2 import rinterface
from rpy2.rinterface import memorymanagement
rinterface.initr()
def test_rmemory_manager():
with memorymanagement.rmemory() as rmemory:
assert rmemory.count == 0
foo = rmemory.protect(rinterface.conversion._str_to_charsxp('foo'))
asser... | StarcoderdataPython |
1718345 | # Copyright 2000 - 2015 NeuStar, 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
#
# Unless required by applicable l... | StarcoderdataPython |
1611007 | <reponame>yk/jina
from typing import Dict, Any, Type
from ..base import VersionedYAMLParser
from ....flow.base import BaseFlow
from ....helper import expand_env_var
class LegacyParser(VersionedYAMLParser):
version = 'legacy' # the version number this parser designed for
def parse(self, cls: Type['BaseFlow'... | StarcoderdataPython |
1654234 | """
Script to export features and labels from database into csv file.
"""
import argparse
import os
import pandas as pd
from research_database.research_database_communication import ResearchDBConnection
def main():
parser = argparse.ArgumentParser(description='Merge feature and labels and output as csv.')
p... | StarcoderdataPython |
1704172 | <reponame>havron/horseradish
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
THREADS_PER_PAGE = 8
# General
# These will need to be set to `True` if you are developing locally
CORS = False
debug = False
# this is the secret key used by flask session management
SECRET_KEY = "<KEY>
# You should cons... | StarcoderdataPython |
62473 | import unicodedata
import unicodedata
chars = []
for c in range(1, 65536):
c = unichr(c)
name = unicodedata.name(c, '')
if name.startswith("FULLWIDTH") or name.startswith("HALFWIDTH"):
chars.append((name, c))
d = {}
for name, c in chars:
p = name.split()
if p[0] in ('HALFWID... | StarcoderdataPython |
165885 | <reponame>TheMagnat/IAR_Self-Improving-Reactive-Agents
import numpy as np
import glob
import os
import matplotlib.pyplot as plt
from scipy.signal import savgol_filter
def load(path):
allRuns = []
allNames = []
with os.scandir(path) as entries:
for entry in entries:
if entry.is_dir():
allNames.appen... | StarcoderdataPython |
4295 | <gh_stars>1-10
# coding: utf-8
# (C) Copyright IBM Corp. 2021.
#
# 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 appl... | StarcoderdataPython |
65744 | import os
import time
from parsons.etl.table import Table
from parsons.utilities.check_env import check
from slackclient import SlackClient
from slackclient.exceptions import SlackClientError
import requests
class Slack(object):
def __init__(self, api_key=None):
if api_key is None:
try:
... | StarcoderdataPython |
3343261 | <reponame>ncilfone/mabwiser<filename>tests/test_popularity.py
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from mabwiser.mab import LearningPolicy, NeighborhoodPolicy, _Popularity
from tests.test_base import BaseTest
class PopularityTest(BaseTest):
def test_2arm_equal_prob(self):
arm, ... | StarcoderdataPython |
3229256 | """ Advent of code 2017 day 15/1 """
from argparse import ArgumentParser
class Generator(object):
""" Value generators """
def __init__(self, factor, initial, name):
""" Constructor for the object """
self.factor = factor
self.prev_value = initial
self.name = name
def __nex... | StarcoderdataPython |
85743 | #
# schedule.py - Contains Hue 'schedule' definitions
#
import enum
import re
from . import common
class Schedule(common.Object):
"""
Represents a Hue schedule.
"""
@property
def name(self):
return self._data['name']
@property
def is_enabled(self):
return Status(self._dat... | StarcoderdataPython |
3263777 | def sort_words(words):
# step 1: get the word list
words_list = words.split(' ')
# step 2: sort the words alphabetically
words_lower = []
for i, j in enumerate(words_list):
words_lower.append(j.lower()+str(i))
words_lower.sort()
# step 3: join the words
new = ["".j... | StarcoderdataPython |
737 | numero1 = int(input("Digite o primeiro número: "))
numero2 = int(input("Digite o segundo número: "))
numero3 = int(input("Digite o terceiro número: "))
if (numero1 < numero2 and numero2 < numero3):
print("crescente")
else:
print("não está em ordem crescente") | StarcoderdataPython |
1601815 | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | StarcoderdataPython |
1652724 | ################################################################################
# Copyright 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
#
# 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 t... | StarcoderdataPython |
3227207 | import argparse
from datetime import datetime
from pathlib import Path
from tqdm import tqdm
import pandas as pd
# androzoo_latest_path = Path("latest.csv")
androzoo_latest_path = Path("/Users/kuznetsov/work/workspace/autogranted/latest.csv")
market = "play.google.com"
required_columns = ['sha256', 'dex_date', 'pkg_n... | StarcoderdataPython |
4837866 | <reponame>ruohoruotsi/pyro
from __future__ import absolute_import, division, print_function
import numbers
from abc import ABCMeta, abstractmethod
from collections import OrderedDict, defaultdict
import torch
from six import add_metaclass
import pyro.poutine as poutine
from pyro.distributions import Categorical, Emp... | StarcoderdataPython |
111332 | import json
import pulumi
import pulumi_aws as aws
from infrastructure.dynamodb.table import books_dynamodb_table
config = pulumi.Config()
lambda_name = config.get('lambda_name')
role = aws.iam.Role(
lambda_name,
name=lambda_name,
assume_role_policy=json.dumps({
"Version": "2012-10-17",
"... | StarcoderdataPython |
1612973 | <reponame>gbrault/resonance<filename>resonance/tests/test_nonlinear_systems.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import pytest
from pandas.util.testing import assert_frame_equal
from ..nonlinear_systems import (SingleDoFNonLinearSystem,
... | StarcoderdataPython |
1762876 | <reponame>tommbendall/peakondrake
from peakondrake import *
code = 'test_jump'
Ld = 40.
dt = 0.001
tmax = 0.01
experiment(code, Ld, tmax,
resolutions=[100, 500, 1000, 5000, 10000],
dts=dt,
sigmas=0.0,
seeds=0,
schemes='upwind',
timesteppings='midpoint'... | StarcoderdataPython |
4828176 | <gh_stars>10-100
#from ..functions._load_features import load_features, make_windows
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.