id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
4803994 | <reponame>plqualls/web-scraping-challenge
from bs4 import BeautifulSoup
from splinter import Browser
from pprint import pprint
from webdriver_manager.chrome import ChromeDriverManager
from splinter import Browser
import pymongo
import pandas as pd
import requests
def init_browser():
executable_path = {"executable_... | StarcoderdataPython |
1692399 | import unittest
from src.database.entities_pg import Job_Class, Job_Class_To_Job_Class_Similar, Job_Class_Similar, X28_HTML, \
Job_Class_Variant, Classification_Results
class TestEntitiesX28(unittest.TestCase):
def test_entities_are_correctly_mapped(self):
X28_HTML.select()
Job_Class.select()... | StarcoderdataPython |
3233810 | import ast
def split_table(table_name):
"""
Method to convert data from excel to src,target tables
Args:
table_name(str): Table name as argument in Text Format
Returns: src,target tables
"""
table_names = ast.literal_eval(table_name)
table_list = {}
tables = table_names["tab... | StarcoderdataPython |
128517 | import pymysql,requests
def my_db(msg):
conn = pymysql.Connect(
host='192.168.3.11',##mysql服务器地址
port=3306,##mysql服务器端口号
user='yhj666',##用户名
passwd='<PASSWORD>',##密码 <PASSWORD>";~OVazNl%y)?
db='yhj666',##数据库名
charset='utf8',##连接编码
)
sq1 = 'SELECT * FROM cityi... | StarcoderdataPython |
3313981 | <gh_stars>0
#!/usr/bin/env python
import argparse
import cPickle
import traceback
import logging
import time
import sys
import numpy
import experiments.nmt
from experiments.nmt import \
RNNEncoderDecoder, \
prototype_phrase_state, \
parse_input
from experiments.nmt.numpy_compat import argpartition
logg... | StarcoderdataPython |
3389595 | <reponame>TSedlar/dusk-dotfiles
import math
zip_code = 85224
panel_bg = 'transparent'
panel_border = 'none'
real_panel_bg = '#282936' # '#2c3e50'
icon_color = '#e6e6e6'
text_css = {
'css': {
'color': icon_color,
'background-color': real_panel_bg,
'font-size': '14px',
'font-famil... | StarcoderdataPython |
3225373 | # -*- coding: utf-8 -*-
# The dos-azul-lambda request handling stack is generally structured like so:
#
# /\ * Endpoint handlers, named for the DOS operation converted to
# /__\ snake case (e.g. list_data_bundles).
# / \ * ElasticSearch helper functions that implement common query types
# /______\ ... | StarcoderdataPython |
43157 | <reponame>jasarsoft/examples
import os
import time
#fajlovi i folderi koje zelimo da backupujemo su specificirani u listi
izvor = ['C:\\py', '"C:\\Documents and Settings\xinjure\\Desktop\\"']
#primjetite da smo koristili duple navodnike unutar stringa, zbog imena koje sadrzi razmake
#backup ce biti sacuvan u glavnom ... | StarcoderdataPython |
1759230 | <reponame>xproj2501x/ecs-python
from enum import Enum
class LOG_LEVEL(Enum):
NONE = 1 << 0
LOG = 1 << 1
DEBUG = 1 << 2
WARNING = 1 << 3
ERROR = 1 << 4
ALL = 1 << 5
class LogService:
def __init__(self, context, log_level):
"""
:param context:
:type context: strin... | StarcoderdataPython |
1764293 | #!/usr/bin/python
import json
import sys
import random
def generate_uuid ():
rand_uuid_start=''
for i in range(8):
r=random.choice('abcdef1234567890')
rand_uuid_start += r
uuid=rand_uuid_start + "-49e5-4c33-afab-9ec90d65faf3"
return uuid
# function that parses 'source' field of CWL, which contain... | StarcoderdataPython |
4831832 | # -*- coding: utf-8 -*-
import os
import argparse
from flask import Flask, render_template, request
from config import get_random_image_from_db
from config import get_latest_image_from_db
from config import get_all_image_from_db
from config import get_one_image_from_db
from config import set_wallpaper
import change_w... | StarcoderdataPython |
39074 | <reponame>trinhcaokhoa/Mebook_hub<filename>api/urls.py
from django.urls import path
from .views import BookView
urlpatterns = [
path('book_api', BookView.as_view()),
] | StarcoderdataPython |
94560 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 21 11:05:24 2017
The oil and sugar separation (pretreatment) section for the baseline lipid cane biorefinery is defined here as System objects. The systems include all streams and units starting from enzyme treatment to purification of the sugar sol... | StarcoderdataPython |
3340331 | <reponame>TooTouch/tootorch<filename>setup.py<gh_stars>1-10
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(
name = 'tootorch',
version = '0.2',
long_description = long_description,
... | StarcoderdataPython |
3262588 | from django.db import models
#CompanyDomain
from django.urls import reverse
from simple_history.models import HistoricalRecords
class CompanyDomain(models.Model):
name = models.CharField(max_length=250)
description = models.CharField(max_length=255, blank=True, null=True)
created_time = models.DateTimeFi... | StarcoderdataPython |
1683451 | #!/usr/bin/python
#
# Make a 49-block file of 64-byte blocks.
#
with open('distfile.bs64', 'w') as f:
for n in xrange(49):
block = "The crying of lot %s"%n
block += "."*(64-len(block))
f.write(block)
with open('distfile.meta', 'w') as f:
f.write("\x00"*4) #version
f.write("\x00\x... | StarcoderdataPython |
1748238 | <gh_stars>1-10
import uuid
from django.db import migrations, models
from django.utils.encoding import force_text
import mayan.apps.storage.classes
def UUID_FUNCTION(*args, **kwargs):
return force_text(s=uuid.uuid4())
class Migration(migrations.Migration):
dependencies = [
('documents... | StarcoderdataPython |
91171 | """this is pulled from Pololu's library for driving motors here: https://github.com/pololu/drv8835-motor-driver-rpi/blob/master/pololu_drv8835_rpi.py"""
from RPIO import PWM
import RPIO
import lcm
from butterbotlcm import motor_t
lc = lcm.LCM()
A1IN = 17
A2IN = 27
B2IN = 23
B1IN = 22
TIMING = 2000
MAX_SPEED = T... | StarcoderdataPython |
156223 | """
This module contains classes for all the API response related items.
It contains one struct for news items, and two objects for Covid and Weather updates,
which self populate with the API response.
"""
import logging
import os
import requests
logger = logging.getLogger(os.getenv("COVCLOCK_LOG_NAMESPACE"))
# Da... | StarcoderdataPython |
1601955 | <reponame>dougalsutherland/py-sdm<gh_stars>10-100
from __future__ import division, print_function
from collections import Counter, defaultdict
from contextlib import closing
from functools import partial
from glob import glob
import operator as op
import os
import cPickle as pickle
import shutil
import sys
import num... | StarcoderdataPython |
179428 | <gh_stars>0
from typing import List
from infobip_channels.core.models import CamelCaseModel, ResponseBase
from infobip_channels.email.models.response.core import ResultBase
class Error(CamelCaseModel):
group_id: int
group_name: str
id: int
name: str
description: str
permanent: bool
class Re... | StarcoderdataPython |
3394168 | from api.model.food import Food
from api.model.foodComment import FoodComment
from api.model.ingredient import Ingredient
from api.model.inclusion import Inclusion
from api.model.ateIngredient import AteIngredient
from api.model.ateFood import AteFood
from api.model.restaurant import Restaurant
from api.model.diet impo... | StarcoderdataPython |
1748652 | #primer
'''
__author__ = "<NAME>"
__Copyright__ "Copyright September 2019, <NAME>"
__License__ = "GPL"
__email__ "<EMAIL>"
'''
import os, glob
import numpy as np
import pandas as pd
import Bio
from Bio.Seq import MutableSeq, Seq
from Bio import SeqIO
from Bio.SeqUtils import GC
from typing import Tuple
def degenera... | StarcoderdataPython |
112948 | <gh_stars>1-10
t = int(raw_input())
for u in range(0,t):
try:
p = int(raw_input())
punkty = ()
wspolrzedne = ()
for v in range(0,p):
try:
z = raw_input().split()
punkty = punkty.append(z[0])
wspolrzedne = wspolrzedne.append... | StarcoderdataPython |
1686755 | <reponame>Mythologos/data-science-project<gh_stars>0
"""
This file contains the prototypical network.
Currently, it takes three optional arguments:
* learning-rate: a floating point value indicating the learning rate of the neural network.
* max-epochs: an integer indicating the maximum number of epochs for wh... | StarcoderdataPython |
3202607 | <reponame>kzenstratus/Finance<filename>stocks.py
from yahoo_finance import Share
from pprint import pprint
from datetime import datetime, timedelta
import numpy as np
import pandas as pd
import time
DATAFILE = "datafile.csv"
SYMBOLS = ['YHOO', 'GM', 'APPL','C','FB']
pd.DataFrame({'Symbols' : SYMBOLS}).to_csv("datafile... | StarcoderdataPython |
1696048 | """Module defining decoders."""
from opennmt.decoders.decoder import Decoder
from opennmt.decoders.decoder import get_sampling_probability
from opennmt.decoders.rnn_decoder import AttentionalRNNDecoder
from opennmt.decoders.rnn_decoder import RNMTPlusDecoder
from opennmt.decoders.rnn_decoder import RNNDecoder
from o... | StarcoderdataPython |
1706735 | <filename>qutebrowser/fkd/gxeneralaj.py<gh_stars>10-100
#---------------------------------------------------------------------------------------------------
# Ĝeneralaj
#---------------------------------------------------------------------------------------------------
c.url.default_page = "~/.qutebrowser/index.html"
... | StarcoderdataPython |
132873 | class Solution(object):
def XXX(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: bool
"""
count=0
ret=[]
def dfs(root,count):
if root:
count+=root.val
if not root.left and not root.right:
... | StarcoderdataPython |
73545 | def insertion_sort(lst):
"""
Sorts list using insertion sort
:param lst: list of unsorted elements
:return comp: number of comparisons
"""
comp = 0
for i in range(1, len(lst)):
key = lst[i]
j = i - 1
cur_comp = 0
while j >= 0 and key < lst[j]:
lst[... | StarcoderdataPython |
181351 | <filename>aispace/models/base_model.py
# !/usr/bin/env python
# coding=utf-8
# @Time : 2019-07-05 10:27
# @Author : <EMAIL>
# @File : base_model.py
from abc import ABCMeta, abstractmethod
import tensorflow as tf
from aispace.utils.hparams import Hparams
from aispace.utils.registry import Registry
__all__ = [... | StarcoderdataPython |
3379398 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread
from functools import wraps
def thread(func):
@wraps(func)
def wrap(*args, **kwargs):
return Thread(target=lambda: func(*args, **kwargs)).start()
return wrap
| StarcoderdataPython |
3301983 | <reponame>avwx-rest/account-backend<gh_stars>0
"""
Token management router
"""
from datetime import datetime, timedelta, timezone
from bson.objectid import ObjectId
from fastapi import APIRouter, Depends, HTTPException, Response
from account.models.token import (
AllTokenUsageOut,
Token,
TokenUpdate,
... | StarcoderdataPython |
53513 | """
bot implementation.
"""
import os
import boto3
from botocore.exceptions import ClientError
import sendgrid
import ciscospark
# Sets config values from the config file
ACCESS_TOKEN_SPARK = "Bearer " + os.environ['access_token_spark']
MYSELF = os.environ['my_person_id']
SENDGRID_API_TOKEN = os.environ['sendgrid_ap... | StarcoderdataPython |
3273479 | <reponame>codefair2019/VarNotWar
class Artist:
def __init__(self, id, name, genre, desc, albums, inactive):
self.id = id
self.name = name
self.genre = genre
self.desc = desc
self.albums = albums
self.inactive = inactive
def __str__(self):
return... | StarcoderdataPython |
1791561 | #!/usr/bin/env python
import sys
from . import consolekit as ck
from .get_args import get_args
from .path_to_x import path_to_filename, path_to_text
from . import pygments_util
from . import shakyo
from . import text_to_lines
from . import log
def get_example_lines(example_path,
example_text,... | StarcoderdataPython |
1628079 | <filename>infotv_test/tests/test_deck.py
import json
import pytest
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.utils.encoding import force_str
from infotv.views import InfoTvView
EXAMPLE_DECK_DATA = {
"decks": {
"default": [
{
... | StarcoderdataPython |
1722050 | import logging
from flask import jsonify
from flask import render_template
from flask import request
import config
logger = logging.getLogger(__name__)
app = config.app
@app.route('/')
def index():
return render_template('index.html')
@app.route('/controller/')
def controller():
return render_template('... | StarcoderdataPython |
1607999 | #!/usr/bin/python
#
# Copyright 2012 Software Freedom Conservancy
#
# 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 app... | StarcoderdataPython |
1621526 | <filename>mayan/apps/mime_types/backends/file_command.py
from shutil import copyfileobj
import sh
from django.utils.translation import ugettext_lazy as _
from mayan.apps.dependencies.exceptions import DependenciesException
from mayan.apps.storage.utils import NamedTemporaryFile
from ..classes import MIMETypeBackend... | StarcoderdataPython |
98352 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# Invenio-Records-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Facets parameter interpreter API."""
import itertools
import operator
from elasticsea... | StarcoderdataPython |
1720545 | <gh_stars>0
# encoding: utf-8
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SecurityConfig(AppConfig):
"""
'handlers': {
...
'workon_security_disallowed_hosts': {
'level': 'ERROR',
'class': 'workon... | StarcoderdataPython |
59837 | <reponame>dhilipsiva/talks<filename>assets/2019-11-30/app.py
from flask import Flask, request
from flask_opentracing import FlaskTracer
from utils import get_config
from github_pb2 import Request
from gist_client import gist_stub
from repo_client import repo_stub
from account_client import account_stub
from commondb_c... | StarcoderdataPython |
3398338 | <filename>batchglm/train/numpy/base_glm/vars.py
import dask.array
import numpy as np
import scipy.sparse
import abc
class ModelVarsGlm:
"""
Build variables to be optimzed and their constraints.
"""
constraints_loc: np.ndarray
constraints_scale: np.ndarray
params: np.ndarray
a_var: np.nda... | StarcoderdataPython |
1615989 | #!/usr/bin/env python3
"""
Author : patarajarina
Date : 2019-02-11
Purpose: Rock the Casbah
"""
import os
import sys
# --------------------------------------------------
def main():
args = sys.argv[1:]
if len(args) != 1:
print('Usage: {} NUM'.format(os.path.basename(sys.argv[0])))
sys.exit... | StarcoderdataPython |
121996 | import tensorflow as tf
from absl import flags
from absl import app
from absl import logging
from tokenization import FullTokenizer
from tokenization_en import load_subword_vocab
from transformer import Transformer, FileConfig
FLAGS = flags.FLAGS
MODEL_DIR = "/Users/livingmagic/Documents/deeplearning/models/bert-nmt... | StarcoderdataPython |
1636055 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('timeslots', '0003_auto_20141102_0853'),
('common', '0002_report_last_sent'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1653245 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['mymodel51']
class FocalLoss(nn.Module):
def __init__(self, alpha=1, gamma=0):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.alpha = alpha
def get_attention(self, input, target):
... | StarcoderdataPython |
1634044 | <reponame>kaicLimaOliveira/Task-app<gh_stars>0
from flask import Flask, Blueprint
from routers import userRoutes
from routers import pagesRoutes
app = Flask(__name__)
app.register_blueprint(pagesRoutes.pages)
app.register_blueprint(userRoutes.user)
@app.template_filter()
def pretty_date(dttm):
return dttm.strftim... | StarcoderdataPython |
3334724 | """ Helpers for getting the locations of places """
__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2016 Black Radley Limited."
import re # for regular expressions
import urllib # for url encoding
import urllib2 # for getting the gear from Wikipedia
import string
from random import randint
from time import sleep... | StarcoderdataPython |
191049 | <reponame>hwangyoungjae/hwangyoungjae.github.io
# asyncio_lock.py
import asyncio
import functools
def unlock(lock: asyncio.Lock):
print("callback releasing lock")
lock.release()
async def coro1(lock: asyncio.Lock):
print("coro1 waiting for the lock")
async with lock:
print("coro1 acquired lo... | StarcoderdataPython |
3311071 | <filename>carnival/utils.py<gh_stars>1-10
import typing
import os
def envvar(varname: str) -> str:
"""
Получить переменную из окружения
Замена context_ref для carnival v3
:raises: ValueError если переменной в окружении нет
"""
if varname not in os.environ:
raise ValueError(f"{varname}... | StarcoderdataPython |
149102 | import math
def adição(x, y):
return x+y
def subtração(x, y):
return x-y
def multiplicação(x, y):
return x*y
def divisão(x, y):
return x/y
def potencia(x, y):
return x**y
def raiz(x, y):
return math.sqrt(x)
print("\n***** Python Calculator *****")
print('Escolha uma operação (1/2/3/4/5/6)... | StarcoderdataPython |
3289201 | <gh_stars>1-10
# users/app/api/utils/__init__.py
| StarcoderdataPython |
195861 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@File : remove_invalid_question.py
@Time : 2021/1/26 下午10:43
@Author : <NAME>
@Contact : <EMAIL>
"""
import os
import json
import linecache
import ast
from tqdm import tqdm
import logging
logging.basicConfig(
format='%(asctime)s | %(levelname)s | %(name)s ... | StarcoderdataPython |
3287907 | <filename>opengl/gl/raw/gl_1_3.py
#BEWARE: automatically generated code
#This code was generated by /generate/__main__.py
from opengl.gl.raw.bindings import *
@accepts(t.enum)
@returns(t.void)
@binds(dll)
def active_texture(texture):
'''
select active texture unit.
gl.active_texture selects which tex... | StarcoderdataPython |
65255 | <reponame>tranmanhdat/FastSpeech2
import re
import argparse
from string import punctuation
from scipy.io import wavfile
import torch
import yaml
import numpy as np
from torch.utils.data import DataLoader
from g2p_en import G2p
from pypinyin import pinyin, Style
from utils.model import get_model, get_vocod... | StarcoderdataPython |
1792241 | from .brfunds import * | StarcoderdataPython |
109262 | <filename>stock_prediction.py
# -*- coding: utf-8 -*-
"""stock-prediction.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1amgI6VqbJRj8XSLlozTmme5ZPjL3Pi3B
"""
#pip install quandl
# Import required libraries
import pandas as pd
import numpy as ... | StarcoderdataPython |
3348002 | <reponame>michsmit99/snapback
################################################################################
# _ ____ ___ _____ _ _ _ _ #
# / \ / ___|_ _| |_ _|__ ___ | | | _(_) |_ #
# / _ \| | | | | |/ _ \ / _... | StarcoderdataPython |
157965 | <reponame>ManthanKeim/code-attempt1<filename>code1/sample.py<gh_stars>0
print(__name__)
def cool():
print("You are Cool") | StarcoderdataPython |
4819117 | import collections
import os
from statistics import mode
from typing import Any, Iterable, List, Tuple
import joblib
import numpy as np
from xarm_hand_control.processing.classifier_base import Classifier
class RandomForest(Classifier):
"""Classifier with a Multi-layer Percptron using ONNX."""
model: Any
... | StarcoderdataPython |
4800046 | """urlconf for the base application"""
from django.conf.urls import url, patterns
urlpatterns = patterns(
"base.views",
)
| StarcoderdataPython |
3332815 | <gh_stars>0
import argparse
import sys
from pathlib import Path
from .photorename import Renamer
from .version import __version__
version = "1.0.0"
def main():
parser = argparse.ArgumentParser(
description='Bulk rename pictures in a directory')
parser.add_argument('-i', '--input', dest='input', defaul... | StarcoderdataPython |
1744773 | <gh_stars>0
#-*- coding: utf-8 -*-
import datetime, random, math
class ProductModel:
def __init__(self, product_id, product_type, product_name, img_url=None):
self.id = product_id
if (product_type == 1):
self.type = '농산물'
elif(product_type == 2):
self.type = '수산물'
elif(product_type == 3):
self.type ... | StarcoderdataPython |
3370642 | <gh_stars>10-100
#The MIT License (MIT)
#
#Copyright (c) 2017, <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,... | StarcoderdataPython |
4817091 | import sys
from datetime import datetime
from sqlalchemy import INTEGER, TIMESTAMP, VARCHAR, Column, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from . import config
reload(sys)
sys.setdefaultencoding('utf-8')
Base = declarative_base()
class Messag... | StarcoderdataPython |
189232 | # -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
n, q = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
xi, yi = map(int, input().split())
x[i] = xi + yi
y[i] = xi - yi
x_min, x_max = min(x), max(x)
y_min, y_... | StarcoderdataPython |
1601250 | from xml.etree import ElementTree
from .value import Value, Pair
class ResponseParsingError(Exception):
pass
def parse_responses(str_elements):
"""
in the ideal case, str_elements is a string that contains
a set of valid xml elements, but it is not a proper xml
string since they are not encapsul... | StarcoderdataPython |
1725758 | ##
# Copyright 2021 IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
##
from .model import Model
from .symbolic import (Proposition, Predicate, And, Or,
Implies, Bidirectional, Not, ForAll, Exists, Variable,
NeuralActivationClass)
from .utils import (... | StarcoderdataPython |
155769 | import numpy as np
import torch
import math
def TLift(in_score, gal_cam_id, gal_time, prob_cam_id, prob_time, num_cams, tau=100, sigma=200, K=10, alpha=0.2):
"""Function for the Temporal Lifting (TLift) method
TLift is a model-free temporal cooccurrence based score weighting method proposed in
<NAME> and ... | StarcoderdataPython |
14553 | from testing_config import BaseTestConfig
from application.models import User
from application.models import Chatroom
import json
from application.utils import auth
class TestMatch(BaseTestConfig):
test_group = {
"name": "test_group",
"tag": "Poker",
}
test_group2 = {
"name": "test... | StarcoderdataPython |
35502 | # -*- coding: utf-8 -*-
import matplotlib.colors as colorplt
import matplotlib.pyplot as plt
import numpy as np
from sktime.distances._distance import distance_alignment_path, pairwise_distance
gray_cmap = colorplt.LinearSegmentedColormap.from_list("", ["#c9cacb", "white"])
def _path_mask(cost_matrix, path, ax, the... | StarcoderdataPython |
3283707 | <reponame>fossabot/tkterminal<gh_stars>10-100
# 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/LICEN... | StarcoderdataPython |
3382544 | # -*- coding: utf-8 -*-
import scrapy
from MusicCourse.items import CNweikeItem
import json
class CnweikeSpider(scrapy.Spider):
name = 'cnweike'
allowed_domains = ['cnweike.cn']
url = 'http://dasai.cnweike.cn/index.php?r=matchV4/search/GetJson&pageSize=10&type=weike&order=quality&keyword=&subject=7&pointOn... | StarcoderdataPython |
25653 | <reponame>ejkim1996/Unity-JSON-Manager<filename>JSONFormatter.py
import json
from tkinter import Tk
from tkinter.filedialog import askopenfilename
# Python script that allows user to select JSON file using TKinter and format it properly.
root = Tk()
filename = askopenfilename()
root.destroy() # Close the window
read... | StarcoderdataPython |
52908 | <reponame>r3fang/MERlin<filename>merfishdecoder/util/imagereader.py
import hashlib
import numpy as np
import re
import tifffile
from typing import List
from merfishdecoder.util import dataportal
# The following code is adopted from github.com/ZhuangLab/storm-analysis and
# is subject to the following license:
#
# Th... | StarcoderdataPython |
3233737 | <reponame>divindevaiah/e2xgrader
from traitlets import Unicode
import os
import nbformat
from .basemodel import BaseModel
class PresetModel(BaseModel):
task_preset_path = Unicode(
os.path.join(
os.path.dirname(__file__),
"..",
"server_extensions/formgrader/presets/ques... | StarcoderdataPython |
161536 | from ._anvil_designer import RowTemplate1Template
class RowTemplate1(RowTemplate1Template):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
# testing `item`
| StarcoderdataPython |
1652141 | <gh_stars>0
class RevasCalculations:
'''Functions related to analyzing data go there
'''
pass | StarcoderdataPython |
3346561 | import itertools
import time
from collections import defaultdict
from datetime import datetime, timedelta
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
from django.conf import settings
from django.db import connection
from django.http import HttpRequest, HttpResponse
from django.shortcuts i... | StarcoderdataPython |
1708583 | <filename>msa_tools_old/preprocess_msa/untar.py
import tarfile
import os
def un_tar(file_path):
file_name = file_path.strip().split('/')[-1][:-4]
tar = tarfile.open(file_path)
# os.system(f'mkdir -p {file_name}')
tar.extractall(path=file_name)
tar.close()
filestr = """/dataset/ee84df8b/MSA_30T/MSA... | StarcoderdataPython |
3246809 | # -*- coding: utf-8 -*-
"""
==================
Benchmark Examples
==================
This submodule of benchpress consist of a broad range of benchmarks in different languages
"""
from __future__ import absolute_import
from . import util as util
| StarcoderdataPython |
124835 | """empty message
Revision ID: 09d3732eef24
Revises: <PASSWORD>
Create Date: 2020-03-12 15:13:32.832239
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '09d3732eef24'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | StarcoderdataPython |
85990 | <filename>scripts/SerialTransferTest/serialTransfer_loopback_test1.py
import time
from pySerialTransfer import pySerialTransfer as txfer
if __name__ == '__main__':
print('loopback.py')
try:
link = txfer.SerialTransfer('/dev/ttyAMA1')
link.open()
time.sleep(2) # allow some time... | StarcoderdataPython |
3334263 | <reponame>gismaps/PDF_Utils<gh_stars>0
'''
Module for PDF utilities.
'''
from pdf_utils import PDF
from pathlib import Path
from pdfrw import PdfReader, PdfWriter
#from pdfrw import IndirectPdfDict # for file metadata
class PDF(object):
'''
An object that represents a single PDF file.
Contains ... | StarcoderdataPython |
163548 |
#import director
from director import cameraview
from director import transformUtils
from director import visualization as vis
from director import objectmodel as om
from director.ikparameters import IkParameters
from director.ikplanner import ConstraintSet
from director import polarisplatformplanner
from director imp... | StarcoderdataPython |
3283570 | <reponame>NLeSC/eEcology-Annotation-WS
# Copyright 2013 Netherlands eScience Center
#
# 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... | StarcoderdataPython |
3300078 | <gh_stars>10-100
class Facade:
pass | StarcoderdataPython |
84207 | import discord
from discord.ext import commands
async def fetchUser(client: commands.Bot, user: discord.User or str = None) -> discord.User:
if(user == None):
user = await client.fetch_user(client.user.id)
else:
try:
user = await client.fetch_user(user)
except:
... | StarcoderdataPython |
3337805 | <filename>tayne/tayne.py
"""
A script that identified bots mf
"""
# coding: utf-8
# !/usr/bin/python3
# Author: <NAME>
# License: Please see the license file in this repo
# First Create Date: 28-June-2018
# Requirements: minimal. check requirements.txt and run pip/pip3 install -f requirements.txt
# imports section
imp... | StarcoderdataPython |
1664007 | <reponame>apmcleod/harmonic-inference
"""Models that generate probability distributions over chord classifications of a given input."""
from abc import ABC, abstractmethod
from typing import Any, Collection, Dict, List, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd... | StarcoderdataPython |
1782887 | from builtins import super
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.models import User
from django.contrib.messages.views import SuccessMessageMixin
from django.db import transaction
from django.http import HttpResponse, HttpResponseRedire... | StarcoderdataPython |
1625230 | #!/usr/bin/env python3
# Copyright (c) 2020 Bitcoin Association
# Distributed under the Open BSV software license, see the accompanying file LICENSE.
#
# Test merkle proof requests and validation
#
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import connect_nodes, assert_equ... | StarcoderdataPython |
1600845 | <gh_stars>0
import requests
from bs4 import BeautifulSoup
import pyquery
# http://www.cnblogs.com/Albert-Lee/p/6232745.html
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36'} #给请求指定一个请求头来模拟chrome浏览器
web_url = 'https://unsplas... | StarcoderdataPython |
3351817 | """
GPS Keplerian elements => ECEF
<NAME>, Ph.D.
"""
from datetime import datetime, timedelta
import xarray
import numpy as np
def keplerian2ecef(sv: xarray.DataArray) -> tuple:
"""
based on:
https://ascelibrary.org/doi/pdf/10.1061/9780784411506.ap03
"""
if 'sv' in sv and sv['sv'] in ('R', 'S'):
... | StarcoderdataPython |
165843 | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from datetime import datetime
import os
from azure.containerregistry import (
ContainerRepositoryClient,
ContainerRegistryClient,
ContainerRe... | StarcoderdataPython |
1638654 | #!/usr/bin/env python
import os
import requests
import sched
import sys
import time
from GetWeather_Data import get_weather_data
from WeatherBot_Auth import authenticate
def arg_check():
"""
Checks to see if enough arguments are passed to the program.
"""
if len(sys.argv) < 2:
... | StarcoderdataPython |
3381809 | <filename>disas.py
#!/usr/bin/env python3
import sys
from cpu_8051 import *
from termcolor import colored
def help():
print("\t*** Intel 8051(basic) disassembler - coded by Fritz (@anarcheuz) ***\n\n")
print(colored("\tSoftware coded for 256k flash dump, append with 0xff if not the case to avoid any inconvenience! ... | StarcoderdataPython |
4835762 | from django import forms
from django.core.exceptions import ValidationError
from posts.models import Post
class PostForm(forms.ModelForm):
class Meta:
# Use model
model = Post
# Show fields
fields = ['title', 'snippet_text', 'body', 'image', 'status', 'publication_date', 'categor... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.