id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1757676
<gh_stars>0 import time import datetime from pyoddgen.generators.basegen import BaseGenerator from pyoddgen.config import ObjectDetectionConfiguration from pyoddgen.tools.distribution import Distribution from pyoddgen.datastructures.objectdetectionrecord import ObjectDetectionDataRecord class ObjectDetectionGenerato...
StarcoderdataPython
110366
# -*- coding: UTF-8 -*- # Copyright 2015 <NAME> # License: BSD (see file COPYING for details) from __future__ import unicode_literals __author__ = 'drx' def populate(p): p.city("Giza", "الجيزة", "") p.city("Al Haram", "الهرم", "") p.city("King Faisel", "الملك فيصل", "") p.city("Memphis", "ممفيس", "")...
StarcoderdataPython
1748528
<gh_stars>0 # # (C) Copyright 2013 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in # LICENSE.txt # from numpy import zeros # Enthought library imports. from traits.api import Any, Bool, Float, Instance, Property, Tuple # Local relative imp...
StarcoderdataPython
1667143
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 24 05:55:59 2021 @author: jeremiasendrinajr """ import streamlit as st #write a multi app object-oriented-program class MultiApp: def __init__(self): self.apps = [] #a function to create a page def add_...
StarcoderdataPython
99412
# -*- coding: utf-8 -*- """Provides ``get_redis_client``, a redis client factory that can be used directly, or in contect of a Pyramid application as a request method. """ __all__ = [ 'GetRedisClient', 'get_redis_client' ] import logging logger = logging.getLogger(__name__) from pyramid_redis import DEFAU...
StarcoderdataPython
3240180
<reponame>doubleblind148/IGCCF<filename>tests/datasets/implemented_datasets/test_lastfm.py #!/usr/bin/env python __author__ = "XXX" __email__ = "XXX" import pytest import pandas as pd def test_load(): from datasets.implemented_datasets.lastfm import LastFM dataset = LastFM() dataset.download() datas...
StarcoderdataPython
84623
from typing import Optional, MutableMapping, List, Union from datetime import datetime, timedelta from fastapi.security import OAuth2PasswordBearer from passlib.context import CryptContext from sqlalchemy.orm.session import Session from jose import jwt from app.models import User from app.config import settings JWTP...
StarcoderdataPython
1733069
#/usr/bin/env python3 def is_chinese(uchar): """判断一个unicode是否是汉字""" if uchar >= '\u4e00' and uchar <= '\u9fa5': return True else: return False def is_number(uchar): """判断一个unicode是否是数字""" if uchar >= '\u0030' and uchar <= '\u0039': return True else: ...
StarcoderdataPython
98073
<gh_stars>0 # Importing Libraries from requests import get print('[Scripts.zAllSBStats] - Imported requests.get') from pathlib import Path print('[Scripts.zAllSBStats] - Imported pathlib.Path') import os print('[Scripts.zAllSBStats] - Imported os') from dotenv import load_dotenv print('[Scripts.zAllSBStats] - Import...
StarcoderdataPython
3285278
# coding=utf-8 # Copyright 2022 DataLab Authors and the current dataset script contributor. # # 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
24643
#!/usr/bin/python3 import os import click import sys import csv import time import pandas as pd import country_converter as coco import hashlib import phonenumbers from tqdm import tqdm from uszipcode import SearchEngine HEADER_TRANSLATIONS = { "email1": "Email", "phone1": "Phone", "person_country": "Count...
StarcoderdataPython
21755
import rpyc from Crypto.Signature import pkcs1_15 from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA ############# ## KLIJENT ## ############# def generiraj_kljuceve(): key = RSA.generate(2048) #stvaranje i spremanje privatnog ključa u datoteku file_out = open("private_key.pem", "wb") fil...
StarcoderdataPython
117252
''' MIT License Optimal Testing and Containment Strategies for Universities in Mexico amid COVID-19 Copyright © 2021 Test and Contain. <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,and <NAME>. https://www.testandcontain.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of thi...
StarcoderdataPython
1620797
import os import json from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from pydatamail_google.base import GoogleDriveBase, GoogleMailBase class Drive(GoogleDriveBase):...
StarcoderdataPython
1706467
from typing import Optional from uuid import UUID import aiohttp import sqlalchemy.sql as sa from sqlalchemy.engine import RowMapping from vocabulary.common import database, settings from vocabulary.common.log import logger from vocabulary.models import models async def _get_json(url: str): async with aiohttp.C...
StarcoderdataPython
3214211
<reponame>waleko/libreta import logging from telegram.ext import Updater import handlers.handlers class Bot: def __init__(self, token): self.updater = Updater(token) for handler in handlers.handlers: self.updater.dispatcher.add_handler(handler) logging.info(f"Registered a tot...
StarcoderdataPython
1603059
from __future__ import annotations import logging from abc import ABCMeta from dataclasses import dataclass from typing import Any, Iterable from pants.core.goals.publish import ( NoApplicableTargetsBehavior, TargetRootsToFieldSets, TargetRootsToFieldSetsRequest, ) from pants.engine.console import Console...
StarcoderdataPython
1665199
class Solution: def numSimilarGroups(self, A: List[str]) -> int:
StarcoderdataPython
122115
import copy from typing import Callable, Tuple import numpy as np from odyssey.distribution import Distribution from iliad.integrators.fields import softabs from iliad.integrators.info import CoupledInfo from iliad.integrators.terminal import cond from iliad.integrators.states.coupled_state import CoupledState from ...
StarcoderdataPython
127898
#!python import os import psycopg2 class Database(): """ Handles interaction with the Postgres database """ def __init__(self): self.port = 5432 self.host = 'localhost' self.database = 'postgis' self.user = 'postgis' self.password = 'password' s...
StarcoderdataPython
109529
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 20 16:23:57 2019 @author: hitansh """ import numpy as np import os import sys # import tarfile import tensorflow as tf # import zipfile # from distutils.version import StrictVersion # from collections import defaultdict # from io import StringIO # f...
StarcoderdataPython
4803488
# ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the reproman package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # NOTE: The sing...
StarcoderdataPython
194722
<reponame>zopefoundation/grokcore.view<filename>src/grokcore/view/tests/base/view/templatedirectory_with_path_sep_fixture.py """ This should fail because you can not use path separator in templatedir directive. """ import grokcore.view as grok import os.path grok.templatedir('templatedirectoryname' + os.path.sep + 'su...
StarcoderdataPython
1702798
<filename>aydin/nn/pytorch/lucyrichardson/lucyrichardson.py<gh_stars>10-100 import numpy import torch import torch.nn.functional as F def richardson_lucy_pytorch(image, psf, iterations=50, clip=True, donut=False): use_cuda = True device_index = 0 device = torch.device(f"cuda:{device_index}" if use_cuda el...
StarcoderdataPython
3252352
<reponame>DOAJ/doaj from copy import deepcopy from portality.lib import swagger from portality.lib.seamless import SeamlessMixin from portality.models.v2.shared_structs import JOURNAL_BIBJSON _SHARED_STRUCT = JOURNAL_BIBJSON class OutgoingCommonJournalApplication(SeamlessMixin, swagger.SwaggerSupport): """ ~...
StarcoderdataPython
152551
<gh_stars>0 import re import os import sys import pprint import itertools from os.path import splitext from collections import Counter, defaultdict, namedtuple from multiprocessing import Pool, Process, JoinableQueue from code_clippy_dataset.utils import infer_source_from_data_dir, load_dataset_infer import tqdm impo...
StarcoderdataPython
1696279
<gh_stars>0 #!/usr/bin/env python # coding=utf8 from copy import deepcopy """ Important: Class was copy-pasted in cause of using it in study. Normal use case suppose to import that class """ class Stack: def __init__(self): self.stack = [] def size(self): return len(self.stack) def po...
StarcoderdataPython
1761372
# coding: utf-8 import numpy from plyfile import PlyData, PlyElement def ply_autocut(inputfile, outputfile, percent): plydata = PlyData.read(inputfile) print (plydata['vertex'].dtype) x = plydata['vertex']['x'].copy() y = plydata['vertex']['y'].copy() z = plydata['vertex']['z'].copy() nx = plydata['verte...
StarcoderdataPython
47638
import olll import numpy as np test1 = [[1,0,0,1,1,0,1],[0,1,0,5,0,0,0],[0,0,1,0,5,0,5]] test2 = [[1,0,0,2,-1,1],[0,1,0,3,-4,-2],[0,0,1,5,-10,-8]] test3 = [[1,0,0,1,1,0,1], [0,1,0,4,-1,0,-1], [0,0,1,1,1,0,1]] test4 = [[1,0,0,2,5,3],[0,1,0,1,1,1,],[0,0,1,4,-2,0]] test5 = [[1,0,0,0,0,0,2,1,1,2],[0,1,0,0,0,0,1,1,-1,-1],[...
StarcoderdataPython
3247888
import os import numpy as np import collections import megengine.module as M import megengine.functional as F import megengine as mge from megengine.data.dataset import Dataset from megengine.data import DataLoader import hparams as hp from megengine.data import Collator class AsrDataset(Dataset): def __init__(se...
StarcoderdataPython
1665294
<filename>pypy/lang/smalltalk/test/test_shadow.py import random from pypy.lang.smalltalk import model, shadow, constants from pypy.lang.smalltalk import objspace space = objspace.ObjSpace() w_Object = space.classtable['w_Object'] w_Metaclass = space.classtable['w_Metaclass'] w_MethodDict = space.classtable['w_Method...
StarcoderdataPython
4828004
import pandas as pd import numpy as np import time from scipy.sparse import csr_matrix # TODO: make channel column optional def edgelist_to_adjs(edgelist, nodelist=None): edgecounts = edgelist.groupby(by=edgelist.columns.tolist(), as_index=False).size().reset_index(name="count") ...
StarcoderdataPython
1773968
<reponame>ecosystemai/ecosystem-notebooks<gh_stars>1-10 import dash # import dash_table # import dash_core_components as dcc # import dash_html_components as html from dash import dcc from dash import html from dash import dash_table from dash.dependencies import State import plotly.graph_objects as go from datetime im...
StarcoderdataPython
167237
<gh_stars>10-100 #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn from hrl4in.utils.distributions import DiagGaussianNet, Categorical...
StarcoderdataPython
3225866
<gh_stars>0 from django import template from git import Repo from os import environ, getcwd register = template.Library() @register.simple_tag def dfirtrack_version(): versionnumber = 'v0.4.6' return versionnumber """ following conditions are necessary for Pull Requests GitHub actions do some kind of `git c...
StarcoderdataPython
4816954
<reponame>mitama-org/mitama-py import unittest from mitama._extra import _classproperty class TestClassProperty(unittest.TestCase): def test_getter(self): class ClassA: @_classproperty def value(cls): return "hello, world!" self.assertEqual(ClassA.value, "...
StarcoderdataPython
3223927
#!/usr/bin/env python # example gtkvscrollbar.py import pygtk pygtk.require('2.0') import gtk class VScrollbar: def delete_event(self, widget, event, data=None): gtk.main_quit() return False def value_changed(self, range, data=None): self.label.set_text("Value: " + str(self.vscrollba...
StarcoderdataPython
1726258
<reponame>J08nY/sec-certs<gh_stars>1-10 import copy import itertools import json import locale import shutil import tempfile from dataclasses import dataclass from datetime import datetime from pathlib import Path from typing import Callable, ClassVar, Dict, Iterator, List, Mapping, Optional, Set, Tuple, Union import ...
StarcoderdataPython
1635367
from decode_and_calculate import decode_and_calculate, MODEL from time import strftime, localtime import cv2 as cv from flask import Flask, render_template, request, Response, send_file, redirect, url_for import os # Silence TensorFlow log os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' app = Flask(__name__) class Camera(...
StarcoderdataPython
164013
<reponame>eternalflow/push-money<filename>minter/api.py import logging from time import sleep from mintersdk.minterapi import MinterAPI from requests import ReadTimeout, ConnectTimeout, HTTPError from helpers.misc import retry class MinterAPIException(Exception): def __init__(self, response): err = resp...
StarcoderdataPython
539
import numpy as np import pytest import theano import theano.tensor as tt # Don't import test classes otherwise they get tested as part of the file from tests import unittest_tools as utt from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name from tests.tensor.test_basic import ( TestAll...
StarcoderdataPython
98037
import cmd from asm_dicts import reg_dict commands = [ 'START', 'RESET', 'MODE', 'STEP', 'LOAD', 'REQ' ] mode_commands = [ 'GET', 'SET_CONT', 'SET_STEP' ] load_commands = [ 'INSTR', 'FILE' ] req_commands = [ 'MEM_DATA', 'MEM_INSTR', 'REG', 'REG_PC', 'LA...
StarcoderdataPython
129261
from django import template from django.utils.http import urlquote from endpoint_monitor.models import EndpointTest from linda_app.lists import CATEGORIES from linda_app.models import Vocabulary, VocabularyClass, VocabularyProperty, get_configuration, \ datasource_from_endpoint register = template.Library() # Loa...
StarcoderdataPython
158166
import requests from bs4 import BeautifulSoup import re from tqdm import tqdm import math import json from datetime import datetime # Taken from https://stackoverflow.com/questions/1345827/how-do-i-find-the-time-difference-between-two-datetime-objects-in-python def get_duration( then, now = datetime.now(), interval = ...
StarcoderdataPython
81356
<reponame>pdehaye/COVID19-Demography import numpy as np import csv ''' Code for sampling the household and age structure of a population of n agents. ''' def get_age_distribution(country): age_distribution=[] with open('World_Age_2019.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=','...
StarcoderdataPython
3355031
import sys, os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from math import sqrt from a_star.node import Node from game_map import GameMap, Cell class PathFinder: def __init__(self, width, height): self.mapWidth = width self.mapHeight = height self.nodes = ...
StarcoderdataPython
1616601
<filename>tests/test_plot.py import numpy as np import pandas as pd from scipy import stats import math import matplotlib.image as mpimg import matplotlib.pyplot as plt # import class to be tested # from heat.plot import ParaHeatPlot import heat.plot as ph # generate some realistic pandas random data and write tests ...
StarcoderdataPython
3215509
# 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 ...
StarcoderdataPython
1780093
# -*- coding: utf-8 -*- """The GUID Partition Table (GPT) directory implementation.""" from dfvfs.path import gpt_path_spec from dfvfs.vfs import directory class GPTDirectory(directory.Directory): """File system directory that uses pyvsgpt.""" def _EntriesGenerator(self): """Retrieves directory entries. ...
StarcoderdataPython
120632
from math import sin, pi from random import uniform X = [] for i in range(10000): s = uniform(0, 2*pi) X.append([sin(s), s]) X = [str(i) + ',' + str(j) + '\n' for i, j in X] fh = open('sinx.csv', 'w') fh.writelines(X) fh.close()
StarcoderdataPython
1799403
<filename>cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/HazardUtils.py<gh_stars>0 ## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains expo...
StarcoderdataPython
2574
"""For neatly implementing static typing in packaging. `mypy` - the static type analysis tool we use - uses the `typing` module, which provides core functionality fundamental to mypy's functioning. Generally, `typing` would be imported at runtime and used in that fashion - it acts as a no-op at runtime and does not h...
StarcoderdataPython
8040
<reponame>Awannaphasch2016/CDKFAUCovid19Cralwer ''' Original code contributor: mentzera Article link: https://aws.amazon.com/blogs/big-data/building-a-near-real-time-discovery-platform-with-aws/ ''' import boto3 import json import twitter_to_es # from Examples.Demo.AWS_Related.TwitterStreamWithAWS.LambdaWithS3Trigger ...
StarcoderdataPython
1718960
<filename>tests/importer/tflite_/basic/test_gather.py # Copyright 2019-2021 Canaan 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 # # ...
StarcoderdataPython
176175
<filename>tests/test_bitround.py import pytest import xarray as xr from dask import is_dask_collection from xarray.testing import assert_allclose, assert_equal import xbitinfo as xb @pytest.mark.parametrize("dtype", ["float16", "float32", "float64"]) @pytest.mark.parametrize("implementation", ["xarray", "julia"]) @p...
StarcoderdataPython
3365764
# Generated by Django 2.2.9 on 2020-04-10 21:24 from django.db import migrations, models import django.db.models.deletion import jsonfield.fields class Migration(migrations.Migration): initial = True dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ] operations = [ ...
StarcoderdataPython
1612112
<reponame>daxAKAhackerman/one-time-secret import os import pymongo def get_mongo_col(): if not os.getenv("TESTING"): MONGO_HOST = os.environ["MONGO_HOST"] MONGO_PORT = os.environ["MONGO_PORT"] MONGO_USERNAME = os.environ["MONGO_USERNAME"] MONGO_PASSWORD = os.environ["MONGO_PASSWOR...
StarcoderdataPython
1688955
# Name: Nathanael # Date: June 12 # proj01: A Simple Program # This program asks the user for his/her name and age. # Then, it prints a sentence that says when the user will turn 100. # If you complete extensions, describe your extensions here! user_input = raw_input("Enter your age: ") user_input2 = raw_input("Enter...
StarcoderdataPython
3364319
<reponame>scottwedge/OpenStack-Stein<filename>panko-6.0.0/panko/tests/functional/test_bin.py # Copyright 2012 eNovance <<EMAIL>> # # 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
1645561
<filename>frappe-bench/apps/erpnext/erpnext/healthcare/doctype/physician/test_physician.py # -*- coding: utf-8 -*- # Copyright (c) 2015, ESS LLP and Contributors # See license.txt from __future__ import unicode_literals import unittest import frappe test_dependencies = ['Physician Schedule'] class TestPhysician(unit...
StarcoderdataPython
1716220
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by <NAME> at 2019-06-14 """add_metacyc_rea_archive.py :description : script :param : :returns: :rtype: """ # note: not finissed import os import pickle import re import sys import cobra import pandas as pd import My_def # Disable def blockPrint(): sy...
StarcoderdataPython
1765538
<reponame>MaxTechniche/DayFolderOrganizer import os import re def organize(directory, keyword='(d|D)ay_?(\d+)', folder_name='Day_', regex=True): if not regex: folder_name=keyword keyword = re.escape(keyword) print(keyword) os.chdir(directory) folder_checks = [] for item in os...
StarcoderdataPython
3306779
<reponame>engr-lynx/cicd-demo from time import time from json import dumps, loads, JSONDecodeError from logging import getLogger, INFO from boto3 import client from botocore.exceptions import ClientError logger = getLogger() logger.setLevel(INFO) cf = client('cloudfront') cp = client('codepipeline') def on_event(eve...
StarcoderdataPython
78718
<reponame>shoaibahmed/pl-cnn<filename>src/utils/visualization/deprecated/plot_res.py try: import cPickle as pickle # Python2 except ModuleNotFoundError: import pickle # Python3 import matplotlib.pyplot as plt import seaborn as sns sns.set(style="white", palette="Set1") res = pickle.load(open("./experiments/l...
StarcoderdataPython
1689584
class Solution(object): # def reverseList(self, head): # """ # :type head: ListNode # :rtype: ListNode # """ # if not head: # return None # if not head.next: # return head # cur = head # ...
StarcoderdataPython
3355975
#!/usr/bin/env python3 import argparse import os, atexit import textwrap import signal import random import time from enum import Enum from collections import defaultdict, OrderedDict def check_positive(value): ivalue = int(value) if ivalue <= 0: raise argparse.ArgumentTypeError("{} is an invalid p...
StarcoderdataPython
1627705
import grpc import json import logging import os import sys import pickle import datetime from urllib import parse import d3m_automl_rpc.core_pb2 as pb_core import d3m_automl_rpc.core_pb2_grpc as pb_core_grpc import d3m_automl_rpc.value_pb2 as pb_value from d3m_automl_rpc.utils import encode_problem_description, encode...
StarcoderdataPython
147650
# Default locale mapping for the Facebook JS SDK # The list of supported locales is at # https://www.facebook.com/translations/FacebookLocales.xml import os from django.utils.translation import get_language, to_locale def _build_locale_table(filename_or_file): """ Parses the FacebookLocales.xml file and buil...
StarcoderdataPython
3329061
from typing import Dict, Tuple, List, Any import array import concurrent.futures import datetime import logging import numpy import pymongo import pytz import zlib from . import DataProvider from wx_explore.common import tracing from wx_explore.common.models import ( Projection, SourceField, DataPointSet,...
StarcoderdataPython
3361498
<reponame>nbk1982/pynctual<filename>pynctual/continous_detection.py import detection as sherlock import time while(1): sherlock.holmes() time.sleep(2)
StarcoderdataPython
3369799
<gh_stars>100-1000 from django.dispatch import Signal from pretalx.common.signals import EventPluginSignal nav_event = EventPluginSignal() """ This signal allows you to add additional views to the admin panel navigation. You will get the request as a keyword argument ``request``. Receivers are expected to return a li...
StarcoderdataPython
122
<reponame>ritchie46/flopy from __future__ import print_function import os import numpy as np import matplotlib.pyplot as plt import flopy fb = flopy.modflow.Modflow.load('freyberg', version='mf2005', model_ws=os.path.join('..', 'data', 'freyberg'), verbose=True) dis = fb.dis top = fb.dis.top fb.dis.top.plot(grid...
StarcoderdataPython
175074
# 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 # distributed under th...
StarcoderdataPython
3295409
<gh_stars>1-10 #!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Versi...
StarcoderdataPython
37348
<gh_stars>1-10 import numpy as np from time import time def bench_2_1(): trials = 100 elements = 1000000 times = [] for i in range(trials): start = time() M = np.random.randint(1,999, size=elements) t = time()-start times.append(t) print 'Python - Benchmark 2.1...
StarcoderdataPython
1686859
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 25 18:00:44 2019 @author: franchesoni """ import os import numpy as np from functions import evaluate '''Evaluate the performance of orders over the places in vectors and save the predictions, the orders, and the RMSDs''' orders = [(1, 0), ...
StarcoderdataPython
26820
<reponame>chris-lawton/libraries_wagtail from django.apps import AppConfig class ExhibitionsConfig(AppConfig): name = 'exhibitions'
StarcoderdataPython
109694
# Librerias en carpetas locales from .submodels.pos import PyPos
StarcoderdataPython
1761710
<gh_stars>0 # Copyright (C) 2018 SCARV project <<EMAIL>> # # Use of this source code is restricted per the MIT license, a copy of which # can be found at https://opensource.org/licenses/MIT (or should be included # as LICENSE.txt within the associated archive or repository). # Per # # https://www.python.org/dev/peps...
StarcoderdataPython
125578
<gh_stars>100-1000 import os, sys import numpy as np from scipy.io.wavfile import write folder = sys.argv[1] for file in os.listdir(folder): if file.endswith(".npy"): print(file, file.split(".")[0]) a = np.load(folder+file) write(folder+file.split(".")[0]+".wav", 22050, a)
StarcoderdataPython
3536
<reponame>wbprice/ojimoji import numpy h = .25 s = 1 bitmap = numpy.array([ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0], [0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0], [0,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0], [0,0,...
StarcoderdataPython
40350
# Let's make an database # # this is like the worst code ever # # just to make an test DB for burn the subs import time from datetime import datetime from bts.dataBaseClass import Sub def main(): fileName = open("subscriberListTest.txt") print("making:") for entry in fileName: en...
StarcoderdataPython
1637080
from pytg import sender from pytg.exceptions import IllegalResponseException import os import logging import yaml import datetime import time logging.basicConfig(level=logging.INFO) # Ugly hack: increate timeout for document reception # Sub hack: use a list to assign a new value tmp_f = list(sender.functions["load_d...
StarcoderdataPython
90112
#There's so many way to improve these code, but for learning sake. This is good enough. I will revisit these code again in a month or two. to improve it by making it shorter, easier to read import random print("Hey! It's time to duel! Let's go!\n ROCK... \n PAPER... \n SCISSOR!!") round = '' your_score = 0 computer_...
StarcoderdataPython
3351053
<filename>python/CodingInterviews/offer27.py ''' Function: 二叉树的镜像 Author: Charles ''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def mirrorTree(self, root: TreeNode) -> Tre...
StarcoderdataPython
1660572
""" The :mod:`tslearn.datasets` module provides simplified access to standard time series datasets. """ import zipfile import tempfile import shutil import os import warnings from urllib.request import urlretrieve __author__ = '<NAME> <EMAIL>.tavenard[at]univ-rennes2.fr' def extract_from_zip_url(url, target_dir=Non...
StarcoderdataPython
3339024
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
StarcoderdataPython
164610
<gh_stars>0 # MIT License # # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
StarcoderdataPython
4825153
import webbrowser class Movie(object): def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube): """ This can initialize the specific details of the movie, such as title, storyline, poster image url, and trailer url. """ self.title =...
StarcoderdataPython
70568
<gh_stars>10-100 """ DataLoader class """ import math from galaxy.args import str2bool from galaxy.data.batch import batch from galaxy.data.sampler import RandomSampler from galaxy.data.sampler import SequentialSampler from galaxy.data.sampler import SortedSampler class DataLoader(object): """ Implement of Data...
StarcoderdataPython
21245
<filename>app/core/tests/test_admin.py import pytest from django.urls import reverse @pytest.mark.skip(reason="WIP moving to pytest tests") def test_with_authenticated_client(client, django_user_model): email = '<EMAIL>' password = '<PASSWORD>' admin_user = django_user_model.objects.create_superuser( ...
StarcoderdataPython
1742729
"""Example Airflow DAG that creates a Cloud Dataproc cluster, runs the Hadoop wordcount example, and deletes the cluster. This DAG relies on three Airflow variables https://airflow.apache.org/concepts.html#variables * gcp_project - Google Cloud Project to use for the Cloud Dataproc cluster. * gce_zone - Google Compute...
StarcoderdataPython
169637
""" LP Files https://www.ibm.com/support/knowledgecenter/SSSA5P_12.5.0/ilog.odms.cplex.help/CPLEX/FileFormats/topics/LP.html http://www.gurobi.com/documentation/8.0/refman/lp_format.html """ from math import isinf from os import path import pyflip as flp def write_lp_file(model, filename, directory='.'): full_fi...
StarcoderdataPython
1710759
<filename>balancehistory.py #!/usr/local/bin/python3 """ Created on 14 Mar 2018 @author: adeelkhan """ import argparse import csv import datetime from finance.financedb import FinanceDB from finance.textreport import TextReport def load_accounts_from_file(filename): accounts = dict() with open(filename, 'r...
StarcoderdataPython
4822145
from MongoDataSource import * #from SolrDataSource import *
StarcoderdataPython
3370484
<reponame>ur001/sociation_corpus # coding: utf-8 def print_results(title, results): print(title) print ("=" * 20) for word_name, similarity in results: print("{:0.3f}\t{}".format(similarity, word_name)) print("") def query_model_print_results(model, query, count=10): results = mo...
StarcoderdataPython
3374491
from flask import render_template, url_for, flash, redirect, request from steganographer import app, db, bcrypt from flask_login import login_user, current_user, logout_user, login_required import secrets, os from PIL import Image import PIL, numpy # FORMS from steganographer.forms import RegistrationForm, LoginForm, ...
StarcoderdataPython
1729713
<reponame>ovv/sir-bot-a-lot #!/usr/bin/env python # -*- coding: utf-8 -*- import codecs from pathlib import Path import sys from setuptools import setup, convert_path if sys.version_info < (3, 5): raise RuntimeError('SirBot requires Python 3.5+') def load_package_meta(): meta_path = convert_path('./sirbot/...
StarcoderdataPython
3349331
<gh_stars>1-10 import bleach from django.apps import apps from django.conf import settings from django.template import Library from django.template.exceptions import TemplateDoesNotExist from django.template.loader import get_template from django.utils.module_loading import import_string from django.utils.safestring i...
StarcoderdataPython
3291568
<filename>src/lib/datasets/sample/pano_det.py<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.utils.data as data import numpy as np import pandas as pd import torch import json import cv2 import os from utils.image import gaussian_rad...
StarcoderdataPython