import order eslint, how to match folder but not subfolder - eslint

I am using eslint and import/order
I have a list of import like this :
import * from '~core/common-workspace';
import * from '~core/feature-user';
import * from '~core/function-account/components';
import * from '~core/function-account/contexts';
import * from '~anyxcoreshared-graphql';
import * from '../../../routing';
I would like to sort those import using eslint import/order so that the result is
import * from '~core/common-workspace';
import * from '~core/feature-user';
import * from '~core/shared-graphql';
import * from '~core/function-account/components';
import * from '~core/function-account/contexts';
import * from '../../../routing';
basically ~core/** in a group and ~core/**/** in another group.
Is it possible ?
cause I tried to setup some rule for each but it always match all type into a single way
{
"pattern": "{~anyx/**}",
"group": "internal",
"position": "before"
}, {
"pattern": "{~anyx/**/**}",
"group": "internal",
"position": "after"
}

Related

Unable to write JSON data into InfluxDB 2.x using python client

I'm trying to insert a simple json data into the InfluxDB 2.x using python client: influxdb_client.
The code create the measurement and all the fields and tags but it does not insert the data.
This is how I'm connecting to InfluxDB:
from datetime import datetime
from influxdb_client import InfluxDBClient as FluxDBClient
from influxdb_client import Point, WriteOptions
from influxdb_client .client.write_api import SYNCHRONOUS
api_token = "gC4vfGRHOW_OMHsXtLBBDnY_heI76GkqQgZlouE8hNYZOVUVLHvhoo79Q-5b0Tvj82rmTofXjywx_tBoTXmT8w=="
org = "0897e8ca6b394328"
client = FluxDBClient(url="http://localhost:8086/", token=api_token, org=org, debug=True, timeout=50000)
Here is the code to insert data:
points = [{
"measurement": "temp",
"time": datetime.now(),
"tags": {
"weather_station": "LAHORE",
"module_detail_id": 1,
},
"fields": {
"Rad1h": 1.2,
"TTT": 100,
"N": 30,
"VV": 20,
"power": 987,
}
}]
options = WriteOptions(batch_size=1, flush_interval=8, jitter_interval=0, retry_interval=1000)
_write_client = client.write_api(write_options=options)
_write_client.write("Test", "0897e8ca6b394328", points)
_write_client.__del__()
client.__del__()
When I run the script, I get 204 response in return, which means that the write query is executed successfully. But I'm getting no record, as you can see in the image below:

After setting "type" field to module, import error still persist

After reading how I can use import statement in node docs and configure it in the package.json, the import error still persist. My requirement is that I don't want to use the require statement.
Is it something that I'm not seeing???
Error output on console.
Package.json
{
"name": "memory-server",
"type": "module",
...
...
}
Exported Class
export default class testDBHelper{
*Blah Blah Blah*
}
Imported Class
import TestDbHelper from "../testUtils/testDBHelper";

How to send(set) parameter dictonaryy to zeep client

Sorry if this question is already asked.
I am trying to send some parameter as dict, but i am getting results as none or not note found.
in parameter i am sending NodeName(GOAFB) and want to change its NodeDetails as mention in param.
And this node name is available on the address, check with get method(Shown in snapshot).
Below is the code i tried
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.wsse.username import UsernameToken
import json
wsdl = "http://10.2.1.8/ws/17.0/Bhaul.asmx?wsdl"
session = Session()
client = Client(wsdl, transport=Transport(session=session),wsse=UsernameToken('admin','password'))
param = {
"Ib440ConfigSet": {
"NodeName": "GOAFB",
"NodeDetail": {
"Custom": [
{
"Name": "Circle",
"Value": "KOLKATA"
},
{
"Name": "SGW",
"Value": "1010"
}
]
}
}
}
dd=client.service.Ib440ConfigGet("GOAFB")
client.service.Ib440ConfigSet(*param)
Below snapshot contains results:
Please support how to make it working
In order to send a dict we need to assign double *
So this should work for you:
client.service.Ib440ConfigSet(**param)

How to publish a npm module that can be auto import in WebStorm?

I try to publish an easy module like follow:
the file list is:
|--[src]
| |--[share]
| |--share.moduel.ts
| |--index.ts
|
|
|--package.json
|--index.ts
package.json
{
"name": "my-common",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"typings": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
index.ts
export { ShareModule } from './src/share/index';
src/share.module.ts
import {NgModule} from "#angular/core";
import {CommonModule} from "#angular/common";
import {FormsModule} from "#angular/forms";
#NgModule({
imports: [
CommonModule,
FormsModule
],
declarations: [],
exports: [CommonModule,FormsModule]
})
export class ShareModule { }
src/index.ts
export { ShareModule } from './share.module';
After I publish the npm module,and then npm install my-common, I try to press Alt + Enter on code 'ShareModule' in order to auto organize import statement, but it doesn't show the tab "Add import statement" which works like the Angular2 HttpModulem, FormModule, etc.
So how could I make my own module that can be auto import by key Alt + Enter in WebStorm like other Angular2's official module? Are there some key point I missed?
Finally,I find how to make it work.
Step 1
create two file in your **/src/** folder like follow:
index.d.ts
index.ts
Step 2
edit your index.d.ts
you show export the class you want to use Alt + Enter to import in WebStrom
for example
export declare class ShareModule {
}
Step 3
edit your index.ts like follow:
export {ShareModule} from './share/share.module';
Step 4
make two file in / folder like follow
index.ts:
export * from './src/index';
index.d.ts:
export * from './src/index'
Finally, the files should like follow:
|--[src]
| |--[share]
| | |--share.moduel.ts
| |--index.ts
| |--index.d.ts
|
|
|--package.json
|--index.ts
|--index.d.ts
Now you can import your class by Alt + Enter

Publicly Defined APIDoc Definitions

I am using apiDoc for documentation in Sails.js app. And, last week I saw someone define responses being used by multiple controllers in a file named api_definitions.js
Example
/*
* #apiDefine UserSuccessExample
* #apiSuccessExample Success-Response:
* HTTP/1.1 201 OK
* {
* "message": "User Created successfully",
* "user" : {
* "displayname": "somedisplayname",
* "lastname": "ALastName",
* "firstname": "AFirstName",
* "email": "sososo#soos.so",
* "phonenumber": "0839293288"
* },
* "token" : "ey.jkernekrerkerkeekwewekwbejwbewbebewbwkebebbwbeibwubfebfebwiee"
* }
*/
And, in each of the controllers, referenced it using the normal Use Parameter #apiUse UserSuccessExample. But when I tried it, I was getting an error in my console saying, it wasn't defined:
Error
error: Referenced groupname does not exist / it is not defined with #apiDefine.
{ File: 'api/controllers/UserController.js',
Block: 2,
Element: '#apiUse',
Groupname: 'UserSuccessExample',
Definition: '#apiUse group',
Example: '#apiDefine MyValidGroup Some title\n#apiUse MyValidGroup' }

Resources