id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1628045 | <filename>PyMesh/third_party/libigl/python/tutorial/501_HarmonicParam.py
#!/usr/bin/env python
#
# This file is part of libigl, a simple c++ geometry processing library.
#
# Copyright (C) 2017 <NAME> <<EMAIL>> and <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public License
# ... | StarcoderdataPython |
34451 | __author__ = 'hhwang'
| StarcoderdataPython |
1632463 | from .givemedata import Data
from .givemedata import get_provider_from_config
from .givemedata import init_provider
from .version import VERSION as __version__
from . import utils
__all__ = [
Data,
get_provider_from_config,
init_provider,
utils,
__version__,
]
| StarcoderdataPython |
1785021 | <reponame>alphacastio/connectors-uruguay-macro-basics
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
from datetime import datetime
import requests
from alphacast import Alphacast
from dotenv import dotenv_values
# In[2]:
#Armo un diccionario con las urls de los archivos y sus respectivas hoja... | StarcoderdataPython |
1757625 | #!/usr/bin/env python
# coding: utf-8
# # GAN으로 새로운 패션아이템 생성하기
# *GAN을 이용하여 새로운 패션 아이템을 만들어봅니다*
# 이 프로젝트는 최윤제님의 파이토치 튜토리얼 사용 허락을 받아 참고했습니다.
# * [yunjey/pytorch-tutorial](https://github.com/yunjey/pytorch-tutorial) - MIT License
import os
import torch
import torchvision
import torch.nn as nn
import torch.optim as opti... | StarcoderdataPython |
3249644 | <reponame>alexander-paskal/PySOP
"""
Contains basic reinforcement-learning algorithms
Reinforcement Learning comes into play when attempting to learn state values or
an optimal policy for an MDP in which we do not know know the environment i.e.
we don't know our Markovian Transition Model P(s' | s,a).
Without this, w... | StarcoderdataPython |
3335796 | <filename>epab/exc.py
# coding=utf-8
"""
EPAB's exceptions
"""
class ExecutableNotFoundError(FileNotFoundError):
"""
Raised when an executable isn't found
"""
| StarcoderdataPython |
1673021 | # Copyright (C) 2022 <NAME> (<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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | StarcoderdataPython |
3210270 | <gh_stars>0
# -*- coding: utf-8 -*-
# Exercícios by <NAME> (CodingBat)
# A. first_last6
# verifica se 6 é o primeiro ou último elemento da lista nums
# first_last6([1, 2, 6]) -> True
# first_last6([6, 1, 2, 3]) -> True
# first_last6([3, 2, 1]) -> False
def first_last6(nums):
retorno = True
if not 6 in nums:
re... | StarcoderdataPython |
3383033 | import typing
import sys
import numpy as np
import numba as nb
@nb.njit((nb.i8, nb.i8, nb.i8[:, :]), cache=True)
def solve(w: int, h: int, xya: np.ndarray) -> typing.NoReturn:
n = len(xya)
x_mn = y_mn = 0
x_mx, y_mx = w, h
for i in range(n):
x, y, a = xya[i]
if a == 1:
x_mn = max(x_mn, x)
... | StarcoderdataPython |
3196 | <gh_stars>1-10
import requests, time, re, rsa, json, base64
from urllib import parse
s = requests.Session()
username = ""
password = ""
if(username == "" or password == ""):
username = input("账号:")
password = input("密码:")
def main():
login(username, password)
rand = str(round(time.time()*1000))
... | StarcoderdataPython |
1694607 | <filename>src/utils/vsqxt/base.py
#!/usr/bin/env python
from utils.vsqxt.setting import *
class myError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class vPrm():
def __init__(self, params):
[bre, bri, cle, gen, ope] = params
se... | StarcoderdataPython |
55651 | import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import utils
from torch.utils.data import Dataset, DataLoader
from net import model
import math
from tqdm import tqdm
import matplotlib.pyplot as plt
import os
from sklearn.preprocessing import StandardScaler
from torch.optim import lr_scheduler
... | StarcoderdataPython |
170675 | class Chain():
def __init__(self, val):
self.val = val
def add(self, b):
self.val += b
return self
def sub(self, b):
self.val -= b
return self
def mul(self, b):
self.val *= b
return self
print(Chain(5).add(5).sub(2).mul(10))
| StarcoderdataPython |
4808077 | <reponame>mlares/hearsay
# coding: utf-8
import pickle
import numpy as np
from matplotlib import pyplot as plt
import pandas
import seaborn as sns
def redux(D):
index = []
firstc = []
ncetis = []
awaken = [] # lapso de tiempo que esta activa
waiting = [] # lapso de tiempo que espera hasta... | StarcoderdataPython |
41802 | <filename>djnic/cambios/apps.py
from django.apps import AppConfig
class CambiosConfig(AppConfig):
name = 'cambios'
| StarcoderdataPython |
47979 | <filename>morse-stf/stensorflow/homo_enc/homo_mul.py<gh_stars>10-100
#!/usr/bin/env python
# coding=utf-8
"""
Ant Group
Copyright (c) 2004-2021 All Rights Reserved.
------------------------------------------------------
File Name : homo_mat_mul
Author : <NAME>
Email: <EMAIL>
Create Time : 2021/9/30... | StarcoderdataPython |
157171 | <reponame>Lingotek/filesystem-connector
from ltk.actions.action import *
class RmAction(Action):
def __init__(self, path):
Action.__init__(self, path)
self.use_delete = False
def rm_action(self, file_patterns, **kwargs):
try:
removed_folder = False
for pattern i... | StarcoderdataPython |
172215 | import logging
from colorlog import ColoredFormatter
def setup_logging():
logger = logging.getLogger()
logger.setLevel(logging.INFO)
color_formatter = ColoredFormatter(
"%(log_color)s[%(asctime)s] [%(levelname)-4s]%(reset)s - %(message)s",
datefmt='%d-%m-%y %H:%M:%S',
r... | StarcoderdataPython |
1790828 | <reponame>mariogeiger/se3cnn
# pylint: disable=C,R,E1101
import torch
import os
import numpy as np
from scipy.stats import special_ortho_group
class Cath(torch.utils.data.Dataset):
url = 'https://github.com/deepfold/cath_datasets/blob/master/{}?raw=true'
def __init__(self, dataset, split, download=False,
... | StarcoderdataPython |
37391 | from .basic_ctrl import BasicCtrl
from .chassis import Chassis
from .gimbal import Gimbal
from .blaster import Blaster | StarcoderdataPython |
3257235 | """Core classes and functions for GuideMaker."""
import os
import re
import yaml
import logging
import gzip
import hashlib
import statistics
import nmslib
import regex
import gc
from typing import List, Dict, TypeVar, Generator
from itertools import product
from Bio import SeqIO
from Bio.SeqUtils import GC
from pybedto... | StarcoderdataPython |
1646819 | <gh_stars>0
#!/usr/bin/env python
# coding:utf-8
"""
Project Name:
File Name : hello.py
Author : heitao
Contect : <EMAIL>
Time : 2020/10/12 下午10:18
Desc:
"""
print(666) | StarcoderdataPython |
3259625 | #!/usr/bin/env python
#
# Copyright (c) 2013-2018 Nest Labs, 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/licen... | StarcoderdataPython |
3248715 | import enum
from collections import namedtuple
# Agents Enum
class Agents(enum.Enum):
AGENT_GREEDY = "Shortest Distance"
AGENT_A_STAR = "A*"
AGENT_BFS = "BFS"
AGENT_SUPER_STAR = "Super Star"
AGENT_Q_LEARNING = "Q Learning"
# Cell
Cell = namedtuple('Cell', 'x, y')
# Direction Enum
class Direction(... | StarcoderdataPython |
1730750 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import testbed
t = testbed.Testbed()
t.setup_env(app_id='my-app')
t.activate()
t.init_datastore_v3_stub()
t.init_memcache_stub()
| StarcoderdataPython |
1796791 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
author: <NAME>
email: <EMAIL>
license: Apache License 2.0
"""
import warnings
warnings.filterwarnings('ignore')
import time
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import model_selection
from skl... | StarcoderdataPython |
106152 | # -*- coding: UTF-8 -*-
from .helpers import insights_upload_conf
from mock.mock import patch
from pytest import raises
collection_rules = {"version": "1.2.3"}
collection_rules_file = "/tmp/collection-rules"
@patch("insights.client.collection_rules.InsightsUploadConf.get_conf_file")
@patch("insights.client.collect... | StarcoderdataPython |
165319 | <reponame>limacv/Deblur-NeRF
import os
import time
import cv2
import imageio
from tensorboardX import SummaryWriter
from NeRF import *
from load_llff import load_llff_data
from run_nerf_helpers import *
from metrics import compute_img_metric
# np.random.seed(0)
DEBUG = False
def config_parser():
import configa... | StarcoderdataPython |
155296 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 00:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobportal', '0008_remove_person_join_date'),
]
operations = [
migrations.Ad... | StarcoderdataPython |
63996 | <filename>testi2c.py
import RPi.GPIO as gpio
import smbus
import time
import sys
bus = smbus.SMBus(1)
address = 0x04
def main():
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
status = False
while 1:
gpio.output(17, status)
status = not status
bus.write_byte(a... | StarcoderdataPython |
90698 | <reponame>WeNeedThePoh/euromillions-api
import os, requests
from datetime import datetime, date
from bs4 import BeautifulSoup
def get_draws_by_year(year: int) -> list:
url = os.getenv("EUROMILLIONS_WEB_BASE_URL") + '/results-history-'+year
page = requests.get(url)
html = BeautifulSoup(page.content, 'html.... | StarcoderdataPython |
10085 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. 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 the Software without restriction, including without limitation the rights
# to us... | StarcoderdataPython |
185031 | <reponame>best-coloc-ever/globibot
from tornado.web import MissingArgumentError
from tornado.escape import json_encode
from http import HTTPStatus
from functools import wraps
def authenticated(method):
@wraps(method)
def call(self, *args, **kwargs):
if self.current_user is None:
self.set_... | StarcoderdataPython |
143006 | <filename>python/seldon_deploy_sdk/api/environment_api.py<gh_stars>1-10
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: <EMAIL>
Generated by: https:... | StarcoderdataPython |
3204204 | import numpy
# first line float inputs as a list(not integer)
n = list(map(float,input().split()));
# second line one input m
m = input();
# print polyval from numpy library
print(numpy.polyval(n,int(m)));
| StarcoderdataPython |
3209114 | import os
import ccxt
import pymongo
def main():
# get environment variables
mongo_username = os.environ.get("MONGO_USERNAME")
mongo_password = os.environ.get("MONGO_PASSWORD")
#init mongodb
mongo_client = pymongo.MongoClient("mongodb://" + str(mongo_username) + ":" + str(mongo_password) + "@mongodb:27017")... | StarcoderdataPython |
3249515 | from abc import ABCMeta, abstractmethod, abstractproperty
import re
import requests
from oauthlib.oauth2 import InvalidGrantError
from hs_restclient import HydroShareAuthOAuth2, HydroShareAuthBasic
from hydroshare_util.adapter import HydroShareAdapter
from . import HydroShareUtilityBaseClass, ImproperlyConfiguredError
... | StarcoderdataPython |
3345010 | import re
import sys
import unittest
import metricbeat
import getpass
import os
SYSTEM_CPU_FIELDS = ["cores", "idle.pct", "iowait.pct", "irq.pct", "nice.pct",
"softirq.pct", "steal.pct", "system.pct", "user.pct"]
SYSTEM_CPU_FIELDS_ALL = ["cores", "idle.pct", "idle.ticks", "iowait.pct", "iowait.ti... | StarcoderdataPython |
3390200 | <reponame>sofa-framework/issofa<gh_stars>0
import Sofa
import SofaPython.Tools
import json
def exportImageShapeFunction( node, sf, filename_indices, filename_weights ):
sfPath = SofaPython.Tools.getObjectPath(sf)
node.createObject(
"ImageExporter", template="ImageUI", name="exporterIndices",
im... | StarcoderdataPython |
118049 | <gh_stars>10-100
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class NEMMosaic(p.MessageType):
def __init__(
... | StarcoderdataPython |
3362169 | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from functools import update_wrapper
from hashlib import md5
from django.conf.urls import url
from django.contrib.admin import ModelAdmin as DjangoModelAdmin
from django.contrib.admin.utils import flatten_fieldsets, model_format_dict
from django.contrib.... | StarcoderdataPython |
81005 | # -*- coding: utf-8 -*-
import unittest
from .. import distributions
from scipy.integrate import quad
import numpy as np
import scipy.stats
class test_distributions(unittest.TestCase):
def _check_pdfintegral(self, integral, integrale, theory):
integrale = max(integrale, 1e-5)
limits = integral ... | StarcoderdataPython |
3271886 | #!/usr/bin/env python3
import argparse
import re
import functools
from pwnlib.context import context
from pwnlib import constants
from pwnlib.asm import cpp
from pwnlib.util import safeeval
from . import common
p = argparse.ArgumentParser(
description="Looking up constants from header files.\n\nExample: constgre... | StarcoderdataPython |
4803917 | from geopandas import base
if base.HAS_SINDEX:
from rtree.index import Index as RTreeIndex
class SpatialIndex(RTreeIndex):
"""
A simple wrapper around rtree's RTree Index
"""
def __init__(self, *args):
if not base.HAS_SINDEX:
raise ImportError("SpatialIndex needs `rtree`")
... | StarcoderdataPython |
196784 | from enum import Enum
class AnnotationStatus(str, Enum):
OK = "OK"
KO = "KO"
def __str__(self) -> str:
return str(self.value)
| StarcoderdataPython |
110196 | #!/usr/bin/env python3
import argparse
import subprocess
import os, os.path, shutil, sys, tempfile
SOLVERS = {
"lingeling": "-q -t {proof} {cnf}",
"kissat": "-q {cnf} {proof}",
"cadical": "-q {cnf} {proof}",
"cryptominisat5": "--verb 0 {cnf} {proof}",
"satch": "-q {cnf} {proof}",
"picosat": "-... | StarcoderdataPython |
1688612 | """
Challenge #3:
Given a string of numbers separated by a comma and space,
return the product of the numbers.
Examples:
- multiply_nums("2, 3") ➞ 6
- multiply_nums("1, 2, 3, 4") ➞ 24
- multiply_nums("54, 75, 453, 0") ➞ 0
- multiply_nums("10, -2") ➞ -20
Notes:
- Bonus: Try to complete this challenge in one line!
U... | StarcoderdataPython |
3241724 | <gh_stars>0
"""The base classes for boards and group of boards."""
import atexit
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Type
from j5.backends import Backend
if TYPE_CHECKING:
from j5.components import Component... | StarcoderdataPython |
1691344 | from datetime import datetime
from freezegun.api import freeze_time
from ee.clickhouse.models.group import create_group
from ee.clickhouse.util import ClickhouseTestMixin
from posthog.test.base import APIBaseTest
class ClickhouseTestGroupsApi(ClickhouseTestMixin, APIBaseTest):
maxDiff = None
@freeze_time("... | StarcoderdataPython |
1736597 | from django.core.management.base import BaseCommand
import intake.services.bundles as BundlesService
class Command(BaseCommand):
help = 'Sends an email about unopened applications'
def handle(self, *args, **options):
BundlesService.count_unreads_and_send_notifications_to_orgs()
self.stdout.w... | StarcoderdataPython |
1616936 | class OpenIDClients(object):
"""
ORM Class representing the table openidclients
"""
def __init__(
self,
client_id,
client_name,
application_type,
redirect_uris,
client_id_issued_at,
client_secret,
client_secret_expires_at,
response... | StarcoderdataPython |
3279171 | #!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
##################################################################
# Documentation
"""Module providing a class for all discourse-aware analyzers.
Attributes:
BaseAnalyzer (class): abstract base for all discourse-aware sentiment
analyzers
"""
########... | StarcoderdataPython |
1750111 | <filename>submodmax/value_reuse/abstract_double_greedy_search.py
import warnings
from typing import Set, TypeVar, Tuple, Iterable
from submodmax.value_reuse.abstract_optimizer import AbstractSubmodularFunctionValueReuse, AbstractOptimizerValueReuse, FuncInfo
from submodmax.value_reuse.set_info import SetInfo
E = Type... | StarcoderdataPython |
3278289 | #! env python
# -*- coding: utf-8 -*-
# Ant-Book.main.py
# Date: 2022/01/01
# Filename: main.py
# Author: koucs
INF = float('inf')
updated = False
def main():
N, ML, MD = map(int, input().split())
AL, BL, DL = [0] * ML, [0] * ML, [0] * ML
for i in range(ML):
AL[i], BL[i], DL[i] = map(int, input(... | StarcoderdataPython |
3310010 | <filename>OnlineJuge/leetcode/037/037b.py<gh_stars>0
import copy
class Solution(object):
def solveSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: void Do not return anything, modify board in-place instead.
"""
boardnew = [list(i) for i in board]
#print b... | StarcoderdataPython |
31644 | <reponame>e-mayo/mscreen
########################################################################
#
# Vision Macro - Python source code - file generated by vision
# Thursday 01 July 2010 13:22:44
#
# The Scripps Research Institute (TSRI)
# Molecular Graphics Lab
# La Jolla, CA 92037, USA
#
... | StarcoderdataPython |
1745114 | <reponame>Clymsw/xHVI-2020
# # # to calculate the shape fitness of the airfoil, give each a score accodring to the badness of each criteria
import itertools
import numpy as np
def shape_fit(coord,thickness_TE):
index_list=np.where(np.sign(coord[:-1,1]) != np.sign(coord[1:,1]))[0]+1
index=index_list[1]
lo=c... | StarcoderdataPython |
1668230 | <reponame>ASRCsoft/skykit
'''
Extensions of xarray Datasets and DataArrays
'''
import copy as cp
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import wxprofilers.utils as rasp
import wxprofilers._cape as cape
# rewriting as an xarray module, following the guid... | StarcoderdataPython |
1641122 | from abc import ABC, abstractmethod
from Carta import *
from Jogador import *
class AbstractMesa(ABC):
'''
Retorna o Jogador 1
@return o Jogador 1
'''
@property
@abstractmethod
def jogador1(self) -> Jogador:
pass
'''
Retorna o Jogador 2
@return o Jogador 2
'''
... | StarcoderdataPython |
178090 | '''
Copyright 2017-present, Airbnb 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 or agreed to in writing, sof... | StarcoderdataPython |
3369941 | <filename>main/models.py
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.conf import settings
from django.dispatch import receiver
from django.db.models.signals import post_save
import uuid
import re
from main import utils
class User... | StarcoderdataPython |
1647131 | <gh_stars>0
from flask import Blueprint, render_template, flash, \
redirect, url_for, request, session
from app.cars.forms import AddNewCarForm, EditCarForm, searchCarsForm
from flask_login import current_user, login_user, logout_user, login_required
from app.models import User, Cars
from app.funcs impo... | StarcoderdataPython |
4826204 | <reponame>awesome-archive/Automatic_Speech_Recognition<gh_stars>0
# -*- coding:utf-8 -*-
import os
import numpy as np
import scipy.io.wavfile as wav
from calcmfcc import calcMFCC_delta_delta
PHN_LOOKUP_TABLE = ['aa', 'ae', 'ah', 'ao', 'aw', 'ax', 'ax-h', 'axr', 'ay', 'b', 'bcl', 'ch', 'd', 'dcl', 'dh', 'dx',
... | StarcoderdataPython |
1744567 | matriz = [[0,0,0],[0,0,0],[0,0,0]]
for l in range(3):
for c in range(3):
matriz[l][c] = int(input(f'Digite um valor para a posição[{l},{c}]: '))
print('-='*30)
for l in range(3):
for c in range(3):
print(f'[{matriz[l][c]:^5}]',end='')
print() | StarcoderdataPython |
1798981 | <reponame>WillianVieira89/WillianVieira89-Python_Geek_University
letra = input('digite a letra desejada maiscula para conversão: ')
print(letra.lower())
| StarcoderdataPython |
1618176 | <filename>tests/Cartesian3d.py<gh_stars>0
import unittest
import GMatElastic.Cartesian3d as GMat
import numpy as np
class Test_main(unittest.TestCase):
def test_Elastic(self):
K = 12.3
G = 45.6
gamma = 0.02
epsm = 0.12
Eps = np.array([[epsm, gamma, 0.0], [gamma, epsm, 0... | StarcoderdataPython |
1614647 | <filename>modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional inte... | StarcoderdataPython |
3265590 | import json
import random
def trans_index(origin_dict):
new_dict = {}
for key in origin_dict:
new_dict[int(key)] = origin_dict[key]
return new_dict
class UserSim():
def __init__(self, config):
with open(config.item_info_path, 'r') as f:
self.item_info = json.load(f)
... | StarcoderdataPython |
3278881 | <gh_stars>100-1000
from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | StarcoderdataPython |
3352226 | # -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import os
import cv2
import numpy as np
from ..dataset_base import DatasetBase
from .nyuv2 import NYUv2Base
class NYUv2(NYUv2Base, DatasetBase):
def __init__(
self,
data_dir=None,
n_classes=40,
split="train",
... | StarcoderdataPython |
129814 | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Created on 22.09.2010
@author: SIGIESEC
'''
from commons.config_if import AutoConfigurable
from commons.core_if import EnumerationItem, Enumeration
class HeaderListSupply(AutoConfigurable):
def get_header_list(self):
raise NotImplementedError(self.__clas... | StarcoderdataPython |
188807 | <gh_stars>1-10
"""
Author: <NAME> - <EMAIL>
Date: 2020-09-21
Make sure your file is in geojson and projection in: EPSG:4326 - WGS 84
This code will parse each street and create points along it every DIST meters.
(e.g., 50 meters).
The output is a file names: points_DIST.csv
Dependencies:
- geopy.distance
"""
i... | StarcoderdataPython |
3380533 | """
Functions to transform firework model files to netCDF files
"""
import logging
import os
import sys
import numpy as np
import datetime
import xarray as xr
import click
import smoke.utils.utilities as utilities
from pathlib import Path
from smoke.load.parsers import *
logging.getLogger(__name__).addHandler(loggin... | StarcoderdataPython |
4834063 | from django.contrib.auth.models import AnonymousUser
from django.template import Context, Template
from django.test import RequestFactory
from django.test.utils import override_settings
from cms import constants as cms_constants
from cms.cms_menus import CMSMenu
from cms.test_utils.testcases import CMSTestCase
from cm... | StarcoderdataPython |
142171 | #!/usr/bin/env python3
def palindrome(x):
return str(x) == str(x)[::-1]
def number_palindrome(n, base):
if base == 2:
binary = bin(n)[2:]
return palindrome(binary)
if base == 10:
return palindrome(n)
return False
def double_base_palindrome(x):
return number_palindrome(x... | StarcoderdataPython |
3355923 | <reponame>fsimkovic/cptbx<filename>conkit/core/sequencefile.py
# coding=utf-8
#
# BSD 3-Clause License
#
# Copyright (c) 2016-21, University of Liverpool
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are... | StarcoderdataPython |
188757 | <filename>utils/fancy_print.py
class FancyPrint(object):
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def echo(stuff_to_print, style):
bash_color = getattr(FancyPri... | StarcoderdataPython |
1783358 | import sys
import time
import numpy as np
import trimesh
import glplotlib.glplot as plt
from glplotlib import MeshData
def load_mesh(path):
mesh = trimesh.load(path)
params = {
'vertexes': mesh.vertices,
'faces': mesh.faces,
'faceColors': mesh.visual.face_colors.astype(np.float32) / 25... | StarcoderdataPython |
3356091 | <reponame>kimihitosugiyama/text_analysis<filename>sentiment_model/utils/dataloader.py
# 自然言語処理による感情分析(BERT)
import glob
import os
import io
import string
import re
import sys
import random
import spacy
import torchtext
import mojimoji
import string
import time
import numpy as np
from tqdm import tqdm
import torch
fr... | StarcoderdataPython |
3216318 | def funcao_raizes (a, b, c):
#Discriminante
Delta = (b**2) - 4*a*c
import math
if Delta > 0:
x1 = (-b + math.sqrt(Delta))/(2*a)
x2 = (-b - math.sqrt(Delta))/(2*a)
if x1 >= x2:
print("as raízes da equação são",x1,"e",x2)
else:
... | StarcoderdataPython |
1620548 | from django.apps import AppConfig
class TransferappConfig(AppConfig):
name = 'transferapp'
| StarcoderdataPython |
1621886 | from typing import Any, Dict, Optional, Union
from trakt.core.exceptions import ArgumentError
from trakt.core.models import Episode, Movie
from trakt.core.paths.path import Path
from trakt.core.paths.response_structs import EpisodeScrobble, MovieScrobble, Show
from trakt.core.paths.suite_interface import SuiteInterfac... | StarcoderdataPython |
1702088 | import boto3
import json
from base64 import b64decode
from dynamodb_json import json_util
import numpy as np
from decimal import *
from collections import OrderedDict
iot_data = boto3.client('iot-data')
dedup_table_name='dedup-table'
counts_table_name='counts-table'
dealer_hand_table='dealer-hand'
region = 'us-east-1... | StarcoderdataPython |
3370607 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author : 陈坤泽
# @Email : <EMAIL>
# @Date : 2020/10/21 09:22
import time
import hmac
import hashlib
import base64
import urllib.parse
import requests
class WeixinRobot:
""" 企业微信 机器人 """
def __init__(self, url):
self.url = url
def push_text(se... | StarcoderdataPython |
3271062 | <filename>src/calmjs/tests/test_testing.py
# -*- coding: utf-8 -*-
import unittest
import sys
import tempfile
from pkg_resources import WorkingSet
from pkg_resources import Requirement
import os
from os.path import exists
from os.path import join
from os.path import normcase
from os.path import realpath
from shutil i... | StarcoderdataPython |
196263 | import numpy as np
class GridMove:
def __init__(self, grid):
self._Grid = grid
self._height = grid.shape[0]
self._width = grid.shape[1]
def _in_bound(self, x, y):
if x < 0 or x >= self._height:
return False
if y < 0 or y >= self._width:
return F... | StarcoderdataPython |
1622870 | from setuptools import setup, find_namespace_packages
setup(
python_requires='>=3.7',
packages=find_namespace_packages(include=["kss.*"]),
package_data={'kss.license': ['resources/*']},
)
| StarcoderdataPython |
3205715 | for sheepCounted in [0,1,2,3,4,5,6,7,8,9]:
print("I have counted "+str(sheepCounted)+"sheep.")
print("I fall asleep.") | StarcoderdataPython |
1600991 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from fuji_server.models.base_model_ import Model
from fuji_server.models.data_provenance_output_inner import DataProvenanceOutputInner # noqa: F401,E501
from f... | StarcoderdataPython |
1632570 | <reponame>SinaMostafanejad/MolSSI_project_FSHXF<filename>examples/thermostat/run-NHC.py
from molecule import Molecule
import qm, mqc
from thermostat import NHC
import numpy as np
from qm.dftbplus.dftbpar import max_l
# This file is to perform molecular dynamics for periodic system with thermostat
# geom is geometry in... | StarcoderdataPython |
111773 | <reponame>jurasofish/mip_cvxpy<filename>mip_cvxpy/tests/test_benchmarks.py
import cvxpy as cp
from cvxpy.tests.base_test import BaseTest
import numpy as np
import time
from mip_cvxpy import PYTHON_MIP
def benchmark(func, iters=1, name=None):
vals = []
for _ in range(iters):
start = time.perf_counter()... | StarcoderdataPython |
3314770 | <filename>pronomial/__init__.py<gh_stars>0
from pronomial.utils import predict_gender, pos_tag, word_tokenize, is_plural
class PronomialCoreferenceSolver:
@staticmethod
def solve_corefs(sentence, lang="en"):
# universal tagset, langs can override these depending on pos tagger
# model
P... | StarcoderdataPython |
129098 | <gh_stars>1-10
from logging import Logger
from typing import Dict, List, Tuple
import numpy as np
import pandas as pd
import plotly.graph_objs as go
import torch
from scipy.spatial.distance import cosine
from sklearn.manifold import TSNE
from sklearn.preprocessing import normalize
from src.core.common.symbol_id_dict ... | StarcoderdataPython |
71976 | <reponame>ChristianCastr0/CMPE172-StorageBox<filename>project1/routes.py
from flask import render_template, url_for, flash, redirect, request
import cgi
from project1 import app, db, bcrypt
from project1.models import User, File
from project1.forms import RegistrationForm, LoginForm
from flask_login import login_user, ... | StarcoderdataPython |
3334785 | # -*- coding: utf-8 -*-
# !usr/bin/env python
import json
from comm.log import Logger
g_dic_sod_cfg = {}
#SOD配置初始化
def InitConfig():
str_cfg_path = "model/sod/setting/config.json"
try:
f_config = open(str_cfg_path, 'r+')
dic_cfg = json.loads(f_config.read())
f_config.close()
return dic_cfg
except Exception... | StarcoderdataPython |
3312669 | <filename>assignments/assignment2/layers.py
import numpy as np
def l2_regularization(W, reg_strength):
"""
Computes L2 regularization loss on weights and its gradient
Arguments:
W, np array - weights
reg_strength - float value
Returns:
loss, single value - l2 regularization loss
... | StarcoderdataPython |
3346975 | <reponame>pmwheatley/eve
import time
from datetime import datetime
import simplejson as json
from bson import ObjectId
from bson.dbref import DBRef
from eve.methods.common import serialize, normalize_dotted_fields
from eve.tests import TestBase
from eve.tests.auth import ValidBasicAuth, ValidTokenAuth, ValidHMACAuth
... | StarcoderdataPython |
3361967 | <reponame>KAIST-AILab/End-to-End-Enc-Dec_DSTC9
import argparse
import json
import re
import sys
from nltk.translate.bleu_score import sentence_bleu
from nltk.translate.meteor_score import single_meteor_score
from rouge import Rouge
from dataset_walker import DatasetWalker
RE_ART = re.compile(r'\b(a|an|the)\b')
RE_PU... | StarcoderdataPython |
1641284 | # import sqlite3
# db = sqlite3.connect('storage.db')
# db.execute("select name from sqlite_master").fetchall()
# db.execute("PRAGMA table_info('file_transfers')").fetchall()
import sqlite3
db = sqlite3.connect('storage.db')
for e in db.execute("select name from sqlite_master").fetchall():
print(e[0])
for rec... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.